From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: bot+bpf-ci@kernel.org, chenhuacai@kernel.org, hengqi.chen@gmail.com
Cc: loongarch@lists.linux.dev, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
daniel@iogearbox.net, martin.lau@kernel.org, eddyz87@gmail.com,
yonghong.song@linux.dev, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH v2 2/4] LoongArch: BPF: Move arena register slot below TCC context
Date: Mon, 6 Jul 2026 13:20:40 +0800 [thread overview]
Message-ID: <e36b6122-8d83-7b4a-dcff-161799c24dbf@loongson.cn> (raw)
In-Reply-To: <20c6156293d46e6515a98030194624a58d25b9ca4771a7a48d99a466edd3b9de@mail.kernel.org>
On 2026/7/6 下午12:29, bot+bpf-ci@kernel.org wrote:
>> LoongArch: BPF: Move arena register slot below TCC context
>>
>> Currently, the stack layout places the optional arena register slot above
>> the tail call counter context. When arena_vm_start is dynamically enabled,
>> it shifts the relative offset of the tcc_ptr slot within the stack frame,
>> causing hardcoded tracking macros to mismatch and potentially leading to
>> memory misalignment or corruption.
>> To fix this, move the arena register save and restore sequences below the
>> tail call counter context slots in both build_prologue() and epilogue. It
>> needs to update __build_epilogue() to insert a proper offset decrement to
>> safely skip the unneeded tcc_ptr reading block while accurately aligning
>> with the relocated arena slot at the very bottom.
>> With this patch, the tcc_ptr slot is always positioned at a fixed distance
>> directly underneath the base callee-saved registers that is independent of
>> whether the arena features are on.
>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>
> This looks like a fix for a memory misalignment or corruption bug affecting
> arena BPF programs. Should it carry a Fixes: tag?
>
> The buggy stack layout, where the arena register save/restore and the extra
> stack reservation sit above the tail call counter context, appears to have
> been introduced by:
>
> Fixes: ef54c517a937 ("LoongArch: BPF: Implement PROBE_MEM32 pseudo instructions")
OK, will add it in v3.
Thanks,
Tiezhu
next prev parent reply other threads:[~2026-07-06 5:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 3:39 [PATCH v2 0/4] Optimize BPF tailcall for LoongArch Tiezhu Yang
2026-07-06 3:39 ` [PATCH v2 1/4] LoongArch: BPF: Optimize redundant TCC loads in epilogue Tiezhu Yang
2026-07-06 3:39 ` [PATCH v2 2/4] LoongArch: BPF: Move arena register slot below TCC context Tiezhu Yang
2026-07-06 4:29 ` bot+bpf-ci
2026-07-06 5:20 ` Tiezhu Yang [this message]
2026-07-06 3:39 ` [PATCH v2 3/4] LoongArch: BPF: Refactor jump offset calculation in tail call Tiezhu Yang
2026-07-06 4:43 ` bot+bpf-ci
2026-07-06 5:31 ` Tiezhu Yang
2026-07-06 3:39 ` [PATCH v2 4/4] LoongArch: BPF: Implement branchless conditional move for TCC Tiezhu Yang
2026-07-06 4:30 ` bot+bpf-ci
2026-07-06 5:26 ` Tiezhu Yang
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=e36b6122-8d83-7b4a-dcff-161799c24dbf@loongson.cn \
--to=yangtiezhu@loongson.cn \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chenhuacai@kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=hengqi.chen@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=martin.lau@kernel.org \
--cc=yonghong.song@linux.dev \
/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