Fix kernel DoS via sigreturn from non-signal context

This commit is contained in:
uuuvn
2023-05-04 15:58:05 +04:00
parent 3a6732eaad
commit 4621cd674d
+6 -2
View File
@@ -381,8 +381,12 @@ pub fn sigreturn() -> Result<usize> {
let contexts = context::contexts();
let context_lock = contexts.current().ok_or(Error::new(ESRCH))?;
let mut context = context_lock.write();
context.ksig_restore = true;
context.block("sigreturn");
if context.ksig.is_some() {
context.ksig_restore = true;
context.block("sigreturn");
} else {
return Err(Error::new(EINVAL));
}
}
let _ = unsafe { context::switch() };