[PATCH] sigaction: don't sign-extend sa_flags
наб
nabijaczleweli@nabijaczleweli.xyz
Sun Jun 1 13:46:25 GMT 2025
Before:
rt_sigaction(SIGBUS, {sa_handler=0x55abb9960139, sa_mask=[], sa_flags=SA_RESTORER|SA_RESETHAND|SA_SIGINFO|0xffffffff00000000, sa_restorer=0x7fb1b2a82050}, NULL, 8) = 0
After:
rt_sigaction(SIGBUS, {sa_handler=0x7f6a70dce139, sa_mask=[], sa_flags=SA_RESTORER|SA_RESETHAND|SA_SIGINFO, sa_restorer=0x7f6a70c28f60}, NULL, 8) = 0
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
sysdeps/unix/sysv/linux/libc_sigaction.c | 2 +-
sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/libc_sigaction.c b/sysdeps/unix/sysv/linux/libc_sigaction.c
index bbfc177655..f349f8660b 100644
--- a/sysdeps/unix/sysv/linux/libc_sigaction.c
+++ b/sysdeps/unix/sysv/linux/libc_sigaction.c
@@ -49,7 +49,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
{
kact.k_sa_handler = act->sa_handler;
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
- kact.sa_flags = act->sa_flags;
+ kact.sa_flags = (unsigned)act->sa_flags;
SET_SA_RESTORER (&kact, act);
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c b/sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c
index 006c532127..812e023584 100644
--- a/sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c
+++ b/sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c
@@ -22,7 +22,7 @@
extern void restore_rt (void) asm ("__restore_rt") attribute_hidden;
#define SET_SA_RESTORER(kact, act) \
- (kact)->sa_flags = (act)->sa_flags | SA_RESTORER; \
+ (kact)->sa_flags |= SA_RESTORER; \
(kact)->sa_restorer = &restore_rt
#define RESET_SA_RESTORER(act, kact) \
--
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: <https://sourceware.org/pipermail/libc-alpha/attachments/20250601/eeaf2cf1/attachment.sig>
More information about the Libc-alpha
mailing list