Re: [PATCH] bpf: Refactor check_ctx_access()

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

 



On Fri, Feb 21, 2025 at 9:57 AM Amery Hung <ameryhung@xxxxxxxxx> wrote:
>
> Reduce the variable passing madness surrounding check_ctx_access().
> Currently, check_mem_access() passes many pointers to local variables to
> check_ctx_access(). They are used to initialize "struct
> bpf_insn_access_aux info" in check_ctx_access() and then passed to
> is_valid_access(). Then, check_ctx_access() takes the data our from
> info and write them back the pointers to pass them back. This can be
> simpilified by moving info up to check_mem_access().
>
> No functional change.
>
> Signed-off-by: Amery Hung <ameryhung@xxxxxxxxx>
> ---
>  kernel/bpf/verifier.c | 56 ++++++++++++++++---------------------------
>  1 file changed, 20 insertions(+), 36 deletions(-)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 212b487fd39d..98a376bd7287 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -6006,19 +6006,10 @@ static int check_packet_access(struct bpf_verifier_env *env, u32 regno, int off,
>
>  /* check access to 'struct bpf_context' fields.  Supports fixed offsets only */
>  static int check_ctx_access(struct bpf_verifier_env *env, int insn_idx, int off, int size,
> -                           enum bpf_access_type t, enum bpf_reg_type *reg_type,
> -                           struct btf **btf, u32 *btf_id, bool *is_retval, bool is_ldsx,
> -                           u32 *ref_obj_id)
> +                           enum bpf_access_type t, struct bpf_insn_access_aux *info)

Nice cleanup! Thanks, applied.





[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