Re: [PATCH bpf-next] bpf: Check for helper calls in check_subprogs()

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

 



On Mon, Feb 20, 2023 at 8:38 AM Ilya Leoshkevich <iii@xxxxxxxxxxxxx> wrote:
>
> The condition src_reg != BPF_PSEUDO_CALL && imm == BPF_FUNC_tail_call
> may be satisfied by a kfunc call. This would lead to unnecessarily
> setting has_tail_call. Use src_reg == 0 instead.

Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxx>

(although not sure on src_reg == 0 vs !src_reg. Alexei seems to be
favoring the latter?)


> Signed-off-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
> ---
>  kernel/bpf/verifier.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index e63af41a7e95..6d4632476c9c 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -2462,8 +2462,8 @@ static int check_subprogs(struct bpf_verifier_env *env)
>                 u8 code = insn[i].code;
>
>                 if (code == (BPF_JMP | BPF_CALL) &&
> -                   insn[i].imm == BPF_FUNC_tail_call &&
> -                   insn[i].src_reg != BPF_PSEUDO_CALL)
> +                   insn[i].src_reg == 0 &&
> +                   insn[i].imm == BPF_FUNC_tail_call)
>                         subprog[cur_subprog].has_tail_call = true;
>                 if (BPF_CLASS(code) == BPF_LD &&
>                     (BPF_MODE(code) == BPF_ABS || BPF_MODE(code) == BPF_IND))
> --
> 2.39.1
>



[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