mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Pedro Falcato <pfalcato@suse.de>
Cc: "Vlastimil Babka" <vbabka@kernel.org>,
	"Harry Yoo" <harry@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Hao Li" <hao.li@linux.dev>, "Christoph Lameter" <cl@gentwo.org>,
	"David Rientjes" <rientjes@google.com>,
	"Roman Gushchin" <roman.gushchin@linux.dev>,
	linux-mm@kvack.org, "Kuniyuki Iwashima" <kuniyu@google.com>,
	linux-hardening@vger.kernel.org,
	"Jakub Kicinski" <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>,
	"Jason Xing" <kerneljasonxing@gmail.com>,
	"Björn Töpel" <bjorn@kernel.org>,
	"Jiayuan Chen" <jiayuan.chen@linux.dev>,
	"Willem de Bruijn" <willemb@google.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v4 6/7] mm/slab: Let a bucket set handle __GFP_ACCOUNT
Date: Fri, 2 Oct 2026 15:29:15 -0700	[thread overview]
Message-ID: <202610021527.05F3D63AA@keescook> (raw)
In-Reply-To: <arJVktqS-CL7zNX0@pedro-suse.tail5790ac.ts.net>

On Tue, Sep 22, 2026 at 11:20:40AM +0100, Pedro Falcato wrote:
> On Mon, Sep 21, 2026 at 12:58:17AM -0700, Kees Cook wrote:
> > A bucket set holds one row of caches, cloned from KMALLOC_NORMAL, and an
> > allocation of any other kmalloc type falls back to the general caches.
> > Extend this to handle __GFP_ACCOUNT, so that a single bucket user can
> > isolate either GFP_KERNEL or GFP_KERNEL_ACCOUNT allocations, as is
> > needed for skb data, where AF_UNIX uses:
> > 
> > 	sk->sk_allocation = GFP_KERNEL_ACCOUNT;
> > 
> > The coverage is selected at bucket creation time:
> > 
> > 	b = kmem_buckets_create_types(name, flags, 0, INT_MAX, NULL,
> > 				      BIT(KMEM_BUCKET_NORMAL) |
> > 				      BIT(KMEM_BUCKET_CGROUP));
> > 
> > The prior kmem_buckets_create() function keeps its name and defaults
> > to only KMEM_BUCKET_NORMAL, leaving existing users as-is.
> > 
> > Only the accounted type is offered. Nothing wants a reclaimable or
> > no-obj-ext row, and of the twelve places passing GFP_DMA to an skb
> > allocator, all rare hardware: b44, b43legacy, prestera and s390 ctcm.
> 
> Well, yes, BUT I don't think silently falling back is a great option.
> I would rather things be done Properly(tm) and kmem_buckets allowing
> instantiation of most/all kmalloc cache types. Given it's security stuff,
> I would prefer being quite explicit over silent.

The types that fall back (DMA, reclaimable) are already isolated in
caches of their own, away from the normal ones, so the security goal
holds for them as-is. The one fallback that would undo the isolation,
an accounted allocation on a set made without the cgroup row, will
warn now.

-- 
Kees Cook

  reply	other threads:[~2026-10-02 22:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  7:58 [PATCH v4 0/7] net: skb: isolate skb data area allocations into a separate bucket Kees Cook
2026-09-21  7:58 ` [PATCH v4 1/7] mm/slab: Mark the kmem_buckets_create() context as a Context: section Kees Cook
2026-09-21 12:03   ` Harry Yoo
2026-09-22  9:58   ` Pedro Falcato
2026-09-25  8:38   ` Hao Li
2026-09-21  7:58 ` [PATCH v4 2/7] mm/slab: Give bucket caches the alignment of the caches they mirror Kees Cook
2026-09-21 13:17   ` Harry Yoo
2026-09-21 23:25     ` Kees Cook
2026-09-24 18:22       ` Harry Yoo
2026-09-25  1:00         ` Kees Cook
2026-09-21  7:58 ` [PATCH v4 3/7] mm/slab: Add kmem_buckets_destroy() Kees Cook
2026-09-21  7:58 ` [PATCH v4 4/7] mm/slab: Add tests for the existing kmem_buckets behaviour Kees Cook
2026-09-21  7:58 ` [PATCH v4 5/7] mm/slab: Provide kmalloc type fallback for bucket allocations Kees Cook
2026-09-22 10:11   ` Pedro Falcato
2026-10-02 22:27     ` Kees Cook
2026-09-21  7:58 ` [PATCH v4 6/7] mm/slab: Let a bucket set handle __GFP_ACCOUNT Kees Cook
2026-09-21 13:25   ` Harry Yoo
2026-09-21 23:26     ` Kees Cook
2026-09-22 10:20   ` Pedro Falcato
2026-10-02 22:29     ` Kees Cook [this message]
2026-09-21  7:58 ` [PATCH v4 7/7] net: skb: isolate skb data area allocations into a separate bucket Kees Cook
2026-09-27  8:24   ` Paolo Abeni
2026-10-02 22:59     ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202610021527.05F3D63AA@keescook \
    --to=kees@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bjorn@kernel.org \
    --cc=cl@gentwo.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hao.li@linux.dev \
    --cc=harry@kernel.org \
    --cc=horms@kernel.org \
    --cc=jiayuan.chen@linux.dev \
    --cc=kerneljasonxing@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pfalcato@suse.de \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®