From: Allison Henderson <achender@kernel.org>
To: netdev@vger.kernel.org, pabeni@redhat.com, edumazet@google.com,
kuba@kernel.org, horms@kernel.org, linux-rdma@vger.kernel.org,
achender@kernel.org, linux-kselftest@vger.kernel.org,
shuah@kernel.org
Subject: [PATCH net-next v3 06/10] selftests: rds: Add SUDO_USER env variable
Date: Sun, 3 May 2026 22:41:39 -0700 [thread overview]
Message-ID: <20260504054143.4027538-7-achender@kernel.org> (raw)
In-Reply-To: <20260504054143.4027538-1-achender@kernel.org>
This patch modifies rds selftests to use the environment variable
SUDO_USER for tcpdumps if it is set. This is needed to avoid chown
operations on the vng 9pfs which is not supported. Passing a user
listed in sudoers avoids the tcpdump privilege drop which may
otherwise create empty pcaps
Signed-off-by: Allison Henderson <achender@kernel.org>
---
tools/testing/selftests/net/rds/README.txt | 7 +++++++
tools/testing/selftests/net/rds/test.py | 11 ++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/rds/README.txt b/tools/testing/selftests/net/rds/README.txt
index e629e08f04ef..295dc82c0770 100644
--- a/tools/testing/selftests/net/rds/README.txt
+++ b/tools/testing/selftests/net/rds/README.txt
@@ -37,6 +37,12 @@ ENV VARIABLES:
the specified --rwdir path for logs to persist on
the host.
+ SUDO_USER The user name that should be used for tcpdump
+ --relinquish-privileges. Set this to a user
+ belonging to the sudoers group to avoid drop
+ privilege errors with the vng 9p filesystem
+ which may result in empty pcaps
+
EXAMPLE:
# Create a suitable gcov enabled .config
@@ -54,6 +60,7 @@ EXAMPLE:
# launch the tests in a VM
vng -v --rwdir ./ --run . --user root --cpus 4 -- \
"export PYTHONPATH=tools/testing/selftests/net/; \
+ export SUDO_USER=example_user; \
export RDS_LOG_DIR=tools/testing/selftests/net/rds/rds_logs; \
tools/testing/selftests/net/rds/run.sh"
diff --git a/tools/testing/selftests/net/rds/test.py b/tools/testing/selftests/net/rds/test.py
index 0ece8324d255..7a3616ac288f 100755
--- a/tools/testing/selftests/net/rds/test.py
+++ b/tools/testing/selftests/net/rds/test.py
@@ -134,10 +134,15 @@ if logdir is not None:
for net in [NET0, NET1]:
pcap = logdir+'/'+net+'.pcap'
fd, pcap_tmp = tempfile.mkstemp(suffix=".pcap", prefix=f"{net}-", dir="/tmp")
+
+ tcpdump_cmd = ['ip', 'netns', 'exec', net, '/usr/sbin/tcpdump']
+ sudo_user = os.environ.get('SUDO_USER')
+ if sudo_user:
+ tcpdump_cmd.extend(['-Z', sudo_user])
+ tcpdump_cmd.extend(['-i', 'any', '-w', pcap_tmp])
+
# pylint: disable-next=consider-using-with
- p = subprocess.Popen(
- ['ip', 'netns', 'exec', net,
- '/usr/sbin/tcpdump', '-i', 'any', '-w', pcap_tmp])
+ p = subprocess.Popen(tcpdump_cmd)
tcpdump_procs.append((p, pcap_tmp, pcap, fd))
# simulate packet loss, duplication and corruption
--
2.25.1
next prev parent reply other threads:[~2026-05-04 5:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 5:41 [PATCH net-next v3 00/10] selftests: rds: Log collection, TAP compliance and cleanups Allison Henderson
2026-05-04 5:41 ` [PATCH net-next v3 01/10] selftests: rds: Increase selftest timeout Allison Henderson
2026-05-04 5:41 ` [PATCH net-next v3 02/10] selftests: rds: Update USAGE string for run.sh Allison Henderson
2026-05-04 5:41 ` [PATCH net-next v3 03/10] selftests: rds: Fix more pylint errors Allison Henderson
2026-05-04 5:41 ` [PATCH net-next v3 04/10] selftests: rds: Add timeout flag to run.sh Allison Henderson
2026-05-04 5:41 ` [PATCH net-next v3 05/10] selftests: rds: Add RDS_LOG_DIR env variable Allison Henderson
2026-05-04 5:41 ` Allison Henderson [this message]
2026-05-04 5:41 ` [PATCH net-next v3 07/10] selftests: rds: Remove tmp pcaps Allison Henderson
2026-05-04 5:41 ` [PATCH net-next v3 08/10] selftests: rds: Stop tcpdump on timeout Allison Henderson
2026-05-04 5:41 ` [PATCH net-next v3 09/10] selftests: rds: Fix gcov collection Allison Henderson
2026-05-04 5:41 ` [PATCH net-next v3 10/10] selftests: rds: Make rds selftests TAP compliant Allison Henderson
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=20260504054143.4027538-7-achender@kernel.org \
--to=achender@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@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