[GIT PULL] nolibc urgent fixes for v6.2

From: Paul E. McKenney
Date: Wed Jan 11 2023 - 19:45:02 EST


Hello, Linus,

The following changes since commit 1b929c02afd37871d5afb9d498426f83432e71c2:

Linux 6.2-rc1 (2022-12-25 13:41:39 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git tags/urgent-nolibc.2023.01.09a

for you to fetch changes up to 00b18da4089330196906b9fe075c581c17eb726c:

tools/nolibc: fix the O_* fcntl/open macro definitions for riscv (2023-01-09 09:36:05 -0800)

----------------------------------------------------------------
Fixes for nolibc for v6.2

This series addresses the following bugs:

o The fd_set structure was incorrectly defined as arrays of u32
instead of long, which breaks BE64. Fix courtesy of Sven Schnelle.

o S_ISxxx macros were incorrectly testing the bits after applying
them instead of bitwise ANDing S_FMT with the value. Fix from
Warner Losh.

o The mips code was randomly broken due to an unprotected
"noreorder" directive in the _start code that could prevent the
assembler from filling delayed slots. This in turn resulted
in random other instructions being placed into those slots.
Fix courtesy of Willy Tarreau.

o The current nolibc header layout refrains from including files
that are not explicitly included by the code using nolibc.
Unfortunately, this causes build failures when such files
contain definitions that are used (for example) by libgcc.
Example definitions include raise() and memset(), which are called
by some architectures, but only at certain optimization levels.
Fix courtesy of Willy Tarreau.

o gcc 11.3 in ARM thumb2 mode at -O2 recognized a memset()
construction inside the memset() definition. The compiler
replaced this construction with a call to... memset(). Userland
cannot be forced to build with -ffreestanding, so an empty asm()
statement was introduced into the loop the loop in order to
prevent the compiler from making this unproductive transformation.
Fix courtesy of Willy Tarreau.

o Most of the O_* macros were wrong on RISCV because their
octal values were coded as hexadecimal. This resulted in the
getdents64() selftest failing. Fix courtesy of Willy Tarreau.

The series was tested on x86_64, i386, armv5, armv7, thumb1, thumb2,
mips and riscv, all at -O0, -Os and -O3.

----------------------------------------------------------------
Sven Schnelle (1):
nolibc: fix fd_set type

Warner Losh (1):
tools/nolibc: Fix S_ISxxx macros

Willy Tarreau (4):
tools/nolibc: restore mips branch ordering in the _start block
tools/nolibc: fix missing includes causing build issues at -O0
tools/nolibc: prevent gcc from making memset() loop over itself
tools/nolibc: fix the O_* fcntl/open macro definitions for riscv

tools/include/nolibc/arch-mips.h | 2 ++
tools/include/nolibc/arch-riscv.h | 14 ++++----
tools/include/nolibc/ctype.h | 3 ++
tools/include/nolibc/errno.h | 3 ++
tools/include/nolibc/signal.h | 3 ++
tools/include/nolibc/stdio.h | 3 ++
tools/include/nolibc/stdlib.h | 3 ++
tools/include/nolibc/string.h | 8 ++++-
tools/include/nolibc/sys.h | 2 ++
tools/include/nolibc/time.h | 3 ++
tools/include/nolibc/types.h | 70 ++++++++++++++++++++++-----------------
tools/include/nolibc/unistd.h | 3 ++
12 files changed, 79 insertions(+), 38 deletions(-)