From a1bfaca761db2245b218afb211468f8e90e800fd Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Mon, 21 Sep 2009 09:41:51 +0000 Subject: [PATCH] If CPU happens to be in usermode when a T_RESERVED trap occured, then trapsignal is called with ksi.ksi_signo = 0. For debugging kernels, that should end up in panic, for non-debugging kernels behaviour is undefined. Do panic regardeless of execution mode at the moment of trap. Reviewed by: jhb MFC after: 1 month --- sys/amd64/amd64/trap.c | 5 +++++ sys/i386/i386/trap.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 65f761eaa4a..cfccf3c3ca6 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -253,6 +253,11 @@ trap(struct trapframe *frame) } #endif + if (type == T_RESERVED) { + trap_fatal(frame, 0); + goto out; + } + #ifdef HWPMC_HOOKS /* * CPU PMCs interrupt using an NMI. If the PMC module is diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index f7064f04a53..f4df6687021 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -225,6 +225,11 @@ trap(struct trapframe *frame) } #endif + if (type == T_RESERVED) { + trap_fatal(frame, 0); + goto out; + } + #ifdef HWPMC_HOOKS /* * CPU PMCs interrupt using an NMI so we check for that first.