Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp580225lqh; Fri, 31 May 2024 09:50:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXYrNs6rmGGmfJE2cHR/t0XGkVqdc76qGegymIzcuXt63glbIXRnttkD2NY/k5JSieps8vR/9+faOUfUnDibz8reD5Llq/fH/AtycdFnQ== X-Google-Smtp-Source: AGHT+IF4bWmRtghibrkx74jh35yt8xM2jDxVCjVxINosJ2LoTMIAM73y1OoN+teGrT6mC8adPdiM X-Received: by 2002:a05:620a:36c7:b0:792:c19d:1b0e with SMTP id af79cd13be357-794f5c8726bmr221045185a.30.1717174222815; Fri, 31 May 2024 09:50:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717174222; cv=pass; d=google.com; s=arc-20160816; b=otNgnZIiJpqYk/nQ3ohOuIFM1iD3Xt4QR2bXO3fDI2unrwR+mv639YWm2Tze8WGR42 2Sg3R+3M4pMTPoDBylc7y09oGT2oBAsn96XmGYEFdCAvsEoH8veOY4gcB0GItyUaWCnf Kb//2OwZuVqU7K4Mo7+NaXtf7/MmzC9DJRHMVHYUWobORh5q+G+25eCX1AVqmKq6khaW H3SSNG+dovdjKkLXK8M2xCmnlDnzcjPgMinRsKmrahZUW8G+3fI16a5wW3CW1AbUm92P DFZ5n7Q2JnDa/PF8Hw+sgR+KHEtBmp7ct/cpU8WDuhV0yI3n26R0tXKJiB8bjMTHnEdP Ei+w== 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=VEEopXa/6axR2qlwT+N+gjyPs9hJMbVFhL2Ri7Y7Wg4=; fh=yRrq3hgxWuV/e7DB+jaoXcbbx0lk/qq//lrXju01W+o=; b=Lk9k4jNP81VkmToOTWm+7n2XTHqokCkI+iqfykI9kKGfqJBpHs/a8XUMYoTZpQFykD Yb+WEWPahektlvg6xCU9dQ0aAOvXZMUQ5LH9w/svh2bzQQdyc8OQq/wyzizYz9Clz6IM 2rKtkdhsgwNmSpTkJ3a/7c8vPcCfk++ujaU4zYMDQjLafMtoglOU5YlXcLrvPs0npPAV EzxL6O24dru3njJdbxYdABkUslRz2ecOc/psTj1nVjpxw6R0H9P0Rbg649Kjl+eoNBqq Nd9XC/JAcXEqvof4QG9zKik+7HaPeauYpdSSx7uvc0duYhOZx9ikAJotEBmJKSsE+Dg8 WtvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Bcv4uZSf; 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-197191-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197191-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794f2f0572bsi229634785a.73.2024.05.31.09.50.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 09:50:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197191-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Bcv4uZSf; 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-197191-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197191-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 79C191C21EFC for ; Fri, 31 May 2024 16:50:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1CBB167D96; Fri, 31 May 2024 16:50:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Bcv4uZSf" Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (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 26B8A3BBE9 for ; Fri, 31 May 2024 16:50:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717174216; cv=none; b=AcSly/nokKE73cIqbHZ6P2djMPsy9jEWYYDbsxSeMxtvP0n99axtAohs1JVRQRO+HCB9ET7W6UlsuGXnuGH0OyhUijd2KRtqoaszl/96C2PosO7ynKlgBbvMAUnLrTr4yYNmTMxEf+WVa/3MzMmHihG2+B1T9Lm7e3deikyzaRw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717174216; c=relaxed/simple; bh=6KcPpMIaVhrfLLpYPvkz29y7PLFD1EMfiqlDmt1B7hM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YWgn6PP6y7TTrZoCn+buQNfbqUTdkg1Vo1Vg5dtX/3bKAW2gwVa3I2Rqxi3uYlpAEjxVY8W/rjPMvHOkQ10zda3xNdbUIArkwWf0inL8s/7uMzrjJI1y3lyLigpW5m5dzGorXT0XEYdpU6O7Wutwogcz5HIjJ4YqUsdgAZezyFc= 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=Bcv4uZSf; arc=none smtp.client-ip=95.215.58.183 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=1717174213; 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=VEEopXa/6axR2qlwT+N+gjyPs9hJMbVFhL2Ri7Y7Wg4=; b=Bcv4uZSfIXwv++7KSEEVLfdODz8CsX7iI+ORptEsJ6KIZ7aQzRHKRGsAkmGcH0q/T5GAFI GFb3ZFZp4vgQsbTlTiSIxol1fLl9iGS/oo7fgJo4VRmS74TN8TVvbMOU/TK9/zEAxLZ4wf Ni5rG8WTUCon886TDWtyjxTtC62/JqY= 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:50:08 -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: <5boulybop2fxtkht7n65r6ktdr5aiedts5xnuadmyr6wvaectx@sbcdzqoljpeh> 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". You don't need to include the full codetag + alloc tag counters - with the appropriate #ifdefs the overhead will be negligable.