linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [xfs?] KASAN: slab-use-after-free Read in xfs_inode_item_push
@ 2024-04-10 12:45 syzbot
  2024-09-26 21:46 ` syzbot
  0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2024-04-10 12:45 UTC (permalink / raw)
  To: chandan.babu, djwong, linux-fsdevel, linux-kernel, linux-xfs,
	syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    707081b61156 Merge branch 'for-next/core', remote-tracking..
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=168b2fe3180000
kernel config:  https://syzkaller.appspot.com/x/.config?x=caeac3f3565b057a
dashboard link: https://syzkaller.appspot.com/bug?extid=1a28995e12fd13faa44e
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6cad68bf7532/disk-707081b6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1a27e5400778/vmlinux-707081b6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/67dfc53755d0/Image-707081b6.gz.xz

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

==================================================================
BUG: KASAN: slab-use-after-free in xfs_inode_item_push+0x248/0x290 fs/xfs/xfs_inode_item.c:743
Read of size 8 at addr ffff0000ddfe0bb8 by task xfsaild/loop0/7856

CPU: 0 PID: 7856 Comm: xfsaild/loop0 Not tainted 6.8.0-rc7-syzkaller-g707081b61156 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call trace:
 dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x178/0x518 mm/kasan/report.c:488
 kasan_report+0xd8/0x138 mm/kasan/report.c:601
 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381
 xfs_inode_item_push+0x248/0x290 fs/xfs/xfs_inode_item.c:743
 xfsaild_push_item fs/xfs/xfs_trans_ail.c:414 [inline]
 xfsaild_push fs/xfs/xfs_trans_ail.c:486 [inline]
 xfsaild+0xbe8/0x2c18 fs/xfs/xfs_trans_ail.c:671
 kthread+0x288/0x310 kernel/kthread.c:388
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860

Allocated by task 7816:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x40/0x78 mm/kasan/common.c:68
 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:575
 unpoison_slab_object mm/kasan/common.c:312 [inline]
 __kasan_slab_alloc+0x74/0x8c mm/kasan/common.c:338
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slub.c:3813 [inline]
 slab_alloc_node mm/slub.c:3860 [inline]
 kmem_cache_alloc+0x1dc/0x488 mm/slub.c:3867
 kmem_cache_zalloc include/linux/slab.h:701 [inline]
 xfs_inode_item_init+0x3c/0xc0 fs/xfs/xfs_inode_item.c:838
 xfs_trans_ijoin+0xd8/0x114 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_create+0x8a4/0xf9c fs/xfs/xfs_inode.c:1040
 xfs_generic_create+0x3c8/0xb10 fs/xfs/xfs_iops.c:199
 xfs_vn_create+0x44/0x58 fs/xfs/xfs_iops.c:275
 lookup_open fs/namei.c:3500 [inline]
 open_last_lookups fs/namei.c:3569 [inline]
 path_openat+0xfb4/0x2830 fs/namei.c:3799
 do_filp_open+0x1bc/0x3cc fs/namei.c:3829
 do_sys_openat2+0x124/0x1b8 fs/open.c:1404
 do_sys_open fs/open.c:1419 [inline]
 __do_sys_openat fs/open.c:1435 [inline]
 __se_sys_openat fs/open.c:1430 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1430
 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598

Freed by task 22:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x40/0x78 mm/kasan/common.c:68
 kasan_save_free_info+0x54/0x6c mm/kasan/generic.c:589
 poison_slab_object+0x124/0x18c mm/kasan/common.c:240
 __kasan_slab_free+0x3c/0x70 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2121 [inline]
 slab_free mm/slub.c:4299 [inline]
 kmem_cache_free+0x15c/0x3d4 mm/slub.c:4363
 xfs_inode_item_destroy+0x80/0x94 fs/xfs/xfs_inode_item.c:860
 xfs_inode_free_callback+0x154/0x1cc fs/xfs/xfs_icache.c:145
 rcu_do_batch kernel/rcu/tree.c:2190 [inline]
 rcu_core+0x890/0x1b34 kernel/rcu/tree.c:2465
 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2482
 __do_softirq+0x2d8/0xce4 kernel/softirq.c:553

The buggy address belongs to the object at ffff0000ddfe0b88
 which belongs to the cache xfs_ili of size 264
The buggy address is located 48 bytes inside of
 freed 264-byte region [ffff0000ddfe0b88, ffff0000ddfe0c90)

The buggy address belongs to the physical page:
page:00000000b7c34688 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0000ddfe0668 pfn:0x11dfe0
flags: 0x5ffc00000000800(slab|node=0|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 05ffc00000000800 ffff0000c559d140 dead000000000122 0000000000000000
raw: ffff0000ddfe0668 00000000800c0004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000ddfe0a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff0000ddfe0b00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
>ffff0000ddfe0b80: fc fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff0000ddfe0c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000ddfe0c80: fb fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb
==================================================================


---
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 syzkaller@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [syzbot] [xfs?] KASAN: slab-use-after-free Read in xfs_inode_item_push
  2024-04-10 12:45 [syzbot] [xfs?] KASAN: slab-use-after-free Read in xfs_inode_item_push syzbot
@ 2024-09-26 21:46 ` syzbot
  2024-11-01  9:27   ` Julian Sun
  0 siblings, 1 reply; 4+ messages in thread
From: syzbot @ 2024-09-26 21:46 UTC (permalink / raw)
  To: chandan.babu, djwong, linux-fsdevel, linux-kernel, linux-xfs,
	syzkaller-bugs

syzbot has found a reproducer for the following issue on:

HEAD commit:    11a299a7933e Merge tag 'for-6.12/block-20240925' of git://..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1378aaa9980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=31f49563bb05c4a8
dashboard link: https://syzkaller.appspot.com/bug?extid=1a28995e12fd13faa44e
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=164f7627980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10923a80580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e97035004495/disk-11a299a7.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/0be318a25b1d/vmlinux-11a299a7.xz
kernel image: https://storage.googleapis.com/syzbot-assets/91f17271baa3/bzImage-11a299a7.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/971400d21e6d/mount_0.gz

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

BUG: KASAN: slab-use-after-free in xfs_inode_item_push+0x293/0x2e0 fs/xfs/xfs_inode_item.c:775
Read of size 8 at addr ffff8880774cfa70 by task xfsaild/loop2/10928

CPU: 1 UID: 0 PID: 10928 Comm: xfsaild/loop2 Not tainted 6.11.0-syzkaller-10669-g11a299a7933e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 xfs_inode_item_push+0x293/0x2e0 fs/xfs/xfs_inode_item.c:775
 xfsaild_push_item fs/xfs/xfs_trans_ail.c:395 [inline]
 xfsaild_push fs/xfs/xfs_trans_ail.c:523 [inline]
 xfsaild+0x112a/0x2e00 fs/xfs/xfs_trans_ail.c:705
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Allocated by task 10907:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 unpoison_slab_object mm/kasan/common.c:319 [inline]
 __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:345
 kasan_slab_alloc include/linux/kasan.h:247 [inline]
 slab_post_alloc_hook mm/slub.c:4086 [inline]
 slab_alloc_node mm/slub.c:4135 [inline]
 kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4142
 xfs_inode_item_init+0x33/0xc0 fs/xfs/xfs_inode_item.c:870
 xfs_trans_ijoin+0xeb/0x130 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_create+0x8a0/0xf60 fs/xfs/xfs_inode.c:720
 xfs_generic_create+0x5d5/0xf50 fs/xfs/xfs_iops.c:213
 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257
 do_mkdirat+0x264/0x3a0 fs/namei.c:4280
 __do_sys_mkdir fs/namei.c:4300 [inline]
 __se_sys_mkdir fs/namei.c:4298 [inline]
 __x64_sys_mkdir+0x6c/0x80 fs/namei.c:4298
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5213:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:2343 [inline]
 slab_free mm/slub.c:4580 [inline]
 kmem_cache_free+0x1a2/0x420 mm/slub.c:4682
 xfs_inode_free_callback+0x152/0x1d0 fs/xfs/xfs_icache.c:158
 rcu_do_batch kernel/rcu/tree.c:2567 [inline]
 rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823
 handle_softirqs+0x2c5/0x980 kernel/softirq.c:554
 __do_softirq kernel/softirq.c:588 [inline]
 invoke_softirq kernel/softirq.c:428 [inline]
 __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1037 [inline]
 sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1037
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702

The buggy address belongs to the object at ffff8880774cfa40
 which belongs to the cache xfs_ili of size 264
The buggy address is located 48 bytes inside of
 freed 264-byte region [ffff8880774cfa40, ffff8880774cfb48)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x774cf
ksm flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000000 ffff888142abe140 ffffea0001d56080 0000000000000007
raw: 0000000000000000 00000000000c000c 00000001f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Reclaimable, gfp_mask 0x52c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_RECLAIMABLE), pid 5289, tgid 5289 (syz-executor269), ts 76754520423, free_ts 21942205490
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1537
 prep_new_page mm/page_alloc.c:1545 [inline]
 get_page_from_freelist+0x3039/0x3180 mm/page_alloc.c:3457
 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4733
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
 alloc_slab_page+0x6a/0x120 mm/slub.c:2413
 allocate_slab+0x5a/0x2f0 mm/slub.c:2579
 new_slab mm/slub.c:2632 [inline]
 ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3819
 __slab_alloc+0x58/0xa0 mm/slub.c:3909
 __slab_alloc_node mm/slub.c:3962 [inline]
 slab_alloc_node mm/slub.c:4123 [inline]
 kmem_cache_alloc_noprof+0x1c1/0x2a0 mm/slub.c:4142
 xfs_inode_item_init+0x33/0xc0 fs/xfs/xfs_inode_item.c:870
 xfs_trans_ijoin+0xeb/0x130 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_icreate+0x13a/0x1f0 fs/xfs/xfs_inode.c:593
 xfs_symlink+0xa74/0x1230 fs/xfs/xfs_symlink.c:170
 xfs_vn_symlink+0x1f5/0x740 fs/xfs/xfs_iops.c:443
 vfs_symlink+0x137/0x2e0 fs/namei.c:4615
 do_symlinkat+0x222/0x3a0 fs/namei.c:4641
page last free pid 1 tgid 1 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1108 [inline]
 free_unref_page+0xcd0/0xf00 mm/page_alloc.c:2638
 free_contig_range+0x152/0x550 mm/page_alloc.c:6748
 destroy_args+0x8a/0x840 mm/debug_vm_pgtable.c:1017
 debug_vm_pgtable+0x4be/0x550 mm/debug_vm_pgtable.c:1397
 do_one_initcall+0x248/0x880 init/main.c:1269
 do_initcall_level+0x157/0x210 init/main.c:1331
 do_initcalls+0x3f/0x80 init/main.c:1347
 kernel_init_freeable+0x435/0x5d0 init/main.c:1580
 kernel_init+0x1d/0x2b0 init/main.c:1469
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Memory state around the buggy address:
 ffff8880774cf900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880774cf980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880774cfa00: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
                                                             ^
 ffff8880774cfa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880774cfb00: fb fb fb fb fb fb fb fb fb 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [syzbot] [xfs?] KASAN: slab-use-after-free Read in xfs_inode_item_push
  2024-09-26 21:46 ` syzbot
