Re: [PATCH v2 2/4] LoongArch: BPF: Move arena register slot below TCC context

From: bot+bpf-ci

Date: Mon Jul 06 2026 - 00:30:15 EST


> 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@xxxxxxxxxxx>

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")

An independent fix for the same root cause ("LoongArch: BPF: Fix tail call
count pointer offset for arena programs") carries this same Fixes tag along
with Cc: stable, so a stable backport may be warranted here as well.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/28766636714