Article View: linux.kernel.netdev
Article #7327Re: [PATCH net v2] ipv6: raw: fix use-after-free in rawv6_send_hdrinc()
From: Hangbin Liu
Date: Mon, 26 Oct 2026 06:09
Date: Mon, 26 Oct 2026 06:09
57 lines
10521 bytes
10521 bytes
On Mon, Oct 26, 2026 at 12:48:08PM +0800, Zhou Qiuyue wrote:
> rawv6_send_hdrinc() caches the route before handing the skb to
> l3mdev_ip6_out(). The VRF output path may replace skb->dst and release
> the original route, leaving the cached pointer stale.
>
> The function later dereferences that pointer for statistics accounting
> and as the output device passed to NF_HOOK(). Its RCU read-side critical
> section starts after l3mdev_ip6_out(), so it cannot prevent the old route
> from being reclaimed in between.
>
> Reload the route from the current skb destination after
> l3mdev_ip6_out() returns.
>
> KASAN reports a slab-use-after-free in rawv6_sendmsg(), with the route
> allocated by ip6_dst_alloc(), freed by dst_destroy() from rcu_core(), and
> the related RCU callback queued from vrf_l3_out().
>
> Fixes: 4c1feac58e06 ("net: vrf: Flip IPv6 output path from FIB lookup hook to out hook")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zhou Qiuyue <n0ps1edzz@gmail.com>
> ---
> Changes in v2:
> - Rebased onto the current net tree at 7076f684d513.
> - Regenerated the patch with git-format-patch so it applies cleanly.
> - Corrected the Fixes tag to the commit that made the IPv6 VRF path reachable.
> - Shortened the code comment and added the required recipients.
>
> v1: https://lore.kernel.org/r/6adad51d.8fc0b0c9.1ec657.1868@mx.google.com
>
> Thank you to Hangbin Liu for reviewing v1 and pointing out the submission
> issues.
>
> net/ipv6/raw.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
> index b965258cf..bdea82543 100644
> --- a/net/ipv6/raw.c
> +++ b/net/ipv6/raw.c
> @@ -654,6 +654,9 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
> if (unlikely(!skb))
> return 0;
>
> + /* l3mdev_ip6_out() may have replaced the skb dst. */
> + rt = dst_rt6_info(skb_dst(skb));
> +
> /* Acquire rcu_read_lock() in case we need to use rt->rt6i_idev
> * in the error path. Since skb has been freed, the dst could
> * have been queued for deletion.
>
> base-commit: 7076f684d5132e6a6145e1da2fa74771ecd052e5
> --
> 2.50.1.windows.1
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Technical Details
Message-ID:
<at7uk8gXtzNufuQF@fedora>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351696-linux-kernel-netdev=dewy.ruReferences:
<20261026044808.613-1-n0ps1edzz@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351696-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2] ipv6: raw: fix use-after-free in rawv6_send_hdrinc() Date: Mon, 26 Oct 2026 14:09:23 +0800 Organization: Usenet Network Message-ID: <at7uk8gXtzNufuQF@fedora> References: <20261026044808.613-1-n0ps1edzz@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="1237856"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:917zk0I0wzdsTZctUHSCpbBy+m8= sha256:UDs/TcF4ItdZgP1S6Fgm2eWwjYgnKao0McHL0sXKOA4= sha1:as5yVivgQ/bmIDVsf6BHbc5GtdI= sha256:YAhV6mBikPiqB3X0PnOTj84aEGxfSlDZHhv03TKgiFg= Content-Disposition: inline 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 76E32125B88; Mon, 26 Oct 2026 09:10:08 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.049 X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=linux.dev 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 JUI0yoGZrYDz; Mon, 26 Oct 2026 09:10:03 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-351696-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 8B1D4125B7B; Mon, 26 Oct 2026 09:09:52 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 0177628218; Mon, 26 Oct 2026 06:09:42 +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=1792994981; b=iyQBLdw3Pu9AB5x2PUM19CrB0WvIb1ximVKSIX3BF4SsbzCtk/zw/Lrzi87kDbB9rYTM KACpfjLp2VWh/pQX+nQ1hJ3BdoXA2HAGjtk8diOdXxlanf/XfMK7oqzHnoM4ucaQXR0oy 4U8ImgGhk/zx0DuUjzi0SOQz9CGeEYIaQhtx0hNqZtgRgyAOsu1WwbXDi1djFHRIojmSP e2QGUPPuWOwqgzxHlW7xbQpVREU3Ef/A8mQEFZmezvNvoBDbX8SRon+1kyBwL8icjG1Cl w21kNCTSlCCnPzL9q/5b8g/GyfHrY7L/H6ozvnZmLSQQdzGf+SgjZH6SemhZFdXboqg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792994981; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=ScUwDrCxcDY2Tg+t0+W2UwFl6cxgpHFmAE9XOo7zw8g=; b=oJrWIntXZ5IBoXqZyMqPPz6fkZS3PRc53+graxnSnHdm7fg+kTJEcpKHov3v6UpMXBuK r+lMInJi418wzcmAOjHIJD7p3Ln3hE8gskNnRFdICTBCYfEng590lNOJgT2sk1lIGl4zb 2mkZpdMv6xetPGgMpg+5Ma2WqOQuIo8FyQs5YjOw122imUS0oB34xfQfylbLhgTlkhe5m SxSSeOkS8ZXfjxIB5l2XURRdEbJw8Qmwx21zPRcJ838MEe2rAi6a5bskxkpCRP4uRoIlH WD/i5tZa9VkUFUyfj43muqu8QeGsb46+CpOHSpJ4M7Lsrm/vCCERLlqnDp+pRC53tqg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=ZJ87ng0A; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; 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 345E3606A333; Mon, 26 Oct 2026 06:09:41 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=ZJ87ng0A X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.61 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792994980; b=qaqkKLba/1nna/LGK9E6P7n7XlpASBdH5K9FcIRG0pnmeCadw8Xlm9xaYTklBGsGl6JW l1iFucy+FGCnhsMlJieOz55duvTaw3q8mxC8smEuaXp1B17Uub88CTSUQ7EhY57ptf19p R5Aqyf+D5faYiYxdrpQPETjzzvpllVW8J2STEXU7hvV+JcN8MlK9avLQuiif6gd5Pwzxv iKfaVyA1J3/qxZx/ZdHDEmAENf88OdDRwl1D9CD/2STOu47zb9V5YeM/WB0D26qW8JmJo PO7rg+CtESW8CTv1wfSJ2DOdDYe3qXkwnWIh8zBha9LWkrpSctbsADE1hIhkXMhVs6w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792994980; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=ScUwDrCxcDY2Tg+t0+W2UwFl6cxgpHFmAE9XOo7zw8g=; b=YkgtysEi4LyUNixjHDRx+Zp+LZ2obNElJrLcCcjcOszByywk7fTmHoXp8eGr1ehwmqPn 3xgX6BcpuSSfD/bCfXBlwN+MlnZvW7e81O0WbqqM4814HpyqiIL89I3g/xjI4fnLlGwVR 8CIQWdViRgB7z264i3FSzJ4fgaV0+xVqLYmWF8lsWkHyuqEacxb/m4L8GocT8RYvDilvS 4vQ7Bvs2svPMKlStEPYtw7rs0prDxGiH1AcNUq+3+SSO0LKZvoHx5mRCJtY3wIKqzLwdT iCZmKB26/F/knRH7ABDW6JHaYQYPb5tI3ynz+e7MepshmBYZ1QFYmX0YR43GOQHOv7Q== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=ZJ87ng0A; arc=none smtp.remote-ip=91.218.175.61 X-Received: from mta0.migadu.com (out-61.mta0.migadu.com [91.218.175.61]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36052606A31D for <netdev@vger.kernel.org>; Mon, 26 Oct 2026 06:09:38 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 36052606A31D X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=HVI1rhJAjlA6hwOuxcxfPrgx9c8vnckidjUuhN7LrGs=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1792994977; v=1; x=1793599777; b=ZJ87ng0Awshfd2qAvlXjnoYCpo/685WZn3yvyRHt4/IgTUhKjohacDBgrda54qYzp5EEu6a3 j+5Z9V0ZA+ZvdslvqtOa0+tNlccVk8FfUpTHuYtkfVkkcwXZsifiFeGE8StoTGNJmjxarDN8IYO pNYB1P4Ax4eCxk58aoUyS7rA= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta11.migadu.com with ESMTPS id 5076e146843fdcaf; Mon, 26 Oct 2026 06:09:37 +0000 X-Mizu-Trace-ID: 5076e146843fdcaf X-Migadu-Flow: FLOW_OUT X-Cc: netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, linux-kernel@vger.kernel.org, stable@vger.kernel.org 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: <20261026044808.613-1-n0ps1edzz@gmail.com>