Fix a bug in sigaction

The bug would allow the user to block non-blockable signals (SIGKILL and SIGSTOP)
using sigaction syscall. This commit fixes this bug.
This commit is contained in:
Tate, Hongliang Tian 2020-07-17 17:10:55 +00:00 committed by tate.thl
parent 1f30d75713
commit 8c7b59ad17

@ -31,7 +31,14 @@ impl SigAction {
handler_addr: sa_c.handler as usize,
flags: SigActionFlags::from_u32(sa_c.flags)?,
restorer_addr: sa_c.restorer as usize,
mask: SigSet::from_c(sa_c.mask),
mask: {
let mut mask = SigSet::from_c(sa_c.mask);
// According to man pages, "it is not possible to block SIGKILL or SIGSTOP.
// Attempts to do so are silently ignored."
mask -= SIGKILL;
mask -= SIGSTOP;
mask
},
},
};
Ok(sa)