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


Groups > linux.kernel > #1533516

Re: BUG: KASAN: stack-out-of-bounds in unwind_get_return_address

From Scott Bauer <scott.bauer@intel.com>
Newsgroups linux.kernel
Subject Re: BUG: KASAN: stack-out-of-bounds in unwind_get_return_address
Date 2016-11-30 20:10 +0100
Message-ID <sJiqu-1CH-13@gated-at.bofh.it> (permalink)
References <sIVke-3Ce-19@gated-at.bofh.it> <sJhXr-1dw-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

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


Thread

BUG: KASAN: stack-out-of-bounds in unwind_get_return_address Scott Bauer <scott.bauer@intel.com> - 2016-11-29 19:30 +0100
  Re: BUG: KASAN: stack-out-of-bounds in unwind_get_return_address Josh Poimboeuf <jpoimboe@redhat.com> - 2016-11-30 19:40 +0100
    Re: BUG: KASAN: stack-out-of-bounds in unwind_get_return_address Scott Bauer <scott.bauer@intel.com> - 2016-11-30 20:10 +0100
      [PATCH] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 00:20 +0100
        Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume "Rafael J. Wysocki" <rafael@kernel.org> - 2016-12-01 15:10 +0100
          Re: [PATCH] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 18:00 +0100
            Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume "Rafael J. Wysocki" <rafael@kernel.org> - 2016-12-01 18:10 +0100
              Re: [PATCH] x86/suspend: fix false positive KASAN warning on  suspend/resume Ingo Molnar <mingo@kernel.org> - 2016-12-02 11:20 +0100
        Re: [PATCH] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 16:00 +0100
          Re: [PATCH] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 17:50 +0100
            Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Dmitry Vyukov <dvyukov@google.com> - 2016-12-01 18:00 +0100
              Re: [PATCH] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 18:20 +0100
                Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Dmitry Vyukov <dvyukov@google.com> - 2016-12-01 18:30 +0100
                Re: [PATCH] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 18:40 +0100
                Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Dmitry Vyukov <dvyukov@google.com> - 2016-12-01 18:50 +0100
                Re: [PATCH] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 19:00 +0100
                [PATCH v2] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 21:40 +0100
                Re: [PATCH v2] x86/suspend: fix false positive KASAN warning on suspend/resume Dmitry Vyukov <dvyukov@google.com> - 2016-12-02 10:50 +0100
                Re: [PATCH v2] x86/suspend: fix false positive KASAN warning on  suspend/resume Pavel Machek <pavel@ucw.cz> - 2016-12-02 14:00 +0100
                Re: [PATCH v2] x86/suspend: fix false positive KASAN warning on suspend/resume Dmitry Vyukov <dvyukov@google.com> - 2016-12-02 15:10 +0100
                Re: [PATCH v2] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-02 15:10 +0100
                [PATCH v3] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-02 15:50 +0100
                Re: [PATCH v3] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-02 16:10 +0100
                [PATCH v4] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-02 18:50 +0100
                Re: [PATCH v4] x86/suspend: fix false positive KASAN warning on  suspend/resume Pavel Machek <pavel@ucw.cz> - 2016-12-02 22:10 +0100
                Re: [PATCH v4] x86/suspend: fix false positive KASAN warning on  suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-02 23:00 +0100
                Re: [PATCH v4] x86/suspend: fix false positive KASAN warning on suspend/resume "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-12-08 01:20 +0100

csiph-web