[v5.15] KASAN: slab-out-of-bounds Write in udf_readdir

0 views
Skip to first unread message

syzbot

unread,
Apr 15, 2024, 2:11:22 AMApr 15
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: fa3df276cd36 Linux 5.15.155
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=102aaaf5180000
kernel config: https://syzkaller.appspot.com/x/.config?x=f12ea3f162537c9c
dashboard link: https://syzkaller.appspot.com/bug?extid=136740e3b42e006e87fb
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/feaf3fb3f68f/disk-fa3df276.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/537c519f1dd0/vmlinux-fa3df276.xz
kernel image: https://storage.googleapis.com/syzbot-assets/5396ec75d1be/bzImage-fa3df276.xz

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

UDF-fs: INFO Mounting volume 'Li uxUDF', timestamp 2022/11/22 14:59 (1000)
==================================================================
BUG: KASAN: slab-out-of-bounds in udf_readdir+0xcaa/0x2170 fs/udf/dir.c:182
Write of size 201 at addr ffff8880165b7636 by task syz-executor.1/10253

CPU: 1 PID: 10253 Comm: syz-executor.1 Not tainted 5.15.155-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
memcpy+0x3c/0x60 mm/kasan/shadow.c:66
udf_readdir+0xcaa/0x2170 fs/udf/dir.c:182
iterate_dir+0x224/0x570
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f71ed324e69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 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 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f71eb8970c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 00007f71ed452f80 RCX: 00007f71ed324e69
RDX: 0000000000001000 RSI: 0000000020000f80 RDI: 000000000000000b
RBP: 00007f71ed37147a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f71ed452f80 R15: 00007fff1e6637a8
</TASK>

Allocated by task 10253:
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+0xba/0xf0 mm/kasan/common.c:513
kasan_kmalloc include/linux/kasan.h:264 [inline]
kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247
kmalloc include/linux/slab.h:591 [inline]
udf_readdir+0xbc6/0x2170 fs/udf/dir.c:172
iterate_dir+0x224/0x570
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

Last potentially related work creation:
kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
kvfree_call_rcu+0x118/0x8a0 kernel/rcu/tree.c:3596
drop_sysctl_table+0x317/0x460 fs/proc/proc_sysctl.c:1680
drop_sysctl_table+0x329/0x460 fs/proc/proc_sysctl.c:1683
unregister_sysctl_table+0x88/0x130 fs/proc/proc_sysctl.c:1718
__addrconf_sysctl_unregister net/ipv6/addrconf.c:7117 [inline]
addrconf_sysctl_unregister net/ipv6/addrconf.c:7145 [inline]
addrconf_ifdown+0x183b/0x1bb0 net/ipv6/addrconf.c:3929
addrconf_notify+0x432/0xf30
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
call_netdevice_notifiers_info net/core/dev.c:2018 [inline]
call_netdevice_notifiers_extack net/core/dev.c:2030 [inline]
call_netdevice_notifiers net/core/dev.c:2044 [inline]
unregister_netdevice_many+0xf1b/0x18f0 net/core/dev.c:11093
sit_exit_batch_net+0x43c/0x480 net/ipv6/sit.c:1952
ops_exit_list net/core/net_namespace.c:174 [inline]
cleanup_net+0x763/0xb60 net/core/net_namespace.c:596
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300

Second to last potentially related work creation:
kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
__call_rcu kernel/rcu/tree.c:3007 [inline]
call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
free_fib_info net/ipv4/fib_semantics.c:255 [inline]
fib_info_put include/net/ip_fib.h:579 [inline]
fib_release_info+0x61c/0x6e0 net/ipv4/fib_semantics.c:281
fib_table_delete+0xfa9/0x11c0 net/ipv4/fib_trie.c:1772
fib_magic net/ipv4/fib_frontend.c:1095 [inline]
fib_del_ifaddr+0x1f37/0x2ae0 net/ipv4/fib_frontend.c:1306
fib_inetaddr_event+0xb4/0x2b0 net/ipv4/fib_frontend.c:1437
notifier_call_chain kernel/notifier.c:83 [inline]
blocking_notifier_call_chain+0x104/0x1b0 kernel/notifier.c:318
__inet_del_ifa+0x87b/0x1020 net/ipv4/devinet.c:428
inet_del_ifa net/ipv4/devinet.c:465 [inline]
inetdev_destroy net/ipv4/devinet.c:318 [inline]
inetdev_event+0x62b/0x1490 net/ipv4/devinet.c:1598
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
call_netdevice_notifiers_info net/core/dev.c:2018 [inline]
call_netdevice_notifiers_extack net/core/dev.c:2030 [inline]
call_netdevice_notifiers net/core/dev.c:2044 [inline]
unregister_netdevice_many+0xf1b/0x18f0 net/core/dev.c:11093
vti6_exit_batch_net+0x3c3/0x410 net/ipv6/ip6_vti.c:1190
ops_exit_list net/core/net_namespace.c:174 [inline]
cleanup_net+0x763/0xb60 net/core/net_namespace.c:596
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300

