KASAN: use-after-free Read in ip6_hold_safe (3)

0 views
Skip to first unread message

syzbot

unread,
Mar 25, 2019, 11:42:09 AM3/25/19
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: a534ea30 net: isdn: Make isdn_ppp_mp_discard and isdn_ppp_..
git tree: net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1439931b200000
kernel config: https://syzkaller.appspot.com/x/.config?x=f05902bca21d8935
dashboard link: https://syzkaller.appspot.com/bug?extid=32d16704a2421381974b
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
CC: [da...@davemloft.net kuz...@ms2.inr.ac.ru
linux-...@vger.kernel.org net...@vger.kernel.org yosh...@linux-ipv6.org
net...@vger.kernel.org]

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+32d167...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in atomic_read
include/asm-generic/atomic-instrumented.h:26 [inline]
BUG: KASAN: use-after-free in atomic_fetch_add_unless
include/linux/atomic-fallback.h:1086 [inline]
BUG: KASAN: use-after-free in atomic_add_unless
include/linux/atomic-fallback.h:1111 [inline]
BUG: KASAN: use-after-free in atomic_inc_not_zero
include/linux/atomic-fallback.h:1127 [inline]
BUG: KASAN: use-after-free in dst_hold_safe include/net/dst.h:308 [inline]
BUG: KASAN: use-after-free in ip6_hold_safe+0xb3/0x3a0 net/ipv6/route.c:1023
Read of size 4 at addr ffff8880914a7300 by task syz-executor.2/7196

CPU: 1 PID: 7196 Comm: syz-executor.2 Not tainted 5.0.0+ #103
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x172/0x1f0 lib/dump_stack.c:113
print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
check_memory_region_inline mm/kasan/generic.c:185 [inline]
check_memory_region+0x123/0x190 mm/kasan/generic.c:191
kasan_check_read+0x11/0x20 mm/kasan/common.c:102
atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
atomic_fetch_add_unless include/linux/atomic-fallback.h:1086 [inline]
atomic_add_unless include/linux/atomic-fallback.h:1111 [inline]
atomic_inc_not_zero include/linux/atomic-fallback.h:1127 [inline]
dst_hold_safe include/net/dst.h:308 [inline]
ip6_hold_safe+0xb3/0x3a0 net/ipv6/route.c:1023
rt6_get_pcpu_route net/ipv6/route.c:1243 [inline]
ip6_pol_route+0x348/0x1040 net/ipv6/route.c:1904
ip6_pol_route_output+0x54/0x70 net/ipv6/route.c:2080
__fib6_rule_action net/ipv6/fib6_rules.c:233 [inline]
fib6_rule_action+0x3d0/0xaa0 net/ipv6/fib6_rules.c:264
fib_rules_lookup+0x351/0xa90 net/core/fib_rules.c:304
fib6_rule_lookup+0x340/0x560 net/ipv6/fib6_rules.c:110
ip6_route_output_flags+0x2c4/0x350 net/ipv6/route.c:2109
ip6_route_output include/net/ip6_route.h:88 [inline]
ip6_dst_lookup_tail+0xd10/0x1b30 net/ipv6/ip6_output.c:964
ip6_dst_lookup_flow+0xa8/0x220 net/ipv6/ip6_output.c:1092
ip6_datagram_dst_update+0x5d8/0xc20 net/ipv6/datagram.c:91
__ip6_datagram_connect+0x5e9/0x1390 net/ipv6/datagram.c:250
ip6_datagram_connect+0x30/0x50 net/ipv6/datagram.c:273
ip6_datagram_connect_v6_only+0x69/0x90 net/ipv6/datagram.c:285
inet_dgram_connect+0x150/0x2e0 net/ipv4/af_inet.c:571
__sys_connect+0x266/0x330 net/socket.c:1808
__do_sys_connect net/socket.c:1819 [inline]
__se_sys_connect net/socket.c:1816 [inline]
__x64_sys_connect+0x73/0xb0 net/socket.c:1816
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x458079
Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff
ff 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ff5660e5c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458079
RDX: 000000000000001c RSI: 0000000020000000 RDI: 0000000000000003
RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff5660e66d4
R13: 00000000004be3fb R14: 00000000004cebc8 R15: 00000000ffffffff

Allocated by task 4219:
save_stack+0x45/0xd0 mm/kasan/common.c:75
set_track mm/kasan/common.c:87 [inline]
__kasan_kmalloc mm/kasan/common.c:497 [inline]
__kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470
kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:505
slab_post_alloc_hook mm/slab.h:436 [inline]
slab_alloc mm/slab.c:3392 [inline]
kmem_cache_alloc+0x11a/0x6f0 mm/slab.c:3554
kmem_cache_zalloc include/linux/slab.h:730 [inline]
__proc_create+0x2c9/0x860 fs/proc/generic.c:408
proc_mkdir_data+0xbc/0x240 fs/proc/generic.c:469
proc_net_mkdir include/linux/proc_fs.h:124 [inline]
rxrpc_init_net+0xa14/0xe30 net/rxrpc/net_ns.c:96
ops_init+0xb6/0x410 net/core/net_namespace.c:129
setup_net+0x2c5/0x730 net/core/net_namespace.c:314
copy_net_ns+0x1d9/0x340 net/core/net_namespace.c:437
create_new_namespaces+0x400/0x7b0 kernel/nsproxy.c:107
unshare_nsproxy_namespaces+0xc2/0x200 kernel/nsproxy.c:206
ksys_unshare+0x440/0x980 kernel/fork.c:2549
__do_sys_unshare kernel/fork.c:2617 [inline]
__se_sys_unshare kernel/fork.c:2615 [inline]
__x64_sys_unshare+0x31/0x40 kernel/fork.c:2615
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4219:
save_stack+0x45/0xd0 mm/kasan/common.c:75
set_track mm/kasan/common.c:87 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/common.c:459
kasan_slab_free+0xe/0x10 mm/kasan/common.c:467
__cache_free mm/slab.c:3498 [inline]
kmem_cache_free+0x86/0x260 mm/slab.c:3764
pde_free+0xb5/0x110 fs/proc/generic.c:42
pde_put fs/proc/generic.c:647 [inline]
pde_put+0x87/0xa0 fs/proc/generic.c:643
remove_proc_subtree+0x277/0x310 fs/proc/generic.c:730
proc_remove fs/proc/generic.c:745 [inline]
proc_remove+0x6a/0x90 fs/proc/generic.c:742
rxrpc_exit_net+0x1f5/0x310 net/rxrpc/net_ns.c:129
ops_exit_list.isra.0+0xb0/0x160 net/core/net_namespace.c:153
setup_net+0x3f2/0x730 net/core/net_namespace.c:331
copy_net_ns+0x1d9/0x340 net/core/net_namespace.c:437
create_new_namespaces+0x400/0x7b0 kernel/nsproxy.c:107
unshare_nsproxy_namespaces+0xc2/0x200 kernel/nsproxy.c:206
ksys_unshare+0x440/0x980 kernel/fork.c:2549
__do_sys_unshare kernel/fork.c:2617 [inline]
__se_sys_unshare kernel/fork.c:2615 [inline]
__x64_sys_unshare+0x31/0x40 kernel/fork.c:2615
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880914a7280
which belongs to the cache proc_dir_entry of size 256
The buggy address is located 128 bytes inside of
256-byte region [ffff8880914a7280, ffff8880914a7380)
The buggy address belongs to the page:
page:ffffea00024529c0 count:1 mapcount:0 mapping:ffff88821bc45b00
index:0xffff8880914a7000
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea0001adc208 ffffea0001ba94c8 ffff88821bc45b00
raw: ffff8880914a7000 ffff8880914a7000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880914a7200: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8880914a7280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8880914a7300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880914a7380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8880914a7400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

Dmitry Vyukov

unread,
May 7, 2019, 5:38:32 AM5/7/19
to syzbot, 'Dmitry Vyukov' via syzkaller-upstream-moderation
#syz upstream
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-upstream-moderation" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-upstream-m...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-upstream-moderation/000000000000fa3a700584ed0bd7%40google.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages