Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp582750lqh; Fri, 31 May 2024 09:54:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBJNAGKFheb/K5+Lu72brwCHs/c5mpf2/F414A7Q0pFrtAe9Zze4uCg+Sf3vxSUyrzCxvj8y9mdUx9c9DkYg/ciedDtdXSLtfMqLL7ig== X-Google-Smtp-Source: AGHT+IHehFINF5BWPiePlvpBOHU/G4wXKQCU0R637mBoECeruCBq/SDlhGvDTQSotbRZiETKcCi1 X-Received: by 2002:a17:90a:ac16:b0:2c1:9c10:8b87 with SMTP id 98e67ed59e1d1-2c1dc590988mr2222697a91.29.1717174483220; Fri, 31 May 2024 09:54:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717174483; cv=pass; d=google.com; s=arc-20160816; b=BwOEFFfQ0yAzZ7TEQx5AzXYZUCaXEhOf0DMEpnJs6YOdwz5sim27LKjcqRZTzY5n5H 0lLOHMeKwYMLNBP6+bCsQrXdJtgV1FU3n+xZl7vPRN9+JLG6q5wfuAFRj+FAV4dl/0q8 KMP1xkiwmj3fynn0+2FQZ+NS5muOomxoqh014c3E53lOK+JFxCNSQtKV36yG05gKZkqi tLXgGjUlzKtJ9qhyL2So6x35pdHzllMe5C/GfRsCfSW3apFt//wzvYdQAMMNi98D09Kv Uv3ZLSvS72Bp5CO359XEg19Rl5U2FLXieA742mFsNfv7r/0SVC6gFT19Mdz7w2HD9Hpu tb5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9lclNorrTuZxHvlm4yhJSeHL+7mBpQLMo/gFiHr6+ZY=; fh=yRrq3hgxWuV/e7DB+jaoXcbbx0lk/qq//lrXju01W+o=; b=DTfGJaVEp0N8TvfTAHhmzd8PdM4NxMz+CRdgNKpiAhhbY2vtjezgMY3BPXTx3UJ99X MJAH0gEX/Jpf83xr0Qbf1+Cvgmm7zBZuM9LS5GIxJ4CnyS5YQghCvJQIJBgmKERkiaRf 8el+2Mnt6Mv8FlAdwEFTTS621gavaUkMheYRmvtlXjJI8jUW+zdEbINHXbSHq8/RzxLA RX27TQFmNY00KbJCO6z10i/DjlXj7prYDLeJuor6xRt6q5qKwPb4fYH3uCO4iNF5D6Us VufzGiZ2aJzZfokPJr7I3B9JEeAPfbQBWACXgyJyAHDLAuZDGxhZ8iq90Lksnl42pVHQ J+tw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=hZ5NNlf5; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-197197-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197197-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c1a77c491bsi3759060a91.131.2024.05.31.09.54.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 09:54:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197197-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=hZ5NNlf5; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-197197-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197197-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E43D42881A2 for ; Fri, 31 May 2024 16:52:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B59A516936F; Fri, 31 May 2024 16:51:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="hZ5NNlf5" Received: from out-175.mta1.migadu.com (out-175.mta1.migadu.com [95.215.58.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5107C3BBE9 for ; Fri, 31 May 2024 16:51:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717174312; cv=none; b=MS1Q2TsQoSxkwhZo4IRyDcPTtQG/S7F1jfRzqqibZAZEfh80pmkrwryDVqDOHppKDOMAoY+QBfSEUkpcFjJXRdH8unLNSSm2TP88/PyVj9gfEva0bgebZZIyNRyniHlR+dGKoD6a8N5PwAQy0HnXfGdG2uJ21bNSLPpdLeNa6K0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717174312; c=relaxed/simple; bh=JXG3CIOMNY5wDMzz4UfBJKTp/yf9W3rH8TR6whRWl3w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iPXnLRAyfvphX/ATDa/1cWpuGkySMidqFZeQy2VhEcOudCpF0wRZyjppjA1mR8HNDkictFbIicJKpJ57/tqxL3y8BHzmH2mFp+Wws4MjcYfcbjFbfUk+wetCXJzUzuyozIZ2fvEe2NzyY6Oe3AL2fv8LydtP8VmD5dZR3nd98xI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=hZ5NNlf5; arc=none smtp.client-ip=95.215.58.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: kees@kernel.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717174299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9lclNorrTuZxHvlm4yhJSeHL+7mBpQLMo/gFiHr6+ZY=; b=hZ5NNlf5zcIZZsBTALKRZnh1mVr8ROUllgS4pYmV3KIQYTq2x3XySgxS9WEDtt52jFA1Q5 6KBII4MnUd/M5BXsTr19url9OpExD0VwT4XAQMBBSbgSHSCBT7HgR/uYK+yBEGooacTXFM UIfeCU4+OuZi4fwUR1SHJwFbRzikJu0= X-Envelope-To: vbabka@suse.cz X-Envelope-To: cl@linux.com X-Envelope-To: penberg@kernel.org X-Envelope-To: rientjes@google.com X-Envelope-To: iamjoonsoo.kim@lge.com X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: roman.gushchin@linux.dev X-Envelope-To: 42.hyeyoo@gmail.com X-Envelope-To: linux-mm@kvack.org X-Envelope-To: linux-hardening@vger.kernel.org X-Envelope-To: gongruiqi@huaweicloud.com X-Envelope-To: xiujianfeng@huawei.com X-Envelope-To: surenb@google.com X-Envelope-To: jannh@google.com X-Envelope-To: matteorizzo@google.com X-Envelope-To: tgraf@suug.ch X-Envelope-To: herbert@gondor.apana.org.au X-Envelope-To: julien.voisin@dustri.org X-Envelope-To: linux-kernel@vger.kernel.org Date: Fri, 31 May 2024 12:51:29 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Kees Cook Cc: Vlastimil Babka , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, linux-hardening@vger.kernel.org, "GONG, Ruiqi" , Xiu Jianfeng , Suren Baghdasaryan , Jann Horn , Matteo Rizzo , Thomas Graf , Herbert Xu , julien.voisin@dustri.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/6] mm/slab: Plumb kmem_buckets into __do_kmalloc_node() Message-ID: References: <20240424213019.make.366-kees@kernel.org> <20240424214104.3248214-2-keescook@chromium.org> <202405310943.D9818A4FE@keescook> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202405310943.D9818A4FE@keescook> X-Migadu-Flow: FLOW_OUT On Fri, May 31, 2024 at 09:48:49AM -0700, Kees Cook wrote: > On Fri, May 24, 2024 at 11:01:40AM -0400, Kent Overstreet wrote: > > On Wed, Apr 24, 2024 at 02:40:59PM -0700, Kees Cook wrote: > > > To be able to choose which buckets to allocate from, make the buckets > > > available to the lower level kmalloc interfaces by adding them as the > > > first argument. Where the bucket is not available, pass NULL, which means > > > "use the default system kmalloc bucket set" (the prior existing behavior), > > > as implemented in kmalloc_slab(). > > > > I thought the plan was to use codetags for this? That would obviate the > > need for all this plumbing. > > > > Add fields to the alloc tag for: > > - allocation size (or 0 if it's not a compile time constant) > > - union of kmem_cache, kmem_buckets, depending on whether the > > allocation size is constant or not > > I want to provide "simple" (low-hanging fruit) coverage that can live > separately from the codetags-based coverage. The memory overhead for > this patch series is negligible, but I suspect the codetags expansion, > while not giant, will be more than some deployments will want. I want > to avoid an all-or-nothing solution -- which is why I had intended this > to be available "by default". technically there's no reason for your thing to depend on CONFIG_CODETAGGING at all, that's the infrastructure for finding codetags for e.g. /proc/allocinfo. you'd just be using the alloc_hoos() macro and struct alloc_tag as a place to stash the kmem_buckets pointer.