public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Scott Bauer <scott.bauer@intel.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@kernel.org, luto@amacapital.net
Subject: Re: BUG: KASAN: stack-out-of-bounds in unwind_get_return_address
Date: Wed, 30 Nov 2016 12:02:17 -0700	[thread overview]
Message-ID: <20161130190217.GA2756@sbauer-Z170X-UD5> (raw)
In-Reply-To: <20161130183507.syv3cdpp3hzxi77k@treble>

On Wed, Nov 30, 2016 at 12:35:07PM -0600, Josh Poimboeuf wrote:
> On Tue, Nov 29, 2016 at 11:13:01AM -0700, Scott Bauer wrote:
> > This is super easy to repro ontop of 4.9-rc7:
> > run pm-suspend and it hits every time
> > 
> > 
> > [  968.667086] ==================================================================
> > [  968.667091] BUG: KASAN: stack-out-of-bounds in unwind_get_return_address+0x11d/0x130 at addr ffff8803867d7878
> > [  968.667092] Read of size 8 by task pm-suspend/7774
> > [  968.667095] page:ffffea000e19f5c0 count:0 mapcount:0 mapping:          (null) index:0x0
> > [  968.667096] flags: 0x2ffff0000000000()
> > [  968.667097] page dumped because: kasan: bad access detected
> 
> Thanks for reporting this.  I think it's a false positive caused by the
> fact that the suspend and resume happen at different contexts.
> 
> Can you test if this patch fixes it?
> 
> diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
> index 4858733..62bd046 100644
> --- a/arch/x86/kernel/acpi/sleep.c
> +++ b/arch/x86/kernel/acpi/sleep.c
> @@ -115,6 +115,9 @@ int x86_acpi_suspend_lowlevel(void)
>  	pause_graph_tracing();
>  	do_suspend_lowlevel();
>  	unpause_graph_tracing();
> +
> +	kasan_unpoison_stack_below_sp();
> +
>  	return 0;
>  }
>  
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index 820c0ad..ca36126 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -45,6 +45,12 @@ void kasan_unpoison_shadow(const void *address, size_t size);
>  
>  void kasan_unpoison_task_stack(struct task_struct *task);
>  void kasan_unpoison_stack_above_sp_to(const void *watermark);
> +asmlinkage void kasan_unpoison_task_stack_below(const void *watermark);
> +
> +static inline void kasan_unpoison_stack_below_sp(void)
> +{
> +	kasan_unpoison_task_stack_below(__builtin_frame_address(0));
> +}
>  
>  void kasan_alloc_pages(struct page *page, unsigned int order);
>  void kasan_free_pages(struct page *page, unsigned int order);


Thanks for the quick turn-around. This patch worked for me. You can add me as
tested by if you need.

  reply	other threads:[~2016-11-30 19:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29 18:13 BUG: KASAN: stack-out-of-bounds in unwind_get_return_address Scott Bauer
2016-11-30 18:35 ` Josh Poimboeuf
2016-11-30 19:02   ` Scott Bauer [this message]
2016-11-30 23:10     ` [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf
2016-12-01  9:05       ` Andrey Ryabinin
2016-12-01 14:58         ` Josh Poimboeuf
2016-12-01 16:45           ` Josh Poimboeuf
2016-12-01 16:51             ` Dmitry Vyukov
2016-12-01 17:13               ` Josh Poimboeuf
2016-12-01 17:27                 ` Dmitry Vyukov
2016-12-01 17:34                   ` Josh Poimboeuf
2016-12-01 17:47                     ` Dmitry Vyukov
2016-12-01 17:56                       ` Josh Poimboeuf
2016-12-01 20:31                         ` [PATCH v2] " Josh Poimboeuf
2016-12-02  9:44                           ` Dmitry Vyukov
2016-12-02 12:54                           ` Pavel Machek
2016-12-02 13:41                           ` Andrey Ryabinin
2016-12-02 14:01                             ` Josh Poimboeuf
2016-12-02 14:02                               ` Dmitry Vyukov
2016-12-02 14:42                               ` [PATCH v3] " Josh Poimboeuf
2016-12-02 14:45                                 ` Andrey Ryabinin
2016-12-02 15:08                                   ` Josh Poimboeuf
2016-12-02 17:42                                     ` [PATCH v4] " Josh Poimboeuf
2016-12-02 20:55                                       ` Andrey Ryabinin
2016-12-02 21:09                                       ` Pavel Machek
2016-12-02 21:57                                         ` Josh Poimboeuf
2016-12-08  0:10                                       ` Rafael J. Wysocki
2016-12-01 14:04       ` [PATCH] " Rafael J. Wysocki
2016-12-01 16:53         ` Josh Poimboeuf
2016-12-01 17:05           ` Rafael J. Wysocki
2016-12-02 10:15             ` Ingo Molnar

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=20161130190217.GA2756@sbauer-Z170X-UD5 \
    --to=scott.bauer@intel.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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