Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sanitizer] Suggest checking ulimit -d in addition to ulimit -v #98625

Merged
merged 1 commit into from
Jul 13, 2024

Conversation

iii-i
Copy link
Member

@iii-i iii-i commented Jul 12, 2024

Since Linux 4.7, RLIMIT_DATA may result in mmap() returning ENOMEM. Example:

$ clang -fsanitize=address -o hello hello.c
$ ulimit -d 100000
$ ./hello
==3349007==ERROR: AddressSanitizer failed to allocate 0x10000000 (268435456) bytes at address 7fff7000 (errno: 12)
==3349007==ReserveShadowMemoryRange failed while trying to map 0x10000000 bytes. Perhaps you're using ulimit -v

Suggest checking ulimit -d in addition to ulimit -v.

Since Linux 4.7, RLIMIT_DATA may result in mmap() returning ENOMEM.
Example:

    $ clang -fsanitize=address -o hello hello.c
    $ ulimit -d 100000
    $ ./hello
    ==3349007==ERROR: AddressSanitizer failed to allocate 0x10000000 (268435456) bytes at address 7fff7000 (errno: 12)
    ==3349007==ReserveShadowMemoryRange failed while trying to map 0x10000000 bytes. Perhaps you're using ulimit -v

Suggest checking ulimit -d in addition to ulimit -v.
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 12, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Ilya Leoshkevich (iii-i)

Changes

Since Linux 4.7, RLIMIT_DATA may result in mmap() returning ENOMEM. Example:

$ clang -fsanitize=address -o hello hello.c
$ ulimit -d 100000
$ ./hello
==3349007==ERROR: AddressSanitizer failed to allocate 0x10000000 (268435456) bytes at address 7fff7000 (errno: 12)
==3349007==ReserveShadowMemoryRange failed while trying to map 0x10000000 bytes. Perhaps you're using ulimit -v

Suggest checking ulimit -d in addition to ulimit -v.


Full diff: https://github.com/llvm/llvm-project/pull/98625.diff

1 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp (+1-1)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
index a174ae7be991d..3966d82d51ee9 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
@@ -169,7 +169,7 @@ void ReserveShadowMemoryRange(uptr beg, uptr end, const char *name,
                      : !MmapFixedNoReserve(beg, size, name)) {
     Report(
         "ReserveShadowMemoryRange failed while trying to map 0x%zx bytes. "
-        "Perhaps you're using ulimit -v\n",
+        "Perhaps you're using ulimit -v or ulimit -d\n",
         size);
     Abort();
   }

@@ -169,7 +169,7 @@ void ReserveShadowMemoryRange(uptr beg, uptr end, const char *name,
: !MmapFixedNoReserve(beg, size, name)) {
Report(
"ReserveShadowMemoryRange failed while trying to map 0x%zx bytes. "
"Perhaps you're using ulimit -v\n",
"Perhaps you're using ulimit -v or ulimit -d\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not this relevant only to !madvise_shadow case?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM either way

@iii-i iii-i merged commit 7232763 into llvm:main Jul 13, 2024
9 checks passed
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
…#98625)

Since Linux 4.7, RLIMIT_DATA may result in mmap() returning ENOMEM.
Example:

    $ clang -fsanitize=address -o hello hello.c
    $ ulimit -d 100000
    $ ./hello
==3349007==ERROR: AddressSanitizer failed to allocate 0x10000000
(268435456) bytes at address 7fff7000 (errno: 12)
==3349007==ReserveShadowMemoryRange failed while trying to map
0x10000000 bytes. Perhaps you're using ulimit -v

Suggest checking ulimit -d in addition to ulimit -v.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants