From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751570AbdHOLUX (ORCPT ); Tue, 15 Aug 2017 07:20:23 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50360 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751030AbdHOLUW (ORCPT ); Tue, 15 Aug 2017 07:20:22 -0400 Date: Tue, 15 Aug 2017 12:19:11 +0100 From: Mark Rutland To: Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, keescook@chromium.org, ard.biesheuvel@linaro.org, matt@codeblueprint.co.uk, kernel-hardening@lists.openwall.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, luto@amacapital.net, james.morse@arm.com, labbott@redhat.com Subject: Re: [PATCH 14/14] arm64: add VMAP_STACK overflow detection Message-ID: <20170815111910.GF6090@leverpostej> References: <1502130965-18710-1-git-send-email-mark.rutland@arm.com> <1502130965-18710-15-git-send-email-mark.rutland@arm.com> <20170815111031.xbga45isn5gumeni@armageddon.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170815111031.xbga45isn5gumeni@armageddon.cambridge.arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.