Re: [PATCH bpf-next v1 01/13] bpf: Support getting referenced kptr from struct_ops argument

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

 



On 12/18/24 8:57 AM, Amery Hung wrote:
At the first glance, the ref_obj_id assignment looks racy because ctx_arg_info
is shared by different bpf progs that may be verified in parallel. After another
thought, this should be fine because it should always end up having the same
ref_obj_id for the same arg-no, right? Not sure if UBSAN can understand this
without using the READ/WRITE_ONCE. but adding READ/WRITE_ONCE when using
ref_obj_id will be quite puzzling when reading the verifier code. Any better idea?

It looks like ref_obj_id cannot be reused (id always comes from
++env->id_gen), and these will be the earliest references to acquire.
So, maybe we can assume the ref_obj_id without needing to store it in
ctx_arg_info? E.g., the first __ref argument's ref_obj_id is always 1.

That seems reasonable to me. Then ctx_arg_info can stay read-only after the very first initialization during bpf_struct_ops_desc_init().




[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