Skip to content

Commit 13d2618

Browse files
lenticularis39Paolo Abeni
authored andcommitted
bpf: sockmap: Remove preempt_disable in sock_map_sk_acquire
Disabling preemption in sock_map_sk_acquire conflicts with GFP_ATOMIC allocation later in sk_psock_init_link on PREEMPT_RT kernels, since GFP_ATOMIC might sleep on RT (see bpf: Make BPF and PREEMPT_RT co-exist patchset notes for details). This causes calling bpf_map_update_elem on BPF_MAP_TYPE_SOCKMAP maps to BUG (sleeping function called from invalid context) on RT kernels. preempt_disable was introduced together with lock_sk and rcu_read_lock in commit 99ba2b5 ("bpf: sockhash, disallow bpf_tcp_close and update in parallel"), probably to match disabled migration of BPF programs, and is no longer necessary. Remove preempt_disable to fix BUG in sock_map_update_common on RT. Signed-off-by: Tomas Glozar <[email protected]> Reviewed-by: Jakub Sitnicki <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Fixes: 99ba2b5 ("bpf: sockhash, disallow bpf_tcp_close and update in parallel") Reviewed-by: John Fastabend <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent c5ccff7 commit 13d2618

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

net/core/sock_map.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,13 @@ static void sock_map_sk_acquire(struct sock *sk)
115115
__acquires(&sk->sk_lock.slock)
116116
{
117117
lock_sock(sk);
118-
preempt_disable();
119118
rcu_read_lock();
120119
}
121120

122121
static void sock_map_sk_release(struct sock *sk)
123122
__releases(&sk->sk_lock.slock)
124123
{
125124
rcu_read_unlock();
126-
preempt_enable();
127125
release_sock(sk);
128126
}
129127

0 commit comments

Comments
 (0)