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


Groups > linux.kernel > #1348211

Re: [PATCH 2/2] kasan: unpoison stack of idle task on cpu online

From Mark Rutland <mark.rutland@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] kasan: unpoison stack of idle task on cpu online
Date 2016-03-02 16:50 +0100
Message-ID <r8hch-1c4-69@gated-at.bofh.it> (permalink)
References <r8exI-7Hb-3@gated-at.bofh.it> <r8ftN-8on-21@gated-at.bofh.it> <r8ftO-8on-41@gated-at.bofh.it> <r8gpQ-Cq-7@gated-at.bofh.it> <r8gSS-14i-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Mar 02, 2016 at 06:27:49PM +0300, Andrey Ryabinin wrote:
> On 03/02/2016 05:50 PM, Mark Rutland wrote:
> > On Wed, Mar 02, 2016 at 04:51:59PM +0300, Andrey Ryabinin wrote:

[...]

> > Is all the above necessary?
> > 
> > Surely we can just include <linux/smpboot.h> in mm/kasan/kasan.c?
> 
> It is necessary. kernel/smpboot.h != include/linux/smpboot.h

Ah, I'd misread the patch. Sorry for the noise!

[...]

> >> +		struct task_struct *tidle = idle_thread_get(cpu);
> >> +		kasan_unpoison_shadow(task_stack_page(tidle), THREAD_SIZE);
> > 
> > We never expect the stack to hit the end of the thread_info, so we can
> > start at task_stack_page(tidle) + 1, and avoid the shadow for
> > sizeof(struct thread_info).
> > 
> 
> I wouldn't bother, it's simpler to unpoison all. Size of struct thread_info is 32-bytes. That's 4-bytes of shadow.
> I don't think it matters whether you do memset of 2048 or 2044 bytes.
> 
> > Do we do any poisoning of the thread_info structure in the thread_union?
> 
> No, why would we poison it? It's absolutely valid memory and available for access.

For some reason I thought ASAN might poison gaps between struct
elements, or at least held open the option to. I guess inserting padding
would be an ABI issue, so it probably doesn't.

In the absence of that, I agree that always starting at
task_stack_page(t), and clearing the shadow for THREAD_SIZE bytes of
stack makes sense).

Thanks,
Mark.

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


Thread

[PATCH v1] kasan, arm64: Unpoison dirty stack frames when resuming from suspend. Alexander Potapenko <glider@google.com> - 2016-02-26 13:40 +0100
  Re: [PATCH v1] kasan, arm64: Unpoison dirty stack frames when  resuming from suspend. Mark Rutland <mark.rutland@arm.com> - 2016-02-26 15:00 +0100
    Re: [PATCH v1] kasan, arm64: Unpoison dirty stack frames when  resuming from suspend. Alexander Potapenko <glider@google.com> - 2016-02-26 18:30 +0100
      Re: [PATCH v1] kasan, arm64: Unpoison dirty stack frames when  resuming from suspend. Mark Rutland <mark.rutland@arm.com> - 2016-03-01 20:40 +0100
      Re: [PATCH v1] kasan, arm64: Unpoison dirty stack frames when  resuming from suspend. Mark Rutland <mark.rutland@arm.com> - 2016-03-01 20:50 +0100
        Re: [PATCH v1] kasan, arm64: Unpoison dirty stack frames when  resuming from suspend. Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-03-02 14:00 +0100
          [PATCH 1/2] cpu, idle: move init_idle() out of idle_thread_get() Andrey Ryabinin <aryabinin@virtuozzo.com> - 2016-03-02 15:00 +0100
            [PATCH 2/2] kasan: unpoison stack of idle task on cpu online Andrey Ryabinin <aryabinin@virtuozzo.com> - 2016-03-02 15:00 +0100
              Re: [PATCH 2/2] kasan: unpoison stack of idle task on cpu online Mark Rutland <mark.rutland@arm.com> - 2016-03-02 16:00 +0100
                Re: [PATCH 2/2] kasan: unpoison stack of idle task on cpu online Andrey Ryabinin <aryabinin@virtuozzo.com> - 2016-03-02 16:30 +0100
                Re: [PATCH 2/2] kasan: unpoison stack of idle task on cpu online Mark Rutland <mark.rutland@arm.com> - 2016-03-02 16:50 +0100

csiph-web