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=-9.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 49A6CC433DB for ; Mon, 15 Mar 2021 22:18:19 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E5B6C64EEE for ; Mon, 15 Mar 2021 22:18:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5B6C64EEE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MC02H++hArJfgVq2gjTKvYMpl1RHZRcNyl4k7hHW424=; b=WUqKxV8aMdEVM45UV1/SFF4rH W25QEUgF7nPqwd20bBokJmGgHZLQ0GYxwAIBYgJzqspbxcdXt3Y5+BC+m+2I8rUp3nfIf5RBfQbtA dxtlPuPtfBePJ/6Yt5aO6Hz/gDIiscwdBbnaB3Qpti7NZb/5vBxerUwuYUcFGdYzUkpyH8tTq8n4g 37D92JgfHZSB/p6Dk8WRBbISokT6fd1SC+jPfM+j1425Yvoo+hjDAda6G3EwDZxlq9GEgJRUdVEQw X67WHPfmC+gaksnSANYOJe3VgiSu6PAz8RzQcT7tZGV357981jqG/ElxXxu3BO4Fgp3H+j6jA3ztC +m9jqDomQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lLvVI-00H0kR-SE; Mon, 15 Mar 2021 22:16:01 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lLvUo-00H0gh-Py for linux-arm-kernel@lists.infradead.org; Mon, 15 Mar 2021 22:15:48 +0000 Received: by mail-pg1-x529.google.com with SMTP id q5so8643835pgk.5 for ; Mon, 15 Mar 2021 15:15: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=4NJ97PlxHnFzJWJgTtpDT+uKjd7HgYN+0ebu/wLMsHQ=; b=GfeWNb1p88yRfbJnymIfERA/ut8kED0Wo7XExiGoNzml+80Z9oey4U0Ro5ATU1yaU2 HTXnfdZHk6IoQmCWOJmzEb8cMJ+ycjfmtAfwRs9BLtRmg+ZBBxLW7s5f8mLFH9cpacl2 tnpMFAMPUUJ7b6g/nDRVteP7L4YMejkChexPI= 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=4NJ97PlxHnFzJWJgTtpDT+uKjd7HgYN+0ebu/wLMsHQ=; b=UiWxANURzUT4MreQsZRX2XKl4RwTA+Bdq/stRN9gMFVy/8Gcmq6syNGLSkyMuNeGpn NarHmbZYAPBTYwiImDtyCeTmIUkVsNklku2Y8TIZ067aGCqXAxl25TWTAVo9WICIsRd3 nZZJBHx8wD8c1sUmBMPOa1ECqTij/R2Q0UEqIBh5OWDlvkHFEWY5wSYoQyofaq3AguX0 MF8kHQGkj9EexaQ04s+gwUkDuNc7jYh1Qv9KJZiOgIlg/YXorLtiti8160+1Wq5INnL3 XuaQLkRALLHfuEzYZMflUZRchXPvl5w6xC+Wnz1OmhhN+NFa6yC1v+FAm9epVesY6yzi gJZQ== X-Gm-Message-State: AOAM530ohyRtRsz2FXkGnuFEz5FvuAN+Zl5NzXypTEqk3b4vmJJpXT8R bwaarST2kb14a3GAfETQotzxCA== X-Google-Smtp-Source: ABdhPJyTjnc9LdJf0dvdcKWL6IHisbEo+ZUejO8pNco1fmFRm1nNRoQe3Sx5RQqz8b9aU1cRR2xiPQ== X-Received: by 2002:a65:6a0c:: with SMTP id m12mr1019256pgu.161.1615846529292; Mon, 15 Mar 2021 15:15:29 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id s194sm14685269pfs.57.2021.03.15.15.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 15:15:28 -0700 (PDT) Date: Mon, 15 Mar 2021 15:15:27 -0700 From: Kees Cook To: Thomas Gleixner Cc: Alexander Potapenko , Elena Reshetova , x86@kernel.org, Andy Lutomirski , Peter Zijlstra , Catalin Marinas , Will Deacon , Mark Rutland , Alexander Popov , Ard Biesheuvel , Jann Horn , Vlastimil Babka , David Hildenbrand , Mike Rapoport , Andrew Morton , Jonathan Corbet , Randy Dunlap , kernel-hardening@lists.openwall.com, linux-hardening@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 2/6] init_on_alloc: Optimize static branches Message-ID: <202103151514.AE11A69683@keescook> References: <20210315180229.1224655-1-keescook@chromium.org> <20210315180229.1224655-3-keescook@chromium.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210315180229.1224655-3-keescook@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210315_221546_448903_991EC467 X-CRM114-Status: GOOD ( 17.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Mar 15, 2021 at 11:02:25AM -0700, Kees Cook wrote: > diff --git a/mm/slab.h b/mm/slab.h > index 076582f58f68..b0977d525c06 100644 > --- a/mm/slab.h > +++ b/mm/slab.h > @@ -601,7 +601,8 @@ static inline void cache_random_seq_destroy(struct kmem_cache *cachep) { } > > static inline bool slab_want_init_on_alloc(gfp_t flags, struct kmem_cache *c) > { > - if (static_branch_unlikely(&init_on_alloc)) { > + if (static_branch_maybe(CONFIG_INIT_ON_FREE_DEFAULT_ON, Gah, this should be CONFIG_INIT_ON_ALLOC_DEFAULT_ON. I'll see if there are any more comments before sending a v7... -Kees > + &init_on_alloc)) { > if (c->ctor) > return false; > if (c->flags & (SLAB_TYPESAFE_BY_RCU | SLAB_POISON)) > @@ -613,7 +614,8 @@ static inline bool slab_want_init_on_alloc(gfp_t flags, struct kmem_cache *c) > > static inline bool slab_want_init_on_free(struct kmem_cache *c) > { > - if (static_branch_unlikely(&init_on_free)) > + if (static_branch_maybe(CONFIG_INIT_ON_FREE_DEFAULT_ON, > + &init_on_free)) > return !(c->ctor || > (c->flags & (SLAB_TYPESAFE_BY_RCU | SLAB_POISON))); > return false; > -- > 2.25.1 > -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel