<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/netfilter/nf_queue.c, branch v4.3</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=v4.3</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2015-07-23T14:17:58Z</updated>
<entry>
<title>netfilter: nf_queue: fix nf_queue_nf_hook_drop()</title>
<updated>2015-07-23T14:17:58Z</updated>
<author>
<name>Pablo Neira Ayuso</name>
<email>pablo@netfilter.org</email>
</author>
<published>2015-07-20T10:55:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2385eb0c5fbcb4316d3490b3affba8e15efc7eb8'/>
<id>urn:sha1:2385eb0c5fbcb4316d3490b3affba8e15efc7eb8</id>
<content type='text'>
This function reacquires the rtnl_lock() which is already held by
nf_unregister_hook().

This can be triggered via: modprobe nf_conntrack_ipv4 &amp;&amp; rmmod nf_conntrack_ipv4

[  720.628746] INFO: task rmmod:3578 blocked for more than 120 seconds.
[  720.628749]       Not tainted 4.2.0-rc2+ #113
[  720.628752] "echo 0 &gt; /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  720.628754] rmmod           D ffff8800ca46fd58     0  3578   3571 0x00000080
[...]
[  720.628783] Call Trace:
[  720.628790]  [&lt;ffffffff8152ea0b&gt;] schedule+0x6b/0x90
[  720.628795]  [&lt;ffffffff8152ecb3&gt;] schedule_preempt_disabled+0x13/0x20
[  720.628799]  [&lt;ffffffff8152ff55&gt;] mutex_lock_nested+0x1f5/0x380
[  720.628803]  [&lt;ffffffff81462622&gt;] ? rtnl_lock+0x12/0x20
[  720.628807]  [&lt;ffffffff81462622&gt;] ? rtnl_lock+0x12/0x20
[  720.628812]  [&lt;ffffffff81462622&gt;] rtnl_lock+0x12/0x20
[  720.628817]  [&lt;ffffffff8148ab25&gt;] nf_queue_nf_hook_drop+0x15/0x160
[  720.628825]  [&lt;ffffffff81488d48&gt;] nf_unregister_net_hook+0x168/0x190
[  720.628831]  [&lt;ffffffff81488e24&gt;] nf_unregister_hook+0x64/0x80
[  720.628837]  [&lt;ffffffff81488e60&gt;] nf_unregister_hooks+0x20/0x30
[...]

Moreover, nf_unregister_net_hook() should only destroy the queue for this
netns, not for every netns.

Reported-by: Fengguang Wu &lt;fengguang.wu@intel.com&gt;
Fixes: 085db2c04557 ("netfilter: Per network namespace netfilter hooks.")
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
Acked-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_queue: Don't recompute the hook_list head</title>
<updated>2015-07-02T13:03:13Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2015-06-19T22:23:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f307170d6e591a48529425b1ed6ca835790995a9'/>
<id>urn:sha1:f307170d6e591a48529425b1ed6ca835790995a9</id>
<content type='text'>
If someone sends packets from one of the netdevice ingress hooks to
the a userspace queue, and then userspace later accepts the packet,
the netfilter code can enter an infinite loop as the list head will
never be found.

Pass in the saved list_head to avoid this.

Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: nf_qeueue: Drop queue entries on nf_unregister_hook</title>
<updated>2015-06-23T13:23:23Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2015-06-19T19:03:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8405a8fff3f8545c888a872d6e3c0c8eecd4d348'/>
<id>urn:sha1:8405a8fff3f8545c888a872d6e3c0c8eecd4d348</id>
<content type='text'>
Add code to nf_unregister_hook to flush the nf_queue when a hook is
unregistered.  This guarantees that the pointer that the nf_queue code
retains into the nf_hook list will remain valid while a packet is
queued.

I tested what would happen if we do not flush queued packets and was
trivially able to obtain the oops below.  All that was required was
to stop the nf_queue listening process, to delete all of the nf_tables,
and to awaken the nf_queue listening process.

&gt; BUG: unable to handle kernel paging request at 0000000100000001
&gt; IP: [&lt;0000000100000001&gt;] 0x100000001
&gt; PGD b9c35067 PUD 0
&gt; Oops: 0010 [#1] SMP
&gt; Modules linked in:
&gt; CPU: 0 PID: 519 Comm: lt-nfqnl_test Not tainted
&gt; task: ffff8800b9c8c050 ti: ffff8800ba9d8000 task.ti: ffff8800ba9d8000
&gt; RIP: 0010:[&lt;0000000100000001&gt;]  [&lt;0000000100000001&gt;] 0x100000001
&gt; RSP: 0018:ffff8800ba9dba40  EFLAGS: 00010a16
&gt; RAX: ffff8800bab48a00 RBX: ffff8800ba9dba90 RCX: ffff8800ba9dba90
&gt; RDX: ffff8800b9c10128 RSI: ffff8800ba940900 RDI: ffff8800bab48a00
&gt; RBP: ffff8800b9c10128 R08: ffffffff82976660 R09: ffff8800ba9dbb28
&gt; R10: dead000000100100 R11: dead000000200200 R12: ffff8800ba940900
&gt; R13: ffffffff8313fd50 R14: ffff8800b9c95200 R15: 0000000000000000
&gt; FS:  00007fb91fc34700(0000) GS:ffff8800bfa00000(0000) knlGS:0000000000000000
&gt; CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
&gt; CR2: 0000000100000001 CR3: 00000000babfb000 CR4: 00000000000007f0
&gt; Stack:
&gt;  ffffffff8206ab0f ffffffff82982240 ffff8800bab48a00 ffff8800b9c100a8
&gt;  ffff8800b9c10100 0000000000000001 ffff8800ba940900 ffff8800b9c10128
&gt;  ffffffff8206bd65 ffff8800bfb0d5e0 ffff8800bab48a00 0000000000014dc0
&gt; Call Trace:
&gt;  [&lt;ffffffff8206ab0f&gt;] ? nf_iterate+0x4f/0xa0
&gt;  [&lt;ffffffff8206bd65&gt;] ? nf_reinject+0x125/0x190
&gt;  [&lt;ffffffff8206dee5&gt;] ? nfqnl_recv_verdict+0x255/0x360
&gt;  [&lt;ffffffff81386290&gt;] ? nla_parse+0x80/0xf0
&gt;  [&lt;ffffffff8206c42c&gt;] ? nfnetlink_rcv_msg+0x13c/0x240
&gt;  [&lt;ffffffff811b2fec&gt;] ? __memcg_kmem_get_cache+0x4c/0x150
&gt;  [&lt;ffffffff8206c2f0&gt;] ? nfnl_lock+0x20/0x20
&gt;  [&lt;ffffffff82068159&gt;] ? netlink_rcv_skb+0xa9/0xc0
&gt;  [&lt;ffffffff820677bf&gt;] ? netlink_unicast+0x12f/0x1c0
&gt;  [&lt;ffffffff82067ade&gt;] ? netlink_sendmsg+0x28e/0x650
&gt;  [&lt;ffffffff81fdd814&gt;] ? sock_sendmsg+0x44/0x50
&gt;  [&lt;ffffffff81fde07b&gt;] ? ___sys_sendmsg+0x2ab/0x2c0
&gt;  [&lt;ffffffff810e8f73&gt;] ? __wake_up+0x43/0x70
&gt;  [&lt;ffffffff8141a134&gt;] ? tty_write+0x1c4/0x2a0
&gt;  [&lt;ffffffff81fde9f4&gt;] ? __sys_sendmsg+0x44/0x80
&gt;  [&lt;ffffffff823ff8d7&gt;] ? system_call_fastpath+0x12/0x6a
&gt; Code:  Bad RIP value.
&gt; RIP  [&lt;0000000100000001&gt;] 0x100000001
&gt;  RSP &lt;ffff8800ba9dba40&gt;
&gt; CR2: 0000000100000001
&gt; ---[ end trace 08eb65d42362793f ]---

Cc: stable@vger.kernel.org
Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next</title>
<updated>2015-04-08T16:30:21Z</updated>
<author>
<name>Pablo Neira Ayuso</name>
<email>pablo@netfilter.org</email>
</author>
<published>2015-04-08T15:40:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=aadd51aa71f8d013c818a312bb2a0c5714830dbc'/>
<id>urn:sha1:aadd51aa71f8d013c818a312bb2a0c5714830dbc</id>
<content type='text'>
Resolve conflicts between 5888b93 ("Merge branch 'nf-hook-compress'") and
Florian Westphal br_netfilter works.

Conflicts:
        net/bridge/br_netfilter.c

Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: bridge: add helpers for fetching physin/outdev</title>
<updated>2015-04-08T14:49:08Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2015-04-02T12:31:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c737b7c4510026c200e14de51eb0006adea0fb2f'/>
<id>urn:sha1:c737b7c4510026c200e14de51eb0006adea0fb2f</id>
<content type='text'>
right now we store this in the nf_bridge_info struct, accessible
via skb-&gt;nf_bridge.  This patch prepares removal of this pointer from skb:

Instead of using skb-&gt;nf_bridge-&gt;x, we use helpers to obtain the in/out
device (or ifindexes).

Followup patches to netfilter will then allow nf_bridge_info to be
obtained by a call into the br_netfilter core, rather than keeping a
pointer to it in sk_buff.

Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
<entry>
<title>netfilter: Pass socket pointer down through okfn().</title>
<updated>2015-04-07T19:25:55Z</updated>
<author>
<name>David Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-04-06T02:19:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7026b1ddb6b8d4e6ee33dc2bd06c0ca8746fa7ab'/>
<id>urn:sha1:7026b1ddb6b8d4e6ee33dc2bd06c0ca8746fa7ab</id>
<content type='text'>
On the output paths in particular, we have to sometimes deal with two
socket contexts.  First, and usually skb-&gt;sk, is the local socket that
generated the frame.

And second, is potentially the socket used to control a tunneling
socket, such as one the encapsulates using UDP.

We do not want to disassociate skb-&gt;sk when encapsulating in order
to fix this, because that would break socket memory accounting.

The most extreme case where this can cause huge problems is an
AF_PACKET socket transmitting over a vxlan device.  We hit code
paths doing checks that assume they are dealing with an ipv4
socket, but are actually operating upon the AF_PACKET one.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netfilter: Add socket pointer to nf_hook_state.</title>
<updated>2015-04-07T19:25:55Z</updated>
<author>
<name>David Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-04-06T02:19:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1c984f8a5df085bcf35364a8a870bd4db4da4ed3'/>
<id>urn:sha1:1c984f8a5df085bcf35364a8a870bd4db4da4ed3</id>
<content type='text'>
It is currently always set to NULL, but nf_queue is adjusted to be
prepared for it being set to a real socket by taking and releasing a
reference to that socket when necessary.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netfilter: Use nf_hook_state in nf_queue_entry.</title>
<updated>2015-04-04T16:25:22Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-04-03T20:31:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1d1de89b9a4746f1dd055a3b8d073dd2f962a3b6'/>
<id>urn:sha1:1d1de89b9a4746f1dd055a3b8d073dd2f962a3b6</id>
<content type='text'>
That way we don't have to reinstantiate another nf_hook_state
on the stack of the nf_reinject() path.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netfilter: Create and use nf_hook_state.</title>
<updated>2015-04-04T16:17:40Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-04-03T20:23:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cfdfab314647b1755afedc33ab66f3f247e161ae'/>
<id>urn:sha1:cfdfab314647b1755afedc33ab66f3f247e161ae</id>
<content type='text'>
Instead of passing a large number of arguments down into the nf_hook()
entry points, create a structure which carries this state down through
the hook processing layers.

This makes is so that if we want to change the types or signatures of
any of these pieces of state, there are less places that need to be
changed.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netfilter: use IS_ENABLED(CONFIG_BRIDGE_NETFILTER)</title>
<updated>2014-10-02T16:30:54Z</updated>
<author>
<name>Pablo Neira Ayuso</name>
<email>pablo@netfilter.org</email>
</author>
<published>2014-10-01T09:19:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1109a90c01177e8f4a5fd95c5b685ad02f1fe9bb'/>
<id>urn:sha1:1109a90c01177e8f4a5fd95c5b685ad02f1fe9bb</id>
<content type='text'>
In 34666d4 ("netfilter: bridge: move br_netfilter out of the core"),
the bridge netfilter code has been modularized.

Use IS_ENABLED instead of ifdef to cover the module case.

Fixes: 34666d4 ("netfilter: bridge: move br_netfilter out of the core")
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
</content>
</entry>
</feed>