@ 2024-11-01  9:27   ` Julian Sun
  2024-11-01  9:50     ` syzbot
  0 siblings, 1 reply; 4+ messages in thread
From: Julian Sun @ 2024-11-01  9:27 UTC (permalink / raw)
  To: syzbot, chandan.babu, djwong, linux-fsdevel, linux-kernel,
	linux-xfs, syzkaller-bugs

On Thu, 2024-09-26 at 14:46 -0700, syzbot wrote:
> syzbot has found a reproducer for the following issue on:
> 
> HEAD commit:    11a299a7933e Merge tag 'for-6.12/block-20240925' of
> git://..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1378aaa9980000
> kernel config: 
> https://syzkaller.appspot.com/x/.config?x=31f49563bb05c4a8
> dashboard link:
> https://syzkaller.appspot.com/bug?extid=1a28995e12fd13faa44e
> 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=164f7627980000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10923a80580000
> 
> Downloadable assets:
> disk image:
> https://storage.googleapis.com/syzbot-assets/e97035004495/disk-11a299a7.raw.xz
> vmlinux:
> https://storage.googleapis.com/syzbot-assets/0be318a25b1d/vmlinux-11a299a7.xz
> kernel image:
> https://storage.googleapis.com/syzbot-assets/91f17271baa3/bzImage-11a299a7.xz
> mounted in repro:
> https://storage.googleapis.com/syzbot-assets/971400d21e6d/mount_0.gz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the
> commit:
> Reported-by: syzbot+1a28995e12fd13faa44e@syzkaller.appspotmail.com
> 
> BUG: KASAN: slab-use-after-free in xfs_inode_item_push+0x293/0x2e0
> fs/xfs/xfs_inode_item.c:775
> Read of size 8 at addr ffff8880774cfa70 by task xfsaild/loop2/10928
> 
> CPU: 1 UID: 0 PID: 10928 Comm: xfsaild/loop2 Not tainted 6.11.0-
> syzkaller-10669-g11a299a7933e #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 09/13/2024
> Call Trace:
>  <TASK>
>  __dump_stack lib/dump_stack.c:94 [inline]
>  dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
>  print_address_description mm/kasan/report.c:377 [inline]
>  print_report+0x169/0x550 mm/kasan/report.c:488
>  kasan_report+0x143/0x180 mm/kasan/report.c:601
>  xfs_inode_item_push+0x293/0x2e0 fs/xfs/xfs_inode_item.c:775
>  xfsaild_push_item fs/xfs/xfs_trans_ail.c:395 [inline]
>  xfsaild_push fs/xfs/xfs_trans_ail.c:523 [inline]
>  xfsaild+0x112a/0x2e00 fs/xfs/xfs_trans_ail.c:705
>  kthread+0x2f0/0x390 kernel/kthread.c:389
>  ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>  </TASK>
> 
> Allocated by task 10907:
>  kasan_save_stack mm/kasan/common.c:47 [inline]
>  kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
>  unpoison_slab_object mm/kasan/common.c:319 [inline]
>  __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:345
>  kasan_slab_alloc include/linux/kasan.h:247 [inline]
>  slab_post_alloc_hook mm/slub.c:4086 [inline]
>  slab_alloc_node mm/slub.c:4135 [inline]
>  kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4142
>  xfs_inode_item_init+0x33/0xc0 fs/xfs/xfs_inode_item.c:870
>  xfs_trans_ijoin+0xeb/0x130 fs/xfs/libxfs/xfs_trans_inode.c:36
>  xfs_create+0x8a0/0xf60 fs/xfs/xfs_inode.c:720
>  xfs_generic_create+0x5d5/0xf50 fs/xfs/xfs_iops.c:213
>  vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257
>  do_mkdirat+0x264/0x3a0 fs/namei.c:4280
>  __do_sys_mkdir fs/namei.c:4300 [inline]
>  __se_sys_mkdir fs/namei.c:4298 [inline]
>  __x64_sys_mkdir+0x6c/0x80 fs/namei.c:4298
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> Freed by task 5213:
>  kasan_save_stack mm/kasan/common.c:47 [inline]
>  kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
>  kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
>  poison_slab_object mm/kasan/common.c:247 [inline]
>  __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
>  kasan_slab_free include/linux/kasan.h:230 [inline]
>  slab_free_hook mm/slub.c:2343 [inline]
>  slab_free mm/slub.c:4580 [inline]
>  kmem_cache_free+0x1a2/0x420 mm/slub.c:4682
>  xfs_inode_free_callback+0x152/0x1d0 fs/xfs/xfs_icache.c:158
>  rcu_do_batch kernel/rcu/tree.c:2567 [inline]
>  rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823
>  handle_softirqs+0x2c5/0x980 kernel/softirq.c:554
>  __do_softirq kernel/softirq.c:588 [inline]
>  invoke_softirq kernel/softirq.c:428 [inline]
>  __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
>  irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
>  instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1037
> [inline]
>  sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1037
>  asm_sysvec_apic_timer_interrupt+0x1a/0x20
> arch/x86/include/asm/idtentry.h:702
> 
> The buggy address belongs to the object at ffff8880774cfa40
>  which belongs to the cache xfs_ili of size 264
> The buggy address is located 48 bytes inside of
>  freed 264-byte region [ffff8880774cfa40, ffff8880774cfb48)
> 
> The buggy address belongs to the physical page:
> page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
> pfn:0x774cf
> ksm flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
> page_type: f5(slab)
> raw: 00fff00000000000 ffff888142abe140 ffffea0001d56080 0000000000000007
> raw: 0000000000000000 00000000000c000c 00000001f5000000 0000000000000000
> page dumped because: kasan: bad access detected
> page_owner tracks the page as allocated
> page last allocated via order 0, migratetype Reclaimable, gfp_mask
> 0x52c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_RECLAIMABLE)
> , pid 5289, tgid 5289 (syz-executor269), ts 76754520423, free_ts
> 21942205490
>  set_page_owner include/linux/page_owner.h:32 [inline]
>  post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1537
>  prep_new_page mm/page_alloc.c:1545 [inline]
>  get_page_from_freelist+0x3039/0x3180 mm/page_alloc.c:3457
>  __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4733
>  alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
>  alloc_slab_page+0x6a/0x120 mm/slub.c:2413
>  allocate_slab+0x5a/0x2f0 mm/slub.c:2579
>  new_slab mm/slub.c:2632 [inline]
>  ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3819
>  __slab_alloc+0x58/0xa0 mm/slub.c:3909
>  __slab_alloc_node mm/slub.c:3962 [inline]
>  slab_alloc_node mm/slub.c:4123 [inline]
>  kmem_cache_alloc_noprof+0x1c1/0x2a0 mm/slub.c:4142
>  xfs_inode_item_init+0x33/0xc0 fs/xfs/xfs_inode_item.c:870
>  xfs_trans_ijoin+0xeb/0x130 fs/xfs/libxfs/xfs_trans_inode.c:36
>  xfs_icreate+0x13a/0x1f0 fs/xfs/xfs_inode.c:593
>  xfs_symlink+0xa74/0x1230 fs/xfs/xfs_symlink.c:170
>  xfs_vn_symlink+0x1f5/0x740 fs/xfs/xfs_iops.c:443
>  vfs_symlink+0x137/0x2e0 fs/namei.c:4615
>  do_symlinkat+0x222/0x3a0 fs/namei.c:4641
> page last free pid 1 tgid 1 stack trace:
>  reset_page_owner include/linux/page_owner.h:25 [inline]
>  free_pages_prepare mm/page_alloc.c:1108 [inline]
>  free_unref_page+0xcd0/0xf00 mm/page_alloc.c:2638
>  free_contig_range+0x152/0x550 mm/page_alloc.c:6748
>  destroy_args+0x8a/0x840 mm/debug_vm_pgtable.c:1017
>  debug_vm_pgtable+0x4be/0x550 mm/debug_vm_pgtable.c:1397
>  do_one_initcall+0x248/0x880 init/main.c:1269
>  do_initcall_level+0x157/0x210 init/main.c:1331
>  do_initcalls+0x3f/0x80 init/main.c:1347
>  kernel_init_freeable+0x435/0x5d0 init/main.c:1580
>  kernel_init+0x1d/0x2b0 init/main.c:1469
>  ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
> 
> Memory state around the buggy address:
>  ffff8880774cf900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>  ffff8880774cf980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> > ffff8880774cfa00: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
>                                                              ^
>  ffff8880774cfa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>  ffff8880774cfb00: fb fb fb fb fb fb fb fb fb 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.

#syz test

-- 
Julian Sun <sunjunchao2870@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [syzbot] [xfs?] KASAN: slab-use-after-free Read in xfs_inode_item_push
  2024-11-01  9:27   ` Julian Sun
@ 2024-11-01  9:50     ` syzbot
  0 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2024-11-01  9:50 UTC (permalink / raw)
  To: chandan.babu, djwong, linux-fsdevel, linux-kernel, linux-xfs,
	sunjunchao2870, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-use-after-free Read in xfs_inode_item_push

==================================================================
BUG: KASAN: slab-use-after-free in xfs_inode_item_push+0x293/0x2e0 fs/xfs/xfs_inode_item.c:775
Read of size 8 at addr ffff888061c9b698 by task xfsaild/loop2/7823

CPU: 1 UID: 0 PID: 7823 Comm: xfsaild/loop2 Not tainted 6.12.0-rc5-syzkaller-00181-g6c52d4da1c74 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 xfs_inode_item_push+0x293/0x2e0 fs/xfs/xfs_inode_item.c:775
 xfsaild_push_item fs/xfs/xfs_trans_ail.c:395 [inline]
 xfsaild_push fs/xfs/xfs_trans_ail.c:523 [inline]
 xfsaild+0x112a/0x2e00 fs/xfs/xfs_trans_ail.c:705
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Allocated by task 7799:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 unpoison_slab_object mm/kasan/common.c:319 [inline]
 __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:345
 kasan_slab_alloc include/linux/kasan.h:247 [inline]
 slab_post_alloc_hook mm/slub.c:4085 [inline]
 slab_alloc_node mm/slub.c:4134 [inline]
 kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4141
 xfs_inode_item_init+0x33/0xc0 fs/xfs/xfs_inode_item.c:870
 xfs_trans_ijoin+0xeb/0x130 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_create+0x8a0/0xf60 fs/xfs/xfs_inode.c:720
 xfs_generic_create+0x5d5/0xf50 fs/xfs/xfs_iops.c:213
 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257
 do_mkdirat+0x264/0x3a0 fs/namei.c:4280
 __do_sys_mkdirat fs/namei.c:4295 [inline]
 __se_sys_mkdirat fs/namei.c:4293 [inline]
 __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4293
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 6015:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:2342 [inline]
 slab_free mm/slub.c:4579 [inline]
 kmem_cache_free+0x1a2/0x420 mm/slub.c:4681
 xfs_inode_free_callback+0x152/0x1d0 fs/xfs/xfs_icache.c:158
 rcu_do_batch kernel/rcu/tree.c:2567 [inline]
 rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823
 handle_softirqs+0x2c5/0x980 kernel/softirq.c:554
 __do_softirq kernel/softirq.c:588 [inline]
 invoke_softirq kernel/softirq.c:428 [inline]
 __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline]
 sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1049
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702

