Linux Hardening
 help / color / mirror / Atom feed
* fortify_test_known_sizes: EXPECTATION FAILED at lib/tests/fortify_kunit.c:90 (v7.0.2, ppc)
@ 2026-04-29 10:17 Erhard Furtner
  2026-04-29 14:27 ` Christophe Leroy (CS GROUP)
  0 siblings, 1 reply; 2+ messages in thread
From: Erhard Furtner @ 2026-04-29 10:17 UTC (permalink / raw)
  To: linux-hardening; +Cc: linuxppc-dev

Greetings!

Getting this on my G4 DP on kernel v7.0.2 and v7.1-rc1 at running 
fortify_kunit test:

[...]
KTAP version 1
1..1
     KTAP version 1
     # Subtest: fortify
     # module: fortify_kunit
     1..26
     # fortify_test_known_sizes: EXPECTATION FAILED at 
lib/tests/fortify_kunit.c:90
     Expected ({ char *__p = (char *)(stack); size_t __ret = 
(~(size_t)0); const size_t __p_size = 
__builtin_dynamic_object_size(stack, 1); if (__p_size != (~(size_t)0) && 
__builtin_constant_p(*__p)) { size_t __p_len = __p_size - 1; if 
(__builtin_constant_p(__p[__p_len]) && __p[__p_len] == '\0') __ret = 
__builtin_strlen(__p); } __ret; }) == 5, but
         ({ char *__p = (char *)(stack); size_t __ret = (~(size_t)0); 
const size_t __p_size = __builtin_dynamic_object_size(stack, 1); if 
(__p_size != (~(size_t)0) && __builtin_constant_p(*__p)) { size_t 
__p_len = __p_size - 1; if (__builtin_constant_p(__p[__p_len]) && 
__p[__p_len] == '\0') __ret = __builtin_strlen(__p); } __ret; }) == 
4294967295 (0xffffffff)
     not ok 1 fortify_test_known_sizes
     ok 2 fortify_test_control_flow_split
     ok 3 fortify_test_alloc_size_kmalloc_const
     ok 4 fortify_test_alloc_size_kmalloc_dynamic
     ok 5 fortify_test_alloc_size_vmalloc_const
     ok 6 fortify_test_alloc_size_vmalloc_dynamic
     ok 7 fortify_test_alloc_size_kvmalloc_const
     ok 8 fortify_test_alloc_size_kvmalloc_dynamic
     ok 9 fortify_test_alloc_size_devm_kmalloc_const
     ok 10 fortify_test_alloc_size_devm_kmalloc_dynamic
     ok 11 fortify_test_realloc_size
     ok 12 fortify_test_strlen
     ok 13 fortify_test_strnlen
     ok 14 fortify_test_strcpy
     ok 15 fortify_test_strncpy
     ok 16 fortify_test_strscpy
     ok 17 fortify_test_strcat
     ok 18 fortify_test_strncat
     ok 19 fortify_test_strlcat
     ok 20 fortify_test_memcpy
     ok 21 fortify_test_memmove
     ok 22 fortify_test_memscan
     ok 23 fortify_test_memchr
     ok 24 fortify_test_memchr_inv
     ok 25 fortify_test_memcmp
     ok 26 fortify_test_kmemdup
# fortify: pass:25 fail:1 skip:0 total:26
# Totals: pass:25 fail:1 skip:0 total:26


Suppose this may be a ppc/BE specific test failure as I don't get it on 
my Thinkpad T60 (x86).

Full dmesg and kernel .config available on request.

Greetings,
Erhard

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: fortify_test_known_sizes: EXPECTATION FAILED at lib/tests/fortify_kunit.c:90 (v7.0.2, ppc)
  2026-04-29 10:17 fortify_test_known_sizes: EXPECTATION FAILED at lib/tests/fortify_kunit.c:90 (v7.0.2, ppc) Erhard Furtner
@ 2026-04-29 14:27 ` Christophe Leroy (CS GROUP)
  0 siblings, 0 replies; 2+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-04-29 14:27 UTC (permalink / raw)
  To: Erhard Furtner, linux-hardening, Kees Cook; +Cc: linuxppc-dev



