syzbot


KASAN: use-after-free Read in xfrm6_tunnel_destroy

Status: public: reported C repro on 2019/04/10 15:44
Reported-by: syzbot+3a9fa82e5fb13514eb32@syzkaller.appspotmail.com
First crash: 2228d, last: 1767d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-44 KASAN: use-after-free Read in xfrm6_tunnel_destroy (2) 1 1851d 1851d 0/2 auto-closed as invalid on 2020/01/08 12:52
android-44 KASAN: use-after-free Read in xfrm6_tunnel_destroy 4 2101d 2001d 0/2 auto-closed as invalid on 2019/07/02 12:36
linux-4.14 KASAN: use-after-free Read in xfrm6_tunnel_destroy C error 1692 975d 2003d 0/1 upstream: reported C repro on 2019/04/12 04:12
android-49 KASAN: use-after-free Read in xfrm6_tunnel_destroy C 36181 1767d 2003d 0/3 public: reported C repro on 2019/04/12 00:00

Sample crash report:
audit: type=1400 audit(1574392809.204:10): avc:  denied  { read } for  pid=1830 comm="syz-executor922" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=1
==================================================================
BUG: KASAN: use-after-free in xfrm6_tunnel_free_spi net/ipv6/xfrm6_tunnel.c:208 [inline]
BUG: KASAN: use-after-free in xfrm6_tunnel_destroy+0x4e0/0x560 net/ipv6/xfrm6_tunnel.c:303
Read of size 8 at addr ffff8881d24e80b8 by task kworker/0:2/71

CPU: 0 PID: 71 Comm: kworker/0:2 Not tainted 4.14.155-syzkaller #0
Workqueue: events xfrm_state_gc_task
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0xe5/0x154 lib/dump_stack.c:58
 print_address_description+0x60/0x226 mm/kasan/report.c:187
 __kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316
 xfrm6_tunnel_free_spi net/ipv6/xfrm6_tunnel.c:208 [inline]
 xfrm6_tunnel_destroy+0x4e0/0x560 net/ipv6/xfrm6_tunnel.c:303
 xfrm_state_gc_destroy net/xfrm/xfrm_state.c:449 [inline]
 xfrm_state_gc_task+0x3d6/0x550 net/xfrm/xfrm_state.c:470
 process_one_work+0x7f1/0x1580 kernel/workqueue.c:2134
 worker_thread+0xdd/0xdf0 kernel/workqueue.c:2271
 kthread+0x31f/0x430 kernel/kthread.c:232
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:404

Allocated by task 1830:
 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
 kmalloc include/linux/slab.h:493 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 ops_init+0xee/0x3f0 net/core/net_namespace.c:108
 setup_net+0x259/0x550 net/core/net_namespace.c:295
 copy_net_ns+0x195/0x480 net/core/net_namespace.c:419
 create_new_namespaces+0x373/0x760 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xa5/0x1e0 kernel/nsproxy.c:206
 SYSC_unshare kernel/fork.c:2543 [inline]
 SyS_unshare+0x34e/0x6c0 kernel/fork.c:2493
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
 0xffffffffffffffff

Freed by task 366:
 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]
 kfree+0x108/0x3a0 mm/slub.c:3976
 ops_free net/core/net_namespace.c:132 [inline]
 ops_free_list.part.0+0x1f9/0x330 net/core/net_namespace.c:154
 ops_free_list net/core/net_namespace.c:152 [inline]
 cleanup_net+0x466/0x870 net/core/net_namespace.c:488
 process_one_work+0x7f1/0x1580 kernel/workqueue.c:2134
 worker_thread+0xdd/0xdf0 kernel/workqueue.c:2271
 kthread+0x31f/0x430 kernel/kthread.c:232
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:404
 0xffffffffffffffff

The buggy address belongs to the object at ffff8881d24e8000
 which belongs to the cache kmalloc-8192 of size 8192
The buggy address is located 184 bytes inside of
 8192-byte region [ffff8881d24e8000, ffff8881d24ea000)
