Linux Modules
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Samuel Wu" <wusamuel@google.com>
Cc: linux-modules@vger.kernel.org, bpf@vger.kernel.org,
	"Petr Pavlu" <petr.pavlu@suse.com>
Subject: Re: [PATCH bpf-next v3 7/9] selftests/proc: Add KALLSYMS_QUERY_* ioctl tests
Date: Fri, 13 Nov 2026 22:27:09 +0000	[thread overview]
Message-ID: <sashiko-outbox-213807@kernel.org> (raw)
In-Reply-To: <20261113221248.3535369-18-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 cea94aa72f17dbd75f99a6a582f1fe997f0b838e
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.

> 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..7788cb0f30f83
> --- /dev/null
> +++ b/tools/testing/selftests/proc/proc-kallsyms-query.c

[ ... ]

> +int main(void)
> +{
> +	struct {
> +		struct kallsyms_query_by_name q;
> +		__u64 extra;
> +	} qx = {};
> +	struct {
> +		struct kallsyms_query_sym s;
> +		__u64 extra;
> +	} sx = {};
> +	struct kallsyms_query_by_addr qa;
> +	struct kallsyms_query_by_name q;
> +	struct kallsyms_query_sym sym;
> +	unsigned int cnt = 0;
> +	__u64 first_pos = 0;
> +	char name[512];
> +	__u64 size;
> +	__u64 len;
> +	int err;
> +	int fd;
> +
> +	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(), and the
ASSERT_*/EXPECT_* macros) or the kselftest.h result helpers
(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, a normal run emits no KTAP
plan or result lines, and any failed check aborts the process with SIGABRT
rather than reporting which subtest failed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113221248.3535369-11-wusamuel@google.com?part=7

  reply	other threads:[~2026-11-13 22:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 22:12 [PATCH bpf-next v3 0/9] kallsyms: Add KALLSYMS_QUERY_BY_NAME and KALLSYMS_QUERY_BY_ADDR ioctls Samuel Wu
2026-11-13 22:12 ` [PATCH bpf-next v3 1/9] Documentation: ioctl-number: Add PROCFS_IOCTL_MAGIC range 0x10-0x11 Samuel Wu
2026-11-13 22:12 ` [PATCH bpf-next v3 2/9] module: Add module_kallsyms_find_name() Samuel Wu
2026-11-13 22:12 ` [PATCH bpf-next v3 3/9] kallsyms: Add KALLSYMS_QUERY_BY_NAME ioctl to /proc/kallsyms Samuel Wu
2026-11-13 22:55   ` bot+bpf-ci
2026-11-13 22:12 ` [PATCH bpf-next v3 4/9] kallsyms: Add KALLSYMS_QUERY_BY_ADDR " Samuel Wu
2026-11-13 22:12 ` [PATCH bpf-next v3 5/9] docs/procfs: Document KALLSYMS_QUERY_* ioctls on /proc/kallsyms Samuel Wu
2026-11-13 22:12 ` [PATCH bpf-next v3 6/9] tools: Copy KALLSYMS_QUERY_* definitions to linux/fs.h Samuel Wu
2026-11-13 22:12 ` [PATCH bpf-next v3 7/9] selftests/proc: Add KALLSYMS_QUERY_* ioctl tests Samuel Wu
2026-11-13 22:27   ` sashiko-bot [this message]
2026-11-13 22:12 ` [PATCH bpf-next v3 8/9] libbpf: Resolve typeless ksyms via KALLSYMS_QUERY_BY_NAME ioctl Samuel Wu
2026-11-13 22:12 ` [PATCH bpf-next v3 9/9] 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-213807@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