> With CONFIG_DEBUG_INFO_BTF=m the vmlinux BTF is loaded on first use.  For
> that to save anything, nothing may pull it in at boot.  The verifier no
> longer does since the previous patches, but register_btf_kfunc_id_set(),
> register_btf_id_dtor_kfuncs() and register_bpf_struct_ops() for vmlinux
> run from initcalls and need the parsed BTF.
> 
> Queue them instead (btf_defer_reg()) and apply them in
> btf_parse_vmlinux(), before the BTF is published, so that no program can
> see a vmlinux BTF without its kfuncs and struct_ops, not even by id: the
> id is reserved before the queue is applied, so that nothing can fail once
> it is, and installed afterwards (btf_reserve_id(), btf_install_id()).
> Applying a struct_ops runs its ->init(), which registers the kfunc sets
> of its hook; those land back on the queue, so it is drained in a loop
> until a pass adds nothing, and only then are new registrations applied
> directly.  The dtor arrays are copied: every caller in the tree builds
> [ ... ]
> together with deferring the module BTF itself.  With =y the BTF is
> present from boot and nothing is queued.  Nothing here is reachable
> until the Kconfig symbol becomes a tristate.
> 
> Signed-off-by: Jay Wang <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=6


Reply via email to