]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/net: Interpret UDP_GRO cmsg data as an int value
authorJakub Sitnicki <jakub@cloudflare.com>
Thu, 16 Feb 2023 12:43:40 +0000 (13:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:07 +0000 (09:33 +0100)
commitad31803ddb8c70778fc2d1300a33fdcdb063e579
treeeb232da8ebd0c84b1f3e22d3b6fa203e2a1113d2
parentaa03cc7e21789fb3bfc4f14ce20e17503a4b7197
selftests/net: Interpret UDP_GRO cmsg data as an int value

[ Upstream commit 19f0014109f0219f8ac5f75c372777f7d28a500f ]

Data passed to user-space with a (SOL_UDP, UDP_GRO) cmsg carries an
int (see udp_cmsg_recv), not a u16 value, as strace confirms:

  recvmsg(8, {msg_name=...,
              msg_iov=[{iov_base="\0\0..."..., iov_len=96000}],
              msg_iovlen=1,
              msg_control=[{cmsg_len=20,         <-- sizeof(cmsghdr) + 4
                            cmsg_level=SOL_UDP,
                            cmsg_type=0x68}],    <-- UDP_GRO
                            msg_controllen=24,
                            msg_flags=0}, 0) = 11200

Interpreting the data as an u16 value won't work on big-endian platforms.
Since it is too late to back out of this API decision [1], fix the test.

[1]: https://lore.kernel.org/netdev/20230131174601.203127-1-jakub@cloudflare.com/

Fixes: 4811482b268d ("selftests: add functionals test for UDP GRO")
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/net/udpgso_bench_rx.c