Bug 1727912
| Summary: | Weird valgrind-openssl interaction | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Tomas Mraz <tmraz> | ||||
| Component: | valgrind | Assignee: | Mark Wielaard <mjw> | ||||
| valgrind sub component: | system-version | QA Contact: | qe-baseos-tools-bugs | ||||
| Status: | CLOSED DUPLICATE | Docs Contact: | |||||
| Severity: | unspecified | ||||||
| Priority: | unspecified | CC: | fweimer, jakub, ohudlick | ||||
| Version: | 8.4 | ||||||
| Target Milestone: | rc | ||||||
| Target Release: | 8.0 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2019-07-08 14:12:44 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
Tomas Mraz
2019-07-08 13:50:16 UTC
I'll have a closer look, but this looks like a bug in glibc: https://bugzilla.redhat.com/show_bug.cgi?id=1717438 __libc_freeres (under valgrind) triggers bad free in libdl if dlerror was not used If so, adding a dlerror () call to the program might be a temporary workaround. Yes, adding dlerror() call to the program fixes the issue, should I mark it as duplicate? Mark, does valgrind somehow detect whether the SIGINT arrives in an async-signal-safe context? Calling __libc_freeres in such a context *will* result in bogus reports (and even crashes) because __libc_freeres calls free etc. and is therefore not async-signal-safe. (This may not be related to this bug, but the backtrace made me think of this issue.) (In reply to Tomas Mraz from comment #2) > Yes, adding dlerror() call to the program fixes the issue, should I mark it > as duplicate? Thanks for testing. Yes, lets mark this a a duplicate of glibc bug #1717438 *** This bug has been marked as a duplicate of bug 1717438 *** (In reply to Florian Weimer from comment #3) > Mark, does valgrind somehow detect whether the SIGINT arrives in an > async-signal-safe context? Calling __libc_freeres in such a context *will* > result in bogus reports (and even crashes) because __libc_freeres calls free > etc. and is therefore not async-signal-safe. > > (This may not be related to this bug, but the backtrace made me think of > this issue.) I don't think valgrind does. And that might indeed be the underlying bug for some different (upstream) issues: https://bugs.kde.org/show_bug.cgi?id=409141 https://bugs.kde.org/show_bug.cgi?id=409367 Please note that all this in OpenSSL happens from atexit() handler. It is not called directly from a signal handler. (I am not sure whether that makes any difference though.) (In reply to Tomas Mraz from comment #6) > Please note that all this in OpenSSL happens from atexit() handler. It is > not called directly from a signal handler. (I am not sure whether that makes > any difference though.) That doesn't really make a difference for this specific bug. Given that adding dlerror () fixes it, this is obviously glibc bug #1717438. In theory valgrind should not have any trouble running atexit() handlers, since those would look like normal code execution as far as valgrind is concerned (they program hasn't actually exited yet). valgrind does do some more work after the process is actually exiting. If a signal is coming in after that, it might in theory confuse valgrind and/or the code in the signal handler if it was actually run (it shouldn't). But that isn't the issue in this case. I meant is calling free in atexit handler when the atexit is triggered as consequence of SIGTERM or SIGINT default action safe in general or not? (In reply to Tomas Mraz from comment #8) > I meant is calling free in atexit handler when the atexit is triggered as > consequence of SIGTERM or SIGINT default action safe in general or not? As long as the atexit handler isn't called in the signal context itself, then yes. But I am not sure an atexit handler is called when the process dies because of signal. The manual page implies it is not called. It depends on what the signal handler does. If it calls exit (not _exit), then the handlers are run. Of course, calling _exit from an asynchronous signal is not safe. Ah, you're right. I'm sorry for all the confusion. There is no signal handler registered so there is nothing that would libcrypto execute in the signal context itself. |