Fix SIGKILL and allow SYS_EXIT to pass 16 bits.
This commit is contained in:
@@ -211,6 +211,8 @@ pub fn switch() -> SwitchResult {
|
||||
next_context.syscall_debug_info.on_switch_to();
|
||||
}
|
||||
|
||||
percpu.switch_internals.being_sigkilled.set(next_context.being_sigkilled);
|
||||
|
||||
unsafe {
|
||||
arch::switch_to(prev_context, next_context);
|
||||
}
|
||||
@@ -240,6 +242,8 @@ pub struct ContextSwitchPercpu {
|
||||
|
||||
// The ID of the idle process
|
||||
idle_id: Cell<ContextId>,
|
||||
|
||||
pub(crate) being_sigkilled: Cell<bool>,
|
||||
}
|
||||
impl ContextSwitchPercpu {
|
||||
pub fn context_id(&self) -> ContextId {
|
||||
|
||||
+8
-3
@@ -4,7 +4,7 @@
|
||||
|
||||
extern crate syscall;
|
||||
|
||||
use syscall::{RwFlags, EINVAL};
|
||||
use syscall::{RwFlags, EINVAL, SIGKILL};
|
||||
|
||||
pub use self::syscall::{
|
||||
data, error, flag, io, number, ptrace_event, EnvRegisters, FloatRegisters, IntRegisters,
|
||||
@@ -195,7 +195,7 @@ pub fn syscall(
|
||||
SYS_GETPGID => getpgid(ContextId::from(b)).map(ContextId::into),
|
||||
SYS_GETPPID => getppid().map(ContextId::into),
|
||||
|
||||
SYS_EXIT => exit((b & 0xFF) << 8),
|
||||
SYS_EXIT => exit(b),
|
||||
SYS_KILL => kill(ContextId::from(b), c),
|
||||
SYS_WAITPID => waitpid(
|
||||
ContextId::from(b),
|
||||
@@ -244,7 +244,12 @@ pub fn syscall(
|
||||
#[cfg(feature = "syscall_debug")]
|
||||
debug_end([a, b, c, d, e, f], result);
|
||||
|
||||
PercpuBlock::current().inside_syscall.set(false);
|
||||
let percpu = PercpuBlock::current();
|
||||
percpu.inside_syscall.set(false);
|
||||
|
||||
if percpu.switch_internals.being_sigkilled.get() {
|
||||
exit(SIGKILL);
|
||||
}
|
||||
|
||||
// errormux turns Result<usize> into -errno
|
||||
Error::mux(result)
|
||||
|
||||
+1
-1
Submodule syscall updated: a8dfcdf7df...f0483e3b33
Reference in New Issue
Block a user