-
Notifications
You must be signed in to change notification settings - Fork 571
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
build fails on musl-libc based linux systems (for example alpine, void, sabotage) #1973
Comments
a possible solution could be to use separate fds for the logging purposes rather than hijacking the ones of the app. |
Unfortunately it is sometimes unavoidable to break abstractions and take "illegal" steps for low-level systems like DR, in this case to load a private copy of libc and isolate it from the app's copy. I don't think tools are willing to give up printing directly to stdout or stderr: interleaving tool output with app output can be very valuable for a tool user. |
can you elaborate about "load a private copy of libc and isolate it from the app's copy" ? |
Malloc & co. are redirected to DR's own allocator. See http://dynamorio.org/docs/using.html#sec_extlibs |
Presumably there is no portable way of doing this redirection of a stream. There's fdopen() for converting a file descriptor into a stream, and there's freopen() for redirecting an existing stream to a new file, but there doesn't seem to be a way of redirecting an existing stream to an existing stream or file descriptor. |
in that case may i suggest that this feature only gets activated if the non-portable prerequisites exist ? for example by doing a configure check. |
These changes seem sufficient to allow building dynamorio on an alpine linux container, and to successfully run some basic clients. No further testing was done. While this can successfully build against musl, there are probably some things broken at runtime. Issue: #1973
This pull request allows DynamoRIO and all the tests to be built on musl libc, - Introduce MUSL macro and detect for musl libc in CMakeLists.txt - Add necessary macro and typedefs in core/unix/include/siginfo.h - Fix compilation of vendored elfutils - Temporarily use STDOUT/STDERR_FILENO when we need the underlying fds of stdout/stderr and suppress warnings for musl's opaque FILE type - Adjust linux.signal* tests to stay compatible with musl's SIGRTMAX, which is actually a function call, instead of a constant value Tested on Alpine Linux, half of the tests are passed and it's possible to run some applications (busybox, mutt and telegram-desktop) and some simple clients (bbsize). Issue: #1973
POSIX.1 requires SS_ONSTACK to appear only in a stack_t retrieved from sigaltstack(), not one passed to it. musl checks the invalid flag and will bail out with EINVAL before issuing a syscall in this case, failing the test. This commit sets ss_flags to zero instead, on both glibc and musl this should issue a syscall, which fixes assertion failures encountered in linux.signal*, api.static_signal and drcachesim.burst_threads on musl. Issue: #1973
The workflow constructs an Alpine Linux chroot environment in place and build DynamoRIO in it, serving as compatibility verification against musl. Tests are disabled in CI since only half of them pass. Issue: #1973
the code in question is
FILE is an opaque type and it's illegal to make assumptions about or access the underlying struct from non-libc code.
I'm currently talking with musl's author if there's a portable solution.
the code in question was introduced to fix #261
The text was updated successfully, but these errors were encountered: