https://bugs.kde.org/show_bug.cgi?id=444278
Bug ID: 444278 Summary: SIGSEGV in musl freelocale Product: valgrind Version: unspecified Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: jsew...@acm.org Reporter: shininggat...@outlook.com Target Milestone: --- Created attachment 142798 --> https://bugs.kde.org/attachment.cgi?id=142798&action=edit minimal test case SUMMARY When running the program `min.c` under valgrind and musl libc, the process is terminated with SIGSEGV in `freelocale`. STEPS TO REPRODUCE 1. Compile and run `min.c` with valgrind using musl libc. OBSERVED RESULT Program crashes with SIGSEGV. EXPECTED RESULT No crashes. SOFTWARE/OS VERSIONS Linux 5.10.75, Alpine Linux, musl 1.2.2 ADDITIONAL INFORMATION The issue seems to be that musl calls `__libc_free` in freelocale, which valgrind does not replace, leading to musl trying to read metadata that is not present, instead getting garbage. In glibc, freelocale calls the normal `free` function, which is correctly replaced by valgrind. Attached is a (semi-)tested patch which replaces `__libc_free`, making the test case and the original application run fine. -- You are receiving this mail because: You are watching all bug changes.