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:
parent
1f30d75713
commit
8c7b59ad17
@ -31,7 +31,14 @@ impl SigAction {
|
|||||||
handler_addr: sa_c.handler as usize,
|
handler_addr: sa_c.handler as usize,
|
||||||
flags: SigActionFlags::from_u32(sa_c.flags)?,
|
flags: SigActionFlags::from_u32(sa_c.flags)?,
|
||||||
restorer_addr: sa_c.restorer as usize,
|
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)
|
Ok(sa)
|
||||||
|
Loading…
Reference in New Issue
Block a user