[PATCH net v2 2/2] cipso: unshare headers before recompiling IP options in cipso_v4_error()

Paul Moore paul at paul-moore.com
Mon Nov 9 21:43:19 UTC 2026


On Mon, Nov 9, 2026 at 8:17 AM Eric Dumazet <edumazet at kernel.org> wrote:
>
> cipso_v4_error() recompiles the IP options of the offending packet with
> __ip_options_compile() before echoing them in an ICMP error.
> __ip_options_compile() updates Record Route and Timestamp options in
> place.
>
> cipso_v4_error() is called from the LSM socket receive hooks through
> netlbl_skbuff_err(). ip_rcv_options() unshared the IPv4 header earlier,
> but at socket delivery time the skb can again be a clone sharing its
> data with other skbs, such as the per-socket clones made for raw sockets
> or multicast/broadcast delivery. Writing to the options then modifies
> packet data seen by the other users of the buffer, and a concurrent
> recompilation would hit the same check-then-write race as the one fixed
> in ipv4_send_dest_unreach().
>
> Make the header private before recompiling options, as ip_rcv_options()
> already does. If the copy fails, do not send the ICMP error.
>
> The issue was found by an AI code review agent. It was not reproduced,
> and the fix was only build-tested.
>
> Fixes: 3da1ed7ac398 ("net: avoid use IPCB in cipso_v4_error")
> Reported-by: Kyle Zeng <kylebot at openai.com>
> Cc: Paul Moore <paul at paul-moore.com>
> Cc: linux-security-module at vger.kernel.org
> Signed-off-by: Eric Dumazet <edumazet at kernel.org>
> ---
> v2: no change.
> v1: https://lore.kernel.org/netdev/20261106234313.2537882-1-edumazet@kernel.org/
>
>  net/ipv4/cipso_ipv4.c | 3 +++
>  1 file changed, 3 insertions(+)

My apologies, I missed that the v2 had been posted while ACK'ing the
v1.  Anyway, just so it's explicit ...

Acked-by: Paul Moore <paul at paul-moore.com>

-- 
paul-moore.com



More information about the Linux-security-module-archive mailing list