public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] tst-setcontext10.c: Undef _FORTIFY_SOURCE
@ 2023-12-19 21:40 H.J. Lu
0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2023-12-19 21:40 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=46432be2f1d4de962b51ca6b9f80fc37744be9f7
commit 46432be2f1d4de962b51ca6b9f80fc37744be9f7
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Dec 19 09:55:25 2023 -0800
tst-setcontext10.c: Undef _FORTIFY_SOURCE
When _FORTIFY_SOURCE is defined to 2, ____longjmp_chk is called,
instead of longjmp. ____longjmp_chk compares the relative stack
values to decide if it is called from a stack frame which called
setjmp. If not, ____longjmp_chk assumes that an alternate signal
stack is used. Since comparing the relative stack values isn't
reliable with user context, when there is no signal, ____longjmp_chk
will fail. Undefine _FORTIFY_SOURCE to avoid ____longjmp_chk in
user context test.
Diff:
---
stdlib/tst-setcontext10.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/stdlib/tst-setcontext10.c b/stdlib/tst-setcontext10.c
index 2926753cb1..d714563742 100644
--- a/stdlib/tst-setcontext10.c
+++ b/stdlib/tst-setcontext10.c
@@ -16,6 +16,15 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+/* When _FORTIFY_SOURCE is defined to 2, ____longjmp_chk is called,
+ instead of longjmp. ____longjmp_chk compares the relative stack
+ values to decide if it is called from a stack frame which called
+ setjmp. If not, ____longjmp_chk assumes that an alternate signal
+ stack is used. Since comparing the relative stack values isn't
+ reliable with user context, when there is no signal, ____longjmp_chk
+ will fail. Undefine _FORTIFY_SOURCE to avoid ____longjmp_chk. */
+#undef _FORTIFY_SOURCE
+
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-12-19 21:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-19 21:40 [glibc] tst-setcontext10.c: Undef _FORTIFY_SOURCE H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).