From: patchwork-bot+netdevbpf@kernel.org
To: Daniel Wade <danjwade95@gmail.com>
Cc: steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: af_key: fix use-after-free in dump_sp() on policy migrate
Date: Sun, 22 Nov 2026 00:50:04 +0000 [thread overview]
Message-ID: <179530860453.1236726.16228084026958621779.git-patchwork-notify@kernel.org> (raw)
In-Reply-To: <20261114223529.1791-1-danjwade95@gmail.com>
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sun, 15 Nov 2026 09:05:29 +1030 you wrote:
> pfkey_xfrm_policy2msg_size() derives an exported policy's message length
> from xfrm_vec[].encap_family. dump_sp() derives it twice: once through
> pfkey_xfrm_policy2msg_prep(), which allocates the skb, and again in
> pfkey_xfrm_policy2msg(), which fills it in.
>
> dump_sp() holds net->xfrm.xfrm_policy_lock rather than pol->lock, so
> xfrm_policy_migrate() can rewrite encap_family between the two
> derivations. The second length is then up to 24 bytes per template
> larger than the first, and pfkey_xfrm_policy2msg() opens with
> memset(hdr, 0, size), clearing the difference into the skb's shared
> info. Four BEET templates put 80 bytes there, which reaches dataref:
> alloc_skb() had set it to 1, the memset makes it 0, and the skb_clone()
> in pfkey_broadcast_one() leaves two skbs sharing one head with a dataref
> of 1. Freeing the original releases a head the queued clone still points
> at, so recvmsg() copies freed memory to user space and consume_skb()
> frees it a second time. The CAP_NET_ADMIN that pfkey_create() and the
> xfrm netlink receive path check is namespace-relative, so an
> unprivileged user can reach this. SLUB's double-free check fires within
> a second of starting the reproducer; the oops kills a task, or panics
> the machine when the corruption lands in softirq context.
>
> [...]
Here is the summary with links:
- [net] net: af_key: fix use-after-free in dump_sp() on policy migrate
https://git.kernel.org/netdev/net/c/af6737b90668
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
prev parent reply other threads:[~2026-11-22 0:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 22:35 Daniel Wade
2026-11-15 20:06 ` netdev-bot+sinfo
2026-11-16 1:34 ` Daniel Wade
2026-11-19 11:32 ` Paolo Abeni
2026-11-20 7:13 ` Steffen Klassert
2026-11-22 0:50 ` patchwork-bot+netdevbpf [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=179530860453.1236726.16228084026958621779.git-patchwork-notify@kernel.org \
--to=patchwork-bot+netdevbpf@kernel.org \
--cc=danjwade95@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=steffen.klassert@secunet.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®