[patch, -rc6-mm1] irqflags tracing: fix x86_64 entry/exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Paolo Ornati <[email protected]> wrote:

> Wow, now I can reproduce it easly :)
> 
> Just run under "gdb" a program that segfaults:
> 
> void main(void)
> {
>         *(int*)(0) = 1;
> }
> 
> and it will trigger.

thanks - please try the fix below - it has solved the problem on my 
testbox.

	Ingo

-------------
Subject: irqflags tracing: fix x86_64 entry/exit
From: Ingo Molnar <[email protected]>

the x86_64 portion of the irqflags code did not properly trace the
"paranoid userspace" type of syscall/ptrace exit variant.

A testcase Paolo Ornati has discovered triggers a lock validator
assert due to this bug.

Signed-off-by: Ingo Molnar <[email protected]>
---
 arch/x86_64/kernel/entry.S |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Index: linux/arch/x86_64/kernel/entry.S
===================================================================
--- linux.orig/arch/x86_64/kernel/entry.S
+++ linux/arch/x86_64/kernel/entry.S
@@ -50,9 +50,10 @@
 #define retint_kernel retint_restore_args
 #endif	
 
-.macro TRACE_IRQS_IRETQ
+
+.macro TRACE_IRQS_IRETQ offset=ARGOFFSET
 #ifdef CONFIG_TRACE_IRQFLAGS
-	bt   $9,EFLAGS-ARGOFFSET(%rsp)	/* interrupts off? */
+	bt   $9,EFLAGS-\offset(%rsp)	/* interrupts off? */
 	jnc  1f
 	TRACE_IRQS_ON
 1:
@@ -809,9 +810,9 @@ error_exit:		
 	andl  %edi,%edx
 	jnz  retint_careful
 	/*
-	 * The iret will restore flags:
+	 * The iret might restore flags:
 	 */
-	TRACE_IRQS_ON
+	TRACE_IRQS_IRETQ
 	swapgs 
 	RESTORE_ARGS 0,8,0						
 	jmp iret_label
@@ -999,6 +1000,7 @@ paranoid_exit:
 	testl $3,CS(%rsp)
 	jnz   paranoid_userspace
 paranoid_swapgs:	
+	TRACE_IRQS_IRETQ 0
 	swapgs
 paranoid_restore:	
 	RESTORE_ALL 8
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux