From: Mark Rutland <mark.rutland@arm.com>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: linux-kernel@vger.kernel.org,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <adech.fo@gmail.com>,
Dmitriy Vyukov <dvyukov@google.com>,
will.deacon@arm.com, catalin.marinas@arm.com,
Andrew Morton <akpm@linux-foundation.org>,
kasan-dev@googlegroups.com, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 2/2] kasan: unpoison stack of idle task on cpu online
Date: Wed, 2 Mar 2016 15:43:58 +0000 [thread overview]
Message-ID: <20160302154357.GF11670@leverpostej> (raw)
In-Reply-To: <56D70675.7050503@virtuozzo.com>
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.
next prev parent reply other threads:[~2016-03-02 15:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 12:38 [PATCH v1] kasan, arm64: Unpoison dirty stack frames when resuming from suspend Alexander Potapenko
2016-02-26 13:53 ` Mark Rutland
2016-02-26 17:28 ` Alexander Potapenko
2016-03-01 19:37 ` Mark Rutland
2016-03-01 19:42 ` Mark Rutland
2016-03-01 20:05 ` [PATCH] sched/kasan: clear stale stack poison kbuild test robot
2016-03-02 12:53 ` [PATCH v1] kasan, arm64: Unpoison dirty stack frames when resuming from suspend Andrey Ryabinin
2016-03-02 13:51 ` [PATCH 1/2] cpu, idle: move init_idle() out of idle_thread_get() Andrey Ryabinin
2016-03-02 13:51 ` [PATCH 2/2] kasan: unpoison stack of idle task on cpu online Andrey Ryabinin
2016-03-02 14:50 ` Mark Rutland
2016-03-02 15:27 ` Andrey Ryabinin
2016-03-02 15:43 ` Mark Rutland [this message]
2016-02-27 1:05 ` [PATCH v1] kasan, arm64: Unpoison dirty stack frames when resuming from suspend kbuild test robot
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=20160302154357.GF11670@leverpostej \
--to=mark.rutland@arm.com \
--cc=adech.fo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aryabinin@virtuozzo.com \
--cc=catalin.marinas@arm.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
/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