syzbot


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

Status: public: reported C repro on 2019/04/12 00:01
Reported-by: syzbot+25cc165172a72f7091a6@syzkaller.appspotmail.com
First crash: 2247d, last: 1840d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in bpf_skb_change_head bpf net C 2 2352d 2352d 8/28 fixed on 2018/07/09 18:05
linux-4.14 KASAN: slab-out-of-bounds Read in bpf_skb_change_head C done 2 1793d 1862d 1/1 fixed on 2020/01/25 22:00

Sample crash report:
audit: type=1400 audit(1570155495.816:7): avc:  denied  { map } for  pid=1788 comm="syz-executor724" path="/root/syz-executor724887516" dev="sda1" ino=16482 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
audit: type=1400 audit(1570155495.816:8): avc:  denied  { prog_load } for  pid=1788 comm="syz-executor724" 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(1570155495.876:9): avc:  denied  { prog_run } for  pid=1788 comm="syz-executor724" 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 ____bpf_skb_change_head net/core/filter.c:2423 [inline]
BUG: KASAN: slab-out-of-bounds in bpf_skb_change_head+0x4ea/0x600 net/core/filter.c:2419
Read of size 4 at addr ffff8881d5a1bfb8 by task syz-executor724/1788

CPU: 0 PID: 1788 Comm: syz-executor724 Not tainted 4.14.146+ #0
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0xca/0x134 lib/dump_stack.c:53
 print_address_description+0x60/0x226 mm/kasan/report.c:187
 __kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316
 ____bpf_skb_change_head net/core/filter.c:2423 [inline]
 bpf_skb_change_head+0x4ea/0x600 net/core/filter.c:2419
 ___bpf_prog_run+0x2478/0x5510 kernel/bpf/core.c:1095

Allocated by task 1586:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_kmalloc.part.0+0x53/0xc0 mm/kasan/common.c:501
 slab_post_alloc_hook mm/slab.h:439 [inline]
 slab_alloc_node mm/slub.c:2792 [inline]
 slab_alloc mm/slub.c:2800 [inline]
 kmem_cache_alloc+0xee/0x360 mm/slub.c:2805
 kmem_cache_zalloc include/linux/slab.h:651 [inline]
 mmap_region+0x56e/0xfb0 mm/mmap.c:1700
 do_mmap+0x548/0xb80 mm/mmap.c:1510
 do_mmap_pgoff include/linux/mm.h:2209 [inline]
 vm_mmap_pgoff+0x177/0x1c0 mm/util.c:333
 SYSC_mmap_pgoff mm/mmap.c:1560 [inline]
 SyS_mmap_pgoff+0x146/0x1b0 mm/mmap.c:1518
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
 0xffffffffffffffff

Freed by task 1586:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_slab_free+0x164/0x210 mm/kasan/common.c:463
 slab_free_hook mm/slub.c:1407 [inline]
 slab_free_freelist_hook mm/slub.c:1458 [inline]
 slab_free mm/slub.c:3039 [inline]
 kmem_cache_free+0xd7/0x3b0 mm/slub.c:3055
 remove_vma+0x117/0x160 mm/mmap.c:177
 exit_mmap+0x2a0/0x440 mm/mmap.c:3083
 __mmput kernel/fork.c:940 [inline]
 mmput+0xeb/0x370 kernel/fork.c:961
 exit_mm kernel/exit.c:545 [inline]
 do_exit+0x905/0x2a20 kernel/exit.c:862
 do_group_exit+0x100/0x2e0 kernel/exit.c:978
 SYSC_exit_group kernel/exit.c:989 [inline]
 SyS_exit_group+0x19/0x20 kernel/exit.c:987
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
 0xffffffffffffffff

The buggy address belongs to the object at ffff8881d5a1be88
 which belongs to the cache vm_area_struct of size 184
The buggy address is located 120 bytes to the right of
 184-byte region [ffff8881d5a1be88, ffff8881d5a1bf40)
The buggy address belongs to the page:
page:ffffea00075686c0 count:1 mapcount:0 mapping:          (null) index:0x0
flags: 0x4000000000000200(slab)
raw: 4000000000000200 0000000000000000 0000000000000000 0000000100100010
raw: dead000000000100 dead000000000200 ffff8881da952a00 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d5a1be80: fc fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881d5a1bf00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8881d5a1bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                        ^
 ffff8881d5a1c000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881d5a1c080: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/10/04 02:21 android-4.14 199ab25eb006 fc17ba49 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/27 05:30 android-4.14 d649ef04c3ed 2f1548bc .config console log report syz C ci-android-414-kasan-gce-root
2018/09/26 20:09 android-4.14 5efa57938b62 455b6354 .config console log report syz C ci-android-414-kasan-gce-root
2019/11/08 15:56 android-4.14 f40abacc8ac0 1e35461e .config console log report ci-android-414-kasan-gce-root
2019/10/29 23:18 android-4.14 59eb65b24c35 5ea87a66 .config console log report ci-android-414-kasan-gce-root
2019/07/29 22:56 android-4.14 ff49f652efde f67095ee .config console log report ci-android-414-kasan-gce-root
2019/07/29 14:54 android-4.14 54fa720a6f32 c85e1c5b .config console log report ci-android-414-kasan-gce-root
2018/09/26 19:49 android-4.14 5efa57938b62 455b6354 .config console log report ci-android-414-kasan-gce-root
* Struck through repros no longer work on HEAD.