From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755429AbcAHOHt (ORCPT ); Fri, 8 Jan 2016 09:07:49 -0500 Received: from resqmta-ch2-03v.sys.comcast.net ([69.252.207.35]:47397 "EHLO resqmta-ch2-03v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755104AbcAHOHq (ORCPT ); Fri, 8 Jan 2016 09:07:46 -0500 Date: Fri, 8 Jan 2016 08:07:44 -0600 (CST) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Laura Abbott cc: Kees Cook , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Linux-MM , LKML , "kernel-hardening@lists.openwall.com" Subject: Re: [RFC][PATCH 0/7] Sanitization of slabs based on grsecurity/PaX In-Reply-To: <568F0F75.4090101@labbott.name> Message-ID: References: <1450755641-7856-1-git-send-email-laura@labbott.name> <5679ACE9.70701@labbott.name> <568C8741.4040709@labbott.name> <568F0F75.4090101@labbott.name> Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 7 Jan 2016, Laura Abbott wrote: > The slub_debug=P not only poisons it enables other consistency checks on the > slab as well, assuming my understanding of what check_object does is correct. > My hope was to have the poison part only and none of the consistency checks in > an attempt to mitigate performance issues. I misunderstood when the checks > actually run and how SLUB_DEBUG was used. Ok I see that there pointer check is done without checking the corresponding debug flag. Patch attached thar fixes it. > Another option would be to have a flag like SLAB_NO_SANITY_CHECK. > sanitization enablement would just be that and SLAB_POISON > in the debug options. The disadvantage to this approach would be losing > the sanitization for ->ctor caches (the grsecurity version works around this > by re-initializing with ->ctor, I haven't heard any feedback if this actually > acceptable) and not having some of the fast paths enabled > (assuming I'm understanding the code path correctly.) which would also > be a performance penalty I think we simply need to fix the missing check there. There is already a flag SLAB_DEBUG_FREE for the pointer checks. Subject: slub: Only perform pointer checks in check_object when SLAB_DEBUG_FREE is set Seems that check_object() always checks for pointer issues currently. Signed-off-by: Christoph Lameter Index: linux/mm/slub.c =================================================================== --- linux.orig/mm/slub.c +++ linux/mm/slub.c @@ -848,6 +848,9 @@ static int check_object(struct kmem_cach */ return 1; + if (!(s->flags & SLAB_DEBUG_FREE)) + return 1; + /* Check free pointer validity */ if (!check_valid_pointer(s, page, get_freepointer(s, p))) { object_err(s, page, p, "Freepointer corrupt"); From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f179.google.com (mail-ig0-f179.google.com [209.85.213.179]) by kanga.kvack.org (Postfix) with ESMTP id F14B9828DE for ; Fri, 8 Jan 2016 09:07:46 -0500 (EST) Received: by mail-ig0-f179.google.com with SMTP id t15so52310546igr.0 for ; Fri, 08 Jan 2016 06:07:46 -0800 (PST) Received: from resqmta-ch2-09v.sys.comcast.net (resqmta-ch2-09v.sys.comcast.net. [2001:558:fe21:29:69:252:207:41]) by mx.google.com with ESMTPS id 85si14083587ioj.6.2016.01.08.06.07.46 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 08 Jan 2016 06:07:46 -0800 (PST) Date: Fri, 8 Jan 2016 08:07:44 -0600 (CST) From: Christoph Lameter Subject: Re: [RFC][PATCH 0/7] Sanitization of slabs based on grsecurity/PaX In-Reply-To: <568F0F75.4090101@labbott.name> Message-ID: References: <1450755641-7856-1-git-send-email-laura@labbott.name> <5679ACE9.70701@labbott.name> <568C8741.4040709@labbott.name> <568F0F75.4090101@labbott.name> Content-Type: text/plain; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Laura Abbott Cc: Kees Cook , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Linux-MM , LKML , "kernel-hardening@lists.openwall.com" On Thu, 7 Jan 2016, Laura Abbott wrote: > The slub_debug=P not only poisons it enables other consistency checks on the > slab as well, assuming my understanding of what check_object does is correct. > My hope was to have the poison part only and none of the consistency checks in > an attempt to mitigate performance issues. I misunderstood when the checks > actually run and how SLUB_DEBUG was used. Ok I see that there pointer check is done without checking the corresponding debug flag. Patch attached thar fixes it. > Another option would be to have a flag like SLAB_NO_SANITY_CHECK. > sanitization enablement would just be that and SLAB_POISON > in the debug options. The disadvantage to this approach would be losing > the sanitization for ->ctor caches (the grsecurity version works around this > by re-initializing with ->ctor, I haven't heard any feedback if this actually > acceptable) and not having some of the fast paths enabled > (assuming I'm understanding the code path correctly.) which would also > be a performance penalty I think we simply need to fix the missing check there. There is already a flag SLAB_DEBUG_FREE for the pointer checks. Subject: slub: Only perform pointer checks in check_object when SLAB_DEBUG_FREE is set Seems that check_object() always checks for pointer issues currently. Signed-off-by: Christoph Lameter Index: linux/mm/slub.c =================================================================== --- linux.orig/mm/slub.c +++ linux/mm/slub.c @@ -848,6 +848,9 @@ static int check_object(struct kmem_cach */ return 1; + if (!(s->flags & SLAB_DEBUG_FREE)) + return 1; + /* Check free pointer validity */ if (!check_valid_pointer(s, page, get_freepointer(s, p))) { object_err(s, page, p, "Freepointer corrupt"); -- 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 Reply-To: kernel-hardening@lists.openwall.com Date: Fri, 8 Jan 2016 08:07:44 -0600 (CST) From: Christoph Lameter In-Reply-To: <568F0F75.4090101@labbott.name> Message-ID: References: <1450755641-7856-1-git-send-email-laura@labbott.name> <5679ACE9.70701@labbott.name> <568C8741.4040709@labbott.name> <568F0F75.4090101@labbott.name> Content-Type: text/plain; charset=US-ASCII Subject: [kernel-hardening] Re: [RFC][PATCH 0/7] Sanitization of slabs based on grsecurity/PaX To: Laura Abbott Cc: Kees Cook , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Linux-MM , LKML , "kernel-hardening@lists.openwall.com" List-ID: On Thu, 7 Jan 2016, Laura Abbott wrote: > The slub_debug=P not only poisons it enables other consistency checks on the > slab as well, assuming my understanding of what check_object does is correct. > My hope was to have the poison part only and none of the consistency checks in > an attempt to mitigate performance issues. I misunderstood when the checks > actually run and how SLUB_DEBUG was used. Ok I see that there pointer check is done without checking the corresponding debug flag. Patch attached thar fixes it. > Another option would be to have a flag like SLAB_NO_SANITY_CHECK. > sanitization enablement would just be that and SLAB_POISON > in the debug options. The disadvantage to this approach would be losing > the sanitization for ->ctor caches (the grsecurity version works around this > by re-initializing with ->ctor, I haven't heard any feedback if this actually > acceptable) and not having some of the fast paths enabled > (assuming I'm understanding the code path correctly.) which would also > be a performance penalty I think we simply need to fix the missing check there. There is already a flag SLAB_DEBUG_FREE for the pointer checks. Subject: slub: Only perform pointer checks in check_object when SLAB_DEBUG_FREE is set Seems that check_object() always checks for pointer issues currently. Signed-off-by: Christoph Lameter Index: linux/mm/slub.c =================================================================== --- linux.orig/mm/slub.c +++ linux/mm/slub.c @@ -848,6 +848,9 @@ static int check_object(struct kmem_cach */ return 1; + if (!(s->flags & SLAB_DEBUG_FREE)) + return 1; + /* Check free pointer validity */ if (!check_valid_pointer(s, page, get_freepointer(s, p))) { object_err(s, page, p, "Freepointer corrupt");