syzbot


KASAN: use-after-free Write in sockfs_setattr

Status: public: reported syz repro on 2019/04/14 08:51
Reported-by: syzbot+aa44ce5555398640af38@syzkaller.appspotmail.com
First crash: 2084d, last: 2084d

Sample crash report:
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_to_bridge: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_bridge: link becomes ready
IPv6: ADDRCONF(NETDEV_UP): veth0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
==================================================================
BUG: KASAN: use-after-free in sockfs_setattr+0x11d/0x140 net/socket.c:531
Write of size 4 at addr ffff8801d4ffd104 by task syz-executor0/4764

CPU: 1 PID: 4764 Comm: syz-executor0 Not tainted 4.4.151-ge917467 #20
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 0000000000000000 4fec89414e34cd67 ffff8800b5b8fb98 ffffffff81e15eed
 ffffea000753fe00 ffff8801d4ffd104 0000000000000001 ffff8801d4ffd104
 0000000000000000 ffff8800b5b8fbd0 ffffffff8151b390 ffff8801d4ffd104
Call Trace:
 [<ffffffff81e15eed>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81e15eed>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
 [<ffffffff8151b390>] print_address_description+0x6c/0x216 mm/kasan/report.c:252
 [<ffffffff8151b6af>] kasan_report_error mm/kasan/report.c:351 [inline]
 [<ffffffff8151b6af>] kasan_report.cold.7+0x175/0x2f7 mm/kasan/report.c:408
 [<ffffffff814fe6c7>] __asan_report_store4_noabort+0x17/0x20 mm/kasan/report.c:433
 [<ffffffff82f2654d>] sockfs_setattr+0x11d/0x140 net/socket.c:531
 [<ffffffff8157c85a>] notify_change2+0x96a/0xbd0 fs/attr.c:283
 [<ffffffff8151cd44>] chown_common+0x484/0x550 fs/open.c:612
 [<ffffffff81520415>] SYSC_fchownat fs/open.c:642 [inline]
 [<ffffffff81520415>] SyS_fchownat+0x115/0x1b0 fs/open.c:622
 [<ffffffff81006d94>] do_syscall_32_irqs_on arch/x86/entry/common.c:393 [inline]
 [<ffffffff81006d94>] do_fast_syscall_32+0x324/0x8b0 arch/x86/entry/common.c:460
 [<ffffffff838cda83>] sysenter_flags_fixed+0xd/0x1a

Allocated by task 4764:
 [<ffffffff81034676>] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63
 [<ffffffff814fd6f3>] save_stack+0x43/0xd0 mm/kasan/kasan.c:512
 [<ffffffff814fd9d7>] set_track mm/kasan/kasan.c:524 [inline]
 [<ffffffff814fd9d7>] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:616
 [<ffffffff814fdfa2>] kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:554
 [<ffffffff814f9abe>] slab_post_alloc_hook mm/slub.c:1349 [inline]
 [<ffffffff814f9abe>] slab_alloc_node mm/slub.c:2615 [inline]
 [<ffffffff814f9abe>] slab_alloc mm/slub.c:2623 [inline]
 [<ffffffff814f9abe>] kmem_cache_alloc+0xbe/0x2a0 mm/slub.c:2628
 [<ffffffff82f2e279>] sk_prot_alloc+0x69/0x300 net/core/sock.c:1344
 [<ffffffff82f33dea>] sk_alloc+0x3a/0x3a0 net/core/sock.c:1419
 [<ffffffff83415a5e>] unix_create1+0x7e/0x4a0 net/unix/af_unix.c:764
 [<ffffffff83415fdc>] unix_create+0x15c/0x1c0 net/unix/af_unix.c:825
 [<ffffffff82f29260>] __sock_create+0x2f0/0x5f0 net/socket.c:1178
 [<ffffffff82f299e5>] sock_create net/socket.c:1218 [inline]
 [<ffffffff82f299e5>] SYSC_socketpair net/socket.c:1294 [inline]
 [<ffffffff82f299e5>] SyS_socketpair+0x195/0x510 net/socket.c:1269
 [<ffffffff81006d94>] do_syscall_32_irqs_on arch/x86/entry/common.c:393 [inline]
 [<ffffffff81006d94>] do_fast_syscall_32+0x324/0x8b0 arch/x86/entry/common.c:460
 [<ffffffff838cda83>] sysenter_flags_fixed+0xd/0x1a

Freed by task 4763:
 [<ffffffff81034676>] save_stack_trace+0x26/0x50 arch/x86/kernel/stacktrace.c:63
 [<ffffffff814fd6f3>] save_stack+0x43/0xd0 mm/kasan/kasan.c:512
 [<ffffffff814fe022>] set_track mm/kasan/kasan.c:524 [inline]
 [<ffffffff814fe022>] kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:589
 [<ffffffff814fb20e>] slab_free_hook mm/slub.c:1383 [inline]
 [<ffffffff814fb20e>] slab_free_freelist_hook mm/slub.c:1405 [inline]
 [<ffffffff814fb20e>] slab_free mm/slub.c:2859 [inline]
 [<ffffffff814fb20e>] kmem_cache_free+0xbe/0x340 mm/slub.c:2881
 [<ffffffff82f381e7>] sk_prot_free net/core/sock.c:1389 [inline]
 [<ffffffff82f381e7>] sk_destruct+0x347/0x4c0 net/core/sock.c:1472
 [<ffffffff82f383af>] __sk_free+0x4f/0x220 net/core/sock.c:1480
 [<ffffffff82f385b0>] sk_free+0x30/0x40 net/core/sock.c:1491
 [<ffffffff8341eea8>] sock_put include/net/sock.h:1639 [inline]
 [<ffffffff8341eea8>] unix_release_sock+0x5a8/0xa00 net/unix/af_unix.c:565
 [<ffffffff8341f344>] unix_release+0x44/0x90 net/unix/af_unix.c:835
 [<ffffffff82f22d36>] sock_release+0x96/0x1c0 net/socket.c:587
 [<ffffffff82f22e76>] sock_close+0x16/0x20 net/socket.c:1038
 [<ffffffff81528775>] __fput+0x235/0x6f0 fs/file_table.c:208
 [<ffffffff81528cb5>] ____fput+0x15/0x20 fs/file_table.c:244
 [<ffffffff8118ee4f>] 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
 [<ffffffff8100708e>] prepare_exit_to_usermode arch/x86/entry/common.c:284 [inline]
 [<ffffffff8100708e>] syscall_return_slowpath arch/x86/entry/common.c:349 [inline]
 [<ffffffff8100708e>] do_syscall_32_irqs_on arch/x86/entry/common.c:399 [inline]
 [<ffffffff8100708e>] do_fast_syscall_32+0x61e/0x8b0 arch/x86/entry/common.c:460
 [<ffffffff838cda83>] sysenter_flags_fixed+0xd/0x1a

The buggy address belongs to the object at ffff8801d4ffcd00
 which belongs to the cache UNIX of size 1664
The buggy address is located 1028 bytes inside of
 1664-byte region [ffff8801d4ffcd00, ffff8801d4ffd380)
The buggy address belongs to the page:
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access[   91.415773] ------------[ cut here ]------------
WARNING: CPU: 0 PID: 3783 at kernel/sched/core.c:7946 __might_sleep+0x138/0x1a0 kernel/sched/core.c:7941()
do not call blocking ops when !TASK_RUNNING; state=1 set at [<ffffffff8113d81e>] do_wait+0x26e/0xa30 kernel/exit.c:1503

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