From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752898AbcD0TQU (ORCPT ); Wed, 27 Apr 2016 15:16:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47778 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751907AbcD0TQT (ORCPT ); Wed, 27 Apr 2016 15:16:19 -0400 Date: Wed, 27 Apr 2016 12:16:17 -0700 From: Andrew Morton To: Thomas Garnier Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Kees Cook , gthelen@google.com, labbott@fedoraproject.org, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v5] mm: SLAB freelist randomization Message-Id: <20160427121617.5a3123d75230effd7842e408@linux-foundation.org> In-Reply-To: <1461777659-81290-1-git-send-email-thgarnie@google.com> References: <1461777659-81290-1-git-send-email-thgarnie@google.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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; _