From: Simon Horman <horms@kernel.org>
To: qingfang.deng@linux.dev
Cc: 'Simon Horman' <horms@kernel.org>,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org,
willemb@google.com, petrm@nvidia.com, anubhavsinggh@google.com,
richardbgobert@gmail.com, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-ppp@vger.kernel.org
Subject: Re: [PATCH net-next v8 2/2] selftests: net: test PPPoE packets in gro.sh
Date: Wed, 6 May 2026 13:14:54 +0100 [thread overview]
Message-ID: <20260506121454.652034-1-horms@kernel.org> (raw)
In-Reply-To: <20260501035102.293031-2-qingfang.deng@linux.dev>
From: 'Simon Horman' <horms@kernel.org>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev
---
selftests: net: test PPPoE packets in gro.sh
This commit adds PPPoE test-cases to the GRO selftest and a new "pppoe_sid"
test case to verify that packets with different PPPoE session IDs are correctly
identified as separate flows.
> diff --git a/tools/testing/selftests/net/lib/gro.c b/tools/testing/selftests/net/lib/gro.c
> index 11b16ae5f0e83..4ffb0491c0da7 100644
> --- a/tools/testing/selftests/net/lib/gro.c
> +++ b/tools/testing/selftests/net/lib/gro.c
[ ... ]
> @@ -1071,6 +1095,20 @@ static void send_fragment6(int fd, struct sockaddr_ll *daddr)
> write_packet(fd, buf, bufpkt_len, daddr);
> }
>
> +static void send_changed_pppoe_sid(int fd, struct sockaddr_ll *daddr)
> +{
> + static char buf[L2_HLEN_MAX + PAYLOAD_LEN];
> + int pkt_size = total_hdr_len + PAYLOAD_LEN;
> + struct pppoe_hdr *hdr = (struct pppoe_hdr *)(buf + ETH_HLEN);
> +
> + create_packet(buf, 0, 0, PAYLOAD_LEN, 0);
Will this write past the end of the buffer?
When create_packet() is called, it writes total_hdr_len + PAYLOAD_LEN bytes:
tools/testing/selftests/net/lib/gro.c:create_packet() {
...
memset(buf, 0, total_hdr_len);
memset(buf + total_hdr_len, 'a', payload_len);
...
}
However, buf is only sized for L2_HLEN_MAX + PAYLOAD_LEN. L2_HLEN_MAX
evaluates to 22 bytes (ETH_HLEN + PPPOE_SES_HLEN). For IPv6 PPPoE packets,
total_hdr_len can be up to 82 bytes (14 ETH + 8 PPPoE + 40 IPv6 + 20 TCP).
Does this result in an out-of-bounds write of 60 bytes when setting up the
IPv6 test case?
> + write_packet(fd, buf, pkt_size, daddr);
> +
> + create_packet(buf, PAYLOAD_LEN, 0, PAYLOAD_LEN, 0);
> + hdr->sid = htons(0x4321);
> + write_packet(fd, buf, pkt_size, daddr);
> +}
next prev parent reply other threads:[~2026-05-06 12:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 3:50 [PATCH net-next v8 1/2] net: pppoe: implement GRO/GSO support Qingfang Deng
2026-05-01 3:50 ` [PATCH net-next v8 2/2] selftests: net: test PPPoE packets in gro.sh Qingfang Deng
2026-05-06 12:14 ` Simon Horman [this message]
2026-05-06 12:14 ` [PATCH net-next v8 1/2] net: pppoe: implement GRO/GSO support Simon Horman
2026-05-07 3:36 ` Qingfang Deng
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=20260506121454.652034-1-horms@kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=anubhavsinggh@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-ppp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=qingfang.deng@linux.dev \
--cc=richardbgobert@gmail.com \
--cc=shuah@kernel.org \
--cc=willemb@google.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