lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <17a04f01.1ae74.19436d003fc.Coremail.stitch@zju.edu.cn>
Date: Sun, 5 Jan 2025 22:13:09 +0800 (GMT+08:00)
From: "Jiacheng Xu" <stitch@....edu.cn>
To: mark@...heh.com, jlbec@...lplan.org, joseph.qi@...ux.alibaba.com,
	ocfs2-devel@...ts.linux.dev, linux-kernel@...r.kernel.org
Cc: syzkaller@...glegroups.com
Subject: [BUG] KASAN: slab-out-of-bounds Read in ocfs2_search_dirblock

Hi developers:

We are reporting a Linux issue using a modified version of Syzkaller.

HEAD commit: 4bbf9020 6.13.0-rc4
git tree: upstream
kernel config: https://github.com/google/syzkaller/blob/master/dashboard/config/linux/upstream-apparmor-kasan.config
console output: https://drive.google.com/file/d/1Dj590opPBkB9nH71JBxAgSKWNaKP9qri/view?usp=sharing
syz repro: https://drive.google.com/file/d/1GjN34eBT9Lc-MKbfcxI188qttt-MO3cb/view?usp=sharing
C reproducer: https://drive.google.com/file/d/1-Lk-_2XtV5caK71T00FcC0JCg3k5ahei/view?usp=sharing

Environment:
Ubuntu 22.04 on Linux 5.15
QEMU emulator version 6.2.0
qemu-system-x86_64 \
-m 2G \
-smp 2 \
-kernel /home/wd/bzImage \
-append "console=ttyS0 root=/dev/sda earlyprintk=serial net.ifnames=0" \
-drive file=/home/wd/bullseye.img,format=raw \
-net user,host=10.0.2.10,hostfwd=tcp:127.0.0.1:10021-:22 \
-net nic,model=e1000 \
-enable-kvm \
-nographic \
-pidfile vm.pid \
2>&1 | tee vm.log

If you fix this issue, please add the following tag to the commit:
Reported-by: Jiacheng Xu <stitch@....edu.cn>

==================================================================
BUG: KASAN: slab-out-of-bounds in ocfs2_match fs/ocfs2/dir.c:334 [inline]
BUG: KASAN: slab-out-of-bounds in ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367
Read of size 1 at addr ffff88804d8b9982 by task syz-executor.2/14802

CPU: 0 UID: 0 PID: 14802 Comm: syz-executor.2 Not tainted 6.13.0-rc4 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Sched_ext: serialise (enabled+all), task: runnable_at=-10ms
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x229/0x350 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0x164/0x530 mm/kasan/report.c:489
 kasan_report+0x147/0x180 mm/kasan/report.c:602
 ocfs2_match fs/ocfs2/dir.c:334 [inline]
 ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367
 ocfs2_find_entry_id fs/ocfs2/dir.c:414 [inline]
 ocfs2_find_entry+0x1143/0x2db0 fs/ocfs2/dir.c:1078
 ocfs2_find_files_on_disk+0x18e/0x530 fs/ocfs2/dir.c:1981
 ocfs2_lookup_ino_from_name+0xb6/0x110 fs/ocfs2/dir.c:2003
 ocfs2_lookup+0x30a/0xd40 fs/ocfs2/namei.c:122
 lookup_open fs/namei.c:3627 [inline]
 open_last_lookups fs/namei.c:3748 [inline]
 path_openat+0x145a/0x3870 fs/namei.c:3984
 do_filp_open+0xe9/0x1c0 fs/namei.c:4014
 do_sys_openat2+0x135/0x1d0 fs/open.c:1402
 do_sys_open fs/open.c:1417 [inline]
 __do_sys_openat fs/open.c:1433 [inline]
 __se_sys_openat fs/open.c:1428 [inline]
 __x64_sys_openat+0x15d/0x1c0 fs/open.c:1428
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf6/0x210 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f01076903ad
Code: c3 e8 a7 2b 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 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:00007f01084acfc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f01077cbf80 RCX: 00007f01076903ad
RDX: 0000000000105042 RSI: 0000000020000080 RDI: ffffffffffffff9c
RBP: 00007f01077cbf80 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000000
R13: 00007f01077cbf80 R14: 00007f010764fc90 R15: 00007f010848d000
 </TASK>

