syzbot


KASAN: use-after-free Read in nfc_llcp_sock_unlink

Status: upstream: reported C repro on 2021/04/17 16:59
Reported-by: syzbot+e957c786fee9905cefc7@syzkaller.appspotmail.com
First crash: 1314d, last: 803d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in nfc_llcp_sock_unlink net nfc C done done 68 1293d 1333d 0/28 auto-obsoleted due to no activity on 2022/09/14 15:37
linux-4.19 KASAN: use-after-free Read in nfc_llcp_sock_unlink C done 22 1279d 1317d 1/1 fixed on 2021/06/23 17:43
Fix bisection attempts (17)
Created Duration User Patch Repo Result
2022/10/13 02:24 0m bisect fix linux-4.14.y error job log
2022/09/10 07:36 19m bisect fix linux-4.14.y OK (0) job log log
2022/08/11 06:54 33m bisect fix linux-4.14.y OK (0) job log log
2022/07/12 06:33 21m bisect fix linux-4.14.y OK (0) job log log
2022/06/12 05:35 29m bisect fix linux-4.14.y OK (0) job log log
2022/05/13 04:32 31m bisect fix linux-4.14.y OK (0) job log log
2022/04/13 03:52 28m bisect fix linux-4.14.y OK (0) job log log
2022/03/14 01:31 35m bisect fix linux-4.14.y OK (0) job log log
2022/02/11 17:26 25m bisect fix linux-4.14.y OK (0) job log log
2022/01/12 16:59 22m bisect fix linux-4.14.y OK (0) job log log
2021/12/13 16:31 23m bisect fix linux-4.14.y OK (0) job log log
2021/11/13 15:35 29m bisect fix linux-4.14.y OK (0) job log log
2021/10/14 14:59 35m bisect fix linux-4.14.y OK (0) job log log
2021/09/14 14:37 21m bisect fix linux-4.14.y OK (0) job log log
2021/08/15 14:14 22m bisect fix linux-4.14.y OK (0) job log log
2021/07/16 13:50 24m bisect fix linux-4.14.y OK (0) job log log
2021/06/16 13:28 22m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x2c57/0x3f20 kernel/locking/lockdep.c:3369
Read of size 8 at addr ffff8880ae5b0d60 by task syz-executor402/7985

CPU: 0 PID: 7985 Comm: syz-executor402 Not tainted 4.14.232-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
 __lock_acquire+0x2c57/0x3f20 kernel/locking/lockdep.c:3369
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __raw_write_lock include/linux/rwlock_api_smp.h:210 [inline]
 _raw_write_lock+0x2a/0x40 kernel/locking/spinlock.c:296
 nfc_llcp_sock_unlink+0x1d/0x170 net/nfc/llcp_core.c:44
 llcp_sock_release+0x235/0x4c0 net/nfc/llcp_sock.c:653
 __sock_release+0xcd/0x2b0 net/socket.c:602
 sock_close+0x15/0x20 net/socket.c:1139
 __fput+0x25f/0x7a0 fs/file_table.c:210
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xa44/0x2850 kernel/exit.c:868
 do_group_exit+0x100/0x2e0 kernel/exit.c:965
 get_signal+0x38d/0x1ca0 kernel/signal.c:2423
 do_signal+0x7c/0x1550 arch/x86/kernel/signal.c:792
 exit_to_usermode_loop+0x160/0x200 arch/x86/entry/common.c:160
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x43fd79
RSP: 002b:00007ffcc1aaf498 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: fffffffffffffe00 RBX: 00000000000f4240 RCX: 000000000043fd79
RDX: 0000000000000001 RSI: 00000000200032c0 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000403550
R13: 0000000000000000 R14: 00007ffcc1aaf4c0 R15: 00007ffcc1aaf4b0

