-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multithreaded applications #2
Comments
We should start by simply supporting case 1. |
Great, what multi threaded target app would you propose for developing/testing? |
IDK, maybe a web server not too huge |
"good first issue" is a lie ;) |
I think we can achieve it by walking all threads on But, the question is how to deal with threads death and born? I think, that first task we can solve via hooking exit functions and check if exit target is our client. If so -- we can just unlink it in pid struct. ( pid struct * + 0x08 offset on old kernels. https://elixir.bootlin.com/linux/v4.19.160/source/include/linux/pid.h#L62 ) What about borned threads -- I think we can just terminate them. But I think we should restore stack and memory state of father thread in this case. To prevent sync troubles and false-positive crashes? So, we'll have:
We just need to have detailed list of them. And so, when
One more question is design of calling P.s.
I fix some things and switch to ftrace current branch. Already send PR. Check it, please, when have some time. |
I want to add the support to snapshotting the state of all threads.
There are 2 cases:
Case 1 is simple, we just terminate thread B when A does the snapshot restore.
Case 2 has 2 subcases:
2.1. thread B is still alive when A does the restore
2.2. thread B is already dead when A does the restore
For 2.1 we stop thread B, restore the context and restart it. For 2.2., we hook thread exit and instead of letting B to exit before A, we pause it marking it as waiting for restore. When A calls restore, we restore also the context of B and restart it.
The current implementation work at task_struct level and does not support this. I will code this eventually, not enough time ATM, if someone wants to pick this issue feel free to do that but before comment here.
The text was updated successfully, but these errors were encountered: