[PATCH bpf] riscv, bpf: Fix possible infinite tailcall when CONFIG_CFI_CLANG is enabled
Pu Lehui
pulehui at huaweicloud.com
Wed Oct 9 03:31:57 PDT 2024
On 2024/10/9 16:33, Björn Töpel wrote:
> Pu Lehui <pulehui at huaweicloud.com> writes:
>
>> From: Pu Lehui <pulehui at huawei.com>
>>
>> When CONFIG_CFI_CLANG is enabled, the number of prologue instructions
>> skipped by tailcall needs to include the kcfi instruction, otherwise the
>> TCC will be initialized every tailcall is called, which may result in
>> infinite tailcalls.
>>
>> Fixes: e63985ecd226 ("bpf, riscv64/cfi: Support kCFI + BPF on riscv64")
>> Signed-off-by: Pu Lehui <pulehui at huawei.com>
>
> Thanks! Did you test this with the selftest suite? Did the tailcall
> tests catch it?
Oh, I discovered it through code review.
I just tried llvm compilation but it seems that my environment cannot
compile bpf selftests. I need to find why.
But after reading the tailcalls testcase, I found that the tailcall_3
subtest can cover this scenario as it will verify the TCC value.
>
> Note to self is that I should run kCFI enabled tests for RISC-V.
>
>
> Acked-by: Björn Töpel <bjorn at kernel.org>
More information about the linux-riscv
mailing list