The buggy address belongs to the object at ffff888061c9b668
 which belongs to the cache xfs_ili of size 264
The buggy address is located 48 bytes inside of
 freed 264-byte region [ffff888061c9b668, ffff888061c9b770)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x61c9b
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000000 ffff88801d3c8dc0 ffffea00017d0300 0000000000000004
raw: 0000000000000000 00000000800c000c 00000001f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Reclaimable, gfp_mask 0x52c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_RECLAIMABLE), pid 6527, tgid 6525 (syz.4.33), ts 123832632595, free_ts 120134322172
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1537
 prep_new_page mm/page_alloc.c:1545 [inline]
 get_page_from_freelist+0x3033/0x3180 mm/page_alloc.c:3457
 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4733
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
 alloc_slab_page+0x6a/0x120 mm/slub.c:2412
 allocate_slab+0x5a/0x2f0 mm/slub.c:2578
 new_slab mm/slub.c:2631 [inline]
 ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3818
 __slab_alloc+0x58/0xa0 mm/slub.c:3908
 __slab_alloc_node mm/slub.c:3961 [inline]
 slab_alloc_node mm/slub.c:4122 [inline]
 kmem_cache_alloc_noprof+0x1c1/0x2a0 mm/slub.c:4141
 xfs_inode_item_init+0x33/0xc0 fs/xfs/xfs_inode_item.c:870
 xfs_trans_ijoin+0xeb/0x130 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_create+0x8a0/0xf60 fs/xfs/xfs_inode.c:720
 xfs_generic_create+0x5d5/0xf50 fs/xfs/xfs_iops.c:213
 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257
 do_mkdirat+0x264/0x3a0 fs/namei.c:4280
 __do_sys_mkdirat fs/namei.c:4295 [inline]
 __se_sys_mkdirat fs/namei.c:4293 [inline]
 __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4293
