linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: syzkaller <syzkaller@googlegroups.com>
Cc: Andrey Konovalov <andreyknvl@google.com>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Alexander Potapenko <glider@google.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	"x86@kernel.org" <x86@kernel.org>,
	Kostya Serebryany <kcc@google.com>
Subject: Re: x86: warning in unwind_get_return_address
Date: Thu, 5 Jan 2017 15:59:52 +0100	[thread overview]
Message-ID: <CACT4Y+agcezesdRUKtrho6sRmoRiCH6q4GU1J2QrTYqVkmJpKA@mail.gmail.com> (raw)
In-Reply-To: <20170105144942.whqucdwmeqybng3s@treble>

On Thu, Jan 5, 2017 at 3:49 PM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> On Tue, Dec 27, 2016 at 05:38:59PM +0100, Dmitry Vyukov wrote:
>> On Thu, Dec 22, 2016 at 6:17 AM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>> > On Wed, Dec 21, 2016 at 01:46:36PM +0100, Andrey Konovalov wrote:
>> >> On Wed, Dec 21, 2016 at 12:36 AM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>> >> >
>> >> > Thanks.  Looking at the stack trace, my guess is that an interrupt hit
>> >> > while running in generated BPF code, and the unwinder got confused
>> >> > because regs->ip points to the generated code.  I may need to disable
>> >> > that warning until we figure out a better solution.
>> >> >
>> >> > Can you share your .config file?
>> >>
>> >> Sure, attached.
>> >
>> > Ok, I was able to recreate with your config.  The culprit was generated
>> > code, as I suspected, though it wasn't BPF, it was a kprobe (created by
>> > dccpprobe_init()).
>> >
>> > I'll make a patch to disable the warning.
>>
>> Hi,
>>
>> I am also seeing the following warnings:
>>
>> [  281.889259] WARNING: kernel stack regs at ffff8801c29a7ea8 in
>> syz-executor8:1302 has bad 'bp' value ffff8801c29a7f28
>> [  833.994878] WARNING: kernel stack regs at ffff8801c4e77ea8 in
>> syz-executor1:13094 has bad 'bp' value ffff8801c4e77f28
>>
>> Can it also be caused by bpf/kprobe?
>
> This is a different warning.  I suspect it's due to unwinding the stack
> of another CPU while it's running, which is still possible in a few
> places.  I'm going to have to disable all these warnings for now.


I also have the following diff locally. These loads trigger episodic
KASAN warnings about stack-of-bounds reads on rcu stall warnings when
it does backtrace of all cpus.
If it looks correct to you, can you please also incorporate it into your patch?


diff --git a/arch/x86/include/asm/stacktrace.h
b/arch/x86/include/asm/stacktrace.h
index a3269c897ec5..d8d4fc66ffec 100644
--- a/arch/x86/include/asm/stacktrace.h
+++ b/arch/x86/include/asm/stacktrace.h
@@ -58,7 +58,7 @@ get_frame_pointer(struct task_struct *task, struct
pt_regs *regs)
        if (task == current)
                return __builtin_frame_address(0);

-       return (unsigned long *)((struct inactive_task_frame
*)task->thread.sp)->bp;
+       return (unsigned long *)READ_ONCE_NOCHECK(((struct
inactive_task_frame *)task->thread.sp)->bp);
 }
 #else
 static inline unsigned long *
diff --git a/arch/x86/kernel/unwind_frame.c b/arch/x86/kernel/unwind_frame.c
index 4443e499f279..f3a225ffa231 100644
--- a/arch/x86/kernel/unwind_frame.c
+++ b/arch/x86/kernel/unwind_frame.c
@@ -162,7 +162,7 @@ bool unwind_next_frame(struct unwind_state *state)
        if (state->regs)
                next_bp = (unsigned long *)state->regs->bp;
        else
-               next_bp = (unsigned long *)*state->bp;
+               next_bp = (unsigned long *)READ_ONCE_NOCHECK(*state->bp);

        /* is the next frame pointer an encoded pointer to pt_regs? */
        regs = decode_frame_pointer(next_bp);

  reply	other threads:[~2017-01-05 15:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 14:43 x86: warning in unwind_get_return_address Andrey Konovalov
2016-12-20 21:01 ` Josh Poimboeuf
2016-12-20 22:35   ` Andrey Konovalov
2016-12-20 23:36     ` Josh Poimboeuf
2016-12-21 12:46       ` Andrey Konovalov
2016-12-22  5:17         ` Josh Poimboeuf
2016-12-27 16:38           ` Dmitry Vyukov
2017-01-05 14:49             ` Josh Poimboeuf
2017-01-05 14:59               ` Dmitry Vyukov [this message]
2017-01-05 15:17                 ` Josh Poimboeuf
2017-01-05 17:03                   ` Josh Poimboeuf
2017-01-05 20:23                     ` Dmitry Vyukov
2017-01-05 20:37                       ` Josh Poimboeuf

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=CACT4Y+agcezesdRUKtrho6sRmoRiCH6q4GU1J2QrTYqVkmJpKA@mail.gmail.com \
    --to=dvyukov@google.com \
    --cc=andreyknvl@google.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=glider@google.com \
    --cc=hpa@zytor.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=syzkaller@googlegroups.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).