[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250610091933.717824-1-jmarchan@redhat.com>
Date: Tue, 10 Jun 2025 11:19:31 +0200
From: "Jerome Marchand" <jmarchan@...hat.com>
To: bpf@...r.kernel.org
Cc: Martin KaFai Lau <martin.lau@...ux.dev>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
linux-kernel@...r.kernel.org,
Yonghong Song <yonghong.song@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>,
Jerome Marchand <jmarchan@...hat.com>
Subject: [PATCH v2 0/2] bpf: Specify access type of bpf_sysctl_get_name args
The second argument of bpf_sysctl_get_name() helper is a pointer to a
buffer that is being written to. However that isn't specify in the
prototype. Until commit 37cce22dbd51a ("bpf: verifier: Refactor helper
access type tracking") that mistake was hidden by the way the verifier
treated helper accesses. Since then, the verifier, working on wrong
infromation from the prototype, can make faulty optimization that
would had been caught by the test_sysctl selftests if it was run by
the CI.
The first patch fixes bpf_sysctl_get_name prototype.
The second patch converts the test_sysctl to prog_tests so that it
will be run by the CI and catch similar issues in the future.
Changes in v2:
- Replace ARG_PTR_TO_UNINIT_MEM by ARG_PTR_TO_MEM | MEM_WRITE.
- Converts test_sysctl to prog_tests.
Jerome Marchand (2):
bpf: Specify access type of bpf_sysctl_get_name args
selftests/bpf: Convert test_sysctl to prog_tests
kernel/bpf/cgroup.c | 2 +-
tools/testing/selftests/bpf/.gitignore | 1 -
tools/testing/selftests/bpf/Makefile | 5 ++-
.../bpf/{ => prog_tests}/test_sysctl.c | 32 ++++---------------
4 files changed, 10 insertions(+), 30 deletions(-)
rename tools/testing/selftests/bpf/{ => prog_tests}/test_sysctl.c (98%)
--
2.49.0
Powered by blists - more mailing lists