]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/uevent: increase __UEVENT_BUFFER_SIZE to avoid ENOBUFS on busy systems
authorGuixin Liu <kanie@linux.alibaba.com>
Mon, 8 Jun 2026 05:39:34 +0000 (13:39 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 17 Jun 2026 22:37:46 +0000 (15:37 -0700)
commitc7fdbc2c2f26b9c397eb3aad2fdc54dbd85f68e1
tree8352f68088de6e31d51366ebdfbadfbf2bc8f214
parentf2737dc40d2ef3e9f3f9395d61f53f6668306a71
selftests/uevent: increase __UEVENT_BUFFER_SIZE to avoid ENOBUFS on busy systems

The kselftests case uevent.uevent_filtering fails reproducibly on busy
systems (e.g.  Intel EMR / AMD servers) with:

  No buffer space available - Failed to receive uevent

The listener binds the NETLINK_KOBJECT_UEVENT socket to all 32 multicast
groups (nl_groups = -1) but only sets SO_RCVBUF to 4 KiB
(__UEVENT_BUFFER_SIZE = 2048 * 2).  On hosts with many devices, the kernel
and userspace daemons (udev/systemd) constantly emit uevents on multiple
groups, plus the test itself triggers 10 add events in a row.  The 4 KiB
receive buffer overflows before the listener can drain it, recvmsg()
returns -ENOBUFS, and the test bails out as failure.

Increase __UEVENT_BUFFER_SIZE to 1 MiB so the receive buffer is large
enough to absorb the burst of uevents on busy systems.  After this change
the test passes consistently across dozens of runs on Intel EMR and AMD
platforms.

Link: https://lore.kernel.org/20260608053934.4059533-1-kanie@linux.alibaba.com
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/uevent/uevent_filtering.c