All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Paolo Ornati <ornati@fastwebnet.it>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>
Subject: [patch, -rc6-mm1] irqflags tracing: fix x86_64 entry/exit
Date: Fri, 9 Jun 2006 10:59:20 +0200	[thread overview]
Message-ID: <20060609085920.GA4869@elte.hu> (raw)
In-Reply-To: <20060608215935.37c52bff@localhost>


* Paolo Ornati <ornati@fastwebnet.it> 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 <mingo@elte.hu>

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 <mingo@elte.hu>
---
 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

  parent reply	other threads:[~2006-06-09  9:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-08 19:38 BUG: warning at kernel/lockdep.c:2427/check_flags() Paolo Ornati
2006-06-08 19:59 ` Paolo Ornati
2006-06-08 20:02   ` Ingo Molnar
2006-06-09  8:59   ` Ingo Molnar [this message]
2006-06-09 10:01     ` [patch, -rc6-mm1] irqflags tracing: fix x86_64 entry/exit Paolo Ornati

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060609085920.GA4869@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ornati@fastwebnet.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.