| Summary: | Infinite recursion during initialization when stdlib's atexit() allocates | ||
|---|---|---|---|
| Product: | [Applications] Heaptrack | Reporter: | Daniel Vrátil <dvratil> |
| Component: | general | Assignee: | Milian Wolff <mail> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.1.0 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://commits.kde.org/heaptrack/5ff967ab12fda20834100ea3861d65d74221db89 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
|
Description
Daniel Vrátil
2018-06-07 13:26:10 UTC
Hey Dan, thanks for the report. Can you tell me how to reproduce this locally on Arch? Without that, it's going to be hard for me to fix this properly. Have you tried moving the atexit call into the lambda of the heaptrack_init call? I.e. after the comment // cleanup environment to prevent tracing of child apps If that works for you too, then I think it would be preferrable. Hi Milian, sorry for the slow response. You probably have to compile uClibc (I'm running against an ancient one here, 0.9.33.2) and then LD_PRELOAD it or link an app directly against in. When you run the app under heaptrack, you should get a crash immediately at the start. I don't know if there's an easy way to reproduce this against glibc. Moving the atexit() at the end of the lambda works. Git commit 5ff967ab12fda20834100ea3861d65d74221db89 by Milian Wolff. Committed on 02/07/2018 at 20:58. Pushed by mwolff into branch '1.1'. Call libc / libstdc++ freeres function in libheaptrack's atexit On one hand, this prevents an infinite recursion when the call to atexit allocates, which happens e.g. with uClibc, since the call from heaptrack_preload did not install the recursion guard yet. On the other hand, this code move ensures that the freeres functions get called properly before heaptrack_stop is called. M +0 -19 src/track/heaptrack_preload.cpp M +19 -0 src/track/libheaptrack.cpp https://commits.kde.org/heaptrack/5ff967ab12fda20834100ea3861d65d74221db89 |