Bug 18654 - mcheck should warn if threads exist
Summary: mcheck should warn if threads exist
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: malloc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-10 12:04 UTC by Jan Kratochvil
Modified: 2021-07-14 02:54 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kratochvil 2015-07-10 12:04:46 UTC
-lmcheck (MALLOC_CHECK_) + -pthread should warn the user.

In reality -pthread always gets indirectly linked so -lmcheck should just check if a new (second) thread has ever been created in this process.

Maybe it is enough if mabort() does this check - that the crash is due to unsupported mcheck usage and not due to the program's bug.

One does not immediately realize all the possible reasons of a crash.
Comment 1 Siddhesh Poyarekar 2021-07-14 02:54:38 UTC
mcheck and MALLOC_CHECK_ are distinct debugging features.  MALLOC_CHECK_ is fine, it's mcheck that doesn't work well with threads.  Given the general brokenness of mcheck, I am inclined towards gradually pulling the plug on it.  Newer targets don't even have __malloc_initialize_hook that is needed to make -lmcheck work.