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.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 63609C433E0 for ; Fri, 5 Jun 2020 21:06:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2581C2074B for ; Fri, 5 Jun 2020 21:06:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mHh7+1LB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2581C2074B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A97DB80007; Fri, 5 Jun 2020 17:06:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A21718E0006; Fri, 5 Jun 2020 17:06:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90F7380007; Fri, 5 Jun 2020 17:06:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id 769698E0006 for ; Fri, 5 Jun 2020 17:06:31 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3B89E1C323 for ; Fri, 5 Jun 2020 21:06:31 +0000 (UTC) X-FDA: 76896391782.20.glue35_300c54926da3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id E5DDF1803CF2C for ; Fri, 5 Jun 2020 21:06:30 +0000 (UTC) X-HE-Tag: glue35_300c54926da3 X-Filterd-Recvd-Size: 6586 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Jun 2020 21:06:30 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id g12so4178992pll.10 for ; Fri, 05 Jun 2020 14:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=S4FEoewm7+mx4PK2KzhQc8E6W3fYSng1kE7iZTT8U+o=; b=mHh7+1LBtqILuDGDB4ibTtLAcR9xu59SwPQMzCn2d5dN4draU4SArwCSKhrcP22jbQ PozPITIP1pGAllImab1JzOqljaaK3f3MGVIIBaAUk5nFjj4WO+45vwDc621nbB8qaGwv aFlZjSdw6juIs9y+5Uekz0X1dZprlV7voNq10= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=S4FEoewm7+mx4PK2KzhQc8E6W3fYSng1kE7iZTT8U+o=; b=YGYrltLCRT0YYQg8Yuox1M2+MLsxrAjkg/YUM7oMdJ0mp57FBadwulyT2yZW+8huKu UmOBThqtNsJe/mykB+/AOdycgfoPcpaf7odx+x6vb/Jnc0EfK5v723gCXlS5336EhUUm Q6SY0SuVjG3UM+nCi111zS3xc6x8niniQt3I+KRO8MESB+95/pnypMxvO8259KrTWFne clJwwSRcEVfgOZMhVUZFKVUVeZq0EsQTEpv2CAgTEIepLXQSQvNDaWMszmQG7WCB2PhV tmwg1vJilsTZxLOpEErPNDixN4nGNM6yvCcqGZ+tcE0eUoYDyICJyo/osfupuNYH86+6 kL3Q== X-Gm-Message-State: AOAM533U/rS8h/CmddbvpucxkjnurGN8e4MXGCDW0YIb8NMpPLaQYJfY gxJcV1duaC/35zh7PLJKEb6yFA== X-Google-Smtp-Source: ABdhPJwE39JaU3icWGUNcL21FFOr0U7ilIORnK/KdechHmsfMr/IG5eaWKnock+V9Ayxwu0pgMJvdA== X-Received: by 2002:a17:902:8f85:: with SMTP id z5mr11648050plo.152.1591391189221; Fri, 05 Jun 2020 14:06:29 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a14sm435194pfc.133.2020.06.05.14.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 14:06:28 -0700 (PDT) Date: Fri, 5 Jun 2020 14:06:27 -0700 From: Kees Cook To: Vlastimil Babka Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com, vinmenon@codeaurora.org, Matthew Garrett , Jann Horn , Vijayanand Jitta Subject: Re: [RFC PATCH 1/5] mm, slub: extend slub_debug syntax for multiple blocks Message-ID: <202006051401.9AB3D2CAD@keescook> References: <20200602141519.7099-1-vbabka@suse.cz> <20200602141519.7099-2-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200602141519.7099-2-vbabka@suse.cz> X-Rspamd-Queue-Id: E5DDF1803CF2C X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: On Tue, Jun 02, 2020 at 04:15:15PM +0200, Vlastimil Babka wrote: > The slub_debug kernel boot parameter can either apply a single set of options > to all caches or a list of caches. There is a use case where debugging is > applied for all caches and then disabled at runtime for specific caches, for > performance and memory consumption reasons [1]. As runtime changes are > dangerous, extend the boot parameter syntax so that multiple blocks of either > global or slab-specific options can be specified, with blocks delimited by ';'. > This will also support the use case of [1] without runtime changes. > > For details see the updated Documentation/vm/slub.rst > > [1] https://lore.kernel.org/r/1383cd32-1ddc-4dac-b5f8-9c42282fa81c@codeaurora.org > > Signed-off-by: Vlastimil Babka > --- > .../admin-guide/kernel-parameters.txt | 2 +- > Documentation/vm/slub.rst | 17 ++ > mm/slub.c | 177 +++++++++++++----- > 3 files changed, 144 insertions(+), 52 deletions(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 6253849afac2..6ea00c8dd635 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -4613,7 +4613,7 @@ > fragmentation. Defaults to 1 for systems with > more than 32MB of RAM, 0 otherwise. > > - slub_debug[=options[,slabs]] [MM, SLUB] > + slub_debug[=options[,slabs][;[options[,slabs]]...] [MM, SLUB] > Enabling slub_debug allows one to determine the > culprit if slab objects become corrupted. Enabling > slub_debug can create guard zones around objects and > diff --git a/Documentation/vm/slub.rst b/Documentation/vm/slub.rst > index 4eee598555c9..f1154f707e06 100644 > --- a/Documentation/vm/slub.rst > +++ b/Documentation/vm/slub.rst > @@ -41,6 +41,11 @@ slub_debug=,,,... > Enable options only for select slabs (no spaces > after a comma) > > +Multiple blocks of options for all slabs or selected slabs can be given, with > +blocks of options delimited by ';'. The last of "all slabs" blocks is applied > +to all slabs except those that match one of the "select slabs" block. Options > +of the first "select slabs" blocks that matches the slab's name are applied. > + > Possible debug options are:: > > F Sanity checks on (enables SLAB_DEBUG_CONSISTENCY_CHECKS > @@ -83,6 +88,18 @@ in low memory situations or if there's high fragmentation of memory. To > > slub_debug=O > > +You can apply different options to different list of slab names, using blocks > +of options. This will enable red zoning for dentry and user tracking for > +kmalloc. All other slabs will not get any debugging enabled:: > + > + slub_debug=Z,dentry;U,kmalloc-* > + > +You can also enable options (e.g. sanity checks and poisoning) for all caches > +except some that are deemed too performance critical and don't need to be > +debugged:: Just for more clarity, how about: ... debugged by starting the list with "-" (to mean "all except the following"):: > + > + slub_debug=FZ;-,zs_handle,zspage > + > In case you forgot to enable debugging on the kernel command line: It is > possible to enable debugging manually when the kernel is up. Look at the > contents of:: Everything else looks great; very nice! :) Reviewed-by: Kees Cook -- Kees Cook