Re: [PATCH v1 bpf 1/2] bpf: Allow bpf_int_jit_compile() to set errno.

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

 



On Mon, Apr 14, 2025 at 2:22 PM Kuniyuki Iwashima <kuniyu@xxxxxxxxxx> wrote:
>
> There are some failure paths in bpf_int_jit_compile() that are not
> worth triggering a warning in __bpf_prog_ret0_warn().
>
> For example, if we fail to allocate memory in bpf_int_jit_compile(),
> we should propagate -ENOMEM to userspace instead of attaching
> __bpf_prog_ret0_warn().
>
> Let's pass &err to bpf_int_jit_compile() to propagate errno.

Is there any reason we are not just returning ERR_PTR() instead of the
approach in this patch? That seems more canonical within BPF
subsystem, if we need to return error for pointer-returning functions?

>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
> ---
>  arch/arc/net/bpf_jit_core.c      |  2 +-
>  arch/arm/net/bpf_jit_32.c        |  2 +-
>  arch/arm64/net/bpf_jit_comp.c    |  2 +-
>  arch/loongarch/net/bpf_jit.c     |  2 +-
>  arch/mips/net/bpf_jit_comp.c     |  2 +-
>  arch/parisc/net/bpf_jit_core.c   |  2 +-
>  arch/powerpc/net/bpf_jit_comp.c  |  2 +-
>  arch/riscv/net/bpf_jit_core.c    |  2 +-
>  arch/s390/net/bpf_jit_comp.c     |  2 +-
>  arch/sparc/net/bpf_jit_comp_64.c |  2 +-
>  arch/x86/net/bpf_jit_comp.c      |  2 +-
>  arch/x86/net/bpf_jit_comp32.c    |  2 +-
>  include/linux/filter.h           |  2 +-
>  kernel/bpf/core.c                |  6 ++++--
>  kernel/bpf/verifier.c            | 21 +++++++++++++++------
>  15 files changed, 32 insertions(+), 21 deletions(-)
>

[...]





[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