public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Josh Poimboeuf <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, torvalds@linux-foundation.org,
	bauerman@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, peterz@infradead.org, hpa@zytor.com,
	jpoimboe@redhat.com, fengguang.wu@intel.com
Subject: [tip:x86/urgent] x86/unwind: Disable KASAN checking in the ORC unwinder
Date: Wed, 8 Nov 2017 01:46:52 -0800	[thread overview]
Message-ID: <tip-881125bfe65bb772f34f4fcb04a35dfe117e186a@git.kernel.org> (raw)
In-Reply-To: <20171108021934.zbl6unh5hpugybc5@treble>

Commit-ID:  881125bfe65bb772f34f4fcb04a35dfe117e186a
Gitweb:     https://git.kernel.org/tip/881125bfe65bb772f34f4fcb04a35dfe117e186a
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Tue, 7 Nov 2017 20:19:34 -0600
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 8 Nov 2017 10:21:49 +0100

x86/unwind: Disable KASAN checking in the ORC unwinder

Fengguang reported a KASAN warning:

  Kprobe smoke test: started
  ==================================================================
  BUG: KASAN: stack-out-of-bounds in deref_stack_reg+0xb5/0x11a
  Read of size 8 at addr ffff8800001c7cd8 by task swapper/1

  CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.0-rc8 #26
  Call Trace:
   <#DB>
   ...
   save_trace+0xd9/0x1d3
   mark_lock+0x5f7/0xdc3
   __lock_acquire+0x6b4/0x38ef
   lock_acquire+0x1a1/0x2aa
   _raw_spin_lock_irqsave+0x46/0x55
   kretprobe_table_lock+0x1a/0x42
   pre_handler_kretprobe+0x3f5/0x521
   kprobe_int3_handler+0x19c/0x25f
   do_int3+0x61/0x142
   int3+0x30/0x60
  [...]

The ORC unwinder got confused by some kprobes changes, which isn't
surprising since the runtime code no longer matches vmlinux and the
stack was modified for kretprobes.

Until we have a way for generated code to register changes with the
unwinder, these types of warnings are inevitable.  So just disable KASAN
checks for stack accesses in the ORC unwinder.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20171108021934.zbl6unh5hpugybc5@treble
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/unwind_orc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index b95007e..a3f973b 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -279,7 +279,7 @@ static bool deref_stack_reg(struct unwind_state *state, unsigned long addr,
 	if (!stack_access_ok(state, addr, sizeof(long)))
 		return false;
 
-	*val = READ_ONCE_TASK_STACK(state->task, *(unsigned long *)addr);
+	*val = READ_ONCE_NOCHECK(*(unsigned long *)addr);
 	return true;
 }
 

      reply	other threads:[~2017-11-08  9:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07  9:32 [bzImage64_load] BUG: KASAN: stack-out-of-bounds in deref_stack_reg+0xb5/0x11a Fengguang Wu
2017-11-07 16:32 ` Linus Torvalds
2017-11-07 17:24   ` Josh Poimboeuf
2017-11-08  2:19     ` [PATCH] x86/unwind: Disable KASAN checking in the ORC unwinder Josh Poimboeuf
2017-11-08  9:46       ` 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-881125bfe65bb772f34f4fcb04a35dfe117e186a@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bauerman@linux.vnet.ibm.com \
    --cc=fengguang.wu@intel.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.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