]> Savannah Git Hosting - gnulib.git/commitdiff
sigsegv tests: Work around a longjmp bug on GNU/Hurd.
authorBruno Haible <bruno@clisp.org>
Mon, 6 Jan 2025 00:16:11 +0000 (01:16 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 18 Jan 2025 08:30:21 +0000 (09:30 +0100)
* tests/test-sigsegv-catch-stackoverflow1.c (_FORTIFY_SOURCE,
__USE_FORTIFY_LEVEL): Undefine, as a workaround to the Hurd longjmp bug.
* tests/test-sigsegv-catch-stackoverflow2.c (_FORTIFY_SOURCE,
__USE_FORTIFY_LEVEL): Likewise.
* doc/posix-functions/longjmp.texi: Document the Hurd bug.

ChangeLog
doc/posix-functions/longjmp.texi
tests/test-sigsegv-catch-stackoverflow1.c
tests/test-sigsegv-catch-stackoverflow2.c

index 2710a9a4898ed5cff26ef2ca910407e212806c2b..ac8d573988ef9066215ede7234669d832bb38d2b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-01-05  Bruno Haible  <bruno@clisp.org>
+
+       sigsegv tests: Work around a longjmp bug on GNU/Hurd.
+       * tests/test-sigsegv-catch-stackoverflow1.c (_FORTIFY_SOURCE,
+       __USE_FORTIFY_LEVEL): Undefine, as a workaround to the Hurd longjmp bug.
+       * tests/test-sigsegv-catch-stackoverflow2.c (_FORTIFY_SOURCE,
+       __USE_FORTIFY_LEVEL): Likewise.
+       * doc/posix-functions/longjmp.texi: Document the Hurd bug.
+
 2025-01-05  Bruno Haible  <bruno@clisp.org>
 
        tests: Don't use module 'getcwd' as dependency.
index 420a8cc44f25934f1b9d5cae0251e9eb081b99fd..ac5dd20d54ba5ea5e0da986e6245a985f0bfd8a8 100644 (file)
@@ -18,7 +18,13 @@ since it restores the contents of register-allocated variables but not
 the contents of stack-allocated variables.
 @item
 When longjumping out of a signal handler that was being executed on an
-alternate stack (installed through @code{sigaltstack}), on FreeBSD, NetBSD,
-OpenBSD, you need to clear the @code{SS_ONSTACK} flag in the @code{stack_t}
+alternate stack (installed through @code{sigaltstack}),
+on Hurd, FreeBSD, NetBSD, OpenBSD,
+you need to clear the @code{SS_ONSTACK} flag in the @code{stack_t}
 structure managed by the kernel.
+@item
+This function may crash when the invoker code was compiled with option
+@code{-D_FORTIFY_SOURCE=2},
+@c https://sourceware.org/bugzilla/show_bug.cgi?id=32522
+on Hurd.
 @end itemize
index 7e58bbb762bb8c549f6e82db3fc86074eddd3be2..cb20bceb8e66c7f2228a34270ac60103d919d545 100644 (file)
@@ -1,5 +1,5 @@
 /* Test the stack overflow handler.
-   Copyright (C) 2002-2024 Free Software Foundation, Inc.
+   Copyright (C) 2002-2025 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <config.h>
 
+/* On GNU/Hurd, when compiling with -D_FORTIFY_SOURCE=2, avoid an error
+   "*** longjmp causes uninitialized stack frame ***: terminated".
+   Cf. <https://sourceware.org/bugzilla/show_bug.cgi?id=32522>  */
+#ifdef __GNU__
+# undef _FORTIFY_SOURCE
+# undef __USE_FORTIFY_LEVEL
+#endif
+
 /* Specification.  */
 #include "sigsegv.h"
 
index 133b616af2165349a2dd56b7943c32b9e0b640d1..34ea491740ded9ccd004f82aac7a4e0569a6fb1f 100644 (file)
@@ -1,5 +1,5 @@
 /* Test that stack overflow and SIGSEGV are correctly distinguished.
-   Copyright (C) 2002-2024 Free Software Foundation, Inc.
+   Copyright (C) 2002-2025 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <config.h>
 
+/* On GNU/Hurd, when compiling with -D_FORTIFY_SOURCE=2, avoid an error
+   "*** longjmp causes uninitialized stack frame ***: terminated".
+   Cf. <https://sourceware.org/bugzilla/show_bug.cgi?id=32522>  */
+#ifdef __GNU__
+# undef _FORTIFY_SOURCE
+# undef __USE_FORTIFY_LEVEL
+#endif
+
 /* Specification.  */
 #include "sigsegv.h"