syzbot


KASAN: use-after-free Read in selinux_inode_free_security

Status: auto-closed as invalid on 2019/02/22 13:59
First crash: 2083d, last: 2083d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 KASAN: use-after-free Read in selinux_inode_free_security 1 1973d 1836d 0/3 auto-closed as invalid on 2019/05/27 03:59
upstream KASAN: use-after-free Read in selinux_inode_free_security selinux 1 2271d 2259d 0/26 auto-closed as invalid on 2019/02/22 10:34

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline]
BUG: KASAN: use-after-free in do_raw_spin_lock+0x254/0x2c0 kernel/locking/spinlock_debug.c:135
Read of size 4 at addr ffff8801ca87146c by task syz-executor1/26500

CPU: 1 PID: 26500 Comm: syz-executor1 Not tainted 4.4.147-ga5fc665 #80
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 0000000000000000 25796c2c6ac0bff4 ffff8800a5927a70 ffffffff81e12a4d
 ffffea00072a1c40 ffff8801ca87146c 0000000000000000 ffff8801ca87146c
 ffff8801d35c1838 ffff8800a5927aa8 ffffffff81517fd6 ffff8801ca87146c
Call Trace:
 [<ffffffff81e12a4d>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81e12a4d>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
 [<ffffffff81517fd6>] print_address_description+0x6c/0x216 mm/kasan/report.c:252
 [<ffffffff815182f5>] kasan_report_error mm/kasan/report.c:351 [inline]
 [<ffffffff815182f5>] kasan_report.cold.7+0x175/0x2f7 mm/kasan/report.c:408
 [<ffffffff814fbdc4>] __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:428
 [<ffffffff81240d14>] debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline]
 [<ffffffff81240d14>] do_raw_spin_lock+0x254/0x2c0 kernel/locking/spinlock_debug.c:135
 [<ffffffff838c7d7e>] __raw_spin_lock include/linux/spinlock_api_smp.h:145 [inline]
 [<ffffffff838c7d7e>] _raw_spin_lock+0x3e/0x50 kernel/locking/spinlock.c:151
 [<ffffffff81c6805b>] spin_lock include/linux/spinlock.h:302 [inline]
 [<ffffffff81c6805b>] inode_free_security security/selinux/hooks.c:269 [inline]
 [<ffffffff81c6805b>] selinux_inode_free_security+0xcb/0x1c0 security/selinux/hooks.c:2718
 [<ffffffff81c4eb16>] security_inode_free+0x56/0x90 security/security.c:354
 [<ffffffff815742fe>] __destroy_inode+0x2e/0x280 fs/inode.c:226
 [<ffffffff8157459b>] destroy_inode+0x4b/0x120 fs/inode.c:253
TCP: request_sock_TCPv6: Possible SYN flooding on port 20002. Sending cookies.  Check SNMP counters.
 [<ffffffff81574992>] evict+0x322/0x4f0 fs/inode.c:559
 [<ffffffff81574fe1>] iput_final fs/inode.c:1477 [inline]
 [<ffffffff81574fe1>] iput+0x391/0x980 fs/inode.c:1504
 [<ffffffff815f1301>] fsnotify_detach_mark+0x251/0x2f0 fs/notify/mark.c:166
 [<ffffffff815f25da>] fsnotify_clear_marks_by_group_flags+0x1ca/0x290 fs/notify/mark.c:457
 [<ffffffff815f26ba>] fsnotify_clear_marks_by_group+0x1a/0x20 fs/notify/mark.c:469
 [<ffffffff815efdf4>] fsnotify_destroy_group+0x64/0x120 fs/notify/group.c:70
 [<ffffffff815f5277>] inotify_release+0x37/0x50 fs/notify/inotify/inotify_user.c:282
 [<ffffffff815253c5>] __fput+0x235/0x6f0 fs/file_table.c:208
 [<ffffffff81525905>] ____fput+0x15/0x20 fs/file_table.c:244
 [<ffffffff8118e00f>] task_work_run+0x10f/0x190 kernel/task_work.c:115
 [<ffffffff8100362d>] tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 [<ffffffff8100362d>] exit_to_usermode_loop+0x13d/0x160 arch/x86/entry/common.c:253
 [<ffffffff81006535>] prepare_exit_to_usermode arch/x86/entry/common.c:284 [inline]
 [<ffffffff81006535>] syscall_return_slowpath+0x1b5/0x1f0 arch/x86/entry/common.c:349
 [<ffffffff838c8df5>] int_ret_from_sys_call+0x25/0xa3

Allocated by task 26480:
 [<ffffffff81034676>] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63
 [<ffffffff814fae93>] save_stack+0x43/0xd0 mm/kasan/kasan.c:512
 [<ffffffff814fb177>] set_track mm/kasan/kasan.c:524 [inline]
 [<ffffffff814fb177>] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:616
 [<ffffffff814f7524>] kmem_cache_alloc_trace+0x104/0x2c0 mm/slub.c:2642
 [<ffffffff81c69939>] kmalloc include/linux/slab.h:476 [inline]
 [<ffffffff81c69939>] kzalloc include/linux/slab.h:620 [inline]
 [<ffffffff81c69939>] superblock_alloc_security security/selinux/hooks.c:313 [inline]
 [<ffffffff81c69939>] selinux_sb_alloc_security+0x49/0x210 security/selinux/hooks.c:2475
 [<ffffffff81c4e413>] security_sb_alloc+0x73/0xb0 security/security.c:271
 [<ffffffff81528659>] alloc_super fs/super.c:192 [inline]
 [<ffffffff81528659>] sget+0xf9/0x970 fs/super.c:481
 [<ffffffff81529077>] mount_nodev+0x37/0x100 fs/super.c:1081
 [<ffffffff8184474c>] ramfs_mount+0x2c/0x40 fs/ramfs/inode.c:242
 [<ffffffff8152b0cc>] mount_fs+0x28c/0x370 fs/super.c:1146
 [<ffffffff815830c1>] vfs_kern_mount.part.30+0xd1/0x3d0 fs/namespace.c:991
 [<ffffffff8158a70e>] vfs_kern_mount fs/namespace.c:973 [inline]
 [<ffffffff8158a70e>] do_new_mount fs/namespace.c:2517 [inline]
 [<ffffffff8158a70e>] do_mount+0x4ee/0x2860 fs/namespace.c:2833
 [<ffffffff8158d490>] SYSC_mount fs/namespace.c:3027 [inline]
 [<ffffffff8158d490>] SyS_mount+0x130/0x1d0 fs/namespace.c:3005
 [<ffffffff838c8c65>] entry_SYSCALL_64_fastpath+0x22/0x9e

Freed by task 26480:
 [<ffffffff81034676>] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63
 [<ffffffff814fae93>] save_stack+0x43/0xd0 mm/kasan/kasan.c:512
 [<ffffffff814fb7c2>] set_track mm/kasan/kasan.c:524 [inline]
 [<ffffffff814fb7c2>] kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:589
 [<ffffffff814f8cc4>] slab_free_hook mm/slub.c:1383 [inline]
 [<ffffffff814f8cc4>] slab_free_freelist_hook mm/slub.c:1405 [inline]
 [<ffffffff814f8cc4>] slab_free mm/slub.c:2859 [inline]
 [<ffffffff814f8cc4>] kfree+0xf4/0x310 mm/slub.c:3749
 [<ffffffff81c5a4b2>] superblock_free_security security/selinux/hooks.c:333 [inline]
 [<ffffffff81c5a4b2>] selinux_sb_free_security+0x42/0x50 security/selinux/hooks.c:2480
 [<ffffffff81c4e49e>] security_sb_free+0x4e/0x90 security/security.c:276
 [<ffffffff81526416>] destroy_super+0x36/0x110 fs/super.c:166
 [<ffffffff81527326>] __put_super.part.7+0x56/0x70 fs/super.c:265
 [<ffffffff815273af>] __put_super fs/super.c:281 [inline]
 [<ffffffff815273af>] put_super+0x6f/0x80 fs/super.c:279
 [<ffffffff81527475>] deactivate_locked_super+0xb5/0xd0 fs/super.c:312
 [<ffffffff81527d91>] deactivate_super+0x91/0xd0 fs/super.c:332
 [<ffffffff81582372>] cleanup_mnt+0xb2/0x160 fs/namespace.c:1119
 [<ffffffff815824a6>] __cleanup_mnt+0x16/0x20 fs/namespace.c:1126
 [<ffffffff8118e00f>] task_work_run+0x10f/0x190 kernel/task_work.c:115
 [<ffffffff8100362d>] tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 [<ffffffff8100362d>] exit_to_usermode_loop+0x13d/0x160 arch/x86/entry/common.c:253
 [<ffffffff81006535>] prepare_exit_to_usermode arch/x86/entry/common.c:284 [inline]
 [<ffffffff81006535>] syscall_return_slowpath+0x1b5/0x1f0 arch/x86/entry/common.c:349
 [<ffffffff838c8df5>] int_ret_from_sys_call+0x25/0xa3

The buggy address belongs to the object at ffff8801ca8713c0
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 172 bytes inside of
 256-byte region [ffff8801ca8713c0, ffff8801ca8714c0)
The buggy address belongs to the page:
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory accessgeneral protection fault: 0000 [#1] PREEMPT SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 26478 Comm: syz-executor1 Not tainted 4.4.147-ga5fc665 #80
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
task: ffff8800a5e20000 task.stack: ffff8800b6838000
RIP: 0010:[<ffffffff811a838d>]  [<ffffffff811a838d>] task_curr kernel/sched/core.c:1025 [inline]
RIP: 0010:[<ffffffff811a838d>]  [<ffffffff811a838d>] kick_process+0xdd/0x1c0 kernel/sched/core.c:1567
RSP: 0018:ffff8800b683fe78  EFLAGS: 00010002
RAX: dffffc0000000000 RBX: 000000000001f540 RCX: 0000000000000000
RDX: 0000000096262d10 RSI: ffffffff81e7257b RDI: 00000004b1316880
RBP: ffff8800b683fe98 R08: ffffffff85340730 R09: 0000000000000001
R10: 0000000000000000 R11: ffff8800a5e20000 R12: ffff8800a4c94800
R13: 00000000a5920050 R14: 00000000a5920050 R15: ffff8800a5e20000
FS:  0000000000bd5940(0063) GS:ffff8801db200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: fffffffafcf69c20 CR3: 00000000b08d6000 CR4: 00000000001606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
 ffff8800a4c94800 0000000000000080 dffffc0000000000 0000000000000002
 ffff8800b683feb8 ffffffff81157cdf ffff8800a4c94800 ffff8800a4c94df0
 ffff8800b683fef0 ffffffff8115c753 0000000000000b00 ffff8801ba913f40
Call Trace:
 [<ffffffff81157cdf>] signal_wake_up_state+0x5f/0x70 kernel/signal.c:660
 [<ffffffff8115c753>] signal_wake_up include/linux/sched.h:3332 [inline]
 [<ffffffff8115c753>] zap_other_threads+0x123/0x170 kernel/signal.c:1213
 [<ffffffff8113d50c>] do_group_exit+0x26c/0x330 kernel/exit.c:880
 [<ffffffff8113d5ed>] SYSC_exit_group kernel/exit.c:896 [inline]
 [<ffffffff8113d5ed>] SyS_exit_group+0x1d/0x20 kernel/exit.c:894
 [<ffffffff838c8c65>] entry_SYSCALL_64_fastpath+0x22/0x9e
Code: 04 02 84 c0 74 08 3c 03 0f 8e b4 00 00 00 48 b8 00 00 00 00 00 fc ff df 45 8b 6d 10 4a 8d 3c ed 00 66 a1 84 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 ae 00 00 00 4a 03 1c ed 00 66 a1 84 48 b8 00 
RIP  [<ffffffff811a838d>] task_curr kernel/sched/core.c:1025 [inline]
RIP  [<ffffffff811a838d>] kick_process+0xdd/0x1c0 kernel/sched/core.c:1567
 RSP <ffff8800b683fe78>
---[ end trace e2d9c9b6a928c31f ]---

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/08/09 16:13 https://android.googlesource.com/kernel/common android-4.4 a5fc66599b61 1fb62d58 .config console log report ci-android-44-kasan-gce
* Struck through repros no longer work on HEAD.