Skip to content

Leak Sanitizer reports leaks on sigaltstack pointers. #63313

@mvanotti

Description

@mvanotti

LSan is reporting leaks for legit uses of the sigaltstack .

See the following example:

#include <signal.h> #include <stddef.h> #include <stdint.h> #include <stdlib.h> constexpr size_t kSigaltstackSize = 0x1000 * 10; int main(void) { void* new_sigaltstack = malloc(kSigaltstackSize); stack_t ss = {.ss_sp = new_sigaltstack, .ss_flags = 0, .ss_size = kSigaltstackSize}; sigaltstack(&ss, NULL); return 0; }

compiled with clang++ -fsanitize=leak program.cc -o program

Returns:

================================================================= ==407264==ERROR: LeakSanitizer: detected memory leaks Direct leak of 40960 byte(s) in 1 object(s) allocated from:  #0 0x5607c7b1df32 in malloc (/home/user/program+0x2ff32) (BuildId: 1fd845c27ab0d578242521bcf8e1508798c8bbcd)  #1 0x5607c7b20688 in main (/home/user/program+0x32688) (BuildId: 1fd845c27ab0d578242521bcf8e1508798c8bbcd)  #2 0x7fed3d367189 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:10:10 SUMMARY: LeakSanitizer: 40960 byte(s) leaked in 1 allocation(s).

Would it be possible for LSan to treat the sigaltstack as a global variable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions