syzbot


KASAN: use-after-free Read in xfrm6_tunnel_destroy

Status: public: reported C repro on 2019/04/12 00:00
Reported-by: syzbot+49a4d7b80aef69caed04@syzkaller.appspotmail.com
First crash: 2534d, last: 1814d
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 1899d 1899d 0/2 auto-closed as invalid on 2020/01/08 12:52
android-414 KASAN: use-after-free Read in xfrm6_tunnel_destroy C 34461 1814d 2052d 0/1 public: reported C repro on 2019/04/10 15:44
android-44 KASAN: use-after-free Read in xfrm6_tunnel_destroy 4 2149d 2048d 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 1023d 2050d 0/1 upstream: reported C repro on 2019/04/12 04:12

Sample crash report:
audit: type=1400 audit(1574406311.429:7): avc:  denied  { read } for  pid=2050 comm="syz-executor045" 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+0x4f6/0x570 net/ipv6/xfrm6_tunnel.c:303
Read of size 8 at addr ffff8801cedf80b8 by task kworker/0:2/351

CPU: 0 PID: 351 Comm: kworker/0:2 Not tainted 4.9.202+ #0
Workqueue: events xfrm_state_gc_task
 ffff8801d51dfa60 ffffffff81b55d2b 0000000000000000 ffffea00073b7e00
 ffff8801cedf80b8 0000000000000008 ffffffff8277d3a6 ffff8801d51dfa98
 ffffffff8150c321 0000000000000000 ffff8801cedf80b8 ffff8801cedf80b8
Call Trace:
 [<000000006670cc3b>] __dump_stack lib/dump_stack.c:15 [inline]
 [<000000006670cc3b>] dump_stack+0xcb/0x130 lib/dump_stack.c:56
 [<000000005832fc63>] print_address_description+0x6f/0x23a mm/kasan/report.c:256
 [<000000002a393df0>] kasan_report_error mm/kasan/report.c:355 [inline]
 [<000000002a393df0>] kasan_report mm/kasan/report.c:413 [inline]
 [<000000002a393df0>] kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:397
 [<00000000efefe0d6>] __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:434
 [<000000008d39d227>] xfrm6_tunnel_free_spi net/ipv6/xfrm6_tunnel.c:208 [inline]
 [<000000008d39d227>] xfrm6_tunnel_destroy+0x4f6/0x570 net/ipv6/xfrm6_tunnel.c:303
 [<0000000059681c70>] xfrm_state_gc_destroy net/xfrm/xfrm_state.c:368 [inline]
 [<0000000059681c70>] xfrm_state_gc_task+0x3b9/0x520 net/xfrm/xfrm_state.c:388
 [<0000000046553ac4>] process_one_work+0x88b/0x1600 kernel/workqueue.c:2114
 [<000000007c369783>] worker_thread+0x5df/0x11d0 kernel/workqueue.c:2251
 [<00000000e32f0bde>] kthread+0x278/0x310 kernel/kthread.c:211
 [<000000009d2cb44d>] ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:375

Allocated by task 2055:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack mm/kasan/kasan.c:512 [inline]
 set_track mm/kasan/kasan.c:524 [inline]
 kasan_kmalloc.part.0+0x62/0xf0 mm/kasan/kasan.c:616
 kasan_kmalloc+0xb7/0xd0 mm/kasan/kasan.c:601
 __kmalloc+0x133/0x320 mm/slub.c:3741
 kmalloc include/linux/slab.h:495 [inline]
 kzalloc include/linux/slab.h:636 [inline]
 ops_init+0xf1/0x3a0 net/core/net_namespace.c:101
 setup_net+0x1c8/0x500 net/core/net_namespace.c:292
 copy_net_ns+0x191/0x340 net/core/net_namespace.c:409
 create_new_namespaces+0x37c/0x7a0 kernel/nsproxy.c:106
 unshare_nsproxy_namespaces+0xab/0x1e0 kernel/nsproxy.c:205
 SYSC_unshare kernel/fork.c:2402 [inline]
 SyS_unshare+0x305/0x6f0 kernel/fork.c:2352
 do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Freed by task 5:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack mm/kasan/kasan.c:512 [inline]
 set_track mm/kasan/kasan.c:524 [inline]
 kasan_slab_free+0xb0/0x190 mm/kasan/kasan.c:589
 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+0xfc/0x310 mm/slub.c:3878
 ops_free net/core/net_namespace.c:126 [inline]
 ops_free_list.part.0+0x1ff/0x330 net/core/net_namespace.c:148
 ops_free_list net/core/net_namespace.c:146 [inline]
 cleanup_net+0x474/0x8a0 net/core/net_namespace.c:478
 process_one_work+0x88b/0x1600 kernel/workqueue.c:2114
 worker_thread+0x5df/0x11d0 kernel/workqueue.c:2251
 kthread+0x278/0x310 kernel/kthread.c:211
 ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:375

The buggy address belongs to the object at ffff8801cedf8000
 which belongs to the cache kmalloc-8192 of size 8192
The buggy address is located 184 bytes inside of
 8192-byte region [ffff8801cedf8000, ffff8801cedfa000)
The buggy address belongs to the page:
page:ffffea00073b7e00 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x4000000000010200(slab|head)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801cedf7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801cedf8000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801cedf8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff8801cedf8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801cedf8180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (36181):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/22 07:08 android-4.9 258971b8e1ac 8098ea0f .config console log report syz C ci-android-49-kasan-gce-root
2019/11/06 19:56 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 da505f84 .config console log report syz C ci-android-49-kasan-gce-root
2019/10/20 22:01 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 8c88c9c1 .config console log report syz C ci-android-49-kasan-gce-root
2019/10/06 11:01 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 f3f7d9c8 .config console log report syz C ci-android-49-kasan-gce-root
2019/09/30 00:20 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 c1ad5441 .config console log report syz C ci-android-49-kasan-gce-root
2019/09/08 14:57 https://android.googlesource.com/kernel/common android-4.9 9ca86082667c a60cb4cd .config console log report syz C ci-android-49-kasan-gce-root
2019/09/08 06:46 https://android.googlesource.com/kernel/common android-4.9 9ca86082667c a60cb4cd .config console log report syz C ci-android-49-kasan-gce-root
2019/09/02 03:36 https://android.googlesource.com/kernel/common android-4.9 1488597c127f bad3cce2 .config console log report syz C ci-android-49-kasan-gce-root
2019/06/28 20:46 https://android.googlesource.com/kernel/common android-4.9 ab758e1039d6 7509bf36 .config console log report syz C ci-android-49-kasan-gce-root
2019/04/29 05:48 https://android.googlesource.com/kernel/common android-4.9 6cf3205cc803 b617407b .config console log report syz C ci-android-49-kasan-gce-root
2019/04/28 22:06 https://android.googlesource.com/kernel/common android-4.9 6cf3205cc803 b617407b .config console log report syz C ci-android-49-kasan-gce-root
2019/01/23 15:38 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 7cf3249c .config console log report syz C ci-android-49-kasan-gce
2019/01/21 02:43 https://android.googlesource.com/kernel/common android-4.9 4b1d0d3e4e00 fd37a550 .config console log report syz C ci-android-49-kasan-gce-root
2019/01/13 05:11 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 c3f3344c .config console log report syz C ci-android-49-kasan-gce
2019/01/06 13:57 https://android.googlesource.com/kernel/common android-4.9 043c92bd0517 94f8adb5 .config console log report syz C ci-android-49-kasan-gce-root
2018/11/18 22:44 https://android.googlesource.com/kernel/common android-4.9 109a48ed2f69 adf636a8 .config console log report syz C ci-android-49-kasan-gce-root
2018/11/03 17:03 https://android.googlesource.com/kernel/common android-4.9 4ba3f69128be 8bd6bd63 .config console log report syz C ci-android-49-kasan-gce-root
2018/09/04 17:36 https://android.googlesource.com/kernel/common android-4.9 a06ea261bc2a a4718693 .config console log report syz C ci-android-49-kasan-gce-root
2018/09/04 17:30 https://android.googlesource.com/kernel/common android-4.9 a06ea261bc2a a4718693 .config console log report syz C ci-android-49-kasan-gce
2018/08/08 13:37 https://android.googlesource.com/kernel/common android-4.9 47b77b8d01c4 ddeb9f8d .config console log report syz C ci-android-49-kasan-gce-root
2018/08/08 04:55 https://android.googlesource.com/kernel/common android-4.9 47b77b8d01c4 1beb8136 .config console log report syz C ci-android-49-kasan-gce
2018/07/31 17:47 https://android.googlesource.com/kernel/common android-4.9 90e7a9002952 1a381291 .config console log report syz C ci-android-49-kasan-gce-root
2018/07/31 07:38 https://android.googlesource.com/kernel/common android-4.9 8956c50bdcd3 1a381291 .config console log report syz C ci-android-49-kasan-gce-root
2019/02/19 06:56 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 59f36113 .config console log report syz C ci-android-49-kasan-gce-386
2019/01/23 15:35 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 7cf3249c .config console log report syz C ci-android-49-kasan-gce-386
2019/01/13 05:10 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 c3f3344c .config console log report syz C ci-android-49-kasan-gce-386
2018/12/23 22:08 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 e3bd7ab8 .config console log report syz C ci-android-49-kasan-gce-386
2018/09/04 17:37 https://android.googlesource.com/kernel/common android-4.9 a06ea261bc2a a4718693 .config console log report syz C ci-android-49-kasan-gce-386
2019/04/16 23:40 https://android.googlesource.com/kernel/common android-4.9 fc67a895f0a5 505ab413 .config console log report syz ci-android-49-kasan-gce-root
2019/01/16 02:00 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 79cb1a7c .config console log report syz ci-android-49-kasan-gce
2018/12/08 22:48 https://android.googlesource.com/kernel/common android-4.9 860c8b893191 60562a1d .config console log report syz ci-android-49-kasan-gce-root
2018/10/29 18:25 https://android.googlesource.com/kernel/common android-4.9 4ba3f69128be 7df9db2e .config console log report syz ci-android-49-kasan-gce-root
2018/10/12 21:17 https://android.googlesource.com/kernel/common android-4.9 38f2b4a8c277 caf12900 .config console log report syz ci-android-49-kasan-gce-root
2018/08/30 17:30 https://android.googlesource.com/kernel/common android-4.9 09eb2ba5ed0c 938220fd .config console log report syz ci-android-49-kasan-gce-root
2018/08/20 07:59 https://android.googlesource.com/kernel/common android-4.9 54068d61e7d8 2dc4378f .config console log report syz ci-android-49-kasan-gce-root
2018/05/19 15:01 https://android.googlesource.com/kernel/common android-4.9 e14d1a35ebd9 849705db .config console log report syz ci-android-49-kasan-gce
2018/05/19 15:01 https://android.googlesource.com/kernel/common android-4.9 e14d1a35ebd9 849705db .config console log report syz ci-android-49-kasan-gce-root
2018/08/08 03:26 https://android.googlesource.com/kernel/common android-4.9 47b77b8d01c4 1beb8136 .config console log report syz ci-android-49-kasan-gce-386
2018/07/10 10:01 https://android.googlesource.com/kernel/common android-4.9 03c70feafdb2 9fa03fa5 .config console log report syz ci-android-49-kasan-gce-386
2018/04/19 11:45 https://android.googlesource.com/kernel/common android-4.9 8683408f8e81 d1b2ef69 .config console log report syz ci-android-49-kasan-gce-386
2019/12/03 13:27 android-4.9 a36b5017c810 ab342da3 .config console log report ci-android-49-kasan-gce-root
2019/12/02 19:42 android-4.9 a36b5017c810 f879db37 .config console log report ci-android-49-kasan-gce-root
2019/12/02 18:02 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 f879db37 .config console log report ci-android-49-kasan-gce
2019/12/02 15:44 android-4.9 a36b5017c810 f879db37 .config console log report ci-android-49-kasan-gce-root
2019/12/02 10:37 android-4.9 a36b5017c810 f879db37 .config console log report ci-android-49-kasan-gce-root
2019/12/01 21:14 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/12/01 14:40 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/12/01 13:04 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/12/01 00:43 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/11/30 19:17 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/30 16:58 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/30 11:35 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/30 10:24 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 3a75be00 .config console log report ci-android-49-kasan-gce
2019/11/30 07:41 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/29 17:22 android-4.9 a36b5017c810 d29b9e84 .config console log report ci-android-49-kasan-gce-root
2019/11/29 12:31 android-4.9 a36b5017c810 d29b9e84 .config console log report ci-android-49-kasan-gce-root
2019/11/29 10:00 android-4.9 13ff5130ff6e 76357d6f .config console log report ci-android-49-kasan-gce-root
2019/11/29 08:13 android-4.9 13ff5130ff6e 76357d6f .config console log report ci-android-49-kasan-gce-root
2019/11/29 00:54 android-4.9 13ff5130ff6e 76357d6f .config console log report ci-android-49-kasan-gce-root
2019/11/28 07:37 android-4.9 13ff5130ff6e 0d63f89c .config console log report ci-android-49-kasan-gce-root
2019/11/27 14:36 android-4.9 13ff5130ff6e 5a38f3f0 .config console log report ci-android-49-kasan-gce-root
2019/11/27 11:41 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/27 10:44 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/27 08:47 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/27 05:21 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/27 03:01 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/26 23:25 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1048481f .config console log report ci-android-49-kasan-gce
2019/11/26 21:50 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/26 20:48 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1048481f .config console log report ci-android-49-kasan-gce
2019/11/26 18:44 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/26 09:54 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/26 07:10 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/26 02:13 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/26 01:08 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/26 00:10 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/12/04 01:47 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 ae13a849 .config console log report ci-android-49-kasan-gce-386
2019/12/01 17:29 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 a76bf83f .config console log report ci-android-49-kasan-gce-386
2019/12/01 02:44 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 a76bf83f .config console log report ci-android-49-kasan-gce-386
2019/11/29 05:54 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 76357d6f .config console log report ci-android-49-kasan-gce-386
2019/11/28 04:03 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 0d63f89c .config console log report ci-android-49-kasan-gce-386
2019/11/28 00:54 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 0d63f89c .config console log report ci-android-49-kasan-gce-386
2019/11/27 23:11 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 0d63f89c .config console log report ci-android-49-kasan-gce-386
2019/11/27 12:53 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1048481f .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.