Le 29/04/2026 à 12:17, Erhard Furtner a écrit :
> Greetings!
> 
> Getting this on my G4 DP on kernel v7.0.2 and v7.1-rc1 at running 
> fortify_kunit test:
> 
> [...]
> KTAP version 1
> 1..1
>      KTAP version 1
>      # Subtest: fortify
>      # module: fortify_kunit
>      1..26
>      # fortify_test_known_sizes: EXPECTATION FAILED at lib/tests/ 
> fortify_kunit.c:90
>      Expected ({ char *__p = (char *)(stack); size_t __ret = 
> (~(size_t)0); const size_t __p_size = 
> __builtin_dynamic_object_size(stack, 1); if (__p_size != (~(size_t)0) && 
> __builtin_constant_p(*__p)) { size_t __p_len = __p_size - 1; if 
> (__builtin_constant_p(__p[__p_len]) && __p[__p_len] == '\0') __ret = 
> __builtin_strlen(__p); } __ret; }) == 5, but
>          ({ char *__p = (char *)(stack); size_t __ret = (~(size_t)0); 
> const size_t __p_size = __builtin_dynamic_object_size(stack, 1); if 
> (__p_size != (~(size_t)0) && __builtin_constant_p(*__p)) { size_t 
> __p_len = __p_size - 1; if (__builtin_constant_p(__p[__p_len]) && 
> __p[__p_len] == '\0') __ret = __builtin_strlen(__p); } __ret; }) == 
> 4294967295 (0xffffffff)
>      not ok 1 fortify_test_known_sizes

I have the same on QEMU with pmac32_defconfig + FORTITY + KUNIT ...

Apparently it is due to __builtin_constant_p(*__p) returning FALSE, if I 
understand correctly it is expected that it returns TRUE.

This is with GCC 15.2

Christophe


>      ok 2 fortify_test_control_flow_split
>      ok 3 fortify_test_alloc_size_kmalloc_const
>      ok 4 fortify_test_alloc_size_kmalloc_dynamic
>      ok 5 fortify_test_alloc_size_vmalloc_const
>      ok 6 fortify_test_alloc_size_vmalloc_dynamic
>      ok 7 fortify_test_alloc_size_kvmalloc_const
>      ok 8 fortify_test_alloc_size_kvmalloc_dynamic
>      ok 9 fortify_test_alloc_size_devm_kmalloc_const
>      ok 10 fortify_test_alloc_size_devm_kmalloc_dynamic
>      ok 11 fortify_test_realloc_size
>      ok 12 fortify_test_strlen
>      ok 13 fortify_test_strnlen
>      ok 14 fortify_test_strcpy
>      ok 15 fortify_test_strncpy
>      ok 16 fortify_test_strscpy
>      ok 17 fortify_test_strcat
>      ok 18 fortify_test_strncat
>      ok 19 fortify_test_strlcat
>      ok 20 fortify_test_memcpy
>      ok 21 fortify_test_memmove
>      ok 22 fortify_test_memscan
>      ok 23 fortify_test_memchr
>      ok 24 fortify_test_memchr_inv
>      ok 25 fortify_test_memcmp
>      ok 26 fortify_test_kmemdup
> # fortify: pass:25 fail:1 skip:0 total:26
> # Totals: pass:25 fail:1 skip:0 total:26
> 
> 
> Suppose this may be a ppc/BE specific test failure as I don't get it on 
> my Thinkpad T60 (x86).
> 
> Full dmesg and kernel .config available on request.
> 
> Greetings,
> Erhard
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-29 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-29 10:17 fortify_test_known_sizes: EXPECTATION FAILED at lib/tests/fortify_kunit.c:90 (v7.0.2, ppc) Erhard Furtner
2026-04-29 14:27 ` Christophe Leroy (CS GROUP)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox