[libc-commits] [libc] [libc] Remove LlvmLibcStackChkFail.Smash test (PR #125919)
Roland McGrath via libc-commits
libc-commits at lists.llvm.org
Wed Feb 5 11:47:25 PST 2025
https://github.com/frobtech created https://github.com/llvm/llvm-project/pull/125919
This test was problematic, and also unnecessary. It's not really
a test of the libc functionality or ABI. That's already covered
by the LlvmLibcStackChkFail.Death test. The Smash test was in
fact just testing that the compiler produces the call in the
expected situation. That's a compiler test, not a libc test.
It's not really feasible to make a test like this both reliable
and safe. Since it's not something libc needs to test, it's not
worth trying.
>From 9259fbe1a7a7842c1c0fcc1ec02ed5e90d9a5afd Mon Sep 17 00:00:00 2001
From: Roland McGrath <mcgrathr at google.com>
Date: Wed, 5 Feb 2025 11:31:44 -0800
Subject: [PATCH] [libc] Remove LlvmLibcStackChkFail.Smash test
This test was problematic, and also unnecessary. It's not really
a test of the libc functionality or ABI. That's already covered
by the LlvmLibcStackChkFail.Death test. The Smash test was in
fact just testing that the compiler produces the call in the
expected situation. That's a compiler test, not a libc test.
It's not really feasible to make a test like this both reliable
and safe. Since it's not something libc needs to test, it's not
worth trying.
---
libc/test/src/compiler/stack_chk_guard_test.cpp | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/libc/test/src/compiler/stack_chk_guard_test.cpp b/libc/test/src/compiler/stack_chk_guard_test.cpp
index 4ec8398c9fc95dc..301031ff47bd5e4 100644
--- a/libc/test/src/compiler/stack_chk_guard_test.cpp
+++ b/libc/test/src/compiler/stack_chk_guard_test.cpp
@@ -7,24 +7,9 @@
//===----------------------------------------------------------------------===//
#include "hdr/signal_macros.h"
-#include "src/__support/macros/sanitizer.h"
#include "src/compiler/__stack_chk_fail.h"
-#include "src/string/memset.h"
#include "test/UnitTest/Test.h"
TEST(LlvmLibcStackChkFail, Death) {
EXPECT_DEATH([] { __stack_chk_fail(); }, WITH_SIGNAL(SIGABRT));
}
-
-// Disable the test when asan is enabled so that it doesn't immediately fail
-// after the memset, but before the stack canary is re-checked.
-#ifndef LIBC_HAS_ADDRESS_SANITIZER
-TEST(LlvmLibcStackChkFail, Smash) {
- EXPECT_DEATH(
- [] {
- int arr[20];
- LIBC_NAMESPACE::memset(arr, 0xAA, 2001);
- },
- WITH_SIGNAL(SIGABRT));
-}
-#endif // LIBC_HAS_ADDRESS_SANITIZER
More information about the libc-commits
mailing list