From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4A70C46466 for ; Sat, 3 Oct 2020 05:21:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 382F1206CA for ; Sat, 3 Oct 2020 05:21:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Erb1j+Uz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 382F1206CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A7EE5900002; Sat, 3 Oct 2020 01:21:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A088B6B0062; Sat, 3 Oct 2020 01:21:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F9A1900002; Sat, 3 Oct 2020 01:21:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id 5E5B46B005D for ; Sat, 3 Oct 2020 01:21:44 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E4E478249980 for ; Sat, 3 Oct 2020 05:21:43 +0000 (UTC) X-FDA: 77329466886.02.tiger64_2e038d1271aa Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id C42BF10096DE1 for ; Sat, 3 Oct 2020 05:21:43 +0000 (UTC) X-HE-Tag: tiger64_2e038d1271aa X-Filterd-Recvd-Size: 3407 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Sat, 3 Oct 2020 05:21:43 +0000 (UTC) Received: from localhost.localdomain (c-71-198-47-131.hsd1.ca.comcast.net [71.198.47.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 16CA0206A1; Sat, 3 Oct 2020 05:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601702502; bh=LqPFWMuvmziHKpIsL+9D4QhvpQHwJOYmXyAmfi7MNaE=; h=Date:From:To:Subject:In-Reply-To:From; b=Erb1j+Uz7jZ09q2xboQJAY3lzT8MY75RUkGHg3sZ1uk3JMz1AgIQByR6gcrQcJtBh 5N2sW0/iDO1PVUp2ABAGSwKR3hYFNOQ+vai6bubyAAkIJbgHkX2XTCCvbxywR0RW9R IuKWAXjF3/FdTZrr6AIUfx7Yh+fMeVZKXMlhZdnA= Date: Fri, 02 Oct 2020 22:21:41 -0700 From: Andrew Morton To: akpm@linux-foundation.org, cl@linux.com, farman@linux.ibm.com, iamjoonsoo.kim@lge.com, keescook@chromium.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, penberg@kernel.org, rientjes@google.com, torvalds@linux-foundation.org, vbabka@suse.cz Subject: [patch 1/3] mm, slub: restore initial kmem_cache flags Message-ID: <20201003052141.rFsR3bpL-%akpm@linux-foundation.org> In-Reply-To: <20201002222038.4f81529dcd31eb8328d562a6@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Eric Farman Subject: mm, slub: restore initial kmem_cache flags The routine that applies debug flags to the kmem_cache slabs inadvertantly prevents non-debug flags from being applied to those same objects. That is, if slub_debug=, is specified, non-debugged slabs will end up having flags of zero, and the slabs may be unusable. Fix this by including the input flags for non-matching slabs with the contents of slub_debug, so that the caches are created as expected alongside any debugging options that may be requested. With this, we can remove the check for a NULL slub_debug_string, since it's covered by the loop itself. Link: https://lkml.kernel.org/r/20200930161931.28575-1-farman@linux.ibm.com Fixes: e17f1dfba37b ("mm, slub: extend slub_debug syntax for multiple blocks") Signed-off-by: Eric Farman Acked-by: Vlastimil Babka Cc: Kees Cook Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Signed-off-by: Andrew Morton --- mm/slub.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/mm/slub.c~mm-slub-restore-initial-kmem_cache-flags +++ a/mm/slub.c @@ -1413,10 +1413,6 @@ slab_flags_t kmem_cache_flags(unsigned i char *next_block; slab_flags_t block_flags; - /* If slub_debug = 0, it folds into the if conditional. */ - if (!slub_debug_string) - return flags | slub_debug; - len = strlen(name); next_block = slub_debug_string; /* Go through all blocks of debug options, see if any matches our slab's name */ @@ -1450,7 +1446,7 @@ slab_flags_t kmem_cache_flags(unsigned i } } - return slub_debug; + return flags | slub_debug; } #else /* !CONFIG_SLUB_DEBUG */ static inline void setup_object_debug(struct kmem_cache *s, _