public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd
@ 2024-12-31 13:27 syzbot
  2024-12-31 13:32 ` Eric Dumazet
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: syzbot @ 2024-12-31 13:27 UTC (permalink / raw)
  To: amir73il, jack, linux-fsdevel, linux-kernel, repnop,
	syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    8155b4ef3466 Add linux-next specific files for 20241220
git tree:       linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=105ba818580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9c90bb7161a56c88
dashboard link: https://syzkaller.appspot.com/bug?extid=6a3aa63412255587b21b
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=10e670b0580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13f42ac4580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/98a974fc662d/disk-8155b4ef.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2dea9b72f624/vmlinux-8155b4ef.xz
kernel image: https://storage.googleapis.com/syzbot-assets/593a42b9eb34/bzImage-8155b4ef.xz

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

RAX: ffffffffffffffda RBX: 00007ffd163c2680 RCX: 00007f8b75a4d669
RDX: 00007f8b75a4c8a0 RSI: 0000000000000000 RDI: 0000000000000008
RBP: 0000000000000001 R08: 00007ffd163c2407 R09: 00000000000000a0
R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000001
R13: 431bde82d7b634db R14: 0000000000000001 R15: 0000000000000001
 </TASK>
==================================================================
BUG: KASAN: use-after-free in instrument_write include/linux/instrumented.h:40 [inline]
BUG: KASAN: use-after-free in ___clear_bit include/asm-generic/bitops/instrumented-non-atomic.h:44 [inline]
BUG: KASAN: use-after-free in __clear_open_fd fs/file.c:324 [inline]
BUG: KASAN: use-after-free in __put_unused_fd+0xdb/0x2a0 fs/file.c:600
Write of size 8 at addr ffff88804952aa48 by task syz-executor128/5830

CPU: 1 UID: 0 PID: 5830 Comm: syz-executor128 Not tainted 6.13.0-rc3-next-20241220-syzkaller #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:378 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:489
 kasan_report+0x143/0x180 mm/kasan/report.c:602
 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189
 instrument_write include/linux/instrumented.h:40 [inline]
 ___clear_bit include/asm-generic/bitops/instrumented-non-atomic.h:44 [inline]
 __clear_open_fd fs/file.c:324 [inline]
 __put_unused_fd+0xdb/0x2a0 fs/file.c:600
 put_unused_fd+0x5c/0x70 fs/file.c:609
 __do_sys_fanotify_init fs/notify/fanotify/fanotify_user.c:1628 [inline]
 __se_sys_fanotify_init+0x800/0x970 fs/notify/fanotify/fanotify_user.c:1466
 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
RIP: 0033:0x7f8b75a4d669
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 a1 1a 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:00007ffd163c2668 EFLAGS: 00000246 ORIG_RAX: 000000000000012c
RAX: ffffffffffffffda RBX: 00007ffd163c2680 RCX: 00007f8b75a4d669
RDX: 00007f8b75a4c8a0 RSI: 0000000000000000 RDI: 0000000000000008
RBP: 0000000000000001 R08: 00007ffd163c2407 R09: 00000000000000a0
R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000001
R13: 431bde82d7b634db R14: 0000000000000001 R15: 0000000000000001
 </TASK>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4952a
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0xcc0(GFP_KERNEL), pid 1, tgid 1 (swapper/0), ts 21408968854, free_ts 21922910177
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1551
 split_free_pages+0xe1/0x2d0 mm/page_alloc.c:6374
 alloc_contig_range_noprof+0x10eb/0x1770 mm/page_alloc.c:6551
 __alloc_contig_pages mm/page_alloc.c:6581 [inline]
 alloc_contig_pages_noprof+0x4b3/0x5c0 mm/page_alloc.c:6663
 debug_vm_pgtable_alloc_huge_page+0xaf/0x100 mm/debug_vm_pgtable.c:1084
 init_args+0x83b/0xb20 mm/debug_vm_pgtable.c:1266
 debug_vm_pgtable+0xe0/0x550 mm/debug_vm_pgtable.c:1304
 do_one_initcall+0x248/0x870 init/main.c:1267
 do_initcall_level+0x157/0x210 init/main.c:1329
 do_initcalls+0x3f/0x80 init/main.c:1345
 kernel_init_freeable+0x435/0x5d0 init/main.c:1578
 kernel_init+0x1d/0x2b0 init/main.c:1467
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
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:1127 [inline]
 free_frozen_pages+0xe0d/0x10e0 mm/page_alloc.c:2660
 free_contig_range+0x14c/0x430 mm/page_alloc.c:6697
 destroy_args+0x92/0x910 mm/debug_vm_pgtable.c:1017
 debug_vm_pgtable+0x4be/0x550 mm/debug_vm_pgtable.c:1397
 do_one_initcall+0x248/0x870 init/main.c:1267
 do_initcall_level+0x157/0x210 init/main.c:1329
 do_initcalls+0x3f/0x80 init/main.c:1345
 kernel_init_freeable+0x435/0x5d0 init/main.c:1578
 kernel_init+0x1d/0x2b0 init/main.c:1467
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Memory state around the buggy address:
 ffff88804952a900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88804952a980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88804952aa00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                              ^
 ffff88804952aa80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88804952ab00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


---
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 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.

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] 8+ messages in thread

* Re: [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd
  2024-12-31 13:27 [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd syzbot
@ 2024-12-31 13:32 ` Eric Dumazet
  2024-12-31 13:41   ` syzbot
  2024-12-31 22:15 ` syzbot
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2024-12-31 13:32 UTC (permalink / raw)
  To: syzbot, amir73il, jack, linux-fsdevel, linux-kernel, repnop,
	syzkaller-bugs, Al Viro


On 12/31/24 2:27 PM, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    8155b4ef3466 Add linux-next specific files for 20241220
> git tree:       linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=105ba818580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=9c90bb7161a56c88
> dashboard link: https://syzkaller.appspot.com/bug?extid=6a3aa63412255587b21b
> 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=10e670b0580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13f42ac4580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/98a974fc662d/disk-8155b4ef.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/2dea9b72f624/vmlinux-8155b4ef.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/593a42b9eb34/bzImage-8155b4ef.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+6a3aa63412255587b21b@syzkaller.appspotmail.com
>
> RAX: ffffffffffffffda RBX: 00007ffd163c2680 RCX: 00007f8b75a4d669
> RDX: 00007f8b75a4c8a0 RSI: 0000000000000000 RDI: 0000000000000008
> RBP: 0000000000000001 R08: 00007ffd163c2407 R09: 00000000000000a0
> R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000001
> R13: 431bde82d7b634db R14: 0000000000000001 R15: 0000000000000001
>   </TASK>
> ==================================================================
> BUG: KASAN: use-after-free in instrument_write include/linux/instrumented.h:40 [inline]
> BUG: KASAN: use-after-free in ___clear_bit include/asm-generic/bitops/instrumented-non-atomic.h:44 [inline]
> BUG: KASAN: use-after-free in __clear_open_fd fs/file.c:324 [inline]
> BUG: KASAN: use-after-free in __put_unused_fd+0xdb/0x2a0 fs/file.c:600
> Write of size 8 at addr ffff88804952aa48 by task syz-executor128/5830
>
> CPU: 1 UID: 0 PID: 5830 Comm: syz-executor128 Not tainted 6.13.0-rc3-next-20241220-syzkaller #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:378 [inline]
>   print_report+0x169/0x550 mm/kasan/report.c:489
>   kasan_report+0x143/0x180 mm/kasan/report.c:602
>   kasan_check_range+0x282/0x290 mm/kasan/generic.c:189
>   instrument_write include/linux/instrumented.h:40 [inline]
>   ___clear_bit include/asm-generic/bitops/instrumented-non-atomic.h:44 [inline]
>   __clear_open_fd fs/file.c:324 [inline]
>   __put_unused_fd+0xdb/0x2a0 fs/file.c:600
>   put_unused_fd+0x5c/0x70 fs/file.c:609
>   __do_sys_fanotify_init fs/notify/fanotify/fanotify_user.c:1628 [inline]
>   __se_sys_fanotify_init+0x800/0x970 fs/notify/fanotify/fanotify_user.c:1466
>   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
> RIP: 0033:0x7f8b75a4d669
> Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 a1 1a 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:00007ffd163c2668 EFLAGS: 00000246 ORIG_RAX: 000000000000012c
> RAX: ffffffffffffffda RBX: 00007ffd163c2680 RCX: 00007f8b75a4d669
> RDX: 00007f8b75a4c8a0 RSI: 0000000000000000 RDI: 0000000000000008
> RBP: 0000000000000001 R08: 00007ffd163c2407 R09: 00000000000000a0
> R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000001
> R13: 431bde82d7b634db R14: 0000000000000001 R15: 0000000000000001
>   </TASK>
>
> The buggy address belongs to the physical page:
> page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4952a
> flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
> raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000
> raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
> page dumped because: kasan: bad access detected
> page_owner tracks the page as freed
> page last allocated via order 0, migratetype Unmovable, gfp_mask 0xcc0(GFP_KERNEL), pid 1, tgid 1 (swapper/0), ts 21408968854, free_ts 21922910177
>   set_page_owner include/linux/page_owner.h:32 [inline]
>   post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1551
>   split_free_pages+0xe1/0x2d0 mm/page_alloc.c:6374
>   alloc_contig_range_noprof+0x10eb/0x1770 mm/page_alloc.c:6551
>   __alloc_contig_pages mm/page_alloc.c:6581 [inline]
>   alloc_contig_pages_noprof+0x4b3/0x5c0 mm/page_alloc.c:6663
>   debug_vm_pgtable_alloc_huge_page+0xaf/0x100 mm/debug_vm_pgtable.c:1084
>   init_args+0x83b/0xb20 mm/debug_vm_pgtable.c:1266
>   debug_vm_pgtable+0xe0/0x550 mm/debug_vm_pgtable.c:1304
>   do_one_initcall+0x248/0x870 init/main.c:1267
>   do_initcall_level+0x157/0x210 init/main.c:1329
>   do_initcalls+0x3f/0x80 init/main.c:1345
>   kernel_init_freeable+0x435/0x5d0 init/main.c:1578
>   kernel_init+0x1d/0x2b0 init/main.c:1467
>   ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:148
>   ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
> 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:1127 [inline]
>   free_frozen_pages+0xe0d/0x10e0 mm/page_alloc.c:2660
>   free_contig_range+0x14c/0x430 mm/page_alloc.c:6697
>   destroy_args+0x92/0x910 mm/debug_vm_pgtable.c:1017
>   debug_vm_pgtable+0x4be/0x550 mm/debug_vm_pgtable.c:1397
>   do_one_initcall+0x248/0x870 init/main.c:1267
>   do_initcall_level+0x157/0x210 init/main.c:1329
>   do_initcalls+0x3f/0x80 init/main.c:1345
>   kernel_init_freeable+0x435/0x5d0 init/main.c:1578
>   kernel_init+0x1d/0x2b0 init/main.c:1467
>   ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:148
>   ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> Memory state around the buggy address:
>   ffff88804952a900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>   ffff88804952a980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>> ffff88804952aa00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>                                                ^
>   ffff88804952aa80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>   ffff88804952ab00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ==================================================================
>
>
> ---
> 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 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.
>
> 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
>
#syz test

