syzbot


BUG: unable to handle kernel NULL pointer dereference

Status: closed as dup on 2017/12/03 19:29
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+daa1680c070033243e46779b39657ff6b012d0a8@syzkaller.appspotmail.com
First crash: 2347d, last: 2324d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: use-after-free Read in aead_recvmsg crypto C 4338 2328d 2347d

Sample crash report:
==================================================================
BUG: unable to handle kernel NULL pointer dereference at           (null)
IP:           (null)
PGD 1cb5c9067 P4D 1cb5c9067 PUD 1ca471067 PMD 0 
Oops: 0010 [#1] SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 3636 Comm: syzkaller687795 Not tainted 4.15.0-rc1+ #197
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
task: ffff8801c91c42c0 task.stack: ffff8801bf000000
RIP: 0010:          (null)
RSP: 0018:ffff8801bf007960 EFLAGS: 00010292
RAX: ffff8801cabcfd80 RBX: 1ffff10037e00f2d RCX: ffffffff823a6c31
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff8801bf007968
RBP: ffff8801bf007b00 R08: 0000000000000000 R09: ffff8801c91f2c90
R10: 0000000000000008 R11: ffffed003923e599 R12: dffffc0000000000
R13: ffff8801cabcfda8 R14: ffff8801c9351400 R15: ffff8801c91f2c80
FS:  00007f7ab2d65700(0000) GS:ffff8801db400000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000001ccbe8000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 sock_recvmsg_nosec net/socket.c:805 [inline]
 sock_recvmsg+0xc9/0x110 net/socket.c:812
 ___sys_recvmsg+0x29b/0x630 net/socket.c:2207
 __sys_recvmsg+0xe2/0x210 net/socket.c:2252
 SYSC_recvmsg net/socket.c:2264 [inline]
 SyS_recvmsg+0x2d/0x50 net/socket.c:2259
 entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x446439
RSP: 002b:00007f7ab2d64d08 EFLAGS: 00000246 ORIG_RAX: 000000000000002f
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000446439
RDX: 0000000000000040 RSI: 00000000207e0000 RDI: 0000000000000004
RBP: 0000000000000000 R08: 00007f7ab2d65700 R09: 00007f7ab2d65700
R10: 00007f7ab2d65700 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc4419186f R14: 00007f7ab2d659c0 R15: 0000000000000000
Code:  Bad RIP value.
RIP:           (null) RSP: ffff8801bf007960
CR2: 0000000000000000
---[ end trace 1d6cf58a48d5320c ]---
Kernel panic - not syncing: Fatal exception
BUG: KASAN: use-after-free in skcipher_request_set_tfm include/crypto/skcipher.h:499 [inline]
BUG: KASAN: use-after-free in crypto_aead_copy_sgl crypto/algif_aead.c:85 [inline]
BUG: KASAN: use-after-free in _aead_recvmsg crypto/algif_aead.c:210 [inline]
BUG: KASAN: use-after-free in aead_recvmsg+0x1552/0x1970 crypto/algif_aead.c:313
Read of size 4 at addr ffff8801cabcfd9c by task syzkaller687795/3634

CPU: 1 PID: 3634 Comm: syzkaller687795 Tainted: G      D          4.15.0-rc1+ #197
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+0x194/0x257 lib/dump_stack.c:53
 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_load4_noabort+0x14/0x20 mm/kasan/report.c:429
 skcipher_request_set_tfm include/crypto/skcipher.h:499 [inline]
 crypto_aead_copy_sgl crypto/algif_aead.c:85 [inline]
 _aead_recvmsg crypto/algif_aead.c:210 [inline]
 aead_recvmsg+0x1552/0x1970 crypto/algif_aead.c:313
 sock_recvmsg_nosec net/socket.c:805 [inline]
 sock_recvmsg+0xc9/0x110 net/socket.c:812
 ___sys_recvmsg+0x29b/0x630 net/socket.c:2207
 __sys_recvmsg+0xe2/0x210 net/socket.c:2252
 SYSC_recvmsg net/socket.c:2264 [inline]
 SyS_recvmsg+0x2d/0x50 net/socket.c:2259
 entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x446439
RSP: 002b:00007f7ab2d64d08 EFLAGS: 00000246 ORIG_RAX: 000000000000002f
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000446439
RDX: 0000000000000040 RSI: 00000000207e0000 RDI: 0000000000000004
RBP: 0000000000000000 R08: 00007f7ab2d65700 R09: 00007f7ab2d65700
R10: 00007f7ab2d65700 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc4419186f R14: 00007f7ab2d659c0 R15: 0000000000000000

Allocated by task 3442:
 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
 __do_kmalloc mm/slab.c:3711 [inline]
 __kmalloc+0x162/0x760 mm/slab.c:3720
 kmalloc include/linux/slab.h:504 [inline]
 kzalloc include/linux/slab.h:688 [inline]
 crypto_create_tfm+0x82/0x2e0 crypto/api.c:455
 crypto_alloc_tfm+0x10e/0x2f0 crypto/api.c:540
 crypto_alloc_skcipher+0x2c/0x40 crypto/skcipher.c:926
 crypto_get_default_null_skcipher+0x5f/0x80 crypto/crypto_null.c:164
 crypto_get_default_null_skcipher2 include/crypto/null.h:17 [inline]
 aead_bind+0x89/0x140 crypto/algif_aead.c:472
 alg_bind+0x1ab/0x440 crypto/af_alg.c:179
 SYSC_bind+0x1b4/0x3f0 net/socket.c:1475
 SyS_bind+0x24/0x30 net/socket.c:1461
 entry_SYSCALL_64_fastpath+0x1f/0x96

Freed by task 3522:
 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:3491 [inline]
 kfree+0xca/0x250 mm/slab.c:3806
 kzfree+0x28/0x30 mm/slab_common.c:1482
 crypto_destroy_tfm+0x140/0x2e0 crypto/api.c:581
 crypto_free_skcipher include/crypto/skcipher.h:212 [inline]
 crypto_put_default_null_skcipher+0x35/0x60 crypto/crypto_null.c:185
 crypto_put_default_null_skcipher2 include/crypto/null.h:22 [inline]
 aead_sock_destruct+0x13c/0x220 crypto/algif_aead.c:522
 __sk_destruct+0xfd/0x910 net/core/sock.c:1558
 sk_destruct+0x47/0x80 net/core/sock.c:1593
 __sk_free+0x57/0x230 net/core/sock.c:1601
 sk_free+0x2a/0x40 net/core/sock.c:1612
 sock_put include/net/sock.h:1655 [inline]
 af_alg_release+0x5d/0x70 crypto/af_alg.c:126
 sock_release+0x8d/0x1e0 net/socket.c:596
 sock_close+0x16/0x20 net/socket.c:1125
 __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:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9bb/0x1ae0 kernel/exit.c:865
 do_group_exit+0x149/0x400 kernel/exit.c:968
 SYSC_exit_group kernel/exit.c:979 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:977
 entry_SYSCALL_64_fastpath+0x1f/0x96

The buggy address belongs to the object at ffff8801cabcfd80
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 28 bytes inside of
 128-byte region [ffff8801cabcfd80, ffff8801cabcfe00)
The buggy address belongs to the page:
page:ffffea00072af3c0 count:1 mapcount:0 mapping:ffff8801cabcf000 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801cabcf000 0000000000000000 0000000100000015
raw: ffffea00072a6ba0 ffffea0007291c20 ffff8801db000640 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801cabcfc80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8801cabcfd00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8801cabcfd80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff8801cabcfe00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8801cabcfe80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
Dumping ftrace buffer:
   (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (35):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/11/28 07:43 upstream 4fbd8d194f06 ac93d7e1 .config console log report syz C ci-upstream-kasan-gce-386
2017/12/03 11:40 net-next-old 75d0de8c7e70 48359b97 .config console log report syz C ci-upstream-net-kasan-gce
2017/12/15 06:38 linux-next 6084b576dca2 ac20b98c .config console log report syz C ci-upstream-next-kasan-gce
2017/12/02 03:38 mmots 4131d5166185 29b0fd90 .config console log report syz C ci-upstream-mmots-kasan-gce
2017/12/11 07:01 upstream 50c4c4e268a2 5ad0ce95 .config console log report ci-upstream-kasan-gce
2017/12/02 10:05 upstream a0651c7fa2c0 48359b97 .config console log report ci-upstream-kasan-gce
2017/12/02 01:09 upstream a0651c7fa2c0 48359b97 .config console log report ci-upstream-kasan-gce
2017/12/01 13:48 upstream 3c1c4ddffb58 2fa91450 .config console log report ci-upstream-kasan-gce
2017/12/10 09:23 net-next-old 51e18a453f5f 5ad0ce95 .config console log report ci-upstream-net-kasan-gce
2017/12/08 11:43 net-next-old 66c5c5b56682 b0fa969c .config console log report ci-upstream-net-kasan-gce
2017/11/29 06:07 net-next-old 1d3b78bbc6e9 29b0fd90 .config console log report ci-upstream-net-kasan-gce
2017/12/20 09:21 linux-next 6084b576dca2 2d836b1d .config console log report ci-upstream-next-kasan-gce
2017/12/20 02:38 linux-next 6084b576dca2 2d836b1d .config console log report ci-upstream-next-kasan-gce
2017/12/20 02:19 linux-next 6084b576dca2 2d836b1d .config console log report ci-upstream-next-kasan-gce
2017/12/20 01:37 linux-next 6084b576dca2 2d836b1d .config console log report ci-upstream-next-kasan-gce
2017/12/19 19:57 linux-next 6084b576dca2 af9163c7 .config console log report ci-upstream-next-kasan-gce
2017/12/19 18:05 linux-next 6084b576dca2 af9163c7 .config console log report ci-upstream-next-kasan-gce
2017/12/19 13:25 linux-next 6084b576dca2 af9163c7 .config console log report ci-upstream-next-kasan-gce
2017/12/18 23:33 linux-next 6084b576dca2 1c4160ef .config console log report ci-upstream-next-kasan-gce
2017/12/18 16:46 linux-next 6084b576dca2 1c4160ef .config console log report ci-upstream-next-kasan-gce
2017/12/17 19:51 linux-next 6084b576dca2 d5beb42a .config console log report ci-upstream-next-kasan-gce
2017/12/17 14:16 linux-next 6084b576dca2 d5beb42a .config console log report ci-upstream-next-kasan-gce
2017/12/15 17:36 linux-next 6084b576dca2 ac20b98c .config console log report ci-upstream-next-kasan-gce
2017/12/15 16:19 linux-next 6084b576dca2 ac20b98c .config console log report ci-upstream-next-kasan-gce
2017/12/15 06:54 linux-next 6084b576dca2 ac20b98c .config console log report ci-upstream-next-kasan-gce
2017/12/15 01:03 linux-next 6084b576dca2 ac20b98c .config console log report ci-upstream-next-kasan-gce
2017/12/14 19:50 linux-next 6084b576dca2 ac20b98c .config console log report ci-upstream-next-kasan-gce
2017/12/14 18:14 linux-next 6084b576dca2 ac20b98c .config console log report ci-upstream-next-kasan-gce
2017/12/14 18:11 linux-next 6084b576dca2 ac20b98c .config console log report ci-upstream-next-kasan-gce
2017/12/14 13:15 linux-next 6084b576dca2 ac20b98c .config console log report ci-upstream-next-kasan-gce
2017/12/14 10:00 linux-next 6084b576dca2 ac20b98c .config console log report ci-upstream-next-kasan-gce
2017/12/14 08:54 linux-next 6084b576dca2 ac20b98c .config console log report ci-upstream-next-kasan-gce
2017/12/14 02:13 linux-next 41d8c16909eb 06ea774d .config console log report ci-upstream-next-kasan-gce
2017/12/01 17:09 mmots 4131d5166185 29b0fd90 .config console log report ci-upstream-mmots-kasan-gce
2017/11/28 04:11 linux-next 5bef2980adef 1808de66 .config console log report ci-upstream-next-kasan-gce
* Struck through repros no longer work on HEAD.