lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f28e3c85-84a4-4b30-a3f5-c2efad311fe7@sirena.org.uk>
Date:   Wed, 12 Apr 2023 16:58:36 +0100
From:   Mark Brown <broonie@...nel.org>
To:     Thomas Weißschuh <linux@...ssschuh.net>
Cc:     Willy Tarreau <w@....eu>, Shuah Khan <shuah@...nel.org>,
        linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-next@...r.kernel.org
Subject: Re: [PATCH v3 3/4] tools/nolibc: implement fd-based FILE streams

On Sun, Apr 02, 2023 at 06:04:36PM +0000, Thomas Weißschuh wrote:

> This enables the usage of the stream APIs with arbitrary filedescriptors.
> 
> It will be used by a future testcase.

This breaks the explicit use of standard streams:

> -static __attribute__((unused)) FILE* const stdin  = (FILE*)-3;
> -static __attribute__((unused)) FILE* const stdout = (FILE*)-2;
> -static __attribute__((unused)) FILE* const stderr = (FILE*)-1;
> +static __attribute__((unused)) FILE* const stdin  = (FILE*)(intptr_t)~STDIN_FILENO;
> +static __attribute__((unused)) FILE* const stdout = (FILE*)(intptr_t)~STDOUT_FILENO;
> +static __attribute__((unused)) FILE* const stderr = (FILE*)(intptr_t)~STDERR_FILENO;

Nothing in this change (or anything else in the series AFAICT) causes
STDx_FILENO to be declared so we get errors like below in -next when a
kselftest is built with this version of nolibc:

clang --target=aarch64-linux-gnu -fintegrated-as -Werror=unknown-warning-option -Werror=ignored-optimization-argument -Werror=option-ignored -Werror=unused-command-line-argument --target=aarch64-linux-gnu -fintegrated-as -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \
	-include ../../../../include/nolibc/nolibc.h -I../..\
	-static -ffreestanding -Wall za-fork.c /tmp/kci/linux/build/kselftest/arm64/fp/za-fork-asm.o -o /tmp/kci/linux/build/kselftest/arm64/fp/za-fork
In file included from <built-in>:1:
In file included from ./../../../../include/nolibc/nolibc.h:97:
In file included from ./../../../../include/nolibc/arch.h:25:
./../../../../include/nolibc/arch-aarch64.h:176:35: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from <built-in>:1:
In file included from ./../../../../include/nolibc/nolibc.h:102:
./../../../../include/nolibc/stdio.h:33:71: error: use of undeclared identifier 'STDIN_FILENO'
static __attribute__((unused)) FILE* const stdin  = (FILE*)(intptr_t)~STDIN_FILENO;
                                                                      ^
./../../../../include/nolibc/stdio.h:34:71: error: use of undeclared identifier 'STDOUT_FILENO'
static __attribute__((unused)) FILE* const stdout = (FILE*)(intptr_t)~STDOUT_FILENO;
                                                                      ^
./../../../../include/nolibc/stdio.h:35:71: error: use of undeclared identifier 'STDERR_FILENO'
static __attribute__((unused)) FILE* const stderr = (FILE*)(intptr_t)~STDERR_FILENO;
                                                                      ^
1 warning and 3 errors generated.

The kselftest branch itself is fine, the issues manifest when it is
merged with the nolibc branch.  I'm not quite sure what the implicit
include that's been missed here is?

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