syzbot


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

Status: public: reported C repro on 2019/04/12 00:00
Reported-by: syzbot+d16e3013eebf32b558d5@syzkaller.appspotmail.com
First crash: 2057d, last: 1928d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in skb_ensure_writable bpf net C 9 2143d 2152d 8/26 fixed on 2018/07/09 18:05

Sample crash report:
audit: type=1400 audit(1536336670.610:8): avc:  denied  { prog_load } for  pid=1785 comm="syz-executor720" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=bpf permissive=1
audit: type=1400 audit(1536336670.660:9): avc:  denied  { prog_run } for  pid=1785 comm="syz-executor720" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=bpf permissive=1
==================================================================
BUG: KASAN: slab-out-of-bounds in skb_headlen include/linux/skbuff.h:1893 [inline]
BUG: KASAN: slab-out-of-bounds in pskb_may_pull include/linux/skbuff.h:2107 [inline]
BUG: KASAN: slab-out-of-bounds in skb_ensure_writable+0x290/0x2e0 net/core/skbuff.c:5001
Read of size 4 at addr ffff8801d016dc38 by task syz-executor720/1785

CPU: 0 PID: 1785 Comm: syz-executor720 Not tainted 4.14.68+ #4
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0xb9/0x11b lib/dump_stack.c:53
 print_address_description+0x60/0x22b mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report.cold.6+0x11b/0x2dd mm/kasan/report.c:409
 skb_headlen include/linux/skbuff.h:1893 [inline]
 pskb_may_pull include/linux/skbuff.h:2107 [inline]
 skb_ensure_writable+0x290/0x2e0 net/core/skbuff.c:5001
 __bpf_try_make_writable net/core/filter.c:1403 [inline]
 bpf_try_make_writable net/core/filter.c:1409 [inline]
 ____bpf_l4_csum_replace net/core/filter.c:1578 [inline]
 bpf_l4_csum_replace+0x61/0x300 net/core/filter.c:1565
 ___bpf_prog_run+0x248e/0x5c70 kernel/bpf/core.c:1012

Allocated by task 191:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc.part.1+0x4f/0xd0 mm/kasan/kasan.c:551
 slab_post_alloc_hook mm/slab.h:442 [inline]
 slab_alloc_node mm/slub.c:2723 [inline]
 slab_alloc mm/slub.c:2731 [inline]
 kmem_cache_alloc+0xe4/0x2b0 mm/slub.c:2736
 kmem_cache_alloc_node include/linux/slab.h:361 [inline]
 __alloc_skb+0xd8/0x550 net/core/skbuff.c:193
 alloc_skb include/linux/skbuff.h:975 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1158 [inline]
 netlink_sendmsg+0x94b/0xbe0 net/netlink/af_netlink.c:1852
 sock_sendmsg_nosec net/socket.c:645 [inline]
 sock_sendmsg+0xb5/0x100 net/socket.c:655
 ___sys_sendmsg+0x741/0x890 net/socket.c:2061
 __sys_sendmsg+0xca/0x170 net/socket.c:2095
 SYSC_sendmsg net/socket.c:2106 [inline]
 SyS_sendmsg+0x27/0x40 net/socket.c:2102
 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 258:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xac/0x190 mm/kasan/kasan.c:524
 slab_free_hook mm/slub.c:1389 [inline]
 slab_free_freelist_hook mm/slub.c:1410 [inline]
 slab_free mm/slub.c:2966 [inline]
 kmem_cache_free+0x12d/0x350 mm/slub.c:2988
 kfree_skbmem+0x9e/0x100 net/core/skbuff.c:582
 __kfree_skb net/core/skbuff.c:642 [inline]
 consume_skb+0xc9/0x330 net/core/skbuff.c:701
 skb_free_datagram+0x15/0xd0 net/core/datagram.c:331
 netlink_recvmsg+0x569/0xd10 net/netlink/af_netlink.c:1956
 sock_recvmsg_nosec net/socket.c:818 [inline]
 sock_recvmsg+0xc0/0x100 net/socket.c:825
 ___sys_recvmsg+0x242/0x510 net/socket.c:2220
 __sys_recvmsg+0xc7/0x170 net/socket.c:2265
 SYSC_recvmsg net/socket.c:2277 [inline]
 SyS_recvmsg+0x27/0x40 net/socket.c:2272
 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801d016db40
 which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 24 bytes to the right of
 224-byte region [ffff8801d016db40, ffff8801d016dc20)
The buggy address belongs to the page:
page:ffffea0007405b40 count:1 mapcount:0 mapping:          (null) index:0x0
flags: 0x4000000000000100(slab)
raw: 4000000000000100 0000000000000000 0000000000000000 00000001800c000c
raw: ffffea0007400140 0000000700000007 ffff8801dab70200 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d016db00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8801d016db80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801d016dc00: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
                                        ^
 ffff8801d016dc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d016dd00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/09/07 16:13 android-4.14 b859aa7d7a0c 69cfeb80 .config console log report syz C ci-android-414-kasan-gce-root
2018/09/07 09:44 android-4.14 b859aa7d7a0c e30d3b52 .config console log report syz C ci-android-414-kasan-gce-root
2019/01/13 20:17 android-4.14 da2880fa47ec c3f3344c .config console log report ci-android-414-kasan-gce-root
2018/11/19 14:55 android-4.14 4e76528bd48d adf636a8 .config console log report ci-android-414-kasan-gce-root
2018/11/18 16:05 android-4.14 4e76528bd48d adf636a8 .config console log report ci-android-414-kasan-gce-root
2018/11/16 11:00 android-4.14 4e76528bd48d f5e275d1 .config console log report ci-android-414-kasan-gce-root
2018/11/12 14:14 android-4.14 494c2659e60e 7b5f8621 .config console log report ci-android-414-kasan-gce-root
2018/10/23 04:45 android-4.14 a3ac63b18873 ecb386fe .config console log report ci-android-414-kasan-gce-root
2018/09/22 04:25 android-4.14 666c420fa3ea 37079712 .config console log report ci-android-414-kasan-gce-root
2018/09/07 08:22 android-4.14 b859aa7d7a0c e30d3b52 .config console log report ci-android-414-kasan-gce-root
* Struck through repros no longer work on HEAD.