From: David Woodhouse <dwmw2@redhat.com> Subject: [RHEL5] #220586 - Avoid kernel panic when taking altivec exceptions from userspace. Date: Wed, 03 Jan 2007 18:52:41 +0000 Bugzilla: 220586 Message-Id: <1167850361.19205.15.camel@pmac.infradead.org> Changelog: ppc64: Avoid panic when taking altivec exceptions from userspace. When the CPU has altivec support but the kernel doesn't realise it -- because it's a new CPU not known in the PVR table and the firmware doesn't announce the availability of altivec support, userspace can panic the machine. This is a bad thing. The simple patch from upstream unconditionally delivers SIGILL if the exception comes from userspace, rather than panicking. commit 6c4841c2b6c32a134f9f36e5e08857138cc12b10 Author: Anton Blanchard <anton@samba.org> [POWERPC] Never panic when taking altivec exceptions from userspace At the moment we rely on a cpu feature bit or a firmware property to detect altivec. If we dont have either of these and the cpu does in fact support altivec we can cause a panic from userspace. It seems safer to always send a signal if we manage to get an 0xf20 exception from userspace. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index d9f10f2..5ed4c2c 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -900,14 +900,13 @@ void kernel_fp_unavailable_exception(struct pt_regs *regs) void altivec_unavailable_exception(struct pt_regs *regs) { -#if !defined(CONFIG_ALTIVEC) if (user_mode(regs)) { /* A user program has executed an altivec instruction, but this kernel doesn't support altivec. */ _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); return; } -#endif + printk(KERN_EMERG "Unrecoverable VMX/Altivec Unavailable Exception " "%lx at %lx\n", regs->trap, regs->nip); die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT); -- dwmw2