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


Groups > linux.kernel > #1712079 > unrolled thread

Re: [PATCH 14/14] arm64: add VMAP_STACK overflow detection

Started byCatalin Marinas <catalin.marinas@arm.com>
First post2017-08-15 13:20 +0200
Last post2017-08-15 13:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 14/14] arm64: add VMAP_STACK overflow detection Catalin Marinas <catalin.marinas@arm.com> - 2017-08-15 13:20 +0200
    Re: [PATCH 14/14] arm64: add VMAP_STACK overflow detection Mark Rutland <mark.rutland@arm.com> - 2017-08-15 13:30 +0200

#1712079 — Re: [PATCH 14/14] arm64: add VMAP_STACK overflow detection

FromCatalin Marinas <catalin.marinas@arm.com>
Date2017-08-15 13:20 +0200
SubjectRe: [PATCH 14/14] arm64: add VMAP_STACK overflow detection
Message-ID<ueI38-An-5@gated-at.bofh.it>
On Mon, Aug 07, 2017 at 07:36:05PM +0100, Mark Rutland wrote:
> diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
> index e5aa866..44a27c3 100644
> --- a/arch/arm64/kernel/entry.S
> +++ b/arch/arm64/kernel/entry.S
> @@ -72,6 +72,37 @@
>  	.macro kernel_ventry	label
>  	.align 7
>  	sub	sp, sp, #S_FRAME_SIZE
> +#ifdef CONFIG_VMAP_STACK
> +	add	sp, sp, x0			// sp' = sp + x0
> +	sub	x0, sp, x0			// x0' = sp' - x0 = (sp + x0) - x0 = sp
> +	tbnz	x0, #THREAD_SHIFT, 0f
> +	sub	x0, sp, x0			// sp' - x0' = (sp + x0) - sp = x0
> +	sub	sp, sp, x0			// sp' - x0 = (sp + x0) - x0 = sp
> +	b	\label

Maybe a small comment before this hunk just to tell the user that it's
trying to test a bit in SP without corrupting a gpr. It's obvious once
you read it but not you see it for the first time ;).

> +
> +	/* Stash the original SP value in tpidr_el0 */
> +0:	msr	tpidr_el0, x0

And a comment here that on this path we no longer care about the user
tpidr_el0 as we are never returning there.

Otherwise I'm fine with the series (I'm not a fan of the complexity it
adds but I don't have a better suggestion).

-- 
Catalin

[toc] | [next] | [standalone]


#1712089

FromMark Rutland <mark.rutland@arm.com>
Date2017-08-15 13:30 +0200
Message-ID<ueIcN-DE-9@gated-at.bofh.it>
In reply to#1712079
On Tue, Aug 15, 2017 at 12:10:32PM +0100, Catalin Marinas wrote:
> On Mon, Aug 07, 2017 at 07:36:05PM +0100, Mark Rutland wrote:
> > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
> > index e5aa866..44a27c3 100644
> > --- a/arch/arm64/kernel/entry.S
> > +++ b/arch/arm64/kernel/entry.S
> > @@ -72,6 +72,37 @@
> >  	.macro kernel_ventry	label
> >  	.align 7
> >  	sub	sp, sp, #S_FRAME_SIZE
> > +#ifdef CONFIG_VMAP_STACK
> > +	add	sp, sp, x0			// sp' = sp + x0
> > +	sub	x0, sp, x0			// x0' = sp' - x0 = (sp + x0) - x0 = sp
> > +	tbnz	x0, #THREAD_SHIFT, 0f
> > +	sub	x0, sp, x0			// sp' - x0' = (sp + x0) - sp = x0
> > +	sub	sp, sp, x0			// sp' - x0 = (sp + x0) - x0 = sp
> > +	b	\label
> 
> Maybe a small comment before this hunk just to tell the user that it's
> trying to test a bit in SP without corrupting a gpr. It's obvious once
> you read it but not you see it for the first time ;).
> 
> > +
> > +	/* Stash the original SP value in tpidr_el0 */
> > +0:	msr	tpidr_el0, x0
> 
> And a comment here that on this path we no longer care about the user
> tpidr_el0 as we are never returning there.

Ok.

I've updated comments in both cases.

> Otherwise I'm fine with the series (I'm not a fan of the complexity it
> adds but I don't have a better suggestion).

Thanks!

I'll send out a v2 shortly with the changes you requested.

Thanks,
Mark.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web