Linux Modules
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Samuel Wu" <wusamuel@google.com>
Cc: bpf@vger.kernel.org, linux-modules@vger.kernel.org,
	"Petr Pavlu" <petr.pavlu@suse.com>
Subject: Re: [PATCH bpf-next v4 08/10] selftests/proc: Add KALLSYMS_QUERY_* ioctl tests
Date: Wed, 02 Dec 2026 00:25:05 +0000	[thread overview]
Message-ID: <sashiko-outbox-244500@kernel.org> (raw)
In-Reply-To: <20261202001344.2721429-20-wusamuel@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/proc: main() bypasses kselftest reporting and harness
  helpers
--

commit 0e501d59d9ac5550f786fe64742f3fdba1808123
Author: Samuel Wu <wusamuel@google.com>

selftests/proc: Add KALLSYMS_QUERY_* ioctl tests

This commit adds a selftest for the KALLSYMS_QUERY_BY_NAME and
KALLSYMS_QUERY_BY_ADDR ioctls on /proc/kallsyms, comparing their results
against the parsed /proc/kallsyms text.

> diff --git a/tools/testing/selftests/proc/proc-kallsyms-query.c b/tools/testing/selftests/proc/proc-kallsyms-query.c
> new file mode 100644
> index 0000000000000..10c75a8ec457e
> --- /dev/null
> +++ b/tools/testing/selftests/proc/proc-kallsyms-query.c
> @@ -0,0 +1,248 @@

[ ... ]

> +int main(void)
> +{

[ ... ]

> +	fd = open("/proc/kallsyms", O_RDONLY | O_CLOEXEC);
> +	if (fd < 0)
> +		ksft_exit_skip("open(/proc/kallsyms): %s\n", strerror(errno));
> +	scan_text();
> +	if (!ref.vfs_read_found)
> +		ksft_exit_skip("vfs_read is not in /proc/kallsyms\n");
> +
> +	/* Exact name in vmlinux, with name and module buffers */
> +	sym = bufs(sizeof(name_buf), sizeof(mod_buf));
> +	q = name_q("vfs_read", "vmlinux", &sym);
> +	err = by_name(fd, &q);
> +	if (err == -ENOTTY)
> +		ksft_exit_skip("KALLSYMS_QUERY_BY_NAME is not supported\n");
> +	if (!ref.vfs_read_addr) {
> +		qa = addr_q(0, &sym);
> +		assert(err == -EPERM && by_addr(fd, &qa) == -EPERM);
> +		ksft_exit_skip("kallsyms addresses are hidden\n");
> +	}
> +	assert(!err);
> +	assert(sym.sym_addr == ref.vfs_read_addr && sym.sym_size > 0);

[ ... ]

> +	close(fd);
> +	return 0;
> +}

[Severity: Low]
Could this test use kselftest_harness.h (FIXTURE() / TEST_F() with
ASSERT_*() and EXPECT_*()) or report results through the kselftest.h
wrappers (ksft_print_header(), ksft_set_plan(), ksft_test_result_*(),
and ksft_finished()) instead of running sequential raw assert() checks
in main() and exiting with a bare return 0?  As written, passing runs
emit no KTAP header, test plan, or result lines, and failures abort with
SIGABRT instead of reporting a kselftest failure.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202001344.2721429-12-wusamuel@google.com?part=8

  reply	other threads:[~2026-12-02  0:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  0:13 [PATCH bpf-next v4 00/10] kallsyms: Add KALLSYMS_QUERY_BY_NAME and KALLSYMS_QUERY_BY_ADDR ioctls Samuel Wu
2026-12-02  0:13 ` [PATCH bpf-next v4 01/10] Documentation: ioctl-number: Add PROCFS_IOCTL_MAGIC range 0x10-0x11 Samuel Wu
2026-12-02  0:13 ` [PATCH bpf-next v4 02/10] module: Add module_kallsyms_query_name() Samuel Wu
2026-12-02  0:13 ` [PATCH bpf-next v4 03/10] bpf: Add bpf_kallsyms_query_name() Samuel Wu
2026-12-02  0:13 ` [PATCH bpf-next v4 04/10] kallsyms: Add KALLSYMS_QUERY_BY_NAME ioctl to /proc/kallsyms Samuel Wu
2026-12-02  0:13 ` [PATCH bpf-next v4 05/10] kallsyms: Add KALLSYMS_QUERY_BY_ADDR " Samuel Wu
2026-12-02  0:13 ` [PATCH bpf-next v4 06/10] docs/procfs: Document KALLSYMS_QUERY_* ioctls on /proc/kallsyms Samuel Wu
2026-12-02  0:13 ` [PATCH bpf-next v4 07/10] tools: Copy KALLSYMS_QUERY_* definitions to linux/fs.h Samuel Wu
2026-12-02  0:13 ` [PATCH bpf-next v4 08/10] selftests/proc: Add KALLSYMS_QUERY_* ioctl tests Samuel Wu
2026-12-02  0:25   ` sashiko-bot [this message]
2026-12-02  0:31     ` Samuel Wu
2026-12-02  0:13 ` [PATCH bpf-next v4 09/10] libbpf: Resolve typeless ksyms via KALLSYMS_QUERY_BY_NAME ioctl Samuel Wu
2026-12-02  0:59   ` bot+bpf-ci
2026-12-02  0:13 ` [PATCH bpf-next v4 10/10] selftests/bpf: Test typeless module ksym resolution Samuel Wu

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=sashiko-outbox-244500@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wusamuel@google.com \
    /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