Skip to content
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

Unable to get backtraces from client program from SIGSEGV handler #9

Open
daniel-grumberg opened this issue Jan 28, 2019 · 2 comments
Assignees

Comments

@daniel-grumberg
Copy link
Collaborator

daniel-grumberg commented Jan 28, 2019

When a signal action is attached from the plugin, it is not possible to properly locate symbols for functions in the client program in order to present the user with a backtrace for debugging purposes.

A minimal reproduction is given with this patch. This can be applied by the usual means using the patch utility from the top level of the SaBRe tree with the following command patch -p1 < sigsegv_repro.patch

To observe the unexpected behaviour, build the SaBRe tree normally. This will produce an additional subdirectory in the build tree under plugins/sigsegv-repro. This contains two products, a shared object plugin for SaBRe that installs a signal handler for SIGSEGV from within the plugin, the resulting shared object is libbacktrace-plugin.so. The other build product is a small sample executable that triggers a segmentation fault by attempting to dereference the NULL pointer with three levels of function call indirection to be able to observe a backtrace, this product is called backtrace-offender. The command to observe the issue is ./sabre plugins/sigsegv-repro/libbacktrace-plugin.so plugins/sigsegv-repro/backtrace-offender

To be able to observe the expected behaviour of the signal handler, it needs to be installed from the sample executable backtrace-offender. The build system provides a facility to conveniently enable this functionality by passing the -DHANDLER_IN_OFFENDER=ON option to CMake when configuring the build system. You can run the same command as previously to observe a correct backtrace.

@parras
Copy link
Collaborator

parras commented Jan 30, 2019

Thanks! Working on it...

@parras
Copy link
Collaborator

parras commented Apr 11, 2019

So a partial solution would be to use dlmopen() instead of our custom ELF loader. This would only work for PIE binaries though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants