[15/18] Avoid stack-protecting signal-handling functions sibcalled from assembly.
Commit Message
From: Nick Alcock <nick.alcock@oracle.com>
Certain signal-handling functions are sibcalled from assembly on
x86, both on Linux and the Hurd. As such, they depend on having
the same-shaped stack frame, an assumption it seems likely that
-fstack-protector violates. More worryingly, setjmp/sigjmp.c lands
in the dynamic linker but is overlooked by the machinery that
rebuilds almost everything else, and is never rebuilt: so we
should compile it witout stack-protection for the sake of ld.so.
v2: de-stack-protect setjmp/sigjmp.c.
v3: Use $(no-stack-protector).
v4: Use inhibit_stack_protector.
v5: Remove inhibition of nptl/pthread_mutex_(un)lock.c now that is
diagnosed and fixed elsewhere, properly; inhibit _hurd_self_sigstate
instead.
* hurd/hurd/signal.h (_hurd_self_sigstate): Add
inhibit_stack_protector.
* setjmp/Makefile (CFLAGS-sigjmp.c): Add $(no-stack-protector).
---
hurd/hurd/signal.h | 2 +-
setjmp/Makefile | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
@@ -129,7 +129,7 @@ extern struct hurd_sigstate *_hurd_self_sigstate (void)
#define _HURD_SIGNAL_H_EXTERN_INLINE __extern_inline
#endif
-_HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
+_HURD_SIGNAL_H_EXTERN_INLINE inhibit_stack_protector struct hurd_sigstate *
_hurd_self_sigstate (void)
{
struct hurd_sigstate **location = (struct hurd_sigstate **)
@@ -35,3 +35,7 @@ tests-static := tst-setjmp-static
include ../Rules
$(objpfx)tst-setjmp-fp: $(libm)
+
+# This is sibcalled directly from arch-specific assembly, included in rtld,
+# but never rebuilt, so it must never be built with stack protection.
+CFLAGS-sigjmp.c += $(no-stack-protector)