syzbot


KASAN: use-after-free Read in __gtp_encap_destroy

Status: closed as invalid on 2021/10/06 01:29
Reported-by: syzbot+@syzkaller.appspotmail.com
First crash: 681d, last: 663d

Cause bisection: failed (bisect log)

Fix bisection: the fix commit could be any of (bisect log):
  5fc4053df3d9 mlxsw: ethtool: Remove max lanes filtering
  7dc33f0914a9 ethtool: Expose the number of lanes in use
  763ece86f0c2 mlxsw: ethtool: Add support for setting lanes when autoneg is off
  c8907043c6ac ethtool: Get link mode in use instead of speed and duplex parameters
  012ce4dd3102 ethtool: Extend link modes settings uAPI with lanes
  25a96f057a0f mlxsw: ethtool: Pass link mode in use to ethtool
  189e7a8d9420 ethtool: Validate master slave configuration before rtnl_lock()
  f72e2f48c710 net: selftests: Add lanes setting test
  6fd5eeee1f10 Merge branch 'support-setting-lanes-via-ethtool'
  99b8202b179f net: dsa: fix SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING getting ignored
  75b8f78fb91f Merge branch 'chelsio-cxgb-use-threaded-interrupts-for-deferred-work'
  f5a5589c7250 tcp: use a smaller percpu_counter batch size for sk_alloc
  3dd344ea84e1 net: tracepoint: exposing sk_family in all tcp:tracepoints
  82154580a7f7 chelsio: cxgb: Disable the card on error in threaded interrupt
  49ecc587dca2 Revert "GTP: add support for flow based tunneling API"
  fec7fa0a750c chelsio: cxgb: Replace the workqueue with threaded interrupt
  462e99a18b22 Merge branch 'support-for-octeontx2-98xx-cpt-block'
  e21eb3a065a2 gtp: set initial MTU
  c57c58fd5c4f octeontx2-af: Handle CPT function level reset
  e1b2914e645c gtp: include role in link info
  a9c0df76d002 gtp: really check namespaces before xmit
  b0f60fab7805 octeontx2-af: Add support for CPT1 in debugfs
  70d132462998 gtp: drop unnecessary call to skb_dst_drop
  de2854c87c64 octeontx2-af: Mailbox changes for 98xx CPT block
  29f53b5c00c1 gtp: set device type
  e0183b974d30 net: mdiobus: Prevent spike on MDIO bus reset signal
  4160d9ec5b41 net: mscc: ocelot: fix error code in mscc_ocelot_probe()
  9716178a3abd gtp: update rx_length_errors for abnormally short packets
  493007c1fa89 Merge branch 'gtp'
  e0c16233577f net: mscc: ocelot: fix error handling bugs in mscc_ocelot_init_ports()
  2d912da016a7 Merge branch 'net-use-indirect_call-in-some-dst_ops'
  e93fac3b5161 drivers: net: xen-netfront: Simplify the calculation of variables
  7e3ce05e7f65 netlink: add tracepoint at NL_SET_ERR_MSG
  bbd807dfbf20 net: indirect call helpers for ipv4/ipv6 dst_check functions
  0053859496ba net: add EXPORT_INDIRECT_CALLABLE wrapper
  f67fbeaebdc0 net: use indirect call helpers for dst_mtu
  9c97921a51a0 net: fix building errors on powerpc when CONFIG_RETPOLINE is not set

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __gtp_encap_destroy+0x194/0x1b0 drivers/net/gtp.c:359
Read of size 8 at addr ffff88801a106bd0 by task syz-executor495/8468

CPU: 1 PID: 8468 Comm: syz-executor495 Not tainted 5.11.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x107/0x163 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:230
 __kasan_report mm/kasan/report.c:396 [inline]
 kasan_report.cold+0x79/0xd5 mm/kasan/report.c:413
 __gtp_encap_destroy+0x194/0x1b0 drivers/net/gtp.c:359
 gtp_encap_destroy+0x16/0x20 drivers/net/gtp.c:373
 udpv6_destroy_sock+0x1df/0x220 net/ipv6/udp.c:1609
 sk_common_release+0x64/0x390 net/core/sock.c:3256
 inet_release+0x12e/0x280 net/ipv4/af_inet.c:431
 inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:475
 __sock_release+0xcd/0x280 net/socket.c:597
 sock_close+0x18/0x20 net/socket.c:1256
 __fput+0x283/0x920 fs/file_table.c:280
 task_work_run+0xdd/0x190 kernel/task_work.c:140
 exit_task_work include/linux/task_work.h:30 [inline]
 do_exit+0xc5c/0x2ae0 kernel/exit.c:825
 do_group_exit+0x125/0x310 kernel/exit.c:922
 __do_sys_exit_group kernel/exit.c:933 [inline]
 __se_sys_exit_group kernel/exit.c:931 [inline]
 __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:931
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x43f078
Code: Unable to access opcode bytes at RIP 0x43f04e.
RSP: 002b:00007ffd4a550178 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043f078
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004be888 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d0180 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8468:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:401 [inline]
 ____kasan_kmalloc.constprop.0+0x82/0xa0 mm/kasan/common.c:429
 kmalloc_node include/linux/slab.h:575 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:587
 kvmalloc include/linux/mm.h:781 [inline]
 kvzalloc include/linux/mm.h:789 [inline]
 alloc_netdev_mqs+0x97/0xea0 net/core/dev.c:10525
 rtnl_create_link+0x219/0xad0 net/core/rtnetlink.c:3171
 __rtnl_newlink+0xf9b/0x16e0 net/core/rtnetlink.c:3433
 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3491
 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5553
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2345
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2399
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2432
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 8468:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:356
 ____kasan_slab_free+0xe1/0x110 mm/kasan/common.c:362
 kasan_slab_free include/linux/kasan.h:188 [inline]
 slab_free_hook mm/slub.c:1547 [inline]
 slab_free_freelist_hook+0x5d/0x150 mm/slub.c:1580
 slab_free mm/slub.c:3142 [inline]
 kfree+0xdb/0x3b0 mm/slub.c:4124
 kvfree+0x42/0x50 mm/util.c:616
 netdev_freemem net/core/dev.c:10479 [inline]
 free_netdev+0x4a9/0x5e0 net/core/dev.c:10648
 __rtnl_newlink+0x1484/0x16e0 net/core/rtnetlink.c:3447
 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3491
 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5553
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2345
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2399
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2432
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff88801a106000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 3024 bytes inside of
 4096-byte region [ffff88801a106000, ffff88801a107000)
The buggy address belongs to the page:
page:0000000052ee4c3d refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1a100
head:0000000052ee4c3d order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010042140
raw: 0000000000000000 0000000080040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88801a106a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801a106b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801a106b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff88801a106c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801a106c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (22):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-net-kasan-gce 2021/01/16 15:00 net-next 9ab7e76aefc9 65a7a854 .config log report syz C
ci-upstream-net-kasan-gce 2021/02/03 09:45 net-next 9ae4bdc6e4c1 624dad51 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-net-kasan-gce 2021/02/03 03:35 net-next 9ae4bdc6e4c1 624dad51 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-net-kasan-gce 2021/02/01 03:41 net-next 14e8e0f60088 fc9fd31e .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-net-kasan-gce 2021/01/28 17:58 net-next d1f3bdd4eaae 7df34f59 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-net-kasan-gce 2021/01/21 10:40 net-next 0fe2f273ab89 d4f4eca5 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-net-kasan-gce 2021/01/19 22:54 net-next 99d518970c5a 63631df1 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-net-kasan-gce 2021/01/18 13:35 net-next 213b97b12580 fd103621 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-linux-next-kasan-gce-root 2021/01/28 20:41 linux-next d03154e8bb6a 7df34f59 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-linux-next-kasan-gce-root 2021/01/25 13:23 linux-next bc085f8fc88f 52e37319 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-linux-next-kasan-gce-root 2021/01/21 14:33 linux-next bc085f8fc88f d4f4eca5 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-linux-next-kasan-gce-root 2021/01/18 12:38 linux-next 93bf8b946e5f fd103621 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-linux-next-kasan-gce-root 2021/01/18 12:10 linux-next 93bf8b946e5f fd103621 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-linux-next-kasan-gce-root 2021/01/18 11:31 linux-next 93bf8b946e5f fd103621 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-linux-next-kasan-gce-root 2021/01/18 11:22 linux-next 93bf8b946e5f fd103621 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-linux-next-kasan-gce-root 2021/01/18 10:22 linux-next 93bf8b946e5f fd103621 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-linux-next-kasan-gce-root 2021/01/18 09:33 linux-next 93bf8b946e5f fd103621 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-linux-next-kasan-gce-root 2021/01/18 08:49 linux-next 93bf8b946e5f fd103621 .config log report info KASAN: use-after-free Read in __gtp_encap_destroy
ci-upstream-net-kasan-gce 2021/01/16 14:35 net-next 9ab7e76aefc9 65a7a854 .config log report info
ci-upstream-net-kasan-gce 2021/01/16 14:19 net-next 9ab7e76aefc9 65a7a854 .config log report info
ci-upstream-net-kasan-gce 2021/01/16 14:13 net-next 9ab7e76aefc9 65a7a854 .config log report info
ci-upstream-net-kasan-gce 2021/01/16 14:11 net-next 9ab7e76aefc9 65a7a854 .config log report info
* Struck through repros no longer work on HEAD.