Re: [bpf-next v3 1/2] bpf: Offload kptr destructors that run from NMI
"Alexei Starovoitov" <[email protected]> Mon, 11 May 2026 10:18:13 -0700
| Newsgroups | dev.linux.lists.sashiko,org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
On Mon May 11, 2026 at 9:38 AM PDT, Justin Suess wrote: > [ 21.604660] Call Trace: > [ 21.604662] <TASK> > [ 21.604663] dump_stack_lvl+0x5d/0x80 > [ 21.604666] print_usage_bug.part.0+0x22b/0x2c0 > [ 21.604669] lock_acquire+0x295/0x2e0 > [ 21.604671] ? terminate_walk+0x33/0x160 > [ 21.604674] ? __call_rcu_common.constprop.0+0x309/0x730 > [ 21.604679] _raw_spin_lock+0x30/0x40 > [ 21.604680] ? __call_rcu_common.constprop.0+0x309/0x730 > [ 21.604682] __call_rcu_common.constprop.0+0x309/0x730 > [ 21.604686] bpf_obj_free_fields+0x118/0x250 > [ 21.604691] free_htab_elem+0x85/0xd0 > [ 21.604694] htab_map_delete_elem+0x168/0x230 > [ 21.604698] bpf_prog_f6a7136050cb5431_clear_task_kptrs_from_nmi+0xeb/0x144 > [ 21.604700] bpf_trace_run3+0x126/0x430 that's better. Looks like we moved bpf_obj_free_fields() into htab_mem_dtor(), but left check_and_free_fields() in free_htab_elem(). I think the fix is to remove check_and_free_fields() from ma path in free_htab_elem() and fallback to bpf_mem_alloc at map create time when map has kptrs with dtors. Even when BPF_F_NO_PREALLOC is not specified. Kumar, thoughts?