Skip to content

Segmentation fault occurs due to the use of static parameters in ThreadSanitizer #64469

Open
@Lantern-r

Description

@Lantern-r

When using the example code simple_race.cc, enabling the -static parameter will cause the code to segfault

➜  DataRaceTest clang++ simple_race.cc -fsanitize=thread -fPIE -g -static -o simple_race_static
➜  DataRaceTest ./simple_race_static 
[1]    4011847 segmentation fault (core dumped)  ./simple_race_static
➜  DataRaceTest clang++ simple_race.cc -fsanitize=thread -fPIE -g -o simple_race_static 
➜  DataRaceTest ./simple_race_static 
==================
WARNING: ThreadSanitizer: data race (pid=4012114)
.................
==================
ThreadSanitizer: reported 1 warnings

Suggested modification: Add code similar to ASan

➜  DataRaceTest clang++ simple_race.cc -fsanitize=address -fPIE -g -static -o simple_race_static
........ 
`__asan::AsanDoesNotSupportStaticLinkage()':
.........

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