There was an error while loading. Please reload this page.
1 parent 047aa14 commit 9d49f16Copy full SHA for 9d49f16
1 file changed
kernel/src/arch/x86_64/sched.rs
@@ -422,6 +422,11 @@ pub(in crate::arch) fn restore_signal_frame(context: &mut Context) {
422
// Restore the saved context.
423
*context = frame.saved_context;
424
425
+ // Make sure the user doesn't do anything funky with the context.
426
+ context.cs = offset_of!(Gdt, user_code64) as u64 | consts::CPL_USER as u64;
427
+ context.ss = offset_of!(Gdt, user_data) as u64 | consts::CPL_USER as u64;
428
+ context.rflags = (frame.saved_context.rflags & 0xDD5) | 0x202;
429
+
430
// Restore the signal mask.
431
let task = Scheduler::get_current();
432
let mut sig_state = task.signal.lock();
0 commit comments