Article View: linux.kernel.netdev
Article #20314Re: [PATCH net] net: af_key: fix use-after-free in dump_sp() on policy migrate
From: patchwork-bot+netdevbpf
Date: Sun, 22 Nov 2026 00:50
Date: Sun, 22 Nov 2026 00:50
38 lines
9620 bytes
9620 bytes
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
Technical Details
Message-ID:
<179530860453.1236726.16228084026958621779.git-patchwork-notify@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368551-linux-kernel-netdev=dewy.ruReferences:
<20261114223529.1791-1-danjwade95@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368551-linux-kernel-netdev=dewy.ru From: patchwork-bot+netdevbpf@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179530860453.1236726.16228084026958621779.git-patchwork-notify@kernel.org> References: <20261114223529.1791-1-danjwade95@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3534050"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:PG5An4eSF8Epwgb5vUr9AK2YHzc= sha256:923xJ85LvHenGRV5TRjDm6VhtRja9uMxTvTxnpXmDKQ= sha1:bb1KCRNb63LsDahbTao8v/InZDU= sha256:k7eDaKPjUE9+XABKmS3dVLGRk7F9WXIs+3oX0bEuRWo= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 063A3115C51; Sun, 22 Nov 2026 03:50:22 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VrnMdGPQ8b3n; Sun, 22 Nov 2026 03:50:18 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368551-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id A551A115C3D; Sun, 22 Nov 2026 03:50:08 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 3FA3D36586; Sun, 22 Nov 2026 00:50:07 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795308607; b=ulSHWeeI+GmR6J6TrSisAwqhIz8guuZzdaH6KRrirgiqcOT5vUz7zR4OonChiIBvRFIw zHSTmYno2uUE6Bat3mNU4BwtPDOiXlkd3z9oTyK7T/ZVNtag1WSuwzvOMLAWG6IwJS24x vXGCYErKzbR6Nz8/7jNxn3egIvUSXlixHEUuGvGi1A3IAZD+FeHHwGpqhlmP5be2BcBbz cl/20yy8dWRWOoKlWlEu5G43czQtdgx6EPY7cTgl+3CpEoSJAp3mlIp/O2dEL13AS3y6z cUSZlGPfJCGUNAswCf8O6BYAlSIsJcgjrAkt/8ZfZzauuebTUSkngl/57rItSRWGKsw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795308607; h=X-Original-To:Received:Received:DKIM-Signature:Received:Content-Type: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding:Subject:From:Message-Id:Date:References: In-Reply-To:To:Cc; bh=JmLfpKYr2QCIbwg+HkVUhA3vaxVAurC/ZibOYjAXnR0=; b=V1Y0YnxK8FrmLS69bpIC0y2dd3J4J9KMyy9yb4syPvJNnvkHcN9NnplykXu/44X7koJR tdYPyFrQWWho74+BIDPjvN7ppSUwePrfI1l0izOu/NGe2inaSOyRlS4jSu5lP1iQtwovi SAzxzW4Vzs9XXrevbl96kuPDaYQuvunrusuxIMldt2Eh5GRfrBXL1ENnf62WLxjy4etTA B/+UfhzUdiEkK3vpSwq8pBwwDlT6kvBnwOQcAOa0/QX38N+pD5Miz8zw+mDhF7eqkkQJB G27YpgZ//TbrGUWxCX1JW0+WA/cNkSYHqipwp5+ScYeLDLPJORPSQSGPx19NRTm6kzw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=UErU4YAw; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1321D606A334; Sun, 22 Nov 2026 00:50:07 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=UErU4YAw X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795308606; b=HNUo8wuVlBM2JoLHTPhzjr2Cn5C4hf9YF2HcaCin7e4KZyVj9uBrWRtGQ++QXSNMZAlC y7loJPVZSPLj7dlaKEzAlzZjwNrY+RI3Nu7Bf98YazzfPmGWRugYz1f0cm9KlBoDv2OX6 o9aKVa9b5cctvlEY4QyN6C9+1ImgIl51i3s8v4w+NxQS8vU0GZv0ssYFAmo/etTTwPB0F O0MBGaO8C1cDW3J3iHpnquUXFvh6UvqCSEtV0r9Bq6IYbXSPjm+Shydm2r7K82hzWN5JJ cdsOqDdbMakZYMg3WGOsNDHnS+RcgYnmfsJDVuwJ/477lvYi+nZfW9+e/DYVXiegMwg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795308606; h=Received:DKIM-Signature:Received:Content-Type:MIME-Version: Content-Transfer-Encoding:Subject:From:Message-Id:Date:References: In-Reply-To:To:Cc; bh=JmLfpKYr2QCIbwg+HkVUhA3vaxVAurC/ZibOYjAXnR0=; b=GcqP+ngxN8YsrHYpWWxqIJBKzqjjEXOaMzOBEQXzQHdZ4NX+RBRnoThIfbPqI0aBLtQ/ AFO2UkPDsvxFmGHTfYJLhxIloXLZ07cJipr1olR5gzafuQ4LwyAG7B6HElBv9f7q+LwCb kSnJCdtW0zPE+Di6hPXX5WDUOhWpPTZPYNPWUIHkvw8aPPibgDftU0LODxZTYoTswgUMt Aee7mmnffceJCqp/19nlMxyiPwFsok/zO2AIcGlhNNA7nEfRzu8t09iuxj3OAo9da7yRc 0MVRxoF5xfqn7MdOiV8g3e255YdqUzKRZvE4EElAfng0ndHKCMhWLYievWi6efgvh/w== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=UErU4YAw; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FD19606A320; Sun, 22 Nov 2026 00:50:05 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDEAB1F000C0; Sun, 22 Nov 2026 00:50:05 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795308605; bh=JmLfpKYr2QCIbwg+HkVUhA3vaxVAurC/ZibOYjAXnR0=; h=Subject:From:Date:References:In-Reply-To:To:Cc; b=UErU4YAwq1c2yX546pdoSE1n/BoQPiz+FkthF3M2npssjYnbK5pjnNf4X1culC7Vm wd6IvYHLO1Zz527yN1AcJNCh5mDz1qVjBrvIxccpwAqVWoOHlgPQgvOETVHdSLKr97 r80KxyxvgNEGZg7os3gfEGifmJC6ZgVkJKCuWKvpffLzKYS5CdtFf7fy1kBFdO39LQ hT8fU5KXeGLUEVPpHnZfVgcR/5q751kg+zKlJRnDWiR294QbNNNSh3oMJW/pB5WXhG hlj55+9NRmVpY4uRJJ81NSFIVaVxHyFTzXMAoiqCfuixZKd6BFpauDKjsIkPONM2yO b+P/28bnIsIRw== X-Received: from [10.30.226.235] (localhost [IPv6:::1]) by aws-us-west-2-korg-oddjob-rhel9-1.codeaurora.org (Postfix) with ESMTP id B4622391B098; Sun, 22 Nov 2026 00:50:05 +0000 (UTC) X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261114223529.1791-1-danjwade95@gmail.com> X-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