syzbot


KASAN: use-after-free Read in ax25_rt_autobind

Status: upstream: reported on 2025/03/21 16:25
Reported-by: syzbot+8309bf0e61f7480d036c@syzkaller.appspotmail.com
First crash: 14d, last: 14d

Sample crash report:
ax25_connect(): syz.5.823 uses autobind, please contact jreuter@yaina.de
==================================================================
BUG: KASAN: use-after-free in ax25_rt_autobind+0x2e8/0x5f4 net/ax25/ax25_route.c:424
Read of size 8 at addr ffff0000d1ddf008 by task syz.5.823/7717

CPU: 1 PID: 7717 Comm: syz.5.823 Not tainted 5.15.179-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x174/0x1e4 mm/kasan/report.c:451
 __asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
 ax25_rt_autobind+0x2e8/0x5f4 net/ax25/ax25_route.c:424
 ax25_connect+0x96c/0x1174 net/ax25/af_ax25.c:1263
 __sys_connect_file net/socket.c:1923 [inline]
 __sys_connect+0x268/0x290 net/socket.c:1940
 __do_sys_connect net/socket.c:1950 [inline]
 __se_sys_connect net/socket.c:1947 [inline]
 __arm64_sys_connect+0x7c/0x94 net/socket.c:1947
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 6130:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513
 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x27c/0x47c mm/slub.c:3247
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 ax25_dev_device_up+0x5c/0x548 net/ax25/ax25_dev.c:55
 ax25_device_event+0x504/0x590 net/ax25/af_ax25.c:139
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xd4/0x164 kernel/notifier.c:391
 __dev_notify_flags+0x2b4/0x540
 dev_change_flags+0xc8/0x154 net/core/dev.c:8928
 dev_ifsioc+0x140/0xfe4 net/core/dev_ioctl.c:324
 dev_ioctl+0x4e0/0xd3c net/core/dev_ioctl.c:587
 sock_do_ioctl+0x1dc/0x2dc net/socket.c:1154
 sock_ioctl+0x4f4/0x8b0 net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 7662:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0x178/0x410 mm/slub.c:4559
 ax25_dev_put include/net/ax25.h:302 [inline]
 ax25_release+0x57c/0x82c net/ax25/af_ax25.c:1062
 __sock_release net/socket.c:649 [inline]
 sock_close+0xb8/0x1fc net/socket.c:1336
 __fput+0x1c4/0x800 fs/file_table.c:311
 ____fput+0x20/0x30 fs/file_table.c:339
 task_work_run+0x130/0x1e4 kernel/task_work.c:188
 get_signal+0x1450/0x1550 kernel/signal.c:2672
 do_signal arch/arm64/kernel/signal.c:890 [inline]
 do_notify_resume+0x3d0/0x32b8 arch/arm64/kernel/signal.c:943
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
 el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:609
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Last potentially related work creation:
 kasan_save_stack+0x38/0x68 mm/kasan/common.c:38
 kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348
 insert_work+0x64/0x394 kernel/workqueue.c:1366
 __queue_work+0xb84/0x114c kernel/workqueue.c:1532
 queue_work_on+0xc4/0x17c kernel/workqueue.c:1559
 queue_work include/linux/workqueue.h:512 [inline]
 netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:659 [inline]
 netdevice_event+0x724/0x84c drivers/infiniband/core/roce_gid_mgmt.c:802
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xd4/0x164 kernel/notifier.c:391
 call_netdevice_notifiers_info net/core/dev.c:2049 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2061 [inline]
 call_netdevice_notifiers+0x13c/0x1bc net/core/dev.c:2075
 register_netdevice+0xf30/0x12dc net/core/dev.c:10427
 hsr_dev_finalize+0x3a4/0x5e8 net/hsr/hsr_device.c:535
 hsr_newlink+0x508/0x5b0 net/hsr/hsr_netlink.c:102
 __rtnl_newlink net/core/rtnetlink.c:3521 [inline]
 rtnl_newlink+0x10d0/0x1ae8 net/core/rtnetlink.c:3569
 rtnetlink_rcv_msg+0xa7c/0xdb4 net/core/rtnetlink.c:5647
 netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2489
 rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:5665
 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
 netlink_unicast+0x664/0x938 net/netlink/af_netlink.c:1337
 netlink_sendmsg+0x844/0xb38 net/netlink/af_netlink.c:1905
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 __sys_sendto+0x388/0x4d0 net/socket.c:2063
 __do_sys_sendto net/socket.c:2075 [inline]
 __se_sys_sendto net/socket.c:2071 [inline]
 __arm64_sys_sendto+0xd8/0xf8 net/socket.c:2071
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Second to last potentially related work creation:
 kasan_save_stack+0x38/0x68 mm/kasan/common.c:38
 kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348
 insert_work+0x64/0x394 kernel/workqueue.c:1366
 __queue_work+0xb84/0x114c kernel/workqueue.c:1532
 queue_work_on+0xc4/0x17c kernel/workqueue.c:1559
 queue_work include/linux/workqueue.h:512 [inline]
 addr_event+0x300/0x3f8 drivers/infiniband/core/roce_gid_mgmt.c:853
 inetaddr_event+0x108/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:869
 notifier_call_chain kernel/notifier.c:83 [inline]
 blocking_notifier_call_chain+0xf0/0x198 kernel/notifier.c:318
 __inet_insert_ifa+0x8d4/0xad8 net/ipv4/devinet.c:568
 inet_rtm_newaddr+0xe90/0x173c net/ipv4/devinet.c:967
 rtnetlink_rcv_msg+0xa7c/0xdb4 net/core/rtnetlink.c:5647
 netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2489
 rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:5665
 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
 netlink_unicast+0x664/0x938 net/netlink/af_netlink.c:1337
 netlink_sendmsg+0x844/0xb38 net/netlink/af_netlink.c:1905
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 __sys_sendto+0x388/0x4d0 net/socket.c:2063
 __do_sys_sendto net/socket.c:2075 [inline]
 __se_sys_sendto net/socket.c:2071 [inline]
 __arm64_sys_sendto+0xd8/0xf8 net/socket.c:2071
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000d1ddf000
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 8 bytes inside of
 256-byte region [ffff0000d1ddf000, ffff0000d1ddf100)
The buggy address belongs to the page:
page:00000000e3c7cb06 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x111dde
head:00000000e3c7cb06 order:1 compound_mapcount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 dead000000000100 dead000000000122 ffff0000c0002480
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d1ddef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff0000d1ddef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000d1ddf000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff0000d1ddf080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d1ddf100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
Unable to handle kernel paging request at virtual address f183808a6000042e
Mem abort info:
  ESR = 0x0000000096000004
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x04: level 0 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000004
  CM = 0, WnR = 0
[f183808a6000042e] address between user and kernel address ranges
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 7717 Comm: syz.5.823 Tainted: G    B             5.15.179-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : ax25_rt_autobind+0x2f4/0x5f4 net/ax25/ax25_route.c:424
lr : ax25_rt_autobind+0x2e8/0x5f4 net/ax25/ax25_route.c:424
sp : ffff8000212d79e0
x29: ffff8000212d79e0 x28: ffff0000d6667000 x27: ffff0000f246e600
x26: dfff800000000000 x25: 0000000000000000 x24: ffff0000f246e600
x23: 1fffe0001accce05 x22: 8c20045300002176 x21: ffff0000d6667010
x20: ffff8000212d7c02 x19: ffff0000d6667000 x18: 0000000000000003
x17: 0000000000000002 x16: ffff80000824f3a0 x15: 00000000ffffffff
x14: ffff0000e4dc51c0 x13: 0000000000000001 x12: 0000000000080000
x11: 00000000000334e4 x10: ffff80002bc00000 x9 : 0000000000000000
x8 : 1184008a6000042e x7 : 0000000000000000 x6 : 0000000000000001
x5 : ffff8000212d7078 x4 : 0000000000000000 x3 : ffff80000819cb88
x2 : 0000000000000001 x1 : 0000000000000001 x0 : 0000000000000001
Call trace:
 ax25_rt_autobind+0x2f4/0x5f4 net/ax25/ax25_route.c:424
 ax25_connect+0x96c/0x1174 net/ax25/af_ax25.c:1263
 __sys_connect_file net/socket.c:1923 [inline]
 __sys_connect+0x268/0x290 net/socket.c:1940
 __do_sys_connect net/socket.c:1950 [inline]
 __se_sys_connect net/socket.c:1947 [inline]
 __arm64_sys_connect+0x7c/0x94 net/socket.c:1947
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
Code: 97c5347c f94002c8 910e2116 d343fec8 (387a6908) 
---[ end trace e7bc335561519460 ]---
----------------
Code disassembly (best guess):
   0:	97c5347c 	bl	0xffffffffff14d1f0
   4:	f94002c8 	ldr	x8, [x22]
   8:	910e2116 	add	x22, x8, #0x388
   c:	d343fec8 	lsr	x8, x22, #3
* 10:	387a6908 	ldrb	w8, [x8, x26] <-- trapping instruction

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/21 16:24 linux-5.15.y 0c935c049b5c 62330552 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in ax25_rt_autobind
* Struck through repros no longer work on HEAD.