<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/bpfilter, branch linux-4.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-11-04T13:51:55Z</updated>
<entry>
<title>net: bpfilter: use get_pid_task instead of pid_task</title>
<updated>2018-11-04T13:51:55Z</updated>
<author>
<name>Taehee Yoo</name>
</author>
<published>2018-10-16T15:35:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dc4526d3bfeb5dff90c70d60463e148cd667b453'/>
<id>urn:sha1:dc4526d3bfeb5dff90c70d60463e148cd667b453</id>
<content type='text'>
[ Upstream commit 84258438e8ce12d6888b68a1238bba9cb25307e2 ]

pid_task() dereferences rcu protected tasks array.
But there is no rcu_read_lock() in shutdown_umh() routine so that
rcu_read_lock() is needed.
get_pid_task() is wrapper function of pid_task. it holds rcu_read_lock()
then calls pid_task(). if task isn't NULL, it increases reference count
of task.

test commands:
   %modprobe bpfilter
   %modprobe -rv bpfilter

splat looks like:
[15102.030932] =============================
[15102.030957] WARNING: suspicious RCU usage
[15102.030985] 4.19.0-rc7+ #21 Not tainted
[15102.031010] -----------------------------
[15102.031038] kernel/pid.c:330 suspicious rcu_dereference_check() usage!
[15102.031063]
	       other info that might help us debug this:

[15102.031332]
	       rcu_scheduler_active = 2, debug_locks = 1
[15102.031363] 1 lock held by modprobe/1570:
[15102.031389]  #0: 00000000580ef2b0 (bpfilter_lock){+.+.}, at: stop_umh+0x13/0x52 [bpfilter]
[15102.031552]
               stack backtrace:
[15102.031583] CPU: 1 PID: 1570 Comm: modprobe Not tainted 4.19.0-rc7+ #21
[15102.031607] Hardware name: To be filled by O.E.M. To be filled by O.E.M./Aptio CRB, BIOS 5.6.5 07/08/2015
[15102.031628] Call Trace:
[15102.031676]  dump_stack+0xc9/0x16b
[15102.031723]  ? show_regs_print_info+0x5/0x5
[15102.031801]  ? lockdep_rcu_suspicious+0x117/0x160
[15102.031855]  pid_task+0x134/0x160
[15102.031900]  ? find_vpid+0xf0/0xf0
[15102.032017]  shutdown_umh.constprop.1+0x1e/0x53 [bpfilter]
[15102.032055]  stop_umh+0x46/0x52 [bpfilter]
[15102.032092]  __x64_sys_delete_module+0x47e/0x570
[ ... ]

Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")
Signed-off-by: Taehee Yoo &lt;ap420073@gmail.com&gt;
Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bpfilter: include bpfilter_umh in assembly instead of using objcopy</title>
<updated>2018-06-28T12:39:16Z</updated>
<author>
<name>Masahiro Yamada</name>
</author>
<published>2018-06-27T03:13:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8e75887d321d102200abf3a9fa621e2c10ff4cc5'/>
<id>urn:sha1:8e75887d321d102200abf3a9fa621e2c10ff4cc5</id>
<content type='text'>
What we want here is to embed a user-space program into the kernel.
Instead of the complex ELF magic, let's simply wrap it in the assembly
with the '.incbin' directive.

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpfilter: check compiler capability in Kconfig</title>
<updated>2018-06-28T04:36:39Z</updated>
<author>
<name>Masahiro Yamada</name>
</author>
<published>2018-06-26T03:55:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=88e85a7daf8e21f2d6cb054374d480c540725cde'/>
<id>urn:sha1:88e85a7daf8e21f2d6cb054374d480c540725cde</id>
<content type='text'>
With the brand-new syntax extension of Kconfig, we can directly
check the compiler capability in the configuration phase.

If the cc-can-link.sh fails, the BPFILTER_UMH is automatically
hidden by the dependency.

I also deleted 'default n', which is no-op.

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpfilter: fix user mode helper cross compilation</title>
<updated>2018-06-21T00:19:19Z</updated>
<author>
<name>Matteo Croce</name>
</author>
<published>2018-06-20T14:04:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c24fb5e68ebfd485ecaa8b5d40cb4721a1d137ee'/>
<id>urn:sha1:c24fb5e68ebfd485ecaa8b5d40cb4721a1d137ee</id>
<content type='text'>
Use $(OBJDUMP) instead of literal 'objdump' to avoid
using host toolchain when cross compiling.

Fixes: 421780fd4983 ("bpfilter: fix build error")
Signed-off-by: Matteo Croce &lt;mcroce@redhat.com&gt;
Reported-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpfilter: ignore binary files</title>
<updated>2018-06-20T00:07:46Z</updated>
<author>
<name>Matteo Croce</name>
</author>
<published>2018-06-19T15:21:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8b26a06ad4f2a12425f1f63a0ee57f42961dfd1e'/>
<id>urn:sha1:8b26a06ad4f2a12425f1f63a0ee57f42961dfd1e</id>
<content type='text'>
net/bpfilter/bpfilter_umh is a binary file generated when bpfilter is
enabled, add it to .gitignore to avoid committing it.

Fixes: d2ba09c17a064 ("net: add skeleton of bpfilter kernel module")
Signed-off-by: Matteo Croce &lt;mcroce@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpfilter: fix build error</title>
<updated>2018-06-20T00:07:46Z</updated>
<author>
<name>Matteo Croce</name>
</author>
<published>2018-06-19T15:16:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=421780fd498399235b044638e85b352d6da20b6a'/>
<id>urn:sha1:421780fd498399235b044638e85b352d6da20b6a</id>
<content type='text'>
bpfilter Makefile assumes that the system locale is en_US, and the
parsing of objdump output fails.
Set LC_ALL=C and, while at it, rewrite the objdump parsing so it spawns
only 2 processes instead of 7.

Fixes: d2ba09c17a064 ("net: add skeleton of bpfilter kernel module")
Signed-off-by: Matteo Croce &lt;mcroce@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpfilter: fix race in pipe access</title>
<updated>2018-06-08T00:07:28Z</updated>
<author>
<name>Alexei Starovoitov</name>
</author>
<published>2018-06-07T22:31:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=66e58e0ef80a56a1d7857b6ce121141563cdd93e'/>
<id>urn:sha1:66e58e0ef80a56a1d7857b6ce121141563cdd93e</id>
<content type='text'>
syzbot reported the following crash
[  338.293946] bpfilter: read fail -512
[  338.304515] kasan: GPF could be caused by NULL-ptr deref or user memory access
[  338.311863] general protection fault: 0000 [#1] SMP KASAN
[  338.344360] RIP: 0010:__vfs_write+0x4a6/0x960
[  338.426363] Call Trace:
[  338.456967]  __kernel_write+0x10c/0x380
[  338.460928]  __bpfilter_process_sockopt+0x1d8/0x35b
[  338.487103]  bpfilter_mbox_request+0x4d/0xb0
[  338.491492]  bpfilter_ip_get_sockopt+0x6b/0x90

This can happen when multiple cpus trying to talk to user mode process
via bpfilter_mbox_request(). One cpu grabs the mutex while another goes to
sleep on the same mutex. Then former cpu sees that umh pipe is down and
shuts down the pipes. Later cpu finally acquires the mutex and crashes
on freed pipe.
Fix the race by using info.pid as an indicator that umh and pipes are healthy
and check it after acquiring the mutex.

Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")
Reported-by: syzbot+7ade6c94abb2774c0fee@syzkaller.appspotmail.com
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpfilter: fix OUTPUT_FORMAT</title>
<updated>2018-06-07T20:56:48Z</updated>
<author>
<name>Alexei Starovoitov</name>
</author>
<published>2018-06-07T17:29:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8d97ca6b6755bf7ef57d323642ca9ee80d689782'/>
<id>urn:sha1:8d97ca6b6755bf7ef57d323642ca9ee80d689782</id>
<content type='text'>
CONFIG_OUTPUT_FORMAT is x86 only macro.
Used objdump to extract elf file format.

Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")
Reported-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpfilter: switch to CC from HOSTCC</title>
<updated>2018-06-05T14:21:18Z</updated>
<author>
<name>Alexei Starovoitov</name>
</author>
<published>2018-06-05T02:53:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=819dd92b9c0bc7bce9097d8c1f14240f471bb386'/>
<id>urn:sha1:819dd92b9c0bc7bce9097d8c1f14240f471bb386</id>
<content type='text'>
check that CC can build executables and use that compiler instead of HOSTCC

Suggested-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpfilter: fix a build err</title>
<updated>2018-05-29T19:20:21Z</updated>
<author>
<name>YueHaibing</name>
</author>
<published>2018-05-25T10:17:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ae40832e53c33fab2755571dabc1378117bc50d4'/>
<id>urn:sha1:ae40832e53c33fab2755571dabc1378117bc50d4</id>
<content type='text'>
gcc-7.3.0 report following err:

  HOSTCC  net/bpfilter/main.o
In file included from net/bpfilter/main.c:9:0:
./include/uapi/linux/bpf.h:12:10: fatal error: linux/bpf_common.h: No such file or directory
 #include &lt;linux/bpf_common.h&gt;

remove it by adding a include path.
Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")

Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