The buggy address belongs to the page:
page:ffffea0007493a00 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 0000000000000000 0000000000000000 0000000100030003
raw: dead000000000100 dead000000000200 ffff8881d6402400 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d24e7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881d24e8000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881d24e8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff8881d24e8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881d24e8180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (34461):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/22 03:23 android-4.14 7bc77fd33905 8098ea0f .config console log report syz C ci-android-414-kasan-gce-root
2019/11/06 19:25 android-4.14 f7fedd5c15c1 da505f84 .config console log report syz C ci-android-414-kasan-gce-root
2019/10/20 21:18 android-4.14 234de92896af 8c88c9c1 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/29 23:31 android-4.14 d649ef04c3ed c1ad5441 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/08 15:30 android-4.14 4eccd8013349 a60cb4cd .config console log report syz C ci-android-414-kasan-gce-root
2019/09/08 05:54 android-4.14 4eccd8013349 a60cb4cd .config console log report syz C ci-android-414-kasan-gce-root
2019/09/02 00:33 android-4.14 a9d0871a562e bad3cce2 .config console log report syz C ci-android-414-kasan-gce-root
2019/04/28 22:05 android-4.14 ffa22221c473 b617407b .config console log report syz C ci-android-414-kasan-gce-root
2019/01/23 15:25 android-4.14 7af2b8dc5ab3 7cf3249c .config console log report syz C ci-android-414-kasan-gce-root
2019/01/21 02:19 android-4.14 5a76363f1262 fd37a550 .config console log report syz C ci-android-414-kasan-gce-root
2019/01/13 04:59 android-4.14 fab7352ca8d1 c3f3344c .config console log report syz C ci-android-414-kasan-gce-root
2019/01/09 23:50 android-4.14 2aee898fff5a 45c0c1b1 .config console log report syz C ci-android-414-kasan-gce-root
2019/01/06 04:12 android-4.14 3c207c880674 53be0a37 .config console log report syz C ci-android-414-kasan-gce-root
2018/09/04 17:04 android-4.14 47350a9f13c6 a4718693 .config console log report syz C ci-android-414-kasan-gce-root
2018/08/30 12:59 android-4.14 47350a9f13c6 6c7e9d3d .config console log report syz C ci-android-414-kasan-gce-root
2019/02/02 19:39 android-4.14 80d7b06534fa c198d5dd .config console log report syz ci-android-414-kasan-gce-root
2018/11/21 04:15 android-4.14 4e76528bd48d 9aca6b52 .config console log report syz ci-android-414-kasan-gce-root
2018/10/12 21:23 android-4.14 b7e40c3d444a caf12900 .config console log report syz ci-android-414-kasan-gce-root
2018/08/30 16:56 android-4.14 47350a9f13c6 938220fd .config console log report syz ci-android-414-kasan-gce-root
2019/12/04 01:04 android-4.14 e6b1fb0e83b2 ae13a849 .config console log report ci-android-414-kasan-gce-root
2019/12/03 20:56 android-4.14 e6b1fb0e83b2 ae13a849 .config console log report ci-android-414-kasan-gce-root
2019/12/03 16:38 android-4.14 e6b1fb0e83b2 ab342da3 .config console log report ci-android-414-kasan-gce-root
2019/12/03 15:30 android-4.14 e6b1fb0e83b2 ab342da3 .config console log report ci-android-414-kasan-gce-root
2019/12/03 14:23 android-4.14 e6b1fb0e83b2 ab342da3 .config console log report ci-android-414-kasan-gce-root
2019/12/03 12:36 android-4.14 e6b1fb0e83b2 ab342da3 .config console log report ci-android-414-kasan-gce-root
2019/12/03 11:26 android-4.14 e6b1fb0e83b2 ab342da3 .config console log report ci-android-414-kasan-gce-root
2019/12/03 10:26 android-4.14 e6b1fb0e83b2 ab342da3 .config console log report ci-android-414-kasan-gce-root
2019/12/03 08:34 android-4.14 e6b1fb0e83b2 ab342da3 .config console log report ci-android-414-kasan-gce-root
2019/12/02 23:01 android-4.14 e6b1fb0e83b2 ab342da3 .config console log report ci-android-414-kasan-gce-root
2019/12/02 19:28 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 18:10 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 18:10 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 17:04 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 15:56 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 14:33 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 12:16 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 11:11 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 10:10 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 08:56 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 07:05 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 02:41 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/02 01:05 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/01 23:20 android-4.14 13855a652bd5 f879db37 .config console log report ci-android-414-kasan-gce-root
2019/12/01 22:00 android-4.14 13855a652bd5 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 20:44 android-4.14 13855a652bd5 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 19:43 android-4.14 13855a652bd5 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 17:18 android-4.14 13855a652bd5 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 14:39 android-4.14 13855a652bd5 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 13:14 android-4.14 13855a652bd5 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 11:41 android-4.14 714ada7cabc7 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 10:06 android-4.14 714ada7cabc7 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 09:54 android-4.14 714ada7cabc7 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 08:04 android-4.14 714ada7cabc7 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 06:51 android-4.14 714ada7cabc7 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/12/01 05:26 android-4.14 714ada7cabc7 a76bf83f .config console log report ci-android-414-kasan-gce-root
2019/11/30 20:38 android-4.14 714ada7cabc7 3a75be00 .config console log report ci-android-414-kasan-gce-root
2019/11/30 19:24 android-4.14 714ada7cabc7 3a75be00 .config console log report ci-android-414-kasan-gce-root
2019/11/30 18:23 android-4.14 714ada7cabc7 3a75be00 .config console log report ci-android-414-kasan-gce-root
2019/11/30 17:26 android-4.14 714ada7cabc7 3a75be00 .config console log report ci-android-414-kasan-gce-root
2019/11/30 15:57 android-4.14 714ada7cabc7 3a75be00 .config console log report ci-android-414-kasan-gce-root
2018/08/30 04:27 android-4.14 47350a9f13c6 6c7e9d3d .config console log report ci-android-414-kasan-gce-root
* Struck through repros no longer work on HEAD.