proc: test lseek on /proc/net/dev
Subsystems (3)
PATCH 1/1 proc: test lseek on /proc/net/dev
From 0991340050b201c6fcbe623b9869ef3a96c133c9 Mon Sep 17 00:00:00 2001
From: Alexey Dobriyan <[email protected]>
Date: Tue, 19 Aug 2025 21:19:17 +0300
Subject: [PATCH 1/1] proc: test lseek on /proc/net/dev
This line in tools/testing/selftests/proc/read.c was added to catch oopses, not to verify lseek correctness:
(void)lseek(fd, 0, SEEK_SET);
Oh, well. Prevent more embarassement with simple test.
--- tools/testing/selftests/proc/.gitignore | 1 + tools/testing/selftests/proc/Makefile | 1 + .../selftests/proc/proc-net-dev-lseek.c | 68 +++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 tools/testing/selftests/proc/proc-net-dev-lseek.c
tools/testing/selftests/proc/.gitignore +1 -0
@@ -7,6 +7,7 @@ /proc-loadavg-001 /proc-maps-race /proc-multiple-procfs +/proc-net-dev-lseek /proc-empty-vm /proc-pid-vm /proc-self-map-files-001
tools/testing/selftests/proc/Makefile +1 -0
@@ -10,6 +10,7 @@ TEST_GEN_PROGS += fd-003-kthread TEST_GEN_PROGS += proc-2-is-kthread TEST_GEN_PROGS += proc-loadavg-001 TEST_GEN_PROGS += proc-maps-race +TEST_GEN_PROGS += proc-net-dev-lseek TEST_GEN_PROGS += proc-empty-vm TEST_GEN_PROGS += proc-pid-vm TEST_GEN_PROGS += proc-self-map-files-001
tools/testing/selftests/proc/proc-net-dev-lseek.c new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
2.49.1
Quoted 4 lines · On Tue, 19 Aug 2025 21:29:16 +0300 Alexey Dobriyan <[email protected]> wrote:
This line in
tools/testing/selftests/proc/read.cwas added to catch oopses, not to verify lseek correctness:(void)lseek(fd, 0, SEEK_SET);
Can you expand on this? Was some issue discovered with /proc/net/dev? If so, what was it?
Quoted 1 line
Oh, well. Prevent more embarassement with simple test.
Quoted 9 lines · Andrew Morton
Quoted 4 lines · On Tue, 19 Aug 2025 21:29:16 +0300 Alexey Dobriyan <[email protected]> wrote:
This line in
tools/testing/selftests/proc/read.cwas added to catch oopses, not to verify lseek correctness:(void)lseek(fd, 0, SEEK_SET);Can you expand on this? Was some issue discovered with
/proc/net/dev? If so, what was it?
Retroactively it would prevented the bug:
assert(lseek(fd, 0, SEEK_SET) == 0);
But I didn't want to compile the list of exceptions and maintain it.
Quoted 1 line
Quoted 1 line
Oh, well. Prevent more embarassement with simple test.