From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751787AbcGOE3b (ORCPT ); Fri, 15 Jul 2016 00:29:31 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38747 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750796AbcGOE31 (ORCPT ); Fri, 15 Jul 2016 00:29:27 -0400 MIME-Version: 1.0 In-Reply-To: <20160715020550.GB13944@balbir.ozlabs.ibm.com> References: <1468446964-22213-1-git-send-email-keescook@chromium.org> <1468446964-22213-12-git-send-email-keescook@chromium.org> <20160715020550.GB13944@balbir.ozlabs.ibm.com> From: Kees Cook Date: Thu, 14 Jul 2016 21:29:25 -0700 X-Google-Sender-Auth: PNFNTebrWfkU13_bTcDixZBdtI4 Message-ID: Subject: Re: [PATCH v2 11/11] mm: SLUB hardened usercopy support To: Balbir Singh Cc: LKML , Rik van Riel , Casey Schaufler , PaX Team , Brad Spengler , Russell King , Catalin Marinas , Will Deacon , Ard Biesheuvel , Benjamin Herrenschmidt , Michael Ellerman , Tony Luck , Fenghua Yu , "David S. Miller" , "x86@kernel.org" , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Andy Lutomirski , Borislav Petkov , Mathias Krause , Jan Kara , Vitaly Wool , Andrea Arcangeli , Dmitry Vyukov , Laura Abbott , "linux-arm-kernel@lists.infradead.org" , linux-ia64@vger.kernel.org, "linuxppc-dev@lists.ozlabs.org" , sparclinux , linux-arch , Linux-MM , "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 Thu, Jul 14, 2016 at 7:05 PM, Balbir Singh wrote: > On Wed, Jul 13, 2016 at 02:56:04PM -0700, Kees Cook wrote: >> Under CONFIG_HARDENED_USERCOPY, this adds object size checking to the >> SLUB allocator to catch any copies that may span objects. Includes a >> redzone handling fix from Michael Ellerman. >> >> Based on code from PaX and grsecurity. >> >> Signed-off-by: Kees Cook >> --- >> init/Kconfig | 1 + >> mm/slub.c | 36 ++++++++++++++++++++++++++++++++++++ >> 2 files changed, 37 insertions(+) >> >> diff --git a/init/Kconfig b/init/Kconfig >> index 798c2020ee7c..1c4711819dfd 100644 >> --- a/init/Kconfig >> +++ b/init/Kconfig >> @@ -1765,6 +1765,7 @@ config SLAB >> >> config SLUB >> bool "SLUB (Unqueued Allocator)" >> + select HAVE_HARDENED_USERCOPY_ALLOCATOR > > Should this patch come in earlier from a build perspective? I think > patch 1 introduces and uses __check_heap_object. __check_heap_object in patch 1 is protected by a check for CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR. It seemed better to be to do arch enablement first, and then add the per-allocator heap object size check since it was a distinct piece. I'm happy to rearrange things, though, if there's a good reason. -Kees -- Kees Cook Chrome OS & Brillo Security From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kees Cook Subject: Re: [PATCH v2 11/11] mm: SLUB hardened usercopy support Date: Thu, 14 Jul 2016 21:29:25 -0700 Message-ID: References: <1468446964-22213-1-git-send-email-keescook@chromium.org> <1468446964-22213-12-git-send-email-keescook@chromium.org> <20160715020550.GB13944@balbir.ozlabs.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <20160715020550.GB13944@balbir.ozlabs.ibm.com> Sender: owner-linux-mm@kvack.org To: Balbir Singh Cc: LKML , Rik van Riel , Casey Schaufler , PaX Team , Brad Spengler , Russell King , Catalin Marinas , Will Deacon , Ard Biesheuvel , Benjamin Herrenschmidt , Michael Ellerman , Tony Luck , Fenghua Yu , "David S. Miller" , "x86@kernel.org" , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Andy Lutomirski , Borislav Petkov , Mathias Krause , Ja List-Id: linux-arch.vger.kernel.org On Thu, Jul 14, 2016 at 7:05 PM, Balbir Singh wrote: > On Wed, Jul 13, 2016 at 02:56:04PM -0700, Kees Cook wrote: >> Under CONFIG_HARDENED_USERCOPY, this adds object size checking to the >> SLUB allocator to catch any copies that may span objects. Includes a >> redzone handling fix from Michael Ellerman. >> >> Based on code from PaX and grsecurity. >> >> Signed-off-by: Kees Cook >> --- >> init/Kconfig | 1 + >> mm/slub.c | 36 ++++++++++++++++++++++++++++++++++++ >> 2 files changed, 37 insertions(+) >> >> diff --git a/init/Kconfig b/init/Kconfig >> index 798c2020ee7c..1c4711819dfd 100644 >> --- a/init/Kconfig >> +++ b/init/Kconfig >> @@ -1765,6 +1765,7 @@ config SLAB >> >> config SLUB >> bool "SLUB (Unqueued Allocator)" >> + select HAVE_HARDENED_USERCOPY_ALLOCATOR > > Should this patch come in earlier from a build perspective? I think > patch 1 introduces and uses __check_heap_object. __check_heap_object in patch 1 is protected by a check for CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR. It seemed better to be to do arch enablement first, and then add the per-allocator heap object size check since it was a distinct piece. I'm happy to rearrange things, though, if there's a good reason. -Kees -- Kees Cook Chrome OS & Brillo Security -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f43.google.com ([74.125.82.43]:37774 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750764AbcGOE31 (ORCPT ); Fri, 15 Jul 2016 00:29:27 -0400 Received: by mail-wm0-f43.google.com with SMTP id i5so12640716wmg.0 for ; Thu, 14 Jul 2016 21:29:26 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20160715020550.GB13944@balbir.ozlabs.ibm.com> References: <1468446964-22213-1-git-send-email-keescook@chromium.org> <1468446964-22213-12-git-send-email-keescook@chromium.org> <20160715020550.GB13944@balbir.ozlabs.ibm.com> From: Kees Cook Date: Thu, 14 Jul 2016 21:29:25 -0700 Message-ID: Subject: Re: [PATCH v2 11/11] mm: SLUB hardened usercopy support Content-Type: text/plain; charset=UTF-8 Sender: linux-arch-owner@vger.kernel.org List-ID: To: Balbir Singh Cc: LKML , Rik van Riel , Casey Schaufler , PaX Team , Brad Spengler , Russell King , Catalin Marinas , Will Deacon , Ard Biesheuvel , Benjamin Herrenschmidt , Michael Ellerman , Tony Luck , Fenghua Yu , "David S. Miller" , "x86@kernel.org" , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Andy Lutomirski , Borislav Petkov , Mathias Krause , Jan Kara , Vitaly Wool , Andrea Arcangeli , Dmitry Vyukov , Laura Abbott , "linux-arm-kernel@lists.infradead.org" , linux-ia64@vger.kernel.org, "linuxppc-dev@lists.ozlabs.org" , sparclinux , linux-arch , Linux-MM , "kernel-hardening@lists.openwall.com" Message-ID: <20160715042925.-TR00JW-gBTRCBszXDsclut5lb8MI4mUS_4ZG6CqsLA@z> On Thu, Jul 14, 2016 at 7:05 PM, Balbir Singh wrote: > On Wed, Jul 13, 2016 at 02:56:04PM -0700, Kees Cook wrote: >> Under CONFIG_HARDENED_USERCOPY, this adds object size checking to the >> SLUB allocator to catch any copies that may span objects. Includes a >> redzone handling fix from Michael Ellerman. >> >> Based on code from PaX and grsecurity. >> >> Signed-off-by: Kees Cook >> --- >> init/Kconfig | 1 + >> mm/slub.c | 36 ++++++++++++++++++++++++++++++++++++ >> 2 files changed, 37 insertions(+) >> >> diff --git a/init/Kconfig b/init/Kconfig >> index 798c2020ee7c..1c4711819dfd 100644 >> --- a/init/Kconfig >> +++ b/init/Kconfig >> @@ -1765,6 +1765,7 @@ config SLAB >> >> config SLUB >> bool "SLUB (Unqueued Allocator)" >> + select HAVE_HARDENED_USERCOPY_ALLOCATOR > > Should this patch come in earlier from a build perspective? I think > patch 1 introduces and uses __check_heap_object. __check_heap_object in patch 1 is protected by a check for CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR. It seemed better to be to do arch enablement first, and then add the per-allocator heap object size check since it was a distinct piece. I'm happy to rearrange things, though, if there's a good reason. -Kees -- Kees Cook Chrome OS & Brillo Security From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kees Cook Date: Fri, 15 Jul 2016 04:29:25 +0000 Subject: Re: [PATCH v2 11/11] mm: SLUB hardened usercopy support Message-Id: List-Id: References: <1468446964-22213-1-git-send-email-keescook@chromium.org> <1468446964-22213-12-git-send-email-keescook@chromium.org> <20160715020550.GB13944@balbir.ozlabs.ibm.com> In-Reply-To: <20160715020550.GB13944@balbir.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Balbir Singh Cc: LKML , Rik van Riel , Casey Schaufler , PaX Team , Brad Spengler , Russell King , Catalin Marinas , Will Deacon , Ard Biesheuvel , Benjamin Herrenschmidt , Michael Ellerman , Tony Luck , Fenghua Yu , "David S. Miller" , "x86@kernel.org" , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Andy Lutomirski , Borislav Petkov , Mathias Krause , Jan Kara , Vitaly Wool , Andrea Arcangeli , Dmitry Vyukov , Laura Abbott , "linux-arm-kernel@lists.infradead.org" , linux-ia64@vger.kernel.org, "linuxppc-dev@lists.ozlabs.org" , sparclinux , linux-arch , Linux-MM , "kernel-hardening@lists.openwall.com" On Thu, Jul 14, 2016 at 7:05 PM, Balbir Singh wrote: > On Wed, Jul 13, 2016 at 02:56:04PM -0700, Kees Cook wrote: >> Under CONFIG_HARDENED_USERCOPY, this adds object size checking to the >> SLUB allocator to catch any copies that may span objects. Includes a >> redzone handling fix from Michael Ellerman. >> >> Based on code from PaX and grsecurity. >> >> Signed-off-by: Kees Cook >> --- >> init/Kconfig | 1 + >> mm/slub.c | 36 ++++++++++++++++++++++++++++++++++++ >> 2 files changed, 37 insertions(+) >> >> diff --git a/init/Kconfig b/init/Kconfig >> index 798c2020ee7c..1c4711819dfd 100644 >> --- a/init/Kconfig >> +++ b/init/Kconfig >> @@ -1765,6 +1765,7 @@ config SLAB >> >> config SLUB >> bool "SLUB (Unqueued Allocator)" >> + select HAVE_HARDENED_USERCOPY_ALLOCATOR > > Should this patch come in earlier from a build perspective? I think > patch 1 introduces and uses __check_heap_object. __check_heap_object in patch 1 is protected by a check for CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR. It seemed better to be to do arch enablement first, and then add the per-allocator heap object size check since it was a distinct piece. I'm happy to rearrange things, though, if there's a good reason. -Kees -- Kees Cook Chrome OS & Brillo Security From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) by kanga.kvack.org (Postfix) with ESMTP id 6652B6B0005 for ; Fri, 15 Jul 2016 00:29:27 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id x83so6268899wma.2 for ; Thu, 14 Jul 2016 21:29:27 -0700 (PDT) Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com. [2a00:1450:400c:c09::233]) by mx.google.com with ESMTPS id f66si2807776wme.56.2016.07.14.21.29.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jul 2016 21:29:26 -0700 (PDT) Received: by mail-wm0-x233.google.com with SMTP id o80so12607724wme.1 for ; Thu, 14 Jul 2016 21:29:26 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20160715020550.GB13944@balbir.ozlabs.ibm.com> References: <1468446964-22213-1-git-send-email-keescook@chromium.org> <1468446964-22213-12-git-send-email-keescook@chromium.org> <20160715020550.GB13944@balbir.ozlabs.ibm.com> From: Kees Cook Date: Thu, 14 Jul 2016 21:29:25 -0700 Message-ID: Subject: Re: [PATCH v2 11/11] mm: SLUB hardened usercopy support Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: Balbir Singh Cc: LKML , Rik van Riel , Casey Schaufler , PaX Team , Brad Spengler , Russell King , Catalin Marinas , Will Deacon , Ard Biesheuvel , Benjamin Herrenschmidt , Michael Ellerman , Tony Luck , Fenghua Yu , "David S. Miller" , "x86@kernel.org" , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Andy Lutomirski , Borislav Petkov , Mathias Krause , Jan Kara , Vitaly Wool , Andrea Arcangeli , Dmitry Vyukov , Laura Abbott , "linux-arm-kernel@lists.infradead.org" , linux-ia64@vger.kernel.org, "linuxppc-dev@lists.ozlabs.org" , sparclinux , linux-arch , Linux-MM , "kernel-hardening@lists.openwall.com" On Thu, Jul 14, 2016 at 7:05 PM, Balbir Singh wrote: > On Wed, Jul 13, 2016 at 02:56:04PM -0700, Kees Cook wrote: >> Under CONFIG_HARDENED_USERCOPY, this adds object size checking to the >> SLUB allocator to catch any copies that may span objects. Includes a >> redzone handling fix from Michael Ellerman. >> >> Based on code from PaX and grsecurity. >> >> Signed-off-by: Kees Cook >> --- >> init/Kconfig | 1 + >> mm/slub.c | 36 ++++++++++++++++++++++++++++++++++++ >> 2 files changed, 37 insertions(+) >> >> diff --git a/init/Kconfig b/init/Kconfig >> index 798c2020ee7c..1c4711819dfd 100644 >> --- a/init/Kconfig >> +++ b/init/Kconfig >> @@ -1765,6 +1765,7 @@ config SLAB >> >> config SLUB >> bool "SLUB (Unqueued Allocator)" >> + select HAVE_HARDENED_USERCOPY_ALLOCATOR > > Should this patch come in earlier from a build perspective? I think > patch 1 introduces and uses __check_heap_object. __check_heap_object in patch 1 is protected by a check for CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR. It seemed better to be to do arch enablement first, and then add the per-allocator heap object size check since it was a distinct piece. I'm happy to rearrange things, though, if there's a good reason. -Kees -- Kees Cook Chrome OS & Brillo Security -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: keescook@chromium.org (Kees Cook) Date: Thu, 14 Jul 2016 21:29:25 -0700 Subject: [PATCH v2 11/11] mm: SLUB hardened usercopy support In-Reply-To: <20160715020550.GB13944@balbir.ozlabs.ibm.com> References: <1468446964-22213-1-git-send-email-keescook@chromium.org> <1468446964-22213-12-git-send-email-keescook@chromium.org> <20160715020550.GB13944@balbir.ozlabs.ibm.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, Jul 14, 2016 at 7:05 PM, Balbir Singh wrote: > On Wed, Jul 13, 2016 at 02:56:04PM -0700, Kees Cook wrote: >> Under CONFIG_HARDENED_USERCOPY, this adds object size checking to the >> SLUB allocator to catch any copies that may span objects. Includes a >> redzone handling fix from Michael Ellerman. >> >> Based on code from PaX and grsecurity. >> >> Signed-off-by: Kees Cook >> --- >> init/Kconfig | 1 + >> mm/slub.c | 36 ++++++++++++++++++++++++++++++++++++ >> 2 files changed, 37 insertions(+) >> >> diff --git a/init/Kconfig b/init/Kconfig >> index 798c2020ee7c..1c4711819dfd 100644 >> --- a/init/Kconfig >> +++ b/init/Kconfig >> @@ -1765,6 +1765,7 @@ config SLAB >> >> config SLUB >> bool "SLUB (Unqueued Allocator)" >> + select HAVE_HARDENED_USERCOPY_ALLOCATOR > > Should this patch come in earlier from a build perspective? I think > patch 1 introduces and uses __check_heap_object. __check_heap_object in patch 1 is protected by a check for CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR. It seemed better to be to do arch enablement first, and then add the per-allocator heap object size check since it was a distinct piece. I'm happy to rearrange things, though, if there's a good reason. -Kees -- Kees Cook Chrome OS & Brillo Security From mboxrd@z Thu Jan 1 00:00:00 1970 Reply-To: kernel-hardening@lists.openwall.com MIME-Version: 1.0 Sender: keescook@google.com In-Reply-To: <20160715020550.GB13944@balbir.ozlabs.ibm.com> References: <1468446964-22213-1-git-send-email-keescook@chromium.org> <1468446964-22213-12-git-send-email-keescook@chromium.org> <20160715020550.GB13944@balbir.ozlabs.ibm.com> From: Kees Cook Date: Thu, 14 Jul 2016 21:29:25 -0700 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: [kernel-hardening] Re: [PATCH v2 11/11] mm: SLUB hardened usercopy support To: Balbir Singh Cc: LKML , Rik van Riel , Casey Schaufler , PaX Team , Brad Spengler , Russell King , Catalin Marinas , Will Deacon , Ard Biesheuvel , Benjamin Herrenschmidt , Michael Ellerman , Tony Luck , Fenghua Yu , "David S. Miller" , "x86@kernel.org" , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Andy Lutomirski , Borislav Petkov , Mathias Krause , Jan Kara , Vitaly Wool , Andrea Arcangeli , Dmitry Vyukov , Laura Abbott , "linux-arm-kernel@lists.infradead.org" , linux-ia64@vger.kernel.org, "linuxppc-dev@lists.ozlabs.org" , sparclinux , linux-arch , Linux-MM , "kernel-hardening@lists.openwall.com" List-ID: On Thu, Jul 14, 2016 at 7:05 PM, Balbir Singh wrote: > On Wed, Jul 13, 2016 at 02:56:04PM -0700, Kees Cook wrote: >> Under CONFIG_HARDENED_USERCOPY, this adds object size checking to the >> SLUB allocator to catch any copies that may span objects. Includes a >> redzone handling fix from Michael Ellerman. >> >> Based on code from PaX and grsecurity. >> >> Signed-off-by: Kees Cook >> --- >> init/Kconfig | 1 + >> mm/slub.c | 36 ++++++++++++++++++++++++++++++++++++ >> 2 files changed, 37 insertions(+) >> >> diff --git a/init/Kconfig b/init/Kconfig >> index 798c2020ee7c..1c4711819dfd 100644 >> --- a/init/Kconfig >> +++ b/init/Kconfig >> @@ -1765,6 +1765,7 @@ config SLAB >> >> config SLUB >> bool "SLUB (Unqueued Allocator)" >> + select HAVE_HARDENED_USERCOPY_ALLOCATOR > > Should this patch come in earlier from a build perspective? I think > patch 1 introduces and uses __check_heap_object. __check_heap_object in patch 1 is protected by a check for CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR. It seemed better to be to do arch enablement first, and then add the per-allocator heap object size check since it was a distinct piece. I'm happy to rearrange things, though, if there's a good reason. -Kees -- Kees Cook Chrome OS & Brillo Security