[PATCH] rt_sigaction: mask down to 32 bits to hide unusable sign-extension artifact
Ahelenia Ziemiańska
nabijaczleweli at nabijaczleweli.xyz
Mon Jun 2 14:48:06 UTC 2025
new_sigaction's sa_flags is (sometimes) an ulong which is (sometimes)
64 bits; only 32 bits can ever be used, and currently libcs sign-extend
SA_RESETHAND to set the top half. Mask it down since it's unused and unusable.
Before:
rt_sigaction(SIGBUS, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESETHAND|0xffffffff00000000, sa_restorer=0x7fb45a2dc050}, NULL, 8) = 0
After:
rt_sigaction(SIGBUS, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x7f95242c6050}, NULL, 8) = 0
Link: https://www.openwall.com/lists/musl/2025/06/01/1
Link: https://sourceware.org/pipermail/libc-alpha/2025-June/167148.html
---
src/signal.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/signal.c b/src/signal.c
index cb9580d74..84b3fb4b5 100644
--- a/src/signal.c
+++ b/src/signal.c
@@ -611,6 +611,7 @@ decode_new_sigaction(struct tcb *const tcp, const kernel_ulong_t addr)
tprints_field_name("sa_mask");
tprintsigmask_val(sa.sa_mask);
tprint_struct_next();
+ sa.sa_flags &= 0xFFFFFFFF;
PRINT_FIELD_FLAGS(sa, sa_flags, sigact_flags, "SA_???");
#if HAVE_SA_RESTORER && defined SA_RESTORER
if (sa.sa_flags & SA_RESTORER) {
--
2.39.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20250602/6fa5c952/attachment.bin>
More information about the Strace-devel
mailing list