mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Josh Poimboeuf <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, hpa@zytor.com,
	torvalds@linux-foundation.org, bp@alien8.de, jpoimboe@redhat.com,
	luto@kernel.org, linux-kernel@vger.kernel.org,
	dvlasenk@redhat.com, tglx@linutronix.de, mingo@kernel.org,
	luto@amacapital.net, brgerst@gmail.com
Subject: [tip:x86/asm] x86/dumpstack: Print orig_ax in __show_regs()
Date: Fri, 21 Oct 2016 00:51:48 -0700	[thread overview]
Message-ID: <tip-6fa81a12b3f1834a22167aa2d7b24dcc4bf884e3@git.kernel.org> (raw)
In-Reply-To: <93f0fe0307a4af884d3fca00edabcc8cff236002.1476973742.git.jpoimboe@redhat.com>

Commit-ID:  6fa81a12b3f1834a22167aa2d7b24dcc4bf884e3
Gitweb:     http://git.kernel.org/tip/6fa81a12b3f1834a22167aa2d7b24dcc4bf884e3
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Thu, 20 Oct 2016 11:34:45 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 21 Oct 2016 09:26:05 +0200

x86/dumpstack: Print orig_ax in __show_regs()

The value of regs->orig_ax contains potentially useful debugging data:
For syscalls it contains the syscall number.  For interrupts it contains
the (negated) vector number.  To reduce noise, print it only if it has a
useful value (i.e., something other than -1).

Here's what it looks like for a write syscall:

  RIP: 0033:[<00007f53ad7b1940>] 0x7f53ad7b1940
  RSP: 002b:00007fff8de66558 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
  RAX: ffffffffffffffda RBX: 0000000000000046 RCX: 00007f53ad7b1940
  RDX: 0000000000000002 RSI: 00007f53ae0ca000 RDI: 0000000000000001
  ...

Suggested-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/93f0fe0307a4af884d3fca00edabcc8cff236002.1476973742.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/process_64.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index b3b50ac..f1c36da 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -63,8 +63,13 @@ void __show_regs(struct pt_regs *regs, int all)
 
 	printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] %pS\n", regs->cs & 0xffff,
 			regs->ip, (void *)regs->ip);
-	printk(KERN_DEFAULT "RSP: %04lx:%016lx  EFLAGS: %08lx\n", regs->ss,
+	printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx", regs->ss,
 			regs->sp, regs->flags);
+	if (regs->orig_ax != -1)
+		pr_cont(" ORIG_RAX: %016lx\n", regs->orig_ax);
+	else
+		pr_cont("\n");
+
 	printk(KERN_DEFAULT "RAX: %016lx RBX: %016lx RCX: %016lx\n",
 	       regs->ax, regs->bx, regs->cx);
 	printk(KERN_DEFAULT "RDX: %016lx RSI: %016lx RDI: %016lx\n",

      reply	other threads:[~2016-10-21  7:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-20 16:34 [PATCH 0/6] x86/dumpstack: print entry regs when dumping the stack Josh Poimboeuf
2016-10-20 16:34 ` [PATCH 1/6] x86/entry/unwind: create stack frames for saved interrupt registers Josh Poimboeuf
2016-10-21  7:49   ` [tip:x86/asm] x86/entry/unwind: Create " tip-bot for Josh Poimboeuf
2016-10-20 16:34 ` [PATCH 2/6] x86/unwind: create stack frames for saved syscall registers Josh Poimboeuf
2016-10-21  7:49   ` [tip:x86/asm] x86/unwind: Create " tip-bot for Josh Poimboeuf
2016-10-20 16:34 ` [PATCH 3/6] x86/dumpstack: print stack identifier on its own line Josh Poimboeuf
2016-10-21  7:50   ` [tip:x86/asm] x86/dumpstack: Print " tip-bot for Josh Poimboeuf
2016-10-20 16:34 ` [PATCH 4/6] x86/dumpstack: print any pt_regs found on the stack Josh Poimboeuf
2016-10-21  7:50   ` [tip:x86/asm] x86/dumpstack: Print " tip-bot for Josh Poimboeuf
2016-10-20 16:34 ` [PATCH 5/6] x86/dumpstack: fix duplicate RIP address display in __show_regs() Josh Poimboeuf
2016-10-21  7:51   ` [tip:x86/asm] x86/dumpstack: Fix " tip-bot for Josh Poimboeuf
2016-10-20 16:34 ` [PATCH 6/6] x86/dumpstack: print orig_ax " Josh Poimboeuf
2016-10-21  7:51   ` tip-bot for Josh Poimboeuf [this message]

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=tip-6fa81a12b3f1834a22167aa2d7b24dcc4bf884e3@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome