<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/netfilter/nf_queue.c, branch v4.5</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.5</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.5'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2015-10-16T16:22:41Z</updated>
<entry>
<title>netfilter: nf_queue: remove rcu_read_lock calls</title>
<updated>2015-10-16T16:22:41Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2015-10-13T12:33:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=81b4325eba6baae80a70d1af866278af38fb6cdd'/>
<id>urn:sha1:81b4325eba6baae80a70d1af866278af38fb6cdd</id>
<content type='text'>
All verdict handlers make use of the nfnetlink .call_rcu callback
so rcu readlock is already held.

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: make nf_queue_entry_get_refs return void</title>
<updated>2015-10-16T16:22:23Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2015-10-13T12:33:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ed78d09d59ba9764b7454e8e1ccbb0072a55b6d7'/>
<id>urn:sha1:ed78d09d59ba9764b7454e8e1ccbb0072a55b6d7</id>
<content type='text'>
We don't care if module is being unloaded anymore since hook unregister
handling will destroy queue entries using that hook.

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: remove hook owner refcounting</title>
<updated>2015-10-16T16:21:39Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2015-10-13T12:33:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2ffbceb2b08f8ca0496c54a9ebcd11d25275954e'/>
<id>urn:sha1:2ffbceb2b08f8ca0496c54a9ebcd11d25275954e</id>
<content type='text'>
since commit 8405a8fff3f8 ("netfilter: nf_qeueue: Drop queue entries on
nf_unregister_hook") all pending queued entries are discarded.

So we can simply remove all of the owner handling -- when module is
removed it also needs to unregister all its hooks.

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: nfqueue: don't use prev pointer</title>
<updated>2015-10-13T10:03:24Z</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2015-10-09T11:10:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7ceebfe46ec026b5405416b72772ac5aa9e09e84'/>
<id>urn:sha1:7ceebfe46ec026b5405416b72772ac5aa9e09e84</id>
<content type='text'>
Usage of -prev seems buggy.  While packet was out our hook cannot be
removed but we have no way to know if the previous one is still valid.

So better not use -&gt;prev at all.  Since NF_REPEAT just asks to invoke
same hook function again, just do so, and continue with nf_interate
if we get an ACCEPT verdict.

A side effect of this change is that if nf_reinject(NF_REPEAT) causes
another REPEAT we will now drop the skb instead of a kernel loop.

However, NF_REPEAT loops would be a bug so this should not happen anyway.

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: Push struct net down into nf_afinfo.reroute</title>
<updated>2015-09-29T18:21:31Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2015-09-25T20:07:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d815d90bbbc08777c0e3a36f57b97fc4a4fb3150'/>
<id>urn:sha1:d815d90bbbc08777c0e3a36f57b97fc4a4fb3150</id>
<content type='text'>
The network namespace is needed when routing a packet.
Stop making nf_afinfo.reroute guess which network namespace
is the proper namespace to route the packet in.

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: Pass net into okfn</title>
<updated>2015-09-18T00:18:37Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2015-09-16T01:04:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0c4b51f0054ce85c0ec578ab818f0631834573eb'/>
<id>urn:sha1:0c4b51f0054ce85c0ec578ab818f0631834573eb</id>
<content type='text'>
This is immediately motivated by the bridge code that chains functions that
call into netfilter.  Without passing net into the okfns the bridge code would
need to guess about the best expression for the network namespace to process
packets in.

As net is frequently one of the first things computed in continuation functions
after netfilter has done it's job passing in the desired network namespace is in
many cases a code simplification.

To support this change the function dst_output_okfn is introduced to
simplify passing dst_output as an okfn.  For the moment dst_output_okfn
just silently drops the struct net.

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>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>
</feed>
