Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1461210

[PATCH v3 22/51] proc: fix return address printk conversion specifer in /proc/<pid>/stack

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Josh Poimboeuf <jpoimboe@redhat.com>
Newsgroups linux.kernel
Subject [PATCH v3 22/51] proc: fix return address printk conversion specifer in /proc/<pid>/stack
Date Fri, 12 Aug 2016 16:40:02 +0200
Message-ID <s5lMS-2Ra-17@gated-at.bofh.it> (permalink)
References <s5lMR-2Ra-3@gated-at.bofh.it>
X-Scanned-By MIMEDefang 2.68 on 10.5.11.23
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 12 Aug 2016 14:32:06 +0000 (UTC)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 29
Organization linux.* mail to news gateway
X-Original-Cc x86@kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski <luto@amacapital.net>, Linus Torvalds <torvalds@linux-foundation.org>, Steven Rostedt <rostedt@goodmis.org>, Brian Gerst <brgerst@gmail.com>, Kees Cook <keescook@chromium.org>, Peter Zijlstra <peterz@infradead.org>, Frederic Weisbecker <fweisbec@gmail.com>, Byungchul Park <byungchul.park@lge.com>, Nilay Vaish <nilayvaish@gmail.com>
X-Original-Date Fri, 12 Aug 2016 09:28:41 -0500
X-Original-Message-ID <d7626125898b9f959b25738641552cc7a24fc31b.1471011425.git.jpoimboe@redhat.com>
X-Original-References <cover.1471011425.git.jpoimboe@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1461210

Show key headers only | View raw


When printing call return addresses found on a stack, /proc/<pid>/stack
can sometimes give a confusing result.  If the call instruction was the
last instruction in the function (which can happen when calling a
noreturn function), '%pS' will incorrectly display the name of the
function which happens to be next in the object code, rather than the
name of the actual calling function.

Use '%pB' instead, which was created for this exact purpose.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 fs/proc/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 54e2702..e9ff186 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -483,7 +483,7 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
 		save_stack_trace_tsk(task, &trace);
 
 		for (i = 0; i < trace.nr_entries; i++) {
-			seq_printf(m, "[<%pK>] %pS\n",
+			seq_printf(m, "[<%pK>] %pB\n",
 				   (void *)entries[i], (void *)entries[i]);
 		}
 		unlock_trace(task);
-- 
2.7.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v3 22/51] proc: fix return address printk conversion specifer in /proc/<pid>/stack Josh Poimboeuf <jpoimboe@redhat.com> - 2016-08-12 16:40 +0200

csiph-web