[PATCH] VMX get_user w/ irq disabled

Jake Moilanen moilanen at austin.ibm.com
Sat Oct 29 02:55:09 EST 2005


During some VMX stress runs, this was seen on a RHEL4 U2 kernel:

Oct  9 04:03:11 ist-6 kernel: Debug: sleeping function called from invalid context at arch/ppc64/kernel/vecemu.c:266
Oct  9 04:03:11 ist-6 kernel: in_atomic():0[expected: 0], irqs_disabled():1 Oct  9 04:03:11 ist-6 kernel: Call Trace:
Oct  9 04:03:11 ist-6 kernel: [c000000061503be0] [c00000000005a87c] .__might_sleep+0xcc/0xec (unreliable)
Oct  9 04:03:11 ist-6 kernel: [c000000061503c80] [c0000000000470cc] .emulate_altivec+0x44/0x430
Oct  9 04:03:11 ist-6 kernel: [c000000061503d30] [c000000000012af8] .AltivecAssistException+0x5c/0x120

Looks like we have a get_user() call with interrupts disabled.  While I
haven't seen the problem, I believe we have the same hole in mainline.

The patch below fixed the problem on Redhat (rebased at 2.6.14).

Thanks,
Jake

Signed-off-by: Jake Moilanen <moilanen at austin.ibm.com>

Index: 2.6.14/arch/ppc64/kernel/vecemu.c
===================================================================
--- 2.6.14.orig/arch/ppc64/kernel/vecemu.c	2005-03-02 01:37:30.000000000 -0600
+++ 2.6.14/arch/ppc64/kernel/vecemu.c	2005-10-28 10:18:51.203485713 -0500
@@ -263,7 +263,7 @@
 	unsigned int va, vb, vc, vd;
 	vector128 *vrs;
 
-	if (get_user(instr, (unsigned int __user *) regs->nip))
+	if (__copy_from_user_inatomic(&instr, (unsigned int *) regs->nip, sizeof(unsigned int *)))
 		return -EFAULT;
 	if ((instr >> 26) != 4)
 		return -EINVAL;		/* not an altivec instruction */



More information about the Linuxppc64-dev mailing list