public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2] arm64: kasan: clear stale stack poison
Date: Wed, 2 Mar 2016 13:55:36 +0000	[thread overview]
Message-ID: <20160302135535.GE7637@arm.com> (raw)
In-Reply-To: <20160302124723.GA11086@e104818-lin.cambridge.arm.com>

On Wed, Mar 02, 2016 at 12:47:24PM +0000, Catalin Marinas wrote:
> On Wed, Mar 02, 2016 at 11:48:34AM +0000, Mark Rutland wrote:
> > On Wed, Mar 02, 2016 at 10:56:20AM +0000, Lorenzo Pieralisi wrote:
> > > On Tue, Mar 01, 2016 at 08:01:05PM +0000, Mark Rutland wrote:
> > > 
> > > [...]
> > > 
> > > > diff --git a/arch/arm64/include/asm/kasan.h b/arch/arm64/include/asm/kasan.h
> > > > index 2774fa3..6f00b76 100644
> > > > --- a/arch/arm64/include/asm/kasan.h
> > > > +++ b/arch/arm64/include/asm/kasan.h
> > > > @@ -1,10 +1,30 @@
> > > >  #ifndef __ASM_KASAN_H
> > > >  #define __ASM_KASAN_H
> > > >  
> > > > -#ifndef __ASSEMBLY__
> > > > -
> > > > +#ifndef LINKER_SCRIPT
> > > >  #ifdef CONFIG_KASAN
> > > >  
> > > > +#ifdef __ASSEMBLY__
> > > > +
> > > > +#include <asm/asm-offsets.h>
> > > > +#include <asm/thread_info.h>
> > > > +
> > > > +	/*
> > > > +	 * Remove stale shadow posion for the stack left over from a prior
> > > > +	 * hot-unplug or idle exit, from the lowest stack address in the
> > > > +	 * thread_union up to the covering up to the current stack pointer.
> > > > +	 * Shadow poison above this is preserved.
> > > > +	 */
> > > > +	.macro kasan_unpoison_stack
> > > > +	mov	x1, sp
> > > > +	and	x0, x1, #~(THREAD_SIZE - 1)
> > > 
> > > I suspect you did not use sp_el0 on purpose here (that contains a
> > > pointer to thread_info), just asking.
> > 
> > I worked on the assumption that the arithmetic was likely to be faster
> > than a system register access, but I do not have numbers to back that
> > up.
> > 
> > I'm happy to use sp_el0 if that's preferrable.
> 
> Since we need sp anyway, it is probably faster. But, I think the current
> patch is more to the point - clearing from the bottom of the current
> stack up to the current sp, we don't need any assumption about sp_el0 (I
> guess we never call cpu_suspend() on an IRQ stack, though I'm not 100%
> sure).
> 
> I don't think Will wants to send this as a fix for 4.5, probably not
> urgent but I'll let him decide. In any case:
> 
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

I wasn't rushing to queue this, especially with the hotplug case
outstanding. Feel free to take it for 4.6.

Will

      reply	other threads:[~2016-03-02 13:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 20:01 [PATCHv2] arm64: kasan: clear stale stack poison Mark Rutland
2016-03-02 10:56 ` Lorenzo Pieralisi
2016-03-02 11:48   ` Mark Rutland
2016-03-02 12:47     ` Catalin Marinas
2016-03-02 13:55       ` Will Deacon [this message]

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=20160302135535.GE7637@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.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