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=-3.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 ACBA4C433E0 for ; Thu, 18 Jun 2020 19:56:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6D30820890 for ; Thu, 18 Jun 2020 19:56:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="BLRIwPp4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D30820890 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 1962C8D0057; Thu, 18 Jun 2020 15:56:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1461F8D0052; Thu, 18 Jun 2020 15:56:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F28488D0057; Thu, 18 Jun 2020 15:56:34 -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 D7E4E8D0052 for ; Thu, 18 Jun 2020 15:56:34 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 93C62D932F for ; Thu, 18 Jun 2020 19:56:34 +0000 (UTC) X-FDA: 76943389908.28.rail74_120bc1926e13 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 65FFFD932E for ; Thu, 18 Jun 2020 19:56:34 +0000 (UTC) X-HE-Tag: rail74_120bc1926e13 X-Filterd-Recvd-Size: 4266 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Thu, 18 Jun 2020 19:56:33 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id l24so3403043pgb.5 for ; Thu, 18 Jun 2020 12:56:33 -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=6WxuJi3UfQEqC50/z7v1HAPWAobzlEVFkfWhBJ8zFb8=; b=BLRIwPp48LTeq9dM8BwXEFv5h/k53jK72H77U2P6ZO0Z+qF0jqS9BYG2WOWGi2uLAP TuUxSPxtQumf9pjuTW1EkIpK17VdeP8VSj7bgQ7xYLKugmWBM1Uaf8TG4Fpne5U6bQ10 4L4OW4EB3085D6soCS/bXnsER6BHuOq4aBaQo= 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=6WxuJi3UfQEqC50/z7v1HAPWAobzlEVFkfWhBJ8zFb8=; b=stFQOmpK0Fn7Zzs2Wc4v/DHUs8aYjyF0wKMZN/WW/MfMLLrJMJ87usbVeCsy9t1vsJ PZah9cijwm37NcIJNbnbCouHV4snxV188gApC/u+JoX3IgHaw96OiOLnRlU2Dmq6Zx+G 6xE7GNpCKwN8OJnWt0MyGQtD0bR/tsiuCgPZsuGSySlC0WPLSmvFOxlYPi6FqAVmJtzq FIdGxcS9O9sUMkU4TgqxPuxdivjEgXFGkRjpMrhdZmv5ldq2GpikBI44sWbwYkNWdhIJ SRRokNG1ezTQ4bwF5VxxYmInHXxTeYYZmf0FYDWAooNjKwLH232P+PIqOkYcsAENlTKM TPfg== X-Gm-Message-State: AOAM530Yq8At3CYjqpWkhzdOOwwIutYYfJEnzvBDB2j1qq12wuY5a3QC Wx7zo4v095GnLBkoNmS7h6dL9g== X-Google-Smtp-Source: ABdhPJxp3L2hsMhtTetcJVLB1ubkKk/0FvqLGsh2lPF4B0wBPnAb1y6cbMAMewS7FT35u7jNXr0hZw== X-Received: by 2002:a63:7d4e:: with SMTP id m14mr171075pgn.391.1592510193055; Thu, 18 Jun 2020 12:56:33 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id m16sm3593977pfh.187.2020.06.18.12.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 12:56:32 -0700 (PDT) Date: Thu, 18 Jun 2020 12:56:31 -0700 From: Kees Cook To: Vlastimil Babka Cc: Andrew Morton , 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 , Roman Gushchin , Jann Horn , Vijayanand Jitta Subject: Re: [PATCH 7/9] mm, slub: introduce kmem_cache_debug_flags() Message-ID: <202006181256.062C1F2@keescook> References: <20200610163135.17364-1-vbabka@suse.cz> <20200610163135.17364-8-vbabka@suse.cz> <949b90ed-e0f0-07d7-4d21-e30ec0958a7c@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <949b90ed-e0f0-07d7-4d21-e30ec0958a7c@suse.cz> X-Rspamd-Queue-Id: 65FFFD932E 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 Thu, Jun 18, 2020 at 10:37:07AM +0200, Vlastimil Babka wrote: > On 6/10/20 6:31 PM, Vlastimil Babka wrote: > > There are few places that call kmem_cache_debug(s) (which tests if any of debug > > flags are enabled for a cache) immediatelly followed by a test for a specific > > flag. The compiler can probably eliminate the extra check, but we can make the > > code nicer by introducing kmem_cache_debug_flags() that works like > > kmem_cache_debug() (including the static key check) but tests for specifig > > flag(s). The next patches will add more users. > > > > Signed-off-by: Vlastimil Babka > > Please add this fixup per reviews. > ----8<---- > From 25793252a31a36f8d1d4ccf0f27ed3e43fba54d8 Mon Sep 17 00:00:00 2001 > From: Vlastimil Babka > Date: Thu, 18 Jun 2020 10:34:53 +0200 > Subject: [PATCH] mm, slub: introduce kmem_cache_debug_flags()-fix > > Change return from int to bool, per Kees. > Add VM_WARN_ON_ONCE() for invalid flags, per Roman. > > Signed-off-by: Vlastimil Babka Acked-by: Kees Cook -- Kees Cook