Linux Hardening
 help / color / mirror / Atom feed
From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Erhard Furtner <erhard_f@mailbox.org>,
	linux-hardening@vger.kernel.org, Kees Cook <kees@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: fortify_test_known_sizes: EXPECTATION FAILED at lib/tests/fortify_kunit.c:90 (v7.0.2, ppc)
Date: Wed, 29 Apr 2026 16:27:52 +0200	[thread overview]
Message-ID: <bdfe4f8b-02f1-4331-a07a-eca2b7de1063@kernel.org> (raw)
In-Reply-To: <f45fd960-335c-4761-9590-ff8eccb62e9a@mailbox.org>



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
> 


      reply	other threads:[~2026-04-29 14:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bdfe4f8b-02f1-4331-a07a-eca2b7de1063@kernel.org \
    --to=chleroy@kernel.org \
    --cc=erhard_f@mailbox.org \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox