Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 2d49c59f authored by Zijian Zhang's avatar Zijian Zhang Committed by Vegard Nossum
Browse files

selftests: fix OOM in msg_zerocopy selftest



[ Upstream commit af2b7e5b741aaae9ffbba2c660def434e07aa241 ]

In selftests/net/msg_zerocopy.c, it has a while loop keeps calling sendmsg
on a socket with MSG_ZEROCOPY flag, and it will recv the notifications
until the socket is not writable. Typically, it will start the receiving
process after around 30+ sendmsgs. However, as the introduction of commit
dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale"), the sender is
always writable and does not get any chance to run recv notifications.
The selftest always exits with OUT_OF_MEMORY because the memory used by
opt_skb exceeds the net.core.optmem_max. Meanwhile, it could be set to a
different value to trigger OOM on older kernels too.

Thus, we introduce "cfg_notification_limit" to force sender to receive
notifications after some number of sendmsgs.

Fixes: 07b65c5b ("test: add msg_zerocopy test")
Signed-off-by: default avatarZijian Zhang <zijianzhang@bytedance.com>
Signed-off-by: default avatarXiaochun Lu <xiaochun.lu@bytedance.com>
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20240701225349.3395580-2-zijianzhang@bytedance.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit d6ab0198fb470e1a9948d08c610a94601a1fdb2c)
[Harshit: Fix conflict due to missing commit: a8987b87
 ("selftests/net: reap zerocopy completions passed up as ancillary
 data.") in 4.14.y, we had to revert this due to selftests compilation
 failures, minor conflicts resolved due to do_recv_completions()
 definition, used do_recv_completions(fd) instead of
 do_recv_completions(fd, domain);]
Signed-off-by: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Signed-off-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
parent d110d6dd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment