syzbot


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

Status: closed as invalid on 2019/01/01 20:10
First crash: 2659d, last: 2526d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-44 KASAN: slab-out-of-bounds Read in pfkey_compile_policy C 2 2526d 2048d 0/2 public: reported C repro on 2019/04/14 00:00

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in pfkey_sadb2xfrm_user_sec_ctx net/key/af_key.c:474 [inline]
BUG: KASAN: slab-out-of-bounds in pfkey_compile_policy+0x8e6/0xd40 net/key/af_key.c:3306
Read of size 1280 at addr ffff8801ca354658 by task syzkaller883765/3324

CPU: 0 PID: 3324 Comm: syzkaller883765 Not tainted 4.9.71-g2506378 #9
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801c927f818 ffffffff81d922b9 ffffea000728d500 ffff8801ca354658
 0000000000000000 ffff8801ca354700 ffff8801c89b2200 ffff8801c927f850
 ffffffff8153bab3 ffff8801ca354658 0000000000000500 0000000000000000
Call Trace:
 [<ffffffff81d922b9>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d922b9>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff8153bab3>] print_address_description+0x73/0x280 mm/kasan/report.c:252
 [<ffffffff8153bfd5>] kasan_report_error mm/kasan/report.c:351 [inline]
 [<ffffffff8153bfd5>] kasan_report+0x275/0x360 mm/kasan/report.c:408
 [<ffffffff8153a9e7>] check_memory_region_inline mm/kasan/kasan.c:318 [inline]
 [<ffffffff8153a9e7>] check_memory_region+0x137/0x190 mm/kasan/kasan.c:325
 [<ffffffff8153af23>] memcpy+0x23/0x50 mm/kasan/kasan.c:360
 [<ffffffff83579c16>] pfkey_sadb2xfrm_user_sec_ctx net/key/af_key.c:474 [inline]
 [<ffffffff83579c16>] pfkey_compile_policy+0x8e6/0xd40 net/key/af_key.c:3306
 [<ffffffff833d2ece>] xfrm_user_policy+0x2fe/0x530 net/xfrm/xfrm_state.c:1907
 [<ffffffff8320d577>] do_ip_setsockopt.isra.12+0x1977/0x2960 net/ipv4/ip_sockglue.c:1151
 [<ffffffff8320e65f>] compat_ip_setsockopt+0x4f/0xf0 net/ipv4/ip_sockglue.c:1269
 [<ffffffff83217be5>] inet_csk_compat_setsockopt+0x95/0x120 net/ipv4/inet_connection_sock.c:914
 [<ffffffff8322df7d>] compat_tcp_setsockopt+0x3d/0x70 net/ipv4/tcp.c:2747
 [<ffffffff82edb362>] compat_sock_common_setsockopt+0xb2/0x140 net/core/sock.c:2717
 [<ffffffff82fda9f9>] C_SYSC_setsockopt net/compat.c:398 [inline]
 [<ffffffff82fda9f9>] compat_SyS_setsockopt+0x149/0x290 net/compat.c:381
 [<ffffffff81006fc7>] do_syscall_32_irqs_on arch/x86/entry/common.c:322 [inline]
 [<ffffffff81006fc7>] do_fast_syscall_32+0x2f7/0x890 arch/x86/entry/common.c:384
 [<ffffffff838b05e1>] entry_SYSENTER_compat+0x51/0x60 arch/x86/entry/entry_64_compat.S:124

Allocated by task 3324:
 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+0xad/0xe0 mm/kasan/kasan.c:609
 __kmalloc+0x11d/0x310 mm/slub.c:3741
 kmalloc include/linux/slab.h:495 [inline]
 xfrm_user_policy+0xc1/0x530 net/xfrm/xfrm_state.c:1896
 do_ip_setsockopt.isra.12+0x1977/0x2960 net/ipv4/ip_sockglue.c:1151
 compat_ip_setsockopt+0x4f/0xf0 net/ipv4/ip_sockglue.c:1269
 inet_csk_compat_setsockopt+0x95/0x120 net/ipv4/inet_connection_sock.c:914
 compat_tcp_setsockopt+0x3d/0x70 net/ipv4/tcp.c:2747
 compat_sock_common_setsockopt+0xb2/0x140 net/core/sock.c:2717
 C_SYSC_setsockopt net/compat.c:398 [inline]
 compat_SyS_setsockopt+0x149/0x290 net/compat.c:381
 do_syscall_32_irqs_on arch/x86/entry/common.c:322 [inline]
 do_fast_syscall_32+0x2f7/0x890 arch/x86/entry/common.c:384
 entry_SYSENTER_compat+0x51/0x60 arch/x86/entry/entry_64_compat.S:124

Freed by task 1798:
 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+0x103/0x300 mm/slub.c:3878
 seq_release+0x59/0x70 fs/seq_file.c:372
 kernfs_fop_release+0xcb/0x140 fs/kernfs/file.c:742
 __fput+0x28c/0x6e0 fs/file_table.c:208
 ____fput+0x15/0x20 fs/file_table.c:244
 task_work_run+0x115/0x190 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:160
 prepare_exit_to_usermode arch/x86/entry/common.c:190 [inline]
 syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
 entry_SYSCALL_64_fastpath+0xc4/0xc6

The buggy address belongs to the object at ffff8801ca354640
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 24 bytes inside of
 256-byte region [ffff8801ca354640, ffff8801ca354740)
The buggy address belongs to the page:
page:ffffea000728d500 count:1 mapcount:0 mapping:          (null) index:0xffff8801ca354dc0
flags: 0x8000000000000080(slab)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801ca354600: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
 ffff8801ca354680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8801ca354700: 02 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff8801ca354780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801ca354800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/12/22 06:38 https://android.googlesource.com/kernel/common android-4.9 250637879165 81fe66b4 .config console log report syz C ci-android-49-kasan-gce-386
2017/12/16 04:54 https://android.googlesource.com/kernel/common android-4.9 3f1d77ca5f8f ac20b98c .config console log report syz C ci-android-49-kasan-gce-386
2017/12/10 15:57 https://android.googlesource.com/kernel/common android-4.9 f26d3c76d376 5ad0ce95 .config console log report syz C ci-android-49-kasan-gce-386
2017/08/11 14:44 https://android.googlesource.com/kernel/common android-4.9 72a8dae2c25d 125de3e4 .config console log report syz C ci-android-49-kasan-gce
2017/12/08 23:19 https://android.googlesource.com/kernel/common android-4.9 f26d3c76d376 5ad0ce95 .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.