[libc-commits] [libc] [libc] fix segfault in stack_chk_guard_test on arm (PR #75962)

via libc-commits libc-commits at lists.llvm.org
Tue Dec 19 11:13:23 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

<details>
<summary>Changes</summary>

Use a size smaller than the smallest supported page size so that we don't
clobber over any guard pages, which may result in a segfault before
__stack_chk_fail can be called.


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


1 Files Affected:

- (modified) libc/test/src/compiler/stack_chk_guard_test.cpp (+1-1) 


``````````diff
diff --git a/libc/test/src/compiler/stack_chk_guard_test.cpp b/libc/test/src/compiler/stack_chk_guard_test.cpp
index 1de2d1b7357f70..df15962acd9678 100644
--- a/libc/test/src/compiler/stack_chk_guard_test.cpp
+++ b/libc/test/src/compiler/stack_chk_guard_test.cpp
@@ -20,7 +20,7 @@ TEST(LlvmLibcStackChkFail, Smash) {
   EXPECT_DEATH(
       [] {
         int arr[20];
-        LIBC_NAMESPACE::memset(arr, 0xAA, 9001);
+        LIBC_NAMESPACE::memset(arr, 0xAA, 2001);
       },
       WITH_SIGNAL(SIGABRT));
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/75962


More information about the libc-commits mailing list