<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/netfilter, branch v6.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.0</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2022-09-20T21:50:03Z</updated>
<entry>
<title>netfilter: nf_ct_ftp: fix deadlock when nat rewrite is needed</title>
<updated>2022-09-20T21:50:03Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2022-09-20T16:31:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d25088932227680988a6b794221e031a7232f137'/>
<id>urn:sha1:d25088932227680988a6b794221e031a7232f137</id>
<content type='text'>
We can't use ct-&gt;lock, this is already used by the seqadj internals.
When using ftp helper + nat, seqadj will attempt to acquire ct-&gt;lock
again.

Revert back to a global lock for now.

Fixes: c783a29c7e59 ("netfilter: nf_ct_ftp: prefer skb_linearize")
Reported-by: Bruno de Paula Larini &lt;bruno.larini@riosoft.com.br&gt;
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_tables: fix percpu memory leak at nf_tables_addchain()</title>
<updated>2022-09-20T21:50:03Z</updated>
<author>
<name>Tetsuo Handa</name>
<email>penguin-kernel@I-love.SAKURA.ne.jp</email>
</author>
<published>2022-09-12T13:58:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9a4d6dd554b86e65581ef6b6638a39ae079b17ac'/>
<id>urn:sha1:9a4d6dd554b86e65581ef6b6638a39ae079b17ac</id>
<content type='text'>
It seems to me that percpu memory for chain stats started leaking since
commit 3bc158f8d0330f0a ("netfilter: nf_tables: map basechain priority to
hardware priority") when nft_chain_offload_priority() returned an error.

Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Fixes: 3bc158f8d0330f0a ("netfilter: nf_tables: map basechain priority to hardware priority")
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_tables: fix nft_counters_enabled underflow at nf_tables_addchain()</title>
<updated>2022-09-20T21:50:03Z</updated>
<author>
<name>Tetsuo Handa</name>
<email>penguin-kernel@I-love.SAKURA.ne.jp</email>
</author>
<published>2022-09-12T12:41:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=921ebde3c0d22c8cba74ce8eb3cc4626abff1ccd'/>
<id>urn:sha1:921ebde3c0d22c8cba74ce8eb3cc4626abff1ccd</id>
<content type='text'>
syzbot is reporting underflow of nft_counters_enabled counter at
nf_tables_addchain() [1], for commit 43eb8949cfdffa76 ("netfilter:
nf_tables: do not leave chain stats enabled on error") missed that
nf_tables_chain_destroy() after nft_basechain_init() in the error path of
nf_tables_addchain() decrements the counter because nft_basechain_init()
makes nft_is_base_chain() return true by setting NFT_CHAIN_BASE flag.

Increment the counter immediately after returning from
nft_basechain_init().

Link:  https://syzkaller.appspot.com/bug?extid=b5d82a651b71cd8a75ab [1]
Reported-by: syzbot &lt;syzbot+b5d82a651b71cd8a75ab@syzkaller.appspotmail.com&gt;
Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Tested-by: syzbot &lt;syzbot+b5d82a651b71cd8a75ab@syzkaller.appspotmail.com&gt;
Fixes: 43eb8949cfdffa76 ("netfilter: nf_tables: do not leave chain stats enabled on error")
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
</content>
</entry>
<entry>
<title>netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find()</title>
<updated>2022-09-07T13:55:28Z</updated>
<author>
<name>Pablo Neira Ayuso</name>
<email>pablo@netfilter.org</email>
</author>
<published>2022-09-07T08:26:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=559c36c5a8d730c49ef805a72b213d3bba155cc8'/>
<id>urn:sha1:559c36c5a8d730c49ef805a72b213d3bba155cc8</id>
<content type='text'>
nf_osf_find() incorrectly returns true on mismatch, this leads to
copying uninitialized memory area in nft_osf which can be used to leak
stale kernel stack data to userspace.

Fixes: 22c7652cdaa8 ("netfilter: nft_osf: Add version option support")
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_conntrack_irc: Tighten matching on DCC message</title>
<updated>2022-09-07T13:55:23Z</updated>
<author>
<name>David Leadbeater</name>
<email>dgl@dgl.cx</email>
</author>
<published>2022-08-26T04:56:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e8d5dfd1d8747b56077d02664a8838c71ced948e'/>
<id>urn:sha1:e8d5dfd1d8747b56077d02664a8838c71ced948e</id>
<content type='text'>
CTCP messages should only be at the start of an IRC message, not
anywhere within it.

While the helper only decodes packes in the ORIGINAL direction, its
possible to make a client send a CTCP message back by empedding one into
a PING request.  As-is, thats enough to make the helper believe that it
saw a CTCP message.

Fixes: 869f37d8e48f ("[NETFILTER]: nf_conntrack/nf_nat: add IRC helper port")
Signed-off-by: David Leadbeater &lt;dgl@dgl.cx&gt;
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_conntrack_sip: fix ct_sip_walk_headers</title>
<updated>2022-09-07T13:06:26Z</updated>
<author>
<name>Igor Ryzhov</name>
<email>iryzhov@nfware.com</email>
</author>
<published>2019-06-05T09:32:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=39aebedeaaa95757f5c1f2ddb5f43fdddbf478ca'/>
<id>urn:sha1:39aebedeaaa95757f5c1f2ddb5f43fdddbf478ca</id>
<content type='text'>
ct_sip_next_header and ct_sip_get_header return an absolute
value of matchoff, not a shift from current dataoff.
So dataoff should be assigned matchoff, not incremented by it.

This issue can be seen in the scenario when there are multiple
Contact headers and the first one is using a hostname and other headers
use IP addresses. In this case, ct_sip_walk_headers will work as follows:

The first ct_sip_get_header call to will find the first Contact header
but will return -1 as the header uses a hostname. But matchoff will
be changed to the offset of this header. After that, dataoff should be
set to matchoff, so that the next ct_sip_get_header call find the next
Contact header. But instead of assigning dataoff to matchoff, it is
incremented by it, which is not correct, as matchoff is an absolute
value of the offset. So on the next call to the ct_sip_get_header,
dataoff will be incorrect, and the next Contact header may not be
found at all.

Fixes: 05e3ced297fe ("[NETFILTER]: nf_conntrack_sip: introduce SIP-URI parsing helper")
Signed-off-by: Igor Ryzhov &lt;iryzhov@nfware.com&gt;
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_conntrack_irc: Fix forged IP logic</title>
<updated>2022-09-01T00:01:56Z</updated>
<author>
<name>David Leadbeater</name>
<email>dgl@dgl.cx</email>
</author>
<published>2022-08-26T04:56:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0efe125cfb99e6773a7434f3463f7c2fa28f3a43'/>
<id>urn:sha1:0efe125cfb99e6773a7434f3463f7c2fa28f3a43</id>
<content type='text'>
Ensure the match happens in the right direction, previously the
destination used was the server, not the NAT host, as the comment
shows the code intended.

Additionally nf_nat_irc uses port 0 as a signal and there's no valid way
it can appear in a DCC message, so consider port 0 also forged.

Fixes: 869f37d8e48f ("[NETFILTER]: nf_conntrack/nf_nat: add IRC helper port")
Signed-off-by: David Leadbeater &lt;dgl@dgl.cx&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_tables: clean up hook list when offload flags check fails</title>
<updated>2022-08-31T11:30:31Z</updated>
<author>
<name>Pablo Neira Ayuso</name>
<email>pablo@netfilter.org</email>
</author>
<published>2022-08-31T11:11:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=77972a36ecc4db7fc7c68f0e80714263c5f03f65'/>
<id>urn:sha1:77972a36ecc4db7fc7c68f0e80714263c5f03f65</id>
<content type='text'>
splice back the hook list so nft_chain_release_hook() has a chance to
release the hooks.

BUG: memory leak
unreferenced object 0xffff88810180b100 (size 96):
  comm "syz-executor133", pid 3619, jiffies 4294945714 (age 12.690s)
  hex dump (first 32 bytes):
    28 64 23 02 81 88 ff ff 28 64 23 02 81 88 ff ff  (d#.....(d#.....
    90 a8 aa 83 ff ff ff ff 00 00 b5 0f 81 88 ff ff  ................
  backtrace:
    [&lt;ffffffff83a8c59b&gt;] kmalloc include/linux/slab.h:600 [inline]
    [&lt;ffffffff83a8c59b&gt;] nft_netdev_hook_alloc+0x3b/0xc0 net/netfilter/nf_tables_api.c:1901
    [&lt;ffffffff83a9239a&gt;] nft_chain_parse_netdev net/netfilter/nf_tables_api.c:1998 [inline]
    [&lt;ffffffff83a9239a&gt;] nft_chain_parse_hook+0x33a/0x530 net/netfilter/nf_tables_api.c:2073
    [&lt;ffffffff83a9b14b&gt;] nf_tables_addchain.constprop.0+0x10b/0x950 net/netfilter/nf_tables_api.c:2218
    [&lt;ffffffff83a9c41b&gt;] nf_tables_newchain+0xa8b/0xc60 net/netfilter/nf_tables_api.c:2593
    [&lt;ffffffff83a3d6a6&gt;] nfnetlink_rcv_batch+0xa46/0xd20 net/netfilter/nfnetlink.c:517
    [&lt;ffffffff83a3db79&gt;] nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:638 [inline]
    [&lt;ffffffff83a3db79&gt;] nfnetlink_rcv+0x1f9/0x220 net/netfilter/nfnetlink.c:656
    [&lt;ffffffff83a13b17&gt;] netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
    [&lt;ffffffff83a13b17&gt;] netlink_unicast+0x397/0x4c0 net/netlink/af_netlink.c:1345
    [&lt;ffffffff83a13fd6&gt;] netlink_sendmsg+0x396/0x710 net/netlink/af_netlink.c:1921
    [&lt;ffffffff83865ab6&gt;] sock_sendmsg_nosec net/socket.c:714 [inline]
    [&lt;ffffffff83865ab6&gt;] sock_sendmsg+0x56/0x80 net/socket.c:734
    [&lt;ffffffff8386601c&gt;] ____sys_sendmsg+0x36c/0x390 net/socket.c:2482
    [&lt;ffffffff8386a918&gt;] ___sys_sendmsg+0xa8/0x110 net/socket.c:2536
    [&lt;ffffffff8386aaa8&gt;] __sys_sendmsg+0x88/0x100 net/socket.c:2565
    [&lt;ffffffff845e5955&gt;] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [&lt;ffffffff845e5955&gt;] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
    [&lt;ffffffff84800087&gt;] entry_SYSCALL_64_after_hwframe+0x63/0xcd

Fixes: d54725cd11a5 ("netfilter: nf_tables: support for multiple devices per netdev hook")
Reported-by: syzbot+5fcdbfab6d6744c57418@syzkaller.appspotmail.com
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: remove nf_conntrack_helper sysctl and modparam toggles</title>
<updated>2022-08-31T10:12:32Z</updated>
<author>
<name>Pablo Neira Ayuso</name>
<email>pablo@netfilter.org</email>
</author>
<published>2022-08-26T06:49:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b118509076b39cc5e616c0680312b5caaca535fe'/>
<id>urn:sha1:b118509076b39cc5e616c0680312b5caaca535fe</id>
<content type='text'>
__nf_ct_try_assign_helper() remains in place but it now requires a
template to configure the helper.

A toggle to disable automatic helper assignment was added by:

  a9006892643a ("netfilter: nf_ct_helper: allow to disable automatic helper assignment")

in 2012 to address the issues described in "Secure use of iptables and
connection tracking helpers". Automatic conntrack helper assignment was
disabled by:

  3bb398d925ec ("netfilter: nf_ct_helper: disable automatic helper assignment")

back in 2016.

This patch removes the sysctl and modparam toggles, users now have to
rely on explicit conntrack helper configuration via ruleset.

Update tools/testing/selftests/netfilter/nft_conntrack_helper.sh to
check that auto-assignment does not happen anymore.

Acked-by: Aaron Conole &lt;aconole@redhat.com&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf</title>
<updated>2022-08-25T02:18:10Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2022-08-25T02:18:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=24c7a64ea4764d70e4ac9b0a60ecd9b03c68435e'/>
<id>urn:sha1:24c7a64ea4764d70e4ac9b0a60ecd9b03c68435e</id>
<content type='text'>
Pablo Neira Ayuso says:

====================
Netfilter fixes for net

1) Fix crash with malformed ebtables blob which do not provide all
   entry points, from Florian Westphal.

2) Fix possible TCP connection clogging up with default 5-days
   timeout in conntrack, from Florian.

3) Fix crash in nf_tables tproxy with unsupported chains, also from Florian.