The buggy address belongs to the object at ffff8880165b7600
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 54 bytes inside of
256-byte region [ffff8880165b7600, ffff8880165b7700)
The buggy address belongs to the page:
page:ffffea0000596d80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x165b6
head:ffffea0000596d80 order:1 compound_mapcount:0
flags: 0xfff80000010200(slab|head|node=0|zone=1|lastcpupid=0xfff)
raw: 00fff80000010200 dead000000000100 dead000000000122 ffff888011c41b40
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3517, ts 56335173704, free_ts 56265876808
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5423
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc_trace+0x1a0/0x290 mm/slub.c:3245
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
____ip_mc_inc_group+0x319/0xbf0 net/ipv4/igmp.c:1452
__ip_mc_inc_group net/ipv4/igmp.c:1487 [inline]
ip_mc_inc_group net/ipv4/igmp.c:1493 [inline]
ip_mc_up+0x11b/0x2f0 net/ipv4/igmp.c:1792
inetdev_event+0xf24/0x1490 net/ipv4/devinet.c:1573
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
__dev_notify_flags+0x304/0x610
dev_change_flags+0xe7/0x190 net/core/dev.c:8889
do_setlink+0xcd1/0x3ae0 net/core/rtnetlink.c:2741
__rtnl_newlink net/core/rtnetlink.c:3429 [inline]
rtnl_newlink+0x17a4/0x2070 net/core/rtnetlink.c:3549
rtnetlink_rcv_msg+0x993/0xee0 net/core/rtnetlink.c:5629
netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
free_slab mm/slub.c:2015 [inline]
discard_slab mm/slub.c:2021 [inline]
__unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
do_slab_free mm/slub.c:3487 [inline]
___cache_free+0xe3/0x100 mm/slub.c:3506
qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
kmem_cache_alloc_node+0x121/0x2c0 mm/slub.c:3256
__alloc_skb+0xdd/0x590 net/core/skbuff.c:415
alloc_skb include/linux/skbuff.h:1167 [inline]
alloc_skb_with_frags+0xa3/0x780 net/core/skbuff.c:6135
sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2530
unix_dgram_sendmsg+0x6fd/0x2090 net/unix/af_unix.c:1810
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
__sys_sendto+0x564/0x720 net/socket.c:2058
__do_sys_sendto net/socket.c:2070 [inline]
__se_sys_sendto net/socket.c:2066 [inline]
__x64_sys_sendto+0xda/0xf0 net/socket.c:2066

Memory state around the buggy address:
ffff8880165b7580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880165b7600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880165b7680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06
^
ffff8880165b7700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880165b7780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Apr 15, 2024, 3:07:26 AMApr 15
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: fa3df276cd36 Linux 5.15.155
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=165062dd180000
kernel config: https://syzkaller.appspot.com/x/.config?x=f12ea3f162537c9c
dashboard link: https://syzkaller.appspot.com/bug?extid=136740e3b42e006e87fb
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16089547180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11c24f97180000
mounted in repro: https://storage.googleapis.com/syzbot-assets/76d2a957ed5c/mount_0.gz

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

loop0: detected capacity change from 0 to 2048
UDF-fs: INFO Mounting volume 'Li uxUDF', timestamp 2022/11/22 14:59 (1000)
==================================================================
BUG: KASAN: slab-out-of-bounds in udf_readdir+0xcaa/0x2170 fs/udf/dir.c:182
Write of size 201 at addr ffff88801e4c3a36 by task syz-executor330/3498

CPU: 1 PID: 3498 Comm: syz-executor330 Not tainted 5.15.155-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
memcpy+0x3c/0x60 mm/kasan/shadow.c:66
udf_readdir+0xcaa/0x2170 fs/udf/dir.c:182
iterate_dir+0x224/0x570
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f7d5ffe4b39
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd13bb6558 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f7d5ffe4b39
RDX: 0000000000001000 RSI: 0000000020000f80 RDI: 0000000000000005
RBP: 00007f7d60058610 R08: 0000000000000000 R09: 00007ffd13bb6728
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffd13bb6718 R14: 0000000000000001 R15: 0000000000000001
</TASK>

Allocated by task 3498:
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+0xba/0xf0 mm/kasan/common.c:513
kasan_kmalloc include/linux/kasan.h:264 [inline]
kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247
kmalloc include/linux/slab.h:591 [inline]
udf_readdir+0xbc6/0x2170 fs/udf/dir.c:172
iterate_dir+0x224/0x570
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff88801e4c3a00
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 54 bytes inside of
256-byte region [ffff88801e4c3a00, ffff88801e4c3b00)
The buggy address belongs to the page:
page:ffffea0000793080 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1e4c2
head:ffffea0000793080 order:1 compound_mapcount:0
flags: 0xfff80000010200(slab|head|node=0|zone=1|lastcpupid=0xfff)
raw: 00fff80000010200 ffffea000511ef00 0000000600000006 ffff888011c41b40
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd2000(__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 11209578772, free_ts 0
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5423
alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2031
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc_trace+0x1a0/0x290 mm/slub.c:3245
kmalloc include/linux/slab.h:591 [inline]
usb_string+0x10f/0x790 drivers/usb/core/message.c:979
usb_cache_string+0x79/0xf0 drivers/usb/core/message.c:1029
usb_enumerate_device drivers/usb/core/hub.c:2438 [inline]
usb_new_device+0x389/0x18e0 drivers/usb/core/hub.c:2563
register_root_hub+0x25f/0x540 drivers/usb/core/hcd.c:1021
usb_add_hcd+0xc4e/0x1250 drivers/usb/core/hcd.c:3001
vhci_hcd_probe+0x1f0/0x3b0 drivers/usb/usbip/vhci_hcd.c:1376
platform_probe+0x131/0x1b0 drivers/base/platform.c:1391
really_probe+0x24e/0xb60 drivers/base/dd.c:595
__driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:755
driver_probe_device+0x50/0x420 drivers/base/dd.c:785
page_owner free stack trace missing

Memory state around the buggy address:
ffff88801e4c3980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88801e4c3a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88801e4c3a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06
^
ffff88801e4c3b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88801e4c3b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

syzbot

unread,
Apr 19, 2024, 1:30:26 AMApr 19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 6741e066ec76 Linux 6.1.87
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12cdb8f7180000
kernel config: https://syzkaller.appspot.com/x/.config?x=3fc2f61bd0ae457
dashboard link: https://syzkaller.appspot.com/bug?extid=0fe06c9a4c97621dd4bf
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/b606a22ddf4b/disk-6741e066.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e31c21737449/vmlinux-6741e066.xz
kernel image: https://storage.googleapis.com/syzbot-assets/ee0cb8c049e9/bzImage-6741e066.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+0fe06c...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in udf_readdir+0xc5f/0x2240 fs/udf/dir.c:182
Write of size 201 at addr ffff88805b1eb036 by task syz-executor.0/8202

CPU: 0 PID: 8202 Comm: syz-executor.0 Not tainted 6.1.87-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:395
kasan_report+0x136/0x160 mm/kasan/report.c:495
kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
memcpy+0x3c/0x60 mm/kasan/shadow.c:66
udf_readdir+0xc5f/0x2240 fs/udf/dir.c:182
iterate_dir+0x224/0x560
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f24fc47dea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 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 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f24fd1bd0c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 00007f24fc5abf80 RCX: 00007f24fc47dea9
RDX: 0000000000000ff9 RSI: 0000000020001280 RDI: 0000000000000008
RBP: 00007f24fc4ca4a4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f24fc5abf80 R15: 00007ffedb1e9978
</TASK>

Allocated by task 8202:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:556 [inline]
udf_readdir+0xb78/0x2240 fs/udf/dir.c:172
iterate_dir+0x224/0x560
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
call_rcu+0x163/0xa10 kernel/rcu/tree.c:2844
fib_create_info+0x189c/0x2500 net/ipv4/fib_semantics.c:1591
fib_table_insert+0x1f2/0x1f20 net/ipv4/fib_trie.c:1236
fib_magic net/ipv4/fib_frontend.c:1104 [inline]
fib_add_ifaddr+0x47f/0x1730 net/ipv4/fib_frontend.c:1126
fib_netdev_event+0x620/0x730 net/ipv4/fib_frontend.c:1486
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
__dev_notify_flags+0x304/0x610
dev_change_flags+0xe7/0x190 net/core/dev.c:8661
do_setlink+0xcf4/0x3e30 net/core/rtnetlink.c:2801
__rtnl_newlink net/core/rtnetlink.c:3576 [inline]
rtnl_newlink+0x172c/0x2050 net/core/rtnetlink.c:3623
rtnetlink_rcv_msg+0x818/0xff0 net/core/rtnetlink.c:6121
netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508
netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
netlink_unicast+0x7d8/0x970 net/netlink/af_netlink.c:1352
netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1874
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
__sys_sendto+0x480/0x600 net/socket.c:2148
__do_sys_sendto net/socket.c:2160 [inline]
__se_sys_sendto net/socket.c:2156 [inline]
__x64_sys_sendto+0xda/0xf0 net/socket.c:2156
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff88805b1eb000
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 54 bytes inside of
256-byte region [ffff88805b1eb000, ffff88805b1eb100)

The buggy address belongs to the physical page:
page:ffffea00016c7a80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5b1ea
head:ffffea00016c7a80 order:1 compound_mapcount:0 compound_pincount:0
flags: 0xfff80000010200(slab|head|node=0|zone=1|lastcpupid=0xfff)
raw: 00fff80000010200 dead000000000100 dead000000000122 ffff888012441b40
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 7786, tgid 7786 (syz-executor.0), ts 241603478001, free_ts 240613127177
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
prep_new_page mm/page_alloc.c:2520 [inline]
get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5547
alloc_slab_page+0x6a/0x150 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x84/0x2d0 mm/slub.c:1992
___slab_alloc+0xc20/0x1270 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:954 [inline]
__kmalloc+0xa1/0x230 mm/slab_common.c:968
kmalloc include/linux/slab.h:561 [inline]
kzalloc include/linux/slab.h:692 [inline]
fib_create_info+0xa37/0x2500 net/ipv4/fib_semantics.c:1459
fib_table_insert+0x1f2/0x1f20 net/ipv4/fib_trie.c:1236
fib_magic net/ipv4/fib_frontend.c:1104 [inline]
fib_add_ifaddr+0xf4c/0x1730 net/ipv4/fib_frontend.c:1148
fib_netdev_event+0x620/0x730 net/ipv4/fib_frontend.c:1486
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
__dev_notify_flags+0x304/0x610
dev_change_flags+0xe7/0x190 net/core/dev.c:8661
do_setlink+0xcf4/0x3e30 net/core/rtnetlink.c:2801
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1440 [inline]
free_pcp_prepare mm/page_alloc.c:1490 [inline]
free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358
free_unref_page+0x33/0x3e0 mm/page_alloc.c:3453
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
__kmem_cache_alloc_node+0x137/0x260 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:954 [inline]
__kmalloc_node_track_caller+0xa0/0x220 mm/slab_common.c:975
kmalloc_reserve net/core/skbuff.c:446 [inline]
__alloc_skb+0x135/0x670 net/core/skbuff.c:515
alloc_skb include/linux/skbuff.h:1271 [inline]
alloc_uevent_skb+0x74/0x220 lib/kobject_uevent.c:290
uevent_net_broadcast_tagged lib/kobject_uevent.c:351 [inline]
kobject_uevent_net_broadcast+0x178/0x560 lib/kobject_uevent.c:412
kobject_uevent_env+0x576/0x8c0 lib/kobject_uevent.c:593
device_add+0xa4f/0xfd0 drivers/base/core.c:3667
netdev_register_kobject+0x176/0x310 net/core/net-sysfs.c:2015
register_netdevice+0x108a/0x1720 net/core/dev.c:10099
nsim_init_netdevsim drivers/net/netdevsim/netdev.c:317 [inline]
nsim_create+0x34b/0x3f0 drivers/net/netdevsim/netdev.c:365

Memory state around the buggy address:
ffff88805b1eaf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88805b1eb000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88805b1eb080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06
^
ffff88805b1eb100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88805b1eb180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---

syzbot

unread,
Apr 19, 2024, 1:56:21 AMApr 19
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 6741e066ec76 Linux 6.1.87
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17a00535180000
kernel config: https://syzkaller.appspot.com/x/.config?x=3fc2f61bd0ae457
dashboard link: https://syzkaller.appspot.com/bug?extid=0fe06c9a4c97621dd4bf
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15be0cc3180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14fb5af5180000
mounted in repro: https://storage.googleapis.com/syzbot-assets/2cbb7c242ca2/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+0fe06c...@syzkaller.appspotmail.com

loop0: detected capacity change from 0 to 2048
UDF-fs: error (device loop0): udf_read_tagged: tag checksum failed, block 160: 0x52 != 0x00
UDF-fs: INFO Mounting volume 'Li uxUDF', timestamp 2022/11/22 14:59 (1000)
==================================================================
BUG: KASAN: slab-out-of-bounds in udf_readdir+0xc5f/0x2240 fs/udf/dir.c:182
Write of size 201 at addr ffff888013a64636 by task syz-executor378/3544

CPU: 0 PID: 3544 Comm: syz-executor378 Not tainted 6.1.87-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:395
kasan_report+0x136/0x160 mm/kasan/report.c:495
kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
memcpy+0x3c/0x60 mm/kasan/shadow.c:66
udf_readdir+0xc5f/0x2240 fs/udf/dir.c:182
iterate_dir+0x224/0x560
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f94dca6dab9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffaba83f68 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f94dca6dab9
RDX: 0000000000000ff9 RSI: 0000000020001280 RDI: 0000000000000005
RBP: 00007f94dcae1610 R08: 0000000000000000 R09: 00007fffaba84138
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007fffaba84128 R14: 0000000000000001 R15: 0000000000000001
</TASK>

Allocated by task 3544:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:556 [inline]
udf_readdir+0xb78/0x2240 fs/udf/dir.c:172
iterate_dir+0x224/0x560
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff888013a64600
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 54 bytes inside of
256-byte region [ffff888013a64600, ffff888013a64700)

The buggy address belongs to the physical page:
page:ffffea00004e9900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x13a64
head:ffffea00004e9900 order:1 compound_mapcount:0 compound_pincount:0
flags: 0xfff80000010200(slab|head|node=0|zone=1|lastcpupid=0xfff)
raw: 00fff80000010200 ffffea00004e9a80 dead000000000002 ffff888012441b40
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 2528782905, free_ts 0
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
prep_new_page mm/page_alloc.c:2520 [inline]
get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5547
alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2115
alloc_slab_page+0x6a/0x150 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x84/0x2d0 mm/slub.c:1992
___slab_alloc+0xc20/0x1270 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:954 [inline]
__kmalloc_node_track_caller+0xa0/0x220 mm/slab_common.c:975
__do_krealloc mm/slab_common.c:1348 [inline]
krealloc+0x61/0xf0 mm/slab_common.c:1381
add_sysfs_param+0xca/0x7f0 kernel/params.c:651
kernel_add_sysfs_param+0xb0/0x126 kernel/params.c:812
param_sysfs_builtin+0x16a/0x1e2 kernel/params.c:851
param_sysfs_init+0x66/0x6a kernel/params.c:970
do_one_initcall+0x265/0x8f0 init/main.c:1297
do_initcall_level+0x157/0x207 init/main.c:1370
page_owner free stack trace missing

Memory state around the buggy address:
ffff888013a64580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888013a64600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888013a64680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06
^
ffff888013a64700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888013a64780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---

syzbot

unread,
May 4, 2024, 1:52:06 PM (3 days ago) May 4
to syzkaller...@googlegroups.com
syzbot suspects this issue could be fixed by backporting the following commit:

commit 7cd7a36ab44d3e8c1dee7185ef407b9831a8220b
git tree: upstream
Author: Jan Kara <ja...@suse.cz>
Date: Tue Oct 4 13:00:15 2022 +0000

udf: Convert udf_readdir() to new directory iteration

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=170fa574980000
Please keep in mind that other backports might be required as well.

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages