syzbot


KASAN: slab-out-of-bounds Read in pfkey_add

Status: public: reported C repro on 2019/04/12 00:00
Reported-by: syzbot+8f5b83a44c53b7c8bef9@syzkaller.appspotmail.com
First crash: 2536d, last: 2350d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in pfkey_add net C 835 2385d 2532d 5/28 fixed on 2018/05/17 10:02
android-44 KASAN: slab-out-of-bounds Read in pfkey_add C 290 2350d 2050d 0/2 public: reported C repro on 2019/04/12 00:00

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in pfkey_msg2xfrm_state net/key/af_key.c:1188 [inline]
BUG: KASAN: slab-out-of-bounds in pfkey_add+0x2565/0x3240 net/key/af_key.c:1506
Read of size 8192 at addr ffff8801b7436f40 by task syzkaller362258/3784

CPU: 0 PID: 3784 Comm: syzkaller362258 Not tainted 4.9.93-gcb02358 #2
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801d900f6e0 ffffffff81d9c249 ffffea0006dd0d80 ffff8801b7436f40
 0000000000000000 ffff8801b7437100 ffff8801b7436f00 ffff8801d900f718
 ffffffff8156533b ffff8801b7436f40 0000000000002000 0000000000000000
Call Trace:
 [<ffffffff81d9c249>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d9c249>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff8156533b>] print_address_description+0x6c/0x234 mm/kasan/report.c:256
 [<ffffffff815655af>] kasan_report_error mm/kasan/report.c:355 [inline]
 [<ffffffff815655af>] kasan_report.cold.6+0xac/0x2f5 mm/kasan/report.c:412
 [<ffffffff8153822f>] check_memory_region_inline mm/kasan/kasan.c:318 [inline]
 [<ffffffff8153822f>] check_memory_region+0x14f/0x1b0 mm/kasan/kasan.c:325
 [<ffffffff81538873>] memcpy+0x23/0x50 mm/kasan/kasan.c:360
 [<ffffffff8358c795>] pfkey_msg2xfrm_state net/key/af_key.c:1188 [inline]
 [<ffffffff8358c795>] pfkey_add+0x2565/0x3240 net/key/af_key.c:1506
 [<ffffffff83582ec1>] pfkey_process+0x671/0x740 net/key/af_key.c:2834
 [<ffffffff835846e6>] pfkey_sendmsg+0x346/0xae0 net/key/af_key.c:3678
 [<ffffffff82ef3fcc>] sock_sendmsg_nosec net/socket.c:635 [inline]
 [<ffffffff82ef3fcc>] sock_sendmsg+0xcc/0x110 net/socket.c:645
 [<ffffffff82ef5a6c>] ___sys_sendmsg+0x6fc/0x840 net/socket.c:1969
 [<ffffffff82ef7ad9>] __sys_sendmsg+0xd9/0x190 net/socket.c:2003
 [<ffffffff82ef7bbd>] SYSC_sendmsg net/socket.c:2014 [inline]
 [<ffffffff82ef7bbd>] SyS_sendmsg+0x2d/0x50 net/socket.c:2010
 [<ffffffff81006316>] do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 [<ffffffff838d5953>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Allocated by task 3784:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:609
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:547
 slab_post_alloc_hook mm/slab.h:417 [inline]
 slab_alloc_node mm/slub.c:2715 [inline]
 slab_alloc mm/slub.c:2723 [inline]
 __kmalloc_track_caller+0xdc/0x2b0 mm/slub.c:4232
 __kmalloc_reserve.isra.37+0x33/0xc0 net/core/skbuff.c:138
 __alloc_skb+0x11a/0x600 net/core/skbuff.c:231
 alloc_skb include/linux/skbuff.h:919 [inline]
 pfkey_sendmsg+0xfe/0xae0 net/key/af_key.c:3665
 sock_sendmsg_nosec net/socket.c:635 [inline]
 sock_sendmsg+0xcc/0x110 net/socket.c:645
 ___sys_sendmsg+0x6fc/0x840 net/socket.c:1969
 __sys_sendmsg+0xd9/0x190 net/socket.c:2003
 SYSC_sendmsg net/socket.c:2014 [inline]
 SyS_sendmsg+0x2d/0x50 net/socket.c:2010
 do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Freed by task 2013:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:582
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kfree+0xfb/0x310 mm/slub.c:3878
 kernfs_fop_release+0xff/0x140 fs/kernfs/file.c:744
 __fput+0x263/0x700 fs/file_table.c:208
 ____fput+0x15/0x20 fs/file_table.c:244
 task_work_run+0x10c/0x180 kernel/task_work.c:116
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0xfc/0x120 arch/x86/entry/common.c:161
 prepare_exit_to_usermode arch/x86/entry/common.c:191 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:260 [inline]
 do_syscall_64+0x364/0x490 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

The buggy address belongs to the object at ffff8801b7436f00
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 64 bytes inside of
 512-byte region [ffff8801b7436f00, ffff8801b7437100)
The buggy address belongs to the page:
page:ffffea0006dd0d80 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x8000000000004080(slab|head)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801b7437000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8801b7437080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8801b7437100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff8801b7437180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b7437200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3155):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/04/13 15:57 https://android.googlesource.com/kernel/common android-4.9 cb023581bd03 0a0c5db6 .config console log report syz C ci-android-49-kasan-gce
2018/04/05 16:58 https://android.googlesource.com/kernel/common android-4.9 7cd956196346 5e1ccffc .config console log report syz C ci-android-49-kasan-gce
2018/03/20 08:57 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 7e7d7ed2 .config console log report syz C ci-android-49-kasan-gce
2018/03/10 21:39 https://android.googlesource.com/kernel/common android-4.9 00db063b0f88 36d1c454 .config console log report syz C ci-android-49-kasan-gce
2018/03/08 19:13 https://android.googlesource.com/kernel/common android-4.9 00db063b0f88 acd0caa5 .config console log report syz C ci-android-49-kasan-gce
2018/02/25 18:08 https://android.googlesource.com/kernel/common android-4.9 a92bb8d6eac3 9fe8aa42 .config console log report syz C ci-android-49-kasan-gce
2018/01/11 10:43 https://android.googlesource.com/kernel/common android-4.9 91549408ceb8 02a19b64 .config console log report syz C ci-android-49-kasan-gce-386
2018/01/07 08:22 https://android.googlesource.com/kernel/common android-4.9 5f5e5d4041e3 19c05fff .config console log report syz C ci-android-49-kasan-gce-386
2018/01/05 21:51 https://android.googlesource.com/kernel/common android-4.9 173c52eae928 00193447 .config console log report syz C ci-android-49-kasan-gce-386
2018/01/04 21:57 https://android.googlesource.com/kernel/common android-4.9 173c52eae928 00193447 .config console log report syz C ci-android-49-kasan-gce-386
2018/01/04 05:37 https://android.googlesource.com/kernel/common android-4.9 4406671f9ec8 00193447 .config console log report syz C ci-android-49-kasan-gce-386
2018/01/03 06:13 https://android.googlesource.com/kernel/common android-4.9 9e5dd8ed9b9b 00193447 .config console log report syz C ci-android-49-kasan-gce-386
2018/01/03 05:18 https://android.googlesource.com/kernel/common android-4.9 9e5dd8ed9b9b 00193447 .config console log report syz C ci-android-49-kasan-gce-386
2017/12/29 00:34 https://android.googlesource.com/kernel/common android-4.9 cb7518e6167c 7d240098 .config console log report syz C ci-android-49-kasan-gce
2017/12/20 16:53 https://android.googlesource.com/kernel/common android-4.9 319c8e1bc7a1 90a46995 .config console log report syz C ci-android-49-kasan-gce
2017/12/18 02:01 https://android.googlesource.com/kernel/common android-4.9 3f1d77ca5f8f d5beb42a .config console log report syz C ci-android-49-kasan-gce
2017/12/15 09:10 https://android.googlesource.com/kernel/common android-4.9 3f1d77ca5f8f ac20b98c .config console log report syz C ci-android-49-kasan-gce
2017/12/14 11:07 https://android.googlesource.com/kernel/common android-4.9 3f1d77ca5f8f ac20b98c .config console log report syz C ci-android-49-kasan-gce
2017/12/12 16:16 https://android.googlesource.com/kernel/common android-4.9 fb66dc2a6e5e 414a185f .config console log report syz C ci-android-49-kasan-gce
2017/12/12 14:01 https://android.googlesource.com/kernel/common android-4.9 fb66dc2a6e5e 32f694fc .config console log report syz C ci-android-49-kasan-gce
2018/02/25 18:48 https://android.googlesource.com/kernel/common android-4.9 a92bb8d6eac3 9fe8aa42 .config console log report syz C ci-android-49-kasan-gce-386
2018/04/13 15:58 https://android.googlesource.com/kernel/common android-4.9 cb023581bd03 0a0c5db6 .config console log report syz ci-android-49-kasan-gce-386
2018/04/05 16:58 https://android.googlesource.com/kernel/common android-4.9 7cd956196346 5e1ccffc .config console log report syz ci-android-49-kasan-gce-386
2018/03/20 08:59 https://android.googlesource.com/kernel/common android-4.9 71df7bbae4d8 7e7d7ed2 .config console log report syz ci-android-49-kasan-gce-386
2018/03/10 23:02 https://android.googlesource.com/kernel/common android-4.9 00db063b0f88 36d1c454 .config console log report syz ci-android-49-kasan-gce-386
2018/03/08 19:15 https://android.googlesource.com/kernel/common android-4.9 00db063b0f88 acd0caa5 .config console log report syz ci-android-49-kasan-gce-386
2018/06/16 04:46 https://android.googlesource.com/kernel/common android-4.9 b7d377b4640b 27c5f59f .config console log report ci-android-49-kasan-gce
2018/06/15 22:32 https://android.googlesource.com/kernel/common android-4.9 b7d377b4640b 27c5f59f .config console log report ci-android-49-kasan-gce
2018/06/15 20:29 https://android.googlesource.com/kernel/common android-4.9 b7d377b4640b 27c5f59f .config console log report ci-android-49-kasan-gce
2018/06/15 18:32 https://android.googlesource.com/kernel/common android-4.9 b7d377b4640b 27c5f59f .config console log report ci-android-49-kasan-gce
2018/06/15 10:07 https://android.googlesource.com/kernel/common android-4.9 b7d377b4640b 27c5f59f .config console log report ci-android-49-kasan-gce
2018/06/14 22:36 https://android.googlesource.com/kernel/common android-4.9 b7d377b4640b 27c5f59f .config console log report ci-android-49-kasan-gce
2018/06/14 07:00 https://android.googlesource.com/kernel/common android-4.9 b7d377b4640b 27c5f59f .config console log report ci-android-49-kasan-gce
2018/06/13 23:55 https://android.googlesource.com/kernel/common android-4.9 b7d377b4640b 27c5f59f .config console log report ci-android-49-kasan-gce
2018/06/13 18:14 https://android.googlesource.com/kernel/common android-4.9 b7d377b4640b 27c5f59f .config console log report ci-android-49-kasan-gce
2018/06/13 05:37 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 6dcbc435 .config console log report ci-android-49-kasan-gce
2018/06/12 20:06 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 6dcbc435 .config console log report ci-android-49-kasan-gce
2018/06/12 17:34 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 598eb192 .config console log report ci-android-49-kasan-gce
2018/06/12 10:30 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 112eec79 .config console log report ci-android-49-kasan-gce-root
2018/06/12 04:48 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 112eec79 .config console log report ci-android-49-kasan-gce-root
2018/06/12 01:14 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 112eec79 .config console log report ci-android-49-kasan-gce
2018/06/11 19:47 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b ae8bdb50 .config console log report ci-android-49-kasan-gce-root
2018/06/11 15:40 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b ae8bdb50 .config console log report ci-android-49-kasan-gce
2018/06/10 23:15 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 866118af .config console log report ci-android-49-kasan-gce
2018/06/10 15:56 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 866118af .config console log report ci-android-49-kasan-gce
2018/06/09 16:40 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 866118af .config console log report ci-android-49-kasan-gce
2018/06/09 14:37 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 866118af .config console log report ci-android-49-kasan-gce
2018/06/09 03:23 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 866118af .config console log report ci-android-49-kasan-gce
2018/06/08 15:56 https://android.googlesource.com/kernel/common android-4.9 42a730adb6e2 f7b27b7a .config console log report ci-android-49-kasan-gce
2018/06/08 13:00 https://android.googlesource.com/kernel/common android-4.9 42a730adb6e2 f7b27b7a .config console log report ci-android-49-kasan-gce
2018/06/07 11:06 https://android.googlesource.com/kernel/common android-4.9 42a730adb6e2 d2ba33fa .config console log report ci-android-49-kasan-gce
2018/06/07 02:04 https://android.googlesource.com/kernel/common android-4.9 42a730adb6e2 e0e534c6 .config console log report ci-android-49-kasan-gce
2018/06/06 15:14 https://android.googlesource.com/kernel/common android-4.9 54f1dc05da62 41f9540d .config console log report ci-android-49-kasan-gce-root
2018/06/05 09:22 https://android.googlesource.com/kernel/common android-4.9 dbe0f6122097 a316ff92 .config console log report ci-android-49-kasan-gce
2018/06/04 15:39 https://android.googlesource.com/kernel/common android-4.9 61aafb6b6e40 6cbe7c26 .config console log report ci-android-49-kasan-gce
2018/06/04 05:19 https://android.googlesource.com/kernel/common android-4.9 d7e64f8022e4 2f93b54f .config console log report ci-android-49-kasan-gce
2018/06/03 11:52 https://android.googlesource.com/kernel/common android-4.9 d7e64f8022e4 2f93b54f .config console log report ci-android-49-kasan-gce
2018/06/03 04:20 https://android.googlesource.com/kernel/common android-4.9 d7e64f8022e4 2f93b54f .config console log report ci-android-49-kasan-gce
2018/06/03 01:45 https://android.googlesource.com/kernel/common android-4.9 d7e64f8022e4 2f93b54f .config console log report ci-android-49-kasan-gce
2018/06/14 18:06 https://android.googlesource.com/kernel/common android-4.9 b7d377b4640b 27c5f59f .config console log report ci-android-49-kasan-gce-386
2018/06/12 11:31 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 112eec79 .config console log report ci-android-49-kasan-gce-386
2018/06/11 08:21 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 866118af .config console log report ci-android-49-kasan-gce-386
2018/06/11 01:34 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 866118af .config console log report ci-android-49-kasan-gce-386
2018/06/09 08:34 https://android.googlesource.com/kernel/common android-4.9 db2c520bb56b 866118af .config console log report ci-android-49-kasan-gce-386
2018/06/06 06:47 https://android.googlesource.com/kernel/common android-4.9 8b94b87fe783 863a24bb .config console log report ci-android-49-kasan-gce-386
2018/06/06 01:41 https://android.googlesource.com/kernel/common android-4.9 8b94b87fe783 863a24bb .config console log report ci-android-49-kasan-gce-386
2018/06/05 06:50 https://android.googlesource.com/kernel/common android-4.9 61aafb6b6e40 a50d873b .config console log report ci-android-49-kasan-gce-386
2018/06/04 09:14 https://android.googlesource.com/kernel/common android-4.9 d7e64f8022e4 6cbe7c26 .config console log report ci-android-49-kasan-gce-386
2018/06/03 23:38 https://android.googlesource.com/kernel/common android-4.9 d7e64f8022e4 2f93b54f .config console log report ci-android-49-kasan-gce-386
2018/06/03 13:45 https://android.googlesource.com/kernel/common android-4.9 d7e64f8022e4 2f93b54f .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.