Re: [PATCH bpf-next] bpf: Reject struct_ops registration that uses module ptr and the module btf_id is missing

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

 



On 1/2/25 10:14 PM, Eduard Zingerman wrote:
It was a bit hard for me to figure out what went wrong from the description,
could you please double-check my understanding below?
- when struct_ops program is attached,
   bpf_struct_ops_map_update_elem() scans every member of specific
   struct_ops type (e.g. struct tcp_congestion_ops) looking for fields
   with type 'struct module *';
- to find these fields BTF id of 'struct module' is used, this id does
   not exist when CONFIG_MODULES=n, bpf_struct_ops_map_update_elem()
   does not check if 'struct module' BTF id is non-zero;
- bpf_struct_ops_map_update_elem() initializes 'struct module *'
   fields using a magic value BPF_MODULE_OWNER, this initialization
   would not happen if fields are not found;

Thanks for reviewing and testing it!

Yes, the understanding is correct. These are pretty much the only two places where st_ops_ids[IDX_MODULE_ID] and BPF_MODULE_OWNER are used.





[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