From: tip-bot for Eiichi Tsukata <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, juri.lelli@gmail.com, mingo@kernel.org,
tglx@linutronix.de, devel@etsukata.com,
linux-kernel@vger.kernel.org
Subject: [tip:x86/urgent] x86/stacktrace: Prevent access_ok() warnings in arch_stack_walk_user()
Date: Mon, 22 Jul 2019 01:46:04 -0700 [thread overview]
Message-ID: <tip-2af7c85714d8cafadf925d55441458eae312cd6b@git.kernel.org> (raw)
In-Reply-To: <20190722083216.16192-2-devel@etsukata.com>
Commit-ID: 2af7c85714d8cafadf925d55441458eae312cd6b
Gitweb: https://git.kernel.org/tip/2af7c85714d8cafadf925d55441458eae312cd6b
Author: Eiichi Tsukata <devel@etsukata.com>
AuthorDate: Mon, 22 Jul 2019 17:32:16 +0900
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 22 Jul 2019 10:42:36 +0200
x86/stacktrace: Prevent access_ok() warnings in arch_stack_walk_user()
When arch_stack_walk_user() is called from atomic contexts, access_ok() can
trigger the following warning if compiled with CONFIG_DEBUG_ATOMIC_SLEEP=y.
Reproducer:
// CONFIG_DEBUG_ATOMIC_SLEEP=y
# cd /sys/kernel/debug/tracing
# echo 1 > options/userstacktrace
# echo 1 > events/irq/irq_handler_entry/enable
WARNING: CPU: 0 PID: 2649 at arch/x86/kernel/stacktrace.c:103 arch_stack_walk_user+0x6e/0xf6
CPU: 0 PID: 2649 Comm: bash Not tainted 5.3.0-rc1+ #99
RIP: 0010:arch_stack_walk_user+0x6e/0xf6
Call Trace:
<IRQ>
stack_trace_save_user+0x10a/0x16d
trace_buffer_unlock_commit_regs+0x185/0x240
trace_event_buffer_commit+0xec/0x330
trace_event_raw_event_irq_handler_entry+0x159/0x1e0
__handle_irq_event_percpu+0x22d/0x440
handle_irq_event_percpu+0x70/0x100
handle_irq_event+0x5a/0x8b
handle_edge_irq+0x12f/0x3f0
handle_irq+0x34/0x40
do_IRQ+0xa6/0x1f0
common_interrupt+0xf/0xf
</IRQ>
Fix it by calling __range_not_ok() directly instead of access_ok() as
copy_from_user_nmi() does. This is fine here because the actual copy is
inside a pagefault disabled region.
Reported-by: Juri Lelli <juri.lelli@gmail.com>
Signed-off-by: Eiichi Tsukata <devel@etsukata.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190722083216.16192-2-devel@etsukata.com
---
arch/x86/kernel/stacktrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index 4f36d3241faf..2d6898c2cb64 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -100,7 +100,7 @@ copy_stack_frame(const void __user *fp, struct stack_frame_user *frame)
{
int ret;
- if (!access_ok(fp, sizeof(*frame)))
+ if (__range_not_ok(fp, sizeof(*frame), TASK_SIZE))
return 0;
ret = 1;
prev parent reply other threads:[~2019-07-22 8:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-03 16:16 WARN_ON: userstacktrace on irq events Steven Rostedt
2019-04-05 8:12 ` Thomas Gleixner
2019-04-05 13:32 ` Steven Rostedt
2019-06-21 14:12 ` Masami Hiramatsu
2019-07-22 8:32 ` [PATCH 0/1] x86/stacktrace: Fix userstacktrace access_ok() WARNING in " Eiichi Tsukata
2019-07-22 8:32 ` [PATCH 1/1] " Eiichi Tsukata
2019-07-22 8:46 ` tip-bot for Eiichi Tsukata [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-2af7c85714d8cafadf925d55441458eae312cd6b@git.kernel.org \
--to=tipbot@zytor.com \
--cc=devel@etsukata.com \
--cc=hpa@zytor.com \
--cc=juri.lelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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