syzbot


KASAN: use-after-free Read in af_alg_accept

Status: auto-closed as invalid on 2020/07/24 11:01
Subsystems: crypto
[Documentation on labels]
Reported-by: syzbot+ff7e2c6754f4db954fad@syzkaller.appspotmail.com
First crash: 1459d, last: 1459d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in af_alg_accept+0x10d/0x480 crypto/af_alg.c:295
Read of size 8 at addr ffff888055c7f4d0 by task syz-executor.1/16819

CPU: 1 PID: 16819 Comm: syz-executor.1 Not tainted 5.7.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1e9/0x30e lib/dump_stack.c:118
 print_address_description+0x74/0x5c0 mm/kasan/report.c:382
 __kasan_report+0x103/0x1a0 mm/kasan/report.c:511
 kasan_report+0x4d/0x80 mm/kasan/common.c:625

Allocated by task 16819:
 save_stack mm/kasan/common.c:49 [inline]
 set_track mm/kasan/common.c:57 [inline]
 __kasan_kmalloc+0x114/0x160 mm/kasan/common.c:495
 __do_kmalloc mm/slab.c:3656 [inline]
 __kmalloc+0x24b/0x330 mm/slab.c:3665
 kmalloc include/linux/slab.h:560 [inline]
 sk_prot_alloc+0xa7/0x2b0 net/core/sock.c:1604
 sk_alloc+0x35/0x990 net/core/sock.c:1658
 alg_create+0x9a/0x130 crypto/af_alg.c:373
 __sock_create+0x5c9/0x8d0 net/socket.c:1433
 sock_create net/socket.c:1484 [inline]
 __sys_socket+0xde/0x2d0 net/socket.c:1526
 __do_sys_socket net/socket.c:1535 [inline]
 __se_sys_socket net/socket.c:1533 [inline]
 __x64_sys_socket+0x76/0x80 net/socket.c:1533
 do_syscall_64+0xf3/0x1b0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3

Freed by task 16817:
 save_stack mm/kasan/common.c:49 [inline]
 set_track mm/kasan/common.c:57 [inline]
 kasan_set_free_info mm/kasan/common.c:317 [inline]
 __kasan_slab_free+0x125/0x190 mm/kasan/common.c:456
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x220 mm/slab.c:3757
 sk_prot_free net/core/sock.c:1641 [inline]
 __sk_destruct+0x61d/0x740 net/core/sock.c:1725
 __sk_destruct+0x50/0x740 net/core/sock.c:1696
 sock_put include/net/sock.h:1778 [inline]
 af_alg_release+0x81/0xf0 crypto/af_alg.c:121
 __sock_release net/socket.c:605 [inline]
 sock_close+0xd8/0x260 net/socket.c:1283
 __fput+0x2ed/0x750 fs/file_table.c:280
 task_work_run+0x147/0x1d0 kernel/task_work.c:123
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop arch/x86/entry/common.c:165 [inline]
 prepare_exit_to_usermode+0x48e/0x600 arch/x86/entry/common.c:196
 entry_SYSCALL_64_after_hwframe+0x49/0xb3

The buggy address belongs to the object at ffff888055c7f000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1232 bytes inside of
 2048-byte region [ffff888055c7f000, ffff888055c7f800)
The buggy address belongs to the page:
page:ffffea0001571fc0 refcount:1 mapcount:0 mapping:000000007e5067b6 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea00026415c8 ffffea00028dc208 ffff8880aa400e00
raw: 0000000000000000 ffff888055c7f000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888055c7f380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888055c7f400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888055c7f480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff888055c7f500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888055c7f580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/04/25 11:00 upstream 5ef58e290782 b8bb8e5f .config console log report ci-upstream-kasan-gce-smack-root
* Struck through repros no longer work on HEAD.