syzbot


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

Status: fixed on 2018/02/01 10:32
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+c028095236fcb6f4348811565b75084c754dc729@syzkaller.appspotmail.com
Fix commit: 862591bf4f51 xfrm: skip policies marked as dead while rehashing
First crash: 2364d, last: 2293d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 KASAN: slab-out-of-bounds Read in xfrm_hash_rebuild C 4 2301d 1839d 0/3 public: reported C repro on 2019/04/14 00:00

Sample crash report:
audit: type=1400 audit(1515303264.277:7): avc:  denied  { map } for  pid=3469 comm="syzkaller049371" path="/root/syzkaller049371331" dev="sda1" ino=16481 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: slab-out-of-bounds in xfrm_hash_rebuild+0xdbe/0xf00 net/xfrm/xfrm_policy.c:618
Read of size 2 at addr ffff8801c0b61c64 by task kworker/1:1/24

CPU: 1 PID: 24 Comm: kworker/1:1 Not tainted 4.15.0-rc6+ #250
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events xfrm_hash_rebuild
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_load2_noabort+0x14/0x20 mm/kasan/report.c:428
 xfrm_hash_rebuild+0xdbe/0xf00 net/xfrm/xfrm_policy.c:618
 process_one_work+0xbbf/0x1b10 kernel/workqueue.c:2112
 worker_thread+0x223/0x1990 kernel/workqueue.c:2246
 kthread+0x33c/0x400 kernel/kthread.c:238
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:524

Allocated by task 3469:
 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:3708 [inline]
 __kmalloc+0x162/0x760 mm/slab.c:3717
 kmalloc include/linux/slab.h:504 [inline]
 sk_prot_alloc+0x101/0x2a0 net/core/sock.c:1469
 sk_alloc+0x105/0x1410 net/core/sock.c:1523
 pfkey_create+0x2b2/0xae0 net/key/af_key.c:158
 __sock_create+0x4d4/0x850 net/socket.c:1265
 sock_create net/socket.c:1305 [inline]
 SYSC_socket net/socket.c:1335 [inline]
 SyS_socket+0xeb/0x1d0 net/socket.c:1315
 entry_SYSCALL_64_fastpath+0x23/0x9a

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8801c0b61740
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 1316 bytes inside of
 2048-byte region [ffff8801c0b61740, ffff8801c0b61f40)
The buggy address belongs to the page:
page:ffffea000702d800 count:1 mapcount:0 mapping:ffff8801c0b60640 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801c0b60640 0000000000000000 0000000100000003
raw: ffffea00070123a0 ffff8801dac01948 ffff8801dac00c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801c0b61b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8801c0b61b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8801c0b61c00: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc
                                                       ^
 ffff8801c0b61c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801c0b61d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (18):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/01/07 05:36 upstream 3219e264b984 19c05fff .config console log report syz C ci-upstream-kasan-gce
2017/12/21 14:38 upstream d1ce8ceb8ba8 eaadba98 .config console log report syz C ci-upstream-kasan-gce
2018/01/07 05:35 net-next-old d0adb51edb73 19c05fff .config console log report syz C ci-upstream-net-kasan-gce
2017/12/21 13:47 net-next-old 8f36e0006543 eaadba98 .config console log report syz C ci-upstream-net-kasan-gce
2017/11/04 11:00 mmots 0f611fb6dcc0 e0a2b195 .config console log report syz ci-upstream-mmots-kasan-gce
2018/01/14 12:34 upstream 2c1cfa499018 c9e7aeae .config console log report ci-upstream-kasan-gce
2018/01/11 16:39 upstream 5f615b97cdea 9dc808a6 .config console log report ci-upstream-kasan-gce
2018/01/01 05:44 upstream 30a7acd57389 00193447 .config console log report ci-upstream-kasan-gce
2017/12/25 02:03 upstream 464e1d5f23cc 73aba437 .config console log report ci-upstream-kasan-gce
2018/01/03 12:34 net-next-old 72bca2084a21 00193447 .config console log report ci-upstream-net-kasan-gce
2017/12/31 15:58 net-next-old 6bb8824732f6 00193447 .config console log report ci-upstream-net-kasan-gce
2017/12/31 13:20 net-next-old 6bb8824732f6 00193447 .config console log report ci-upstream-net-kasan-gce
2017/12/28 18:27 net-next-old 836df24a7062 7d240098 .config console log report ci-upstream-net-kasan-gce
2017/12/26 08:47 net-next-old fba961ab29e5 73aba437 .config console log report ci-upstream-net-kasan-gce
2017/12/25 14:47 net-next-old fba961ab29e5 73aba437 .config console log report ci-upstream-net-kasan-gce
2017/12/25 09:54 net-next-old fba961ab29e5 73aba437 .config console log report ci-upstream-net-kasan-gce
2017/12/21 13:29 net-next-old 8f36e0006543 eaadba98 .config console log report ci-upstream-net-kasan-gce
2017/11/04 10:31 mmots 0f611fb6dcc0 e0a2b195 .config console log report ci-upstream-mmots-kasan-gce
* Struck through repros no longer work on HEAD.