Allocated by task 1:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 nfc_llcp_register_device+0x43/0xa50 net/nfc/llcp_core.c:1584
 nfc_register_device+0x63/0x330 net/nfc/core.c:1132
 nfcsim_device_new+0x372/0x5c2 drivers/nfc/nfcsim.c:417
 nfcsim_init+0x71/0x12a drivers/nfc/nfcsim.c:464
 do_one_initcall+0x88/0x210 init/main.c:826
 do_initcall_level init/main.c:892 [inline]
 do_initcalls init/main.c:900 [inline]
 do_basic_setup init/main.c:918 [inline]
 kernel_init_freeable+0x553/0x614 init/main.c:1075
 kernel_init+0xd/0x165 init/main.c:1000
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Freed by task 7984:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xc9/0x250 mm/slab.c:3815
 local_release net/nfc/llcp_core.c:187 [inline]
 kref_put include/linux/kref.h:70 [inline]
 nfc_llcp_local_put+0x13c/0x190 net/nfc/llcp_core.c:195
 llcp_sock_destruct+0x69/0x120 net/nfc/llcp_sock.c:960
 __sk_destruct+0x49/0x760 net/core/sock.c:1557
 sk_destruct net/core/sock.c:1597 [inline]
 __sk_free+0xd9/0x2d0 net/core/sock.c:1605
 sk_free+0x2b/0x40 net/core/sock.c:1616
 sock_put include/net/sock.h:1662 [inline]
 llcp_sock_release+0x31b/0x4c0 net/nfc/llcp_sock.c:657
 __sock_release+0xcd/0x2b0 net/socket.c:602
 sock_close+0x15/0x20 net/socket.c:1139
 __fput+0x25f/0x7a0 fs/file_table.c:210
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xa44/0x2850 kernel/exit.c:868
 do_group_exit+0x100/0x2e0 kernel/exit.c:965
 get_signal+0x38d/0x1ca0 kernel/signal.c:2423
 do_signal+0x7c/0x1550 arch/x86/kernel/signal.c:792
 exit_to_usermode_loop+0x160/0x200 arch/x86/entry/common.c:160
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880ae5b0940
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 1056 bytes inside of
 2048-byte region [ffff8880ae5b0940, ffff8880ae5b1140)
The buggy address belongs to the page:
page:ffffea0002b96c00 count:1 mapcount:0 mapping:ffff8880ae5b00c0 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff8880ae5b00c0 0000000000000000 0000000100000003
raw: ffffea0002b96ba0 ffffea0002b98220 ffff88813fe80c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880ae5b0c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880ae5b0c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880ae5b0d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff8880ae5b0d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880ae5b0e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/05/03 20:38 linux-4.14.y 7d7d1c0ab3eb ad61f371 .config console log report syz C ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/05/17 13:27 linux-4.14.y 7d7d1c0ab3eb a2eb125d .config console log report syz ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/05/07 08:06 linux-4.14.y 7d7d1c0ab3eb 06585184 .config console log report syz ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/04/30 17:00 linux-4.14.y 7d7d1c0ab3eb 77e2b668 .config console log report syz ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/04/29 12:18 linux-4.14.y 7d7d1c0ab3eb 77e2b668 .config console log report syz ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/04/17 23:53 linux-4.14.y cf256fbcbe34 7e2b734b .config console log report syz ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/05/15 10:29 linux-4.14.y 7d7d1c0ab3eb 93f844de .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/05/12 23:07 linux-4.14.y 7d7d1c0ab3eb ed7d41c5 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/05/03 20:19 linux-4.14.y 7d7d1c0ab3eb ad61f371 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/05/02 20:28 linux-4.14.y 7d7d1c0ab3eb 77e2b668 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/04/29 08:16 linux-4.14.y 7d7d1c0ab3eb 77e2b668 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/04/27 06:32 linux-4.14.y cf256fbcbe34 8ee2dea6 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
2021/04/17 16:58 linux-4.14.y cf256fbcbe34 7e2b734b .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in nfc_llcp_sock_unlink
* Struck through repros no longer work on HEAD.