[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260128004344.GA2127@quark>
Date: Tue, 27 Jan 2026 16:43:44 -0800
From: Eric Biggers <ebiggers@...nel.org>
To: Amir Goldstein <amir73il@...il.com>
Cc: Qing Wang <wangqing7171@...il.com>, miklos@...redi.hu,
linux-kernel@...r.kernel.org, linux-unionfs@...r.kernel.org,
syzbot+d130f98b2c265fae5297@...kaller.appspotmail.com,
Christian Brauner <brauner@...nel.org>
Subject: Re: [PATCH v2] ovl: Fix uninit-value in ovl_fill_real
On Tue, Jan 27, 2026 at 12:09:47PM +0100, Amir Goldstein wrote:
> Eric,
>
> Considering that fscrypt_fname_alloc_buffer() anyway allocates the byte for NUL
> termination and that decrypted names are zero padded (right?).
Only when the length of the original filename isn't already a multiple
of the padding amount, as configured by FSCRYPT_POLICY_FLAGS_PAD_*.
> How about reinforcing this fix with:
>
> diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c
> index a9a4432d12ba1..97e00af49bb9f 100644
> --- a/fs/crypto/fname.c
> +++ b/fs/crypto/fname.c
> @@ -276,6 +276,7 @@ int fscrypt_fname_disk_to_usr(const struct inode *inode,
> if (fscrypt_is_dot_dotdot(&qname)) {
> oname->name[0] = '.';
> oname->name[iname->len - 1] = '.';
> + oname->name[iname->len] = 0;
> oname->len = iname->len;
> return 0;
Do you propose to do the same for all callers of dir_emit() in all
filesystems? It seems not NUL-terminating the name is normal. Just
usually the name is in the pagecache rather than slab memory, which
makes KMSAN not usually notice the out-of-bounds read in overlayfs.
- Eric
Powered by blists - more mailing lists