<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/bpf/preload/bpf_preload_kern.c, branch linux-5.12.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-03-19T21:23:19Z</updated>
<entry>
<title>bpf: Fix umd memory leak in copy_process()</title>
<updated>2021-03-19T21:23:19Z</updated>
<author>
<name>Zqiang</name>
</author>
<published>2021-03-17T03:09:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f60a85cad677c4f9bb4cadd764f1d106c38c7cf8'/>
<id>urn:sha1:f60a85cad677c4f9bb4cadd764f1d106c38c7cf8</id>
<content type='text'>
The syzbot reported a memleak as follows:

BUG: memory leak
unreferenced object 0xffff888101b41d00 (size 120):
  comm "kworker/u4:0", pid 8, jiffies 4294944270 (age 12.780s)
  backtrace:
    [&lt;ffffffff8125dc56&gt;] alloc_pid+0x66/0x560
    [&lt;ffffffff81226405&gt;] copy_process+0x1465/0x25e0
    [&lt;ffffffff81227943&gt;] kernel_clone+0xf3/0x670
    [&lt;ffffffff812281a1&gt;] kernel_thread+0x61/0x80
    [&lt;ffffffff81253464&gt;] call_usermodehelper_exec_work
    [&lt;ffffffff81253464&gt;] call_usermodehelper_exec_work+0xc4/0x120
    [&lt;ffffffff812591c9&gt;] process_one_work+0x2c9/0x600
    [&lt;ffffffff81259ab9&gt;] worker_thread+0x59/0x5d0
    [&lt;ffffffff812611c8&gt;] kthread+0x178/0x1b0
    [&lt;ffffffff8100227f&gt;] ret_from_fork+0x1f/0x30

unreferenced object 0xffff888110ef5c00 (size 232):
  comm "kworker/u4:0", pid 8414, jiffies 4294944270 (age 12.780s)
  backtrace:
    [&lt;ffffffff8154a0cf&gt;] kmem_cache_zalloc
    [&lt;ffffffff8154a0cf&gt;] __alloc_file+0x1f/0xf0
    [&lt;ffffffff8154a809&gt;] alloc_empty_file+0x69/0x120
    [&lt;ffffffff8154a8f3&gt;] alloc_file+0x33/0x1b0
    [&lt;ffffffff8154ab22&gt;] alloc_file_pseudo+0xb2/0x140
    [&lt;ffffffff81559218&gt;] create_pipe_files+0x138/0x2e0
    [&lt;ffffffff8126c793&gt;] umd_setup+0x33/0x220
    [&lt;ffffffff81253574&gt;] call_usermodehelper_exec_async+0xb4/0x1b0
    [&lt;ffffffff8100227f&gt;] ret_from_fork+0x1f/0x30

After the UMD process exits, the pipe_to_umh/pipe_from_umh and
tgid need to be released.

Fixes: d71fa5c9763c ("bpf: Add kernel module with user mode driver that populates bpffs.")
Reported-by: syzbot+44908bb56d2bfe56b28e@syzkaller.appspotmail.com
Signed-off-by: Zqiang &lt;qiang.zhang@windriver.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20210317030915.2865-1-qiang.zhang@windriver.com
</content>
</entry>
<entry>
<title>bpf: Add kernel module with user mode driver that populates bpffs.</title>
<updated>2020-08-20T14:02:36Z</updated>
<author>
<name>Alexei Starovoitov</name>
</author>
<published>2020-08-19T04:27:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d71fa5c9763c24dd997a2fa4feb7a13a95bab42c'/>
<id>urn:sha1:d71fa5c9763c24dd997a2fa4feb7a13a95bab42c</id>
<content type='text'>
Add kernel module with user mode driver that populates bpffs with
BPF iterators.

$ mount bpffs /my/bpffs/ -t bpf
$ ls -la /my/bpffs/
total 4
drwxrwxrwt  2 root root    0 Jul  2 00:27 .
drwxr-xr-x 19 root root 4096 Jul  2 00:09 ..
-rw-------  1 root root    0 Jul  2 00:27 maps.debug
-rw-------  1 root root    0 Jul  2 00:27 progs.debug

The user mode driver will load BPF Type Formats, create BPF maps, populate BPF
maps, load two BPF programs, attach them to BPF iterators, and finally send two
bpf_link IDs back to the kernel.
The kernel will pin two bpf_links into newly mounted bpffs instance under
names "progs.debug" and "maps.debug". These two files become human readable.

$ cat /my/bpffs/progs.debug
  id name            attached
  11 dump_bpf_map    bpf_iter_bpf_map
  12 dump_bpf_prog   bpf_iter_bpf_prog
  27 test_pkt_access
  32 test_main       test_pkt_access test_pkt_access
  33 test_subprog1   test_pkt_access_subprog1 test_pkt_access
  34 test_subprog2   test_pkt_access_subprog2 test_pkt_access
  35 test_subprog3   test_pkt_access_subprog3 test_pkt_access
  36 new_get_skb_len get_skb_len test_pkt_access
  37 new_get_skb_ifindex get_skb_ifindex test_pkt_access
  38 new_get_constant get_constant test_pkt_access

The BPF program dump_bpf_prog() in iterators.bpf.c is printing this data about
all BPF programs currently loaded in the system. This information is unstable
and will change from kernel to kernel as ".debug" suffix conveys.

Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20200819042759.51280-4-alexei.starovoitov@gmail.com
</content>
</entry>
</feed>
