Merge tag 'nolibc-20250928-for-6.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc

Pull nolibc updates from Thomas Weißschuh:
 "Only small bugfixes and cleanups"

* tag 'nolibc-20250928-for-6.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc:
  tools/nolibc: add stdbool.h to nolibc includes
  tools/nolibc: make time_t robust if __kernel_old_time_t is missing in host headers
  selftests/nolibc: remove outdated comment about construct order
  selftests/nolibc: fix EXPECT_NZ macro
  tools/nolibc: drop wait4() support
  kselftest/arm64: tpidr2: Switch to waitpid() over wait4()
  tools/nolibc: fold llseek fallback into lseek()
  tools/nolibc: remove __nolibc_enosys() fallback from fork functions
  tools/nolibc: remove __nolibc_enosys() fallback from dup2()
  tools/nolibc: remove __nolibc_enosys() fallback from *at() functions
  tools/nolibc: remove __nolibc_enosys() fallback from time64-related functions
  tools/nolibc: use tabs instead of spaces for indentation
  tools/nolibc: avoid error in dup2() if old fd equals new fd
  selftests/nolibc: always compile the kernel with GCC
  selftests/nolibc: don't pass CC to toplevel Makefile
  selftests/nolibc: deduplicate invocations of toplevel Makefile
  selftests/nolibc: be more specific about variables affecting nolibc-test
  tools/nolibc: fix error return value of clock_nanosleep()
This commit is contained in:
Linus Torvalds
2025-09-30 19:18:17 -07:00
12 changed files with 69 additions and 116 deletions

View File

@@ -182,16 +182,16 @@ static int write_clone_read(void)
}
for (;;) {
waiting = wait4(ret, &status, __WCLONE, NULL);
waiting = waitpid(ret, &status, __WCLONE);
if (waiting < 0) {
if (errno == EINTR)
continue;
ksft_print_msg("wait4() failed: %d\n", errno);
ksft_print_msg("waitpid() failed: %d\n", errno);
return 0;
}
if (waiting != ret) {
ksft_print_msg("wait4() returned wrong PID %d\n",
ksft_print_msg("waitpid() returned wrong PID %d\n",
waiting);
return 0;
}

View File

@@ -262,19 +262,22 @@ REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++
if (f || !p || !done) printf("failure\n"); else if (s) printf("warning\n"); else printf("success\n");; \
printf("\nSee all results in %s\n", ARGV[1]); }'
# Execute the toplevel kernel Makefile
KBUILD_MAKE = $(MAKE) -C $(srctree) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) LLVM=
help:
@echo "Supported targets under selftests/nolibc:"
@echo " all call the \"run\" target below"
@echo " help this help"
@echo " sysroot create the nolibc sysroot here (uses \$$ARCH)"
@echo " nolibc-test build the executable (uses \$$CC and \$$CROSS_COMPILE)"
@echo " nolibc-test build the executable (uses \$$CC or \$$CROSS_COMPILE)"
@echo " libc-test build an executable using the compiler's default libc instead"
@echo " run-user runs the executable under QEMU (uses \$$XARCH, \$$TEST)"
@echo " initramfs.cpio prepare the initramfs archive with nolibc-test"
@echo " initramfs prepare the initramfs tree with nolibc-test"
@echo " defconfig create a fresh new default config (uses \$$XARCH)"
@echo " kernel (re)build the kernel (uses \$$XARCH)"
@echo " kernel-standalone (re)build the kernel with the initramfs (uses \$$XARCH)"
@echo " kernel (re)build the kernel (uses \$$XARCH, \$$CROSS_COMPILE)"
@echo " kernel-standalone (re)build the kernel with the initramfs (uses \$$XARCH, \$$CROSS_COMPILE)"
@echo " run runs the kernel in QEMU after building it (uses \$$XARCH, \$$TEST)"
@echo " rerun runs a previously prebuilt kernel in QEMU (uses \$$XARCH, \$$TEST)"
@echo " clean clean the sysroot, initramfs, build and output files"
@@ -340,17 +343,17 @@ initramfs: nolibc-test
$(Q)cp nolibc-test initramfs/init
defconfig:
$(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(DEFCONFIG)
$(Q)$(KBUILD_MAKE) $(DEFCONFIG)
$(Q)if [ -n "$(EXTRACONFIG)" ]; then \
$(srctree)/scripts/config --file $(objtree)/.config $(EXTRACONFIG); \
$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) olddefconfig < /dev/null; \
$(KBUILD_MAKE) olddefconfig < /dev/null; \
fi
kernel:
$(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) < /dev/null
$(Q)$(KBUILD_MAKE) $(IMAGE_NAME) < /dev/null
kernel-standalone: initramfs
$(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs < /dev/null
$(Q)$(KBUILD_MAKE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs < /dev/null
# run the tests after building the kernel
run: kernel initramfs.cpio

View File

@@ -196,8 +196,8 @@ int expect_zr(int expr, int llen)
}
#define EXPECT_NZ(cond, expr, val) \
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_nz(expr, llen; } while (0)
#define EXPECT_NZ(cond, expr) \
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_nz(expr, llen); } while (0)
static __attribute__((unused))
int expect_nz(int expr, int llen)
@@ -686,7 +686,6 @@ int expect_strtox(int llen, void *func, const char *input, int base, intmax_t ex
#define CASE_TEST(name) \
case __LINE__: llen += printf("%d %s", test, #name);
/* constructors validate that they are executed in definition order */
__attribute__((constructor))
static void constructor1(void)
{
@@ -1334,6 +1333,7 @@ int run_syscall(int min, int max)
CASE_TEST(chroot_root); EXPECT_SYSZR(euid0, chroot("/")); break;
CASE_TEST(chroot_blah); EXPECT_SYSER(1, chroot("/proc/self/blah"), -1, ENOENT); break;
CASE_TEST(chroot_exe); EXPECT_SYSER(1, chroot(argv0), -1, ENOTDIR); break;
CASE_TEST(clock_nanosleep); ts.tv_nsec = -1; EXPECT_EQ(1, EINVAL, clock_nanosleep(CLOCK_REALTIME, 0, &ts, NULL)); break;
CASE_TEST(close_m1); EXPECT_SYSER(1, close(-1), -1, EBADF); break;
CASE_TEST(close_dup); EXPECT_SYSZR(1, close(dup(0))); break;
CASE_TEST(dup_0); tmp = dup(0); EXPECT_SYSNE(1, tmp, -1); close(tmp); break;