2024-04-23 11:38:38

by syzbot

[permalink] [raw]
Subject: [syzbot] [fs?] KASAN: slab-use-after-free Read in __fput (2)

Hello,

syzbot found the following issue on:

HEAD commit: 4d2008430ce8 Merge tag 'docs-6.9-fixes2' of git://git.lwn...
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=12b508d3180000
kernel config: https://syzkaller.appspot.com/x/.config?x=545d4b3e07d6ccbc
dashboard link: https://syzkaller.appspot.com/bug?extid=5d4cb6b4409edfd18646
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1357d230980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10923dfd180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/4250d1d2a53f/disk-4d200843.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/af264ac1a9b0/vmlinux-4d200843.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c0e1e88877a5/bzImage-4d200843.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

general protection fault, probably for non-canonical address 0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f]
CPU: 0 PID: 5113 Comm: syz-executor107 Not tainted 6.9.0-rc5-syzkaller-00007-g4d2008430ce8 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
RIP: 0010:fsnotify_parent include/linux/fsnotify.h:68 [inline]
RIP: 0010:fsnotify_file include/linux/fsnotify.h:106 [inline]
RIP: 0010:fsnotify_close include/linux/fsnotify.h:387 [inline]
RIP: 0010:__fput+0x59e/0xb80 fs/file_table.c:408
Code: ea 03 80 3c 02 00 0f 85 88 05 00 00 49 8b 47 68 48 8d 78 28 48 89 44 24 10 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 35 05 00 00 48 8b 44 24 10 be 08 00 00 00 48 8b
RSP: 0018:ffffc90003197da8 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff88801fa16f00 RCX: ffffffff81f974e8
RDX: 0000000000000005 RSI: ffffffff81f978bf RDI: 0000000000000028
RBP: ffff88801fa16f50 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000080007
R13: 0000000000000008 R14: ffff888078a81e60 R15: ffff88807de245e0
FS: 00007fd582e0b6c0(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000080 CR3: 00000000774ac000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
task_work_run+0x14e/0x250 kernel/task_work.c:180
ptrace_notify+0x10e/0x130 kernel/signal.c:2404
ptrace_report_syscall include/linux/ptrace.h:415 [inline]
ptrace_report_syscall_exit include/linux/ptrace.h:477 [inline]
syscall_exit_work kernel/entry/common.c:173 [inline]
syscall_exit_to_user_mode_prepare+0x126/0x260 kernel/entry/common.c:200
__syscall_exit_to_user_mode_work kernel/entry/common.c:205 [inline]
syscall_exit_to_user_mode+0x11/0x2a0 kernel/entry/common.c:218
do_syscall_64+0xdc/0x260 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fd582e504e9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 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:00007fd582e0b218 EFLAGS: 00000246 ORIG_RAX: 00000000000000e8
RAX: 0000000000000001 RBX: 00007fd582eda348 RCX: 00007fd582e504e9
RDX: 0000000000000002 RSI: 00000000200000c0 RDI: 0000000000000005
RBP: 00007fd582eda340 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000000fa R11: 0000000000000246 R12: 00007fd582ea717c
R13: 00007fd582ea7068 R14: 00667562616d6475 R15: 6d64752f7665642f
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:fsnotify_parent include/linux/fsnotify.h:68 [inline]
RIP: 0010:fsnotify_file include/linux/fsnotify.h:106 [inline]
RIP: 0010:fsnotify_close include/linux/fsnotify.h:387 [inline]
RIP: 0010:__fput+0x59e/0xb80 fs/file_table.c:408
Code: ea 03 80 3c 02 00 0f 85 88 05 00 00 49 8b 47 68 48 8d 78 28 48 89 44 24 10 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 35 05 00 00 48 8b 44 24 10 be 08 00 00 00 48 8b
RSP: 0018:ffffc90003197da8 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff88801fa16f00 RCX: ffffffff81f974e8
RDX: 0000000000000005 RSI: ffffffff81f978bf RDI: 0000000000000028
RBP: ffff88801fa16f50 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000080007
R13: 0000000000000008 R14: ffff888078a81e60 R15: ffff88807de245e0
FS: 00007fd582e0b6c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd582e8c190 CR3: 00000000774ac000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 03 80 3c 02 00 0f add 0xf00023c(%rax),%eax
6: 85 88 05 00 00 49 test %ecx,0x49000005(%rax)
c: 8b 47 68 mov 0x68(%rdi),%eax
f: 48 8d 78 28 lea 0x28(%rax),%rdi
13: 48 89 44 24 10 mov %rax,0x10(%rsp)
18: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
1f: fc ff df
22: 48 89 fa mov %rdi,%rdx
25: 48 c1 ea 03 shr $0x3,%rdx
* 29: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2d: 0f 85 35 05 00 00 jne 0x568
33: 48 8b 44 24 10 mov 0x10(%rsp),%rax
38: be 08 00 00 00 mov $0x8,%esi
3d: 48 rex.W
3e: 8b .byte 0x8b


---
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 [email protected].

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


2024-05-12 19:38:40

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [fs?] KASAN: slab-use-after-free Read in __fput (2)

syzbot has bisected this issue to:

commit ff2d23843f7fb4f13055be5a4a9a20ddd04e6e9c
Author: Michel Dänzer <[email protected]>
Date: Fri Jul 23 07:58:57 2021 +0000

dma-buf/poll: Get a file reference for outstanding fence callbacks

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=17c1007c980000
start commit: 5eb4573ea63d Merge tag 'soc-fixes-6.9-2' of git://git.kern..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=1421007c980000
console output: https://syzkaller.appspot.com/x/log.txt?x=1021007c980000
kernel config: https://syzkaller.appspot.com/x/.config?x=9d985095f83428be
dashboard link: https://syzkaller.appspot.com/bug?extid=5d4cb6b4409edfd18646
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11a13cf8980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15c4d2f8980000

Reported-by: [email protected]
Fixes: ff2d23843f7f ("dma-buf/poll: Get a file reference for outstanding fence callbacks")

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

2024-05-12 22:35:22

by Hillf Danton

[permalink] [raw]
Subject: Re: [syzbot] [fs?] KASAN: slab-use-after-free Read in __fput (2)

On Tue, 23 Apr 2024 04:38:18 -0700
> syzbot found the following issue on:
>
> HEAD commit: 4d2008430ce8 Merge tag 'docs-6.9-fixes2' of git://git.lwn...
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10923dfd180000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

2024-05-12 23:10:16

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [fs?] KASAN: slab-use-after-free Read in __fput (2)

Hello,

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

Reported-and-tested-by: [email protected]

Tested on:

commit: a38297e3 Linux 6.9
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=175fec3f180000
kernel config: https://syzkaller.appspot.com/x/.config?x=3f2ffcdf236c8fc3
dashboard link: https://syzkaller.appspot.com/bug?extid=5d4cb6b4409edfd18646
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.