syzbot


KASAN: use-after-free Read in selinux_netlbl_sk_security_free

Status: closed as invalid on 2017/11/03 21:23
Subsystems: selinux
[Documentation on labels]
Reported-by: syzbot+c06fb26dfcd8220259619bf322a79eb0887147c8@syzkaller.appspotmail.com
First crash: 2671d, last: 2671d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in selinux_netlbl_sk_security_free (2) selinux 1 2613d 2612d 0/28 closed as invalid on 2017/12/06 15:28

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in selinux_netlbl_sk_security_free+0x2e8/0x2f0 security/selinux/netlabel.c:170
Read of size 8 at addr ffff8801c5c288c8 by task syz-executor5/15738

CPU: 0 PID: 15738 Comm: syz-executor5 Not tainted 4.14.0-rc3+ #71
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report+0x25b/0x340 mm/kasan/report.c:409
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 selinux_netlbl_sk_security_free+0x2e8/0x2f0 security/selinux/netlabel.c:170
 selinux_sk_free_security+0x47/0x60 security/selinux/hooks.c:4899
 security_sk_free+0x48/0x80 security/security.c:1430
 sk_prot_free net/core/sock.c:1504 [inline]
 __sk_destruct+0x609/0x910 net/core/sock.c:1587
 sk_destruct+0x47/0x80 net/core/sock.c:1595
 __sk_free+0x57/0x230 net/core/sock.c:1603
 sk_free+0x2a/0x40 net/core/sock.c:1614
 sock_put include/net/sock.h:1649 [inline]
 unix_release_sock+0x644/0xc10 net/unix/af_unix.c:566
 unix_release+0x44/0x90 net/unix/af_unix.c:837
 sock_release+0x8d/0x1e0 net/socket.c:597
 sock_close+0x16/0x20 net/socket.c:1126
 __fput+0x333/0x7f0 fs/file_table.c:210
 ____fput+0x15/0x20 fs/file_table.c:244
 task_work_run+0x199/0x270 kernel/task_work.c:112
 exit_task_work include/linux/task_work.h:21 [inline]
 do_exit+0x9d2/0x1af0 kernel/exit.c:865
 do_group_exit+0x149/0x400 kernel/exit.c:968
 get_signal+0x73f/0x16d0 kernel/signal.c:2334
 do_signal+0x94/0x1ee0 arch/x86/kernel/signal.c:808
 exit_to_usermode_loop+0x214/0x310 arch/x86/entry/common.c:158
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath+0x42f/0x510 arch/x86/entry/common.c:266
 ret_from_fork+0x15/0x40 arch/x86/entry/entry_64.S:423
RIP: 0033:0x454a39
RSP: 002b:00007f1264e1adb0 EFLAGS: 00000202 ORIG_RAX: 0000000000000038
RAX: 0000000000000000 RBX: 00007f1264e1b700 RCX: 0000000000454a39
RDX: 00007f1264e1b9d0 RSI: 00007f1264e1adb0 RDI: 00000000003d0f00
RBP: 0000000000a6f870 R08: 00007f1264e1b700 R09: 00007f1264e1b700
R10: 00007f1264e1b9d0 R11: 0000000000000202 R12: 0000000000000000
R13: 0000000000a6f7ef R14: 00007f1264e1b9c0 R15: 0000000000000004

Allocated by task 15710:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3627
 kmalloc include/linux/slab.h:493 [inline]
 single_open+0x51/0x1d0 fs/seq_file.c:562
 cmdline_proc_open+0x1e/0x30 fs/proc/cmdline.c:14
 proc_reg_open+0x190/0x540 fs/proc/inode.c:351
 do_dentry_open+0x67f/0xd70 fs/open.c:752
 vfs_open+0x107/0x230 fs/open.c:866
 do_last fs/namei.c:3387 [inline]
 path_openat+0x1157/0x3520 fs/namei.c:3527
 do_filp_open+0x25b/0x3b0 fs/namei.c:3562
 do_sys_open+0x502/0x6d0 fs/open.c:1059
 SYSC_open fs/open.c:1077 [inline]
 SyS_open+0x2d/0x40 fs/open.c:1072
 entry_SYSCALL_64_fastpath+0x1f/0xbe

Freed by task 15710:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xca/0x250 mm/slab.c:3820
 single_release+0x88/0xb0 fs/seq_file.c:602
 close_pdeo+0x130/0x420 fs/proc/inode.c:164
 proc_reg_release+0x12b/0x170 fs/proc/inode.c:375
 __fput+0x333/0x7f0 fs/file_table.c:210
 ____fput+0x15/0x20 fs/file_table.c:244
 task_work_run+0x199/0x270 kernel/task_work.c:112
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x296/0x310 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath+0x42f/0x510 arch/x86/entry/common.c:266
 entry_SYSCALL_64_fastpath+0xbc/0xbe

The buggy address belongs to the object at ffff8801c5c288c0
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 8 bytes inside of
 32-byte region [ffff8801c5c288c0, ffff8801c5c288e0)
The buggy address belongs to the page:
page:ffffea0007170a00 count:1 mapcount:0 mapping:ffff8801c5c28000 index:0xffff8801c5c28fc1
flags: 0x200000000000100(slab)
raw: 0200000000000100 ffff8801c5c28000 ffff8801c5c28fc1 000000010000002a
raw: ffffea0007416ba0 ffffea00074efea0 ffff8801dac001c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c5c28780: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801c5c28800: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8801c5c28880: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                                              ^
 ffff8801c5c28900: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801c5c28980: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/10/06 02:42 net-next-old 53954cf8c5d2 c26ea367 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.