[PATCH bpf-next v10 2/3] cfi: Move BPF CFI types and helpers to generic code

Sami Tolvanen samitolvanen at google.com
Fri Jul 18 15:27:19 PDT 2025


On Fri, Jul 18, 2025 at 4:40 AM Will Deacon <will at kernel.org> wrote:
>
> On Tue, Jul 15, 2025 at 10:57:36PM +0000, Sami Tolvanen wrote:
> >
> > +u32 __weak cfi_get_func_hash(void *func)
> > +{
> > +     u32 hash;
> > +
> > +     if (get_kernel_nofault(hash, func - cfi_get_offset()))
> > +             return 0;
> > +
> > +     return hash;
> > +}
>
> Do you really need the '__weak' function definition here, or could you
> use an '#ifndef cfi_get_func_hash' guard, a bit like you're doing for
> cfi_get_offset()?

Good point, it's not really necessary. I'll move this behind a guard instead.

Sami



More information about the linux-arm-kernel mailing list