From e58b93c02fcc427342e13aa5230155516ceac020 Mon Sep 17 00:00:00 2001 From: MANVENDRA RAJPUROHIT <145118895+manvendrarajpurohit@users.noreply.github.com> Date: Thu, 23 Apr 2026 15:51:55 +0000 Subject: [PATCH] bug p28-kill:set killed=1 on unexpected user-space traps --- trap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/trap.c b/trap.c index bd1af93..f48ccd9 100644 --- a/trap.c +++ b/trap.c @@ -66,6 +66,12 @@ trap(struct trapframe *tf) tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); } + // In user space, assume process misbehaved. + cprintf("pid %d %s: trap %d err %d on cpu %d " + "eip 0x%x addr 0x%x--kill proc\n", + myproc()->pid, myproc()->name, tf->trapno, + tf->err, cpuid(), tf->eip, rcr2()); + myproc()->killed = 1; } // Force process to exit if it has been killed and is in user space.