Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Eric Dumazet <edumazet@google.com>, zhilinz@nebusec.ai
Cc: Daehyeon Ko <4ncienth@gmail.com>,
	netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3] ip: validate options before echoing them
Date: Wed, 2 Sep 2026 18:53:27 +0300	[thread overview]
Message-ID: <20260902155327.GA4024109@shredder> (raw)
In-Reply-To: <CANn89i+CSVHtjDk_NQT_Q6NpwJ76WQ=CExXp1xY15iPQuZSp+w@mail.gmail.com>

On Wed, Sep 02, 2026 at 10:44:45AM +0200, Eric Dumazet wrote:
> Oh well. Ai reviews will probably raise many bugs in this patch :/
> 
> ipmr_cache_report() is a distinct bug and needs its own one liner fix.
> 
> When ipmr_cache_report() builds an IGMPMSG_WHOLEPKT or IGMPMSG_WRVIFWHOLE
> report, it reallocates headroom and pushes a 20-byte iphdr with ihl = 5, but
> inherits pkt->cb with stale IPCB(skb)->opt offsets.
> Even if __ip_options_echo() rejects it, ip_cmsg_recv_opts() will still read
> stale IPCB(skb)->opt.optlen bytes from ip_hdr(skb) + 1 and leak packet data
> as IP_RECVOPTS.
> ipmr_cache_report() must clear IPCB(skb)->opt (or memset IPCB(skb)) when
> prepending the report header.
> 
> Something like:
> 
> diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
> index e5f2b1c6150d2f6b2084c2ebaef6047db869cc87..72f1d620b8760722f805935d0299bac24a9f720c
> 100644
> --- a/net/ipv4/ipmr.c
> +++ b/net/ipv4/ipmr.c
> @@ -1102,6 +1102,7 @@ static int ipmr_cache_report(const struct mr_table *mrt,
>                 ip_hdr(skb)->ihl = sizeof(struct iphdr) >> 2;
>                 ip_hdr(skb)->tot_len = htons(ntohs(ip_hdr(pkt)->tot_len) +
>                                              sizeof(struct iphdr));
> +               memset(&IPCB(skb)->opt, 0, sizeof(IPCB(skb)->opt));
>         } else {
>                 /* Copy the IP header */
>                 skb_set_network_header(skb, skb->len);

Yes, this was raised in the past [1].

Zhiling Zou, please send v4 of [2].

[1] https://lore.kernel.org/netdev/20260805081737.GA1284302@shredder/
[2] https://lore.kernel.org/netdev/e93d0d2fa5725ddd06b20e3e4223ab68b93b48d1.1785719031.git.zhilinz@nebusec.ai/

  reply	other threads:[~2026-09-02 15:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  5:58 [PATCH net v3] ip: validate options before echoing them Daehyeon Ko
2026-09-02  8:44 ` Eric Dumazet
2026-09-02 15:53   ` Ido Schimmel [this message]
2026-09-02  9:29 ` Jiayuan Chen
2026-09-02 22:05 ` [syzbot ci] " syzbot ci

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=20260902155327.GA4024109@shredder \
    --to=idosch@nvidia.com \
    --cc=4ncienth@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zhilinz@nebusec.ai \
    /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