diff --git a/pkg.info b/info.yml similarity index 98% rename from pkg.info rename to info.yml index 92ab158..4ab7eff 100644 --- a/pkg.info +++ b/info.yml @@ -1,7 +1,7 @@ name: glibc description: The GNU C Library version: "2.43" -revision: 1 +revision: 2 url: https://www.gnu.org/software/libc/ license: GPL2-or-later,LGPL2.1-or-later,BSD-3-Clause maintainers: diff --git a/source.sh b/recipe.sh similarity index 87% rename from source.sh rename to recipe.sh index a954d2f..aeec79f 100644 --- a/source.sh +++ b/recipe.sh @@ -1,7 +1,16 @@ -# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT +# The prepare function is executed in the root of the temp directory +# This function is used for putting downloaded files to the correct location or applying patches +prepare() { + cd "$BPM_SOURCE" + patch -Np1 -i "$BPM_WORKDIR"/0001-fix-tst-rseq-with-linux-7.0.patch + patch -Np1 -i "$BPM_WORKDIR"/0002-isolate-__O_CLOEXEC-flag-for-sys-mount.h-and-fcntl.h.patch + patch -Np1 -i "$BPM_WORKDIR"/0003-only-define-OPEN_TREE_-macros-in-sys-mount.h-if-undefined.patch +} + # The build function is executed in the source directory # This function is used to compile the source code build() { @@ -47,7 +56,7 @@ check() { sed -i '/CFLAGS/s/-fno-plt//' config.make # 27 failures sed -i '/CFLAGS/s/-fexceptions//' config.make # 1 failure - make check + make check } # The package function is executed in the source directory diff --git a/source-files/0001-fix-tst-rseq-with-linux-7.0.patch b/source-files/0001-fix-tst-rseq-with-linux-7.0.patch new file mode 100644 index 0000000..7bd6bb3 --- /dev/null +++ b/source-files/0001-fix-tst-rseq-with-linux-7.0.patch @@ -0,0 +1,57 @@ +From 67f303b47dc584f204e3f2441b9832082415eebc Mon Sep 17 00:00:00 2001 +From: Michael Jeanson +Date: Fri, 20 Feb 2026 11:01:00 -0500 +Subject: [PATCH] tests: fix tst-rseq with Linux 7.0 + +A sub-test of tst-rseq is to validate the return code and errno of the +rseq syscall when attempting to register the exact same rseq area as was +done in the dynamic loader. + +This involves finding the rseq area address by adding the +'__rseq_offset' to the thread pointer and calculating the area size from +the AT_RSEQ_FEATURE_SIZE auxiliary vector. However the test currently +calculates the size of the rseq area allocation in the TLS block which +must be a multiple of AT_RSEQ_ALIGN. + +Up until now that happened to be the same value since the feature size +and alignment exposed by the kernel were below the minimum ABI size of +32. Starting with Linux 7.0 the feature size has reached 33 while the +alignment is now 64. + +This results in the test trying to re-register the rseq area with a +different size and thus not getting the expected errno value. + +Signed-off-by: Michael Jeanson +Reviewed-by: Mathieu Desnoyers +--- + sysdeps/unix/sysv/linux/tst-rseq.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/sysdeps/unix/sysv/linux/tst-rseq.c b/sysdeps/unix/sysv/linux/tst-rseq.c +index 11371dc6c5..ba93d390f4 100644 +--- a/sysdeps/unix/sysv/linux/tst-rseq.c ++++ b/sysdeps/unix/sysv/linux/tst-rseq.c +@@ -48,8 +48,7 @@ do_rseq_main_test (void) + size_t rseq_align = MAX (getauxval (AT_RSEQ_ALIGN), RSEQ_MIN_ALIGN); + size_t rseq_feature_size = MAX (getauxval (AT_RSEQ_FEATURE_SIZE), + RSEQ_AREA_SIZE_INITIAL_USED); +- size_t rseq_alloc_size = roundup (MAX (rseq_feature_size, +- RSEQ_AREA_SIZE_INITIAL_USED), rseq_align); ++ size_t rseq_reg_size = MAX (rseq_feature_size, RSEQ_AREA_SIZE_INITIAL); + struct rseq *rseq_abi = __thread_pointer () + __rseq_offset; + + TEST_VERIFY_EXIT (rseq_thread_registered ()); +@@ -89,8 +88,8 @@ do_rseq_main_test (void) + /* Test a rseq registration with the same arguments as the internal + registration which should fail with errno == EBUSY. */ + TEST_VERIFY (((unsigned long) rseq_abi % rseq_align) == 0); +- TEST_VERIFY (__rseq_size <= rseq_alloc_size); +- int ret = syscall (__NR_rseq, rseq_abi, rseq_alloc_size, 0, RSEQ_SIG); ++ TEST_VERIFY (__rseq_size <= rseq_reg_size); ++ int ret = syscall (__NR_rseq, rseq_abi, rseq_reg_size, 0, RSEQ_SIG); + TEST_VERIFY (ret != 0); + TEST_COMPARE (errno, EBUSY); + } +-- +2.43.7 + diff --git a/source-files/0002-isolate-__O_CLOEXEC-flag-for-sys-mount.h-and-fcntl.h.patch b/source-files/0002-isolate-__O_CLOEXEC-flag-for-sys-mount.h-and-fcntl.h.patch new file mode 100644 index 0000000..e2cab28 --- /dev/null +++ b/source-files/0002-isolate-__O_CLOEXEC-flag-for-sys-mount.h-and-fcntl.h.patch @@ -0,0 +1,139 @@ +From 419245719ccbc7dad6a97f24465e7f09c090327a Mon Sep 17 00:00:00 2001 +From: DJ Delorie +Date: Mon, 26 Jan 2026 22:24:42 -0500 +Subject: [PATCH 1/1] include: isolate __O_CLOEXEC flag for sys/mount.h and + fcntl.h + +Including sys/mount.h should not implicitly include fcntl.h +as that causes namespace pollution and conflicts with kernel +headers. It only needs O_CLOEXEC for OPEN_TREE_CLOEXEC +(although it shouldn't need that, but it's defined that way) +so we provide that define (via a private version) separately. + +Reviewed-by: Adhemerval Zanella +Tested-by: Florian Weimer +--- + io/fcntl.c | 4 ++++ + sysdeps/unix/sysv/linux/Makefile | 1 + + sysdeps/unix/sysv/linux/alpha/bits/cloexec.h | 1 + + sysdeps/unix/sysv/linux/bits/cloexec.h | 1 + + sysdeps/unix/sysv/linux/bits/fcntl-linux.h | 4 +--- + sysdeps/unix/sysv/linux/hppa/bits/cloexec.h | 1 + + sysdeps/unix/sysv/linux/sparc/bits/cloexec.h | 1 + + sysdeps/unix/sysv/linux/sys/mount.h | 6 +++++- + sysdeps/unix/sysv/linux/tst-mount.c | 1 + + 9 files changed, 16 insertions(+), 4 deletions(-) + create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/cloexec.h + create mode 100644 sysdeps/unix/sysv/linux/bits/cloexec.h + create mode 100644 sysdeps/unix/sysv/linux/hppa/bits/cloexec.h + create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/cloexec.h + +diff --git a/io/fcntl.c b/io/fcntl.c +index c13546e4fd..4fbc522624 100644 +--- a/io/fcntl.c ++++ b/io/fcntl.c +@@ -18,6 +18,10 @@ + #include + #include + ++#ifndef __O_CLOEXEC ++# error __O_CLOEXEC not defined by fcntl.h/cloexec.h ++#endif ++ + /* Perform file control operations on FD. */ + int + __fcntl (int fd, int cmd, ...) +diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile +index 955d316362..c6bd97abf1 100644 +--- a/sysdeps/unix/sysv/linux/Makefile ++++ b/sysdeps/unix/sysv/linux/Makefile +@@ -129,6 +129,7 @@ CFLAGS-test-errno-linux.c += $(no-fortify-source) + + sysdep_headers += \ + bits/a.out.h \ ++ bits/cloexec.h \ + bits/epoll.h \ + bits/eventfd.h \ + bits/inotify.h \ +diff --git a/sysdeps/unix/sysv/linux/alpha/bits/cloexec.h b/sysdeps/unix/sysv/linux/alpha/bits/cloexec.h +new file mode 100644 +index 0000000000..f381f28a53 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/alpha/bits/cloexec.h +@@ -0,0 +1 @@ ++#define __O_CLOEXEC 010000000 +diff --git a/sysdeps/unix/sysv/linux/bits/cloexec.h b/sysdeps/unix/sysv/linux/bits/cloexec.h +new file mode 100644 +index 0000000000..3059fb6473 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/bits/cloexec.h +@@ -0,0 +1 @@ ++#define __O_CLOEXEC 02000000 +diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h +index ad7f7c98c6..221a71aa62 100644 +--- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h ++++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h +@@ -81,9 +81,7 @@ + #ifndef __O_NOFOLLOW + # define __O_NOFOLLOW 0400000 + #endif +-#ifndef __O_CLOEXEC +-# define __O_CLOEXEC 02000000 +-#endif ++#include + #ifndef __O_DIRECT + # define __O_DIRECT 040000 + #endif +diff --git a/sysdeps/unix/sysv/linux/hppa/bits/cloexec.h b/sysdeps/unix/sysv/linux/hppa/bits/cloexec.h +new file mode 100644 +index 0000000000..f381f28a53 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/hppa/bits/cloexec.h +@@ -0,0 +1 @@ ++#define __O_CLOEXEC 010000000 +diff --git a/sysdeps/unix/sysv/linux/sparc/bits/cloexec.h b/sysdeps/unix/sysv/linux/sparc/bits/cloexec.h +new file mode 100644 +index 0000000000..6706eaa7d5 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/sparc/bits/cloexec.h +@@ -0,0 +1 @@ ++#define __O_CLOEXEC 0x400000 +diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h +index 457d8dcff2..5e496caf2f 100644 +--- a/sysdeps/unix/sysv/linux/sys/mount.h ++++ b/sysdeps/unix/sysv/linux/sys/mount.h +@@ -21,7 +21,6 @@ + #ifndef _SYS_MOUNT_H + #define _SYS_MOUNT_H 1 + +-#include + #include + #include + #include +@@ -266,6 +265,11 @@ enum fsconfig_command + + /* open_tree flags. */ + #define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */ ++#ifndef O_CLOEXEC ++# include ++# define O_CLOEXEC __O_CLOEXEC ++#endif ++#undef OPEN_TREE_CLOEXEC + #define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */ + + +diff --git a/sysdeps/unix/sysv/linux/tst-mount.c b/sysdeps/unix/sysv/linux/tst-mount.c +index 8e3ffbd56f..84dcd448d4 100644 +--- a/sysdeps/unix/sysv/linux/tst-mount.c ++++ b/sysdeps/unix/sysv/linux/tst-mount.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include /* For AT_ constants. */ + #include + + _Static_assert (sizeof (struct mount_attr) == MOUNT_ATTR_SIZE_VER0, +-- +2.43.7 + diff --git a/source-files/0003-only-define-OPEN_TREE_-macros-in-sys-mount.h-if-undefined.patch b/source-files/0003-only-define-OPEN_TREE_-macros-in-sys-mount.h-if-undefined.patch new file mode 100644 index 0000000..6297c08 --- /dev/null +++ b/source-files/0003-only-define-OPEN_TREE_-macros-in-sys-mount.h-if-undefined.patch @@ -0,0 +1,44 @@ +From d12b017cddfeb9fe9920ba054ae3dfcb8e9238b8 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Wed, 4 Mar 2026 18:32:36 +0100 +Subject: [PATCH] Linux: Only define OPEN_TREE_* macros in if + undefined (bug 33921) + +There is a conditional inclusion of earlier in the file. +If that defines the macros, do not redefine them. This addresses build +problems as the token sequence used by the UAPI macro definitions +changes between Linux versions. + +Reviewed-by: Adhemerval Zanella +--- + sysdeps/unix/sysv/linux/sys/mount.h | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h +index 5e496caf2f..0c5ebed33a 100644 +--- a/sysdeps/unix/sysv/linux/sys/mount.h ++++ b/sysdeps/unix/sysv/linux/sys/mount.h +@@ -264,14 +264,16 @@ enum fsconfig_command + #define FSOPEN_CLOEXEC 0x00000001 + + /* open_tree flags. */ +-#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */ ++#ifndef OPEN_TREE_CLONE ++# define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */ ++#endif + #ifndef O_CLOEXEC + # include + # define O_CLOEXEC __O_CLOEXEC + #endif +-#undef OPEN_TREE_CLOEXEC +-#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */ +- ++#ifndef OPEN_TREE_CLOEXEC ++# define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */ ++#endif + + __BEGIN_DECLS + +-- +2.43.7 +