linux/fs/overlayfs
Qing Wang 721f679d4e ovl: Fix uninit-value in ovl_fill_real
[ Upstream commit 1992330d90 ]

Syzbot reported a KMSAN uninit-value issue in ovl_fill_real.

This iusse's call chain is:
__do_sys_getdents64()
    -> iterate_dir()
        ...
            -> ext4_readdir()
                -> fscrypt_fname_alloc_buffer() // alloc
                -> fscrypt_fname_disk_to_usr // write without tail '\0'
                -> dir_emit()
                    -> ovl_fill_real() // read by strcmp()

The string is used to store the decrypted directory entry name for an
encrypted inode. As shown in the call chain, fscrypt_fname_disk_to_usr()
write it without null-terminate. However, ovl_fill_real() uses strcmp() to
compare the name against "..", which assumes a null-terminated string and
may trigger a KMSAN uninit-value warning when the buffer tail contains
uninit data.

Reported-by: syzbot+d130f98b2c265fae5297@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d130f98b2c265fae5297
Fixes: 4edb83bb10 ("ovl: constant d_ino for non-merge dirs")
Signed-off-by: Qing Wang <wangqing7171@gmail.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://patch.msgid.link/20260128132406.23768-2-amir73il@gmail.com
Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-03-04 07:20:32 -05:00
..
copy_up.c ovl: use I_MUTEX_PARENT when locking parent in ovl_create_temp() 2025-08-28 16:31:10 +02:00
dir.c ovl: fix copy-up in tmpfile 2024-05-28 10:06:55 +02:00
export.c ovl: support encoding fid from inode with no alias 2025-01-17 13:40:36 +01:00
file.c ovl: Fix nested backing file paths 2025-06-27 11:11:24 +01:00
inode.c ovl: properly handle large files in ovl_security_fileattr 2024-12-09 10:41:08 +01:00
Kconfig fs: prepare for stackable filesystems backing file helpers 2023-12-23 16:35:08 +02:00
Makefile ovl: Move xattr support to new xattrs.c file 2023-10-31 00:12:59 +02:00
namei.c ovl: pass realinode to ovl_encode_real_fh() instead of realdentry 2025-01-17 13:40:36 +01:00
overlayfs.h ovl: remove unused forward declaration 2025-04-25 10:47:39 +02:00
ovl_entry.h ovl: mark xwhiteouts directory with overlay.opaque='x' 2024-01-23 12:39:48 +02:00
params.c ovl: fail if trusted xattrs are needed but caller lacks permission 2024-09-08 15:36:59 +02:00
params.h ovl: store and show the user provided lowerdir mount option 2023-10-31 00:13:02 +02:00
readdir.c ovl: Fix uninit-value in ovl_fill_real 2026-03-04 07:20:32 -05:00
super.c ovl: don't allow datadir only 2025-04-25 10:47:53 +02:00
util.c ovl: Check for NULL d_inode() in ovl_dentry_upper() 2025-07-06 11:01:36 +02:00
xattrs.c ovl: Support escaped overlay.* xattrs 2023-10-31 00:12:59 +02:00