Allocated by task 9658:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0x89/0xa0 mm/kasan/common.c:394
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __do_kmalloc_node mm/slub.c:4298 [inline]
 __kmalloc_noprof+0x290/0x540 mm/slub.c:4310
 kmalloc_noprof include/linux/slab.h:905 [inline]
 kzalloc_noprof include/linux/slab.h:1037 [inline]
 __register_sysctl_table+0xcf/0x1100 fs/proc/proc_sysctl.c:1375
 __devinet_sysctl_register+0x1f4/0x2e0 net/ipv4/devinet.c:2630
 devinet_sysctl_register+0x1eb/0x270 net/ipv4/devinet.c:2670
 inetdev_init+0x342/0x5d0 net/ipv4/devinet.c:299
 inetdev_event+0x381/0x1560 net/ipv4/devinet.c:1598
 notifier_call_chain+0x1c6/0x410 kernel/notifier.c:85
 call_netdevice_notifiers_extack net/core/dev.c:2034 [inline]
 call_netdevice_notifiers+0xd3/0x110 net/core/dev.c:2048
 register_netdevice+0x18fc/0x1d90 net/core/dev.c:10632
 veth_newlink+0x6ee/0x960 drivers/net/veth.c:1844
 rtnl_newlink_create+0x353/0x690 net/core/rtnetlink.c:3786
 __rtnl_newlink net/core/rtnetlink.c:3897 [inline]
 rtnl_newlink+0x13a9/0x1ac0 net/core/rtnetlink.c:4012
 rtnetlink_rcv_msg+0x8e1/0xf50 net/core/rtnetlink.c:6922
 netlink_rcv_skb+0x248/0x4e0 net/netlink/af_netlink.c:2542
 netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline]
 netlink_unicast+0x7b8/0x8e0 net/netlink/af_netlink.c:1347
 netlink_sendmsg+0xb42/0xe90 net/netlink/af_netlink.c:1891
 sock_sendmsg_nosec+0x1f5/0x250 net/socket.c:711
 __sock_sendmsg net/socket.c:726 [inline]
 __sys_sendto+0x45d/0x5d0 net/socket.c:2197
 __do_sys_sendto net/socket.c:2204 [inline]
 __se_sys_sendto net/socket.c:2200 [inline]
 __x64_sys_sendto+0x128/0x140 net/socket.c:2200
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf6/0x210 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88804d8b9000
 which belongs to the cache kmalloc-cg-2k of size 2048
The buggy address is located 1290 bytes to the right of
 allocated 1144-byte region [ffff88804d8b9000, ffff88804d8b9478)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4d8b8
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff8880730a4b01
flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000040 ffff88801d44f3c0 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000080008 00000001f5000000 ffff8880730a4b01
head: 04fff00000000040 ffff88801d44f3c0 dead000000000122 0000000000000000
head: 0000000000000000 0000000000080008 00000001f5000000 ffff8880730a4b01
head: 04fff00000000003 ffffea0001362e01 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 9658, tgid 9658 (syz-executor.2), ts 54055202793, free_ts 54050245815
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f6/0x240 mm/page_alloc.c:1558
 prep_new_page mm/page_alloc.c:1566 [inline]
 get_page_from_freelist+0x3586/0x36d0 mm/page_alloc.c:3476
 __alloc_pages_noprof+0x260/0x680 mm/page_alloc.c:4753
 alloc_pages_mpol_noprof+0x3c8/0x650 mm/mempolicy.c:2269
 alloc_slab_page+0x6a/0x110 mm/slub.c:2423
 allocate_slab+0x5f/0x2b0 mm/slub.c:2589
 new_slab mm/slub.c:2642 [inline]
 ___slab_alloc+0xbdf/0x1490 mm/slub.c:3830
 __slab_alloc mm/slub.c:3920 [inline]
 __slab_alloc_node mm/slub.c:3995 [inline]
 slab_alloc_node mm/slub.c:4156 [inline]
 __do_kmalloc_node mm/slub.c:4297 [inline]
 __kmalloc_node_track_caller_noprof+0x30f/0x520 mm/slub.c:4317
 kmemdup_noprof+0x2b/0x60 mm/util.c:135
 __devinet_sysctl_register+0xb1/0x2e0 net/ipv4/devinet.c:2618
 devinet_sysctl_register+0x1eb/0x270 net/ipv4/devinet.c:2670
 inetdev_init+0x342/0x5d0 net/ipv4/devinet.c:299
 inetdev_event+0x381/0x1560 net/ipv4/devinet.c:1598
 notifier_call_chain+0x1c6/0x410 kernel/notifier.c:85
 call_netdevice_notifiers_extack net/core/dev.c:2034 [inline]
 call_netdevice_notifiers+0xd3/0x110 net/core/dev.c:2048
 register_netdevice+0x18fc/0x1d90 net/core/dev.c:10632
page last free pid 9658 tgid 9658 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1127 [inline]
 free_unref_page+0xe32/0x1100 mm/page_alloc.c:2659
 discard_slab mm/slub.c:2688 [inline]
 __put_partials+0x15d/0x1b0 mm/slub.c:3157
 put_cpu_partial+0x17d/0x250 mm/slub.c:3232
 __slab_free+0x2de/0x3e0 mm/slub.c:4483
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x9a/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:250 [inline]
 slab_post_alloc_hook mm/slub.c:4119 [inline]
 slab_alloc_node mm/slub.c:4168 [inline]
 __kmalloc_cache_noprof+0x1c6/0x3d0 mm/slub.c:4324
 kmalloc_noprof include/linux/slab.h:901 [inline]
 kzalloc_noprof include/linux/slab.h:1037 [inline]
 kobject_uevent_env+0x27e/0x8c0 lib/kobject_uevent.c:540
 __kobject_del+0xd3/0x300 lib/kobject.c:601
 kobject_cleanup lib/kobject.c:680 [inline]
 kobject_release lib/kobject.c:720 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x26c/0x490 lib/kobject.c:737
 netdev_queue_update_kobjects+0x56f/0x640 net/core/net-sysfs.c:1857
 netif_set_real_num_tx_queues+0x1bf/0x980 net/core/dev.c:2944
 veth_init_queues+0x97/0x1b0 drivers/net/veth.c:1756
 veth_newlink+0x7a8/0x960 drivers/net/veth.c:1862
 rtnl_newlink_create+0x353/0x690 net/core/rtnetlink.c:3786

Memory state around the buggy address:
 ffff88804d8b9880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88804d8b9900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88804d8b9980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff88804d8b9a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88804d8b9a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