Merge branch 'fix-sigreturn-dos' into 'master'

Fix kernel DoS via sigreturn from non-signal context

See merge request redox-os/kernel!211
This commit is contained in:
Jeremy Soller
2023-05-04 12:32:24 +00:00
+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() };