Re: [REGRESSION][BISECTED] erroneous buffer overflow detected in bch2_xattr_validate

From: Jan Hendrik Farr
Date: Thu Oct 03 2024 - 11:35:16 EST


On 03 17:30:28, Thorsten Blum wrote:
> On 3. Oct 2024, at 17:22, Jan Hendrik Farr <kernel@xxxxxxxx> wrote:
> > On 03 17:02:07, Thorsten Blum wrote:
> >> On 3. Oct 2024, at 15:12, Jan Hendrik Farr <kernel@xxxxxxxx> wrote:
> >>> On 03 15:07:52, Thorsten Blum wrote:
> >>>> On 3. Oct 2024, at 13:33, Jan Hendrik Farr <kernel@xxxxxxxx> wrote:
> >>>>>> [...]
> >>>>>
> >>>>> This issue is now fixed on the llvm main branch:
> >>>>> https://github.com/llvm/llvm-project/commit/882457a2eedbe6d53161b2f78fcf769fc9a93e8a
> >>>>
> >>>> Thanks!
> >>>>
> >>>> Do you know if it also fixes the different sizes here:
> >>>> https://godbolt.org/z/vvK9PE1Yq

Do you already have an open issue on the llvm github? Otherwise I'll
open one and submit the PR shortly.

> >>>
> >>> Unfortunately this still prints 36.
> >>
> >> I just realized that the counted_by attribute itself causes the 4 bytes
> >> difference. When you remove the attribute, the sizes are equal again.
> >
> > But we want these attributes to be in the kernel, so that
> > bounds-checking can be done in more scenarios, right?
>
> Yes
>
> > This changes clang to print 40, right? gcc prints 40 in the example
> > whether the attribute is there or not.
>
> Yes, clang prints 36 with and 40 without the attribute; gcc always 40.
>
> >>>> I ran out of disk space when compiling llvm :0
> >>>>
> >>>>> So presumably this will go into 19.1.2, not sure what this means for
> >>>>> distros that ship clang 18. Will they have to be notified to backport
> >>>>> this?
> >>>>>
> >>>>> Best Regards
> >>>>> Jan