Re: [PATCH v2 01/10] kunit: tool: Enable CONFIG_FORTIFY_SOURCE under UML

From: Nick Desaulniers
Date: Mon May 22 2023 - 15:44:13 EST


On Wed, May 10, 2023 at 12:24 PM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
> On Fri, Apr 07, 2023 at 04:42:27PM -0700, Nick Desaulniers wrote:
> > On Fri, Apr 7, 2023 at 4:33 PM Nick Desaulniers <ndesaulniers@xxxxxxxxxx> wrote:
> > >
> > > On Fri, Apr 7, 2023 at 12:27 PM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> > > >
> > > > Since commit ba38961a069b ("um: Enable FORTIFY_SOURCE"), it's possible
> > > > to run the FORTIFY tests under UML. Enable CONFIG_FORTIFY_SOURCE when
> > > > running with --altests to gain additional coverage, and by default under
> > >
> > > two L's in alltest?
> >
> > Also, while testing this series:
> > ```
> > $ LLVM=1 ./tools/testing/kunit/kunit.py run
> > ...
> > [16:40:09] ================== fortify (24 subtests) ===================
> > [16:40:09] [PASSED] known_sizes_test
> > [16:40:09] [PASSED] control_flow_split_test
> > [16:40:09] [PASSED] alloc_size_kmalloc_const_test
> > [16:40:09] # alloc_size_kmalloc_dynamic_test: EXPECTATION FAILED
> > at lib/fortify_kunit.c:249
> > [16:40:09] Expected __builtin_dynamic_object_size(p, 1) == expected, but
> > [16:40:09] __builtin_dynamic_object_size(p, 1) == -1
> > (0xffffffffffffffff)
> > [16:40:09] expected == 11 (0xb)
> > [16:40:09] __alloc_size() not working with __bdos on kmemdup("hello
> > there", len, gfp)
>
> I'm still tracking this down. I'm not sure what's happening here, but it
> seems to be Clang-specific, and due to some interaction with the changes
> I made for Kunit examination. WHY it happens I haven't found yet.

Was this what exposed https://github.com/llvm/llvm-project/issues/62789?

--
Thanks,
~Nick Desaulniers