dlinject icon indicating copy to clipboard operation
dlinject copied to clipboard

no protect for mutiple threads

Open anatasluo opened this issue 1 year ago • 4 comments

anatasluo avatar Nov 07 '23 18:11 anatasluo

Could you be more specific?

DavidBuchanan314 avatar Nov 07 '23 20:11 DavidBuchanan314

Could you be more specific?

For example, for a process consisting of multiple threads, when you continue the process, multiple threads may all execute this segment of code. It leads to several problems:

  1. dl_open is executed several times.
  2. one thread modifies the text while the other thread executes it, which may lead to segment fault.

Maybe steps should be like this:

  1. stop all threads
  2. continue one threads
  3. stop this threads again
  4. continue all threads

anatasluo avatar Nov 10 '23 17:11 anatasluo

@DavidBuchanan314

anatasluo avatar Nov 10 '23 17:11 anatasluo

IIUC, there is no execute-while-writing race condition if you use the cgroup freezer stop method.

However, when the threads are restarted, you are correct that multiple threads could theoretically enter the shellcode simultaneously. Do you have a test program that exhibits this behaviour?

DavidBuchanan314 avatar Nov 10 '23 19:11 DavidBuchanan314