page last free pid 4674 tgid 4674 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1108 [inline]
 free_unref_page+0xcd0/0xf00 mm/page_alloc.c:2638
 discard_slab mm/slub.c:2677 [inline]
 __put_partials+0xeb/0x130 mm/slub.c:3145
 put_cpu_partial+0x17c/0x250 mm/slub.c:3220
 __slab_free+0x2ea/0x3d0 mm/slub.c:4449
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x9a/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:247 [inline]
 slab_post_alloc_hook mm/slub.c:4085 [inline]
 slab_alloc_node mm/slub.c:4134 [inline]
 kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4141
 getname_flags+0xb7/0x540 fs/namei.c:139
 do_sys_openat2+0xd2/0x1d0 fs/open.c:1409
 do_sys_open fs/open.c:1430 [inline]
 __do_sys_openat fs/open.c:1446 [inline]
 __se_sys_openat fs/open.c:1441 [inline]
 __x64_sys_openat+0x247/0x2a0 fs/open.c:1441
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff888061c9b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888061c9b600: fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb
>ffff888061c9b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff888061c9b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
 ffff888061c9b780: fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb fb
==================================================================


Tested on:

commit:         6c52d4da Merge tag 'for-linus' of git://git.kernel.org..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13345340580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e9b3366c241ed3c7
dashboard link: https://syzkaller.appspot.com/bug?extid=1a28995e12fd13faa44e
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Note: no patches were applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-01  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-10 12:45 [syzbot] [xfs?] KASAN: slab-use-after-free Read in xfs_inode_item_push syzbot
2024-09-26 21:46 ` syzbot
2024-11-01  9:27   ` Julian Sun
2024-11-01  9:50     ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).