Patch "bpf: sockmap: Remove preempt_disable in sock_map_sk_acquire" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    bpf: sockmap: Remove preempt_disable in sock_map_sk_acquire

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bpf-sockmap-remove-preempt_disable-in-sock_map_sk_ac.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a645d88fa9de1bfe63729527e48559436ee01df2
Author: Tomas Glozar <tglozar@xxxxxxxxxx>
Date:   Fri Jul 28 08:44:11 2023 +0200

    bpf: sockmap: Remove preempt_disable in sock_map_sk_acquire
    
    [ Upstream commit 13d2618b48f15966d1adfe1ff6a1985f5eef40ba ]
    
    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 99ba2b5aba24e ("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 <tglozar@xxxxxxxxxx>
    Reviewed-by: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/all/20200224140131.461979697@xxxxxxxxxxxxx/
    Fixes: 99ba2b5aba24 ("bpf: sockhash, disallow bpf_tcp_close and update in parallel")
    Reviewed-by: John Fastabend <john.fastabend@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230728064411.305576-1-tglozar@xxxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index 5bce6d4d20573..5b82ff0e2680f 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -115,7 +115,6 @@ static void sock_map_sk_acquire(struct sock *sk)
 	__acquires(&sk->sk_lock.slock)
 {
 	lock_sock(sk);
-	preempt_disable();
 	rcu_read_lock();
 }
 
@@ -123,7 +122,6 @@ static void sock_map_sk_release(struct sock *sk)
 	__releases(&sk->sk_lock.slock)
 {
 	rcu_read_unlock();
-	preempt_enable();
 	release_sock(sk);
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux