forked from rpms/glibc
import glibc-2.34-16.el9
This commit is contained in:
parent
d772ba140f
commit
1f31ebdabf
@ -1,15 +1,44 @@
|
|||||||
Short description: Adjust CS_PATH return value.
|
Short description: Adjust CS_PATH and the test container layout.
|
||||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||||
Origin: PATCH
|
Origin: PATCH
|
||||||
Upstream status: not-needed
|
Upstream status: not-needed
|
||||||
|
|
||||||
In Fedora we should return only /usr/bin because /bin is just a symlink
|
In Fedora we should return only /usr/bin as CS_PATH because /bin is just
|
||||||
to /usr/bin after MoveToUsr transition (which glibc has not really
|
a symlink to /usr/bin after MoveToUsr transition (which glibc has not
|
||||||
completed).
|
really completed).
|
||||||
|
|
||||||
diff -pruN a/sysdeps/unix/confstr.h b/sysdeps/unix/confstr.h
|
We also create /{bin,lib,lib64,sbin} in the test container as symbolic
|
||||||
--- a/sysdeps/unix/confstr.h 2012-12-25 08:32:13.000000000 +0530
|
links. This brings the test container in line with Fedora's filesystem
|
||||||
+++ b/sysdeps/unix/confstr.h 2014-09-05 20:02:55.698275219 +0530
|
layout and avoids some test failures. For example, because Fedora's
|
||||||
|
CS_PATH is /usr/bin, tst-vfork3 will try to execute /usr/bin/echo in the
|
||||||
|
container. Without this change the container installs `echo' in /bin
|
||||||
|
not /usr/bin, causing the test to fail.
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index a49870d3d1e636a9..feb2599203b10098 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -598,9 +598,13 @@ $(tests-container) $(addsuffix /tests,$(subdirs)) : \
|
||||||
|
$(objpfx)testroot.pristine/install.stamp :
|
||||||
|
test -d $(objpfx)testroot.pristine || \
|
||||||
|
mkdir $(objpfx)testroot.pristine
|
||||||
|
- # We need a working /bin/sh for some of the tests.
|
||||||
|
- test -d $(objpfx)testroot.pristine/bin || \
|
||||||
|
- mkdir $(objpfx)testroot.pristine/bin
|
||||||
|
+ # Set up symlinks to directories whose contents got moved to /usr
|
||||||
|
+ for moved in bin lib lib64 sbin; do \
|
||||||
|
+ test -d $(objpfx)testroot.pristine/usr/$$moved || \
|
||||||
|
+ mkdir -p $(objpfx)testroot.pristine/usr/$$moved ;\
|
||||||
|
+ test -e $(objpfx)testroot.pristine/$$moved || \
|
||||||
|
+ ln -s usr/$$moved $(objpfx)testroot.pristine/$$moved ;\
|
||||||
|
+ done
|
||||||
|
# We need the compiled locale dir for localedef tests.
|
||||||
|
test -d $(objpfx)testroot.pristine/$(complocaledir) || \
|
||||||
|
mkdir -p $(objpfx)testroot.pristine/$(complocaledir)
|
||||||
|
diff --git a/sysdeps/unix/confstr.h b/sysdeps/unix/confstr.h
|
||||||
|
index 15859c3b2759878e..9b63b7f8069866fd 100644
|
||||||
|
--- a/sysdeps/unix/confstr.h
|
||||||
|
+++ b/sysdeps/unix/confstr.h
|
||||||
@@ -1 +1 @@
|
@@ -1 +1 @@
|
||||||
-#define CS_PATH "/bin:/usr/bin"
|
-#define CS_PATH "/bin:/usr/bin"
|
||||||
+#define CS_PATH "/usr/bin"
|
+#define CS_PATH "/usr/bin"
|
||||||
|
619
SOURCES/glibc-rh1988382.patch
Normal file
619
SOURCES/glibc-rh1988382.patch
Normal file
@ -0,0 +1,619 @@
|
|||||||
|
commit 23645707f12f2dd9d80b51effb2d9618a7b65565
|
||||||
|
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||||
|
Date: Wed Dec 8 11:21:26 2021 +0530
|
||||||
|
|
||||||
|
Replace --enable-static-pie with --disable-default-pie
|
||||||
|
|
||||||
|
Build glibc programs and tests as PIE by default and enable static-pie
|
||||||
|
automatically if the architecture and toolchain supports it.
|
||||||
|
|
||||||
|
Also add a new configuration option --disable-default-pie to prevent
|
||||||
|
building programs as PIE.
|
||||||
|
|
||||||
|
Only the following architectures now have PIE disabled by default
|
||||||
|
because they do not work at the moment. hppa, ia64, alpha and csky
|
||||||
|
don't work because the linker is unable to handle a pcrel relocation
|
||||||
|
generated from PIE objects. The microblaze compiler is currently
|
||||||
|
failing with an ICE. GNU hurd tries to enable static-pie, which does
|
||||||
|
not work and hence fails. All these targets have default PIE disabled
|
||||||
|
at the moment and I have left it to the target maintainers to enable PIE
|
||||||
|
on their targets.
|
||||||
|
|
||||||
|
build-many-glibcs runs clean for all targets. I also tested x86_64 on
|
||||||
|
Fedora and Ubuntu, to verify that the default build as well as
|
||||||
|
--disable-default-pie work as expected with both system toolchains.
|
||||||
|
|
||||||
|
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||||
|
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
|
||||||
|
diff --git a/INSTALL b/INSTALL
|
||||||
|
index 02dcf6b1ca3a4c43..d6d93ec9be4262d7 100644
|
||||||
|
--- a/INSTALL
|
||||||
|
+++ b/INSTALL
|
||||||
|
@@ -111,16 +111,14 @@ if 'CFLAGS' is specified it must enable optimization. For example:
|
||||||
|
systems support shared libraries; you need ELF support and
|
||||||
|
(currently) the GNU linker.
|
||||||
|
|
||||||
|
-'--enable-static-pie'
|
||||||
|
- Enable static position independent executable (static PIE) support.
|
||||||
|
- Static PIE is similar to static executable, but can be loaded at
|
||||||
|
- any address without help from a dynamic linker. All static
|
||||||
|
- programs as well as static tests are built as static PIE, except
|
||||||
|
- for those marked with no-pie. The resulting glibc can be used with
|
||||||
|
- the GCC option, -static-pie, which is available with GCC 8 or
|
||||||
|
- above, to create static PIE. This option also implies that glibc
|
||||||
|
- programs and tests are created as dynamic position independent
|
||||||
|
- executables (PIE) by default.
|
||||||
|
+'--disable-default-pie'
|
||||||
|
+ Don't build glibc programs and the testsuite as position
|
||||||
|
+ independent executables (PIE). By default, glibc programs and tests
|
||||||
|
+ are created as position independent executables on targets that
|
||||||
|
+ support it. If the toolchain and architecture support it, static
|
||||||
|
+ executables are built as static PIE and the resulting glibc can be
|
||||||
|
+ used with the GCC option, -static-pie, which is available with GCC
|
||||||
|
+ 8 or above, to create static PIE.
|
||||||
|
|
||||||
|
'--enable-cet'
|
||||||
|
'--enable-cet=permissive'
|
||||||
|
diff --git a/Makeconfig b/Makeconfig
|
||||||
|
index 2fa0884b4eee5e53..8bc5540292c7b6fa 100644
|
||||||
|
--- a/Makeconfig
|
||||||
|
+++ b/Makeconfig
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
# Copyright (C) 1991-2021 Free Software Foundation, Inc.
|
||||||
|
+# Copyright (C) The GNU Toolchain Authors.
|
||||||
|
# This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
# The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@@ -376,19 +377,24 @@ LDFLAGS.so += $(hashstyle-LDFLAGS)
|
||||||
|
LDFLAGS-rtld += $(hashstyle-LDFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
-ifeq (yes,$(enable-static-pie))
|
||||||
|
+ifeq (no,$(build-pie-default))
|
||||||
|
+pie-default = $(no-pie-ccflag)
|
||||||
|
+else # build-pie-default
|
||||||
|
pic-default = -DPIC
|
||||||
|
# Compile libc.a and libc_p.a with -fPIE/-fpie for static PIE.
|
||||||
|
pie-default = $(pie-ccflag)
|
||||||
|
+
|
||||||
|
+ifeq (yes,$(enable-static-pie))
|
||||||
|
ifeq (yes,$(have-static-pie))
|
||||||
|
-default-pie-ldflag = -static-pie
|
||||||
|
+static-pie-ldflag = -static-pie
|
||||||
|
else
|
||||||
|
# Static PIE can't have dynamic relocations in read-only segments since
|
||||||
|
# static PIE is mapped into memory by kernel. --eh-frame-hdr is needed
|
||||||
|
# for PIE to support exception.
|
||||||
|
-default-pie-ldflag = -Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
|
||||||
|
-endif
|
||||||
|
-endif
|
||||||
|
+static-pie-ldflag = -Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
|
||||||
|
+endif # have-static-pie
|
||||||
|
+endif # enable-static-pie
|
||||||
|
+endif # build-pie-default
|
||||||
|
|
||||||
|
# If lazy relocations are disabled, add the -z now flag. Use
|
||||||
|
# LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to
|
||||||
|
@@ -444,7 +450,7 @@ endif
|
||||||
|
# Command for statically linking programs with the C library.
|
||||||
|
ifndef +link-static
|
||||||
|
+link-static-before-inputs = -nostdlib -nostartfiles -static \
|
||||||
|
- $(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)) \
|
||||||
|
+ $(if $($(@F)-no-pie),$(no-pie-ldflag),$(static-pie-ldflag)) \
|
||||||
|
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
||||||
|
$(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \
|
||||||
|
$(+preinit) $(+prectorT)
|
||||||
|
@@ -479,7 +485,7 @@ ifeq (yes,$(build-pie-default))
|
||||||
|
+link-tests-after-inputs = $(link-libc-tests) $(+link-pie-after-libc)
|
||||||
|
+link-printers-tests = $(+link-pie-printers-tests)
|
||||||
|
else # not build-pie-default
|
||||||
|
-+link-before-inputs = -nostdlib -nostartfiles \
|
||||||
|
++link-before-inputs = -nostdlib -nostartfiles $(no-pie-ldflag) \
|
||||||
|
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
||||||
|
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
|
||||||
|
$(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \
|
||||||
|
@@ -1047,6 +1053,7 @@ PIC-ccflag = -fPIC
|
||||||
|
endif
|
||||||
|
# This can be changed by a sysdep makefile
|
||||||
|
pie-ccflag = -fpie
|
||||||
|
+no-pie-ccflag = -fno-pie
|
||||||
|
# This one should always stay like this unless there is a very good reason.
|
||||||
|
PIE-ccflag = -fPIE
|
||||||
|
ifeq (yes,$(build-profile))
|
||||||
|
diff --git a/config.h.in b/config.h.in
|
||||||
|
index 8b45a3a61d774714..458342887e4e9380 100644
|
||||||
|
--- a/config.h.in
|
||||||
|
+++ b/config.h.in
|
||||||
|
@@ -277,6 +277,9 @@
|
||||||
|
/* Build glibc with tunables support. */
|
||||||
|
#define HAVE_TUNABLES 0
|
||||||
|
|
||||||
|
+/* Define if PIE is unsupported. */
|
||||||
|
+#undef PIE_UNSUPPORTED
|
||||||
|
+
|
||||||
|
/* Define if static PIE is supported. */
|
||||||
|
#undef SUPPORT_STATIC_PIE
|
||||||
|
|
||||||
|
diff --git a/config.make.in b/config.make.in
|
||||||
|
index cbf59114b0b9ae4f..e8630a8d0ccf874d 100644
|
||||||
|
--- a/config.make.in
|
||||||
|
+++ b/config.make.in
|
||||||
|
@@ -90,9 +90,6 @@ static-nss-crypt = @libc_cv_static_nss_crypt@
|
||||||
|
|
||||||
|
# Configuration options.
|
||||||
|
build-shared = @shared@
|
||||||
|
-build-pic-default= @libc_cv_pic_default@
|
||||||
|
-build-pie-default= @libc_cv_pie_default@
|
||||||
|
-cc-pie-default= @libc_cv_cc_pie_default@
|
||||||
|
build-profile = @profile@
|
||||||
|
build-static-nss = @static_nss@
|
||||||
|
cross-compiling = @cross_compiling@
|
||||||
|
diff --git a/configure b/configure
|
||||||
|
index 9619c10991d04362..e9d2b1f398c4dba0 100755
|
||||||
|
--- a/configure
|
||||||
|
+++ b/configure
|
||||||
|
@@ -596,9 +596,6 @@ DEFINES
|
||||||
|
static_nss
|
||||||
|
profile
|
||||||
|
libc_cv_multidir
|
||||||
|
-libc_cv_pie_default
|
||||||
|
-libc_cv_cc_pie_default
|
||||||
|
-libc_cv_pic_default
|
||||||
|
shared
|
||||||
|
static
|
||||||
|
ldd_rewrite_script
|
||||||
|
@@ -767,7 +764,7 @@ with_nonshared_cflags
|
||||||
|
enable_sanity_checks
|
||||||
|
enable_shared
|
||||||
|
enable_profile
|
||||||
|
-enable_static_pie
|
||||||
|
+enable_default_pie
|
||||||
|
enable_timezone_tools
|
||||||
|
enable_hardcoded_path_in_tests
|
||||||
|
enable_hidden_plt
|
||||||
|
@@ -1423,8 +1420,8 @@ Optional Features:
|
||||||
|
in special situations) [default=yes]
|
||||||
|
--enable-shared build shared library [default=yes if GNU ld]
|
||||||
|
--enable-profile build profiled library [default=no]
|
||||||
|
- --enable-static-pie enable static PIE support and use it in the
|
||||||
|
- testsuite [default=no]
|
||||||
|
+ --disable-default-pie Do not build glibc programs and the testsuite as PIE
|
||||||
|
+ [default=no]
|
||||||
|
--disable-timezone-tools
|
||||||
|
do not install timezone tools [default=install]
|
||||||
|
--enable-hardcoded-path-in-tests
|
||||||
|
@@ -3408,11 +3405,11 @@ else
|
||||||
|
profile=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
-# Check whether --enable-static-pie was given.
|
||||||
|
-if test "${enable_static_pie+set}" = set; then :
|
||||||
|
- enableval=$enable_static_pie; static_pie=$enableval
|
||||||
|
+# Check whether --enable-default-pie was given.
|
||||||
|
+if test "${enable_default_pie+set}" = set; then :
|
||||||
|
+ enableval=$enable_default_pie; default_pie=$enableval
|
||||||
|
else
|
||||||
|
- static_pie=no
|
||||||
|
+ default_pie=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check whether --enable-timezone-tools was given.
|
||||||
|
@@ -6912,7 +6909,8 @@ rm -f conftest.*
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_pic_default" >&5
|
||||||
|
$as_echo "$libc_cv_pic_default" >&6; }
|
||||||
|
-
|
||||||
|
+config_vars="$config_vars
|
||||||
|
+build-pic-default = $libc_cv_pic_default"
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fPIE is default" >&5
|
||||||
|
$as_echo_n "checking whether -fPIE is default... " >&6; }
|
||||||
|
@@ -6932,17 +6930,37 @@ rm -f conftest.*
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_pie_default" >&5
|
||||||
|
$as_echo "$libc_cv_cc_pie_default" >&6; }
|
||||||
|
-libc_cv_pie_default=$libc_cv_cc_pie_default
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-# Set the `multidir' variable by grabbing the variable from the compiler.
|
||||||
|
-# We do it once and save the result in a generated makefile.
|
||||||
|
-libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
|
||||||
|
-
|
||||||
|
+config_vars="$config_vars
|
||||||
|
+cc-pie-default = $libc_cv_cc_pie_default"
|
||||||
|
|
||||||
|
-if test "$static_pie" = yes; then
|
||||||
|
- # Check target support for static PIE
|
||||||
|
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can build programs as PIE" >&5
|
||||||
|
+$as_echo_n "checking if we can build programs as PIE... " >&6; }
|
||||||
|
+if test "x$default_pie" != xno; then
|
||||||
|
+ # Disable build-pie-default if target does not support it.
|
||||||
|
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
+/* end confdefs.h. */
|
||||||
|
+#ifdef PIE_UNSUPPORTED
|
||||||
|
+# error PIE is not supported
|
||||||
|
+#endif
|
||||||
|
+_ACEOF
|
||||||
|
+if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
|
+ libc_cv_pie_default=yes
|
||||||
|
+else
|
||||||
|
+ libc_cv_pie_default=no
|
||||||
|
+fi
|
||||||
|
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
+fi
|
||||||
|
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_pie_default" >&5
|
||||||
|
+$as_echo "$libc_cv_pie_default" >&6; }
|
||||||
|
+config_vars="$config_vars
|
||||||
|
+build-pie-default = $libc_cv_pie_default"
|
||||||
|
+
|
||||||
|
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can build static PIE programs" >&5
|
||||||
|
+$as_echo_n "checking if we can build static PIE programs... " >&6; }
|
||||||
|
+libc_cv_static_pie=$libc_cv_pie_default
|
||||||
|
+if test "x$libc_cv_pie_default" != xno \
|
||||||
|
+ -a "$libc_cv_no_dynamic_linker" = yes; then
|
||||||
|
+ # Enable static-pie if available
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#ifndef SUPPORT_STATIC_PIE
|
||||||
|
@@ -6950,22 +6968,25 @@ if test "$static_pie" = yes; then
|
||||||
|
#endif
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
|
-
|
||||||
|
+ libc_cv_static_pie=yes
|
||||||
|
else
|
||||||
|
- as_fn_error $? "the architecture does not support static PIE" "$LINENO" 5
|
||||||
|
+ libc_cv_static_pie=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
- # The linker must support --no-dynamic-linker.
|
||||||
|
- if test "$libc_cv_no_dynamic_linker" != yes; then
|
||||||
|
- as_fn_error $? "linker support for --no-dynamic-linker needed" "$LINENO" 5
|
||||||
|
- fi
|
||||||
|
- # Default to PIE.
|
||||||
|
- libc_cv_pie_default=yes
|
||||||
|
- $as_echo "#define ENABLE_STATIC_PIE 1" >>confdefs.h
|
||||||
|
+ if test "$libc_cv_static_pie" = "yes"; then
|
||||||
|
+ $as_echo "#define ENABLE_STATIC_PIE 1" >>confdefs.h
|
||||||
|
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_static_pie" >&5
|
||||||
|
+$as_echo "$libc_cv_static_pie" >&6; }
|
||||||
|
config_vars="$config_vars
|
||||||
|
-enable-static-pie = $static_pie"
|
||||||
|
+enable-static-pie = $libc_cv_static_pie"
|
||||||
|
+
|
||||||
|
+# Set the `multidir' variable by grabbing the variable from the compiler.
|
||||||
|
+# We do it once and save the result in a generated makefile.
|
||||||
|
+libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
|
||||||
|
+
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 34ecbba540546337..79f6822d29ce21cf 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -179,11 +179,11 @@ AC_ARG_ENABLE([profile],
|
||||||
|
[build profiled library @<:@default=no@:>@]),
|
||||||
|
[profile=$enableval],
|
||||||
|
[profile=no])
|
||||||
|
-AC_ARG_ENABLE([static-pie],
|
||||||
|
- AS_HELP_STRING([--enable-static-pie],
|
||||||
|
- [enable static PIE support and use it in the testsuite @<:@default=no@:>@]),
|
||||||
|
- [static_pie=$enableval],
|
||||||
|
- [static_pie=no])
|
||||||
|
+AC_ARG_ENABLE([default-pie],
|
||||||
|
+ AS_HELP_STRING([--disable-default-pie],
|
||||||
|
+ [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
|
||||||
|
+ [default_pie=$enableval],
|
||||||
|
+ [default_pie=yes])
|
||||||
|
AC_ARG_ENABLE([timezone-tools],
|
||||||
|
AS_HELP_STRING([--disable-timezone-tools],
|
||||||
|
[do not install timezone tools @<:@default=install@:>@]),
|
||||||
|
@@ -1856,7 +1856,7 @@ if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
|
||||||
|
libc_cv_pic_default=no
|
||||||
|
fi
|
||||||
|
rm -f conftest.*])
|
||||||
|
-AC_SUBST(libc_cv_pic_default)
|
||||||
|
+LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
|
||||||
|
[libc_cv_cc_pie_default=yes
|
||||||
|
@@ -1869,30 +1869,38 @@ if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
|
||||||
|
libc_cv_cc_pie_default=no
|
||||||
|
fi
|
||||||
|
rm -f conftest.*])
|
||||||
|
-libc_cv_pie_default=$libc_cv_cc_pie_default
|
||||||
|
-AC_SUBST(libc_cv_cc_pie_default)
|
||||||
|
-AC_SUBST(libc_cv_pie_default)
|
||||||
|
+LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
|
||||||
|
+
|
||||||
|
+AC_MSG_CHECKING(if we can build programs as PIE)
|
||||||
|
+if test "x$default_pie" != xno; then
|
||||||
|
+ # Disable build-pie-default if target does not support it.
|
||||||
|
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
|
||||||
|
+# error PIE is not supported
|
||||||
|
+#endif]])], [libc_cv_pie_default=yes], [libc_cv_pie_default=no])
|
||||||
|
+fi
|
||||||
|
+AC_MSG_RESULT($libc_cv_pie_default)
|
||||||
|
+LIBC_CONFIG_VAR([build-pie-default], [$libc_cv_pie_default])
|
||||||
|
+
|
||||||
|
+AC_MSG_CHECKING(if we can build static PIE programs)
|
||||||
|
+libc_cv_static_pie=$libc_cv_pie_default
|
||||||
|
+if test "x$libc_cv_pie_default" != xno \
|
||||||
|
+ -a "$libc_cv_no_dynamic_linker" = yes; then
|
||||||
|
+ # Enable static-pie if available
|
||||||
|
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
|
||||||
|
+# error static PIE is not supported
|
||||||
|
+#endif]])], [libc_cv_static_pie=yes], [libc_cv_static_pie=no])
|
||||||
|
+ if test "$libc_cv_static_pie" = "yes"; then
|
||||||
|
+ AC_DEFINE(ENABLE_STATIC_PIE)
|
||||||
|
+ fi
|
||||||
|
+fi
|
||||||
|
+AC_MSG_RESULT($libc_cv_static_pie)
|
||||||
|
+LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
|
||||||
|
|
||||||
|
# Set the `multidir' variable by grabbing the variable from the compiler.
|
||||||
|
# We do it once and save the result in a generated makefile.
|
||||||
|
libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
|
||||||
|
AC_SUBST(libc_cv_multidir)
|
||||||
|
|
||||||
|
-if test "$static_pie" = yes; then
|
||||||
|
- # Check target support for static PIE
|
||||||
|
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
|
||||||
|
-# error static PIE is not supported
|
||||||
|
-#endif]])], , AC_MSG_ERROR([the architecture does not support static PIE]))
|
||||||
|
- # The linker must support --no-dynamic-linker.
|
||||||
|
- if test "$libc_cv_no_dynamic_linker" != yes; then
|
||||||
|
- AC_MSG_ERROR([linker support for --no-dynamic-linker needed])
|
||||||
|
- fi
|
||||||
|
- # Default to PIE.
|
||||||
|
- libc_cv_pie_default=yes
|
||||||
|
- AC_DEFINE(ENABLE_STATIC_PIE)
|
||||||
|
-fi
|
||||||
|
-LIBC_CONFIG_VAR([enable-static-pie], [$static_pie])
|
||||||
|
-
|
||||||
|
AC_SUBST(profile)
|
||||||
|
AC_SUBST(static_nss)
|
||||||
|
|
||||||
|
diff --git a/manual/install.texi b/manual/install.texi
|
||||||
|
index 46f73b538d3fee6f..1320ac69b3c645f2 100644
|
||||||
|
--- a/manual/install.texi
|
||||||
|
+++ b/manual/install.texi
|
||||||
|
@@ -141,15 +141,13 @@ Don't build shared libraries even if it is possible. Not all systems
|
||||||
|
support shared libraries; you need ELF support and (currently) the GNU
|
||||||
|
linker.
|
||||||
|
|
||||||
|
-@item --enable-static-pie
|
||||||
|
-Enable static position independent executable (static PIE) support.
|
||||||
|
-Static PIE is similar to static executable, but can be loaded at any
|
||||||
|
-address without help from a dynamic linker. All static programs as
|
||||||
|
-well as static tests are built as static PIE, except for those marked
|
||||||
|
-with no-pie. The resulting glibc can be used with the GCC option,
|
||||||
|
--static-pie, which is available with GCC 8 or above, to create static
|
||||||
|
-PIE. This option also implies that glibc programs and tests are created
|
||||||
|
-as dynamic position independent executables (PIE) by default.
|
||||||
|
+@item --disable-default-pie
|
||||||
|
+Don't build glibc programs and the testsuite as position independent
|
||||||
|
+executables (PIE). By default, glibc programs and tests are created as
|
||||||
|
+position independent executables on targets that support it. If the toolchain
|
||||||
|
+and architecture support it, static executables are built as static PIE and the
|
||||||
|
+resulting glibc can be used with the GCC option, -static-pie, which is
|
||||||
|
+available with GCC 8 or above, to create static PIE.
|
||||||
|
|
||||||
|
@item --enable-cet
|
||||||
|
@itemx --enable-cet=permissive
|
||||||
|
diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
|
||||||
|
index 86537fa8005cfd3d..2fd82a5d054c51ca 100755
|
||||||
|
--- a/scripts/build-many-glibcs.py
|
||||||
|
+++ b/scripts/build-many-glibcs.py
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
# Build many configurations of glibc.
|
||||||
|
# Copyright (C) 2016-2021 Free Software Foundation, Inc.
|
||||||
|
+# Copyright (C) The GNU Toolchain Authors.
|
||||||
|
# This file is part of the GNU C Library.
|
||||||
|
#
|
||||||
|
# The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@@ -435,15 +436,15 @@ class Context(object):
|
||||||
|
'--disable-experimental-malloc',
|
||||||
|
'--disable-build-nscd',
|
||||||
|
'--disable-nscd']},
|
||||||
|
- {'variant': 'static-pie',
|
||||||
|
- 'cfg': ['--enable-static-pie']},
|
||||||
|
- {'variant': 'x32-static-pie',
|
||||||
|
+ {'variant': 'no-pie',
|
||||||
|
+ 'cfg': ['--disable-default-pie']},
|
||||||
|
+ {'variant': 'x32-no-pie',
|
||||||
|
'ccopts': '-mx32',
|
||||||
|
- 'cfg': ['--enable-static-pie']},
|
||||||
|
- {'variant': 'static-pie',
|
||||||
|
+ 'cfg': ['--disable-default-pie']},
|
||||||
|
+ {'variant': 'no-pie',
|
||||||
|
'arch': 'i686',
|
||||||
|
'ccopts': '-m32 -march=i686',
|
||||||
|
- 'cfg': ['--enable-static-pie']},
|
||||||
|
+ 'cfg': ['--disable-default-pie']},
|
||||||
|
{'variant': 'disable-multi-arch',
|
||||||
|
'arch': 'i686',
|
||||||
|
'ccopts': '-m32 -march=i686',
|
||||||
|
diff --git a/sysdeps/alpha/configure b/sysdeps/alpha/configure
|
||||||
|
index 464b5965276dca19..3d665d96f2b40c4e 100644
|
||||||
|
--- a/sysdeps/alpha/configure
|
||||||
|
+++ b/sysdeps/alpha/configure
|
||||||
|
@@ -5,4 +5,9 @@
|
||||||
|
# symbols in a position independent way.
|
||||||
|
$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
|
||||||
|
|
||||||
|
+
|
||||||
|
+# PIE builds fail on binutils 2.37 and earlier, see:
|
||||||
|
+# https://sourceware.org/bugzilla/show_bug.cgi?id=28672
|
||||||
|
+$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
|
||||||
|
+
|
||||||
|
# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/alpha/configure.ac b/sysdeps/alpha/configure.ac
|
||||||
|
index 38e52e71ac2a5bc0..8f9a39ed2e4a29cb 100644
|
||||||
|
--- a/sysdeps/alpha/configure.ac
|
||||||
|
+++ b/sysdeps/alpha/configure.ac
|
||||||
|
@@ -4,4 +4,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
|
||||||
|
# With required gcc+binutils, we can always access static and hidden
|
||||||
|
# symbols in a position independent way.
|
||||||
|
AC_DEFINE(PI_STATIC_AND_HIDDEN)
|
||||||
|
+
|
||||||
|
+# PIE builds fail on binutils 2.37 and earlier, see:
|
||||||
|
+# https://sourceware.org/bugzilla/show_bug.cgi?id=28672
|
||||||
|
+AC_DEFINE(PIE_UNSUPPORTED)
|
||||||
|
# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/csky/configure b/sysdeps/csky/configure
|
||||||
|
index 19acb084fb43d9ea..27464eb707ebd6c6 100644
|
||||||
|
--- a/sysdeps/csky/configure
|
||||||
|
+++ b/sysdeps/csky/configure
|
||||||
|
@@ -2,3 +2,10 @@
|
||||||
|
# Local configure fragment for sysdeps/csky.
|
||||||
|
|
||||||
|
$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+# PIE builds fail on binutils 2.37 and earlier, see:
|
||||||
|
+# https://sourceware.org/bugzilla/show_bug.cgi?id=28672
|
||||||
|
+$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
|
||||||
|
+
|
||||||
|
+# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/csky/configure.ac b/sysdeps/csky/configure.ac
|
||||||
|
index 5656b665da698d05..8e008249094d9e5a 100644
|
||||||
|
--- a/sysdeps/csky/configure.ac
|
||||||
|
+++ b/sysdeps/csky/configure.ac
|
||||||
|
@@ -2,3 +2,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
|
||||||
|
# Local configure fragment for sysdeps/csky.
|
||||||
|
|
||||||
|
AC_DEFINE(PI_STATIC_AND_HIDDEN)
|
||||||
|
+
|
||||||
|
+# PIE builds fail on binutils 2.37 and earlier, see:
|
||||||
|
+# https://sourceware.org/bugzilla/show_bug.cgi?id=28672
|
||||||
|
+AC_DEFINE(PIE_UNSUPPORTED)
|
||||||
|
+# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/hppa/configure b/sysdeps/hppa/configure
|
||||||
|
index 2cfe6cbea14549d0..cf5acf966dad67ba 100644
|
||||||
|
--- a/sysdeps/hppa/configure
|
||||||
|
+++ b/sysdeps/hppa/configure
|
||||||
|
@@ -30,3 +30,10 @@ $as_echo "$libc_cv_asm_line_sep" >&6; }
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define ASM_LINE_SEP $libc_cv_asm_line_sep
|
||||||
|
_ACEOF
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+# PIE builds fail on binutils 2.37 and earlier, see:
|
||||||
|
+# https://sourceware.org/bugzilla/show_bug.cgi?id=28672
|
||||||
|
+$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
|
||||||
|
+
|
||||||
|
+# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/hppa/configure.ac b/sysdeps/hppa/configure.ac
|
||||||
|
index 1ec417b9474c3382..3e1c35bbd992f548 100644
|
||||||
|
--- a/sysdeps/hppa/configure.ac
|
||||||
|
+++ b/sysdeps/hppa/configure.ac
|
||||||
|
@@ -19,3 +19,8 @@ else
|
||||||
|
fi
|
||||||
|
rm -f conftest*])
|
||||||
|
AC_DEFINE_UNQUOTED(ASM_LINE_SEP, $libc_cv_asm_line_sep)
|
||||||
|
+
|
||||||
|
+# PIE builds fail on binutils 2.37 and earlier, see:
|
||||||
|
+# https://sourceware.org/bugzilla/show_bug.cgi?id=28672
|
||||||
|
+AC_DEFINE(PIE_UNSUPPORTED)
|
||||||
|
+# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/ia64/configure b/sysdeps/ia64/configure
|
||||||
|
index 1ef70921bc5266db..748cb526012adeb8 100644
|
||||||
|
--- a/sysdeps/ia64/configure
|
||||||
|
+++ b/sysdeps/ia64/configure
|
||||||
|
@@ -3,4 +3,9 @@
|
||||||
|
|
||||||
|
$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
|
||||||
|
|
||||||
|
+
|
||||||
|
+# PIE builds fail on binutils 2.37 and earlier, see:
|
||||||
|
+# https://sourceware.org/bugzilla/show_bug.cgi?id=28672
|
||||||
|
+$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
|
||||||
|
+
|
||||||
|
# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/ia64/configure.ac b/sysdeps/ia64/configure.ac
|
||||||
|
index 3bae9fc5e1a3ff45..8e5fba32c3ec8bfc 100644
|
||||||
|
--- a/sysdeps/ia64/configure.ac
|
||||||
|
+++ b/sysdeps/ia64/configure.ac
|
||||||
|
@@ -4,4 +4,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
|
||||||
|
dnl It is always possible to access static and hidden symbols in an
|
||||||
|
dnl position independent way.
|
||||||
|
AC_DEFINE(PI_STATIC_AND_HIDDEN)
|
||||||
|
+
|
||||||
|
+# PIE builds fail on binutils 2.37 and earlier, see:
|
||||||
|
+# https://sourceware.org/bugzilla/show_bug.cgi?id=28672
|
||||||
|
+AC_DEFINE(PIE_UNSUPPORTED)
|
||||||
|
# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/mach/hurd/configure b/sysdeps/mach/hurd/configure
|
||||||
|
index 8d0702ad438d1c0a..3303e5dff8ef5ecf 100644
|
||||||
|
--- a/sysdeps/mach/hurd/configure
|
||||||
|
+++ b/sysdeps/mach/hurd/configure
|
||||||
|
@@ -49,3 +49,9 @@ fi
|
||||||
|
|
||||||
|
# Hurd has libpthread as a separate library.
|
||||||
|
pthread_in_libc=no
|
||||||
|
+
|
||||||
|
+# Hurd build needs to be updated to support static pie, see:
|
||||||
|
+# https://sourceware.org/bugzilla/show_bug.cgi?id=28671
|
||||||
|
+$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
|
||||||
|
+
|
||||||
|
+# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/mach/hurd/configure.ac b/sysdeps/mach/hurd/configure.ac
|
||||||
|
index 82d085af33701aa2..022c2eff79fc0d08 100644
|
||||||
|
--- a/sysdeps/mach/hurd/configure.ac
|
||||||
|
+++ b/sysdeps/mach/hurd/configure.ac
|
||||||
|
@@ -29,3 +29,8 @@ fi
|
||||||
|
|
||||||
|
# Hurd has libpthread as a separate library.
|
||||||
|
pthread_in_libc=no
|
||||||
|
+
|
||||||
|
+# Hurd build needs to be updated to support static pie, see:
|
||||||
|
+# https://sourceware.org/bugzilla/show_bug.cgi?id=28671
|
||||||
|
+AC_DEFINE(PIE_UNSUPPORTED)
|
||||||
|
+# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/microblaze/configure b/sysdeps/microblaze/configure
|
||||||
|
new file mode 100755
|
||||||
|
index 0000000000000000..e6652562d212b688
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sysdeps/microblaze/configure
|
||||||
|
@@ -0,0 +1,8 @@
|
||||||
|
+# This file is generated from configure.ac by Autoconf. DO NOT EDIT!
|
||||||
|
+ # Local configure fragment for sysdeps/microblaze.
|
||||||
|
+
|
||||||
|
+# gcc 11.2.1 and earlier crash with an internal compiler error, see:
|
||||||
|
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103613
|
||||||
|
+$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h
|
||||||
|
+
|
||||||
|
+# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/microblaze/configure.ac b/sysdeps/microblaze/configure.ac
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..1c58f70a7bdfebcb
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sysdeps/microblaze/configure.ac
|
||||||
|
@@ -0,0 +1,7 @@
|
||||||
|
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
|
||||||
|
+# Local configure fragment for sysdeps/microblaze.
|
||||||
|
+
|
||||||
|
+# gcc 11.2.1 and earlier crash with an internal compiler error, see:
|
||||||
|
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103613
|
||||||
|
+AC_DEFINE(PIE_UNSUPPORTED)
|
||||||
|
+# work around problem with autoconf and empty lines at the end of files
|
||||||
|
diff --git a/sysdeps/sparc/Makefile b/sysdeps/sparc/Makefile
|
||||||
|
index 1be9a3db2ca12216..12c2c1b085fd4ae2 100644
|
||||||
|
--- a/sysdeps/sparc/Makefile
|
||||||
|
+++ b/sysdeps/sparc/Makefile
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
long-double-fcts = yes
|
||||||
|
|
||||||
|
pie-ccflag = -fPIE
|
||||||
|
+no-pie-ccflag = -fno-PIE
|
||||||
|
|
||||||
|
ifeq ($(subdir),gmon)
|
||||||
|
sysdep_routines += sparc-mcount
|
250
SOURCES/glibc-rh2023422-1.patch
Normal file
250
SOURCES/glibc-rh2023422-1.patch
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
commit c1cb2deeca1a85c6fc5bd41b90816d48a95bc434
|
||||||
|
Author: Florian Weimer <fweimer@redhat.com>
|
||||||
|
Date: Sun Dec 5 11:28:34 2021 +0100
|
||||||
|
|
||||||
|
elf: execve statically linked programs instead of crashing [BZ #28648]
|
||||||
|
|
||||||
|
Programs without dynamic dependencies and without a program
|
||||||
|
interpreter are now run via execve.
|
||||||
|
|
||||||
|
Previously, the dynamic linker either crashed while attempting to
|
||||||
|
read a non-existing dynamic segment (looking for DT_AUDIT/DT_DEPAUDIT
|
||||||
|
data), or the self-relocated in the static PIE executable crashed
|
||||||
|
because the outer dynamic linker had already applied RELRO protection.
|
||||||
|
|
||||||
|
<dl-execve.h> is needed because execve is not available in the
|
||||||
|
dynamic loader on Hurd.
|
||||||
|
|
||||||
|
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||||
|
|
||||||
|
Conflicts:
|
||||||
|
elf/Makefile
|
||||||
|
(usual test differences)
|
||||||
|
elf/rtld.c
|
||||||
|
(missing ld.so self-relocation cleanup downstream)
|
||||||
|
|
||||||
|
diff --git a/elf/Makefile b/elf/Makefile
|
||||||
|
index 118d579c42c38110..7696aa1324919a80 100644
|
||||||
|
--- a/elf/Makefile
|
||||||
|
+++ b/elf/Makefile
|
||||||
|
@@ -224,7 +224,8 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
|
||||||
|
tst-tls-ie tst-tls-ie-dlmopen argv0test \
|
||||||
|
tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \
|
||||||
|
tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dlmopen-gethostbyname \
|
||||||
|
- tst-dl-is_dso tst-ro-dynamic
|
||||||
|
+ tst-dl-is_dso tst-ro-dynamic \
|
||||||
|
+ tst-rtld-run-static \
|
||||||
|
# reldep9
|
||||||
|
tests-internal += loadtest unload unload2 circleload1 \
|
||||||
|
neededtest neededtest2 neededtest3 neededtest4 \
|
||||||
|
@@ -1914,3 +1915,5 @@ $(objpfx)tst-ro-dynamic-mod.so: $(objpfx)tst-ro-dynamic-mod.os \
|
||||||
|
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
|
||||||
|
-Wl,--script=tst-ro-dynamic-mod.map \
|
||||||
|
$(objpfx)tst-ro-dynamic-mod.os
|
||||||
|
+
|
||||||
|
+$(objpfx)tst-rtld-run-static.out: $(objpfx)/ldconfig
|
||||||
|
diff --git a/elf/rtld.c b/elf/rtld.c
|
||||||
|
index d83ac1bdc40a6081..6b0d6107801b2f44 100644
|
||||||
|
--- a/elf/rtld.c
|
||||||
|
+++ b/elf/rtld.c
|
||||||
|
@@ -50,6 +50,7 @@
|
||||||
|
#include <dl-main.h>
|
||||||
|
#include <gnu/lib-names.h>
|
||||||
|
#include <dl-tunables.h>
|
||||||
|
+#include <dl-execve.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
@@ -1106,6 +1107,45 @@ load_audit_modules (struct link_map *main_map, struct audit_list *audit_list)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Check if the executable is not actualy dynamically linked, and
|
||||||
|
+ invoke it directly in that case. */
|
||||||
|
+static void
|
||||||
|
+rtld_chain_load (struct link_map *main_map, char *argv0)
|
||||||
|
+{
|
||||||
|
+ /* The dynamic loader run against itself. */
|
||||||
|
+ const char *rtld_soname
|
||||||
|
+ = ((const char *) D_PTR (&GL(dl_rtld_map), l_info[DT_STRTAB])
|
||||||
|
+ + GL(dl_rtld_map).l_info[DT_SONAME]->d_un.d_val);
|
||||||
|
+ if (main_map->l_info[DT_SONAME] != NULL
|
||||||
|
+ && strcmp (rtld_soname,
|
||||||
|
+ ((const char *) D_PTR (main_map, l_info[DT_STRTAB])
|
||||||
|
+ + main_map->l_info[DT_SONAME]->d_un.d_val)) == 0)
|
||||||
|
+ _dl_fatal_printf ("%s: loader cannot load itself\n", rtld_soname);
|
||||||
|
+
|
||||||
|
+ /* With DT_NEEDED dependencies, the executable is dynamically
|
||||||
|
+ linked. */
|
||||||
|
+ if (__glibc_unlikely (main_map->l_info[DT_NEEDED] != NULL))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* If the executable has program interpreter, it is dynamically
|
||||||
|
+ linked. */
|
||||||
|
+ for (size_t i = 0; i < main_map->l_phnum; ++i)
|
||||||
|
+ if (main_map->l_phdr[i].p_type == PT_INTERP)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ const char *pathname = _dl_argv[0];
|
||||||
|
+ if (argv0 != NULL)
|
||||||
|
+ _dl_argv[0] = argv0;
|
||||||
|
+ int errcode = __rtld_execve (pathname, _dl_argv, _environ);
|
||||||
|
+ const char *errname = strerrorname_np (errcode);
|
||||||
|
+ if (errname != NULL)
|
||||||
|
+ _dl_fatal_printf("%s: cannot execute %s: %s\n",
|
||||||
|
+ rtld_soname, pathname, errname);
|
||||||
|
+ else
|
||||||
|
+ _dl_fatal_printf("%s: cannot execute %s: %d\n",
|
||||||
|
+ rtld_soname, pathname, errno);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
dl_main (const ElfW(Phdr) *phdr,
|
||||||
|
ElfW(Word) phnum,
|
||||||
|
@@ -1374,14 +1414,8 @@ dl_main (const ElfW(Phdr) *phdr,
|
||||||
|
/* Now the map for the main executable is available. */
|
||||||
|
main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
|
||||||
|
|
||||||
|
- if (__glibc_likely (state.mode == rtld_mode_normal)
|
||||||
|
- && GL(dl_rtld_map).l_info[DT_SONAME] != NULL
|
||||||
|
- && main_map->l_info[DT_SONAME] != NULL
|
||||||
|
- && strcmp ((const char *) D_PTR (&GL(dl_rtld_map), l_info[DT_STRTAB])
|
||||||
|
- + GL(dl_rtld_map).l_info[DT_SONAME]->d_un.d_val,
|
||||||
|
- (const char *) D_PTR (main_map, l_info[DT_STRTAB])
|
||||||
|
- + main_map->l_info[DT_SONAME]->d_un.d_val) == 0)
|
||||||
|
- _dl_fatal_printf ("loader cannot load itself\n");
|
||||||
|
+ if (__glibc_likely (state.mode == rtld_mode_normal))
|
||||||
|
+ rtld_chain_load (main_map, argv0);
|
||||||
|
|
||||||
|
phdr = main_map->l_phdr;
|
||||||
|
phnum = main_map->l_phnum;
|
||||||
|
diff --git a/elf/tst-rtld-run-static.c b/elf/tst-rtld-run-static.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..7281093504b675c4
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/elf/tst-rtld-run-static.c
|
||||||
|
@@ -0,0 +1,62 @@
|
||||||
|
+/* Test running statically linked programs using ld.so.
|
||||||
|
+ Copyright (C) 2021 Free Software Foundation, Inc.
|
||||||
|
+ This file is part of the GNU C Library.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
+ modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ License as published by the Free Software Foundation; either
|
||||||
|
+ version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ License along with the GNU C Library; if not, see
|
||||||
|
+ <https://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+#include <support/check.h>
|
||||||
|
+#include <support/support.h>
|
||||||
|
+#include <support/capture_subprocess.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+do_test (void)
|
||||||
|
+{
|
||||||
|
+ char *ldconfig_path = xasprintf ("%s/elf/ldconfig", support_objdir_root);
|
||||||
|
+
|
||||||
|
+ {
|
||||||
|
+ char *argv[] = { (char *) "ld.so", ldconfig_path, (char *) "--help", NULL };
|
||||||
|
+ struct support_capture_subprocess cap
|
||||||
|
+ = support_capture_subprogram (support_objdir_elf_ldso, argv);
|
||||||
|
+ support_capture_subprocess_check (&cap, "no --argv0", 0, sc_allow_stdout);
|
||||||
|
+ puts ("info: output without --argv0:");
|
||||||
|
+ puts (cap.out.buffer);
|
||||||
|
+ TEST_VERIFY (strstr (cap.out.buffer, "Usage: ldconfig [OPTION...]\n")
|
||||||
|
+ == cap.out.buffer);
|
||||||
|
+ support_capture_subprocess_free (&cap);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ {
|
||||||
|
+ char *argv[] =
|
||||||
|
+ {
|
||||||
|
+ (char *) "ld.so", (char *) "--argv0", (char *) "ldconfig-argv0",
|
||||||
|
+ ldconfig_path, (char *) "--help", NULL
|
||||||
|
+ };
|
||||||
|
+ struct support_capture_subprocess cap
|
||||||
|
+ = support_capture_subprogram (support_objdir_elf_ldso, argv);
|
||||||
|
+ support_capture_subprocess_check (&cap, "with --argv0", 0, sc_allow_stdout);
|
||||||
|
+ puts ("info: output with --argv0:");
|
||||||
|
+ puts (cap.out.buffer);
|
||||||
|
+ TEST_VERIFY (strstr (cap.out.buffer, "Usage: ldconfig-argv0 [OPTION...]\n")
|
||||||
|
+ == cap.out.buffer);
|
||||||
|
+ support_capture_subprocess_free (&cap);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free (ldconfig_path);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#include <support/test-driver.c>
|
||||||
|
diff --git a/sysdeps/generic/dl-execve.h b/sysdeps/generic/dl-execve.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..5fd097df69e1770c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sysdeps/generic/dl-execve.h
|
||||||
|
@@ -0,0 +1,25 @@
|
||||||
|
+/* execve for the dynamic linker. Generic stub version.
|
||||||
|
+ Copyright (C) 2021 Free Software Foundation, Inc.
|
||||||
|
+ This file is part of the GNU C Library.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
+ modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ License as published by the Free Software Foundation; either
|
||||||
|
+ version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ License along with the GNU C Library; if not, see
|
||||||
|
+ <https://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+#include <errno.h>
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+__rtld_execve (const char *path, char *const *argv, char *const *envp)
|
||||||
|
+{
|
||||||
|
+ return ENOSYS;
|
||||||
|
+}
|
||||||
|
diff --git a/sysdeps/unix/sysv/linux/dl-execve.h b/sysdeps/unix/sysv/linux/dl-execve.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..ead3e1c28da34363
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sysdeps/unix/sysv/linux/dl-execve.h
|
||||||
|
@@ -0,0 +1,25 @@
|
||||||
|
+/* execve for the dynamic linker. Linux version.
|
||||||
|
+ Copyright (C) 2021 Free Software Foundation, Inc.
|
||||||
|
+ This file is part of the GNU C Library.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
+ modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ License as published by the Free Software Foundation; either
|
||||||
|
+ version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ License along with the GNU C Library; if not, see
|
||||||
|
+ <https://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+#include <errno.h>
|
||||||
|
+
|
||||||
|
+static inline int
|
||||||
|
+__rtld_execve (const char *path, char *const *argv, char *const *envp)
|
||||||
|
+{
|
||||||
|
+ return -INTERNAL_SYSCALL_CALL (execve, path, argv, envp);
|
||||||
|
+}
|
37
SOURCES/glibc-rh2023422-2.patch
Normal file
37
SOURCES/glibc-rh2023422-2.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
commit 2e75604f8337fa4332977f72a8f6726309679edf
|
||||||
|
Author: Florian Weimer <fweimer@redhat.com>
|
||||||
|
Date: Fri Dec 10 16:06:36 2021 +0100
|
||||||
|
|
||||||
|
elf: Install a symbolic link to ld.so as /usr/bin/ld.so
|
||||||
|
|
||||||
|
This makes ld.so features such as --preload, --audit,
|
||||||
|
and --list-diagnostics more accessible to end users because they
|
||||||
|
do not need to know the ABI name of the dynamic loader.
|
||||||
|
|
||||||
|
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/elf/Makefile b/elf/Makefile
|
||||||
|
index 7696aa1324919a80..3e7debdd81baafe0 100644
|
||||||
|
--- a/elf/Makefile
|
||||||
|
+++ b/elf/Makefile
|
||||||
|
@@ -104,7 +104,7 @@ endif
|
||||||
|
ifeq (yes,$(build-shared))
|
||||||
|
extra-objs = $(all-rtld-routines:%=%.os) sofini.os interp.os
|
||||||
|
generated += librtld.os dl-allobjs.os ld.so ldd
|
||||||
|
-install-others = $(inst_rtlddir)/$(rtld-installed-name)
|
||||||
|
+install-others = $(inst_rtlddir)/$(rtld-installed-name) $(inst_bindir)/ld.so
|
||||||
|
install-bin-script = ldd
|
||||||
|
endif
|
||||||
|
|
||||||
|
@@ -645,6 +645,11 @@ $(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
|
||||||
|
$(make-target-directory)
|
||||||
|
$(do-install-program)
|
||||||
|
|
||||||
|
+# Creates the relative /usr/bin/ld.so symbolic link.
|
||||||
|
+$(inst_bindir)/ld.so: $(inst_rtlddir)/$(rtld-installed-name)
|
||||||
|
+ $(make-target-directory)
|
||||||
|
+ $(make-link)
|
||||||
|
+
|
||||||
|
# Special target called by parent to install just the dynamic linker.
|
||||||
|
.PHONY: ldso_install
|
||||||
|
ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
|
19
SOURCES/glibc-rh2023422-3.patch
Normal file
19
SOURCES/glibc-rh2023422-3.patch
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
commit f1eeef945d49c72eb13654bd30b5904e89b4626f
|
||||||
|
Author: Florian Weimer <fweimer@redhat.com>
|
||||||
|
Date: Fri Dec 10 21:34:30 2021 +0100
|
||||||
|
|
||||||
|
elf: Use errcode instead of (unset) errno in rtld_chain_load
|
||||||
|
|
||||||
|
diff --git a/elf/rtld.c b/elf/rtld.c
|
||||||
|
index 6b0d6107801b2f44..6bbb373c5743cb99 100644
|
||||||
|
--- a/elf/rtld.c
|
||||||
|
+++ b/elf/rtld.c
|
||||||
|
@@ -1143,7 +1143,7 @@ rtld_chain_load (struct link_map *main_map, char *argv0)
|
||||||
|
rtld_soname, pathname, errname);
|
||||||
|
else
|
||||||
|
_dl_fatal_printf("%s: cannot execute %s: %d\n",
|
||||||
|
- rtld_soname, pathname, errno);
|
||||||
|
+ rtld_soname, pathname, errcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
23
SOURCES/glibc-rh2027789.patch
Normal file
23
SOURCES/glibc-rh2027789.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Downstream-only patch from Mark Wielaard <mjw@redhat.com> to avoid a
|
||||||
|
crash in backtrace if the vDSO is not available.
|
||||||
|
|
||||||
|
Upstream, this code was removed in commit 82fd7314c7df8c5555dce02
|
||||||
|
("powerpc: Remove backtrace implementation"), so patch is not needed
|
||||||
|
there.
|
||||||
|
|
||||||
|
diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c
|
||||||
|
index 37de9b5bdd73c316..0ffa7509dfa4862a 100644
|
||||||
|
--- a/sysdeps/powerpc/powerpc64/backtrace.c
|
||||||
|
+++ b/sysdeps/powerpc/powerpc64/backtrace.c
|
||||||
|
@@ -68,8 +68,9 @@ static inline bool
|
||||||
|
is_sigtramp_address (void *nip)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_SIGTRAMP_RT64
|
||||||
|
- if (nip == GLRO (dl_vdso_sigtramp_rt64) ||
|
||||||
|
- nip == GLRO (dl_vdso_sigtramp_rt64) + 4)
|
||||||
|
+ if ((nip == GLRO (dl_vdso_sigtramp_rt64) ||
|
||||||
|
+ nip == GLRO (dl_vdso_sigtramp_rt64) + 4)
|
||||||
|
+ && nip != NULL)
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
return false;
|
143
SOURCES/glibc-rh2029410.patch
Normal file
143
SOURCES/glibc-rh2029410.patch
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
commit ea5814467a02c9d2d7608b6445c5d60e2a81d3ee
|
||||||
|
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||||
|
Date: Fri Dec 10 13:00:09 2021 -0800
|
||||||
|
|
||||||
|
x86-64: Remove LD_PREFER_MAP_32BIT_EXEC support [BZ #28656]
|
||||||
|
|
||||||
|
Remove the LD_PREFER_MAP_32BIT_EXEC environment variable support since
|
||||||
|
the first PT_LOAD segment is no longer executable due to defaulting to
|
||||||
|
-z separate-code.
|
||||||
|
|
||||||
|
This fixes [BZ #28656].
|
||||||
|
|
||||||
|
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
|
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
|
||||||
|
deleted file mode 100644
|
||||||
|
index 5b9696e2de8e5482..0000000000000000
|
||||||
|
--- a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,45 +0,0 @@
|
||||||
|
-/* Optional code to distinguish library flavours. x86-64 version.
|
||||||
|
- Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||||
|
- This file is part of the GNU C Library.
|
||||||
|
-
|
||||||
|
- The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
- modify it under the terms of the GNU Lesser General Public
|
||||||
|
- License as published by the Free Software Foundation; either
|
||||||
|
- version 2.1 of the License, or (at your option) any later version.
|
||||||
|
-
|
||||||
|
- The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
- Lesser General Public License for more details.
|
||||||
|
-
|
||||||
|
- You should have received a copy of the GNU Lesser General Public
|
||||||
|
- License along with the GNU C Library; if not, see
|
||||||
|
- <https://www.gnu.org/licenses/>. */
|
||||||
|
-
|
||||||
|
-#ifndef _DL_LIBRECON_H
|
||||||
|
-
|
||||||
|
-#include <sysdeps/unix/sysv/linux/dl-librecon.h>
|
||||||
|
-
|
||||||
|
-/* Recognizing extra environment variables. For 64-bit applications,
|
||||||
|
- branch prediction performance may be negatively impacted when the
|
||||||
|
- target of a branch is more than 4GB away from the branch. Add the
|
||||||
|
- Prefer_MAP_32BIT_EXEC bit so that mmap will try to map executable
|
||||||
|
- pages with MAP_32BIT first. NB: MAP_32BIT will map to lower 2GB,
|
||||||
|
- not lower 4GB, address. Prefer_MAP_32BIT_EXEC reduces bits available
|
||||||
|
- for address space layout randomization (ASLR). Prefer_MAP_32BIT_EXEC
|
||||||
|
- is always disabled for SUID programs and can be enabled by setting
|
||||||
|
- environment variable, LD_PREFER_MAP_32BIT_EXEC. */
|
||||||
|
-#define EXTRA_LD_ENVVARS \
|
||||||
|
- case 21: \
|
||||||
|
- if (!__libc_enable_secure \
|
||||||
|
- && memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0) \
|
||||||
|
- GLRO(dl_x86_cpu_features).preferred[index_arch_Prefer_MAP_32BIT_EXEC] \
|
||||||
|
- |= bit_arch_Prefer_MAP_32BIT_EXEC; \
|
||||||
|
- break;
|
||||||
|
-
|
||||||
|
-/* Extra unsecure variables. The names are all stuffed in a single
|
||||||
|
- string which means they have to be terminated with a '\0' explicitly. */
|
||||||
|
-#define EXTRA_UNSECURE_ENVVARS \
|
||||||
|
- "LD_PREFER_MAP_32BIT_EXEC\0"
|
||||||
|
-
|
||||||
|
-#endif /* dl-librecon.h */
|
||||||
|
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/mmap_internal.h b/sysdeps/unix/sysv/linux/x86_64/64/mmap_internal.h
|
||||||
|
deleted file mode 100644
|
||||||
|
index 18177d2cb3ae645f..0000000000000000
|
||||||
|
--- a/sysdeps/unix/sysv/linux/x86_64/64/mmap_internal.h
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,42 +0,0 @@
|
||||||
|
-/* Linux mmap system call. x86-64 version.
|
||||||
|
- Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||||
|
-
|
||||||
|
- This file is part of the GNU C Library.
|
||||||
|
-
|
||||||
|
- The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
- modify it under the terms of the GNU Lesser General Public License as
|
||||||
|
- published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
- License, or (at your option) any later version.
|
||||||
|
-
|
||||||
|
- The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
- Lesser General Public License for more details.
|
||||||
|
-
|
||||||
|
- You should have received a copy of the GNU Lesser General Public
|
||||||
|
- License along with the GNU C Library; if not, see
|
||||||
|
- <https://www.gnu.org/licenses/>. */
|
||||||
|
-
|
||||||
|
-#ifndef MMAP_X86_64_INTERNAL_H
|
||||||
|
-#define MMAP_X86_64_INTERNAL_H
|
||||||
|
-
|
||||||
|
-#include <ldsodefs.h>
|
||||||
|
-
|
||||||
|
-/* If the Prefer_MAP_32BIT_EXEC bit is set, try to map executable pages
|
||||||
|
- with MAP_32BIT first. */
|
||||||
|
-#define MMAP_PREPARE(addr, len, prot, flags, fd, offset) \
|
||||||
|
- if ((addr) == NULL \
|
||||||
|
- && ((prot) & PROT_EXEC) != 0 \
|
||||||
|
- && HAS_ARCH_FEATURE (Prefer_MAP_32BIT_EXEC)) \
|
||||||
|
- { \
|
||||||
|
- void *ret = (void*) INLINE_SYSCALL_CALL (mmap, (addr), (len), \
|
||||||
|
- (prot), \
|
||||||
|
- (flags) | MAP_32BIT, \
|
||||||
|
- (fd), (offset)); \
|
||||||
|
- if (ret != MAP_FAILED) \
|
||||||
|
- return ret; \
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
-#include_next <mmap_internal.h>
|
||||||
|
-
|
||||||
|
-#endif
|
||||||
|
diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-tunables.c
|
||||||
|
index 00fe5045eb56eb07..58f2fad4323d5d91 100644
|
||||||
|
--- a/sysdeps/x86/cpu-tunables.c
|
||||||
|
+++ b/sysdeps/x86/cpu-tunables.c
|
||||||
|
@@ -260,13 +260,6 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp)
|
||||||
|
20);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
- case 21:
|
||||||
|
- {
|
||||||
|
- CHECK_GLIBC_IFUNC_PREFERRED_BOTH (n, cpu_features,
|
||||||
|
- Prefer_MAP_32BIT_EXEC,
|
||||||
|
- disable, 21);
|
||||||
|
- }
|
||||||
|
- break;
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
CHECK_GLIBC_IFUNC_PREFERRED_NEED_BOTH
|
||||||
|
diff --git a/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def b/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def
|
||||||
|
index d7c93f00c5928a30..3bdc76cf71007948 100644
|
||||||
|
--- a/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def
|
||||||
|
+++ b/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def
|
||||||
|
@@ -26,7 +26,6 @@ BIT (I586)
|
||||||
|
BIT (I686)
|
||||||
|
BIT (Slow_SSE4_2)
|
||||||
|
BIT (AVX_Fast_Unaligned_Load)
|
||||||
|
-BIT (Prefer_MAP_32BIT_EXEC)
|
||||||
|
BIT (Prefer_No_VZEROUPPER)
|
||||||
|
BIT (Prefer_ERMS)
|
||||||
|
BIT (Prefer_No_AVX512)
|
177
SOURCES/glibc-upstream-2.34-44.patch
Normal file
177
SOURCES/glibc-upstream-2.34-44.patch
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
commit f411207a833d0c49578ebe7062aee3660813ed5f
|
||||||
|
Author: Nikita Popov <npv1310@gmail.com>
|
||||||
|
Date: Tue Nov 2 13:21:42 2021 +0500
|
||||||
|
|
||||||
|
gconv: Do not emit spurious NUL character in ISO-2022-JP-3 (bug 28524)
|
||||||
|
|
||||||
|
Bugfix 27256 has introduced another issue:
|
||||||
|
In conversion from ISO-2022-JP-3 encoding, it is possible
|
||||||
|
to force iconv to emit extra NUL character on internal state reset.
|
||||||
|
To do this, it is sufficient to feed iconv with escape sequence
|
||||||
|
which switches active character set.
|
||||||
|
The simplified check 'data->__statep->__count != ASCII_set'
|
||||||
|
introduced by the aforementioned bugfix picks that case and
|
||||||
|
behaves as if '\0' character has been queued thus emitting it.
|
||||||
|
|
||||||
|
To eliminate this issue, these steps are taken:
|
||||||
|
* Restore original condition
|
||||||
|
'(data->__statep->__count & ~7) != ASCII_set'.
|
||||||
|
It is necessary since bits 0-2 may contain
|
||||||
|
number of buffered input characters.
|
||||||
|
* Check that queued character is not NUL.
|
||||||
|
Similar step is taken for main conversion loop.
|
||||||
|
|
||||||
|
Bundled test case follows following logic:
|
||||||
|
* Try to convert ISO-2022-JP-3 escape sequence
|
||||||
|
switching active character set
|
||||||
|
* Reset internal state by providing NULL as input buffer
|
||||||
|
* Ensure that nothing has been converted.
|
||||||
|
|
||||||
|
Signed-off-by: Nikita Popov <npv1310@gmail.com>
|
||||||
|
(cherry picked from commit ff012870b2c02a62598c04daa1e54632e020fd7d)
|
||||||
|
|
||||||
|
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
|
||||||
|
index c216f959df1413f8..d5507a048c6a6508 100644
|
||||||
|
--- a/iconvdata/Makefile
|
||||||
|
+++ b/iconvdata/Makefile
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
|
||||||
|
+# Copyright (C) The GNU Toolchain Authors.
|
||||||
|
# This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
# The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@@ -74,7 +75,7 @@ ifeq (yes,$(build-shared))
|
||||||
|
tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
|
||||||
|
tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \
|
||||||
|
bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 \
|
||||||
|
- bug-iconv13 bug-iconv14
|
||||||
|
+ bug-iconv13 bug-iconv14 bug-iconv15
|
||||||
|
ifeq ($(have-thread-library),yes)
|
||||||
|
tests += bug-iconv3
|
||||||
|
endif
|
||||||
|
@@ -327,6 +328,8 @@ $(objpfx)bug-iconv12.out: $(addprefix $(objpfx), $(gconv-modules)) \
|
||||||
|
$(addprefix $(objpfx),$(modules.so))
|
||||||
|
$(objpfx)bug-iconv14.out: $(addprefix $(objpfx), $(gconv-modules)) \
|
||||||
|
$(addprefix $(objpfx),$(modules.so))
|
||||||
|
+$(objpfx)bug-iconv15.out: $(addprefix $(objpfx), $(gconv-modules)) \
|
||||||
|
+ $(addprefix $(objpfx),$(modules.so))
|
||||||
|
|
||||||
|
$(objpfx)iconv-test.out: run-iconv-test.sh \
|
||||||
|
$(addprefix $(objpfx), $(gconv-modules)) \
|
||||||
|
diff --git a/iconvdata/bug-iconv15.c b/iconvdata/bug-iconv15.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..cc04bd0313a68786
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/iconvdata/bug-iconv15.c
|
||||||
|
@@ -0,0 +1,60 @@
|
||||||
|
+/* Bug 28524: Conversion from ISO-2022-JP-3 with iconv
|
||||||
|
+ may emit spurious NUL character on state reset.
|
||||||
|
+ Copyright (C) The GNU Toolchain Authors.
|
||||||
|
+ This file is part of the GNU C Library.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
+ modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ License as published by the Free Software Foundation; either
|
||||||
|
+ version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ License along with the GNU C Library; if not, see
|
||||||
|
+ <https://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+#include <stddef.h>
|
||||||
|
+#include <iconv.h>
|
||||||
|
+#include <support/check.h>
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+do_test (void)
|
||||||
|
+{
|
||||||
|
+ char in[] = "\x1b(I";
|
||||||
|
+ char *inbuf = in;
|
||||||
|
+ size_t inleft = sizeof (in) - 1;
|
||||||
|
+ char out[1];
|
||||||
|
+ char *outbuf = out;
|
||||||
|
+ size_t outleft = sizeof (out);
|
||||||
|
+ iconv_t cd;
|
||||||
|
+
|
||||||
|
+ cd = iconv_open ("UTF8", "ISO-2022-JP-3");
|
||||||
|
+ TEST_VERIFY_EXIT (cd != (iconv_t) -1);
|
||||||
|
+
|
||||||
|
+ /* First call to iconv should alter internal state.
|
||||||
|
+ Now, JISX0201_Kana_set is selected and
|
||||||
|
+ state value != ASCII_set. */
|
||||||
|
+ TEST_VERIFY (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) != (size_t) -1);
|
||||||
|
+
|
||||||
|
+ /* No bytes should have been added to
|
||||||
|
+ the output buffer at this point. */
|
||||||
|
+ TEST_VERIFY (outbuf == out);
|
||||||
|
+ TEST_VERIFY (outleft == sizeof (out));
|
||||||
|
+
|
||||||
|
+ /* Second call shall emit spurious NUL character in unpatched glibc. */
|
||||||
|
+ TEST_VERIFY (iconv (cd, NULL, NULL, &outbuf, &outleft) != (size_t) -1);
|
||||||
|
+
|
||||||
|
+ /* No characters are expected to be produced. */
|
||||||
|
+ TEST_VERIFY (outbuf == out);
|
||||||
|
+ TEST_VERIFY (outleft == sizeof (out));
|
||||||
|
+
|
||||||
|
+ TEST_VERIFY_EXIT (iconv_close (cd) != -1);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#include <support/test-driver.c>
|
||||||
|
diff --git a/iconvdata/iso-2022-jp-3.c b/iconvdata/iso-2022-jp-3.c
|
||||||
|
index c8ba88cdc9fe9200..5fc0c0f7397935fe 100644
|
||||||
|
--- a/iconvdata/iso-2022-jp-3.c
|
||||||
|
+++ b/iconvdata/iso-2022-jp-3.c
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* Conversion module for ISO-2022-JP-3.
|
||||||
|
Copyright (C) 1998-2021 Free Software Foundation, Inc.
|
||||||
|
+ Copyright (C) The GNU Toolchain Authors.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998,
|
||||||
|
and Bruno Haible <bruno@clisp.org>, 2002.
|
||||||
|
@@ -81,20 +82,31 @@ enum
|
||||||
|
the output state to the initial state. This has to be done during the
|
||||||
|
flushing. */
|
||||||
|
#define EMIT_SHIFT_TO_INIT \
|
||||||
|
- if (data->__statep->__count != ASCII_set) \
|
||||||
|
+ if ((data->__statep->__count & ~7) != ASCII_set) \
|
||||||
|
{ \
|
||||||
|
if (FROM_DIRECTION) \
|
||||||
|
{ \
|
||||||
|
- if (__glibc_likely (outbuf + 4 <= outend)) \
|
||||||
|
+ uint32_t ch = data->__statep->__count >> 6; \
|
||||||
|
+ \
|
||||||
|
+ if (__glibc_unlikely (ch != 0)) \
|
||||||
|
{ \
|
||||||
|
- /* Write out the last character. */ \
|
||||||
|
- *((uint32_t *) outbuf) = data->__statep->__count >> 6; \
|
||||||
|
- outbuf += sizeof (uint32_t); \
|
||||||
|
- data->__statep->__count = ASCII_set; \
|
||||||
|
+ if (__glibc_likely (outbuf + 4 <= outend)) \
|
||||||
|
+ { \
|
||||||
|
+ /* Write out the last character. */ \
|
||||||
|
+ put32u (outbuf, ch); \
|
||||||
|
+ outbuf += 4; \
|
||||||
|
+ data->__statep->__count &= 7; \
|
||||||
|
+ data->__statep->__count |= ASCII_set; \
|
||||||
|
+ } \
|
||||||
|
+ else \
|
||||||
|
+ /* We don't have enough room in the output buffer. */ \
|
||||||
|
+ status = __GCONV_FULL_OUTPUT; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
- /* We don't have enough room in the output buffer. */ \
|
||||||
|
- status = __GCONV_FULL_OUTPUT; \
|
||||||
|
+ { \
|
||||||
|
+ data->__statep->__count &= 7; \
|
||||||
|
+ data->__statep->__count |= ASCII_set; \
|
||||||
|
+ } \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
68
SOURCES/glibc-upstream-2.34-45.patch
Normal file
68
SOURCES/glibc-upstream-2.34-45.patch
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
commit cf8c6a634c0a04a9f5d198ef05310f85f7338839
|
||||||
|
Author: Florian Weimer <fweimer@redhat.com>
|
||||||
|
Date: Fri Nov 5 17:01:24 2021 +0100
|
||||||
|
|
||||||
|
elf: Earlier missing dynamic segment check in _dl_map_object_from_fd
|
||||||
|
|
||||||
|
Separated debuginfo files have PT_DYNAMIC with p_filesz == 0. We
|
||||||
|
need to check for that before the _dl_map_segments call because
|
||||||
|
that could attempt to write to mappings that extend beyond the end
|
||||||
|
of the file, resulting in SIGBUS.
|
||||||
|
|
||||||
|
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||||
|
(cherry picked from commit ea32ec354c65ddad11b82ca9d057010df13a9cea)
|
||||||
|
|
||||||
|
diff --git a/elf/dl-load.c b/elf/dl-load.c
|
||||||
|
index 4445c28ef3fb4a7e..0976977fbdf21902 100644
|
||||||
|
--- a/elf/dl-load.c
|
||||||
|
+++ b/elf/dl-load.c
|
||||||
|
@@ -1130,6 +1130,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
|
||||||
|
struct loadcmd loadcmds[l->l_phnum];
|
||||||
|
size_t nloadcmds = 0;
|
||||||
|
bool has_holes = false;
|
||||||
|
+ bool empty_dynamic = false;
|
||||||
|
|
||||||
|
/* The struct is initialized to zero so this is not necessary:
|
||||||
|
l->l_ld = 0;
|
||||||
|
@@ -1142,7 +1143,9 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
|
||||||
|
segments are mapped in. We record the addresses it says
|
||||||
|
verbatim, and later correct for the run-time load address. */
|
||||||
|
case PT_DYNAMIC:
|
||||||
|
- if (ph->p_filesz)
|
||||||
|
+ if (ph->p_filesz == 0)
|
||||||
|
+ empty_dynamic = true; /* Usually separate debuginfo. */
|
||||||
|
+ else
|
||||||
|
{
|
||||||
|
/* Debuginfo only files from "objcopy --only-keep-debug"
|
||||||
|
contain a PT_DYNAMIC segment with p_filesz == 0. Skip
|
||||||
|
@@ -1265,6 +1268,13 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
|
||||||
|
goto lose;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* This check recognizes most separate debuginfo files. */
|
||||||
|
+ if (__glibc_unlikely ((l->l_ld == 0 && type == ET_DYN) || empty_dynamic))
|
||||||
|
+ {
|
||||||
|
+ errstring = N_("object file has no dynamic section");
|
||||||
|
+ goto lose;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Length of the sections to be loaded. */
|
||||||
|
maplength = loadcmds[nloadcmds - 1].allocend - loadcmds[0].mapstart;
|
||||||
|
|
||||||
|
@@ -1282,15 +1292,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (l->l_ld == 0)
|
||||||
|
- {
|
||||||
|
- if (__glibc_unlikely (type == ET_DYN))
|
||||||
|
- {
|
||||||
|
- errstring = N_("object file has no dynamic section");
|
||||||
|
- goto lose;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
+ if (l->l_ld != 0)
|
||||||
|
l->l_ld = (ElfW(Dyn) *) ((ElfW(Addr)) l->l_ld + l->l_addr);
|
||||||
|
|
||||||
|
elf_get_dynamic_info (l);
|
41
SOURCES/glibc-upstream-2.34-46.patch
Normal file
41
SOURCES/glibc-upstream-2.34-46.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
commit a4f3bc23461e3f9f6053e827715984ba0d2e589a
|
||||||
|
Author: Florian Weimer <fweimer@redhat.com>
|
||||||
|
Date: Wed Nov 10 15:21:37 2021 +0100
|
||||||
|
|
||||||
|
s390: Use long branches across object boundaries (jgh instead of jh)
|
||||||
|
|
||||||
|
Depending on the layout chosen by the linker, the 16-bit displacement
|
||||||
|
of the jh instruction is insufficient to reach the target label.
|
||||||
|
|
||||||
|
Analysis of the linker failure was carried out by Nick Clifton.
|
||||||
|
|
||||||
|
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||||
|
Reviewed-by: Stefan Liebler <stli@linux.ibm.com>
|
||||||
|
(cherry picked from commit 98966749f2b418825ff2ea496a0ee89fe63d2cc8)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/s390/memmem-arch13.S b/sysdeps/s390/memmem-arch13.S
|
||||||
|
index c5c8d8c97efb3b9f..58df8cdb142a6b25 100644
|
||||||
|
--- a/sysdeps/s390/memmem-arch13.S
|
||||||
|
+++ b/sysdeps/s390/memmem-arch13.S
|
||||||
|
@@ -41,7 +41,7 @@ ENTRY(MEMMEM_ARCH13)
|
||||||
|
# error The arch13 variant of memmem needs the z13 variant of memmem!
|
||||||
|
# endif
|
||||||
|
clgfi %r5,9
|
||||||
|
- jh MEMMEM_Z13
|
||||||
|
+ jgh MEMMEM_Z13
|
||||||
|
|
||||||
|
aghik %r0,%r5,-1 /* vll needs highest index. */
|
||||||
|
bc 4,0(%r14) /* cc==1: return if needle-len == 0. */
|
||||||
|
diff --git a/sysdeps/s390/strstr-arch13.S b/sysdeps/s390/strstr-arch13.S
|
||||||
|
index c7183e627c9fa986..222a6de91abb3fc6 100644
|
||||||
|
--- a/sysdeps/s390/strstr-arch13.S
|
||||||
|
+++ b/sysdeps/s390/strstr-arch13.S
|
||||||
|
@@ -49,7 +49,7 @@ ENTRY(STRSTR_ARCH13)
|
||||||
|
# error The arch13 variant of strstr needs the z13 variant of strstr!
|
||||||
|
# endif
|
||||||
|
clgfi %r4,9
|
||||||
|
- jh STRSTR_Z13
|
||||||
|
+ jgh STRSTR_Z13
|
||||||
|
|
||||||
|
/* In case of a partial match, the vstrs instruction returns the index
|
||||||
|
of the partial match in a vector-register. Then we have to
|
102
SOURCES/glibc-upstream-2.34-47.patch
Normal file
102
SOURCES/glibc-upstream-2.34-47.patch
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
commit bfe68fe3c475fe34bed4e017d6e63196c305c934
|
||||||
|
Author: Florian Weimer <fweimer@redhat.com>
|
||||||
|
Date: Wed Nov 24 08:59:54 2021 +0100
|
||||||
|
|
||||||
|
nptl: Do not set signal mask on second setjmp return [BZ #28607]
|
||||||
|
|
||||||
|
__libc_signal_restore_set was in the wrong place: It also ran
|
||||||
|
when setjmp returned the second time (after pthread_exit or
|
||||||
|
pthread_cancel). This is observable with blocked pending
|
||||||
|
signals during thread exit.
|
||||||
|
|
||||||
|
Fixes commit b3cae39dcbfa2432b3f3aa28854d8ac57f0de1b8
|
||||||
|
("nptl: Start new threads with all signals blocked [BZ #25098]").
|
||||||
|
|
||||||
|
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
(cherry picked from commit e186fc5a31e46f2cbf5ea1a75223b4412907f3d8)
|
||||||
|
|
||||||
|
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
|
||||||
|
index bc213f0bc4e948bd..3db0c9fdf40ae2bf 100644
|
||||||
|
--- a/nptl/pthread_create.c
|
||||||
|
+++ b/nptl/pthread_create.c
|
||||||
|
@@ -407,8 +407,6 @@ start_thread (void *arg)
|
||||||
|
unwind_buf.priv.data.prev = NULL;
|
||||||
|
unwind_buf.priv.data.cleanup = NULL;
|
||||||
|
|
||||||
|
- __libc_signal_restore_set (&pd->sigmask);
|
||||||
|
-
|
||||||
|
/* Allow setxid from now onwards. */
|
||||||
|
if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2))
|
||||||
|
futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE);
|
||||||
|
@@ -418,6 +416,8 @@ start_thread (void *arg)
|
||||||
|
/* Store the new cleanup handler info. */
|
||||||
|
THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf);
|
||||||
|
|
||||||
|
+ __libc_signal_restore_set (&pd->sigmask);
|
||||||
|
+
|
||||||
|
LIBC_PROBE (pthread_start, 3, (pthread_t) pd, pd->start_routine, pd->arg);
|
||||||
|
|
||||||
|
/* Run the code the user provided. */
|
||||||
|
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
|
||||||
|
index df8943f4860a39d8..c65710169697ad95 100644
|
||||||
|
--- a/sysdeps/pthread/Makefile
|
||||||
|
+++ b/sysdeps/pthread/Makefile
|
||||||
|
@@ -118,6 +118,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
|
||||||
|
tst-unload \
|
||||||
|
tst-unwind-thread \
|
||||||
|
tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
|
||||||
|
+ tst-pthread-exit-signal \
|
||||||
|
tst-pthread-setuid-loop \
|
||||||
|
tst-pthread_cancel-exited \
|
||||||
|
tst-pthread_cancel-select-loop \
|
||||||
|
diff --git a/sysdeps/pthread/tst-pthread-exit-signal.c b/sysdeps/pthread/tst-pthread-exit-signal.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..b4526fe663671068
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sysdeps/pthread/tst-pthread-exit-signal.c
|
||||||
|
@@ -0,0 +1,45 @@
|
||||||
|
+/* Test that pending signals are not delivered on thread exit (bug 28607).
|
||||||
|
+ Copyright (C) 2021 Free Software Foundation, Inc.
|
||||||
|
+ This file is part of the GNU C Library.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
+ modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ License as published by the Free Software Foundation; either
|
||||||
|
+ version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ License along with the GNU C Library; if not, see
|
||||||
|
+ <https://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+/* Due to bug 28607, pthread_kill (or pthread_cancel) restored the
|
||||||
|
+ signal mask during during thread exit, triggering the delivery of a
|
||||||
|
+ blocked pending signal (SIGUSR1 in this test). */
|
||||||
|
+
|
||||||
|
+#include <support/xthread.h>
|
||||||
|
+#include <support/xsignal.h>
|
||||||
|
+
|
||||||
|
+static void *
|
||||||
|
+threadfunc (void *closure)
|
||||||
|
+{
|
||||||
|
+ sigset_t sigmask;
|
||||||
|
+ sigfillset (&sigmask);
|
||||||
|
+ xpthread_sigmask (SIG_SETMASK, &sigmask, NULL);
|
||||||
|
+ xpthread_kill (pthread_self (), SIGUSR1);
|
||||||
|
+ pthread_exit (NULL);
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+do_test (void)
|
||||||
|
+{
|
||||||
|
+ pthread_t thr = xpthread_create (NULL, threadfunc, NULL);
|
||||||
|
+ xpthread_join (thr);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#include <support/test-driver.c>
|
97
SOURCES/glibc-upstream-2.34-48.patch
Normal file
97
SOURCES/glibc-upstream-2.34-48.patch
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
commit f988b7f228851370d1faa1e8f28d02f4b4e6dc46
|
||||||
|
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
Date: Thu Nov 25 09:12:00 2021 -0300
|
||||||
|
|
||||||
|
linux: Use /proc/stat fallback for __get_nprocs_conf (BZ #28624)
|
||||||
|
|
||||||
|
The /proc/statm fallback was removed by f13fb81ad3159 if sysfs is
|
||||||
|
not available, reinstate it.
|
||||||
|
|
||||||
|
Checked on x86_64-linux-gnu.
|
||||||
|
(cherry-picked from commit 137ed5ac440a4d3cf4178ce97f349b349a9c2c66)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
|
||||||
|
index d70ed9586950615c..7fc6521942e87293 100644
|
||||||
|
--- a/sysdeps/unix/sysv/linux/getsysstats.c
|
||||||
|
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
|
||||||
|
@@ -108,6 +108,37 @@ next_line (int fd, char *const buffer, char **cp, char **re,
|
||||||
|
return res == *re ? NULL : res;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int
|
||||||
|
+get_nproc_stat (char *buffer, size_t buffer_size)
|
||||||
|
+{
|
||||||
|
+ char *buffer_end = buffer + buffer_size;
|
||||||
|
+ char *cp = buffer_end;
|
||||||
|
+ char *re = buffer_end;
|
||||||
|
+
|
||||||
|
+ /* Default to an SMP system in case we cannot obtain an accurate
|
||||||
|
+ number. */
|
||||||
|
+ int result = 2;
|
||||||
|
+
|
||||||
|
+ const int flags = O_RDONLY | O_CLOEXEC;
|
||||||
|
+ int fd = __open_nocancel ("/proc/stat", flags);
|
||||||
|
+ if (fd != -1)
|
||||||
|
+ {
|
||||||
|
+ result = 0;
|
||||||
|
+
|
||||||
|
+ char *l;
|
||||||
|
+ while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
|
||||||
|
+ /* The current format of /proc/stat has all the cpu* entries
|
||||||
|
+ at the front. We assume here that stays this way. */
|
||||||
|
+ if (strncmp (l, "cpu", 3) != 0)
|
||||||
|
+ break;
|
||||||
|
+ else if (isdigit (l[3]))
|
||||||
|
+ ++result;
|
||||||
|
+
|
||||||
|
+ __close_nocancel_nostatus (fd);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return result;
|
||||||
|
+}
|
||||||
|
|
||||||
|
int
|
||||||
|
__get_nprocs (void)
|
||||||
|
@@ -163,30 +194,7 @@ __get_nprocs (void)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
- cp = buffer_end;
|
||||||
|
- re = buffer_end;
|
||||||
|
-
|
||||||
|
- /* Default to an SMP system in case we cannot obtain an accurate
|
||||||
|
- number. */
|
||||||
|
- result = 2;
|
||||||
|
-
|
||||||
|
- fd = __open_nocancel ("/proc/stat", flags);
|
||||||
|
- if (fd != -1)
|
||||||
|
- {
|
||||||
|
- result = 0;
|
||||||
|
-
|
||||||
|
- while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
|
||||||
|
- /* The current format of /proc/stat has all the cpu* entries
|
||||||
|
- at the front. We assume here that stays this way. */
|
||||||
|
- if (strncmp (l, "cpu", 3) != 0)
|
||||||
|
- break;
|
||||||
|
- else if (isdigit (l[3]))
|
||||||
|
- ++result;
|
||||||
|
-
|
||||||
|
- __close_nocancel_nostatus (fd);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return result;
|
||||||
|
+ return get_nproc_stat (buffer, buffer_size);
|
||||||
|
}
|
||||||
|
libc_hidden_def (__get_nprocs)
|
||||||
|
weak_alias (__get_nprocs, get_nprocs)
|
||||||
|
@@ -220,7 +228,9 @@ __get_nprocs_conf (void)
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return 1;
|
||||||
|
+ enum { buffer_size = 1024 };
|
||||||
|
+ char buffer[buffer_size];
|
||||||
|
+ return get_nproc_stat (buffer, buffer_size);
|
||||||
|
}
|
||||||
|
libc_hidden_def (__get_nprocs_conf)
|
||||||
|
weak_alias (__get_nprocs_conf, get_nprocs_conf)
|
101
SOURCES/glibc-upstream-2.34-49.patch
Normal file
101
SOURCES/glibc-upstream-2.34-49.patch
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
commit 387bff63dc2dccd62b09aa26dccf8cdc5f3c985c
|
||||||
|
Author: Matheus Castanho <msc@linux.ibm.com>
|
||||||
|
Date: Tue Oct 26 10:44:59 2021 -0300
|
||||||
|
|
||||||
|
powerpc64[le]: Fix CFI and LR save address for asm syscalls [BZ #28532]
|
||||||
|
|
||||||
|
Syscalls based on the assembly templates are missing CFI for r31, which gets
|
||||||
|
clobbered when scv is used, and info for LR is inaccurate, placed in the wrong
|
||||||
|
LOC and not using the proper offset. LR was also being saved to the callee's
|
||||||
|
frame, while the ABI mandates it to be saved to the caller's frame. These are
|
||||||
|
fixed by this commit.
|
||||||
|
|
||||||
|
After this change:
|
||||||
|
|
||||||
|
$ readelf -wF libc.so.6 | grep 0004b9d4.. -A 7 && objdump --disassemble=kill libc.so.6
|
||||||
|
00004a48 0000000000000020 00004a4c FDE cie=00000000 pc=000000000004b9d4..000000000004ba3c
|
||||||
|
LOC CFA r31 ra
|
||||||
|
000000000004b9d4 r1+0 u u
|
||||||
|
000000000004b9e4 r1+48 u u
|
||||||
|
000000000004b9e8 r1+48 c-16 u
|
||||||
|
000000000004b9fc r1+48 c-16 c+16
|
||||||
|
000000000004ba08 r1+48 c-16
|
||||||
|
000000000004ba18 r1+48 u
|
||||||
|
000000000004ba1c r1+0 u
|
||||||
|
|
||||||
|
libc.so.6: file format elf64-powerpcle
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
000000000004b9d4 <kill>:
|
||||||
|
4b9d4: 1f 00 4c 3c addis r2,r12,31
|
||||||
|
4b9d8: 2c c3 42 38 addi r2,r2,-15572
|
||||||
|
4b9dc: 25 00 00 38 li r0,37
|
||||||
|
4b9e0: d1 ff 21 f8 stdu r1,-48(r1)
|
||||||
|
4b9e4: 20 00 e1 fb std r31,32(r1)
|
||||||
|
4b9e8: 98 8f ed eb ld r31,-28776(r13)
|
||||||
|
4b9ec: 10 00 ff 77 andis. r31,r31,16
|
||||||
|
4b9f0: 1c 00 82 41 beq 4ba0c <kill+0x38>
|
||||||
|
4b9f4: a6 02 28 7d mflr r9
|
||||||
|
4b9f8: 40 00 21 f9 std r9,64(r1)
|
||||||
|
4b9fc: 01 00 00 44 scv 0
|
||||||
|
4ba00: 40 00 21 e9 ld r9,64(r1)
|
||||||
|
4ba04: a6 03 28 7d mtlr r9
|
||||||
|
4ba08: 08 00 00 48 b 4ba10 <kill+0x3c>
|
||||||
|
4ba0c: 02 00 00 44 sc
|
||||||
|
4ba10: 00 00 bf 2e cmpdi cr5,r31,0
|
||||||
|
4ba14: 20 00 e1 eb ld r31,32(r1)
|
||||||
|
4ba18: 30 00 21 38 addi r1,r1,48
|
||||||
|
4ba1c: 18 00 96 41 beq cr5,4ba34 <kill+0x60>
|
||||||
|
4ba20: 01 f0 20 39 li r9,-4095
|
||||||
|
4ba24: 40 48 23 7c cmpld r3,r9
|
||||||
|
4ba28: 20 00 e0 4d bltlr+
|
||||||
|
4ba2c: d0 00 63 7c neg r3,r3
|
||||||
|
4ba30: 08 00 00 48 b 4ba38 <kill+0x64>
|
||||||
|
4ba34: 20 00 e3 4c bnslr+
|
||||||
|
4ba38: c8 32 fe 4b b 2ed00 <__syscall_error>
|
||||||
|
...
|
||||||
|
4ba44: 40 20 0c 00 .long 0xc2040
|
||||||
|
4ba48: 68 00 00 00 .long 0x68
|
||||||
|
4ba4c: 06 00 5f 5f rlwnm r31,r26,r0,0,3
|
||||||
|
4ba50: 6b 69 6c 6c xoris r12,r3,26987
|
||||||
|
|
||||||
|
(cherry picked from commit d120fb9941be1fb1934f0b50c6ad64e4c5e404fb)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h
|
||||||
|
index 589f7c8d18814ee9..cfcfa69f91f1773d 100644
|
||||||
|
--- a/sysdeps/powerpc/powerpc64/sysdep.h
|
||||||
|
+++ b/sysdeps/powerpc/powerpc64/sysdep.h
|
||||||
|
@@ -275,12 +275,14 @@ LT_LABELSUFFIX(name,_name_end): ; \
|
||||||
|
/* Allocate frame and save register */
|
||||||
|
#define NVOLREG_SAVE \
|
||||||
|
stdu r1,-SCV_FRAME_SIZE(r1); \
|
||||||
|
+ cfi_adjust_cfa_offset(SCV_FRAME_SIZE); \
|
||||||
|
std r31,SCV_FRAME_NVOLREG_SAVE(r1); \
|
||||||
|
- cfi_adjust_cfa_offset(SCV_FRAME_SIZE);
|
||||||
|
+ cfi_rel_offset(r31,SCV_FRAME_NVOLREG_SAVE);
|
||||||
|
|
||||||
|
/* Restore register and destroy frame */
|
||||||
|
#define NVOLREG_RESTORE \
|
||||||
|
ld r31,SCV_FRAME_NVOLREG_SAVE(r1); \
|
||||||
|
+ cfi_restore(r31); \
|
||||||
|
addi r1,r1,SCV_FRAME_SIZE; \
|
||||||
|
cfi_adjust_cfa_offset(-SCV_FRAME_SIZE);
|
||||||
|
|
||||||
|
@@ -331,13 +333,13 @@ LT_LABELSUFFIX(name,_name_end): ; \
|
||||||
|
|
||||||
|
#define DO_CALL_SCV \
|
||||||
|
mflr r9; \
|
||||||
|
- std r9,FRAME_LR_SAVE(r1); \
|
||||||
|
- cfi_offset(lr,FRAME_LR_SAVE); \
|
||||||
|
+ std r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \
|
||||||
|
+ cfi_rel_offset(lr,SCV_FRAME_SIZE+FRAME_LR_SAVE); \
|
||||||
|
.machine "push"; \
|
||||||
|
.machine "power9"; \
|
||||||
|
scv 0; \
|
||||||
|
.machine "pop"; \
|
||||||
|
- ld r9,FRAME_LR_SAVE(r1); \
|
||||||
|
+ ld r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \
|
||||||
|
mtlr r9; \
|
||||||
|
cfi_restore(lr);
|
||||||
|
|
63
SOURCES/glibc-upstream-2.34-50.patch
Normal file
63
SOURCES/glibc-upstream-2.34-50.patch
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
commit e9f81c261a2ca74d31d07ff9c8e780ac8a25993c
|
||||||
|
Author: Florian Weimer <fweimer@redhat.com>
|
||||||
|
Date: Fri Dec 10 05:14:24 2021 +0100
|
||||||
|
|
||||||
|
nptl: Add one more barrier to nptl/tst-create1
|
||||||
|
|
||||||
|
Without the bar_ctor_finish barrier, it was possible that thread2
|
||||||
|
re-locked user_lock before ctor had a chance to lock it. ctor then
|
||||||
|
blocked in its locking operation, xdlopen from the main thread
|
||||||
|
did not return, and thread2 was stuck waiting in bar_dtor:
|
||||||
|
|
||||||
|
thread 1: started.
|
||||||
|
thread 2: started.
|
||||||
|
thread 2: locked user_lock.
|
||||||
|
constructor started: 0.
|
||||||
|
thread 1: in ctor: started.
|
||||||
|
thread 3: started.
|
||||||
|
thread 3: done.
|
||||||
|
thread 2: unlocked user_lock.
|
||||||
|
thread 2: locked user_lock.
|
||||||
|
|
||||||
|
Fixes the test in commit 83b5323261bb72313bffcf37476c1b8f0847c736
|
||||||
|
("elf: Avoid deadlock between pthread_create and ctors [BZ #28357]").
|
||||||
|
|
||||||
|
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
|
||||||
|
(cherry picked from commit 5cc338565479a620244c2f8ff35956629c4dbf81)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/pthread/tst-create1.c b/sysdeps/pthread/tst-create1.c
|
||||||
|
index 932586c30990d1d4..763ded8d7956f943 100644
|
||||||
|
--- a/sysdeps/pthread/tst-create1.c
|
||||||
|
+++ b/sysdeps/pthread/tst-create1.c
|
||||||
|
@@ -33,6 +33,7 @@ thread 2: lock(user_lock) -> pthread_create
|
||||||
|
*/
|
||||||
|
|
||||||
|
static pthread_barrier_t bar_ctor;
|
||||||
|
+static pthread_barrier_t bar_ctor_finish;
|
||||||
|
static pthread_barrier_t bar_dtor;
|
||||||
|
static pthread_mutex_t user_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
|
@@ -46,6 +47,7 @@ ctor (void)
|
||||||
|
xpthread_mutex_unlock (&user_lock);
|
||||||
|
dprintf (1, "thread 1: in ctor: unlocked user_lock.\n");
|
||||||
|
dprintf (1, "thread 1: in ctor: done.\n");
|
||||||
|
+ xpthread_barrier_wait (&bar_ctor_finish);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -81,6 +83,7 @@ thread2 (void *a)
|
||||||
|
xpthread_mutex_unlock (&user_lock);
|
||||||
|
dprintf (1, "thread 2: unlocked user_lock.\n");
|
||||||
|
xpthread_join (t3);
|
||||||
|
+ xpthread_barrier_wait (&bar_ctor_finish);
|
||||||
|
|
||||||
|
xpthread_mutex_lock (&user_lock);
|
||||||
|
dprintf (1, "thread 2: locked user_lock.\n");
|
||||||
|
@@ -99,6 +102,7 @@ thread1 (void)
|
||||||
|
{
|
||||||
|
dprintf (1, "thread 1: started.\n");
|
||||||
|
xpthread_barrier_init (&bar_ctor, NULL, 2);
|
||||||
|
+ xpthread_barrier_init (&bar_ctor_finish, NULL, 2);
|
||||||
|
xpthread_barrier_init (&bar_dtor, NULL, 2);
|
||||||
|
pthread_t t2 = xpthread_create (0, thread2, 0);
|
||||||
|
void *p = xdlopen ("tst-create1mod.so", RTLD_NOW | RTLD_GLOBAL);
|
191
SOURCES/glibc-upstream-2.34-51.patch
Normal file
191
SOURCES/glibc-upstream-2.34-51.patch
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
commit 0dcbf4c8705309af8c8c1620491c60539901a3b0
|
||||||
|
Author: Joseph Myers <joseph@codesourcery.com>
|
||||||
|
Date: Fri Sep 17 13:12:10 2021 +0000
|
||||||
|
|
||||||
|
Run conform/ tests using newly built libc
|
||||||
|
|
||||||
|
Although the conform/ header tests are built using the headers of the
|
||||||
|
glibc under test, the execution tests from conformtest (a few tests of
|
||||||
|
the values of macros evaluating to string constants) are linked and
|
||||||
|
run with system libc, not the newly built libc.
|
||||||
|
|
||||||
|
Apart from preventing testing in cross environments, this can be a
|
||||||
|
problem even for native testing. Specifically, it can be useful to do
|
||||||
|
native testing when building with a cross compiler that links with a
|
||||||
|
libc that is not the system libc; for example, on x86_64, you can test
|
||||||
|
all three ABIs that way if the kernel support is present, even if the
|
||||||
|
host OS lacks 32-bit or x32 libraries or they are older than the
|
||||||
|
libraries in the sysroot used by the compiler used to build glibc.
|
||||||
|
This works for almost all tests, but not for these conformtest tests.
|
||||||
|
|
||||||
|
Arrange for conformtest to link and run test programs similarly to
|
||||||
|
other tests, with consequent refactoring of various variables in
|
||||||
|
Makeconfig to allow passing relevant parts of the link-time command
|
||||||
|
lines down to conformtest. In general, the parts of the link command
|
||||||
|
involving $@ or $^ are separated out from the parts that should be
|
||||||
|
passed to conformtest (the variables passed to conformtest still
|
||||||
|
involve various variables whose names involve $(@F), but those
|
||||||
|
variables simply won't be defined for the conformtest makefile rules
|
||||||
|
and I think their presence there is harmless).
|
||||||
|
|
||||||
|
This is also most of the support that would be needed to allow running
|
||||||
|
those tests of string constants for cross testing when test-wrapper is
|
||||||
|
defined. That will also need changes to where conformtest.py puts the
|
||||||
|
test executables, so it puts them in the main object directory
|
||||||
|
(expected to be shared with a test system in cross testing) rather
|
||||||
|
than /tmp (not expected to be shared) as at present.
|
||||||
|
|
||||||
|
Tested for x86_64.
|
||||||
|
|
||||||
|
(cherry picked from commit f3eef963902d0f54f68cffc74f79b97f4d6154b7)
|
||||||
|
|
||||||
|
diff --git a/Makeconfig b/Makeconfig
|
||||||
|
index 68663d984e6a1264..2fa0884b4eee5e53 100644
|
||||||
|
--- a/Makeconfig
|
||||||
|
+++ b/Makeconfig
|
||||||
|
@@ -412,12 +412,13 @@ link-extra-libs-tests = $(libsupport)
|
||||||
|
|
||||||
|
# Command for linking PIE programs with the C library.
|
||||||
|
ifndef +link-pie
|
||||||
|
-+link-pie-before-libc = $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
|
||||||
|
- -Wl,-O1 -nostdlib -nostartfiles -o $@ \
|
||||||
|
++link-pie-before-inputs = $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \
|
||||||
|
+ -Wl,-O1 -nostdlib -nostartfiles \
|
||||||
|
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
||||||
|
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
|
||||||
|
$(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \
|
||||||
|
- $(+preinit) $(+prectorS) \
|
||||||
|
+ $(+preinit) $(+prectorS)
|
||||||
|
++link-pie-before-libc = -o $@ $(+link-pie-before-inputs) \
|
||||||
|
$(filter-out $(addprefix $(csu-objpfx),start.o \
|
||||||
|
S$(start-installed-name))\
|
||||||
|
$(+preinit) $(link-extra-libs) \
|
||||||
|
@@ -442,11 +443,12 @@ endef
|
||||||
|
endif
|
||||||
|
# Command for statically linking programs with the C library.
|
||||||
|
ifndef +link-static
|
||||||
|
-+link-static-before-libc = -nostdlib -nostartfiles -static -o $@ \
|
||||||
|
++link-static-before-inputs = -nostdlib -nostartfiles -static \
|
||||||
|
$(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)) \
|
||||||
|
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
||||||
|
$(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \
|
||||||
|
- $(+preinit) $(+prectorT) \
|
||||||
|
+ $(+preinit) $(+prectorT)
|
||||||
|
++link-static-before-libc = -o $@ $(+link-static-before-inputs) \
|
||||||
|
$(filter-out $(addprefix $(csu-objpfx),start.o \
|
||||||
|
$(start-installed-name))\
|
||||||
|
$(+preinit) $(link-extra-libs-static) \
|
||||||
|
@@ -473,13 +475,16 @@ endif
|
||||||
|
ifeq (yes,$(build-pie-default))
|
||||||
|
+link = $(+link-pie)
|
||||||
|
+link-tests = $(+link-pie-tests)
|
||||||
|
++link-tests-before-inputs = $(+link-pie-before-inputs) $(rtld-tests-LDFLAGS)
|
||||||
|
++link-tests-after-inputs = $(link-libc-tests) $(+link-pie-after-libc)
|
||||||
|
+link-printers-tests = $(+link-pie-printers-tests)
|
||||||
|
else # not build-pie-default
|
||||||
|
-+link-before-libc = -nostdlib -nostartfiles -o $@ \
|
||||||
|
++link-before-inputs = -nostdlib -nostartfiles \
|
||||||
|
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
||||||
|
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
|
||||||
|
$(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \
|
||||||
|
- $(+preinit) $(+prector) \
|
||||||
|
+ $(+preinit) $(+prector)
|
||||||
|
++link-before-libc = -o $@ $(+link-before-inputs) \
|
||||||
|
$(filter-out $(addprefix $(csu-objpfx),start.o \
|
||||||
|
$(start-installed-name))\
|
||||||
|
$(+preinit) $(link-extra-libs) \
|
||||||
|
@@ -491,6 +496,8 @@ $(CC) $(link-libc-rpath-link) $(+link-before-libc) $(rtld-LDFLAGS) \
|
||||||
|
$(link-extra-flags) $(link-libc) $(+link-after-libc)
|
||||||
|
$(call after-link,$@)
|
||||||
|
endef
|
||||||
|
++link-tests-before-inputs = $(+link-before-inputs) $(rtld-tests-LDFLAGS)
|
||||||
|
++link-tests-after-inputs = $(link-libc-tests) $(+link-after-libc)
|
||||||
|
define +link-tests
|
||||||
|
$(CC) $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
|
||||||
|
$(+link-after-libc)
|
||||||
|
@@ -505,6 +512,8 @@ endif # build-pie-default
|
||||||
|
else # build-static
|
||||||
|
+link = $(+link-static)
|
||||||
|
+link-tests = $(+link-static-tests)
|
||||||
|
++link-tests-before-inputs = $(+link-static-before-inputs)
|
||||||
|
++link-tests-after-inputs = $(link-libc-static-tests) $(+link-static-after-libc)
|
||||||
|
+link-printers-tests = $(+link-static-tests)
|
||||||
|
endif # build-shared
|
||||||
|
endif # +link
|
||||||
|
diff --git a/conform/Makefile b/conform/Makefile
|
||||||
|
index c64a83a905b991cc..296db818f0a72253 100644
|
||||||
|
--- a/conform/Makefile
|
||||||
|
+++ b/conform/Makefile
|
||||||
|
@@ -176,6 +176,9 @@ $(conformtest-header-tests): $(objpfx)%/conform.out: \
|
||||||
|
(set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \
|
||||||
|
mkdir -p $(@D); \
|
||||||
|
$(PYTHON) $< --cc='$(CC)' --flags='$(conformtest-cc-flags)' \
|
||||||
|
+ --ldflags='$(+link-tests-before-inputs)' \
|
||||||
|
+ --libs='$(+link-tests-after-inputs)' \
|
||||||
|
+ --run-program-prefix='$(run-program-prefix)' \
|
||||||
|
--standard=$$std --header=$$hdr $(conformtest-xfail) \
|
||||||
|
$(conformtest-cross) \
|
||||||
|
> $@ 2>&1); \
|
||||||
|
diff --git a/conform/conformtest.py b/conform/conformtest.py
|
||||||
|
index f0405b71869831f9..4898e16c9fb96503 100644
|
||||||
|
--- a/conform/conformtest.py
|
||||||
|
+++ b/conform/conformtest.py
|
||||||
|
@@ -381,12 +381,16 @@ class MacroStrTest(object):
|
||||||
|
class HeaderTests(object):
|
||||||
|
"""The set of tests run for a header."""
|
||||||
|
|
||||||
|
- def __init__(self, header, standard, cc, flags, cross, xfail):
|
||||||
|
+ def __init__(self, header, standard, cc, flags, ldflags, libs,
|
||||||
|
+ run_program_prefix, cross, xfail):
|
||||||
|
"""Initialize a HeaderTests object."""
|
||||||
|
self.header = header
|
||||||
|
self.standard = standard
|
||||||
|
self.cc = cc
|
||||||
|
self.flags = flags
|
||||||
|
+ self.ldflags = ldflags
|
||||||
|
+ self.libs = libs
|
||||||
|
+ self.run_program_prefix = run_program_prefix
|
||||||
|
self.cross = cross
|
||||||
|
self.xfail_str = xfail
|
||||||
|
self.cflags_namespace = ('%s -fno-builtin %s -D_ISOMAC'
|
||||||
|
@@ -590,7 +594,8 @@ class HeaderTests(object):
|
||||||
|
exe_file = os.path.join(self.temp_dir, 'test')
|
||||||
|
with open(c_file, 'w') as c_file_out:
|
||||||
|
c_file_out.write('#include <%s>\n%s' % (self.header, text))
|
||||||
|
- cmd = ('%s %s %s -o %s' % (self.cc, self.cflags, c_file, exe_file))
|
||||||
|
+ cmd = ('%s %s %s %s %s -o %s' % (self.cc, self.cflags, self.ldflags,
|
||||||
|
+ c_file, self.libs, exe_file))
|
||||||
|
try:
|
||||||
|
subprocess.check_call(cmd, shell=True)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
@@ -600,7 +605,9 @@ class HeaderTests(object):
|
||||||
|
self.note_skip(name)
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
- subprocess.check_call(exe_file, shell=True)
|
||||||
|
+ subprocess.check_call('%s %s' % (self.run_program_prefix,
|
||||||
|
+ exe_file),
|
||||||
|
+ shell=True)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
self.note_error(name, self.group_xfail)
|
||||||
|
return
|
||||||
|
@@ -719,12 +726,19 @@ def main():
|
||||||
|
help='C compiler to use')
|
||||||
|
parser.add_argument('--flags', metavar='CFLAGS',
|
||||||
|
help='Compiler flags to use with CC')
|
||||||
|
+ parser.add_argument('--ldflags', metavar='LDFLAGS',
|
||||||
|
+ help='Compiler arguments for linking before inputs')
|
||||||
|
+ parser.add_argument('--libs', metavar='LIBS',
|
||||||
|
+ help='Compiler arguments for linking after inputs')
|
||||||
|
+ parser.add_argument('--run-program-prefix', metavar='RUN-PROGRAM-PREFIX',
|
||||||
|
+ help='Wrapper for running newly built program')
|
||||||
|
parser.add_argument('--cross', action='store_true',
|
||||||
|
help='Do not run compiled test programs')
|
||||||
|
parser.add_argument('--xfail', metavar='COND',
|
||||||
|
help='Name of condition for XFAILs')
|
||||||
|
args = parser.parse_args()
|
||||||
|
tests = HeaderTests(args.header, args.standard, args.cc, args.flags,
|
||||||
|
+ args.ldflags, args.libs, args.run_program_prefix,
|
||||||
|
args.cross, args.xfail)
|
||||||
|
tests.run()
|
||||||
|
|
37
SOURCES/glibc-upstream-2.34-52.patch
Normal file
37
SOURCES/glibc-upstream-2.34-52.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
commit 1fe4b8d6937139faa47410552d4e21b356810d67
|
||||||
|
Author: Joseph Myers <joseph@codesourcery.com>
|
||||||
|
Date: Fri Sep 17 19:24:14 2021 +0000
|
||||||
|
|
||||||
|
Use $(pie-default) with conformtest
|
||||||
|
|
||||||
|
My glibc bot showed that my conformtest changes fail the build of the
|
||||||
|
conformtest execution tests for x86_64-linux-gnu-static-pie, because
|
||||||
|
linking the newly built object with the newly built libc and the
|
||||||
|
associated options normally used for linking requires it to be built
|
||||||
|
as PIE. Add $(pie-default) to the compiler command used so that PIE
|
||||||
|
options are used when required.
|
||||||
|
|
||||||
|
There's a case for using the whole of $(CFLAGS-.o) (which includes
|
||||||
|
$(pie-default)), but that raises questions of any impact from using
|
||||||
|
optimization flags from CFLAGS in these tests. So for now just use
|
||||||
|
$(pie-default) as the key part of $(CFLAGS-.o) that's definitely
|
||||||
|
needed.
|
||||||
|
|
||||||
|
Tested with build-many-glibcs.py for x86_64-linux-gnu-static-pie.
|
||||||
|
|
||||||
|
(cherry picked from commit 885762aa31d75de8b9fea4c0e2e372b582d4c548)
|
||||||
|
|
||||||
|
diff --git a/conform/Makefile b/conform/Makefile
|
||||||
|
index 296db818f0a72253..27ad98caf866879f 100644
|
||||||
|
--- a/conform/Makefile
|
||||||
|
+++ b/conform/Makefile
|
||||||
|
@@ -175,7 +175,8 @@ $(conformtest-header-tests): $(objpfx)%/conform.out: \
|
||||||
|
conformtest.py $(conformtest-headers-data)
|
||||||
|
(set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \
|
||||||
|
mkdir -p $(@D); \
|
||||||
|
- $(PYTHON) $< --cc='$(CC)' --flags='$(conformtest-cc-flags)' \
|
||||||
|
+ $(PYTHON) $< --cc='$(CC) $(pie-default)' \
|
||||||
|
+ --flags='$(conformtest-cc-flags)' \
|
||||||
|
--ldflags='$(+link-tests-before-inputs)' \
|
||||||
|
--libs='$(+link-tests-after-inputs)' \
|
||||||
|
--run-program-prefix='$(run-program-prefix)' \
|
37
SOURCES/glibc-upstream-2.34-53.patch
Normal file
37
SOURCES/glibc-upstream-2.34-53.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
commit 06865865151579d1aa17d38110060a68b85c5d90
|
||||||
|
Author: Stafford Horne <shorne@gmail.com>
|
||||||
|
Date: Sat Sep 25 17:02:06 2021 +0900
|
||||||
|
|
||||||
|
pthread/tst-cancel28: Fix barrier re-init race condition
|
||||||
|
|
||||||
|
When running this test on the OpenRISC port I am working on this test
|
||||||
|
fails with a timeout. The test passes when being straced or debugged.
|
||||||
|
Looking at the code there seems to be a race condition in that:
|
||||||
|
|
||||||
|
1 main thread: calls xpthread_cancel
|
||||||
|
2 sub thread : receives cancel signal
|
||||||
|
3 sub thread : cleanup routine waits on barrier
|
||||||
|
4 main thread: re-inits barrier
|
||||||
|
5 main thread: waits on barrier
|
||||||
|
|
||||||
|
After getting to 5 the main thread and sub thread wait forever as the 2
|
||||||
|
barriers are no longer the same.
|
||||||
|
|
||||||
|
Removing the barrier re-init seems to fix this issue. Also, the barrier
|
||||||
|
does not need to be reinitialized as that is done by default.
|
||||||
|
|
||||||
|
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
(cherry picked from commit 9874ca536b1d0662b1cea46af3ce09a4d42aeb32)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/pthread/tst-cancel28.c b/sysdeps/pthread/tst-cancel28.c
|
||||||
|
index 627cbc8160191c5c..9286c159b3be5e8a 100644
|
||||||
|
--- a/sysdeps/pthread/tst-cancel28.c
|
||||||
|
+++ b/sysdeps/pthread/tst-cancel28.c
|
||||||
|
@@ -69,7 +69,6 @@ do_test (void)
|
||||||
|
|
||||||
|
xpthread_cancel (timer_thread);
|
||||||
|
|
||||||
|
- xpthread_barrier_init (&barrier, NULL, 2);
|
||||||
|
xpthread_barrier_wait (&barrier);
|
||||||
|
|
||||||
|
return 0;
|
@ -69,9 +69,6 @@
|
|||||||
%undefine with_valgrind
|
%undefine with_valgrind
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# Only some architectures have static PIE support.
|
|
||||||
%define pie_arches %{ix86} x86_64
|
|
||||||
|
|
||||||
# The annobin annotations cause binutils to produce broken ARM EABI
|
# The annobin annotations cause binutils to produce broken ARM EABI
|
||||||
# unwinding information. Symptom is a hang/test failure for
|
# unwinding information. Symptom is a hang/test failure for
|
||||||
# malloc/tst-malloc-stats-cancellation. See
|
# malloc/tst-malloc-stats-cancellation. See
|
||||||
@ -151,7 +148,7 @@ end \
|
|||||||
Summary: The GNU libc libraries
|
Summary: The GNU libc libraries
|
||||||
Name: glibc
|
Name: glibc
|
||||||
Version: %{glibcversion}
|
Version: %{glibcversion}
|
||||||
Release: 8%{?dist}
|
Release: 16%{?dist}
|
||||||
|
|
||||||
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
|
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
|
||||||
# libraries.
|
# libraries.
|
||||||
@ -274,6 +271,22 @@ Patch71: glibc-upstream-2.34-40.patch
|
|||||||
Patch72: glibc-upstream-2.34-41.patch
|
Patch72: glibc-upstream-2.34-41.patch
|
||||||
Patch73: glibc-upstream-2.34-42.patch
|
Patch73: glibc-upstream-2.34-42.patch
|
||||||
Patch74: glibc-upstream-2.34-43.patch
|
Patch74: glibc-upstream-2.34-43.patch
|
||||||
|
Patch75: glibc-upstream-2.34-44.patch
|
||||||
|
Patch76: glibc-upstream-2.34-45.patch
|
||||||
|
Patch77: glibc-upstream-2.34-46.patch
|
||||||
|
Patch78: glibc-upstream-2.34-47.patch
|
||||||
|
Patch79: glibc-upstream-2.34-48.patch
|
||||||
|
Patch80: glibc-upstream-2.34-49.patch
|
||||||
|
Patch81: glibc-rh2027789.patch
|
||||||
|
Patch82: glibc-rh2023422-1.patch
|
||||||
|
Patch83: glibc-rh2023422-2.patch
|
||||||
|
Patch84: glibc-rh2023422-3.patch
|
||||||
|
Patch85: glibc-rh2029410.patch
|
||||||
|
Patch86: glibc-upstream-2.34-50.patch
|
||||||
|
Patch87: glibc-upstream-2.34-51.patch
|
||||||
|
Patch88: glibc-upstream-2.34-52.patch
|
||||||
|
Patch89: glibc-upstream-2.34-53.patch
|
||||||
|
Patch90: glibc-rh1988382.patch
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Continued list of core "glibc" package information:
|
# Continued list of core "glibc" package information:
|
||||||
@ -1233,9 +1246,6 @@ build()
|
|||||||
--enable-bind-now \
|
--enable-bind-now \
|
||||||
--build=%{target} \
|
--build=%{target} \
|
||||||
--enable-stack-protector=strong \
|
--enable-stack-protector=strong \
|
||||||
%ifarch %{pie_arches}
|
|
||||||
--enable-static-pie \
|
|
||||||
%endif
|
|
||||||
--enable-tunables \
|
--enable-tunables \
|
||||||
--enable-systemtap \
|
--enable-systemtap \
|
||||||
${core_with_options} \
|
${core_with_options} \
|
||||||
@ -2305,6 +2315,39 @@ fi
|
|||||||
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
|
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 14 2021 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.34-16
|
||||||
|
- Enable PIE by default on all architectures (#1988382)
|
||||||
|
|
||||||
|
* Tue Dec 14 2021 Florian Weimer <fweimer@redhat.com> - 2.34-15
|
||||||
|
- Sync with upstream branch release/2.34/master,
|
||||||
|
commit 06865865151579d1aa17d38110060a68b85c5d90:
|
||||||
|
- pthread/tst-cancel28: Fix barrier re-init race condition
|
||||||
|
- Use $(pie-default) with conformtest
|
||||||
|
- Run conform/ tests using newly built libc
|
||||||
|
- nptl: Add one more barrier to nptl/tst-create1
|
||||||
|
|
||||||
|
* Fri Dec 10 2021 Florian Weimer <fweimer@redhat.com> - 2.34-13
|
||||||
|
- x86-64: Remove LD_PREFER_MAP_32BIT_EXEC support (#2029410)
|
||||||
|
|
||||||
|
* Fri Dec 10 2021 Florian Weimer <fweimer@redhat.com> - 2.34-12
|
||||||
|
- Add /usr/bin/ld.so --list-diagnostics (#2023422)
|
||||||
|
|
||||||
|
* Tue Dec 7 2021 Florian Weimer <fweimer@redhat.com> - 2.34-11
|
||||||
|
- backtrace function crashes without vDSO on ppc64le (#2027789)
|
||||||
|
|
||||||
|
* Fri Dec 3 2021 Florian Weimer <fweimer@redhat.com> - 2.34-10
|
||||||
|
- Sync with upstream branch release/2.34/master,
|
||||||
|
commit 387bff63dc2dccd62b09aa26dccf8cdc5f3c985c:
|
||||||
|
- powerpc64[le]: Fix CFI and LR save address for asm syscalls [BZ #28532]
|
||||||
|
- linux: Use /proc/stat fallback for __get_nprocs_conf (BZ #28624)
|
||||||
|
- nptl: Do not set signal mask on second setjmp return [BZ #28607]
|
||||||
|
- s390: Use long branches across object boundaries (jgh instead of jh)
|
||||||
|
- elf: Earlier missing dynamic segment check in _dl_map_object_from_fd
|
||||||
|
- gconv: Do not emit spurious NUL character in ISO-2022-JP-3 (bug 28524)
|
||||||
|
|
||||||
|
* Tue Nov 16 2021 Arjun Shankar <arjun@redhat.com> - 2.34-9
|
||||||
|
- Create /{bin,lib,lib64,sbin} as symbolic links in test-container
|
||||||
|
|
||||||
* Wed Nov 3 2021 Florian Weimer <fweimer@redhat.com> - 2.34-8
|
* Wed Nov 3 2021 Florian Weimer <fweimer@redhat.com> - 2.34-8
|
||||||
- Sync with upstream branch release/2.34/master,
|
- Sync with upstream branch release/2.34/master,
|
||||||
commit 6548a9bdba95b3e1fcdbd85445342467e4b0cd4f:
|
commit 6548a9bdba95b3e1fcdbd85445342467e4b0cd4f:
|
||||||
|
Loading…
Reference in New Issue
Block a user