From: Kees Cook <kees@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>
Cc: "Vlastimil Babka" <vbabka@kernel.org>,
"Pedro Falcato" <pfalcato@suse.de>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Simon Horman" <horms@kernel.org>,
"Willem de Bruijn" <willemb@google.com>,
"Jason Xing" <kerneljasonxing@gmail.com>,
netdev@vger.kernel.org, "Kuniyuki Iwashima" <kuniyu@google.com>,
linux-hardening@vger.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>,
"Björn Töpel" <bjorn@kernel.org>,
"Jiayuan Chen" <jiayuan.chen@linux.dev>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v4 7/7] net: skb: isolate skb data area allocations into a separate bucket
Date: Fri, 2 Oct 2026 15:59:35 -0700 [thread overview]
Message-ID: <202610021554.58F5CBB8@keescook> (raw)
In-Reply-To: <8862b9ed-6f96-48c6-a134-6e8635c38987@redhat.com>
On Sun, Sep 27, 2026 at 10:24:16AM +0200, Paolo Abeni wrote:
> On 9/21/26 09:58, Kees Cook wrote:
> > From: Pedro Falcato <pfalcato@suse.de>
> >
> > SKB data area allocations (as done from alloc_skb()) use kmalloc().
> > These allocations can be variably sized and their contents can be more
> > or less controlled from userspace, which makes them useful for attackers
> > that want to overwrite a use-after-free'd object from the same kmalloc slab
> > (which often just requires the sizes to roughly match into the same kmalloc
> > bucket). [0] is an easy example of an exploit that uses netlink skb
> > allocation to target another similarly-sized accidentally freed object.
> >
> > While other mitigations like CONFIG_RANDOM_KMALLOC_CACHES exist, these are
> > probabilistic. Use the existing kmem buckets API to further isolate these
> > allocations in a guaranteed fashion, when CONFIG_SLAB_BUCKETS=y.
> >
> > Ask for the accounted kmalloc type as well as the normal one. AF_UNIX
> > sets sk_allocation to GFP_KERNEL_ACCOUNT, so without it every AF_UNIX
> > skb data area would fall back to the general caches, and those are the
> > ones most worth isolating. GFP_DMA is left to fall back, being passed to
> > an skb allocator only by rare devices.
> >
> > Link: https://github.com/google/security-research/blob/master/pocs/linux/kernelctf/CVE-2023-4207_lts_cos_mitigation_2/docs/exploit.md [0]
> > Reviewed-by: Kees Cook <kees@kernel.org>
> > Signed-off-by: Pedro Falcato <pfalcato@suse.de>
>
> I would be curious to learn how about the memory usage delta.
> However I see buckets are protected by their own kconfig, small
> systems can unselect them.
Correct. But here's the delta for a 1 node NUMA with memcg, which is
dominated by sysfs. 26 caches (13 normal and 13 memcg):
sysfs, 26 caches 113,152
struct kmem_cache, 26 6,656
kmem_cache_node, 26 1,664
node_barn, 26 1,664
names, 26 1,248
the set itself, 2 rows × 14 pointers in kmalloc_buckets 224
per-CPU sheaf structs CPUSx x 832
> For the networking bits:
>
> Acked-by: Paolo Abeni <pabeni@redhat.com>
Thanks!
--
Kees Cook
prev parent reply other threads:[~2026-10-02 22:59 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 7:58 [PATCH v4 0/7] " 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
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 [this message]
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=202610021554.58F5CBB8@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®