From: sashiko-bot@kernel.org
To: "Tiezhu Yang" <yangtiezhu@loongson.cn>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH RFC bpf-next 2/3] selftests/bpf: Test inline_bpf_get_current_task() for LoongArch
Date: Tue, 28 Apr 2026 20:46:14 +0000 [thread overview]
Message-ID: <20260428204614.99120C2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260428080051.20938-3-yangtiezhu@loongson.cn>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The expected BPF JIT inline instruction for `bpf_get_current_task()` on LoongArch incorrectly expects a pointer to `struct thread_info` instead of `struct task_struct`.
- [Medium] Adding test expectations for an unmerged kernel feature will cause the test suite to fail on LoongArch, breaking CI.
--
commit e03cdf4a4a90c2aa3d904cdf264ea432cfe489b9
Author: Tiezhu Yang <yangtiezhu@loongson.cn>
selftests/bpf: Test inline_bpf_get_current_task() for LoongArch
This commit adds the expected JIT inline instruction for bpf_get_current_task()
on LoongArch to the verifier_jit_inline selftest. It defines the expected JIT
output ahead of the actual JIT implementation being merged.
> Note that this test will pass only after the JIT inline support for
> bpf_get_current_task is merged. While the JIT inlining is still in
> the pipeline, adding the changes now will not introduce any build
> regressions.
Will this cause the selftest suite to fail on LoongArch in the meantime?
Since the JIT implementation is not yet merged, the test framework will likely
fall back to emitting a standard helper call instead of the expected inline
instruction. Adding test expectations for unmerged features often results in
test suite regressions until the corresponding feature lands.
> diff --git a/tools/testing/selftests/bpf/progs/verifier_jit_inline.c b/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
> index 4ea254063646..913a1699e42b 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_jit_inline.c
> @@ -10,6 +10,8 @@ __arch_x86_64
> __jited(" addq %gs:{{.*}}, %rax")
> __arch_arm64
> __jited(" mrs x7, SP_EL0")
> +__arch_loongarch
> +__jited(" move $a5, $tp")
Does this instruction return a pointer to struct thread_info instead of
struct task_struct?
On LoongArch, it appears the kernel stack holds struct thread_info, and the
$tp register points directly to it rather than to struct task_struct. The task
pointer is the first member of struct thread_info at offset 0.
By using a move instruction, the BPF program would receive the thread_info
pointer. When the program later attempts to access fields like task->pid, it
will read out-of-bounds stack memory relative to the thread_info base.
Should this be a memory load like ld.d $a5, $tp, 0 to dereference the task
pointer instead?
> int inline_bpf_get_current_task(void)
> {
> bpf_get_current_task();
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260428080051.20938-1-yangtiezhu@loongson.cn?part=2
next prev parent reply other threads:[~2026-04-28 20:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 8:00 [PATCH RFC bpf-next 0/3] selftests/bpf: Test inline helpers for LoongArch Tiezhu Yang
2026-04-28 8:00 ` [PATCH RFC bpf-next 1/3] selftests/bpf: Add __arch_loongarch macro to limit test cases Tiezhu Yang
2026-04-28 8:00 ` [PATCH RFC bpf-next 2/3] selftests/bpf: Test inline_bpf_get_current_task() for LoongArch Tiezhu Yang
2026-04-28 20:46 ` sashiko-bot [this message]
2026-04-28 8:00 ` [PATCH RFC bpf-next 3/3] selftests/bpf: Test jited inline of bpf_get_smp_processor_id() Tiezhu Yang
2026-04-28 22:04 ` sashiko-bot
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=20260428204614.99120C2BCB3@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko@lists.linux.dev \
--cc=yangtiezhu@loongson.cn \
/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