forked from rpms/glibc
Merged update from upstream sources
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/glibc.git#df07cd507e60fb1effac0d28d1bb0137235725ee
This commit is contained in:
parent
75c69240a7
commit
0bc968985e
179
glibc-upstream-2.33-11.patch
Normal file
179
glibc-upstream-2.33-11.patch
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
commit ee9f98d9cac12e843ca59c6e4d4b225f58a66727
|
||||||
|
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||||
|
Date: Tue Feb 2 13:45:58 2021 -0800
|
||||||
|
|
||||||
|
x86: Set minimum x86-64 level marker [BZ #27318]
|
||||||
|
|
||||||
|
Since the full ISA set used in an ELF binary is unknown to compiler,
|
||||||
|
an x86-64 ISA level marker indicates the minimum, not maximum, ISA set
|
||||||
|
required to run such an ELF binary. We never guarantee a library with
|
||||||
|
an x86-64 ISA level v3 marker doesn't contain other ISAs beyond x86-64
|
||||||
|
ISA level v3, like AVX VNNI. We check the x86-64 ISA level marker for
|
||||||
|
the minimum ISA set. Since -march=sandybridge enables only some ISAs
|
||||||
|
in x86-64 ISA level v3, we should set the needed ISA marker to v2.
|
||||||
|
Otherwise, libc is compiled with -march=sandybridge will fail to run on
|
||||||
|
Sandy Bridge:
|
||||||
|
|
||||||
|
$ ./elf/ld.so ./libc.so
|
||||||
|
./libc.so: (p) CPU ISA level is lower than required: needed: 7; got: 3
|
||||||
|
|
||||||
|
Set the minimum, instead of maximum, x86-64 ISA level marker should have
|
||||||
|
no impact on the glibc-hwcaps directory assignment logic in ldconfig nor
|
||||||
|
ld.so.
|
||||||
|
|
||||||
|
(cherry picked from commit 339bf918ea4830fb35614632e96f3aab3237adce)
|
||||||
|
|
||||||
|
diff --git a/config.h.in b/config.h.in
|
||||||
|
index 06ee8ae26a0eb833..f21bf04e4791e5dc 100644
|
||||||
|
--- a/config.h.in
|
||||||
|
+++ b/config.h.in
|
||||||
|
@@ -275,4 +275,10 @@
|
||||||
|
/* Define if x86 ISA level should be included in shared libraries. */
|
||||||
|
#undef INCLUDE_X86_ISA_LEVEL
|
||||||
|
|
||||||
|
+/* Define if -msahf is enabled by default on x86. */
|
||||||
|
+#undef HAVE_X86_LAHF_SAHF
|
||||||
|
+
|
||||||
|
+/* Define if -mmovbe is enabled by default on x86. */
|
||||||
|
+#undef HAVE_X86_MOVBE
|
||||||
|
+
|
||||||
|
#endif
|
||||||
|
diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
|
||||||
|
index 5e32dc62b334b27f..ead1295c38cf5f4e 100644
|
||||||
|
--- a/sysdeps/x86/configure
|
||||||
|
+++ b/sysdeps/x86/configure
|
||||||
|
@@ -126,6 +126,8 @@ cat > conftest2.S <<EOF
|
||||||
|
4:
|
||||||
|
EOF
|
||||||
|
libc_cv_include_x86_isa_level=no
|
||||||
|
+libc_cv_have_x86_lahf_sahf=no
|
||||||
|
+libc_cv_have_x86_movbe=no
|
||||||
|
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest conftest1.S conftest2.S'
|
||||||
|
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
@@ -135,6 +137,24 @@ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest c
|
||||||
|
count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l`
|
||||||
|
if test "$count" = 1; then
|
||||||
|
libc_cv_include_x86_isa_level=yes
|
||||||
|
+ cat > conftest.c <<EOF
|
||||||
|
+EOF
|
||||||
|
+ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c'
|
||||||
|
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
|
+ (eval $ac_try) 2>&5
|
||||||
|
+ ac_status=$?
|
||||||
|
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
+ test $ac_status = 0; }; } | grep -q "\-msahf"; then
|
||||||
|
+ libc_cv_have_x86_lahf_sahf=yes
|
||||||
|
+ fi
|
||||||
|
+ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c'
|
||||||
|
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
|
+ (eval $ac_try) 2>&5
|
||||||
|
+ ac_status=$?
|
||||||
|
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
+ test $ac_status = 0; }; } | grep -q "\-mmovbe"; then
|
||||||
|
+ libc_cv_have_x86_movbe=yes
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
@@ -144,6 +164,14 @@ $as_echo "$libc_cv_include_x86_isa_level" >&6; }
|
||||||
|
if test $libc_cv_include_x86_isa_level = yes; then
|
||||||
|
$as_echo "#define INCLUDE_X86_ISA_LEVEL 1" >>confdefs.h
|
||||||
|
|
||||||
|
+fi
|
||||||
|
+if test $libc_cv_have_x86_lahf_sahf = yes; then
|
||||||
|
+ $as_echo "#define HAVE_X86_LAHF_SAHF 1" >>confdefs.h
|
||||||
|
+
|
||||||
|
+fi
|
||||||
|
+if test $libc_cv_have_x86_movbe = yes; then
|
||||||
|
+ $as_echo "#define HAVE_X86_MOVBE 1" >>confdefs.h
|
||||||
|
+
|
||||||
|
fi
|
||||||
|
config_vars="$config_vars
|
||||||
|
enable-x86-isa-level = $libc_cv_include_x86_isa_level"
|
||||||
|
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
|
||||||
|
index f94088f377ec95ab..bca97fdc2f1ac1a7 100644
|
||||||
|
--- a/sysdeps/x86/configure.ac
|
||||||
|
+++ b/sysdeps/x86/configure.ac
|
||||||
|
@@ -98,14 +98,30 @@ cat > conftest2.S <<EOF
|
||||||
|
4:
|
||||||
|
EOF
|
||||||
|
libc_cv_include_x86_isa_level=no
|
||||||
|
+libc_cv_have_x86_lahf_sahf=no
|
||||||
|
+libc_cv_have_x86_movbe=no
|
||||||
|
if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest conftest1.S conftest2.S); then
|
||||||
|
count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l`
|
||||||
|
if test "$count" = 1; then
|
||||||
|
libc_cv_include_x86_isa_level=yes
|
||||||
|
+ cat > conftest.c <<EOF
|
||||||
|
+EOF
|
||||||
|
+ if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c) | grep -q "\-msahf"; then
|
||||||
|
+ libc_cv_have_x86_lahf_sahf=yes
|
||||||
|
+ fi
|
||||||
|
+ if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c) | grep -q "\-mmovbe"; then
|
||||||
|
+ libc_cv_have_x86_movbe=yes
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm -f conftest*])
|
||||||
|
if test $libc_cv_include_x86_isa_level = yes; then
|
||||||
|
AC_DEFINE(INCLUDE_X86_ISA_LEVEL)
|
||||||
|
fi
|
||||||
|
+if test $libc_cv_have_x86_lahf_sahf = yes; then
|
||||||
|
+ AC_DEFINE(HAVE_X86_LAHF_SAHF)
|
||||||
|
+fi
|
||||||
|
+if test $libc_cv_have_x86_movbe = yes; then
|
||||||
|
+ AC_DEFINE(HAVE_X86_MOVBE)
|
||||||
|
+fi
|
||||||
|
LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level])
|
||||||
|
diff --git a/sysdeps/x86/isa-level.c b/sysdeps/x86/isa-level.c
|
||||||
|
index aaf524cb56c99cb4..49ef4aa6122072cf 100644
|
||||||
|
--- a/sysdeps/x86/isa-level.c
|
||||||
|
+++ b/sysdeps/x86/isa-level.c
|
||||||
|
@@ -29,32 +29,35 @@
|
||||||
|
|
||||||
|
/* ELF program property for x86 ISA level. */
|
||||||
|
#ifdef INCLUDE_X86_ISA_LEVEL
|
||||||
|
-# if defined __x86_64__ || defined __FXSR__ || !defined _SOFT_FLOAT \
|
||||||
|
- || defined __MMX__ || defined __SSE__ || defined __SSE2__
|
||||||
|
+# if defined __SSE__ && defined __SSE2__
|
||||||
|
+/* NB: ISAs, excluding MMX, in x86-64 ISA level baseline are used. */
|
||||||
|
# define ISA_BASELINE GNU_PROPERTY_X86_ISA_1_BASELINE
|
||||||
|
# else
|
||||||
|
# define ISA_BASELINE 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
-# if defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 \
|
||||||
|
- || (defined __x86_64__ && defined __LAHF_SAHF__) \
|
||||||
|
- || defined __POPCNT__ || defined __SSE3__ \
|
||||||
|
- || defined __SSSE3__ || defined __SSE4_1__ || defined __SSE4_2__
|
||||||
|
+# if ISA_BASELINE && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 \
|
||||||
|
+ && defined HAVE_X86_LAHF_SAHF && defined __POPCNT__ \
|
||||||
|
+ && defined __SSE3__ && defined __SSSE3__ && defined __SSE4_1__ \
|
||||||
|
+ && defined __SSE4_2__
|
||||||
|
+/* NB: ISAs in x86-64 ISA level v2 are used. */
|
||||||
|
# define ISA_V2 GNU_PROPERTY_X86_ISA_1_V2
|
||||||
|
# else
|
||||||
|
# define ISA_V2 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
-# if defined __AVX__ || defined __AVX2__ || defined __F16C__ \
|
||||||
|
- || defined __FMA__ || defined __LZCNT__ || defined __MOVBE__ \
|
||||||
|
- || defined __XSAVE__
|
||||||
|
+# if ISA_V2 && defined __AVX__ && defined __AVX2__ && defined __F16C__ \
|
||||||
|
+ && defined __FMA__ && defined __LZCNT__ && defined HAVE_X86_MOVBE
|
||||||
|
+/* NB: ISAs in x86-64 ISA level v3 are used. */
|
||||||
|
# define ISA_V3 GNU_PROPERTY_X86_ISA_1_V3
|
||||||
|
# else
|
||||||
|
# define ISA_V3 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
-# if defined __AVX512F__ || defined __AVX512BW__ || defined __AVX512CD__ \
|
||||||
|
- || defined __AVX512DQ__ || defined __AVX512VL__
|
||||||
|
+# if ISA_V3 && defined __AVX512F__ && defined __AVX512BW__ \
|
||||||
|
+ && defined __AVX512CD__ && defined __AVX512DQ__ \
|
||||||
|
+ && defined __AVX512VL__
|
||||||
|
+/* NB: ISAs in x86-64 ISA level v4 are used. */
|
||||||
|
# define ISA_V4 GNU_PROPERTY_X86_ISA_1_V4
|
||||||
|
# else
|
||||||
|
# define ISA_V4 0
|
40
glibc-upstream-2.33-12.patch
Normal file
40
glibc-upstream-2.33-12.patch
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
commit a151f2e05a64727c552a297d129b8ef242ffb3b6
|
||||||
|
Author: DJ Delorie <dj@redhat.com>
|
||||||
|
Date: Thu Feb 25 16:08:21 2021 -0500
|
||||||
|
|
||||||
|
nscd: Fix double free in netgroupcache [BZ #27462]
|
||||||
|
|
||||||
|
In commit 745664bd798ec8fd50438605948eea594179fba1 a use-after-free
|
||||||
|
was fixed, but this led to an occasional double-free. This patch
|
||||||
|
tracks the "live" allocation better.
|
||||||
|
|
||||||
|
Tested manually by a third party.
|
||||||
|
|
||||||
|
Related: RHBZ 1927877
|
||||||
|
|
||||||
|
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||||
|
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||||
|
(cherry picked from commit dca565886b5e8bd7966e15f0ca42ee5cff686673)
|
||||||
|
|
||||||
|
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
|
||||||
|
index dba6ceec1be490bf..ad2daddafdc9d80c 100644
|
||||||
|
--- a/nscd/netgroupcache.c
|
||||||
|
+++ b/nscd/netgroupcache.c
|
||||||
|
@@ -248,7 +248,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||||
|
: NULL);
|
||||||
|
ndomain = (ndomain ? newbuf + ndomaindiff
|
||||||
|
: NULL);
|
||||||
|
- buffer = newbuf;
|
||||||
|
+ *tofreep = buffer = newbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
nhost = memcpy (buffer + bufused,
|
||||||
|
@@ -319,7 +319,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||||
|
else if (status == NSS_STATUS_TRYAGAIN && e == ERANGE)
|
||||||
|
{
|
||||||
|
buflen *= 2;
|
||||||
|
- buffer = xrealloc (buffer, buflen);
|
||||||
|
+ *tofreep = buffer = xrealloc (buffer, buflen);
|
||||||
|
}
|
||||||
|
else if (status == NSS_STATUS_RETURN
|
||||||
|
|| status == NSS_STATUS_NOTFOUND
|
241
glibc-upstream-2.33-13.patch
Normal file
241
glibc-upstream-2.33-13.patch
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
commit 32b9280f1d9f78e8fa3874e22f4d9a76460ee02a
|
||||||
|
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
Date: Thu Mar 11 08:21:06 2021 -0300
|
||||||
|
|
||||||
|
io: Return EBAFD for negative file descriptor on fstat (BZ #27559)
|
||||||
|
|
||||||
|
Now that fstat is implemented on top fstatat we need to handle negative
|
||||||
|
inputs. The implementation now rejects AT_FDCWD, which would otherwise
|
||||||
|
be accepted by the kernel.
|
||||||
|
|
||||||
|
Checked on x86_64-linux-gnu and on i686-linux-gnu.
|
||||||
|
|
||||||
|
(cherry picked from commit 94caafa040e4b4289c968cd70d53041b1463ac4d)
|
||||||
|
|
||||||
|
diff --git a/io/Makefile b/io/Makefile
|
||||||
|
index b7bebe923f84e878..d145d88f4e3faabf 100644
|
||||||
|
--- a/io/Makefile
|
||||||
|
+++ b/io/Makefile
|
||||||
|
@@ -68,7 +68,7 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
|
||||||
|
tst-fts tst-fts-lfs tst-open-tmpfile \
|
||||||
|
tst-copy_file_range tst-getcwd-abspath tst-lockf \
|
||||||
|
tst-ftw-lnk tst-file_change_detection tst-lchmod \
|
||||||
|
- tst-ftw-bz26353
|
||||||
|
+ tst-ftw-bz26353 tst-stat tst-stat-lfs
|
||||||
|
|
||||||
|
# Likewise for statx, but we do not need static linking here.
|
||||||
|
tests-internal += tst-statx
|
||||||
|
diff --git a/io/fstat.c b/io/fstat.c
|
||||||
|
index dc117361ffe7064b..17f31bf3b3a65a12 100644
|
||||||
|
--- a/io/fstat.c
|
||||||
|
+++ b/io/fstat.c
|
||||||
|
@@ -16,10 +16,16 @@
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
__fstat (int fd, struct stat *buf)
|
||||||
|
{
|
||||||
|
+ if (fd < 0)
|
||||||
|
+ {
|
||||||
|
+ __set_errno (EBADF);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
return __fstatat (fd, "", buf, AT_EMPTY_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/io/fstat64.c b/io/fstat64.c
|
||||||
|
index addf3797754f16b3..618170695cd56eec 100644
|
||||||
|
--- a/io/fstat64.c
|
||||||
|
+++ b/io/fstat64.c
|
||||||
|
@@ -16,10 +16,16 @@
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
__fstat64 (int fd, struct stat64 *buf)
|
||||||
|
{
|
||||||
|
+ if (fd < 0)
|
||||||
|
+ {
|
||||||
|
+ __set_errno (EBADF);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
return __fstatat64 (fd, "", buf, AT_EMPTY_PATH);
|
||||||
|
}
|
||||||
|
hidden_def (__fstat64)
|
||||||
|
diff --git a/io/tst-stat-lfs.c b/io/tst-stat-lfs.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..b53f460ad589c383
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/io/tst-stat-lfs.c
|
||||||
|
@@ -0,0 +1,2 @@
|
||||||
|
+#define _FILE_OFFSET_BITS 64
|
||||||
|
+#include "tst-stat.c"
|
||||||
|
diff --git a/io/tst-stat.c b/io/tst-stat.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..445ac4176c1d0f94
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/io/tst-stat.c
|
||||||
|
@@ -0,0 +1,102 @@
|
||||||
|
+/* Basic tests for stat, lstat, fstat, and fstatat.
|
||||||
|
+ 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 <array_length.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
+#include <support/check.h>
|
||||||
|
+#include <support/support.h>
|
||||||
|
+#include <support/temp_file.h>
|
||||||
|
+#include <support/xunistd.h>
|
||||||
|
+#include <sys/stat.h>
|
||||||
|
+#include <sys/sysmacros.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+stat_check (int fd, const char *path, struct stat *st)
|
||||||
|
+{
|
||||||
|
+ TEST_COMPARE (stat (path, st), 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+lstat_check (int fd, const char *path, struct stat *st)
|
||||||
|
+{
|
||||||
|
+ TEST_COMPARE (lstat (path, st), 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+fstat_check (int fd, const char *path, struct stat *st)
|
||||||
|
+{
|
||||||
|
+ /* Test for invalid fstat input (BZ #27559). */
|
||||||
|
+ TEST_COMPARE (fstat (AT_FDCWD, st), -1);
|
||||||
|
+ TEST_COMPARE (errno, EBADF);
|
||||||
|
+
|
||||||
|
+ TEST_COMPARE (fstat (fd, st), 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+fstatat_check (int fd, const char *path, struct stat *st)
|
||||||
|
+{
|
||||||
|
+ TEST_COMPARE (fstatat (fd, "", st, 0), -1);
|
||||||
|
+ TEST_COMPARE (errno, ENOENT);
|
||||||
|
+
|
||||||
|
+ TEST_COMPARE (fstatat (fd, path, st, 0), 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+typedef void (*test_t)(int, const char *path, struct stat *);
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+do_test (void)
|
||||||
|
+{
|
||||||
|
+ char *path;
|
||||||
|
+ int fd = create_temp_file ("tst-fstat.", &path);
|
||||||
|
+ TEST_VERIFY_EXIT (fd >= 0);
|
||||||
|
+ support_write_file_string (path, "abc");
|
||||||
|
+
|
||||||
|
+ struct statx stx;
|
||||||
|
+ TEST_COMPARE (statx (fd, path, 0, STATX_BASIC_STATS, &stx), 0);
|
||||||
|
+
|
||||||
|
+ test_t tests[] = { stat_check, lstat_check, fstat_check, fstatat_check };
|
||||||
|
+
|
||||||
|
+ for (int i = 0; i < array_length (tests); i++)
|
||||||
|
+ {
|
||||||
|
+ struct stat st;
|
||||||
|
+ tests[i](fd, path, &st);
|
||||||
|
+
|
||||||
|
+ TEST_COMPARE (stx.stx_dev_major, major (st.st_dev));
|
||||||
|
+ TEST_COMPARE (stx.stx_dev_minor, minor (st.st_dev));
|
||||||
|
+ TEST_COMPARE (stx.stx_ino, st.st_ino);
|
||||||
|
+ TEST_COMPARE (stx.stx_mode, st.st_mode);
|
||||||
|
+ TEST_COMPARE (stx.stx_nlink, st.st_nlink);
|
||||||
|
+ TEST_COMPARE (stx.stx_uid, st.st_uid);
|
||||||
|
+ TEST_COMPARE (stx.stx_gid, st.st_gid);
|
||||||
|
+ TEST_COMPARE (stx.stx_rdev_major, major (st.st_rdev));
|
||||||
|
+ TEST_COMPARE (stx.stx_rdev_minor, minor (st.st_rdev));
|
||||||
|
+ TEST_COMPARE (stx.stx_blksize, st.st_blksize);
|
||||||
|
+ TEST_COMPARE (stx.stx_blocks, st.st_blocks);
|
||||||
|
+
|
||||||
|
+ TEST_COMPARE (stx.stx_ctime.tv_sec, st.st_ctim.tv_sec);
|
||||||
|
+ TEST_COMPARE (stx.stx_ctime.tv_nsec, st.st_ctim.tv_nsec);
|
||||||
|
+ TEST_COMPARE (stx.stx_mtime.tv_sec, st.st_mtim.tv_sec);
|
||||||
|
+ TEST_COMPARE (stx.stx_mtime.tv_nsec, st.st_mtim.tv_nsec);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#include <support/test-driver.c>
|
||||||
|
diff --git a/sysdeps/unix/sysv/linux/fstat.c b/sysdeps/unix/sysv/linux/fstat.c
|
||||||
|
index fd643622054fea26..31a172dcc81163e7 100644
|
||||||
|
--- a/sysdeps/unix/sysv/linux/fstat.c
|
||||||
|
+++ b/sysdeps/unix/sysv/linux/fstat.c
|
||||||
|
@@ -19,11 +19,17 @@
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <kernel_stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
|
||||||
|
#if !XSTAT_IS_XSTAT64
|
||||||
|
int
|
||||||
|
__fstat (int fd, struct stat *buf)
|
||||||
|
{
|
||||||
|
+ if (fd < 0)
|
||||||
|
+ {
|
||||||
|
+ __set_errno (EBADF);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
return __fstatat (fd, "", buf, AT_EMPTY_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/sysdeps/unix/sysv/linux/fstat64.c b/sysdeps/unix/sysv/linux/fstat64.c
|
||||||
|
index 993abcb4458fa309..46de80b663b9c1c4 100644
|
||||||
|
--- a/sysdeps/unix/sysv/linux/fstat64.c
|
||||||
|
+++ b/sysdeps/unix/sysv/linux/fstat64.c
|
||||||
|
@@ -22,10 +22,16 @@
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <kernel_stat.h>
|
||||||
|
#include <stat_t64_cp.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
__fstat64_time64 (int fd, struct __stat64_t64 *buf)
|
||||||
|
{
|
||||||
|
+ if (fd < 0)
|
||||||
|
+ {
|
||||||
|
+ __set_errno (EBADF);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
return __fstatat64_time64 (fd, "", buf, AT_EMPTY_PATH);
|
||||||
|
}
|
||||||
|
#if __TIMESIZE != 64
|
||||||
|
@@ -34,6 +40,12 @@ hidden_def (__fstat64_time64)
|
||||||
|
int
|
||||||
|
__fstat64 (int fd, struct stat64 *buf)
|
||||||
|
{
|
||||||
|
+ if (fd < 0)
|
||||||
|
+ {
|
||||||
|
+ __set_errno (EBADF);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
struct __stat64_t64 st_t64;
|
||||||
|
return __fstat64_time64 (fd, &st_t64)
|
||||||
|
?: __cp_stat64_t64_stat64 (&st_t64, buf);
|
193
glibc-upstream-2.33-14.patch
Normal file
193
glibc-upstream-2.33-14.patch
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
commit 64f6c287ad3ccd807b7d4c694f4a91e2a662fed5
|
||||||
|
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||||
|
Date: Sat Mar 6 10:19:32 2021 -0800
|
||||||
|
|
||||||
|
x86: Handle _SC_LEVEL1_ICACHE_LINESIZE [BZ #27444]
|
||||||
|
|
||||||
|
commit 2d651eb9265d1366d7b9e881bfddd46db9c1ecc4
|
||||||
|
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||||
|
Date: Fri Sep 18 07:55:14 2020 -0700
|
||||||
|
|
||||||
|
x86: Move x86 processor cache info to cpu_features
|
||||||
|
|
||||||
|
missed _SC_LEVEL1_ICACHE_LINESIZE.
|
||||||
|
|
||||||
|
1. Add level1_icache_linesize to struct cpu_features.
|
||||||
|
2. Initialize level1_icache_linesize by calling handle_intel,
|
||||||
|
handle_zhaoxin and handle_amd with _SC_LEVEL1_ICACHE_LINESIZE.
|
||||||
|
3. Return level1_icache_linesize for _SC_LEVEL1_ICACHE_LINESIZE.
|
||||||
|
|
||||||
|
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||||
|
(cherry picked from commit f53ffc9b90cbd92fa5518686daf4091bdd1d4889)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
|
||||||
|
index dd826743426ffc9c..d231263051f1c242 100644
|
||||||
|
--- a/sysdeps/x86/Makefile
|
||||||
|
+++ b/sysdeps/x86/Makefile
|
||||||
|
@@ -208,3 +208,11 @@ $(objpfx)check-cet.out: $(..)sysdeps/x86/check-cet.awk \
|
||||||
|
generated += check-cet.out
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
+
|
||||||
|
+ifeq ($(subdir),posix)
|
||||||
|
+tests += \
|
||||||
|
+ tst-sysconf-cache-linesize \
|
||||||
|
+ tst-sysconf-cache-linesize-static
|
||||||
|
+tests-static += \
|
||||||
|
+ tst-sysconf-cache-linesize-static
|
||||||
|
+endif
|
||||||
|
diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
|
||||||
|
index 7b8df45e3bb6eaa1..5ea4723ca69d7b62 100644
|
||||||
|
--- a/sysdeps/x86/cacheinfo.c
|
||||||
|
+++ b/sysdeps/x86/cacheinfo.c
|
||||||
|
@@ -32,6 +32,9 @@ __cache_sysconf (int name)
|
||||||
|
case _SC_LEVEL1_ICACHE_SIZE:
|
||||||
|
return cpu_features->level1_icache_size;
|
||||||
|
|
||||||
|
+ case _SC_LEVEL1_ICACHE_LINESIZE:
|
||||||
|
+ return cpu_features->level1_icache_linesize;
|
||||||
|
+
|
||||||
|
case _SC_LEVEL1_DCACHE_SIZE:
|
||||||
|
return cpu_features->level1_dcache_size;
|
||||||
|
|
||||||
|
diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
|
||||||
|
index 6f91651f0da1d46a..2ab3acd83e1cfd97 100644
|
||||||
|
--- a/sysdeps/x86/dl-cacheinfo.h
|
||||||
|
+++ b/sysdeps/x86/dl-cacheinfo.h
|
||||||
|
@@ -707,6 +707,7 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||||
|
long int core;
|
||||||
|
unsigned int threads = 0;
|
||||||
|
unsigned long int level1_icache_size = -1;
|
||||||
|
+ unsigned long int level1_icache_linesize = -1;
|
||||||
|
unsigned long int level1_dcache_size = -1;
|
||||||
|
unsigned long int level1_dcache_assoc = -1;
|
||||||
|
unsigned long int level1_dcache_linesize = -1;
|
||||||
|
@@ -726,6 +727,8 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||||
|
|
||||||
|
level1_icache_size
|
||||||
|
= handle_intel (_SC_LEVEL1_ICACHE_SIZE, cpu_features);
|
||||||
|
+ level1_icache_linesize
|
||||||
|
+ = handle_intel (_SC_LEVEL1_ICACHE_LINESIZE, cpu_features);
|
||||||
|
level1_dcache_size = data;
|
||||||
|
level1_dcache_assoc
|
||||||
|
= handle_intel (_SC_LEVEL1_DCACHE_ASSOC, cpu_features);
|
||||||
|
@@ -753,6 +756,7 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||||
|
shared = handle_zhaoxin (_SC_LEVEL3_CACHE_SIZE);
|
||||||
|
|
||||||
|
level1_icache_size = handle_zhaoxin (_SC_LEVEL1_ICACHE_SIZE);
|
||||||
|
+ level1_icache_linesize = handle_zhaoxin (_SC_LEVEL1_ICACHE_LINESIZE);
|
||||||
|
level1_dcache_size = data;
|
||||||
|
level1_dcache_assoc = handle_zhaoxin (_SC_LEVEL1_DCACHE_ASSOC);
|
||||||
|
level1_dcache_linesize = handle_zhaoxin (_SC_LEVEL1_DCACHE_LINESIZE);
|
||||||
|
@@ -772,6 +776,7 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||||
|
shared = handle_amd (_SC_LEVEL3_CACHE_SIZE);
|
||||||
|
|
||||||
|
level1_icache_size = handle_amd (_SC_LEVEL1_ICACHE_SIZE);
|
||||||
|
+ level1_icache_linesize = handle_amd (_SC_LEVEL1_ICACHE_LINESIZE);
|
||||||
|
level1_dcache_size = data;
|
||||||
|
level1_dcache_assoc = handle_amd (_SC_LEVEL1_DCACHE_ASSOC);
|
||||||
|
level1_dcache_linesize = handle_amd (_SC_LEVEL1_DCACHE_LINESIZE);
|
||||||
|
@@ -833,6 +838,7 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||||
|
}
|
||||||
|
|
||||||
|
cpu_features->level1_icache_size = level1_icache_size;
|
||||||
|
+ cpu_features->level1_icache_linesize = level1_icache_linesize;
|
||||||
|
cpu_features->level1_dcache_size = level1_dcache_size;
|
||||||
|
cpu_features->level1_dcache_assoc = level1_dcache_assoc;
|
||||||
|
cpu_features->level1_dcache_linesize = level1_dcache_linesize;
|
||||||
|
diff --git a/sysdeps/x86/dl-diagnostics-cpu.c b/sysdeps/x86/dl-diagnostics-cpu.c
|
||||||
|
index 55c6f35c7cabb4da..af8486470826426d 100644
|
||||||
|
--- a/sysdeps/x86/dl-diagnostics-cpu.c
|
||||||
|
+++ b/sysdeps/x86/dl-diagnostics-cpu.c
|
||||||
|
@@ -89,6 +89,8 @@ _dl_diagnostics_cpu (void)
|
||||||
|
cpu_features->rep_stosb_threshold);
|
||||||
|
print_cpu_features_value ("level1_icache_size",
|
||||||
|
cpu_features->level1_icache_size);
|
||||||
|
+ print_cpu_features_value ("level1_icache_linesize",
|
||||||
|
+ cpu_features->level1_icache_linesize);
|
||||||
|
print_cpu_features_value ("level1_dcache_size",
|
||||||
|
cpu_features->level1_dcache_size);
|
||||||
|
print_cpu_features_value ("level1_dcache_assoc",
|
||||||
|
diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h
|
||||||
|
index 184dc93c699d9b91..04d8e5734eb53e2b 100644
|
||||||
|
--- a/sysdeps/x86/include/cpu-features.h
|
||||||
|
+++ b/sysdeps/x86/include/cpu-features.h
|
||||||
|
@@ -859,6 +859,8 @@ struct cpu_features
|
||||||
|
unsigned long int rep_stosb_threshold;
|
||||||
|
/* _SC_LEVEL1_ICACHE_SIZE. */
|
||||||
|
unsigned long int level1_icache_size;
|
||||||
|
+ /* _SC_LEVEL1_ICACHE_LINESIZE. */
|
||||||
|
+ unsigned long int level1_icache_linesize;
|
||||||
|
/* _SC_LEVEL1_DCACHE_SIZE. */
|
||||||
|
unsigned long int level1_dcache_size;
|
||||||
|
/* _SC_LEVEL1_DCACHE_ASSOC. */
|
||||||
|
diff --git a/sysdeps/x86/tst-sysconf-cache-linesize-static.c b/sysdeps/x86/tst-sysconf-cache-linesize-static.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..152ae68821748b3d
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sysdeps/x86/tst-sysconf-cache-linesize-static.c
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+#include "tst-sysconf-cache-linesize.c"
|
||||||
|
diff --git a/sysdeps/x86/tst-sysconf-cache-linesize.c b/sysdeps/x86/tst-sysconf-cache-linesize.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..642dbde5d25b7c5e
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sysdeps/x86/tst-sysconf-cache-linesize.c
|
||||||
|
@@ -0,0 +1,57 @@
|
||||||
|
+/* Test system cache line sizes.
|
||||||
|
+ 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 <stdio.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <array_length.h>
|
||||||
|
+
|
||||||
|
+static struct
|
||||||
|
+{
|
||||||
|
+ const char *name;
|
||||||
|
+ int _SC_val;
|
||||||
|
+} sc_options[] =
|
||||||
|
+ {
|
||||||
|
+#define N(name) { "_SC_"#name, _SC_##name }
|
||||||
|
+ N (LEVEL1_ICACHE_LINESIZE),
|
||||||
|
+ N (LEVEL1_DCACHE_LINESIZE),
|
||||||
|
+ N (LEVEL2_CACHE_LINESIZE)
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+do_test (void)
|
||||||
|
+{
|
||||||
|
+ int result = EXIT_SUCCESS;
|
||||||
|
+
|
||||||
|
+ for (int i = 0; i < array_length (sc_options); ++i)
|
||||||
|
+ {
|
||||||
|
+ long int scret = sysconf (sc_options[i]._SC_val);
|
||||||
|
+ if (scret < 0)
|
||||||
|
+ {
|
||||||
|
+ printf ("sysconf (%s) returned < 0 (%ld)\n",
|
||||||
|
+ sc_options[i].name, scret);
|
||||||
|
+ result = EXIT_FAILURE;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ printf ("sysconf (%s): %ld\n", sc_options[i].name, scret);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return result;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#include <support/test-driver.c>
|
162
glibc-upstream-2.33-15.patch
Normal file
162
glibc-upstream-2.33-15.patch
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
commit ea5a537e879bb667e03435a2308d915dc89448a6
|
||||||
|
Author: Carlos O'Donell <carlos@redhat.com>
|
||||||
|
Date: Fri Mar 12 16:44:47 2021 +0100
|
||||||
|
|
||||||
|
elf: Always set l in _dl_init_paths (bug 23462)
|
||||||
|
|
||||||
|
After d1d5471579eb0426671bf94f2d71e61dfb204c30 ("Remove dead
|
||||||
|
DL_DST_REQ_STATIC code.") we always setup the link map l to make the
|
||||||
|
static and shared cases the same. The bug is that in elf/dl-load.c
|
||||||
|
(_dl_init_paths) we conditionally set l only in the #ifdef SHARED
|
||||||
|
case, but unconditionally use it later. The simple solution is to
|
||||||
|
remove the #ifdef SHARED conditional, because it's no longer needed,
|
||||||
|
and unconditionally setup l for both the static and shared cases. A
|
||||||
|
regression test is added to run a static binary with
|
||||||
|
LD_LIBRARY_PATH='$ORIGIN' which crashes before the fix and runs after
|
||||||
|
the fix.
|
||||||
|
|
||||||
|
Co-Authored-By: Florian Weimer <fweimer@redhat.com>
|
||||||
|
(cherry picked from commit 332421312576bd7095e70589154af99b124dd2d1)
|
||||||
|
|
||||||
|
diff --git a/elf/Makefile b/elf/Makefile
|
||||||
|
index 7610fa080f3f4738..63da0ed64f6234a8 100644
|
||||||
|
--- a/elf/Makefile
|
||||||
|
+++ b/elf/Makefile
|
||||||
|
@@ -164,7 +164,8 @@ tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \
|
||||||
|
tst-dl-iter-static \
|
||||||
|
tst-tlsalign-static tst-tlsalign-extern-static \
|
||||||
|
tst-linkall-static tst-env-setuid tst-env-setuid-tunables \
|
||||||
|
- tst-single_threaded-static tst-single_threaded-pthread-static
|
||||||
|
+ tst-single_threaded-static tst-single_threaded-pthread-static \
|
||||||
|
+ tst-dst-static
|
||||||
|
|
||||||
|
tests-static-internal := tst-tls1-static tst-tls2-static \
|
||||||
|
tst-ptrguard1-static tst-stackguard1-static \
|
||||||
|
@@ -1905,3 +1906,5 @@ $(objpfx)list-tunables.out: tst-rtld-list-tunables.sh $(objpfx)ld.so
|
||||||
|
cmp tst-rtld-list-tunables.exp \
|
||||||
|
$(objpfx)/tst-rtld-list-tunables.out > $@; \
|
||||||
|
$(evaluate-test)
|
||||||
|
+
|
||||||
|
+tst-dst-static-ENV = LD_LIBRARY_PATH='$$ORIGIN'
|
||||||
|
diff --git a/elf/dl-load.c b/elf/dl-load.c
|
||||||
|
index 9e2089cfaa7dd4b1..376a2e64d6a33535 100644
|
||||||
|
--- a/elf/dl-load.c
|
||||||
|
+++ b/elf/dl-load.c
|
||||||
|
@@ -758,50 +758,45 @@ _dl_init_paths (const char *llp, const char *source,
|
||||||
|
max_dirnamelen = SYSTEM_DIRS_MAX_LEN;
|
||||||
|
*aelem = NULL;
|
||||||
|
|
||||||
|
-#ifdef SHARED
|
||||||
|
/* This points to the map of the main object. */
|
||||||
|
l = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
|
||||||
|
- if (l != NULL)
|
||||||
|
+ assert (l->l_type != lt_loaded);
|
||||||
|
+
|
||||||
|
+ if (l->l_info[DT_RUNPATH])
|
||||||
|
+ {
|
||||||
|
+ /* Allocate room for the search path and fill in information
|
||||||
|
+ from RUNPATH. */
|
||||||
|
+ decompose_rpath (&l->l_runpath_dirs,
|
||||||
|
+ (const void *) (D_PTR (l, l_info[DT_STRTAB])
|
||||||
|
+ + l->l_info[DT_RUNPATH]->d_un.d_val),
|
||||||
|
+ l, "RUNPATH");
|
||||||
|
+ /* During rtld init the memory is allocated by the stub malloc,
|
||||||
|
+ prevent any attempt to free it by the normal malloc. */
|
||||||
|
+ l->l_runpath_dirs.malloced = 0;
|
||||||
|
+
|
||||||
|
+ /* The RPATH is ignored. */
|
||||||
|
+ l->l_rpath_dirs.dirs = (void *) -1;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
{
|
||||||
|
- assert (l->l_type != lt_loaded);
|
||||||
|
+ l->l_runpath_dirs.dirs = (void *) -1;
|
||||||
|
|
||||||
|
- if (l->l_info[DT_RUNPATH])
|
||||||
|
+ if (l->l_info[DT_RPATH])
|
||||||
|
{
|
||||||
|
/* Allocate room for the search path and fill in information
|
||||||
|
- from RUNPATH. */
|
||||||
|
- decompose_rpath (&l->l_runpath_dirs,
|
||||||
|
+ from RPATH. */
|
||||||
|
+ decompose_rpath (&l->l_rpath_dirs,
|
||||||
|
(const void *) (D_PTR (l, l_info[DT_STRTAB])
|
||||||
|
- + l->l_info[DT_RUNPATH]->d_un.d_val),
|
||||||
|
- l, "RUNPATH");
|
||||||
|
- /* During rtld init the memory is allocated by the stub malloc,
|
||||||
|
- prevent any attempt to free it by the normal malloc. */
|
||||||
|
- l->l_runpath_dirs.malloced = 0;
|
||||||
|
-
|
||||||
|
- /* The RPATH is ignored. */
|
||||||
|
- l->l_rpath_dirs.dirs = (void *) -1;
|
||||||
|
+ + l->l_info[DT_RPATH]->d_un.d_val),
|
||||||
|
+ l, "RPATH");
|
||||||
|
+ /* During rtld init the memory is allocated by the stub
|
||||||
|
+ malloc, prevent any attempt to free it by the normal
|
||||||
|
+ malloc. */
|
||||||
|
+ l->l_rpath_dirs.malloced = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
- {
|
||||||
|
- l->l_runpath_dirs.dirs = (void *) -1;
|
||||||
|
-
|
||||||
|
- if (l->l_info[DT_RPATH])
|
||||||
|
- {
|
||||||
|
- /* Allocate room for the search path and fill in information
|
||||||
|
- from RPATH. */
|
||||||
|
- decompose_rpath (&l->l_rpath_dirs,
|
||||||
|
- (const void *) (D_PTR (l, l_info[DT_STRTAB])
|
||||||
|
- + l->l_info[DT_RPATH]->d_un.d_val),
|
||||||
|
- l, "RPATH");
|
||||||
|
- /* During rtld init the memory is allocated by the stub
|
||||||
|
- malloc, prevent any attempt to free it by the normal
|
||||||
|
- malloc. */
|
||||||
|
- l->l_rpath_dirs.malloced = 0;
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- l->l_rpath_dirs.dirs = (void *) -1;
|
||||||
|
- }
|
||||||
|
+ l->l_rpath_dirs.dirs = (void *) -1;
|
||||||
|
}
|
||||||
|
-#endif /* SHARED */
|
||||||
|
|
||||||
|
if (llp != NULL && *llp != '\0')
|
||||||
|
{
|
||||||
|
diff --git a/elf/tst-dst-static.c b/elf/tst-dst-static.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..56eb371c96f85276
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/elf/tst-dst-static.c
|
||||||
|
@@ -0,0 +1,32 @@
|
||||||
|
+/* Test DST expansion for static binaries doesn't carsh. Bug 23462.
|
||||||
|
+ 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/>. */
|
||||||
|
+
|
||||||
|
+/* The purpose of this test is to exercise the code in elf/dl-loac.c
|
||||||
|
+ (_dl_init_paths) or thereabout and ensure that static binaries
|
||||||
|
+ don't crash when expanding DSTs.
|
||||||
|
+
|
||||||
|
+ If the dynamic loader code linked into the static binary cannot
|
||||||
|
+ handle expanding the DSTs e.g. null-deref on an incomplete link
|
||||||
|
+ map, then it will crash before reaching main, so the test harness
|
||||||
|
+ is unnecessary. */
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+main (void)
|
||||||
|
+{
|
||||||
|
+ return 0;
|
||||||
|
+}
|
77
glibc-upstream-2.33-16.patch
Normal file
77
glibc-upstream-2.33-16.patch
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
commit dd8023c2ac0af28a6e391a2eb5038bb351694243
|
||||||
|
Author: Florian Weimer <fweimer@redhat.com>
|
||||||
|
Date: Mon Mar 15 10:33:43 2021 +0100
|
||||||
|
|
||||||
|
elf: ld.so --help calls _dl_init_paths without a main map [BZ #27577]
|
||||||
|
|
||||||
|
In this case, use the link map of the dynamic loader itself as
|
||||||
|
a replacement. This is more than just a hack: if we ever support
|
||||||
|
DT_RUNPATH/DT_RPATH for the dynamic loader, reporting it for
|
||||||
|
ld.so --help (without further command line arguments) would be the
|
||||||
|
right thing to do.
|
||||||
|
|
||||||
|
Fixes commit 332421312576bd7095e70589154af99b124dd2d1 ("elf: Always
|
||||||
|
set l in _dl_init_paths (bug 23462)").
|
||||||
|
|
||||||
|
(cherry picked from commit 4e6db99c665d3b82a70a3e218860ef087b1555b4)
|
||||||
|
|
||||||
|
diff --git a/elf/Makefile b/elf/Makefile
|
||||||
|
index 63da0ed64f6234a8..4b92f8b3054b556e 100644
|
||||||
|
--- a/elf/Makefile
|
||||||
|
+++ b/elf/Makefile
|
||||||
|
@@ -245,7 +245,7 @@ tests += $(tests-execstack-$(have-z-execstack))
|
||||||
|
ifeq ($(run-built-tests),yes)
|
||||||
|
tests-special += $(objpfx)tst-leaks1-mem.out \
|
||||||
|
$(objpfx)tst-leaks1-static-mem.out $(objpfx)noload-mem.out \
|
||||||
|
- $(objpfx)tst-ldconfig-X.out
|
||||||
|
+ $(objpfx)tst-ldconfig-X.out $(objpfx)tst-rtld-help.out
|
||||||
|
endif
|
||||||
|
tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
||||||
|
tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
||||||
|
@@ -433,7 +433,8 @@ endif
|
||||||
|
ifeq (yes,$(build-shared))
|
||||||
|
ifeq ($(run-built-tests),yes)
|
||||||
|
tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out \
|
||||||
|
- $(objpfx)tst-rtld-preload.out $(objpfx)argv0test.out
|
||||||
|
+ $(objpfx)tst-rtld-preload.out $(objpfx)argv0test.out \
|
||||||
|
+ $(objpfx)tst-rtld-help.out
|
||||||
|
endif
|
||||||
|
tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
|
||||||
|
$(objpfx)check-wx-segment.out \
|
||||||
|
@@ -1908,3 +1909,16 @@ $(objpfx)list-tunables.out: tst-rtld-list-tunables.sh $(objpfx)ld.so
|
||||||
|
$(evaluate-test)
|
||||||
|
|
||||||
|
tst-dst-static-ENV = LD_LIBRARY_PATH='$$ORIGIN'
|
||||||
|
+
|
||||||
|
+$(objpfx)tst-rtld-help.out: $(objpfx)ld.so
|
||||||
|
+ $(test-wrapper) $(rtld-prefix) --help > $@; \
|
||||||
|
+ status=$$?; \
|
||||||
|
+ echo "info: ld.so exit status: $$status" >> $@; \
|
||||||
|
+ if ! grep -q 'Legacy HWCAP subdirectories under library search path directories' $@; then \
|
||||||
|
+ echo "error: missing subdirectory pattern" >> $@; \
|
||||||
|
+ if test $$status -eq 0; then \
|
||||||
|
+ status=1; \
|
||||||
|
+ fi; \
|
||||||
|
+ fi; \
|
||||||
|
+ (exit $$status); \
|
||||||
|
+ $(evaluate-test)
|
||||||
|
diff --git a/elf/dl-load.c b/elf/dl-load.c
|
||||||
|
index 376a2e64d6a33535..2f760503c5f117f8 100644
|
||||||
|
--- a/elf/dl-load.c
|
||||||
|
+++ b/elf/dl-load.c
|
||||||
|
@@ -758,8 +758,14 @@ _dl_init_paths (const char *llp, const char *source,
|
||||||
|
max_dirnamelen = SYSTEM_DIRS_MAX_LEN;
|
||||||
|
*aelem = NULL;
|
||||||
|
|
||||||
|
- /* This points to the map of the main object. */
|
||||||
|
+ /* This points to the map of the main object. If there is no main
|
||||||
|
+ object (e.g., under --help, use the dynamic loader itself as a
|
||||||
|
+ stand-in. */
|
||||||
|
l = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
|
||||||
|
+#ifdef SHARED
|
||||||
|
+ if (l == NULL)
|
||||||
|
+ l = &GL (dl_rtld_map);
|
||||||
|
+#endif
|
||||||
|
assert (l->l_type != lt_loaded);
|
||||||
|
|
||||||
|
if (l->l_info[DT_RUNPATH])
|
196
glibc-upstream-2.33-17.patch
Normal file
196
glibc-upstream-2.33-17.patch
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
commit f90d6b0484032334a3e2db5891981e123051cf19
|
||||||
|
Author: Jakub Jelinek <jakub@redhat.com>
|
||||||
|
Date: Thu Mar 4 15:15:33 2021 +0100
|
||||||
|
|
||||||
|
pthread_once hangs when init routine throws an exception [BZ #18435]
|
||||||
|
|
||||||
|
This is another attempt at making pthread_once handle throwing exceptions
|
||||||
|
from the init routine callback. As the new testcases show, just switching
|
||||||
|
to the cleanup attribute based cleanup does fix the tst-once5 test, but
|
||||||
|
breaks the new tst-oncey3 test. That is because when throwing exceptions,
|
||||||
|
only the unwind info registered cleanups (i.e. C++ destructors or cleanup
|
||||||
|
attribute), when cancelling threads and there has been unwind info from the
|
||||||
|
cancellation point up to whatever needs cleanup both unwind info registered
|
||||||
|
cleanups and THREAD_SETMEM (self, cleanup, ...) registered cleanups are
|
||||||
|
invoked, but once we hit some frame with no unwind info, only the
|
||||||
|
THREAD_SETMEM (self, cleanup, ...) registered cleanups are invoked.
|
||||||
|
So, to stay fully backwards compatible (allow init routines without
|
||||||
|
unwind info which encounter cancellation points) and handle exception throwing
|
||||||
|
we actually need to register the pthread_once cleanups in both unwind info
|
||||||
|
and in the THREAD_SETMEM (self, cleanup, ...) way.
|
||||||
|
If an exception is thrown, only the former will happen and we in that case
|
||||||
|
need to also unregister the THREAD_SETMEM (self, cleanup, ...) registered
|
||||||
|
handler, because otherwise after catching the exception the user code could
|
||||||
|
call deeper into the stack some cancellation point, get cancelled and then
|
||||||
|
a stale cleanup handler would clobber stack and probably crash.
|
||||||
|
If a thread calling init routine is cancelled and unwind info ends before
|
||||||
|
the pthread_once frame, it will be cleaned up through self->cleanup as
|
||||||
|
before. And if unwind info is present, unwind_stop first calls the
|
||||||
|
self->cleanup registered handler for the frame, then it will call the
|
||||||
|
unwind info registered handler but that will already see __do_it == 0
|
||||||
|
and do nothing.
|
||||||
|
|
||||||
|
(cherry picked from commit f0419e6a10740a672b28e112c409ae24f5e890ab)
|
||||||
|
|
||||||
|
diff --git a/nptl/Makefile b/nptl/Makefile
|
||||||
|
index 0282e07390e8a249..5b036eb8a7b5d8b3 100644
|
||||||
|
--- a/nptl/Makefile
|
||||||
|
+++ b/nptl/Makefile
|
||||||
|
@@ -314,10 +314,6 @@ xtests += tst-eintr1
|
||||||
|
|
||||||
|
test-srcs = tst-oddstacklimit
|
||||||
|
|
||||||
|
-# Test expected to fail on most targets (except x86_64) due to bug
|
||||||
|
-# 18435 - pthread_once hangs when init routine throws an exception.
|
||||||
|
-test-xfail-tst-once5 = yes
|
||||||
|
-
|
||||||
|
gen-as-const-headers = unwindbuf.sym \
|
||||||
|
pthread-pi-defines.sym
|
||||||
|
|
||||||
|
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
|
||||||
|
index e5efa2e62d3d23d8..79be1bc70f4e9db8 100644
|
||||||
|
--- a/nptl/pthreadP.h
|
||||||
|
+++ b/nptl/pthreadP.h
|
||||||
|
@@ -602,6 +602,67 @@ extern void __pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer,
|
||||||
|
# undef pthread_cleanup_pop
|
||||||
|
# define pthread_cleanup_pop(execute) \
|
||||||
|
__pthread_cleanup_pop (&_buffer, (execute)); }
|
||||||
|
+
|
||||||
|
+# if defined __EXCEPTIONS && !defined __cplusplus
|
||||||
|
+/* Structure to hold the cleanup handler information. */
|
||||||
|
+struct __pthread_cleanup_combined_frame
|
||||||
|
+{
|
||||||
|
+ void (*__cancel_routine) (void *);
|
||||||
|
+ void *__cancel_arg;
|
||||||
|
+ int __do_it;
|
||||||
|
+ struct _pthread_cleanup_buffer __buffer;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* Special cleanup macros which register cleanup both using
|
||||||
|
+ __pthread_cleanup_{push,pop} and using cleanup attribute. This is needed
|
||||||
|
+ for pthread_once, so that it supports both throwing exceptions from the
|
||||||
|
+ pthread_once callback (only cleanup attribute works there) and cancellation
|
||||||
|
+ of the thread running the callback if the callback or some routines it
|
||||||
|
+ calls don't have unwind information. */
|
||||||
|
+
|
||||||
|
+static __always_inline void
|
||||||
|
+__pthread_cleanup_combined_routine (struct __pthread_cleanup_combined_frame
|
||||||
|
+ *__frame)
|
||||||
|
+{
|
||||||
|
+ if (__frame->__do_it)
|
||||||
|
+ {
|
||||||
|
+ __frame->__cancel_routine (__frame->__cancel_arg);
|
||||||
|
+ __frame->__do_it = 0;
|
||||||
|
+ __pthread_cleanup_pop (&__frame->__buffer, 0);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static inline void
|
||||||
|
+__pthread_cleanup_combined_routine_voidptr (void *__arg)
|
||||||
|
+{
|
||||||
|
+ struct __pthread_cleanup_combined_frame *__frame
|
||||||
|
+ = (struct __pthread_cleanup_combined_frame *) __arg;
|
||||||
|
+ if (__frame->__do_it)
|
||||||
|
+ {
|
||||||
|
+ __frame->__cancel_routine (__frame->__cancel_arg);
|
||||||
|
+ __frame->__do_it = 0;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# define pthread_cleanup_combined_push(routine, arg) \
|
||||||
|
+ do { \
|
||||||
|
+ void (*__cancel_routine) (void *) = (routine); \
|
||||||
|
+ struct __pthread_cleanup_combined_frame __clframe \
|
||||||
|
+ __attribute__ ((__cleanup__ (__pthread_cleanup_combined_routine))) \
|
||||||
|
+ = { .__cancel_routine = __cancel_routine, .__cancel_arg = (arg), \
|
||||||
|
+ .__do_it = 1 }; \
|
||||||
|
+ __pthread_cleanup_push (&__clframe.__buffer, \
|
||||||
|
+ __pthread_cleanup_combined_routine_voidptr, \
|
||||||
|
+ &__clframe);
|
||||||
|
+
|
||||||
|
+# define pthread_cleanup_combined_pop(execute) \
|
||||||
|
+ __pthread_cleanup_pop (&__clframe.__buffer, 0); \
|
||||||
|
+ __clframe.__do_it = 0; \
|
||||||
|
+ if (execute) \
|
||||||
|
+ __cancel_routine (__clframe.__cancel_arg); \
|
||||||
|
+ } while (0)
|
||||||
|
+
|
||||||
|
+# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
|
||||||
|
diff --git a/nptl/pthread_once.c b/nptl/pthread_once.c
|
||||||
|
index 28d97097c75f992d..7645da222a65bc3d 100644
|
||||||
|
--- a/nptl/pthread_once.c
|
||||||
|
+++ b/nptl/pthread_once.c
|
||||||
|
@@ -111,11 +111,11 @@ __pthread_once_slow (pthread_once_t *once_control, void (*init_routine) (void))
|
||||||
|
/* This thread is the first here. Do the initialization.
|
||||||
|
Register a cleanup handler so that in case the thread gets
|
||||||
|
interrupted the initialization can be restarted. */
|
||||||
|
- pthread_cleanup_push (clear_once_control, once_control);
|
||||||
|
+ pthread_cleanup_combined_push (clear_once_control, once_control);
|
||||||
|
|
||||||
|
init_routine ();
|
||||||
|
|
||||||
|
- pthread_cleanup_pop (0);
|
||||||
|
+ pthread_cleanup_combined_pop (0);
|
||||||
|
|
||||||
|
|
||||||
|
/* Mark *once_control as having finished the initialization. We need
|
||||||
|
diff --git a/nptl/tst-once5.cc b/nptl/tst-once5.cc
|
||||||
|
index b797ab35622e78eb..60fe1ef820f3832c 100644
|
||||||
|
--- a/nptl/tst-once5.cc
|
||||||
|
+++ b/nptl/tst-once5.cc
|
||||||
|
@@ -59,7 +59,7 @@ do_test (void)
|
||||||
|
" throwing an exception", stderr);
|
||||||
|
}
|
||||||
|
catch (OnceException) {
|
||||||
|
- if (1 < niter)
|
||||||
|
+ if (niter > 1)
|
||||||
|
fputs ("pthread_once unexpectedly threw", stderr);
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
@@ -75,7 +75,5 @@ do_test (void)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
-// The test currently hangs and is XFAILed. Reduce the timeout.
|
||||||
|
-#define TIMEOUT 1
|
||||||
|
#define TEST_FUNCTION do_test ()
|
||||||
|
#include "../test-skeleton.c"
|
||||||
|
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
|
||||||
|
index eeb64f9fb0480ccc..53b65ef3499ef8c9 100644
|
||||||
|
--- a/sysdeps/pthread/Makefile
|
||||||
|
+++ b/sysdeps/pthread/Makefile
|
||||||
|
@@ -231,7 +231,7 @@ generated += $(objpfx)tst-atfork2.mtrace \
|
||||||
|
|
||||||
|
tests-internal += tst-cancel25 tst-robust8
|
||||||
|
|
||||||
|
-tests += tst-oncex3 tst-oncex4
|
||||||
|
+tests += tst-oncex3 tst-oncex4 tst-oncey3 tst-oncey4
|
||||||
|
|
||||||
|
modules-names += tst-join7mod
|
||||||
|
|
||||||
|
@@ -242,6 +242,8 @@ endif
|
||||||
|
|
||||||
|
CFLAGS-tst-oncex3.c += -fexceptions
|
||||||
|
CFLAGS-tst-oncex4.c += -fexceptions
|
||||||
|
+CFLAGS-tst-oncey3.c += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||||
|
+CFLAGS-tst-oncey4.c += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||||
|
|
||||||
|
$(objpfx)tst-join7: $(libdl) $(shared-thread-library)
|
||||||
|
$(objpfx)tst-join7.out: $(objpfx)tst-join7mod.so
|
||||||
|
diff --git a/sysdeps/pthread/tst-oncey3.c b/sysdeps/pthread/tst-oncey3.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..08225b88dc06b979
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sysdeps/pthread/tst-oncey3.c
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+#include "tst-once3.c"
|
||||||
|
diff --git a/sysdeps/pthread/tst-oncey4.c b/sysdeps/pthread/tst-oncey4.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000..9b4d98f3f13c265a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sysdeps/pthread/tst-oncey4.c
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+#include "tst-once4.c"
|
42
glibc-upstream-2.33-18.patch
Normal file
42
glibc-upstream-2.33-18.patch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
commit 79c6be6a0ad59e28cfb73ad6cae6b073e22836e3
|
||||||
|
Author: Florian Weimer <fweimer@redhat.com>
|
||||||
|
Date: Thu Feb 4 15:00:20 2021 +0100
|
||||||
|
|
||||||
|
nptl: Remove private futex optimization [BZ #27304]
|
||||||
|
|
||||||
|
It is effectively used, unexcept for pthread_cond_destroy, where we do
|
||||||
|
not want it; see bug 27304. The internal locks do not support a
|
||||||
|
process-shared mode.
|
||||||
|
|
||||||
|
This fixes commit dc6cfdc934db9997c33728082d63552b9eee4563 ("nptl:
|
||||||
|
Move pthread_cond_destroy implementation into libc").
|
||||||
|
|
||||||
|
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
(cherry picked from commit c4ad832276f4dadfa40904109b26a521468f66bc)
|
||||||
|
|
||||||
|
diff --git a/sysdeps/nptl/lowlevellock-futex.h b/sysdeps/nptl/lowlevellock-futex.h
|
||||||
|
index ecb729da6b838773..ca96397a4a925b8b 100644
|
||||||
|
--- a/sysdeps/nptl/lowlevellock-futex.h
|
||||||
|
+++ b/sysdeps/nptl/lowlevellock-futex.h
|
||||||
|
@@ -50,20 +50,8 @@
|
||||||
|
#define LLL_SHARED FUTEX_PRIVATE_FLAG
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLER__
|
||||||
|
-
|
||||||
|
-# if IS_IN (libc) || IS_IN (rtld)
|
||||||
|
-/* In libc.so or ld.so all futexes are private. */
|
||||||
|
-# define __lll_private_flag(fl, private) \
|
||||||
|
- ({ \
|
||||||
|
- /* Prevent warnings in callers of this macro. */ \
|
||||||
|
- int __lll_private_flag_priv __attribute__ ((unused)); \
|
||||||
|
- __lll_private_flag_priv = (private); \
|
||||||
|
- ((fl) | FUTEX_PRIVATE_FLAG); \
|
||||||
|
- })
|
||||||
|
-# else
|
||||||
|
-# define __lll_private_flag(fl, private) \
|
||||||
|
+# define __lll_private_flag(fl, private) \
|
||||||
|
(((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
|
||||||
|
-# endif
|
||||||
|
|
||||||
|
# define lll_futex_syscall(nargs, futexp, op, ...) \
|
||||||
|
({ \
|
102
glibc-upstream-2.33-19.patch
Normal file
102
glibc-upstream-2.33-19.patch
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
commit db32fc27e7bdfb5468200a94e9152bcc1c971d25
|
||||||
|
Author: DJ Delorie <dj@redhat.com>
|
||||||
|
Date: Thu Mar 11 12:50:02 2021 -0500
|
||||||
|
|
||||||
|
test-container: Always copy test-specific support files [BZ #27537]
|
||||||
|
|
||||||
|
There's a small chance that a fresh checkout will result in some of
|
||||||
|
the test-specific container files will have the same timestamp and
|
||||||
|
size, which breaks the rsync logic in test-container, resulting in
|
||||||
|
tests running with the wrong support files.
|
||||||
|
|
||||||
|
This patch changes the rsync logic to always copy the test-specific
|
||||||
|
files, which normally would always be copied anyway. The rsync logic
|
||||||
|
for the testroot itself is unchanged.
|
||||||
|
|
||||||
|
(cherry picked from commit 20bee7134801cc932ff87fac511289b92fc94944)
|
||||||
|
|
||||||
|
diff --git a/support/test-container.c b/support/test-container.c
|
||||||
|
index 28cc44d9f1e28c10..94498d39019a4776 100644
|
||||||
|
--- a/support/test-container.c
|
||||||
|
+++ b/support/test-container.c
|
||||||
|
@@ -481,7 +481,7 @@ need_sync (char *ap, char *bp, struct stat *a, struct stat *b)
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-rsync_1 (path_buf * src, path_buf * dest, int and_delete)
|
||||||
|
+rsync_1 (path_buf * src, path_buf * dest, int and_delete, int force_copies)
|
||||||
|
{
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent *de;
|
||||||
|
@@ -491,8 +491,9 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete)
|
||||||
|
r_append ("/", dest);
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
- printf ("sync %s to %s %s\n", src->buf, dest->buf,
|
||||||
|
- and_delete ? "and delete" : "");
|
||||||
|
+ printf ("sync %s to %s%s%s\n", src->buf, dest->buf,
|
||||||
|
+ and_delete ? " and delete" : "",
|
||||||
|
+ force_copies ? " (forced)" : "");
|
||||||
|
|
||||||
|
size_t staillen = src->len;
|
||||||
|
|
||||||
|
@@ -521,10 +522,10 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete)
|
||||||
|
missing. */
|
||||||
|
lstat (dest->buf, &d);
|
||||||
|
|
||||||
|
- if (! need_sync (src->buf, dest->buf, &s, &d))
|
||||||
|
+ if (! force_copies && ! need_sync (src->buf, dest->buf, &s, &d))
|
||||||
|
{
|
||||||
|
if (S_ISDIR (s.st_mode))
|
||||||
|
- rsync_1 (src, dest, and_delete);
|
||||||
|
+ rsync_1 (src, dest, and_delete, force_copies);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -559,7 +560,7 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete)
|
||||||
|
if (verbose)
|
||||||
|
printf ("+D %s\n", dest->buf);
|
||||||
|
maybe_xmkdir (dest->buf, (s.st_mode & 0777) | 0700);
|
||||||
|
- rsync_1 (src, dest, and_delete);
|
||||||
|
+ rsync_1 (src, dest, and_delete, force_copies);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case S_IFLNK:
|
||||||
|
@@ -639,12 +640,12 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete)
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-rsync (char *src, char *dest, int and_delete)
|
||||||
|
+rsync (char *src, char *dest, int and_delete, int force_copies)
|
||||||
|
{
|
||||||
|
r_setup (src, &spath);
|
||||||
|
r_setup (dest, &dpath);
|
||||||
|
|
||||||
|
- rsync_1 (&spath, &dpath, and_delete);
|
||||||
|
+ rsync_1 (&spath, &dpath, and_delete, force_copies);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -846,11 +847,11 @@ main (int argc, char **argv)
|
||||||
|
do_ldconfig = true;
|
||||||
|
|
||||||
|
rsync (pristine_root_path, new_root_path,
|
||||||
|
- file_exists (concat (command_root, "/preclean.req", NULL)));
|
||||||
|
+ file_exists (concat (command_root, "/preclean.req", NULL)), 0);
|
||||||
|
|
||||||
|
if (stat (command_root, &st) >= 0
|
||||||
|
&& S_ISDIR (st.st_mode))
|
||||||
|
- rsync (command_root, new_root_path, 0);
|
||||||
|
+ rsync (command_root, new_root_path, 0, 1);
|
||||||
|
|
||||||
|
new_objdir_path = xstrdup (concat (new_root_path,
|
||||||
|
support_objdir_root, NULL));
|
||||||
|
@@ -1044,7 +1045,7 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
|
/* Child has exited, we can post-clean the test root. */
|
||||||
|
printf("running post-clean rsync\n");
|
||||||
|
- rsync (pristine_root_path, new_root_path, 1);
|
||||||
|
+ rsync (pristine_root_path, new_root_path, 1, 0);
|
||||||
|
|
||||||
|
if (WIFEXITED (status))
|
||||||
|
exit (WEXITSTATUS (status));
|
24
glibc.spec
24
glibc.spec
@ -96,7 +96,7 @@
|
|||||||
Summary: The GNU libc libraries
|
Summary: The GNU libc libraries
|
||||||
Name: glibc
|
Name: glibc
|
||||||
Version: %{glibcversion}
|
Version: %{glibcversion}
|
||||||
Release: 4%{?dist}
|
Release: 5%{?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.
|
||||||
@ -165,6 +165,15 @@ Patch38: glibc-upstream-2.33-7.patch
|
|||||||
Patch39: glibc-upstream-2.33-8.patch
|
Patch39: glibc-upstream-2.33-8.patch
|
||||||
Patch40: glibc-upstream-2.33-9.patch
|
Patch40: glibc-upstream-2.33-9.patch
|
||||||
Patch41: glibc-upstream-2.33-10.patch
|
Patch41: glibc-upstream-2.33-10.patch
|
||||||
|
Patch42: glibc-upstream-2.33-11.patch
|
||||||
|
Patch43: glibc-upstream-2.33-12.patch
|
||||||
|
Patch44: glibc-upstream-2.33-13.patch
|
||||||
|
Patch45: glibc-upstream-2.33-14.patch
|
||||||
|
Patch46: glibc-upstream-2.33-15.patch
|
||||||
|
Patch47: glibc-upstream-2.33-16.patch
|
||||||
|
Patch48: glibc-upstream-2.33-17.patch
|
||||||
|
Patch49: glibc-upstream-2.33-18.patch
|
||||||
|
Patch50: glibc-upstream-2.33-19.patch
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Continued list of core "glibc" package information:
|
# Continued list of core "glibc" package information:
|
||||||
@ -2300,6 +2309,19 @@ fi
|
|||||||
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
|
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 16 2021 Florian Weimer <fweimer@redhat.com> - 2.33-5
|
||||||
|
- Import patches from the upstream glibc 2.33 branch, up to commit
|
||||||
|
db32fc27e7bdfb5468200a94e9152bcc1c971d25:
|
||||||
|
- test-container: Always copy test-specific support files [BZ #27537]
|
||||||
|
- nptl: Remove private futex optimization [BZ #27304]
|
||||||
|
- pthread_once hangs when init routine throws an exception [BZ #18435]
|
||||||
|
- elf: ld.so --help calls _dl_init_paths without a main map (#1609351)
|
||||||
|
- elf: Always set l in _dl_init_paths (bug 23462)
|
||||||
|
- x86: Handle _SC_LEVEL1_ICACHE_LINESIZE [BZ #27444]
|
||||||
|
- io: Return EBAFD for negative file descriptor on fstat (BZ #27559)
|
||||||
|
- nscd: Fix double free in netgroupcache [BZ #27462]
|
||||||
|
- x86: Set minimum x86-64 level marker [BZ #27318]
|
||||||
|
|
||||||
* Thu Mar 4 2021 Florian Weimer <fweimer@redhat.com> - 2.33-4
|
* Thu Mar 4 2021 Florian Weimer <fweimer@redhat.com> - 2.33-4
|
||||||
- Import patch from the upstream glibc 2.33 branch, up to commit
|
- Import patch from the upstream glibc 2.33 branch, up to commit
|
||||||
3e880d733753183696d1a81c34caef3a9add2b0c.
|
3e880d733753183696d1a81c34caef3a9add2b0c.
|
||||||
|
Loading…
Reference in New Issue
Block a user