Patch "netfilter, bpf: Adjust timeouts of non-confirmed CTs in bpf_ct_insert_entry()" has been added to the 6.1-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

    netfilter, bpf: Adjust timeouts of non-confirmed CTs in bpf_ct_insert_entry()

to the 6.1-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:
     netfilter-bpf-adjust-timeouts-of-non-confirmed-cts-i.patch
and it can be found in the queue-6.1 subdirectory.

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



commit faded7ba99e8dec27e8bdd6b141356ca8bac203a
Author: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
Date:   Wed Aug 30 03:07:43 2023 +0200

    netfilter, bpf: Adjust timeouts of non-confirmed CTs in bpf_ct_insert_entry()
    
    [ Upstream commit 837723b22a63cfbff584655b009b9d488d0e9087 ]
    
    bpf_nf testcase fails on s390x: bpf_skb_ct_lookup() cannot find the entry
    that was added by bpf_ct_insert_entry() within the same BPF function.
    
    The reason is that this entry is deleted by nf_ct_gc_expired().
    
    The CT timeout starts ticking after the CT confirmation; therefore
    nf_conn.timeout is initially set to the timeout value, and
    __nf_conntrack_confirm() sets it to the deadline value.
    
    bpf_ct_insert_entry() sets IPS_CONFIRMED_BIT, but does not adjust the
    timeout, making its value meaningless and causing false positives.
    
    Fix the problem by making bpf_ct_insert_entry() adjust the timeout,
    like __nf_conntrack_confirm().
    
    Fixes: 2cdaa3eefed8 ("netfilter: conntrack: restore IPS_CONFIRMED out of nf_conntrack_hash_check_insert()")
    Signed-off-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Cc: Florian Westphal <fw@xxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20230830011128.1415752-3-iii@xxxxxxxxxxxxx
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/netfilter/nf_conntrack_bpf.c b/net/netfilter/nf_conntrack_bpf.c
index 8639e7efd0e22..816283f0aa593 100644
--- a/net/netfilter/nf_conntrack_bpf.c
+++ b/net/netfilter/nf_conntrack_bpf.c
@@ -384,6 +384,8 @@ struct nf_conn *bpf_ct_insert_entry(struct nf_conn___init *nfct_i)
 	struct nf_conn *nfct = (struct nf_conn *)nfct_i;
 	int err;
 
+	if (!nf_ct_is_confirmed(nfct))
+		nfct->timeout += nfct_time_stamp;
 	nfct->status |= IPS_CONFIRMED;
 	err = nf_conntrack_hash_check_insert(nfct);
 	if (err < 0) {



[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