diff --git a/fs/notify/fanotify/fanotify_user.c 
b/fs/notify/fanotify/fanotify_user.c
index 19435cd2c41f..6ff94e312232 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -1624,8 +1624,8 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, 
flags, unsigned int, event_f_flags)
         file = anon_inode_getfile_fmode("[fanotify]", &fanotify_fops, 
group,
                                         f_flags, FMODE_NONOTIFY);
         if (IS_ERR(file)) {
-               fd = PTR_ERR(file);
                 put_unused_fd(fd);
+               fd = PTR_ERR(file);
                 goto out_destroy_group;
         }
         fd_install(fd, file);


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

* Re: [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd
  2024-12-31 13:32 ` Eric Dumazet
@ 2024-12-31 13:41   ` syzbot
  0 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2024-12-31 13:41 UTC (permalink / raw)
  To: amir73il, eric.dumazet, jack, linux-fsdevel, linux-kernel, repnop,
	syzkaller-bugs, viro

Hello,

syzbot tried to test the proposed patch but the build/boot failed:

failed to apply patch:
checking file fs/notify/fanotify/fanotify_user.c
Hunk #1 FAILED at 1624.
1 out of 1 hunk FAILED



Tested on:

commit:         8155b4ef Add linux-next specific files for 20241220
git tree:       linux-next
kernel config:  https://syzkaller.appspot.com/x/.config?x=9c90bb7161a56c88
dashboard link: https://syzkaller.appspot.com/bug?extid=6a3aa63412255587b21b
compiler:       
patch:          https://syzkaller.appspot.com/x/patch.diff?x=10931af8580000


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

* Re: [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd
  2024-12-31 13:27 [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd syzbot
  2024-12-31 13:32 ` Eric Dumazet
@ 2024-12-31 22:15 ` syzbot
  2025-01-01  1:34 ` Hillf Danton
  2025-01-06 11:15 ` Jan Kara
  3 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2024-12-31 22:15 UTC (permalink / raw)
  To: amir73il, eric.dumazet, jack, linux-fsdevel, linux-kernel, repnop,
	syzkaller-bugs, viro

syzbot has bisected this issue to:

commit ebe559609d7829b52c6642b581860760984faf9d
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Fri Nov 15 15:30:14 2024 +0000

    fs: get rid of __FMODE_NONOTIFY kludge

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=113e5818580000
start commit:   8155b4ef3466 Add linux-next specific files for 20241220
git tree:       linux-next
final oops:     https://syzkaller.appspot.com/x/report.txt?x=133e5818580000
console output: https://syzkaller.appspot.com/x/log.txt?x=153e5818580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9c90bb7161a56c88
dashboard link: https://syzkaller.appspot.com/bug?extid=6a3aa63412255587b21b
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10e670b0580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13f42ac4580000

Reported-by: syzbot+6a3aa63412255587b21b@syzkaller.appspotmail.com
Fixes: ebe559609d78 ("fs: get rid of __FMODE_NONOTIFY kludge")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

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

* Re: [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd
  2024-12-31 13:27 [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd syzbot
  2024-12-31 13:32 ` Eric Dumazet
  2024-12-31 22:15 ` syzbot
@ 2025-01-01  1:34 ` Hillf Danton
  2025-01-01  2:03   ` syzbot
  2025-01-06 11:15 ` Jan Kara
  3 siblings, 1 reply; 8+ messages in thread
From: Hillf Danton @ 2025-01-01  1:34 UTC (permalink / raw)
  To: syzbot, linux-fsdevel, linux-kernel, syzkaller-bugs, Al Viro; +Cc: Eric Dumazet

On 12/31/24 2:27 PM, syzbot wrote:
> syzbot found the following issue on:
>
> HEAD commit:    8155b4ef3466 Add linux-next specific files for 20241220
> git tree:       linux-next
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13f42ac4580000

Test Eric's patch.

#syz test

--- x/fs/notify/fanotify/fanotify_user.c
+++ y/fs/notify/fanotify/fanotify_user.c
@@ -1624,8 +1624,8 @@ SYSCALL_DEFINE2(fanotify_init, unsigned
 	file = anon_inode_getfile_fmode("[fanotify]", &fanotify_fops, group,
 					f_flags, FMODE_NONOTIFY);
 	if (IS_ERR(file)) {
-		fd = PTR_ERR(file);
 		put_unused_fd(fd);
+		fd = PTR_ERR(file);
 		goto out_destroy_group;
 	}
 	fd_install(fd, file);
--

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

* Re: [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd
  2025-01-01  1:34 ` Hillf Danton
@ 2025-01-01  2:03   ` syzbot
  0 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2025-01-01  2:03 UTC (permalink / raw)
  To: eric.dumazet, hdanton, linux-fsdevel, linux-kernel,
	syzkaller-bugs, viro

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+6a3aa63412255587b21b@syzkaller.appspotmail.com
Tested-by: syzbot+6a3aa63412255587b21b@syzkaller.appspotmail.com

Tested on:

commit:         8155b4ef Add linux-next specific files for 20241220
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=12a85af8580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9c90bb7161a56c88
dashboard link: https://syzkaller.appspot.com/bug?extid=6a3aa63412255587b21b
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=11717ac4580000

Note: testing is done by a robot and is best-effort only.

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

* Re: [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd
  2024-12-31 13:27 [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd syzbot
                   ` (2 preceding siblings ...)
  2025-01-01  1:34 ` Hillf Danton
@ 2025-01-06 11:15 ` Jan Kara
  2025-01-06 11:49   ` syzbot
  3 siblings, 1 reply; 8+ messages in thread
From: Jan Kara @ 2025-01-06 11:15 UTC (permalink / raw)
  To: syzbot; +Cc: amir73il, jack, linux-fsdevel, linux-kernel, repnop,
	syzkaller-bugs

On Tue 31-12-24 05:27:19, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    8155b4ef3466 Add linux-next specific files for 20241220
> git tree:       linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=105ba818580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=9c90bb7161a56c88
> dashboard link: https://syzkaller.appspot.com/bug?extid=6a3aa63412255587b21b
> 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=10e670b0580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13f42ac4580000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/98a974fc662d/disk-8155b4ef.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/2dea9b72f624/vmlinux-8155b4ef.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/593a42b9eb34/bzImage-8155b4ef.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+6a3aa63412255587b21b@syzkaller.appspotmail.com
> 
> RAX: ffffffffffffffda RBX: 00007ffd163c2680 RCX: 00007f8b75a4d669
> RDX: 00007f8b75a4c8a0 RSI: 0000000000000000 RDI: 0000000000000008
> RBP: 0000000000000001 R08: 00007ffd163c2407 R09: 00000000000000a0
> R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000001
> R13: 431bde82d7b634db R14: 0000000000000001 R15: 0000000000000001
>  </TASK>
> ==================================================================
> BUG: KASAN: use-after-free in instrument_write include/linux/instrumented.h:40 [inline]
> BUG: KASAN: use-after-free in ___clear_bit include/asm-generic/bitops/instrumented-non-atomic.h:44 [inline]
> BUG: KASAN: use-after-free in __clear_open_fd fs/file.c:324 [inline]
> BUG: KASAN: use-after-free in __put_unused_fd+0xdb/0x2a0 fs/file.c:600
> Write of size 8 at addr ffff88804952aa48 by task syz-executor128/5830

Good catch. Thanks! Should be fixed now:

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git for_next

									Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd
  2025-01-06 11:15 ` Jan Kara
@ 2025-01-06 11:49   ` syzbot
  0 siblings, 0 replies; 8+ messages in thread
From: syzbot @ 2025-01-06 11:49 UTC (permalink / raw)
  To: amir73il, jack, linux-fsdevel, linux-kernel, repnop,
	syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+6a3aa63412255587b21b@syzkaller.appspotmail.com
Tested-by: syzbot+6a3aa63412255587b21b@syzkaller.appspotmail.com

Tested on:

commit:         94dfee45 Merge fix for access beyond end of bitmap in ..
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git for_next
console output: https://syzkaller.appspot.com/x/log.txt?x=13473418580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=16a6f811a8c2a826
dashboard link: https://syzkaller.appspot.com/bug?extid=6a3aa63412255587b21b
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Note: no patches were applied.
Note: testing is done by a robot and is best-effort only.

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

end of thread, other threads:[~2025-01-06 11:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-31 13:27 [syzbot] [fs?] KASAN: slab-out-of-bounds Write in __put_unused_fd syzbot
2024-12-31 13:32 ` Eric Dumazet
2024-12-31 13:41   ` syzbot
2024-12-31 22:15 ` syzbot
2025-01-01  1:34 ` Hillf Danton
2025-01-01  2:03   ` syzbot
2025-01-06 11:15 ` Jan Kara
2025-01-06 11:49   ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox