From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kees Cook Date: Wed, 24 May 2017 16:16:51 +0000 Subject: Re: [PATCH 4/5] arm64: ascii armor the arm64 boot init stack canary Message-Id: List-Id: References: <20170524155751.424-1-riel@redhat.com> <20170524155751.424-5-riel@redhat.com> In-Reply-To: <20170524155751.424-5-riel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Rik van Riel , Andrew Morton Cc: LKML , Daniel Micay , Ted Ts'o , "H. Peter Anvin" , Andy Lutomirski , Ingo Molnar , "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Catalin Marinas , linux-sh , Yoshinori Sato , "kernel-hardening@lists.openwall.com" On Wed, May 24, 2017 at 8:57 AM, wrote: > From: Rik van Riel > > Use the ascii-armor canary to prevent unterminated C string overflows > from being able to successfully overwrite the canary, even if they > somehow obtain the canary value. > > Inspired by execshield ascii-armor and Daniel Micay's linux-hardened tree. > > Signed-off-by: Rik van Riel Acked-by: Kees Cook -Kees > --- > arch/arm64/include/asm/stackprotector.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/include/asm/stackprotector.h b/arch/arm64/include/asm/stackprotector.h > index fe5e287dc56b..b86a0865ddf1 100644 > --- a/arch/arm64/include/asm/stackprotector.h > +++ b/arch/arm64/include/asm/stackprotector.h > @@ -30,6 +30,7 @@ static __always_inline void boot_init_stack_canary(void) > /* Try to get a semi random initial value. */ > get_random_bytes(&canary, sizeof(canary)); > canary ^= LINUX_VERSION_CODE; > + canary &= CANARY_MASK; > > current->stack_canary = canary; > __stack_chk_guard = current->stack_canary; > -- > 2.9.3 > -- Kees Cook Pixel Security From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030619AbdEXQQ5 (ORCPT ); Wed, 24 May 2017 12:16:57 -0400 Received: from mail-it0-f54.google.com ([209.85.214.54]:36065 "EHLO mail-it0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966912AbdEXQQw (ORCPT ); Wed, 24 May 2017 12:16:52 -0400 MIME-Version: 1.0 In-Reply-To: <20170524155751.424-5-riel@redhat.com> References: <20170524155751.424-1-riel@redhat.com> <20170524155751.424-5-riel@redhat.com> From: Kees Cook Date: Wed, 24 May 2017 09:16:51 -0700 Message-ID: Subject: Re: [PATCH 4/5] arm64: ascii armor the arm64 boot init stack canary To: Rik van Riel , Andrew Morton Cc: LKML , Daniel Micay , "Ted Ts'o" , "H. Peter Anvin" , Andy Lutomirski , Ingo Molnar , "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Catalin Marinas , linux-sh , Yoshinori Sato , "kernel-hardening@lists.openwall.com" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 24, 2017 at 8:57 AM, wrote: > From: Rik van Riel > > Use the ascii-armor canary to prevent unterminated C string overflows > from being able to successfully overwrite the canary, even if they > somehow obtain the canary value. > > Inspired by execshield ascii-armor and Daniel Micay's linux-hardened tree. > > Signed-off-by: Rik van Riel Acked-by: Kees Cook -Kees > --- > arch/arm64/include/asm/stackprotector.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/include/asm/stackprotector.h b/arch/arm64/include/asm/stackprotector.h > index fe5e287dc56b..b86a0865ddf1 100644 > --- a/arch/arm64/include/asm/stackprotector.h > +++ b/arch/arm64/include/asm/stackprotector.h > @@ -30,6 +30,7 @@ static __always_inline void boot_init_stack_canary(void) > /* Try to get a semi random initial value. */ > get_random_bytes(&canary, sizeof(canary)); > canary ^= LINUX_VERSION_CODE; > + canary &= CANARY_MASK; > > current->stack_canary = canary; > __stack_chk_guard = current->stack_canary; > -- > 2.9.3 > -- Kees Cook Pixel Security From mboxrd@z Thu Jan 1 00:00:00 1970 From: keescook@google.com (Kees Cook) Date: Wed, 24 May 2017 09:16:51 -0700 Subject: [PATCH 4/5] arm64: ascii armor the arm64 boot init stack canary In-Reply-To: <20170524155751.424-5-riel@redhat.com> References: <20170524155751.424-1-riel@redhat.com> <20170524155751.424-5-riel@redhat.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, May 24, 2017 at 8:57 AM, wrote: > From: Rik van Riel > > Use the ascii-armor canary to prevent unterminated C string overflows > from being able to successfully overwrite the canary, even if they > somehow obtain the canary value. > > Inspired by execshield ascii-armor and Daniel Micay's linux-hardened tree. > > Signed-off-by: Rik van Riel Acked-by: Kees Cook -Kees > --- > arch/arm64/include/asm/stackprotector.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/include/asm/stackprotector.h b/arch/arm64/include/asm/stackprotector.h > index fe5e287dc56b..b86a0865ddf1 100644 > --- a/arch/arm64/include/asm/stackprotector.h > +++ b/arch/arm64/include/asm/stackprotector.h > @@ -30,6 +30,7 @@ static __always_inline void boot_init_stack_canary(void) > /* Try to get a semi random initial value. */ > get_random_bytes(&canary, sizeof(canary)); > canary ^= LINUX_VERSION_CODE; > + canary &= CANARY_MASK; > > current->stack_canary = canary; > __stack_chk_guard = current->stack_canary; > -- > 2.9.3 > -- Kees Cook Pixel Security From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <20170524155751.424-5-riel@redhat.com> References: <20170524155751.424-1-riel@redhat.com> <20170524155751.424-5-riel@redhat.com> From: Kees Cook Date: Wed, 24 May 2017 09:16:51 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" Subject: [kernel-hardening] Re: [PATCH 4/5] arm64: ascii armor the arm64 boot init stack canary To: Rik van Riel , Andrew Morton Cc: LKML , Daniel Micay , Ted Ts'o , "H. Peter Anvin" , Andy Lutomirski , Ingo Molnar , "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Catalin Marinas , linux-sh , Yoshinori Sato , "kernel-hardening@lists.openwall.com" List-ID: On Wed, May 24, 2017 at 8:57 AM, wrote: > From: Rik van Riel > > Use the ascii-armor canary to prevent unterminated C string overflows > from being able to successfully overwrite the canary, even if they > somehow obtain the canary value. > > Inspired by execshield ascii-armor and Daniel Micay's linux-hardened tree. > > Signed-off-by: Rik van Riel Acked-by: Kees Cook -Kees > --- > arch/arm64/include/asm/stackprotector.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/include/asm/stackprotector.h b/arch/arm64/include/asm/stackprotector.h > index fe5e287dc56b..b86a0865ddf1 100644 > --- a/arch/arm64/include/asm/stackprotector.h > +++ b/arch/arm64/include/asm/stackprotector.h > @@ -30,6 +30,7 @@ static __always_inline void boot_init_stack_canary(void) > /* Try to get a semi random initial value. */ > get_random_bytes(&canary, sizeof(canary)); > canary ^= LINUX_VERSION_CODE; > + canary &= CANARY_MASK; > > current->stack_canary = canary; > __stack_chk_guard = current->stack_canary; > -- > 2.9.3 > -- Kees Cook Pixel Security