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

[libc] __stack_chk_fail post submit test failures #75962

Merged
merged 5 commits into from
Dec 19, 2023

Conversation

nickdesaulniers
Copy link
Member

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.

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.
@llvmbot
Copy link
Collaborator

llvmbot commented Dec 19, 2023

@llvm/pr-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

Changes

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 --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));
 }

@nickdesaulniers nickdesaulniers changed the title [libc] fix segfault in stack_chk_guard_test on arm [libc] __stack_chk_fail post submit test failures Dec 19, 2023
Copy link

github-actions bot commented Dec 19, 2023

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

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

LGTM, but possibly add a comment about this specific function needing extern "C" instead of the usual namespace.

@nickdesaulniers nickdesaulniers merged commit 24d44ff into llvm:main Dec 19, 2023
3 of 4 checks passed
@nickdesaulniers nickdesaulniers deleted the fix_forward_scf branch December 19, 2023 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants