Rualark
Rualark

Reputation: 523

How to enable address sanitizer at godbolt.org

I am trying to enable address sanitizer at godbolt.org with -fsanitize=address, but get error:

==3==ERROR: AddressSanitizer failed to allocate 0xdfff0001000 (15392894357504) bytes at address 2008fff7000 (errno: 12)
==3==ReserveShadowMemoryRange failed while trying to map 0xdfff0001000 bytes. Perhaps you're using ulimit -v

Example: https://godbolt.org/z/5GDtrr

How can I enable address sanitizer correctly?

Upvotes: 6

Views: 3359

Answers (2)

Cyao
Cyao

Reputation: 774

I'm posting this answer for anyone that stumbles here in the future.

Currently (2024) you can enable address sanitizer in godbolt by passing in the -fsanitize=address limit. It works!

Upvotes: 0

yugr
yugr

Reputation: 21954

By design Asan allocates a huge amount of virtual memory (20 Tb on x86_64 machines) at start (details here). This may be a problem if overcommit is disabled or virtual memory is limited with ulimit -v.

In both cases there's nothing Asan can do - you'll need to raise this with Godbolt VM maintainers in https://github.com/mattgodbolt/compiler-explorer/issues

Upvotes: 9

Related Questions