4) Do not allow to update implicit chains.

5) Make table handle allocation per-netns to fix data race.

6) Do not truncated payload length and offset, and checksum offset.
   Instead report EINVAl.

7) Enable chain stats update via static key iff no error occurs.

8) Restrict osf expression to ip, ip6 and inet families.

9) Restrict tunnel expression to netdev family.

10) Fix crash when trying to bind again an already bound chain.

11) Flowtable garbage collector might leave behind pending work to
    delete entries. This patch comes with a previous preparation patch
    as dependency.

12) Allow net.netfilter.nf_conntrack_frag6_high_thresh to be lowered,
    from Eric Dumazet.

* git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
  netfilter: nf_defrag_ipv6: allow nf_conntrack_frag6_high_thresh increases
  netfilter: flowtable: fix stuck flows on cleanup due to pending work
  netfilter: flowtable: add function to invoke garbage collection immediately
  netfilter: nf_tables: disallow binding to already bound chain
  netfilter: nft_tunnel: restrict it to netdev family
  netfilter: nft_osf: restrict osf to ipv4, ipv6 and inet families
  netfilter: nf_tables: do not leave chain stats enabled on error
  netfilter: nft_payload: do not truncate csum_offset and csum_type
  netfilter: nft_payload: report ERANGE for too long offset and length
  netfilter: nf_tables: make table handle allocation per-netns friendly
  netfilter: nf_tables: disallow updates of implicit chain
  netfilter: nft_tproxy: restrict to prerouting hook
  netfilter: conntrack: work around exceeded receive window
  netfilter: ebtables: reject blobs that don't provide all entry points
====================

Link: https://lore.kernel.org/r/20220824220330.64283-1-pablo@netfilter.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
</feed>
