.`mtrace` no longer hangs when internal failures occur
Previously, a defect in the `mtrace` tool implementation could cause memory tracing to hang. To fix this issue, the `mtrace` memory tracing implementation has been made more robust to avoid the hang even in the face of internal failures. As a result, users can now call `mtrace` and it no longer hangs, completing in bounded time.
DescriptionCarlos O'Donell
2019-10-22 13:58:50 UTC
commit e621246ec6393ea08ae50310f9d5e72500f8c9bc
Author: Carlos O'Donell <carlos>
Date: Mon Apr 8 17:35:05 2019 -0400
malloc: Set and reset all hooks for tracing (Bug 16573)
If an error occurs during the tracing operation, particularly during a
call to lock_and_info() which calls _dl_addr, we may end up calling back
into the malloc-subsystem and relock the loader lock and deadlock. For
all intents and purposes the call to _dl_addr can call any of the malloc
family API functions and so we should disable all tracing before calling
such loader functions. This is similar to the strategy that the new
malloc tracer takes when calling the real malloc, namely that all
tracing ceases at the boundary to the real function and any faults at
that point are the purvue of the library (though the new tracer does
this on a per-thread basis in an MT-safe fashion). Since the new tracer
and the hook deprecation are not yet complete we must fix these issues
where we can.
Tested on x86_64 with no regressions.
Co-authored-by: Kwok Cheung Yeung <kcy>
Reviewed-by: DJ Delorie <dj>
Please also verify upstream branch backports:
release/2.30/master - May be required. Please check.
release/2.29/master - May be required. Please check.
release/2.28/master - May be required. Please check.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2020:1828
commit e621246ec6393ea08ae50310f9d5e72500f8c9bc Author: Carlos O'Donell <carlos> Date: Mon Apr 8 17:35:05 2019 -0400 malloc: Set and reset all hooks for tracing (Bug 16573) If an error occurs during the tracing operation, particularly during a call to lock_and_info() which calls _dl_addr, we may end up calling back into the malloc-subsystem and relock the loader lock and deadlock. For all intents and purposes the call to _dl_addr can call any of the malloc family API functions and so we should disable all tracing before calling such loader functions. This is similar to the strategy that the new malloc tracer takes when calling the real malloc, namely that all tracing ceases at the boundary to the real function and any faults at that point are the purvue of the library (though the new tracer does this on a per-thread basis in an MT-safe fashion). Since the new tracer and the hook deprecation are not yet complete we must fix these issues where we can. Tested on x86_64 with no regressions. Co-authored-by: Kwok Cheung Yeung <kcy> Reviewed-by: DJ Delorie <dj> Please also verify upstream branch backports: release/2.30/master - May be required. Please check. release/2.29/master - May be required. Please check. release/2.28/master - May be required. Please check.