Re: A potential deadlock in sockhash map

From: Cong Wang
Date: Sun Mar 12 2023 - 15:32:28 EST


On Mon, Feb 20, 2023 at 07:39:59AM -0600, Hsin-Wei Hung wrote:
> DEFINE_BPF_MAP(map_0, BPF_MAP_TYPE_SOCKHASH, 0, uint32_t, uint32_t, 1005);
> SEC("tp/sched/sched_switch")
> int func(__u64 *ctx) {
> uint32_t v0 = 0;
> uint64_t v1 = 0;
> v1 = bpf_map_delete_elem(&map_0, &v0);
> return 0;
> }

It looks like we have to disable hardirq (instead of just softirq) in order to use
sockmap safely in interrupt context like sched/sched_switch.

Thanks.