Skip to content

ThreadSanitizer doesn't work with memory overcommit disabled #138581

Open
@zackw

Description

@zackw

On Linux, if memory overcommit has been disabled (sysctl -w vm.overcommit_memory=2), all programs compiled with -fsanitize=thread crash on startup with an error message...

==363640==ERROR: ThreadSanitizer failed to allocate 0x200000000000 (35184372088832) bytes at address 100000000000 (errno: 12)
FATAL: ThreadSanitizer can not mmap the shadow memory
FATAL: Make sure to compile with -fPIE and to link with -pie.

... that indicates ThreadSanitizer attempted to allocate 32 terabytes of RAM. That's not a reasonable amount of memory to expect a developer workstation to have.

Please change ThreadSanitizer so that it only allocates shadow memory proportional to the amount of RAM that the program actually uses. You can probably use MAP_NORESERVE to allocate a range of address space without also allocating RAM.

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