Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Christian Brauner <brauner@kernel.org>
Cc: linux-kselftest@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Maximilian Heyne <mheyne@amazon.de>,
	Christian Brauner <christianvanbrauner@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Shuah Khan <shuah@kernel.org>,
	Wei Yang <richard.weiyang@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH] selftests: uevent filtering: don't shrink the socket buffer
Date: Tue, 24 Nov 2026 22:06:04 -0800	[thread overview]
Message-ID: <3179ee5792a7421ba74dbfebe2838617.1@linux-foundation.org> (raw)

From: Maximilian Heyne <mheyne@amazon.de>
Subject: selftests: uevent filtering: don't shrink the socket buffer
Date: Fri, 19 Jun 2026 11:24:29 +0000

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.

Link: https://patch.msgid.link/20260619-get-swam-a1cd4cca@mheyne-amazon
Fixes: 9d3df886d17b ("selftests: uevent filtering")
Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Christian Brauner <christianvanbrauner@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: <stable@vger.kernel.org>

 tools/testing/selftests/uevent/uevent_filtering.c |    8 --------
 1 file changed, 8 deletions(-)

--- a/tools/testing/selftests/uevent/uevent_filtering.c~selftests-uevent-filtering-dont-shrink-the-socket-buffer
+++ a/tools/testing/selftests/uevent/uevent_filtering.c
@@ -78,7 +78,6 @@ static int uevent_listener(unsigned long
 {
 	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
 		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;
 
_

             reply	other threads:[~2026-11-25  6:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  6:06 Andrew Morton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-06-19 11:24 [PATCH] selftests: uevent filtering: don't shrink the socket buffer Maximilian Heyne

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=3179ee5792a7421ba74dbfebe2838617.1@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=christianvanbrauner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mheyne@amazon.de \
    --cc=richard.weiyang@gmail.com \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    /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