[libc-commits] [libc] [libc][setjmp] disable -ftrivial-auto-var-init=pattern for now (PR #92796)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Mon May 20 10:52:13 PDT 2024
https://github.com/nickdesaulniers created https://github.com/llvm/llvm-project/pull/92796
This would consistently fail for me locally, to the point where I could not run
ninja libc-unit-tests without ninja libc_setjmp_unittests failing.
Turns out that since I enabled -ftrivial-auto-var-init=pattern in
commit 1d5c16d ("[libc] default enable -ftrivial-auto-var-init=pattern (#78776)")
this has been a problem. Our x86_64 setjmp definition disabled -Wuninitialized,
so we wound up clobbering these registers and instead backing up
0xAAAAAAAAAAAAAAAA rather than the actual register value.
The implemenation should be rewritten entirely. I've proposed three different
ways to do so (linked below). Until we decide which way to go, at least disable
this hardening feature for this function for now so that the unit tests go back
to green.
Link: #87837
Link: #88054
Link: #88157
Fixes: #91164
>From 223d279d2e55efe00859b62d94c275b897b6de34 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Mon, 20 May 2024 10:48:17 -0700
Subject: [PATCH] [libc][setjmp] disable -ftrivial-auto-var-init=pattern for
now
This would consistently fail for me locally, to the point where I could not run
ninja libc-unit-tests without ninja libc_setjmp_unittests failing.
Turns out that since I enabled -ftrivial-auto-var-init=pattern in
commit 1d5c16d ("[libc] default enable -ftrivial-auto-var-init=pattern (#78776)")
this has been a problem. Our x86_64 setjmp definition disabled -Wuninitialized,
so we wound up clobbering these registers and instead backing up
0xAAAAAAAAAAAAAAAA rather than the actual register value.
The implemenation should be rewritten entirely. I've proposed three different
ways to do so (linked below). Until we decide which way to go, at least disable
this hardening feature for this function for now so that the unit tests go back
to green.
Link: #87837
Link: #88054
Link: #88157
Fixes: #91164
---
libc/src/setjmp/x86_64/CMakeLists.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libc/src/setjmp/x86_64/CMakeLists.txt b/libc/src/setjmp/x86_64/CMakeLists.txt
index 9899c00e7c4a6..ae84322a65401 100644
--- a/libc/src/setjmp/x86_64/CMakeLists.txt
+++ b/libc/src/setjmp/x86_64/CMakeLists.txt
@@ -9,6 +9,11 @@ add_entrypoint_object(
COMPILE_OPTIONS
-O3
-fno-omit-frame-pointer
+ # TODO: Remove once one of these lands:
+ # https://github.com/llvm/llvm-project/pull/87837
+ # https://github.com/llvm/llvm-project/pull/88054
+ # https://github.com/llvm/llvm-project/pull/88157
+ -ftrivial-auto-var-init=uninitialized
)
add_entrypoint_object(
More information about the libc-commits
mailing list