No change for this in v3: https://lore.kernel.org/bpf/[email protected]/
I don't think this can happen. do_init_module() runs the MODULE_STATE_LIVE notifier chain before it drops the reference it holds during initialization: the "Drop initial reference." module_put() comes after the notifiers, under module_mutex. While the LIVE notifier runs, the refcount is therefore above MODULE_REF_BASE, and a concurrent delete_module() fails in try_stop_module() with -EWOULDBLOCK (short of a forced unload, which is unsafe for any user of the module). So the module and its kfunc sets and struct_ops stay valid for the whole of btf_apply_deferred_regs() here, without a try_module_get(). Jay
