On Monday 17 May 2021 at 21:25:06 +0200, Philip Lorenz wrote:
> Commit 60e25a36558f1f07dcce1a044fe976b475bec42b started dereferencing
> the "path" parameter which for some functions is annotated with the
> "nonnull" attribute. While the commit explicitly checks for NULL
> pointers before dereferencing it, GCC (at optimization level 1 and
> above) removes the check due to the "nonnull" attribute being set for
> some parameters in the glibc headers (e.g. statx()).
> 
> However, the statx() man page explicitly allows calling with NULL
> pointers (in which case the EFAULT is returned) and this behaviour is
> used in the wild (e.g. in Rust) to determine whether the statx() system
> call is supported.
> 
> Disabling the optimization is not possible ([1]) so prevent the compiler
> optimization by referencing the parameter in a noop inline assembly
> instruction instead.
> 
> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100404
> 
> Signed-off-by: Philip Lorenz <[email protected]>
> ---
>  Makefile.in        |  2 ++
>  makewrappers       |  6 +++++-
>  test/test-fstat.c  | 29 +++++++++++++++++++++++++++++
>  test/test-fstat.sh |  8 ++++++++
>  4 files changed, 44 insertions(+), 1 deletion(-)
>  create mode 100644 test/test-fstat.c
>  create mode 100755 test/test-fstat.sh
> 
> diff --git a/Makefile.in b/Makefile.in
> index cf13010..10441ef 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -77,6 +77,8 @@ all: $(LIBPSEUDO) $(PSEUDO) $(PSEUDODB) $(PSEUDOLOG) 
> $(PSEUDO_PROFILE)
>  test: all | $(BIN) $(LIB) $(LOCALSTATE)
>       $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-rename-fstat 
> test/test-rename-fstat.c
>       $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-openat test/test-openat.c
> +     $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-statx test/test-statx.c

The test/test-stax.c file wasn't included in the patch, which means that
"make test" no longer works on the current pseudo oe-core branch. :(
Perhaps this went unnoticed since it's necessary to run configure again for
the Makefile to be regenerated to see the problem.

Do you still have the file, or should I just submit a change to remove this
line?

Thanks.

Mike.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#154725): 
https://lists.openembedded.org/g/openembedded-core/message/154725
Mute This Topic: https://lists.openembedded.org/mt/82895298/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to