From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qg0-f72.google.com (mail-qg0-f72.google.com [209.85.192.72]) by kanga.kvack.org (Postfix) with ESMTP id 1C2466B0005 for ; Wed, 27 Apr 2016 16:04:19 -0400 (EDT) Received: by mail-qg0-f72.google.com with SMTP id e35so24239757qge.0 for ; Wed, 27 Apr 2016 13:04:19 -0700 (PDT) Received: from mail-yw0-x231.google.com (mail-yw0-x231.google.com. [2607:f8b0:4002:c05::231]) by mx.google.com with ESMTPS id z7si1779499ywe.122.2016.04.27.13.04.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Apr 2016 13:04:18 -0700 (PDT) Received: by mail-yw0-x231.google.com with SMTP id j74so87862887ywg.1 for ; Wed, 27 Apr 2016 13:04:18 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20160427121617.5a3123d75230effd7842e408@linux-foundation.org> References: <1461777659-81290-1-git-send-email-thgarnie@google.com> <20160427121617.5a3123d75230effd7842e408@linux-foundation.org> Date: Wed, 27 Apr 2016 13:04:17 -0700 Message-ID: Subject: Re: [PATCH v5] mm: SLAB freelist randomization From: Thomas Garnier Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Kees Cook , Greg Thelen , Laura Abbott , kernel-hardening@lists.openwall.com, LKML , Linux-MM On Wed, Apr 27, 2016 at 12:16 PM, Andrew Morton wrote: > On Wed, 27 Apr 2016 10:20:59 -0700 Thomas Garnier wrote: > >> Provides an optional config (CONFIG_SLAB_FREELIST_RANDOM) to randomize >> the SLAB freelist. > > Forgot this bit? > I thought I would change it when we support other kernel heaps. > From: Andrew Morton > Subject: mm-slab-freelist-randomization-v5-fix > > propagate gfp_t into cache_random_seq_create() > > Cc: Christoph Lameter > Cc: David Rientjes > Cc: Greg Thelen > Cc: Joonsoo Kim > Cc: Kees Cook > Cc: Laura Abbott > Cc: Pekka Enberg > Cc: Thomas Garnier > Signed-off-by: Andrew Morton > > --- a/mm/slab.c~mm-slab-freelist-randomization-v5-fix > +++ a/mm/slab.c > @@ -1262,7 +1262,7 @@ static void freelist_randomize(struct rn > } > > /* Create a random sequence per cache */ > -static int cache_random_seq_create(struct kmem_cache *cachep) > +static int cache_random_seq_create(struct kmem_cache *cachep, gfp_t gfp) > { > unsigned int seed, count = cachep->num; > struct rnd_state state; > @@ -1271,7 +1271,7 @@ static int cache_random_seq_create(struc > return 0; > > /* If it fails, we will just use the global lists */ > - cachep->random_seq = kcalloc(count, sizeof(freelist_idx_t), GFP_KERNEL); > + cachep->random_seq = kcalloc(count, sizeof(freelist_idx_t), gfp); > if (!cachep->random_seq) > return -ENOMEM; > > @@ -1290,7 +1290,7 @@ static void cache_random_seq_destroy(str > cachep->random_seq = NULL; > } > #else > -static inline int cache_random_seq_create(struct kmem_cache *cachep) > +static inline int cache_random_seq_create(struct kmem_cache *cachep, gfp_t gfp) > { > return 0; > } > @@ -3999,7 +3999,7 @@ static int enable_cpucache(struct kmem_c > int shared = 0; > int batchcount = 0; > > - err = cache_random_seq_create(cachep); > + err = cache_random_seq_create(cachep, gfp); > if (err) > goto end; > > _ > -- 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