Re: [REGRESSION][BISECTED] erroneous buffer overflow detected in bch2_xattr_validate
From: Kees Cook
Date: Sat Sep 28 2024 - 16:50:21 EST
On Thu, Sep 26, 2024 at 06:30:15PM -0700, Bill Wendling wrote:
> On Thu, Sep 26, 2024 at 3:18 PM Bill Wendling <morbo@xxxxxxxxxx> wrote:
> >
> > On Thu, Sep 26, 2024 at 12:58 PM Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
> > >
> > > (cc Kees and Bill)
> > >
> > > On Thu, 26 Sept 2024 at 19:46, Jan Hendrik Farr <kernel@xxxxxxxx> wrote:
> > > >
> > > > On 26 19:01:20, Jan Hendrik Farr wrote:
> > > > > On 26 18:09:57, Thorsten Blum wrote:
> > > > > > On 26. Sep 2024, at 17:28, Thorsten Blum <thorsten.blum@xxxxxxxxxx> wrote:
> > > > > > > On 26. Sep 2024, at 17:14, Jan Hendrik Farr <kernel@xxxxxxxx> wrote:
> [...]
> > > > > > >> [ 6.252375] memchr: detected buffer overflow: 12 byte read of buffer size 0
> [...]
> > > > > bkey_fsck_err_on(memchr(xattr.v->x_name, '\0', xattr.v->x_name_len),
> > > > > c, xattr_name_invalid_chars,
> > > > > "xattr name has invalid characters");
> [...]
The thing going wrong is that __bdos(xattr.v->x_name, 0) is returning 0.
This looks exactly like the bug I minimized here:
https://lore.kernel.org/all/202409170436.C3C6E7F7A@keescook/
Since there wasn't an LLVM open bug yet, I've created:
https://github.com/llvm/llvm-project/issues/110385
-Kees
--
Kees Cook