Re: [PATCH v2 bpf-next 16/20] bpf: Add helper macro bpf_arena_cast()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 9 Feb 2024 at 05:07, Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> From: Alexei Starovoitov <ast@xxxxxxxxxx>
>
> Introduce helper macro bpf_arena_cast() that emits:
> rX = rX
> instruction with off = BPF_ARENA_CAST_KERN or off = BPF_ARENA_CAST_USER
> and encodes address_space into imm32.
>
> It's useful with older LLVM that doesn't emit this insn automatically.
>
> Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
> ---

Acked-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>

But could this simply be added to libbpf along with bpf_cast_user and
bpf_cast_kern? I believe since LLVM and the verifier support the new
cast instructions, they are unlikely to disappear any time soon. It
would probably also make it easier to use elsewhere (e.g. sched-ext)
without having to copy them.

I plan on doing the same eventually with assert macros too.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux