-
Notifications
You must be signed in to change notification settings - Fork 566
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
SIGSEGV when the client loads the auxiliary library and the auxiliary library invokes printf. #6500
Comments
|
Hi~, I just tried your mentioned three steps. (It should be noted that defining a large thread-local array inside the auxiliary library can also cause a crash, even without using With -debug option enabled, I didn't find any assertion failure, the full output is shown below:
I also tried loading the library in event_module_load, the crash still happens. And, for gdb, the full interactive output is pasted below:
|
Paste the lines in the message with the header |
Thanks for your guides, I tried your suggestions and get this stack dump:
Source code at frame #9 and #10 is as below: #9:
#10:
|
What is the glibc version? Is it > 2.36? I'm afraid this is the continuation of #5437 where the glibc developers added hidden undocumented interfaces which break DynamoRIO's private loader. Workarounds were put in for glibc 2.34, 2.35, and 2.36: see e.g. #5902. But this glibc decision to not keep libraries separate with clean interfaces puts the whole private loader approach on shaky footing and means there have to be hacky workarounds every time glibc changes something. The long-term support for the private loader, and being able to just load some library that calls regular functions like printf like you did here, is unclear -- see discussion in #5437. |
My glibc version is 2.35, and I have some new observations about this crash. Introducing large thread-local variables into
My modified libtest.c is presented below:
Another observation worth noting: In the stack dump presented in the previous response, the instruction which cause segfault is:
When I manually insert an inline assembly with the instruction into I am uncertain whether these two crashes stem from the same underlying issue, but I hope this information will be helpful. |
Given that, as explained in the referenced #5437, the long-term future of private loader support in DR is in doubt due to glibc changes making it difficult to keep maintaining that support, I'm not sure there are developers who are eager to spend time on corner cases of private libraries that are not impacting the regression tests (or their own primary projects). Also, you're referencing some pthreads symbols, and note that as documented private pthreads code has never been officially supported (part of the headache with 2.34+). If you'd like to work on support for the private loader issues you are hitting on glibc 2.35 (note that what you are doing may well work fine on versions < 2.34) such contributions are welcome. If it's like the other #5437 issues, there may be missing undocumented initialization calls or other pieces (see those PR's); you would have to study how these libraries work normally and compare to the private version. |
Describe the bug
Necessary Conditions:
client.so
wraps the functionfunc_for_hook
in the target application.func_to_hook
by the target application,client.so
executespre_func_for_hook
.pre_func_to_hook
,client.so
usesdr_load_aux_library
to load the functionlibtest_main
fromlibtest.so
.client.so
executeslibtest_main
.libtest_main
, the function simply callsprintf
and returns its returnThen, drrun crashes.
To Reproduce
My client.c is:
My app's source is:
My libtest is:
My makefile is:
Let's assume that the
DYNAMORIO_DIR
variable in the Makefile has been correctly set to the relevant path.To reproduce the crash, place all the files in the same directory and execute
make test
.To simplify the reproduction process, I have packaged these files into an attachment reproduce.zip. Please find the attached file for your convenience.
Expected behavior
The
libtest_main
is expected to normally return.Screenshots or Pasted Text
Output from my pc:
Versions
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: