LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* memory leak in do_seccomp
@ 2021-07-31 19:20 Sudip Mukherjee
  2021-08-01  3:25 ` Kees Cook
  0 siblings, 1 reply; 11+ messages in thread
From: Sudip Mukherjee @ 2021-07-31 19:20 UTC (permalink / raw)
  To: Kees Cook, Andy Lutomirski, Will Drewry, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh
  Cc: linux-kernel, netdev, bpf

Hi All,

We had been running syzkaller on v5.10.y and a "memory leak in
do_seccomp" was being reported on it. I got some time to check that
today and have managed to get a syzkaller
reproducer. I dont have a C reproducer which I can share but I can use
the syz-reproducer to reproduce this with next-20210730.
The old report on v5.10.y is at
https://elisa-builder-00.iol.unh.edu/syzkaller/report?id=f6ddd3b592f00e95f9cbd2e74f70a5b04b015c6f

BUG: memory leak
unreferenced object 0xffff888019282c00 (size 512):
  comm "syz-executor.1", pid 7389, jiffies 4294761829 (age 17.841s)
  hex dump (first 32 bytes):
    01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000762c0963>] do_seccomp+0x2d5/0x27d0
    [<0000000006e512d1>] do_syscall_64+0x3b/0x90
    [<0000000094ae9ff8>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffffc900006b5000 (size 4096):
  comm "syz-executor.1", pid 7389, jiffies 4294761829 (age 17.841s)
  hex dump (first 32 bytes):
    01 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000854901e5>] __vmalloc_node_range+0x550/0x9a0
    [<000000002686628f>] __vmalloc_node+0xb5/0x100
    [<0000000004cbd298>] bpf_prog_alloc_no_stats+0x38/0x350
    [<0000000009149728>] bpf_prog_alloc+0x24/0x170
    [<000000000fe7f1e7>] bpf_prog_create_from_user+0xad/0x2e0
    [<000000000c70eb02>] do_seccomp+0x325/0x27d0
    [<0000000006e512d1>] do_syscall_64+0x3b/0x90
    [<0000000094ae9ff8>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff888026eb1000 (size 2048):
  comm "syz-executor.1", pid 7389, jiffies 4294761829 (age 17.842s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<0000000072de7240>] bpf_prog_alloc_no_stats+0xeb/0x350
    [<0000000009149728>] bpf_prog_alloc+0x24/0x170
    [<000000000fe7f1e7>] bpf_prog_create_from_user+0xad/0x2e0
    [<000000000c70eb02>] do_seccomp+0x325/0x27d0
    [<0000000006e512d1>] do_syscall_64+0x3b/0x90
    [<0000000094ae9ff8>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff888014dddac0 (size 16):
  comm "syz-executor.1", pid 7389, jiffies 4294761829 (age 17.842s)
  hex dump (first 16 bytes):
    01 00 ca 08 80 88 ff ff c8 ef df 14 80 88 ff ff  ................
  backtrace:
    [<00000000c5d4ed93>] bpf_prog_store_orig_filter+0x7b/0x1e0
    [<000000007cb21c2a>] bpf_prog_create_from_user+0x1c6/0x2e0
    [<000000000c70eb02>] do_seccomp+0x325/0x27d0
    [<0000000006e512d1>] do_syscall_64+0x3b/0x90
    [<0000000094ae9ff8>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff888014dfefc8 (size 8):
  comm "syz-executor.1", pid 7389, jiffies 4294761829 (age 17.842s)
  hex dump (first 8 bytes):
    06 00 00 00 ff ff ff 7f                          ........
  backtrace:
    [<00000000ee5550f8>] kmemdup+0x23/0x50
    [<00000000f1acd067>] bpf_prog_store_orig_filter+0x103/0x1e0
    [<000000007cb21c2a>] bpf_prog_create_from_user+0x1c6/0x2e0
    [<000000000c70eb02>] do_seccomp+0x325/0x27d0
    [<0000000006e512d1>] do_syscall_64+0x3b/0x90
    [<0000000094ae9ff8>] entry_SYSCALL_64_after_hwframe+0x44/0xae

Not sure if this has been already reported or not, but I will be happy
to test if you have a fix for this.


-- 
Regards
Sudip

^ permalink raw reply	[flat|nested] 11+ messages in thread
* memory leak in do_seccomp
@ 2020-08-11 17:06 syzbot
  2020-08-31  3:50 ` syzbot
  0 siblings, 1 reply; 11+ messages in thread
From: syzbot @ 2020-08-11 17:06 UTC (permalink / raw)
  To: andriin, ast, bpf, daniel, john.fastabend, kafai, keescook,
	kpsingh, linux-kernel, luto, netdev, songliubraving,
	syzkaller-bugs, wad, yhs

Hello,

syzbot found the following issue on:

HEAD commit:    449dc8c9 Merge tag 'for-v5.9' of git://git.kernel.org/pub/..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=15d816c2900000
kernel config:  https://syzkaller.appspot.com/x/.config?x=4810fa4a53b3aa2c
dashboard link: https://syzkaller.appspot.com/bug?extid=3ad9614a12f80994c32e
compiler:       gcc (GCC) 10.1.0-syz 20200507
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=153d30e2900000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3ad9614a12f80994c32e@syzkaller.appspotmail.com

2020/08/09 00:29:47 executed programs: 3
BUG: memory leak
unreferenced object 0xffff88811310ea80 (size 96):
  comm "syz-executor.0", pid 6688, jiffies 4294954707 (age 12.810s)
  hex dump (first 32 bytes):
    01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 30 e0 00 00 c9 ff ff  .........0......
  backtrace:
    [<0000000073bb6e7d>] kmalloc include/linux/slab.h:554 [inline]
    [<0000000073bb6e7d>] kzalloc include/linux/slab.h:666 [inline]
    [<0000000073bb6e7d>] seccomp_prepare_filter kernel/seccomp.c:562 [inline]
    [<0000000073bb6e7d>] seccomp_prepare_user_filter kernel/seccomp.c:604 [inline]
    [<0000000073bb6e7d>] seccomp_set_mode_filter kernel/seccomp.c:1535 [inline]
    [<0000000073bb6e7d>] do_seccomp+0x2ec/0xd40 kernel/seccomp.c:1649
    [<00000000658618a4>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
    [<00000000b8258e4d>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffffc90000e03000 (size 4096):
  comm "syz-executor.0", pid 6688, jiffies 4294954707 (age 12.810s)
  hex dump (first 32 bytes):
    01 00 03 00 00 00 00 00 00 00 00 00 05 00 00 00  ................
    2d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  -...............
  backtrace:
    [<000000003b6a39af>] __vmalloc_node_range+0x2e1/0x3c0 mm/vmalloc.c:2520
    [<00000000eee59e12>] __vmalloc_node mm/vmalloc.c:2552 [inline]
    [<00000000eee59e12>] __vmalloc+0x49/0x50 mm/vmalloc.c:2566
    [<000000006e13ac2a>] bpf_prog_alloc_no_stats+0x32/0x100 kernel/bpf/core.c:85
    [<00000000cff3572c>] bpf_prog_alloc+0x1c/0xb0 kernel/bpf/core.c:111
    [<000000003222ffa9>] bpf_prog_create_from_user+0x5f/0x2a0 net/core/filter.c:1409
    [<00000000baa576ae>] seccomp_prepare_filter kernel/seccomp.c:567 [inline]
    [<00000000baa576ae>] seccomp_prepare_user_filter kernel/seccomp.c:604 [inline]
    [<00000000baa576ae>] seccomp_set_mode_filter kernel/seccomp.c:1535 [inline]
    [<00000000baa576ae>] do_seccomp+0x32e/0xd40 kernel/seccomp.c:1649
    [<00000000658618a4>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
    [<00000000b8258e4d>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffff888113bc1c00 (size 1024):
  comm "syz-executor.0", pid 6688, jiffies 4294954707 (age 12.810s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<000000000466b245>] kmalloc include/linux/slab.h:554 [inline]
    [<000000000466b245>] kzalloc include/linux/slab.h:666 [inline]
    [<000000000466b245>] bpf_prog_alloc_no_stats+0x73/0x100 kernel/bpf/core.c:89
    [<00000000cff3572c>] bpf_prog_alloc+0x1c/0xb0 kernel/bpf/core.c:111
    [<000000003222ffa9>] bpf_prog_create_from_user+0x5f/0x2a0 net/core/filter.c:1409
    [<00000000baa576ae>] seccomp_prepare_filter kernel/seccomp.c:567 [inline]
    [<00000000baa576ae>] seccomp_prepare_user_filter kernel/seccomp.c:604 [inline]
    [<00000000baa576ae>] seccomp_set_mode_filter kernel/seccomp.c:1535 [inline]
    [<00000000baa576ae>] do_seccomp+0x32e/0xd40 kernel/seccomp.c:1649
    [<00000000658618a4>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
    [<00000000b8258e4d>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffff8881154cb860 (size 32):
  comm "syz-executor.0", pid 6688, jiffies 4294954707 (age 12.810s)
  hex dump (first 32 bytes):
    01 00 73 74 65 6d 64 2d 00 5c d6 19 81 88 ff ff  ..stemd-.\......
    65 72 76 69 63 65 00 00 00 00 00 00 00 00 00 00  ervice..........
  backtrace:
    [<00000000561d65d4>] kmalloc include/linux/slab.h:554 [inline]
    [<00000000561d65d4>] bpf_prog_store_orig_filter+0x33/0xa0 net/core/filter.c:1131
    [<000000005d9b7cd2>] bpf_prog_create_from_user+0xda/0x2a0 net/core/filter.c:1422
    [<00000000baa576ae>] seccomp_prepare_filter kernel/seccomp.c:567 [inline]
    [<00000000baa576ae>] seccomp_prepare_user_filter kernel/seccomp.c:604 [inline]
    [<00000000baa576ae>] seccomp_set_mode_filter kernel/seccomp.c:1535 [inline]
    [<00000000baa576ae>] do_seccomp+0x32e/0xd40 kernel/seccomp.c:1649
    [<00000000658618a4>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
    [<00000000b8258e4d>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffff888119d65c00 (size 32):
  comm "syz-executor.0", pid 6688, jiffies 4294954707 (age 12.810s)
  hex dump (first 32 bytes):
    06 00 00 00 fb ff ff 7f 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000ad603142>] kmemdup+0x23/0x50 mm/util.c:127
    [<0000000001d3eabf>] kmemdup include/linux/string.h:479 [inline]
    [<0000000001d3eabf>] bpf_prog_store_orig_filter+0x5e/0xa0 net/core/filter.c:1138
    [<000000005d9b7cd2>] bpf_prog_create_from_user+0xda/0x2a0 net/core/filter.c:1422
    [<00000000baa576ae>] seccomp_prepare_filter kernel/seccomp.c:567 [inline]
    [<00000000baa576ae>] seccomp_prepare_user_filter kernel/seccomp.c:604 [inline]
    [<00000000baa576ae>] seccomp_set_mode_filter kernel/seccomp.c:1535 [inline]
    [<00000000baa576ae>] do_seccomp+0x32e/0xd40 kernel/seccomp.c:1649
    [<00000000658618a4>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
    [<00000000b8258e4d>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffff8881131ecb00 (size 96):
  comm "syz-executor.0", pid 6688, jiffies 4294954707 (age 12.810s)
  hex dump (first 32 bytes):
    01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
    80 ea 10 13 81 88 ff ff 00 b0 d8 00 00 c9 ff ff  ................
  backtrace:
    [<0000000073bb6e7d>] kmalloc include/linux/slab.h:554 [inline]
    [<0000000073bb6e7d>] kzalloc include/linux/slab.h:666 [inline]
    [<0000000073bb6e7d>] seccomp_prepare_filter kernel/seccomp.c:562 [inline]
    [<0000000073bb6e7d>] seccomp_prepare_user_filter kernel/seccomp.c:604 [inline]
    [<0000000073bb6e7d>] seccomp_set_mode_filter kernel/seccomp.c:1535 [inline]
    [<0000000073bb6e7d>] do_seccomp+0x2ec/0xd40 kernel/seccomp.c:1649
    [<00000000658618a4>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
    [<00000000b8258e4d>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

BUG: memory leak
unreferenced object 0xffff88811310e400 (size 96):
  comm "syz-executor.0", pid 6702, jiffies 4294955242 (age 7.460s)
  hex dump (first 32 bytes):
    01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 50 e1 00 00 c9 ff ff  .........P......
  backtrace:
    [<0000000073bb6e7d>] kmalloc include/linux/slab.h:554 [inline]
    [<0000000073bb6e7d>] kzalloc include/linux/slab.h:666 [inline]
    [<0000000073bb6e7d>] seccomp_prepare_filter kernel/seccomp.c:562 [inline]
    [<0000000073bb6e7d>] seccomp_prepare_user_filter kernel/seccomp.c:604 [inline]
    [<0000000073bb6e7d>] seccomp_set_mode_filter kernel/seccomp.c:1535 [inline]
    [<0000000073bb6e7d>] do_seccomp+0x2ec/0xd40 kernel/seccomp.c:1649
    [<00000000658618a4>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
    [<00000000b8258e4d>] entry_SYSCALL_64_after_hwframe+0x44/0xa9



---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-08-01 21:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-31 19:20 memory leak in do_seccomp Sudip Mukherjee
2021-08-01  3:25 ` Kees Cook
2021-08-01 21:10   ` Sudip Mukherjee
  -- strict thread matches above, loose matches on Subject: below --
2020-08-11 17:06 syzbot
2020-08-31  3:50 ` syzbot
2020-08-31 23:25   ` Kees Cook
2020-09-01  0:09     ` Tycho Andersen
2020-09-01  1:14       ` Tycho Andersen
2020-09-01 10:07         ` Christian Brauner
2020-09-01 15:08         ` Kees Cook
2020-09-01 15:26           ` Tycho Andersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).