* [syzbot] [nfs?] KMSAN: kernel-infoleak in sys_name_to_handle_at (4)
@ 2024-01-14 10:14 syzbot
2024-01-16 15:07 ` Chuck Lever III
2024-01-18 16:45 ` [syzbot] " syzbot
0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2024-01-14 10:14 UTC (permalink / raw)
To: amir73il, brauner, chuck.lever, jlayton, linux-fsdevel,
linux-kernel, linux-nfs, syzkaller-bugs, viro
Hello,
syzbot found the following issue on:
HEAD commit: 861deac3b092 Linux 6.7-rc7
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=155d9131e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=e0c7078a6b901aa3
dashboard link: https://syzkaller.appspot.com/bug?extid=09b349b3066c2e0b1e96
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=16cefdc9e80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=164fe7e9e80000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/0ea60ee8ed32/disk-861deac3.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6d69fdc33021/vmlinux-861deac3.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f0158750d452/bzImage-861deac3.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/bb450f076a10/mount_0.gz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+09b349b3066c2e0b1e96@syzkaller.appspotmail.com
option from the mount to silence this warning.
=======================================================
=====================================================
BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
BUG: KMSAN: kernel-infoleak in _copy_to_user+0xbc/0x100 lib/usercopy.c:40
instrument_copy_to_user include/linux/instrumented.h:114 [inline]
_copy_to_user+0xbc/0x100 lib/usercopy.c:40
copy_to_user include/linux/uaccess.h:191 [inline]
do_sys_name_to_handle fs/fhandle.c:73 [inline]
__do_sys_name_to_handle_at fs/fhandle.c:112 [inline]
__se_sys_name_to_handle_at+0x949/0xb10 fs/fhandle.c:94
__x64_sys_name_to_handle_at+0xe4/0x140 fs/fhandle.c:94
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b
Uninit was created at:
slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768
slab_alloc_node mm/slub.c:3478 [inline]
__kmem_cache_alloc_node+0x5c9/0x970 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1006 [inline]
__kmalloc+0x121/0x3c0 mm/slab_common.c:1020
kmalloc include/linux/slab.h:604 [inline]
do_sys_name_to_handle fs/fhandle.c:39 [inline]
__do_sys_name_to_handle_at fs/fhandle.c:112 [inline]
__se_sys_name_to_handle_at+0x441/0xb10 fs/fhandle.c:94
__x64_sys_name_to_handle_at+0xe4/0x140 fs/fhandle.c:94
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x63/0x6b
Bytes 18-19 of 20 are uninitialized
Memory access of size 20 starts at ffff888128a46380
Data copied to user address 0000000020000240
CPU: 0 PID: 5006 Comm: syz-executor975 Not tainted 6.7.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
=====================================================
---
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] 5+ messages in thread
* Re: [syzbot] [nfs?] KMSAN: kernel-infoleak in sys_name_to_handle_at (4)
2024-01-14 10:14 [syzbot] [nfs?] KMSAN: kernel-infoleak in sys_name_to_handle_at (4) syzbot
@ 2024-01-16 15:07 ` Chuck Lever III
2024-01-16 17:21 ` Amir Goldstein
2024-01-18 16:45 ` [syzbot] " syzbot
1 sibling, 1 reply; 5+ messages in thread
From: Chuck Lever III @ 2024-01-16 15:07 UTC (permalink / raw)
To: Amir Goldstein
Cc: syzbot, Christian Brauner, Jeff Layton, linux-fsdevel,
Linux Kernel Mailing List, Linux NFS Mailing List,
syzkaller-bugs, Al Viro
> On Jan 14, 2024, at 5:14 AM, syzbot <syzbot+09b349b3066c2e0b1e96@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 861deac3b092 Linux 6.7-rc7
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=155d9131e80000
> kernel config: https://syzkaller.appspot.com/x/.config?x=e0c7078a6b901aa3
> dashboard link: https://syzkaller.appspot.com/bug?extid=09b349b3066c2e0b1e96
> 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=16cefdc9e80000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=164fe7e9e80000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/0ea60ee8ed32/disk-861deac3.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/6d69fdc33021/vmlinux-861deac3.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/f0158750d452/bzImage-861deac3.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/bb450f076a10/mount_0.gz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+09b349b3066c2e0b1e96@syzkaller.appspotmail.com
>
> option from the mount to silence this warning.
> =======================================================
> =====================================================
> BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
> BUG: KMSAN: kernel-infoleak in _copy_to_user+0xbc/0x100 lib/usercopy.c:40
> instrument_copy_to_user include/linux/instrumented.h:114 [inline]
> _copy_to_user+0xbc/0x100 lib/usercopy.c:40
> copy_to_user include/linux/uaccess.h:191 [inline]
> do_sys_name_to_handle fs/fhandle.c:73 [inline]
> __do_sys_name_to_handle_at fs/fhandle.c:112 [inline]
> __se_sys_name_to_handle_at+0x949/0xb10 fs/fhandle.c:94
> __x64_sys_name_to_handle_at+0xe4/0x140 fs/fhandle.c:94
> do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
> entry_SYSCALL_64_after_hwframe+0x63/0x6b
>
> Uninit was created at:
> slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768
> slab_alloc_node mm/slub.c:3478 [inline]
> __kmem_cache_alloc_node+0x5c9/0x970 mm/slub.c:3517
> __do_kmalloc_node mm/slab_common.c:1006 [inline]
> __kmalloc+0x121/0x3c0 mm/slab_common.c:1020
> kmalloc include/linux/slab.h:604 [inline]
> do_sys_name_to_handle fs/fhandle.c:39 [inline]
> __do_sys_name_to_handle_at fs/fhandle.c:112 [inline]
> __se_sys_name_to_handle_at+0x441/0xb10 fs/fhandle.c:94
> __x64_sys_name_to_handle_at+0xe4/0x140 fs/fhandle.c:94
> do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
> entry_SYSCALL_64_after_hwframe+0x63/0x6b
>
> Bytes 18-19 of 20 are uninitialized
> Memory access of size 20 starts at ffff888128a46380
> Data copied to user address 0000000020000240
>
> CPU: 0 PID: 5006 Comm: syz-executor975 Not tainted 6.7.0-rc7-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
> =====================================================
Hi Amir-
The kmalloc() at fs/fhandle.c:39 could be made a kzalloc().
But I wonder if those uninitialized bytes in the file_handle
buffer are actually a logic bug in do_sys_name_to_handle().
--
Chuck Lever
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [syzbot] [nfs?] KMSAN: kernel-infoleak in sys_name_to_handle_at (4)
2024-01-16 15:07 ` Chuck Lever III
@ 2024-01-16 17:21 ` Amir Goldstein
0 siblings, 0 replies; 5+ messages in thread
From: Amir Goldstein @ 2024-01-16 17:21 UTC (permalink / raw)
To: Chuck Lever III
Cc: syzbot, Christian Brauner, Jeff Layton, linux-fsdevel,
Linux Kernel Mailing List, Linux NFS Mailing List,
syzkaller-bugs, Al Viro
On Tue, Jan 16, 2024 at 5:08 PM Chuck Lever III <chuck.lever@oracle.com> wrote:
>
>
>
> > On Jan 14, 2024, at 5:14 AM, syzbot <syzbot+09b349b3066c2e0b1e96@syzkaller.appspotmail.com> wrote:
> >
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: 861deac3b092 Linux 6.7-rc7
> > git tree: upstream
> > console+strace: https://syzkaller.appspot.com/x/log.txt?x=155d9131e80000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=e0c7078a6b901aa3
> > dashboard link: https://syzkaller.appspot.com/bug?extid=09b349b3066c2e0b1e96
> > 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=16cefdc9e80000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=164fe7e9e80000
> >
> > Downloadable assets:
> > disk image: https://storage.googleapis.com/syzbot-assets/0ea60ee8ed32/disk-861deac3.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/6d69fdc33021/vmlinux-861deac3.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/f0158750d452/bzImage-861deac3.xz
> > mounted in repro: https://storage.googleapis.com/syzbot-assets/bb450f076a10/mount_0.gz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+09b349b3066c2e0b1e96@syzkaller.appspotmail.com
> >
> > option from the mount to silence this warning.
> > =======================================================
> > =====================================================
> > BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
> > BUG: KMSAN: kernel-infoleak in _copy_to_user+0xbc/0x100 lib/usercopy.c:40
> > instrument_copy_to_user include/linux/instrumented.h:114 [inline]
> > _copy_to_user+0xbc/0x100 lib/usercopy.c:40
> > copy_to_user include/linux/uaccess.h:191 [inline]
> > do_sys_name_to_handle fs/fhandle.c:73 [inline]
> > __do_sys_name_to_handle_at fs/fhandle.c:112 [inline]
> > __se_sys_name_to_handle_at+0x949/0xb10 fs/fhandle.c:94
> > __x64_sys_name_to_handle_at+0xe4/0x140 fs/fhandle.c:94
> > do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> > do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
> > entry_SYSCALL_64_after_hwframe+0x63/0x6b
> >
> > Uninit was created at:
> > slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768
> > slab_alloc_node mm/slub.c:3478 [inline]
> > __kmem_cache_alloc_node+0x5c9/0x970 mm/slub.c:3517
> > __do_kmalloc_node mm/slab_common.c:1006 [inline]
> > __kmalloc+0x121/0x3c0 mm/slab_common.c:1020
> > kmalloc include/linux/slab.h:604 [inline]
> > do_sys_name_to_handle fs/fhandle.c:39 [inline]
> > __do_sys_name_to_handle_at fs/fhandle.c:112 [inline]
> > __se_sys_name_to_handle_at+0x441/0xb10 fs/fhandle.c:94
> > __x64_sys_name_to_handle_at+0xe4/0x140 fs/fhandle.c:94
> > do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> > do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
> > entry_SYSCALL_64_after_hwframe+0x63/0x6b
> >
> > Bytes 18-19 of 20 are uninitialized
> > Memory access of size 20 starts at ffff888128a46380
> > Data copied to user address 0000000020000240
> >
> > CPU: 0 PID: 5006 Comm: syz-executor975 Not tainted 6.7.0-rc7-syzkaller #0
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
> > =====================================================
>
> Hi Amir-
>
> The kmalloc() at fs/fhandle.c:39 could be made a kzalloc().
>
> But I wonder if those uninitialized bytes in the file_handle
> buffer are actually a logic bug in do_sys_name_to_handle().
>
I am not sure I understand from the report which bytes are not initialized.
If it's the bytes of the opaque f_handle, then it sounds like a
filesystem (nilfs) bug.
Thanks,
Amir.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [syzbot] [syzbot] [nfs?] KMSAN: kernel-infoleak in sys_name_to_handle_at (4)
2024-01-14 10:14 [syzbot] [nfs?] KMSAN: kernel-infoleak in sys_name_to_handle_at (4) syzbot
2024-01-16 15:07 ` Chuck Lever III
@ 2024-01-18 16:45 ` syzbot
1 sibling, 0 replies; 5+ messages in thread
From: syzbot @ 2024-01-18 16:45 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [syzbot] [nfs?] KMSAN: kernel-infoleak in sys_name_to_handle_at (4)
Author: n.zhandarovich@fintech.ru
Try using kzalloc() instead of kmalloc() in do_sys_name_to_handle()
#syz test: https://github.com/google/kmsan.git master
---
fs/fhandle.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fhandle.c b/fs/fhandle.c
index 18b3ba8dc8ea..57a12614addf 100644
--- a/fs/fhandle.c
+++ b/fs/fhandle.c
@@ -36,7 +36,7 @@ static long do_sys_name_to_handle(const struct path *path,
if (f_handle.handle_bytes > MAX_HANDLE_SZ)
return -EINVAL;
- handle = kmalloc(sizeof(struct file_handle) + f_handle.handle_bytes,
+ handle = kzalloc(sizeof(struct file_handle) + f_handle.handle_bytes,
GFP_KERNEL);
if (!handle)
return -ENOMEM;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [syzbot] [nfs?] KMSAN: kernel-infoleak in sys_name_to_handle_at (4)
[not found] <20240118164534.14880-1-n.zhandarovich@fintech.ru>
@ 2024-01-18 17:12 ` syzbot
0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2024-01-18 17:12 UTC (permalink / raw)
To: glider, linux-kernel, n.zhandarovich, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+09b349b3066c2e0b1e96@syzkaller.appspotmail.com
Tested on:
commit: d1d7f15c DO-NOT-SUBMIT: kmsan: add the kmsan_exceed_ma..
git tree: https://github.com/google/kmsan.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=125bb51be80000
kernel config: https://syzkaller.appspot.com/x/.config?x=4778da307461370c
dashboard link: https://syzkaller.appspot.com/bug?extid=09b349b3066c2e0b1e96
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=10f39bfbe80000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-18 17:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-14 10:14 [syzbot] [nfs?] KMSAN: kernel-infoleak in sys_name_to_handle_at (4) syzbot
2024-01-16 15:07 ` Chuck Lever III
2024-01-16 17:21 ` Amir Goldstein
2024-01-18 16:45 ` [syzbot] " syzbot
[not found] <20240118164534.14880-1-n.zhandarovich@fintech.ru>
2024-01-18 17:12 ` syzbot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.