* [PATCH] selftests: uevent filtering: don't shrink the socket buffer
@ 2026-06-19 11:24 Maximilian Heyne
0 siblings, 0 replies; only message in thread
From: Maximilian Heyne @ 2026-06-19 11:24 UTC (permalink / raw)
To: stable
Cc: Maximilian Heyne, Shuah Khan, Wei Yang, Andrew Morton,
Bala-Vignesh-Reddy, David S. Miller, Christian Brauner,
linux-kselftest, linux-kernel
The uevent_filtering test shrinks the uevent socket buffer to 4 KB
although the default socket buffer size is much higher. This leads to
this test being flaky when too many unrelated uevents are fired on the
machine. They might fill up the netlink receive buffer leading to
ENOBUFS errors when trying to receive the uevents.
For example, I could trigger test failures when running triggering a lot
of udev events in the background:
$ # run multiple of that in the background:
$ while :; do sudo udevadm trigger --action=change; done &
$ sudo ./uevent_filtering
# Starting 1 tests from 1 test cases.
# RUN global.uevent_filtering ...
add@/devices/virtual/mem/fullACTION=addDEVPATH=/devices/virtual/mem/fullSUBSYSTEM=memSYNTH_UUID=0MAJOR=1MINOR=7DEVNAME=fullDEVMODE=0666SEQNUM=304458
add@/devices/virtual/mem/fullACTION=addDEVPATH=/devices/virtual/mem/fullSUBSYSTEM=memSYNTH_UUID=0MAJOR=1MINOR=7DEVNAME=fullDEVMODE=0666SEQNUM=304471
add@/devices/virtual/mem/fullACTION=addDEVPATH=/devices/virtual/mem/fullSUBSYSTEM=memSYNTH_UUID=0MAJOR=1MINOR=7DEVNAME=fullDEVMODE=0666SEQNUM=304481
add@/devices/virtual/mem/fullACTION=addDEVPATH=/devices/virtual/mem/fullSUBSYSTEM=memSYNTH_UUID=0MAJOR=1MINOR=7DEVNAME=fullDEVMODE=0666SEQNUM=349156
No buffer space available - Failed to receive uevent
# uevent_filtering.c:463:uevent_filtering:Expected 0 (0) == ret (-1)
# uevent_filtering: Test failed
# FAIL global.uevent_filtering
not ok 1 global.uevent_filtering
The default receive buffer size (SK_RMEM_MAX) is far larger than the
requested 4 KB, so keep this to make the test less flaky.
Fixes: 9d3df886d17b ("selftests: uevent filtering")
Cc: stable@vger.kernel.org
Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
---
tools/testing/selftests/uevent/uevent_filtering.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/tools/testing/selftests/uevent/uevent_filtering.c b/tools/testing/selftests/uevent/uevent_filtering.c
index 974b076f9235..dd3549faf5db 100644
--- a/tools/testing/selftests/uevent/uevent_filtering.c
+++ b/tools/testing/selftests/uevent/uevent_filtering.c
@@ -78,7 +78,6 @@ static int uevent_listener(unsigned long post_flags, bool expect_uevent,
{
int sk_fd, ret;
socklen_t sk_addr_len;
- int rcv_buf_sz = __UEVENT_BUFFER_SIZE;
uint64_t sync_add = 1;
struct sockaddr_nl sk_addr = { 0 }, rcv_addr = { 0 };
char buf[__UEVENT_BUFFER_SIZE] = { 0 };
@@ -96,13 +95,6 @@ static int uevent_listener(unsigned long post_flags, bool expect_uevent,
return -1;
}
- ret = setsockopt(sk_fd, SOL_SOCKET, SO_RCVBUF, &rcv_buf_sz,
- sizeof(rcv_buf_sz));
- if (ret < 0) {
- fprintf(stderr, "%s - Failed to set socket options\n", strerror(errno));
- goto on_error;
- }
-
sk_addr.nl_family = AF_NETLINK;
sk_addr.nl_groups = __UEVENT_LISTEN_ALL;
--
2.50.1
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-19 11:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-19 11:24 [PATCH] selftests: uevent filtering: don't shrink the socket buffer Maximilian Heyne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®