upgrade glibc from 2.31-9 to 2.33-1
This commit is contained in:
parent
da501e53af
commit
51bddc616d
@ -1,126 +0,0 @@
|
|||||||
From 9f997ceca28f0634ad78a1ca95b84265f7801ff4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joseph Myers <joseph@codesourcery.com>
|
|
||||||
Date: Wed, 12 Feb 2020 23:31:56 +0000
|
|
||||||
Subject: [PATCH] Avoid ldbl-96 stack corruption from range reduction of
|
|
||||||
pseudo-zero (bug 25487).
|
|
||||||
|
|
||||||
Bug 25487 reports stack corruption in ldbl-96 sinl on a pseudo-zero
|
|
||||||
argument (an representation where all the significand bits, including
|
|
||||||
the explicit high bit, are zero, but the exponent is not zero, which
|
|
||||||
is not a valid representation for the long double type).
|
|
||||||
|
|
||||||
Although this is not a valid long double representation, existing
|
|
||||||
practice in this area (see bug 4586, originally marked invalid but
|
|
||||||
subsequently fixed) is that we still seek to avoid invalid memory
|
|
||||||
accesses as a result, in case of programs that treat arbitrary binary
|
|
||||||
data as long double representations, although the invalid
|
|
||||||
representations of the ldbl-96 format do not need to be consistently
|
|
||||||
handled the same as any particular valid representation.
|
|
||||||
|
|
||||||
This patch makes the range reduction detect pseudo-zero and unnormal
|
|
||||||
representations that would otherwise go to __kernel_rem_pio2, and
|
|
||||||
returns a NaN for them instead of continuing with the range reduction
|
|
||||||
process. (Pseudo-zero and unnormal representations whose unbiased
|
|
||||||
exponent is less than -1 have already been safely returned from the
|
|
||||||
function before this point without going through the rest of range
|
|
||||||
reduction.) Pseudo-zero representations would previously result in
|
|
||||||
the value passed to __kernel_rem_pio2 being all-zero, which is
|
|
||||||
definitely unsafe; unnormal representations would previously result in
|
|
||||||
a value passed whose high bit is zero, which might well be unsafe
|
|
||||||
since that is not a form of input expected by __kernel_rem_pio2.
|
|
||||||
|
|
||||||
Tested for x86_64.
|
|
||||||
|
|
||||||
(cherry picked from commit 9333498794cde1d5cca518badf79533a24114b6f)
|
|
||||||
---
|
|
||||||
sysdeps/ieee754/ldbl-96/Makefile | 3 ++-
|
|
||||||
sysdeps/ieee754/ldbl-96/e_rem_pio2l.c | 12 +++++++++
|
|
||||||
sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c | 41 ++++++++++++++++++++++++++++++
|
|
||||||
4 files changed, 60 insertions(+), 1 deletion(-)
|
|
||||||
create mode 100644 sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
|
|
||||||
|
|
||||||
diff --git a/sysdeps/ieee754/ldbl-96/Makefile b/sysdeps/ieee754/ldbl-96/Makefile
|
|
||||||
index 995e90d..318628a 100644
|
|
||||||
--- a/sysdeps/ieee754/ldbl-96/Makefile
|
|
||||||
+++ b/sysdeps/ieee754/ldbl-96/Makefile
|
|
||||||
@@ -17,5 +17,6 @@
|
|
||||||
# <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ifeq ($(subdir),math)
|
|
||||||
-tests += test-canonical-ldbl-96 test-totalorderl-ldbl-96
|
|
||||||
+tests += test-canonical-ldbl-96 test-totalorderl-ldbl-96 test-sinl-pseudo
|
|
||||||
+CFLAGS-test-sinl-pseudo.c += -fstack-protector-all
|
|
||||||
endif
|
|
||||||
diff --git a/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c b/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
|
|
||||||
index 5f74232..bcdf201 100644
|
|
||||||
--- a/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
|
|
||||||
+++ b/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
|
|
||||||
@@ -210,6 +210,18 @@ __ieee754_rem_pio2l (long double x, long double *y)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if ((i0 & 0x80000000) == 0)
|
|
||||||
+ {
|
|
||||||
+ /* Pseudo-zero and unnormal representations are not valid
|
|
||||||
+ representations of long double. We need to avoid stack
|
|
||||||
+ corruption in __kernel_rem_pio2, which expects input in a
|
|
||||||
+ particular normal form, but those representations do not need
|
|
||||||
+ to be consistently handled like any particular floating-point
|
|
||||||
+ value. */
|
|
||||||
+ y[1] = y[0] = __builtin_nanl ("");
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/* Split the 64 bits of the mantissa into three 24-bit integers
|
|
||||||
stored in a double array. */
|
|
||||||
exp = j0 - 23;
|
|
||||||
diff --git a/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c b/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..f59b977
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
|
|
||||||
@@ -0,0 +1,41 @@
|
|
||||||
+/* Test sinl for pseudo-zeros and unnormals for ldbl-96 (bug 25487).
|
|
||||||
+ Copyright (C) 2020 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 <math.h>
|
|
||||||
+#include <math_ldbl.h>
|
|
||||||
+#include <stdint.h>
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
+do_test (void)
|
|
||||||
+{
|
|
||||||
+ for (int i = 0; i < 64; i++)
|
|
||||||
+ {
|
|
||||||
+ uint64_t sig = i == 63 ? 0 : 1ULL << i;
|
|
||||||
+ long double ld;
|
|
||||||
+ SET_LDOUBLE_WORDS (ld, 0x4141,
|
|
||||||
+ sig >> 32, sig & 0xffffffffULL);
|
|
||||||
+ /* The requirement is that no stack overflow occurs when the
|
|
||||||
+ pseudo-zero or unnormal goes through range reduction. */
|
|
||||||
+ volatile long double ldr;
|
|
||||||
+ ldr = sinl (ld);
|
|
||||||
+ (void) ldr;
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#include <support/test-driver.c>
|
|
||||||
--
|
|
||||||
2.7.4
|
|
||||||
|
|
||||||
@ -1,104 +0,0 @@
|
|||||||
From 04726be814c6fd6d9cf974e15d684dd3ac1a180e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Arjun Shankar <arjun@redhat.com>
|
|
||||||
Date: Thu, 23 Jul 2020 12:20:38 +0200
|
|
||||||
Subject: [PATCH] Disable warnings due to deprecated libselinux symbols used by
|
|
||||||
nss and nscd
|
|
||||||
|
|
||||||
The SELinux API deprecated several symbols in its 3.1 release, including
|
|
||||||
security_context_t, matchpathcon, avc_init, and sidput, which are used in
|
|
||||||
makedb and nscd. While the usage of these should eventually be replaced by
|
|
||||||
newer interfaces, this commit disables GCC warnings due to the use of the
|
|
||||||
above symbols.
|
|
||||||
|
|
||||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
||||||
Tested-by: Carlos O'Donell <carlos@redhat.com>
|
|
||||||
---
|
|
||||||
nscd/selinux.c | 15 +++++++++++++++
|
|
||||||
nss/makedb.c | 9 +++++++++
|
|
||||||
2 files changed, 24 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/nscd/selinux.c b/nscd/selinux.c
|
|
||||||
index a4ea8008e2..1ebf924826 100644
|
|
||||||
--- a/nscd/selinux.c
|
|
||||||
+++ b/nscd/selinux.c
|
|
||||||
@@ -33,6 +33,7 @@
|
|
||||||
#ifdef HAVE_LIBAUDIT
|
|
||||||
# include <libaudit.h>
|
|
||||||
#endif
|
|
||||||
+#include <libc-diag.h>
|
|
||||||
|
|
||||||
#include "dbg_log.h"
|
|
||||||
#include "selinux.h"
|
|
||||||
@@ -320,6 +321,12 @@ avc_free_lock (void *lock)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+/* avc_init (along with several other symbols) was marked as deprecated by the
|
|
||||||
+ SELinux API starting from version 3.1. We use it here, but should
|
|
||||||
+ eventually switch to the newer API. */
|
|
||||||
+DIAG_PUSH_NEEDS_COMMENT
|
|
||||||
+DIAG_IGNORE_NEEDS_COMMENT (10, "-Wdeprecated-declarations");
|
|
||||||
+
|
|
||||||
/* Initialize the user space access vector cache (AVC) for NSCD along with
|
|
||||||
log/thread/lock callbacks. */
|
|
||||||
void
|
|
||||||
@@ -335,7 +342,14 @@ nscd_avc_init (void)
|
|
||||||
audit_init ();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
+DIAG_POP_NEEDS_COMMENT
|
|
||||||
+
|
|
||||||
|
|
||||||
+/* security_context_t and sidput (along with several other symbols) were marked
|
|
||||||
+ as deprecated by the SELinux API starting from version 3.1. We use them
|
|
||||||
+ here, but should eventually switch to the newer API. */
|
|
||||||
+DIAG_PUSH_NEEDS_COMMENT
|
|
||||||
+DIAG_IGNORE_NEEDS_COMMENT (10, "-Wdeprecated-declarations");
|
|
||||||
|
|
||||||
/* Check the permission from the caller (via getpeercon) to nscd.
|
|
||||||
Returns 0 if access is allowed, 1 if denied, and -1 on error.
|
|
||||||
@@ -422,6 +436,7 @@ out:
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
+DIAG_POP_NEEDS_COMMENT
|
|
||||||
|
|
||||||
|
|
||||||
/* Wrapper to get AVC statistics. */
|
|
||||||
diff --git a/nss/makedb.c b/nss/makedb.c
|
|
||||||
index 8e389a1683..8e1e8ec9ad 100644
|
|
||||||
--- a/nss/makedb.c
|
|
||||||
+++ b/nss/makedb.c
|
|
||||||
@@ -38,6 +38,7 @@
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/uio.h>
|
|
||||||
#include "nss_db/nss_db.h"
|
|
||||||
+#include <libc-diag.h>
|
|
||||||
|
|
||||||
/* Get libc version number. */
|
|
||||||
#include "../version.h"
|
|
||||||
@@ -841,6 +842,13 @@ print_database (int fd)
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_SELINUX
|
|
||||||
+
|
|
||||||
+/* security_context_t and matchpathcon (along with several other symbols) were
|
|
||||||
+ marked as deprecated by the SELinux API starting from version 3.1. We use
|
|
||||||
+ them here, but should eventually switch to the newer API. */
|
|
||||||
+DIAG_PUSH_NEEDS_COMMENT
|
|
||||||
+DIAG_IGNORE_NEEDS_COMMENT (10, "-Wdeprecated-declarations");
|
|
||||||
+
|
|
||||||
static void
|
|
||||||
set_file_creation_context (const char *outname, mode_t mode)
|
|
||||||
{
|
|
||||||
@@ -870,6 +878,7 @@ set_file_creation_context (const char *outname, mode_t mode)
|
|
||||||
freecon (ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+DIAG_POP_NEEDS_COMMENT
|
|
||||||
|
|
||||||
static void
|
|
||||||
reset_file_creation_context (void)
|
|
||||||
--
|
|
||||||
2.23.0
|
|
||||||
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
From 9a99c682144bdbd40792ebf822fe9264e0376fb5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Arjun Shankar <arjun@redhat.com>
|
|
||||||
Date: Wed, 4 Nov 2020 12:19:38 +0100
|
|
||||||
Subject: [PATCH] iconv: Accept redundant shift sequences in IBM1364 [BZ
|
|
||||||
#26224]
|
|
||||||
|
|
||||||
The IBM1364, IBM1371, IBM1388, IBM1390 and IBM1399 character sets
|
|
||||||
share converter logic (iconvdata/ibm1364.c) which would reject
|
|
||||||
redundant shift sequences when processing input in these character
|
|
||||||
sets. This led to a hang in the iconv program (CVE-2020-27618).
|
|
||||||
|
|
||||||
This commit adjusts the converter to ignore redundant shift sequences
|
|
||||||
and adds test cases for iconv_prog hangs that would be triggered upon
|
|
||||||
their rejection. This brings the implementation in line with other
|
|
||||||
converters that also ignore redundant shift sequences (e.g. IBM930
|
|
||||||
etc., fixed in commit 692de4b3960d).
|
|
||||||
|
|
||||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
||||||
---
|
|
||||||
iconvdata/ibm1364.c | 14 ++------------
|
|
||||||
1 files changed, 2 insertions(+), 12 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/iconvdata/ibm1364.c b/iconvdata/ibm1364.c
|
|
||||||
index 49e7267ab45..521f0825b7f 100644
|
|
||||||
--- a/iconvdata/ibm1364.c
|
|
||||||
+++ b/iconvdata/ibm1364.c
|
|
||||||
@@ -158,24 +158,14 @@ enum
|
|
||||||
\
|
|
||||||
if (__builtin_expect (ch, 0) == SO) \
|
|
||||||
{ \
|
|
||||||
- /* Shift OUT, change to DBCS converter. */ \
|
|
||||||
- if (curcs == db) \
|
|
||||||
- { \
|
|
||||||
- result = __GCONV_ILLEGAL_INPUT; \
|
|
||||||
- break; \
|
|
||||||
- } \
|
|
||||||
+ /* Shift OUT, change to DBCS converter (redundant escape okay). */ \
|
|
||||||
curcs = db; \
|
|
||||||
++inptr; \
|
|
||||||
continue; \
|
|
||||||
} \
|
|
||||||
if (__builtin_expect (ch, 0) == SI) \
|
|
||||||
{ \
|
|
||||||
- /* Shift IN, change to SBCS converter. */ \
|
|
||||||
- if (curcs == sb) \
|
|
||||||
- { \
|
|
||||||
- result = __GCONV_ILLEGAL_INPUT; \
|
|
||||||
- break; \
|
|
||||||
- } \
|
|
||||||
+ /* Shift IN, change to SBCS converter (redundant escape okay). */ \
|
|
||||||
curcs = sb; \
|
|
||||||
++inptr; \
|
|
||||||
continue; \
|
|
||||||
--
|
|
||||||
2.25.1
|
|
||||||
|
|
||||||
@ -1,189 +0,0 @@
|
|||||||
From 79a4fa341b8a89cb03f84564fd72abaa1a2db394 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Evgeny Eremin <e.eremin@omprussia.ru>
|
|
||||||
Date: Wed, 8 Jul 2020 14:18:19 +0200
|
|
||||||
Subject: [PATCH] arm: CVE-2020-6096: fix memcpy and memmove for negative
|
|
||||||
length [BZ #25620]
|
|
||||||
|
|
||||||
Unsigned branch instructions could be used for r2 to fix the wrong
|
|
||||||
behavior when a negative length is passed to memcpy and memmove.
|
|
||||||
This commit fixes the generic arm implementation of memcpy amd memmove.
|
|
||||||
---
|
|
||||||
sysdeps/arm/memcpy.S | 24 ++++++++++--------------
|
|
||||||
sysdeps/arm/memmove.S | 24 ++++++++++--------------
|
|
||||||
2 files changed, 20 insertions(+), 28 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sysdeps/arm/memcpy.S b/sysdeps/arm/memcpy.S
|
|
||||||
index 510e8adaf2..bcfbc51d99 100644
|
|
||||||
--- a/sysdeps/arm/memcpy.S
|
|
||||||
+++ b/sysdeps/arm/memcpy.S
|
|
||||||
@@ -68,7 +68,7 @@ ENTRY(memcpy)
|
|
||||||
cfi_remember_state
|
|
||||||
|
|
||||||
subs r2, r2, #4
|
|
||||||
- blt 8f
|
|
||||||
+ blo 8f
|
|
||||||
ands ip, r0, #3
|
|
||||||
PLD( pld [r1, #0] )
|
|
||||||
bne 9f
|
|
||||||
@@ -82,7 +82,7 @@ ENTRY(memcpy)
|
|
||||||
cfi_rel_offset (r6, 4)
|
|
||||||
cfi_rel_offset (r7, 8)
|
|
||||||
cfi_rel_offset (r8, 12)
|
|
||||||
- blt 5f
|
|
||||||
+ blo 5f
|
|
||||||
|
|
||||||
CALGN( ands ip, r1, #31 )
|
|
||||||
CALGN( rsb r3, ip, #32 )
|
|
||||||
@@ -98,9 +98,9 @@ ENTRY(memcpy)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PLD( pld [r1, #0] )
|
|
||||||
-2: PLD( subs r2, r2, #96 )
|
|
||||||
+2: PLD( cmp r2, #96 )
|
|
||||||
PLD( pld [r1, #28] )
|
|
||||||
- PLD( blt 4f )
|
|
||||||
+ PLD( blo 4f )
|
|
||||||
PLD( pld [r1, #60] )
|
|
||||||
PLD( pld [r1, #92] )
|
|
||||||
|
|
||||||
@@ -108,9 +108,7 @@ ENTRY(memcpy)
|
|
||||||
4: ldmia r1!, {r3, r4, r5, r6, r7, r8, ip, lr}
|
|
||||||
subs r2, r2, #32
|
|
||||||
stmia r0!, {r3, r4, r5, r6, r7, r8, ip, lr}
|
|
||||||
- bge 3b
|
|
||||||
- PLD( cmn r2, #96 )
|
|
||||||
- PLD( bge 4b )
|
|
||||||
+ bhs 3b
|
|
||||||
|
|
||||||
5: ands ip, r2, #28
|
|
||||||
rsb ip, ip, #32
|
|
||||||
@@ -222,7 +220,7 @@ ENTRY(memcpy)
|
|
||||||
strbge r4, [r0], #1
|
|
||||||
subs r2, r2, ip
|
|
||||||
strb lr, [r0], #1
|
|
||||||
- blt 8b
|
|
||||||
+ blo 8b
|
|
||||||
ands ip, r1, #3
|
|
||||||
beq 1b
|
|
||||||
|
|
||||||
@@ -236,7 +234,7 @@ ENTRY(memcpy)
|
|
||||||
.macro forward_copy_shift pull push
|
|
||||||
|
|
||||||
subs r2, r2, #28
|
|
||||||
- blt 14f
|
|
||||||
+ blo 14f
|
|
||||||
|
|
||||||
CALGN( ands ip, r1, #31 )
|
|
||||||
CALGN( rsb ip, ip, #32 )
|
|
||||||
@@ -253,9 +251,9 @@ ENTRY(memcpy)
|
|
||||||
cfi_rel_offset (r10, 16)
|
|
||||||
|
|
||||||
PLD( pld [r1, #0] )
|
|
||||||
- PLD( subs r2, r2, #96 )
|
|
||||||
+ PLD( cmp r2, #96 )
|
|
||||||
PLD( pld [r1, #28] )
|
|
||||||
- PLD( blt 13f )
|
|
||||||
+ PLD( blo 13f )
|
|
||||||
PLD( pld [r1, #60] )
|
|
||||||
PLD( pld [r1, #92] )
|
|
||||||
|
|
||||||
@@ -280,9 +278,7 @@ ENTRY(memcpy)
|
|
||||||
mov ip, ip, PULL #\pull
|
|
||||||
orr ip, ip, lr, PUSH #\push
|
|
||||||
stmia r0!, {r3, r4, r5, r6, r7, r8, r10, ip}
|
|
||||||
- bge 12b
|
|
||||||
- PLD( cmn r2, #96 )
|
|
||||||
- PLD( bge 13b )
|
|
||||||
+ bhs 12b
|
|
||||||
|
|
||||||
pop {r5 - r8, r10}
|
|
||||||
cfi_adjust_cfa_offset (-20)
|
|
||||||
diff --git a/sysdeps/arm/memmove.S b/sysdeps/arm/memmove.S
|
|
||||||
index 954037ef3a..0d07b76ee6 100644
|
|
||||||
--- a/sysdeps/arm/memmove.S
|
|
||||||
+++ b/sysdeps/arm/memmove.S
|
|
||||||
@@ -85,7 +85,7 @@ ENTRY(memmove)
|
|
||||||
add r1, r1, r2
|
|
||||||
add r0, r0, r2
|
|
||||||
subs r2, r2, #4
|
|
||||||
- blt 8f
|
|
||||||
+ blo 8f
|
|
||||||
ands ip, r0, #3
|
|
||||||
PLD( pld [r1, #-4] )
|
|
||||||
bne 9f
|
|
||||||
@@ -99,7 +99,7 @@ ENTRY(memmove)
|
|
||||||
cfi_rel_offset (r6, 4)
|
|
||||||
cfi_rel_offset (r7, 8)
|
|
||||||
cfi_rel_offset (r8, 12)
|
|
||||||
- blt 5f
|
|
||||||
+ blo 5f
|
|
||||||
|
|
||||||
CALGN( ands ip, r1, #31 )
|
|
||||||
CALGN( sbcsne r4, ip, r2 ) @ C is always set here
|
|
||||||
@@ -114,9 +114,9 @@ ENTRY(memmove)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PLD( pld [r1, #-4] )
|
|
||||||
-2: PLD( subs r2, r2, #96 )
|
|
||||||
+2: PLD( cmp r2, #96 )
|
|
||||||
PLD( pld [r1, #-32] )
|
|
||||||
- PLD( blt 4f )
|
|
||||||
+ PLD( blo 4f )
|
|
||||||
PLD( pld [r1, #-64] )
|
|
||||||
PLD( pld [r1, #-96] )
|
|
||||||
|
|
||||||
@@ -124,9 +124,7 @@ ENTRY(memmove)
|
|
||||||
4: ldmdb r1!, {r3, r4, r5, r6, r7, r8, ip, lr}
|
|
||||||
subs r2, r2, #32
|
|
||||||
stmdb r0!, {r3, r4, r5, r6, r7, r8, ip, lr}
|
|
||||||
- bge 3b
|
|
||||||
- PLD( cmn r2, #96 )
|
|
||||||
- PLD( bge 4b )
|
|
||||||
+ bhs 3b
|
|
||||||
|
|
||||||
5: ands ip, r2, #28
|
|
||||||
rsb ip, ip, #32
|
|
||||||
@@ -237,7 +235,7 @@ ENTRY(memmove)
|
|
||||||
strbge r4, [r0, #-1]!
|
|
||||||
subs r2, r2, ip
|
|
||||||
strb lr, [r0, #-1]!
|
|
||||||
- blt 8b
|
|
||||||
+ blo 8b
|
|
||||||
ands ip, r1, #3
|
|
||||||
beq 1b
|
|
||||||
|
|
||||||
@@ -251,7 +249,7 @@ ENTRY(memmove)
|
|
||||||
.macro backward_copy_shift push pull
|
|
||||||
|
|
||||||
subs r2, r2, #28
|
|
||||||
- blt 14f
|
|
||||||
+ blo 14f
|
|
||||||
|
|
||||||
CALGN( ands ip, r1, #31 )
|
|
||||||
CALGN( rsb ip, ip, #32 )
|
|
||||||
@@ -268,9 +266,9 @@ ENTRY(memmove)
|
|
||||||
cfi_rel_offset (r10, 16)
|
|
||||||
|
|
||||||
PLD( pld [r1, #-4] )
|
|
||||||
- PLD( subs r2, r2, #96 )
|
|
||||||
+ PLD( cmp r2, #96 )
|
|
||||||
PLD( pld [r1, #-32] )
|
|
||||||
- PLD( blt 13f )
|
|
||||||
+ PLD( blo 13f )
|
|
||||||
PLD( pld [r1, #-64] )
|
|
||||||
PLD( pld [r1, #-96] )
|
|
||||||
|
|
||||||
@@ -295,9 +293,7 @@ ENTRY(memmove)
|
|
||||||
mov r4, r4, PUSH #\push
|
|
||||||
orr r4, r4, r3, PULL #\pull
|
|
||||||
stmdb r0!, {r4 - r8, r10, ip, lr}
|
|
||||||
- bge 12b
|
|
||||||
- PLD( cmn r2, #96 )
|
|
||||||
- PLD( bge 13b )
|
|
||||||
+ bhs 12b
|
|
||||||
|
|
||||||
pop {r5 - r8, r10}
|
|
||||||
cfi_adjust_cfa_offset (-20)
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -1,107 +0,0 @@
|
|||||||
From beea361050728138b82c57dda0c4810402d342b9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Alexander Anisimov <a.anisimov@omprussia.ru>
|
|
||||||
Date: Wed, 8 Jul 2020 14:18:31 +0200
|
|
||||||
Subject: [PATCH] arm: CVE-2020-6096: Fix multiarch memcpy for negative length
|
|
||||||
[BZ #25620]
|
|
||||||
|
|
||||||
Unsigned branch instructions could be used for r2 to fix the wrong
|
|
||||||
behavior when a negative length is passed to memcpy.
|
|
||||||
This commit fixes the armv7 version.
|
|
||||||
---
|
|
||||||
sysdeps/arm/armv7/multiarch/memcpy_impl.S | 22 +++++++++++-----------
|
|
||||||
1 file changed, 11 insertions(+), 11 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sysdeps/arm/armv7/multiarch/memcpy_impl.S b/sysdeps/arm/armv7/multiarch/memcpy_impl.S
|
|
||||||
index bf4ac7077f..379bb56fc9 100644
|
|
||||||
--- a/sysdeps/arm/armv7/multiarch/memcpy_impl.S
|
|
||||||
+++ b/sysdeps/arm/armv7/multiarch/memcpy_impl.S
|
|
||||||
@@ -268,7 +268,7 @@ ENTRY(memcpy)
|
|
||||||
|
|
||||||
mov dst, dstin /* Preserve dstin, we need to return it. */
|
|
||||||
cmp count, #64
|
|
||||||
- bge .Lcpy_not_short
|
|
||||||
+ bhs .Lcpy_not_short
|
|
||||||
/* Deal with small copies quickly by dropping straight into the
|
|
||||||
exit block. */
|
|
||||||
|
|
||||||
@@ -351,10 +351,10 @@ ENTRY(memcpy)
|
|
||||||
|
|
||||||
1:
|
|
||||||
subs tmp2, count, #64 /* Use tmp2 for count. */
|
|
||||||
- blt .Ltail63aligned
|
|
||||||
+ blo .Ltail63aligned
|
|
||||||
|
|
||||||
cmp tmp2, #512
|
|
||||||
- bge .Lcpy_body_long
|
|
||||||
+ bhs .Lcpy_body_long
|
|
||||||
|
|
||||||
.Lcpy_body_medium: /* Count in tmp2. */
|
|
||||||
#ifdef USE_VFP
|
|
||||||
@@ -378,7 +378,7 @@ ENTRY(memcpy)
|
|
||||||
add src, src, #64
|
|
||||||
vstr d1, [dst, #56]
|
|
||||||
add dst, dst, #64
|
|
||||||
- bge 1b
|
|
||||||
+ bhs 1b
|
|
||||||
tst tmp2, #0x3f
|
|
||||||
beq .Ldone
|
|
||||||
|
|
||||||
@@ -412,7 +412,7 @@ ENTRY(memcpy)
|
|
||||||
ldrd A_l, A_h, [src, #64]!
|
|
||||||
strd A_l, A_h, [dst, #64]!
|
|
||||||
subs tmp2, tmp2, #64
|
|
||||||
- bge 1b
|
|
||||||
+ bhs 1b
|
|
||||||
tst tmp2, #0x3f
|
|
||||||
bne 1f
|
|
||||||
ldr tmp2,[sp], #FRAME_SIZE
|
|
||||||
@@ -482,7 +482,7 @@ ENTRY(memcpy)
|
|
||||||
add src, src, #32
|
|
||||||
|
|
||||||
subs tmp2, tmp2, #prefetch_lines * 64 * 2
|
|
||||||
- blt 2f
|
|
||||||
+ blo 2f
|
|
||||||
1:
|
|
||||||
cpy_line_vfp d3, 0
|
|
||||||
cpy_line_vfp d4, 64
|
|
||||||
@@ -494,7 +494,7 @@ ENTRY(memcpy)
|
|
||||||
add dst, dst, #2 * 64
|
|
||||||
add src, src, #2 * 64
|
|
||||||
subs tmp2, tmp2, #prefetch_lines * 64
|
|
||||||
- bge 1b
|
|
||||||
+ bhs 1b
|
|
||||||
|
|
||||||
2:
|
|
||||||
cpy_tail_vfp d3, 0
|
|
||||||
@@ -615,8 +615,8 @@ ENTRY(memcpy)
|
|
||||||
1:
|
|
||||||
pld [src, #(3 * 64)]
|
|
||||||
subs count, count, #64
|
|
||||||
- ldrmi tmp2, [sp], #FRAME_SIZE
|
|
||||||
- bmi .Ltail63unaligned
|
|
||||||
+ ldrlo tmp2, [sp], #FRAME_SIZE
|
|
||||||
+ blo .Ltail63unaligned
|
|
||||||
pld [src, #(4 * 64)]
|
|
||||||
|
|
||||||
#ifdef USE_NEON
|
|
||||||
@@ -633,7 +633,7 @@ ENTRY(memcpy)
|
|
||||||
neon_load_multi d0-d3, src
|
|
||||||
neon_load_multi d4-d7, src
|
|
||||||
subs count, count, #64
|
|
||||||
- bmi 2f
|
|
||||||
+ blo 2f
|
|
||||||
1:
|
|
||||||
pld [src, #(4 * 64)]
|
|
||||||
neon_store_multi d0-d3, dst
|
|
||||||
@@ -641,7 +641,7 @@ ENTRY(memcpy)
|
|
||||||
neon_store_multi d4-d7, dst
|
|
||||||
neon_load_multi d4-d7, src
|
|
||||||
subs count, count, #64
|
|
||||||
- bpl 1b
|
|
||||||
+ bhs 1b
|
|
||||||
2:
|
|
||||||
neon_store_multi d0-d3, dst
|
|
||||||
neon_store_multi d4-d7, dst
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
From 75870237ff3bb363447b03f4b0af100227570910 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sunil K Pandey <skpgkp1@gmail.com>
|
|
||||||
Date: Fri, 12 Jun 2020 08:57:16 -0700
|
|
||||||
Subject: [PATCH] Fix avx2 strncmp offset compare condition check [BZ #25933]
|
|
||||||
|
|
||||||
strcmp-avx2.S: In avx2 strncmp function, strings are compared in
|
|
||||||
chunks of 4 vector size(i.e. 32x4=128 byte for avx2). After first 4
|
|
||||||
vector size comparison, code must check whether it already passed
|
|
||||||
the given offset. This patch implement avx2 offset check condition
|
|
||||||
for strncmp function, if both string compare same for first 4 vector
|
|
||||||
size.
|
|
||||||
---
|
|
||||||
sysdeps/x86_64/multiarch/strcmp-avx2.S | 15 +++++++++++++++
|
|
||||||
1 file changed, 15 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
|
||||||
index 5f88a68262..d42b04b54f 100644
|
|
||||||
--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
|
||||||
+++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
|
||||||
@@ -591,7 +591,14 @@ L(loop_cross_page_2_vec):
|
|
||||||
movl $(PAGE_SIZE / (VEC_SIZE * 4) - 1), %esi
|
|
||||||
|
|
||||||
testq %rdi, %rdi
|
|
||||||
+# ifdef USE_AS_STRNCMP
|
|
||||||
+ /* At this point, if %rdi value is 0, it already tested
|
|
||||||
+ VEC_SIZE*4+%r10 byte starting from %rax. This label
|
|
||||||
+ checks whether strncmp maximum offset reached or not. */
|
|
||||||
+ je L(string_nbyte_offset_check)
|
|
||||||
+# else
|
|
||||||
je L(back_to_loop)
|
|
||||||
+# endif
|
|
||||||
tzcntq %rdi, %rcx
|
|
||||||
addq %r10, %rcx
|
|
||||||
/* Adjust for number of bytes skipped. */
|
|
||||||
@@ -627,6 +634,14 @@ L(loop_cross_page_2_vec):
|
|
||||||
VZEROUPPER
|
|
||||||
ret
|
|
||||||
|
|
||||||
+# ifdef USE_AS_STRNCMP
|
|
||||||
+L(string_nbyte_offset_check):
|
|
||||||
+ leaq (VEC_SIZE * 4)(%r10), %r10
|
|
||||||
+ cmpq %r10, %r11
|
|
||||||
+ jbe L(zero)
|
|
||||||
+ jmp L(back_to_loop)
|
|
||||||
+# endif
|
|
||||||
+
|
|
||||||
.p2align 4
|
|
||||||
L(cross_page_loop):
|
|
||||||
/* Check one byte/dword at a time. */
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
From ede56038e50235cd1ca7de3602c9491d3b84b49b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joseph Myers <joseph@codesourcery.com>
|
|
||||||
Date: Thu, 9 Jul 2020 21:51:49 +0000
|
|
||||||
Subject: [PATCH] Fix double free in __printf_fp_l (bug 26214).
|
|
||||||
|
|
||||||
__printf_fp_l has a double free bug in the case where it allocates
|
|
||||||
memory with malloc internally, then has an I/O error while outputting
|
|
||||||
trailing padding and tries to free that already-freed memory when the
|
|
||||||
error occurs. This patch fixes this by setting the relevant pointer
|
|
||||||
to NULL after the first free (the only free of this pointer that isn't
|
|
||||||
immediately followed by returning from the function).
|
|
||||||
|
|
||||||
note that this patch is parts of the origin one.
|
|
||||||
|
|
||||||
Tested for x86_64 and x86.
|
|
||||||
---
|
|
||||||
stdio-common/printf_fp.c | 3 +++
|
|
||||||
1 file changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
|
|
||||||
index 66ab59ba..c310eb8e 100644
|
|
||||||
--- a/stdio-common/printf_fp.c
|
|
||||||
+++ b/stdio-common/printf_fp.c
|
|
||||||
@@ -1250,6 +1250,9 @@ __printf_fp_l (FILE *fp, locale_t loc,
|
|
||||||
{
|
|
||||||
free (buffer);
|
|
||||||
free (wbuffer);
|
|
||||||
+ /* Avoid a double free if the subsequent PADN encounters an
|
|
||||||
+ I/O error. */
|
|
||||||
+ wbuffer = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.23.0
|
|
||||||
|
|
||||||
@ -1,87 +0,0 @@
|
|||||||
From 90663e9c814a919fa1fb41a878c06ef2fae58ed2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Joseph Myers <joseph@codesourcery.com>
|
|
||||||
Date: Thu, 9 Jul 2020 21:52:24 +0000
|
|
||||||
Subject: [PATCH] Fix memory leak in __printf_fp_l (bug 26215).
|
|
||||||
|
|
||||||
__printf_fp_l has a memory leak in the case of some I/O errors, where
|
|
||||||
both buffer and wbuffer have been malloced but the handling of I/O
|
|
||||||
errors only frees wbuffer. This patch fixes this by moving the
|
|
||||||
declaration of buffer to an outer scope and ensuring that it is freed
|
|
||||||
when wbuffer is freed.
|
|
||||||
|
|
||||||
note that this patch is parts of the origin one.
|
|
||||||
|
|
||||||
Tested for x86_64 and x86.
|
|
||||||
---
|
|
||||||
stdio-common/printf_fp.c | 20 +++++++++++++++-----
|
|
||||||
1 file changed, 15 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
|
|
||||||
index c310eb8e..b88e9cc6 100644
|
|
||||||
--- a/stdio-common/printf_fp.c
|
|
||||||
+++ b/stdio-common/printf_fp.c
|
|
||||||
@@ -72,7 +72,10 @@
|
|
||||||
if (putc (outc, fp) == EOF) \
|
|
||||||
{ \
|
|
||||||
if (buffer_malloced) \
|
|
||||||
- free (wbuffer); \
|
|
||||||
+ { \
|
|
||||||
+ free (buffer); \
|
|
||||||
+ free (wbuffer); \
|
|
||||||
+ } \
|
|
||||||
return -1; \
|
|
||||||
} \
|
|
||||||
++done; \
|
|
||||||
@@ -87,7 +90,10 @@
|
|
||||||
if (PUT (fp, wide ? (const char *) wptr : ptr, outlen) != outlen) \
|
|
||||||
{ \
|
|
||||||
if (buffer_malloced) \
|
|
||||||
- free (wbuffer); \
|
|
||||||
+ { \
|
|
||||||
+ free (buffer); \
|
|
||||||
+ free (wbuffer); \
|
|
||||||
+ } \
|
|
||||||
return -1; \
|
|
||||||
} \
|
|
||||||
ptr += outlen; \
|
|
||||||
@@ -110,7 +116,10 @@
|
|
||||||
if (PAD (fp, ch, len) != len) \
|
|
||||||
{ \
|
|
||||||
if (buffer_malloced) \
|
|
||||||
- free (wbuffer); \
|
|
||||||
+ { \
|
|
||||||
+ free (buffer); \
|
|
||||||
+ free (wbuffer); \
|
|
||||||
+ } \
|
|
||||||
return -1; \
|
|
||||||
} \
|
|
||||||
done += len; \
|
|
||||||
@@ -259,7 +268,8 @@ __printf_fp_l (FILE *fp, locale_t loc,
|
|
||||||
|
|
||||||
/* Buffer in which we produce the output. */
|
|
||||||
wchar_t *wbuffer = NULL;
|
|
||||||
- /* Flag whether wbuffer is malloc'ed or not. */
|
|
||||||
+ char *buffer = NULL;
|
|
||||||
+ /* Flag whether wbuffer and buffer are malloc'ed or not. */
|
|
||||||
int buffer_malloced = 0;
|
|
||||||
|
|
||||||
p.expsign = 0;
|
|
||||||
@@ -1172,7 +1182,6 @@ __printf_fp_l (FILE *fp, locale_t loc,
|
|
||||||
PADN ('0', width);
|
|
||||||
|
|
||||||
{
|
|
||||||
- char *buffer = NULL;
|
|
||||||
char *buffer_end = NULL;
|
|
||||||
char *cp = NULL;
|
|
||||||
char *tmpptr;
|
|
||||||
@@ -1252,6 +1261,7 @@ __printf_fp_l (FILE *fp, locale_t loc,
|
|
||||||
free (wbuffer);
|
|
||||||
/* Avoid a double free if the subsequent PADN encounters an
|
|
||||||
I/O error. */
|
|
||||||
+ buffer = NULL;
|
|
||||||
wbuffer = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.23.0
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,63 +0,0 @@
|
|||||||
From ddc650e9b3dc916eab417ce9f79e67337b05035c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Andreas Schwab <schwab@suse.de>
|
|
||||||
Date: Wed, 19 Feb 2020 17:21:46 +0100
|
|
||||||
Subject: [PATCH] Fix use-after-free in glob when expanding ~user (bug 25414)
|
|
||||||
|
|
||||||
The value of `end_name' points into the value of `dirname', thus don't
|
|
||||||
deallocate the latter before the last use of the former.
|
|
||||||
---
|
|
||||||
posix/glob.c | 25 +++++++++++++------------
|
|
||||||
1 file changed, 13 insertions(+), 12 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/posix/glob.c b/posix/glob.c
|
|
||||||
index cba9cd18198..4580cefb9fa 100644
|
|
||||||
--- a/posix/glob.c
|
|
||||||
+++ b/posix/glob.c
|
|
||||||
@@ -827,31 +827,32 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
|
|
||||||
{
|
|
||||||
size_t home_len = strlen (p->pw_dir);
|
|
||||||
size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
|
|
||||||
- char *d;
|
|
||||||
+ char *d, *newp;
|
|
||||||
+ bool use_alloca = glob_use_alloca (alloca_used,
|
|
||||||
+ home_len + rest_len + 1);
|
|
||||||
|
|
||||||
- if (__glibc_unlikely (malloc_dirname))
|
|
||||||
- free (dirname);
|
|
||||||
- malloc_dirname = 0;
|
|
||||||
-
|
|
||||||
- if (glob_use_alloca (alloca_used, home_len + rest_len + 1))
|
|
||||||
- dirname = alloca_account (home_len + rest_len + 1,
|
|
||||||
- alloca_used);
|
|
||||||
+ if (use_alloca)
|
|
||||||
+ newp = alloca_account (home_len + rest_len + 1, alloca_used);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
- dirname = malloc (home_len + rest_len + 1);
|
|
||||||
- if (dirname == NULL)
|
|
||||||
+ newp = malloc (home_len + rest_len + 1);
|
|
||||||
+ if (newp == NULL)
|
|
||||||
{
|
|
||||||
scratch_buffer_free (&pwtmpbuf);
|
|
||||||
retval = GLOB_NOSPACE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
- malloc_dirname = 1;
|
|
||||||
}
|
|
||||||
- d = mempcpy (dirname, p->pw_dir, home_len);
|
|
||||||
+ d = mempcpy (newp, p->pw_dir, home_len);
|
|
||||||
if (end_name != NULL)
|
|
||||||
d = mempcpy (d, end_name, rest_len);
|
|
||||||
*d = '\0';
|
|
||||||
|
|
||||||
+ if (__glibc_unlikely (malloc_dirname))
|
|
||||||
+ free (dirname);
|
|
||||||
+ dirname = newp;
|
|
||||||
+ malloc_dirname = !use_alloca;
|
|
||||||
+
|
|
||||||
dirlen = home_len + rest_len;
|
|
||||||
dirname_modified = 1;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -1,251 +0,0 @@
|
|||||||
From c580e6466d6da8262820cdbad19f32c5546226cf Mon Sep 17 00:00:00 2001
|
|
||||||
From: Carlos O'Donell <carlos@redhat.com>
|
|
||||||
Date: Fri, 27 Mar 2020 17:03:36 -0400
|
|
||||||
Subject: [PATCH] Reset converter state after second wchar_t output (Bug 25734)
|
|
||||||
|
|
||||||
An input BIG5-HKSCS character may be converted into at most 2 wchar_t
|
|
||||||
characters. After outputting the second whcar_t character (which was
|
|
||||||
saved in the converter state) we must reset the state. If we fail
|
|
||||||
to reset the state we will be stuck continually copying that
|
|
||||||
character to the output even if we have further input to consider.
|
|
||||||
|
|
||||||
We add a new test case that covers the 4 BIG5-HKSCS characters
|
|
||||||
that may become 2 wchar_t characters.
|
|
||||||
|
|
||||||
Reviewed-by: Tom Honermann <tom@honermann.net>
|
|
||||||
---
|
|
||||||
iconvdata/Makefile | 17 ++-
|
|
||||||
iconvdata/big5hkscs.c | 3 +
|
|
||||||
iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c | 160 ++++++++++++++++++++++
|
|
||||||
3 files changed, 176 insertions(+), 4 deletions(-)
|
|
||||||
create mode 100644 iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c
|
|
||||||
|
|
||||||
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
|
|
||||||
index c83962f351b..4ec2741cdce 100644
|
|
||||||
--- a/iconvdata/Makefile
|
|
||||||
+++ b/iconvdata/Makefile
|
|
||||||
@@ -73,7 +73,7 @@ modules.so := $(addsuffix .so, $(modules))
|
|
||||||
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
|
|
||||||
+ bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4
|
|
||||||
ifeq ($(have-thread-library),yes)
|
|
||||||
tests += bug-iconv3
|
|
||||||
endif
|
|
||||||
@@ -275,16 +275,21 @@ endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
-include ../Rules
|
|
||||||
-
|
|
||||||
ifeq ($(run-built-tests),yes)
|
|
||||||
-LOCALES := de_DE.UTF-8
|
|
||||||
+LOCALES := \
|
|
||||||
+ de_DE.UTF-8 \
|
|
||||||
+ zh_HK.BIG5-HKSCS \
|
|
||||||
+ $(NULL)
|
|
||||||
+
|
|
||||||
include ../gen-locales.mk
|
|
||||||
|
|
||||||
$(objpfx)bug-iconv6.out: $(gen-locales)
|
|
||||||
$(objpfx)tst-iconv7.out: $(gen-locales)
|
|
||||||
+$(objpfx)tst-iconv-big5-hkscs-to-2ucs4.out: $(gen-locales)
|
|
||||||
endif
|
|
||||||
|
|
||||||
+include ../Rules
|
|
||||||
+
|
|
||||||
# Set libof-* for each routine.
|
|
||||||
cpp-srcs-left := $(modules) $(generated-modules) $(libJIS-routines) \
|
|
||||||
$(libKSC-routines) $(libGB-routines) $(libCNS-routines) \
|
|
||||||
@@ -340,3 +345,7 @@ tst-tables-clean:
|
|
||||||
|
|
||||||
$(objpfx)gconv-modules: gconv-modules
|
|
||||||
cat $(sysdeps-gconv-modules) $^ > $@
|
|
||||||
+
|
|
||||||
+# Test requires BIG5HKSCS.
|
|
||||||
+$(objpfx)tst-iconv-big5-hkscs-to-2ucs4.out: $(objpfx)gconv-modules \
|
|
||||||
+ $(addprefix $(objpfx),$(modules.so))
|
|
||||||
diff --git a/iconvdata/big5hkscs.c b/iconvdata/big5hkscs.c
|
|
||||||
index 01fcfeba76b..ef325119b18 100644
|
|
||||||
--- a/iconvdata/big5hkscs.c
|
|
||||||
+++ b/iconvdata/big5hkscs.c
|
|
||||||
@@ -17895,6 +17895,9 @@ static struct
|
|
||||||
else \
|
|
||||||
++inptr; \
|
|
||||||
} \
|
|
||||||
+ else \
|
|
||||||
+ /* Clear the queue and proceed to output the saved character. */ \
|
|
||||||
+ *statep = 0; \
|
|
||||||
\
|
|
||||||
put32 (outptr, ch); \
|
|
||||||
outptr += 4; \
|
|
||||||
diff --git a/iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c b/iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000000..8389adebf27
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c
|
|
||||||
@@ -0,0 +1,160 @@
|
|
||||||
+/* Verify the BIG5HKSCS outputs that generate 2 wchar_t's (Bug 25734).
|
|
||||||
+ Copyright (C) 2020 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 <string.h>
|
|
||||||
+#include <locale.h>
|
|
||||||
+#include <wchar.h>
|
|
||||||
+#include <support/check.h>
|
|
||||||
+#include <support/support.h>
|
|
||||||
+
|
|
||||||
+/* A few BIG5-HKSCS characters map in two unicode code points.
|
|
||||||
+ They are:
|
|
||||||
+ /x88/x62 => <U00CA><U0304>
|
|
||||||
+ /x88/x64 => <U00CA><U030C>
|
|
||||||
+ /x88/xa3 => <U00EA><U0304>
|
|
||||||
+ /x88/xa5 => <U00EA><U030C>
|
|
||||||
+ Each of these is special cased in iconvdata/big5hkscs.c.
|
|
||||||
+ This test ensures that we correctly reset the shift state after
|
|
||||||
+ outputting any of these characters. We do this by converting
|
|
||||||
+ each them followed by converting an ASCII character. If we fail
|
|
||||||
+ to reset the shift state (bug 25734) then we'll see the last
|
|
||||||
+ character in the queue output again. */
|
|
||||||
+
|
|
||||||
+/* Each test has name, input bytes, and expected wide character
|
|
||||||
+ output. */
|
|
||||||
+struct testdata {
|
|
||||||
+ const char *name;
|
|
||||||
+ const char input[3];
|
|
||||||
+ wchar_t expected[3];
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/* In BIG5-HKSCS (2008) there are 4 characters that generate multiple
|
|
||||||
+ wide characters. */
|
|
||||||
+struct testdata tests[4] = {
|
|
||||||
+ /* <H-8862>X => <U+00CA><U+0304>X */
|
|
||||||
+ { "<H-8862>", "\x88\x62\x58", { 0x00CA, 0x0304, 0x0058 } },
|
|
||||||
+ /* <H-8864>X => <U+00CA><U+030C>X */
|
|
||||||
+ { "<H-8864>", "\x88\x64\x58", { 0x00CA, 0x030C, 0x0058 } },
|
|
||||||
+ /* <H-88A3>X => <U+00EA><U+0304>X */
|
|
||||||
+ { "<H-88A3>", "\x88\xa3\x58", { 0x00EA, 0x0304, 0x0058 } },
|
|
||||||
+ /* <H-88A5>X => <U+00EA><U+030C>X */
|
|
||||||
+ { "<H-88A5>", "\x88\xa5\x58", { 0x00EA, 0x030C, 0x0058 } }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/* Each test is of the form:
|
|
||||||
+ - Translate first code sequence (two bytes)
|
|
||||||
+ - Translate second (zero bytes)
|
|
||||||
+ - Translate the third (one byte). */
|
|
||||||
+static int
|
|
||||||
+check_conversion (struct testdata test)
|
|
||||||
+{
|
|
||||||
+ int err = 0;
|
|
||||||
+ wchar_t wc;
|
|
||||||
+ mbstate_t st;
|
|
||||||
+ size_t ret;
|
|
||||||
+ const char *mbs = test.input;
|
|
||||||
+ int consumed = 0;
|
|
||||||
+ /* Input is always 3 bytes long. */
|
|
||||||
+ int inlen = 3;
|
|
||||||
+
|
|
||||||
+ memset (&st, 0, sizeof (st));
|
|
||||||
+ /* First conversion: Consumes first 2 bytes. */
|
|
||||||
+ ret = mbrtowc (&wc, mbs, inlen - consumed, &st);
|
|
||||||
+ if (ret != 2)
|
|
||||||
+ {
|
|
||||||
+ printf ("error: First conversion consumed only %zd bytes.\n", ret);
|
|
||||||
+ err++;
|
|
||||||
+ }
|
|
||||||
+ /* Advance the two consumed bytes. */
|
|
||||||
+ mbs += ret;
|
|
||||||
+ consumed += ret;
|
|
||||||
+ if (wc != test.expected[0])
|
|
||||||
+ {
|
|
||||||
+ printf ("error: Result of first conversion was wrong.\n");
|
|
||||||
+ err++;
|
|
||||||
+ }
|
|
||||||
+ /* Second conversion: Consumes 0 bytes. */
|
|
||||||
+ ret = mbrtowc (&wc, mbs, inlen - consumed, &st);
|
|
||||||
+ if (ret != 0)
|
|
||||||
+ {
|
|
||||||
+ printf ("error: Second conversion consumed only %zd bytes.\n", ret);
|
|
||||||
+ err++;
|
|
||||||
+ }
|
|
||||||
+ /* Advance the zero consumed bytes. */
|
|
||||||
+ mbs += ret;
|
|
||||||
+ consumed += ret;
|
|
||||||
+ if (wc != test.expected[1])
|
|
||||||
+ {
|
|
||||||
+ printf ("error: Result of second conversion was wrong.\n");
|
|
||||||
+ err++;
|
|
||||||
+ }
|
|
||||||
+ /* After the second conversion the state of the converter should be
|
|
||||||
+ in the initial state. It is in the initial state because the two
|
|
||||||
+ input BIG5-HKSCS bytes have been consumed and the 2 wchar_t's have
|
|
||||||
+ been output. */
|
|
||||||
+ if (mbsinit (&st) == 0)
|
|
||||||
+ {
|
|
||||||
+ printf ("error: Converter not in initial state.\n");
|
|
||||||
+ err++;
|
|
||||||
+ }
|
|
||||||
+ /* Third conversion: Consumes 1 byte (it's an ASCII character). */
|
|
||||||
+ ret = mbrtowc (&wc, mbs, inlen - consumed, &st);
|
|
||||||
+ if (ret != 1)
|
|
||||||
+ {
|
|
||||||
+ printf ("error: Third conversion consumed only %zd bytes.\n", ret);
|
|
||||||
+ err++;
|
|
||||||
+ }
|
|
||||||
+ /* Advance the one byte. */
|
|
||||||
+ mbs += ret;
|
|
||||||
+ consumed += ret;
|
|
||||||
+ if (wc != test.expected[2])
|
|
||||||
+ {
|
|
||||||
+ printf ("error: Result of third conversion was wrong.\n");
|
|
||||||
+ err++;
|
|
||||||
+ }
|
|
||||||
+ /* Return 0 if we saw no errors. */
|
|
||||||
+ return err;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
+do_test (void)
|
|
||||||
+{
|
|
||||||
+ int err = 0;
|
|
||||||
+ int ret;
|
|
||||||
+ /* Testing BIG5-HKSCS. */
|
|
||||||
+ setlocale (LC_ALL, "zh_HK.BIG5-HKSCS");
|
|
||||||
+
|
|
||||||
+ /* Run all the special conversions. */
|
|
||||||
+ for (int i = 0; i < (sizeof (tests) / sizeof (struct testdata)); i++)
|
|
||||||
+ {
|
|
||||||
+ printf ("Running test for %s\n", tests[i].name);
|
|
||||||
+ ret = check_conversion (tests[i]);
|
|
||||||
+ if (ret > 0)
|
|
||||||
+ printf ("Test %s failed.\n", tests[i].name);
|
|
||||||
+ err += ret;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Fail if any conversion had an error. */
|
|
||||||
+ if (err > 0)
|
|
||||||
+ FAIL_EXIT1 ("One or more conversions failed.");
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#include <support/test-driver.c>
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
From a4efbf44757477717a907078c340386146c7623f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stafford Horne <shorne@gmail.com>
|
||||||
|
Date: Wed, 3 Feb 2021 15:36:47 -0300
|
||||||
|
Subject: [PATCH] posix/tst-rfc3484: Fix compile failure linking to local
|
||||||
|
__stat64
|
||||||
|
|
||||||
|
After 04986243d1 ("Remove internal usage of extensible stat functions")
|
||||||
|
linking the __stat64 symbol in getaddrinfo for this test fails with the
|
||||||
|
below error:
|
||||||
|
|
||||||
|
[...] or1k-smh-linux-gnu/bin/ld: [...]/posix/tst-rfc3484.o: in function `gaiconf_reload':
|
||||||
|
[...]/sysdeps/posix/getaddrinfo.c:2136: undefined reference to `__stat64'
|
||||||
|
collect2: error: ld returned 1 exit status
|
||||||
|
|
||||||
|
This is because __stat64 is a local symbol, the test includes the
|
||||||
|
getaddrinfo directly and fails to link against the local symbol. Fix
|
||||||
|
this by setting up an alias to the global stat64 symbol name like is
|
||||||
|
done for other local symbol usage.
|
||||||
|
|
||||||
|
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
---
|
||||||
|
posix/tst-rfc3484-2.c | 1 +
|
||||||
|
posix/tst-rfc3484-3.c | 1 +
|
||||||
|
posix/tst-rfc3484.c | 1 +
|
||||||
|
3 files changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c
|
||||||
|
index 5f5ada9420..ce8ccd5f38 100644
|
||||||
|
--- a/posix/tst-rfc3484-2.c
|
||||||
|
+++ b/posix/tst-rfc3484-2.c
|
||||||
|
@@ -11,6 +11,7 @@
|
||||||
|
#define __gethostbyaddr_r gethostbyaddr_r
|
||||||
|
#define __gethostbyname2_r gethostbyname2_r
|
||||||
|
#define __qsort_r qsort_r
|
||||||
|
+#define __stat64 stat64
|
||||||
|
|
||||||
|
void
|
||||||
|
attribute_hidden
|
||||||
|
diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c
|
||||||
|
index d9ec5cc851..ecb163963f 100644
|
||||||
|
--- a/posix/tst-rfc3484-3.c
|
||||||
|
+++ b/posix/tst-rfc3484-3.c
|
||||||
|
@@ -11,6 +11,7 @@
|
||||||
|
#define __gethostbyaddr_r gethostbyaddr_r
|
||||||
|
#define __gethostbyname2_r gethostbyname2_r
|
||||||
|
#define __qsort_r qsort_r
|
||||||
|
+#define __stat64 stat64
|
||||||
|
|
||||||
|
void
|
||||||
|
attribute_hidden
|
||||||
|
diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
|
||||||
|
index 97d065b6bf..3b2052eb54 100644
|
||||||
|
--- a/posix/tst-rfc3484.c
|
||||||
|
+++ b/posix/tst-rfc3484.c
|
||||||
|
@@ -11,6 +11,7 @@
|
||||||
|
#define __gethostbyaddr_r gethostbyaddr_r
|
||||||
|
#define __gethostbyname2_r gethostbyname2_r
|
||||||
|
#define __qsort_r qsort_r
|
||||||
|
+#define __stat64 stat64
|
||||||
|
|
||||||
|
void
|
||||||
|
attribute_hidden
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
@ -1,13 +1,71 @@
|
|||||||
From 808cf7c45e187c1889867ac83d047abfdf81c7a3 Mon Sep 17 00:00:00 2001
|
From 808cf7c45e187c1889867ac83d047abfdf81c7a3 Mon Sep 17 00:00:00 2001
|
||||||
From: root <root@localhost.localdomain>
|
From: xuhuijie <xuhuijie2@huawei.com>
|
||||||
Date: Fri, 14 Aug 2020 17:41:59 +0800
|
Date: Fri, 14 Aug 2020 17:41:59 +0800
|
||||||
Subject: [PATCH] performance degradation in multi-core scenarios, here is an
|
Subject: [PATCH] build extra lipthreadcond so
|
||||||
extra libpthreadcond.so using old version of the function. you can use it by
|
performance degradation in multi-core scenarios, here is an
|
||||||
adding LD_PRELOAD=./libpthreadcond.so in front of your program (eg:
|
extra libpthreadcond.so using old version of the function. you can use it by
|
||||||
LD_PRELOAD=./libpthreadcond.so ./test). use with-libpthreadcond to compile
|
adding LD_PRELOAD=./libpthreadcond.so in front of your program (eg:
|
||||||
it. warning:2.17 version does not meet the posix standard, you should pay
|
LD_PRELOAD=./libpthreadcond.so ./test). use with-libpthreadcond to compile
|
||||||
attention when using it.
|
it. warning:2.17 version does not meet the posix standard, you should pay
|
||||||
https://sourceware.org/git/?p=glibc.git;a=commit;h=ed19993b5b0d05d62cc883571519a67dae481a14
|
attention when using it.
|
||||||
|
https://sourceware.org/git/?p=glibc.git;a=commit;h=ed19993b5b0d05d62cc883571519a67dae481a14
|
||||||
|
|
||||||
|
---
|
||||||
|
nptl_2_17/Makefile | 52 +
|
||||||
|
nptl_2_17/bits/pthreadtypes_2_17.h | 121 ++
|
||||||
|
nptl_2_17/bits/thread-shared-types_2_17.h | 104 ++
|
||||||
|
nptl_2_17/build_libpthreadcondso.sh | 9 +
|
||||||
|
nptl_2_17/cancellation_2_17.c | 104 ++
|
||||||
|
nptl_2_17/cleanup_compat_2_17.c | 50 +
|
||||||
|
nptl_2_17/libpthreadcond-aarch64.map | 8 +
|
||||||
|
nptl_2_17/libpthreadcond-x86_64.map | 8 +
|
||||||
|
nptl_2_17/pthreadP_2_17.h | 620 +++++++++
|
||||||
|
nptl_2_17/pthread_2_17.h | 1173 ++++++++++++++++++
|
||||||
|
nptl_2_17/pthread_cond_broadcast_2_17.c | 94 ++
|
||||||
|
nptl_2_17/pthread_cond_destroy_2_17.c | 85 ++
|
||||||
|
nptl_2_17/pthread_cond_init_2_17.c | 50 +
|
||||||
|
nptl_2_17/pthread_cond_signal_2_17.c | 82 ++
|
||||||
|
nptl_2_17/pthread_cond_timedwait_2_17.c | 268 ++++
|
||||||
|
nptl_2_17/pthread_cond_wait_2_17.c | 231 ++++
|
||||||
|
nptl_2_17/pthread_condattr_getclock_2_17.c | 28 +
|
||||||
|
nptl_2_17/pthread_condattr_getpshared_2_17.c | 28 +
|
||||||
|
nptl_2_17/pthread_condattr_init_2_17.c | 34 +
|
||||||
|
nptl_2_17/pthread_condattr_setclock_2_17.c | 45 +
|
||||||
|
nptl_2_17/pthread_mutex_cond_lock_2_17.c | 21 +
|
||||||
|
nptl_2_17/pthread_mutex_lock_2_17.c | 628 ++++++++++
|
||||||
|
nptl_2_17/pthread_mutex_unlock_2_17.c | 360 ++++++
|
||||||
|
nptl_2_17/pthreadtypes_2_17.h | 179 +++
|
||||||
|
nptl_2_17/tpp_2_17.c | 195 +++
|
||||||
|
nptl_2_17/unwind_2_17.c | 138 +++
|
||||||
|
nptl_2_17/vars_2_17.c | 43 +
|
||||||
|
27 files changed, 4758 insertions(+)
|
||||||
|
create mode 100644 nptl_2_17/Makefile
|
||||||
|
create mode 100644 nptl_2_17/bits/pthreadtypes_2_17.h
|
||||||
|
create mode 100644 nptl_2_17/bits/thread-shared-types_2_17.h
|
||||||
|
create mode 100644 nptl_2_17/build_libpthreadcondso.sh
|
||||||
|
create mode 100644 nptl_2_17/cancellation_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/cleanup_compat_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/libpthreadcond-aarch64.map
|
||||||
|
create mode 100644 nptl_2_17/libpthreadcond-x86_64.map
|
||||||
|
create mode 100644 nptl_2_17/pthreadP_2_17.h
|
||||||
|
create mode 100644 nptl_2_17/pthread_2_17.h
|
||||||
|
create mode 100644 nptl_2_17/pthread_cond_broadcast_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_cond_destroy_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_cond_init_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_cond_signal_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_cond_timedwait_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_cond_wait_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_condattr_getclock_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_condattr_getpshared_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_condattr_init_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_condattr_setclock_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_mutex_cond_lock_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_mutex_lock_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthread_mutex_unlock_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/pthreadtypes_2_17.h
|
||||||
|
create mode 100644 nptl_2_17/tpp_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/unwind_2_17.c
|
||||||
|
create mode 100644 nptl_2_17/vars_2_17.c
|
||||||
|
|
||||||
|
|
||||||
diff --git a/nptl_2_17/Makefile b/nptl_2_17/Makefile
|
diff --git a/nptl_2_17/Makefile b/nptl_2_17/Makefile
|
||||||
|
|||||||
@ -1,537 +0,0 @@
|
|||||||
From eb447b7b4bd6177f876ba9420ad9e048c27bae91 Mon Sep 17 00:00:00 2001
|
|
||||||
From: David Kilroy <David.Kilroy@arm.com>
|
|
||||||
Date: Wed, 12 Feb 2020 14:28:15 -0300
|
|
||||||
Subject: [PATCH] elf: Allow dlopen of filter object to work [BZ #16272]
|
|
||||||
|
|
||||||
There are two fixes that are needed to be able to dlopen filter
|
|
||||||
objects. First _dl_map_object_deps cannot assume that map will be at
|
|
||||||
the beginning of l_searchlist.r_list[], as filtees are inserted before
|
|
||||||
map. Secondly dl_open_worker needs to ensure that filtees get
|
|
||||||
relocated.
|
|
||||||
|
|
||||||
In _dl_map_object_deps:
|
|
||||||
|
|
||||||
* avoiding removing relocation dependencies of map by setting
|
|
||||||
l_reserved to 0 and otherwise processing the rest of the search
|
|
||||||
list.
|
|
||||||
|
|
||||||
* ensure that map remains at the beginning of l_initfini - the list
|
|
||||||
of things that need initialisation (and destruction). Do this by
|
|
||||||
splitting the copy up. This may not be required, but matches the
|
|
||||||
initialization order without dlopen.
|
|
||||||
|
|
||||||
Modify dl_open_worker to relocate the objects in new->l_inifini.
|
|
||||||
new->l_initfini is constructed in _dl_map_object_deps, and lists the
|
|
||||||
objects that need initialization and destruction. Originally the list
|
|
||||||
of objects in new->l_next are relocated. All of these objects should
|
|
||||||
also be included in new->l_initfini (both lists are populated with
|
|
||||||
dependencies in _dl_map_object_deps). We can't use new->l_prev to pick
|
|
||||||
up filtees, as during a recursive dlopen from an interposed malloc
|
|
||||||
call, l->prev can contain objects that are not ready for relocation.
|
|
||||||
|
|
||||||
Add tests to verify that symbols resolve to the filtee implementation
|
|
||||||
when auxiliary and filter objects are used, both as a normal link and
|
|
||||||
when dlopen'd.
|
|
||||||
|
|
||||||
Tested by running the testsuite on x86_64.
|
|
||||||
---
|
|
||||||
elf/Makefile | 18 ++++++++++++++++--
|
|
||||||
elf/dl-deps.c | 39 ++++++++++++++++++++++++++++----------
|
|
||||||
elf/dl-open.c | 11 +++++++----
|
|
||||||
elf/tst-auxobj-dlopen.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
elf/tst-auxobj.c | 42 +++++++++++++++++++++++++++++++++++++++++
|
|
||||||
elf/tst-filterobj-aux.c | 33 ++++++++++++++++++++++++++++++++
|
|
||||||
elf/tst-filterobj-dlopen.c | 39 ++++++++++++++++++++++++++++++++++++++
|
|
||||||
elf/tst-filterobj-filtee.c | 27 ++++++++++++++++++++++++++
|
|
||||||
elf/tst-filterobj-filtee.h | 24 +++++++++++++++++++++++
|
|
||||||
elf/tst-filterobj-flt.c | 27 ++++++++++++++++++++++++++
|
|
||||||
elf/tst-filterobj.c | 36 +++++++++++++++++++++++++++++++++++
|
|
||||||
11 files changed, 327 insertions(+), 16 deletions(-)
|
|
||||||
create mode 100644 elf/tst-auxobj-dlopen.c
|
|
||||||
create mode 100644 elf/tst-auxobj.c
|
|
||||||
create mode 100644 elf/tst-filterobj-aux.c
|
|
||||||
create mode 100644 elf/tst-filterobj-dlopen.c
|
|
||||||
create mode 100644 elf/tst-filterobj-filtee.c
|
|
||||||
create mode 100644 elf/tst-filterobj-filtee.h
|
|
||||||
create mode 100644 elf/tst-filterobj-flt.c
|
|
||||||
create mode 100644 elf/tst-filterobj.c
|
|
||||||
|
|
||||||
diff --git a/elf/Makefile b/elf/Makefile
|
|
||||||
index f440488..2053c9d 100644
|
|
||||||
--- a/elf/Makefile
|
|
||||||
+++ b/elf/Makefile
|
|
||||||
@@ -202,7 +202,8 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
|
|
||||||
tst-sonamemove-link tst-sonamemove-dlopen tst-dlopen-tlsmodid \
|
|
||||||
tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \
|
|
||||||
tst-dlopenfail-2 \
|
|
||||||
- tst-tls-ie tst-tls-ie-dlmopen
|
|
||||||
+ tst-tls-ie tst-tls-ie-dlmopen \
|
|
||||||
+ tst-filterobj tst-filterobj-dlopen tst-auxobj tst-auxobj-dlopen
|
|
||||||
# reldep9
|
|
||||||
tests-internal += loadtest unload unload2 circleload1 \
|
|
||||||
neededtest neededtest2 neededtest3 neededtest4 \
|
|
||||||
@@ -316,7 +317,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
|
|
||||||
tst-dlopenfailmod3 tst-ldconfig-ld-mod \
|
|
||||||
tst-tls-ie-mod0 tst-tls-ie-mod1 tst-tls-ie-mod2 \
|
|
||||||
tst-tls-ie-mod3 tst-tls-ie-mod4 tst-tls-ie-mod5 \
|
|
||||||
- tst-tls-ie-mod6
|
|
||||||
+ tst-tls-ie-mod6 \
|
|
||||||
+ tst-filterobj-flt tst-filterobj-aux tst-filterobj-filtee
|
|
||||||
# Most modules build with _ISOMAC defined, but those filtered out
|
|
||||||
# depend on internal headers.
|
|
||||||
modules-names-tests = $(filter-out ifuncmod% tst-libc_dlvsym-dso tst-tlsmod%,\
|
|
||||||
@@ -1723,3 +1725,15 @@ $(objpfx)tst-tls-ie-dlmopen.out: \
|
|
||||||
$(objpfx)tst-tls-ie-mod4.so \
|
|
||||||
$(objpfx)tst-tls-ie-mod5.so \
|
|
||||||
$(objpfx)tst-tls-ie-mod6.so
|
|
||||||
+
|
|
||||||
+LDFLAGS-tst-filterobj-flt.so = -Wl,--filter=$(objpfx)tst-filterobj-filtee.so
|
|
||||||
+$(objpfx)tst-filterobj: $(objpfx)tst-filterobj-flt.so
|
|
||||||
+$(objpfx)tst-filterobj-dlopen: $(libdl)
|
|
||||||
+$(objpfx)tst-filterobj.out: $(objpfx)tst-filterobj-filtee.so
|
|
||||||
+$(objpfx)tst-filterobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
|
|
||||||
+
|
|
||||||
+LDFLAGS-tst-filterobj-aux.so = -Wl,--auxiliary=$(objpfx)tst-filterobj-filtee.so
|
|
||||||
+$(objpfx)tst-auxobj: $(objpfx)tst-filterobj-aux.so
|
|
||||||
+$(objpfx)tst-auxobj-dlopen: $(libdl)
|
|
||||||
+$(objpfx)tst-auxobj.out: $(objpfx)tst-filterobj-filtee.so
|
|
||||||
+$(objpfx)tst-auxobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
|
|
||||||
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
|
|
||||||
index 5103a8a..0730ea9 100644
|
|
||||||
--- a/elf/dl-deps.c
|
|
||||||
+++ b/elf/dl-deps.c
|
|
||||||
@@ -485,14 +485,18 @@ _dl_map_object_deps (struct link_map *map,
|
|
||||||
|
|
||||||
map->l_searchlist.r_list = &l_initfini[nlist + 1];
|
|
||||||
map->l_searchlist.r_nlist = nlist;
|
|
||||||
+ unsigned int map_index = UINT_MAX;
|
|
||||||
|
|
||||||
for (nlist = 0, runp = known; runp; runp = runp->next)
|
|
||||||
{
|
|
||||||
if (__builtin_expect (trace_mode, 0) && runp->map->l_faked)
|
|
||||||
/* This can happen when we trace the loading. */
|
|
||||||
--map->l_searchlist.r_nlist;
|
|
||||||
- else
|
|
||||||
+ else {
|
|
||||||
+ if (runp->map == map)
|
|
||||||
+ map_index = nlist;
|
|
||||||
map->l_searchlist.r_list[nlist++] = runp->map;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
/* Now clear all the mark bits we set in the objects on the search list
|
|
||||||
to avoid duplicates, so the next call starts fresh. */
|
|
||||||
@@ -550,13 +554,14 @@ Filters not supported with LD_TRACE_PRELINKING"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Maybe we can remove some relocation dependencies now. */
|
|
||||||
- assert (map->l_searchlist.r_list[0] == map);
|
|
||||||
struct link_map_reldeps *l_reldeps = NULL;
|
|
||||||
if (map->l_reldeps != NULL)
|
|
||||||
{
|
|
||||||
- for (i = 1; i < nlist; ++i)
|
|
||||||
+ for (i = 0; i < nlist; ++i)
|
|
||||||
map->l_searchlist.r_list[i]->l_reserved = 1;
|
|
||||||
|
|
||||||
+ /* Avoid removing relocation dependencies of the main binary. */
|
|
||||||
+ map->l_reserved = 0;
|
|
||||||
struct link_map **list = &map->l_reldeps->list[0];
|
|
||||||
for (i = 0; i < map->l_reldeps->act; ++i)
|
|
||||||
if (list[i]->l_reserved)
|
|
||||||
@@ -581,16 +586,30 @@ Filters not supported with LD_TRACE_PRELINKING"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- for (i = 1; i < nlist; ++i)
|
|
||||||
+ for (i = 0; i < nlist; ++i)
|
|
||||||
map->l_searchlist.r_list[i]->l_reserved = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* Sort the initializer list to take dependencies into account. The binary
|
|
||||||
- itself will always be initialize last. */
|
|
||||||
- memcpy (l_initfini, map->l_searchlist.r_list,
|
|
||||||
- nlist * sizeof (struct link_map *));
|
|
||||||
- /* We can skip looking for the binary itself which is at the front of
|
|
||||||
- the search list. */
|
|
||||||
+ /* Sort the initializer list to take dependencies into account. Always
|
|
||||||
+ initialize the binary itself last. */
|
|
||||||
+ assert (map_index < nlist);
|
|
||||||
+ if (map_index > 0)
|
|
||||||
+ {
|
|
||||||
+ /* Copy the binary into position 0. */
|
|
||||||
+ l_initfini[0] = map->l_searchlist.r_list[map_index];
|
|
||||||
+
|
|
||||||
+ /* Copy the filtees. */
|
|
||||||
+ for (i = 0; i < map_index; ++i)
|
|
||||||
+ l_initfini[i+1] = map->l_searchlist.r_list[i];
|
|
||||||
+
|
|
||||||
+ /* Copy the remainder. */
|
|
||||||
+ for (i = map_index + 1; i < nlist; ++i)
|
|
||||||
+ l_initfini[i] = map->l_searchlist.r_list[i];
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ memcpy (l_initfini, map->l_searchlist.r_list,
|
|
||||||
+ nlist * sizeof (struct link_map *));
|
|
||||||
+
|
|
||||||
_dl_sort_maps (&l_initfini[1], nlist - 1, NULL, false);
|
|
||||||
|
|
||||||
/* Terminate the list of dependencies. */
|
|
||||||
diff --git a/elf/dl-open.c b/elf/dl-open.c
|
|
||||||
index 623c975..ecb2ba9 100644
|
|
||||||
--- a/elf/dl-open.c
|
|
||||||
+++ b/elf/dl-open.c
|
|
||||||
@@ -621,22 +621,25 @@ dl_open_worker (void *a)
|
|
||||||
allows IFUNC relocations to work and it also means copy
|
|
||||||
relocation of dependencies are if necessary overwritten. */
|
|
||||||
unsigned int nmaps = 0;
|
|
||||||
- struct link_map *l = new;
|
|
||||||
+ unsigned int j = 0;
|
|
||||||
+ struct link_map *l = new->l_initfini[0];
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (! l->l_real->l_relocated)
|
|
||||||
++nmaps;
|
|
||||||
- l = l->l_next;
|
|
||||||
+ l = new->l_initfini[++j];
|
|
||||||
}
|
|
||||||
while (l != NULL);
|
|
||||||
+ /* Stack allocation is limited by the number of loaded objects. */
|
|
||||||
struct link_map *maps[nmaps];
|
|
||||||
nmaps = 0;
|
|
||||||
- l = new;
|
|
||||||
+ j = 0;
|
|
||||||
+ l = new->l_initfini[0];
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (! l->l_real->l_relocated)
|
|
||||||
maps[nmaps++] = l;
|
|
||||||
- l = l->l_next;
|
|
||||||
+ l = new->l_initfini[++j];
|
|
||||||
}
|
|
||||||
while (l != NULL);
|
|
||||||
_dl_sort_maps (maps, nmaps, NULL, false);
|
|
||||||
diff --git a/elf/tst-auxobj-dlopen.c b/elf/tst-auxobj-dlopen.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..cb54aba
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-auxobj-dlopen.c
|
|
||||||
@@ -0,0 +1,47 @@
|
|
||||||
+/* Test for BZ#16272, dlopen'ing an auxiliary filter object.
|
|
||||||
+ Ensure that symbols from the resolve correctly.
|
|
||||||
+
|
|
||||||
+ Copyright (C) 2020 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 <support/check.h>
|
|
||||||
+#include <support/xdlfcn.h>
|
|
||||||
+
|
|
||||||
+static int do_test (void)
|
|
||||||
+{
|
|
||||||
+ void *lib = xdlopen ("tst-filterobj-aux.so", RTLD_LAZY);
|
|
||||||
+ char *(*fn)(void) = xdlsym (lib, "get_text");
|
|
||||||
+ const char* text = fn ();
|
|
||||||
+
|
|
||||||
+ printf ("%s\n", text);
|
|
||||||
+
|
|
||||||
+ /* Verify the text matches what we expect from the filtee */
|
|
||||||
+ TEST_COMPARE_STRING (text, "Hello from filtee (PASS)");
|
|
||||||
+
|
|
||||||
+ fn = xdlsym (lib, "get_text2");
|
|
||||||
+ text = fn ();
|
|
||||||
+
|
|
||||||
+ printf ("%s\n", text);
|
|
||||||
+
|
|
||||||
+ /* Verify the text matches what we expect from the auxiliary object */
|
|
||||||
+ TEST_COMPARE_STRING (text, "Hello from auxiliary filter object (PASS)");
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#include <support/test-driver.c>
|
|
||||||
diff --git a/elf/tst-auxobj.c b/elf/tst-auxobj.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..bdc7713
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-auxobj.c
|
|
||||||
@@ -0,0 +1,42 @@
|
|
||||||
+/* Test that symbols from auxiliary filter objects are resolved to the
|
|
||||||
+ filtee.
|
|
||||||
+
|
|
||||||
+ Copyright (C) 2020 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 <support/check.h>
|
|
||||||
+#include "tst-filterobj-filtee.h"
|
|
||||||
+
|
|
||||||
+static int do_test (void)
|
|
||||||
+{
|
|
||||||
+ const char* text = get_text ();
|
|
||||||
+ printf ("%s\n", text);
|
|
||||||
+
|
|
||||||
+ /* Verify the text matches what we expect from the filtee */
|
|
||||||
+ TEST_COMPARE_STRING (text, "Hello from filtee (PASS)");
|
|
||||||
+
|
|
||||||
+ text = get_text2 ();
|
|
||||||
+ printf ("%s\n", text);
|
|
||||||
+
|
|
||||||
+ /* Verify the text matches what we expect from the auxiliary object */
|
|
||||||
+ TEST_COMPARE_STRING (text, "Hello from auxiliary filter object (PASS)");
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#include <support/test-driver.c>
|
|
||||||
diff --git a/elf/tst-filterobj-aux.c b/elf/tst-filterobj-aux.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..0b732f2
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-filterobj-aux.c
|
|
||||||
@@ -0,0 +1,33 @@
|
|
||||||
+/* Auxiliary filter object.
|
|
||||||
+ Contains symbols to be resolved in filtee, and one which doesn't.
|
|
||||||
+
|
|
||||||
+ Copyright (C) 2020 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 "tst-filterobj-filtee.h"
|
|
||||||
+
|
|
||||||
+/* We never want to see the output of the auxiliary object. */
|
|
||||||
+const char *get_text (void)
|
|
||||||
+{
|
|
||||||
+ return "Hello from auxiliary filter object (FAIL)";
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* The filtee doesn't implement this symbol, so this should resolve. */
|
|
||||||
+const char *get_text2 (void)
|
|
||||||
+{
|
|
||||||
+ return "Hello from auxiliary filter object (PASS)";
|
|
||||||
+}
|
|
||||||
diff --git a/elf/tst-filterobj-dlopen.c b/elf/tst-filterobj-dlopen.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..c5b5072
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-filterobj-dlopen.c
|
|
||||||
@@ -0,0 +1,39 @@
|
|
||||||
+/* Test for BZ#16272, dlopen'ing a filter object.
|
|
||||||
+ Ensure that symbols from the filter object resolve to the filtee.
|
|
||||||
+
|
|
||||||
+ Copyright (C) 2020 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 <support/check.h>
|
|
||||||
+#include <support/xdlfcn.h>
|
|
||||||
+
|
|
||||||
+static int do_test (void)
|
|
||||||
+{
|
|
||||||
+ void *lib = xdlopen ("tst-filterobj-flt.so", RTLD_LAZY);
|
|
||||||
+ char *(*fn)(void) = xdlsym (lib, "get_text");
|
|
||||||
+ const char* text = fn ();
|
|
||||||
+
|
|
||||||
+ printf ("%s\n", text);
|
|
||||||
+
|
|
||||||
+ /* Verify the text matches what we expect from the filtee */
|
|
||||||
+ TEST_COMPARE_STRING (text, "Hello from filtee (PASS)");
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#include <support/test-driver.c>
|
|
||||||
diff --git a/elf/tst-filterobj-filtee.c b/elf/tst-filterobj-filtee.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..8fa557c
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-filterobj-filtee.c
|
|
||||||
@@ -0,0 +1,27 @@
|
|
||||||
+/* Filtee for BZ#16272 test.
|
|
||||||
+ Contains desired symbol implementations.
|
|
||||||
+
|
|
||||||
+ Copyright (C) 2020 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 "tst-filterobj-filtee.h"
|
|
||||||
+
|
|
||||||
+/* This is the real implementation that wants to be called */
|
|
||||||
+const char *get_text (void)
|
|
||||||
+{
|
|
||||||
+ return "Hello from filtee (PASS)";
|
|
||||||
+}
|
|
||||||
diff --git a/elf/tst-filterobj-filtee.h b/elf/tst-filterobj-filtee.h
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..46aee28
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-filterobj-filtee.h
|
|
||||||
@@ -0,0 +1,24 @@
|
|
||||||
+/* Filtee header for BZ#16272 test.
|
|
||||||
+ Contains prototypes for symbols implemented in the filtee.
|
|
||||||
+
|
|
||||||
+ Copyright (C) 2020 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/>. */
|
|
||||||
+
|
|
||||||
+const char *get_text (void);
|
|
||||||
+
|
|
||||||
+/* For testing auxiliary filter object. */
|
|
||||||
+const char *get_text2 (void);
|
|
||||||
diff --git a/elf/tst-filterobj-flt.c b/elf/tst-filterobj-flt.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..5062654
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-filterobj-flt.c
|
|
||||||
@@ -0,0 +1,27 @@
|
|
||||||
+/* Filter object for BZ#16272 test.
|
|
||||||
+ Contains symbols to be resolved in filtee.
|
|
||||||
+
|
|
||||||
+ Copyright (C) 2020 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 "tst-filterobj-filtee.h"
|
|
||||||
+
|
|
||||||
+/* We never want to see the output of the filter object */
|
|
||||||
+const char *get_text (void)
|
|
||||||
+{
|
|
||||||
+ return "Hello from filter object (FAIL)";
|
|
||||||
+}
|
|
||||||
diff --git a/elf/tst-filterobj.c b/elf/tst-filterobj.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..96bfae0
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-filterobj.c
|
|
||||||
@@ -0,0 +1,36 @@
|
|
||||||
+/* Test that symbols from filter objects are resolved to the filtee.
|
|
||||||
+
|
|
||||||
+ Copyright (C) 2020 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 <support/check.h>
|
|
||||||
+#include "tst-filterobj-filtee.h"
|
|
||||||
+
|
|
||||||
+static int do_test (void)
|
|
||||||
+{
|
|
||||||
+ const char* text = get_text ();
|
|
||||||
+
|
|
||||||
+ printf ("%s\n", text);
|
|
||||||
+
|
|
||||||
+ /* Verify the text matches what we expect from the filtee */
|
|
||||||
+ TEST_COMPARE_STRING (text, "Hello from filtee (PASS)");
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#include <support/test-driver.c>
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
Binary file not shown.
52
glibc.spec
52
glibc.spec
@ -29,7 +29,7 @@
|
|||||||
%bcond_without testsuite
|
%bcond_without testsuite
|
||||||
%bcond_without benchtests
|
%bcond_without benchtests
|
||||||
%bcond_with bootstrap
|
%bcond_with bootstrap
|
||||||
%bcond_without werror
|
%bcond_with werror
|
||||||
%bcond_without docs
|
%bcond_without docs
|
||||||
%bcond_with libpthreadcond
|
%bcond_with libpthreadcond
|
||||||
|
|
||||||
@ -59,8 +59,8 @@
|
|||||||
# glibc - The GNU C Library (glibc) core package.
|
# glibc - The GNU C Library (glibc) core package.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
Name: glibc
|
Name: glibc
|
||||||
Version: 2.31
|
Version: 2.33
|
||||||
Release: 9
|
Release: 1
|
||||||
Summary: The GNU libc libraries
|
Summary: The GNU libc libraries
|
||||||
License: %{all_license}
|
License: %{all_license}
|
||||||
URL: http://www.gnu.org/software/glibc/
|
URL: http://www.gnu.org/software/glibc/
|
||||||
@ -76,28 +76,12 @@ Source6: LicenseList
|
|||||||
Patch0: glibc-1070416.patch
|
Patch0: glibc-1070416.patch
|
||||||
Patch1: glibc-c-utf8-locale.patch
|
Patch1: glibc-c-utf8-locale.patch
|
||||||
|
|
||||||
Patch6000: Fix-use-after-free-in-glob-when-expanding-user-bug-2.patch
|
Patch6000: backport-posix-tst-rfc3484-Fix-compile-failure-linking-to-loc.patch
|
||||||
Patch6001: Avoid-ldbl-96-stack-corruption-from-range-reduction-.patch
|
|
||||||
Patch6002: Reset-converter-state-after-second-wchar_t-output-Bu.patch
|
|
||||||
Patch6003: Fix-avx2-strncmp-offset-compare-condition-check-BZ-2.patch
|
|
||||||
Patch6004: nptl-wait-for-pending-setxid-request-also-in-detache.patch
|
|
||||||
Patch6005: x86-64-Use-RDX_LP-on-__x86_shared_non_temporal_thres.patch
|
|
||||||
Patch6006: x86_64-Use-xmmN-with-vpxor-to-clear-a-vector-registe.patch
|
|
||||||
Patch6007: nptl-Don-t-madvise-user-provided-stack.patch
|
|
||||||
Patch6008: turn-REP_STOSB_THRESHOLD-from-2k-to-1M.patch
|
|
||||||
Patch6009: Fix-strtod-multiple-precision-division-bug-bug-26137.patch
|
|
||||||
Patch6010: Fix-double-free-in-__printf_fp_l-bug-26214.patch
|
|
||||||
Patch6011: Fix-memory-leak-in-__printf_fp_l-bug-26215.patch
|
|
||||||
Patch6012: Fix-CVE-2020-6096-001.patch
|
|
||||||
Patch6013: Fix-CVE-2020-6096-002.patch
|
|
||||||
Patch6014: Disable-warnings-due-to-deprecated-libselinux-symbol.patch
|
|
||||||
Patch6015: rtld-Avoid-using-up-static-TLS-surplus-for-optimizat.patch
|
|
||||||
Patch6016: Fix-CVE-2020-27618-iconv-Accept-redundant-shift-sequences.patch
|
|
||||||
Patch6017: elf-Allow-dlopen-of-filter-object-to-work-BZ-16272.patch
|
|
||||||
|
|
||||||
Patch9000: delete-no-hard-link-to-avoid-all_language-package-to.patch
|
Patch9000: turn-REP_STOSB_THRESHOLD-from-2k-to-1M.patch
|
||||||
Patch9001: build-extra-libpthreadcond-so.patch
|
Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch
|
||||||
Patch9002: remove-country-selection-from-tzselect.patch
|
Patch9002: build-extra-libpthreadcond-so.patch
|
||||||
|
Patch9003: remove-country-selection-from-tzselect.patch
|
||||||
|
|
||||||
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
|
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
|
||||||
|
|
||||||
@ -481,8 +465,6 @@ popd
|
|||||||
# Install glibc...
|
# Install glibc...
|
||||||
##############################################################################
|
##############################################################################
|
||||||
%install
|
%install
|
||||||
chmod 644 sysdeps/gnu/errlist.c
|
|
||||||
|
|
||||||
%ifarch riscv64
|
%ifarch riscv64
|
||||||
for d in $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT/%{_lib}; do
|
for d in $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT/%{_lib}; do
|
||||||
mkdir -p $d
|
mkdir -p $d
|
||||||
@ -551,9 +533,6 @@ mv $RPM_BUILD_ROOT%{_prefix}/lib/locale/libc.lang .
|
|||||||
# Install configuration files for services
|
# Install configuration files for services
|
||||||
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/nsswitch.conf
|
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/nsswitch.conf
|
||||||
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/default
|
|
||||||
install -p -m 644 nis/nss $RPM_BUILD_ROOT/etc/default/nss
|
|
||||||
|
|
||||||
# This is for ncsd - in glibc 2.2
|
# This is for ncsd - in glibc 2.2
|
||||||
install -m 644 nscd/nscd.conf $RPM_BUILD_ROOT/etc
|
install -m 644 nscd/nscd.conf $RPM_BUILD_ROOT/etc
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}
|
mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}
|
||||||
@ -586,7 +565,7 @@ rm -f $RPM_BUILD_ROOT%{_prefix}/lib/debug%{_libdir}/*_p.a
|
|||||||
rm -rf $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo
|
rm -rf $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo
|
||||||
|
|
||||||
touch -r %{SOURCE0} $RPM_BUILD_ROOT/etc/ld.so.conf
|
touch -r %{SOURCE0} $RPM_BUILD_ROOT/etc/ld.so.conf
|
||||||
touch -r sunrpc/etc.rpc $RPM_BUILD_ROOT/etc/rpc
|
touch -r inet/etc.rpc $RPM_BUILD_ROOT/etc/rpc
|
||||||
|
|
||||||
# Lastly copy some additional documentation for the packages.
|
# Lastly copy some additional documentation for the packages.
|
||||||
rm -rf documentation
|
rm -rf documentation
|
||||||
@ -613,8 +592,8 @@ done
|
|||||||
for i in benchout.schema.json compare_bench.py import_bench.py validate_benchout.py; do
|
for i in benchout.schema.json compare_bench.py import_bench.py validate_benchout.py; do
|
||||||
cp benchtests/scripts/$i $RPM_BUILD_ROOT%{_prefix}/libexec/glibc-benchtests/
|
cp benchtests/scripts/$i $RPM_BUILD_ROOT%{_prefix}/libexec/glibc-benchtests/
|
||||||
done
|
done
|
||||||
|
%endif
|
||||||
|
|
||||||
%if 0%{?_enable_debug_packages}
|
|
||||||
pushd locale
|
pushd locale
|
||||||
ln -s programs/*.gperf .
|
ln -s programs/*.gperf .
|
||||||
popd
|
popd
|
||||||
@ -811,6 +790,7 @@ cat > debugutils.filelist <<EOF
|
|||||||
%{_prefix}/bin/xtrace
|
%{_prefix}/bin/xtrace
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
%if %{with benchtests}
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# glibc benchtests sub-package
|
# glibc benchtests sub-package
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -826,8 +806,9 @@ echo "%{_prefix}/libexec/glibc-benchtests/benchout.schema.json" >> benchtests.fi
|
|||||||
echo "%{_prefix}/libexec/glibc-benchtests/compare_bench.py*" >> benchtests.filelist
|
echo "%{_prefix}/libexec/glibc-benchtests/compare_bench.py*" >> benchtests.filelist
|
||||||
echo "%{_prefix}/libexec/glibc-benchtests/import_bench.py*" >> benchtests.filelist
|
echo "%{_prefix}/libexec/glibc-benchtests/import_bench.py*" >> benchtests.filelist
|
||||||
echo "%{_prefix}/libexec/glibc-benchtests/validate_benchout.py*" >> benchtests.filelist
|
echo "%{_prefix}/libexec/glibc-benchtests/validate_benchout.py*" >> benchtests.filelist
|
||||||
%endif # 0%{?_enable_debug_packages}
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?_enable_debug_packages}
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# glibc debuginfo sub-package
|
# glibc debuginfo sub-package
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -870,7 +851,7 @@ for d in $(echo $remove_dir | sed 's/ /\n/g'); do
|
|||||||
sed -i "\|^%%dir $d/\?$|d" debuginfo.filelist
|
sed -i "\|^%%dir $d/\?$|d" debuginfo.filelist
|
||||||
done
|
done
|
||||||
|
|
||||||
%endif # %{with benchtests}
|
%endif # 0%{?_enable_debug_packages}
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Run the glibc testsuite
|
# Run the glibc testsuite
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -1121,8 +1102,6 @@ fi
|
|||||||
%{_prefix}/lib/locale/en_US.utf8
|
%{_prefix}/lib/locale/en_US.utf8
|
||||||
%{_prefix}/share/locale/zh_CN
|
%{_prefix}/share/locale/zh_CN
|
||||||
%{_prefix}/share/locale/en_GB
|
%{_prefix}/share/locale/en_GB
|
||||||
%dir %attr(755,root,root) /etc/default
|
|
||||||
%verify(not md5 size mtime) %config(noreplace) /etc/default/nss
|
|
||||||
|
|
||||||
%files -f libc.lang all-langpacks
|
%files -f libc.lang all-langpacks
|
||||||
%{_prefix}/lib/locale
|
%{_prefix}/lib/locale
|
||||||
@ -1191,6 +1170,9 @@ fi
|
|||||||
%doc hesiod/README.hesiod
|
%doc hesiod/README.hesiod
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Mar 5 2021 Wang Shuo<wangshuo_1994@foxmail.com> - 2.33-1
|
||||||
|
- upgrade glibc to 2.33-1
|
||||||
|
|
||||||
* Tue Jan 26 2021 shanzhikun <shanzhikun@huawei.com> - 2.31-9
|
* Tue Jan 26 2021 shanzhikun <shanzhikun@huawei.com> - 2.31-9
|
||||||
- elf: Allow dlopen of filter object to work [BZ #16272]
|
- elf: Allow dlopen of filter object to work [BZ #16272]
|
||||||
https://sourceware.org/bugzilla/show_bug.cgi?id=16272
|
https://sourceware.org/bugzilla/show_bug.cgi?id=16272
|
||||||
|
|||||||
@ -1,41 +0,0 @@
|
|||||||
From 087942251f26d5fd5802b8d14e47d460263a0c4d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
|
|
||||||
Date: Wed, 24 Jun 2020 07:47:15 +0100
|
|
||||||
Subject: [PATCH] nptl: Don't madvise user provided stack
|
|
||||||
|
|
||||||
User provided stack should not be released nor madvised at
|
|
||||||
thread exit because it's owned by the user.
|
|
||||||
|
|
||||||
If the memory is shared or file based then MADV_DONTNEED
|
|
||||||
can have unwanted effects. With memory tagging on aarch64
|
|
||||||
linux the tags are dropped and thus it may invalidate
|
|
||||||
pointers.
|
|
||||||
|
|
||||||
Tested on aarch64-linux-gnu with MTE, it fixes
|
|
||||||
|
|
||||||
FAIL: nptl/tst-stack3
|
|
||||||
FAIL: nptl/tst-stack3-mem
|
|
||||||
|
|
||||||
---
|
|
||||||
nptl/pthread_create.c | 5 +++--
|
|
||||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
|
|
||||||
index 179f07a1..00931c19 100644
|
|
||||||
--- a/nptl/pthread_create.c
|
|
||||||
+++ b/nptl/pthread_create.c
|
|
||||||
@@ -564,8 +564,9 @@ START_THREAD_DEFN
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- advise_stack_range (pd->stackblock, pd->stackblock_size, (uintptr_t) pd,
|
|
||||||
- pd->guardsize);
|
|
||||||
+ if (!pd->user_stack)
|
|
||||||
+ advise_stack_range (pd->stackblock, pd->stackblock_size, (uintptr_t) pd,
|
|
||||||
+ pd->guardsize);
|
|
||||||
|
|
||||||
if (__glibc_unlikely (pd->cancelhandling & SETXID_BITMASK))
|
|
||||||
{
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
From 4cab20fa49b3ea3e3454fdc4f13bf3828d8efd19 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Andreas Schwab <schwab@suse.de>
|
|
||||||
Date: Thu, 7 May 2020 15:50:09 +0200
|
|
||||||
Subject: [PATCH] nptl: wait for pending setxid request also in detached thread
|
|
||||||
(bug 25942)
|
|
||||||
|
|
||||||
There is a race between __nptl_setxid and exiting detached thread, which
|
|
||||||
causes a deadlock on stack_cache_lock. The deadlock happens in this
|
|
||||||
state:
|
|
||||||
|
|
||||||
T1: setgroups -> __nptl_setxid (holding stack_cache_lock, waiting on cmdp->cntr == 0)
|
|
||||||
T2 (detached, exiting): start_thread -> __deallocate_stack (waiting on stack_cache_lock)
|
|
||||||
more threads waiting on stack_cache_lock in pthread_create
|
|
||||||
|
|
||||||
For non-detached threads, start_thread waits for its own setxid handler to
|
|
||||||
finish before exiting. Do this for detached threads as well.
|
|
||||||
---
|
|
||||||
nptl/pthread_create.c | 11 ++++++-----
|
|
||||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
|
|
||||||
index afd379e89a..a43089065c 100644
|
|
||||||
--- a/nptl/pthread_create.c
|
|
||||||
+++ b/nptl/pthread_create.c
|
|
||||||
@@ -567,11 +567,7 @@ START_THREAD_DEFN
|
|
||||||
advise_stack_range (pd->stackblock, pd->stackblock_size, (uintptr_t) pd,
|
|
||||||
pd->guardsize);
|
|
||||||
|
|
||||||
- /* If the thread is detached free the TCB. */
|
|
||||||
- if (IS_DETACHED (pd))
|
|
||||||
- /* Free the TCB. */
|
|
||||||
- __free_tcb (pd);
|
|
||||||
- else if (__glibc_unlikely (pd->cancelhandling & SETXID_BITMASK))
|
|
||||||
+ if (__glibc_unlikely (pd->cancelhandling & SETXID_BITMASK))
|
|
||||||
{
|
|
||||||
/* Some other thread might call any of the setXid functions and expect
|
|
||||||
us to reply. In this case wait until we did that. */
|
|
||||||
@@ -587,6 +583,11 @@ START_THREAD_DEFN
|
|
||||||
pd->setxid_futex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* If the thread is detached free the TCB. */
|
|
||||||
+ if (IS_DETACHED (pd))
|
|
||||||
+ /* Free the TCB. */
|
|
||||||
+ __free_tcb (pd);
|
|
||||||
+
|
|
||||||
/* We cannot call '_exit' here. '_exit' will terminate the process.
|
|
||||||
|
|
||||||
The 'exit' implementation in the kernel will signal when the
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -1,586 +0,0 @@
|
|||||||
From ffb17e7ba3a5ba9632cee97330b325072fbe41dd Mon Sep 17 00:00:00 2001
|
|
||||||
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
|
|
||||||
Date: Wed, 10 Jun 2020 13:40:40 +0100
|
|
||||||
Subject: [PATCH] rtld: Avoid using up static TLS surplus for optimizations [BZ
|
|
||||||
#25051]
|
|
||||||
|
|
||||||
On some targets static TLS surplus area can be used opportunistically
|
|
||||||
for dynamically loaded modules such that the TLS access then becomes
|
|
||||||
faster (TLSDESC and powerpc TLS optimization). However we don't want
|
|
||||||
all surplus TLS to be used for this optimization because dynamically
|
|
||||||
loaded modules with initial-exec model TLS can only use surplus TLS.
|
|
||||||
|
|
||||||
The new contract for surplus static TLS use is:
|
|
||||||
|
|
||||||
- libc.so can have up to 192 bytes of IE TLS,
|
|
||||||
- other system libraries together can have up to 144 bytes of IE TLS.
|
|
||||||
- Some "optional" static TLS is available for opportunistic use.
|
|
||||||
|
|
||||||
The optional TLS is now tunable: rtld.optional_static_tls, so users
|
|
||||||
can directly affect the allocated static TLS size. (Note that module
|
|
||||||
unloading with dlclose does not reclaim static TLS. After the optional
|
|
||||||
TLS runs out, TLS access is no longer optimized to use static TLS.)
|
|
||||||
|
|
||||||
The default setting of rtld.optional_static_tls is 512 so the surplus
|
|
||||||
TLS is 3*192 + 4*144 + 512 = 1664 by default, the same as before.
|
|
||||||
|
|
||||||
Fixes BZ #25051.
|
|
||||||
|
|
||||||
Tested on aarch64-linux-gnu and x86_64-linux-gnu.
|
|
||||||
|
|
||||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
||||||
---
|
|
||||||
csu/libc-tls.c | 3 ++
|
|
||||||
elf/Makefile | 29 +++++++++++-
|
|
||||||
elf/dl-reloc.c | 37 +++++++++++----
|
|
||||||
elf/dl-tls.c | 9 ++--
|
|
||||||
elf/dl-tunables.list | 5 ++
|
|
||||||
elf/dynamic-link.h | 5 +-
|
|
||||||
elf/tst-tls-ie-dlmopen.c | 112 +++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
elf/tst-tls-ie-mod.h | 40 ++++++++++++++++
|
|
||||||
elf/tst-tls-ie-mod0.c | 4 ++
|
|
||||||
elf/tst-tls-ie-mod1.c | 4 ++
|
|
||||||
elf/tst-tls-ie-mod2.c | 4 ++
|
|
||||||
elf/tst-tls-ie-mod3.c | 4 ++
|
|
||||||
elf/tst-tls-ie-mod4.c | 4 ++
|
|
||||||
elf/tst-tls-ie-mod5.c | 4 ++
|
|
||||||
elf/tst-tls-ie-mod6.c | 4 ++
|
|
||||||
elf/tst-tls-ie.c | 111 ++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
manual/tunables.texi | 17 +++++++
|
|
||||||
sysdeps/generic/ldsodefs.h | 3 ++
|
|
||||||
18 files changed, 382 insertions(+), 17 deletions(-)
|
|
||||||
create mode 100644 elf/tst-tls-ie-dlmopen.c
|
|
||||||
create mode 100644 elf/tst-tls-ie-mod.h
|
|
||||||
create mode 100644 elf/tst-tls-ie-mod0.c
|
|
||||||
create mode 100644 elf/tst-tls-ie-mod1.c
|
|
||||||
create mode 100644 elf/tst-tls-ie-mod2.c
|
|
||||||
create mode 100644 elf/tst-tls-ie-mod3.c
|
|
||||||
create mode 100644 elf/tst-tls-ie-mod4.c
|
|
||||||
create mode 100644 elf/tst-tls-ie-mod5.c
|
|
||||||
create mode 100644 elf/tst-tls-ie-mod6.c
|
|
||||||
create mode 100644 elf/tst-tls-ie.c
|
|
||||||
|
|
||||||
diff --git a/csu/libc-tls.c b/csu/libc-tls.c
|
|
||||||
index 28a7944..1b68d71 100644
|
|
||||||
--- a/csu/libc-tls.c
|
|
||||||
+++ b/csu/libc-tls.c
|
|
||||||
@@ -59,6 +59,9 @@ size_t _dl_tls_static_size = 2048;
|
|
||||||
size_t _dl_tls_static_used;
|
|
||||||
/* Alignment requirement of the static TLS block. */
|
|
||||||
size_t _dl_tls_static_align;
|
|
||||||
+/* Remaining amount of static TLS that may be used for optimizing
|
|
||||||
+ dynamic TLS access (e.g. with TLSDESC). */
|
|
||||||
+size_t _dl_tls_static_optional = 512;
|
|
||||||
|
|
||||||
/* Generation counter for the dtv. */
|
|
||||||
size_t _dl_tls_generation;
|
|
||||||
diff --git a/elf/Makefile b/elf/Makefile
|
|
||||||
index 632a4d8..f440488 100644
|
|
||||||
--- a/elf/Makefile
|
|
||||||
+++ b/elf/Makefile
|
|
||||||
@@ -201,7 +201,8 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
|
|
||||||
tst-unwind-ctor tst-unwind-main tst-audit13 \
|
|
||||||
tst-sonamemove-link tst-sonamemove-dlopen tst-dlopen-tlsmodid \
|
|
||||||
tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \
|
|
||||||
- tst-dlopenfail-2
|
|
||||||
+ tst-dlopenfail-2 \
|
|
||||||
+ tst-tls-ie tst-tls-ie-dlmopen
|
|
||||||
# reldep9
|
|
||||||
tests-internal += loadtest unload unload2 circleload1 \
|
|
||||||
neededtest neededtest2 neededtest3 neededtest4 \
|
|
||||||
@@ -312,7 +313,10 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
|
|
||||||
tst-auditmanymod7 tst-auditmanymod8 tst-auditmanymod9 \
|
|
||||||
tst-initlazyfailmod tst-finilazyfailmod \
|
|
||||||
tst-dlopenfailmod1 tst-dlopenfaillinkmod tst-dlopenfailmod2 \
|
|
||||||
- tst-dlopenfailmod3 tst-ldconfig-ld-mod
|
|
||||||
+ tst-dlopenfailmod3 tst-ldconfig-ld-mod \
|
|
||||||
+ tst-tls-ie-mod0 tst-tls-ie-mod1 tst-tls-ie-mod2 \
|
|
||||||
+ tst-tls-ie-mod3 tst-tls-ie-mod4 tst-tls-ie-mod5 \
|
|
||||||
+ tst-tls-ie-mod6
|
|
||||||
# Most modules build with _ISOMAC defined, but those filtered out
|
|
||||||
# depend on internal headers.
|
|
||||||
modules-names-tests = $(filter-out ifuncmod% tst-libc_dlvsym-dso tst-tlsmod%,\
|
|
||||||
@@ -1699,3 +1703,23 @@ LDFLAGS-tst-dlopen-nodelete-reloc-mod17.so = -Wl,--no-as-needed
|
|
||||||
|
|
||||||
$(objpfx)tst-ldconfig-ld_so_conf-update.out: $(objpfx)tst-ldconfig-ld-mod.so
|
|
||||||
$(objpfx)tst-ldconfig-ld_so_conf-update: $(libdl)
|
|
||||||
+
|
|
||||||
+$(objpfx)tst-tls-ie: $(libdl) $(shared-thread-library)
|
|
||||||
+$(objpfx)tst-tls-ie.out: \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod0.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod1.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod2.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod3.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod4.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod5.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod6.so
|
|
||||||
+
|
|
||||||
+$(objpfx)tst-tls-ie-dlmopen: $(libdl) $(shared-thread-library)
|
|
||||||
+$(objpfx)tst-tls-ie-dlmopen.out: \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod0.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod1.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod2.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod3.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod4.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod5.so \
|
|
||||||
+ $(objpfx)tst-tls-ie-mod6.so
|
|
||||||
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
|
|
||||||
index ffcc84d..6d32e49 100644
|
|
||||||
--- a/elf/dl-reloc.c
|
|
||||||
+++ b/elf/dl-reloc.c
|
|
||||||
@@ -39,13 +39,16 @@
|
|
||||||
/* We are trying to perform a static TLS relocation in MAP, but it was
|
|
||||||
dynamically loaded. This can only work if there is enough surplus in
|
|
||||||
the static TLS area already allocated for each running thread. If this
|
|
||||||
- object's TLS segment is too big to fit, we fail. If it fits,
|
|
||||||
- we set MAP->l_tls_offset and return.
|
|
||||||
- This function intentionally does not return any value but signals error
|
|
||||||
- directly, as static TLS should be rare and code handling it should
|
|
||||||
- not be inlined as much as possible. */
|
|
||||||
+ object's TLS segment is too big to fit, we fail with -1. If it fits,
|
|
||||||
+ we set MAP->l_tls_offset and return 0.
|
|
||||||
+ A portion of the surplus static TLS can be optionally used to optimize
|
|
||||||
+ dynamic TLS access (with TLSDESC or powerpc TLS optimizations).
|
|
||||||
+ If OPTIONAL is true then TLS is allocated for such optimization and
|
|
||||||
+ the caller must have a fallback in case the optional portion of surplus
|
|
||||||
+ TLS runs out. If OPTIONAL is false then the entire surplus TLS area is
|
|
||||||
+ considered and the allocation only fails if that runs out. */
|
|
||||||
int
|
|
||||||
-_dl_try_allocate_static_tls (struct link_map *map)
|
|
||||||
+_dl_try_allocate_static_tls (struct link_map *map, bool optional)
|
|
||||||
{
|
|
||||||
/* If we've already used the variable with dynamic access, or if the
|
|
||||||
alignment requirements are too high, fail. */
|
|
||||||
@@ -68,8 +71,14 @@ _dl_try_allocate_static_tls (struct link_map *map)
|
|
||||||
|
|
||||||
size_t n = (freebytes - blsize) / map->l_tls_align;
|
|
||||||
|
|
||||||
- size_t offset = GL(dl_tls_static_used) + (freebytes - n * map->l_tls_align
|
|
||||||
- - map->l_tls_firstbyte_offset);
|
|
||||||
+ /* Account optional static TLS surplus usage. */
|
|
||||||
+ size_t use = freebytes - n * map->l_tls_align - map->l_tls_firstbyte_offset;
|
|
||||||
+ if (optional && use > GL(dl_tls_static_optional))
|
|
||||||
+ goto fail;
|
|
||||||
+ else if (optional)
|
|
||||||
+ GL(dl_tls_static_optional) -= use;
|
|
||||||
+
|
|
||||||
+ size_t offset = GL(dl_tls_static_used) + use;
|
|
||||||
|
|
||||||
map->l_tls_offset = GL(dl_tls_static_used) = offset;
|
|
||||||
#elif TLS_DTV_AT_TP
|
|
||||||
@@ -83,6 +92,13 @@ _dl_try_allocate_static_tls (struct link_map *map)
|
|
||||||
if (used > GL(dl_tls_static_size))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
+ /* Account optional static TLS surplus usage. */
|
|
||||||
+ size_t use = used - GL(dl_tls_static_used);
|
|
||||||
+ if (optional && use > GL(dl_tls_static_optional))
|
|
||||||
+ goto fail;
|
|
||||||
+ else if (optional)
|
|
||||||
+ GL(dl_tls_static_optional) -= use;
|
|
||||||
+
|
|
||||||
map->l_tls_offset = offset;
|
|
||||||
map->l_tls_firstbyte_offset = GL(dl_tls_static_used);
|
|
||||||
GL(dl_tls_static_used) = used;
|
|
||||||
@@ -110,12 +126,15 @@ _dl_try_allocate_static_tls (struct link_map *map)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* This function intentionally does not return any value but signals error
|
|
||||||
+ directly, as static TLS should be rare and code handling it should
|
|
||||||
+ not be inlined as much as possible. */
|
|
||||||
void
|
|
||||||
__attribute_noinline__
|
|
||||||
_dl_allocate_static_tls (struct link_map *map)
|
|
||||||
{
|
|
||||||
if (map->l_tls_offset == FORCED_DYNAMIC_TLS_OFFSET
|
|
||||||
- || _dl_try_allocate_static_tls (map))
|
|
||||||
+ || _dl_try_allocate_static_tls (map, false))
|
|
||||||
{
|
|
||||||
_dl_signal_error (0, map->l_name, NULL, N_("\
|
|
||||||
cannot allocate memory in static TLS block"));
|
|
||||||
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
|
|
||||||
index bb7a66f..6727233 100644
|
|
||||||
--- a/elf/dynamic-link.h
|
|
||||||
+++ b/elf/dynamic-link.h
|
|
||||||
@@ -40,9 +40,10 @@
|
|
||||||
(__builtin_expect ((sym_map)->l_tls_offset \
|
|
||||||
!= FORCED_DYNAMIC_TLS_OFFSET, 1) \
|
|
||||||
&& (__builtin_expect ((sym_map)->l_tls_offset != NO_TLS_OFFSET, 1) \
|
|
||||||
- || _dl_try_allocate_static_tls (sym_map) == 0))
|
|
||||||
+ || _dl_try_allocate_static_tls (sym_map, true) == 0))
|
|
||||||
|
|
||||||
-int _dl_try_allocate_static_tls (struct link_map *map) attribute_hidden;
|
|
||||||
+int _dl_try_allocate_static_tls (struct link_map *map, bool optional)
|
|
||||||
+ attribute_hidden;
|
|
||||||
|
|
||||||
#include <elf.h>
|
|
||||||
|
|
||||||
diff --git a/elf/tst-tls-ie-dlmopen.c b/elf/tst-tls-ie-dlmopen.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..c7b5c68
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-tls-ie-dlmopen.c
|
|
||||||
@@ -0,0 +1,112 @@
|
|
||||||
+/* Test dlopen of modules with initial-exec TLS after dlmopen.
|
|
||||||
+ Copyright (C) 2016-2020 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/>. */
|
|
||||||
+
|
|
||||||
+/* This test tries to check that surplus static TLS is not used up for
|
|
||||||
+ dynamic TLS optimizations and 4*144 = 576 bytes of static TLS is
|
|
||||||
+ still available for dlopening modules with initial-exec TLS after 3
|
|
||||||
+ new dlmopen namespaces are created. It depends on rtld.nns=4 and
|
|
||||||
+ rtld.optional_static_tls=512 tunable settings. */
|
|
||||||
+
|
|
||||||
+#include <errno.h>
|
|
||||||
+#include <pthread.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+
|
|
||||||
+static int do_test (void);
|
|
||||||
+#include <support/xthread.h>
|
|
||||||
+#include <support/xdlfcn.h>
|
|
||||||
+#include <support/check.h>
|
|
||||||
+#include <support/test-driver.c>
|
|
||||||
+
|
|
||||||
+/* Have some big TLS in the main exe: should not use surplus TLS. */
|
|
||||||
+__thread char maintls[1000];
|
|
||||||
+
|
|
||||||
+static pthread_barrier_t barrier;
|
|
||||||
+
|
|
||||||
+/* Forces multi-threaded behaviour. */
|
|
||||||
+static void *
|
|
||||||
+blocked_thread_func (void *closure)
|
|
||||||
+{
|
|
||||||
+ xpthread_barrier_wait (&barrier);
|
|
||||||
+ /* TLS load and access tests run here in the main thread. */
|
|
||||||
+ xpthread_barrier_wait (&barrier);
|
|
||||||
+ return NULL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void *
|
|
||||||
+load_and_access (Lmid_t lmid, const char *mod, const char *func)
|
|
||||||
+{
|
|
||||||
+ /* Load module with TLS. */
|
|
||||||
+ void *p = xdlmopen (lmid, mod, RTLD_NOW);
|
|
||||||
+ /* Access the TLS variable to ensure it is allocated. */
|
|
||||||
+ void (*f) (void) = (void (*) (void))xdlsym (p, func);
|
|
||||||
+ f ();
|
|
||||||
+ return p;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
+do_test (void)
|
|
||||||
+{
|
|
||||||
+ void *mods[5];
|
|
||||||
+
|
|
||||||
+ {
|
|
||||||
+ int ret = pthread_barrier_init (&barrier, NULL, 2);
|
|
||||||
+ if (ret != 0)
|
|
||||||
+ {
|
|
||||||
+ errno = ret;
|
|
||||||
+ printf ("error: pthread_barrier_init: %m\n");
|
|
||||||
+ exit (1);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ pthread_t blocked_thread = xpthread_create (NULL, blocked_thread_func, NULL);
|
|
||||||
+ xpthread_barrier_wait (&barrier);
|
|
||||||
+
|
|
||||||
+ printf ("maintls[%zu]:\t %p .. %p\n",
|
|
||||||
+ sizeof maintls, maintls, maintls + sizeof maintls);
|
|
||||||
+ memset (maintls, 1, sizeof maintls);
|
|
||||||
+
|
|
||||||
+ /* Load modules with dynamic TLS (use surplus static TLS for libc
|
|
||||||
+ in new namespaces and may be for TLS optimizations too). */
|
|
||||||
+ mods[0] = load_and_access (LM_ID_BASE, "tst-tls-ie-mod0.so", "access0");
|
|
||||||
+ mods[1] = load_and_access (LM_ID_NEWLM, "tst-tls-ie-mod1.so", "access1");
|
|
||||||
+ mods[2] = load_and_access (LM_ID_NEWLM, "tst-tls-ie-mod2.so", "access2");
|
|
||||||
+ mods[3] = load_and_access (LM_ID_NEWLM, "tst-tls-ie-mod3.so", "access3");
|
|
||||||
+ /* Load modules with initial-exec TLS (can only use surplus static TLS). */
|
|
||||||
+ mods[4] = load_and_access (LM_ID_BASE, "tst-tls-ie-mod6.so", "access6");
|
|
||||||
+
|
|
||||||
+ /* Here 576 bytes + 3 * libc use of surplus static TLS is in use so less
|
|
||||||
+ than 1024 bytes are available (exact number depends on TLS optimizations
|
|
||||||
+ and the libc TLS use). */
|
|
||||||
+ printf ("The next dlmopen should fail...\n");
|
|
||||||
+ void *p = dlmopen (LM_ID_BASE, "tst-tls-ie-mod4.so", RTLD_NOW);
|
|
||||||
+ if (p != NULL)
|
|
||||||
+ FAIL_EXIT1 ("error: expected dlmopen to fail because there is "
|
|
||||||
+ "not enough surplus static TLS.\n");
|
|
||||||
+ printf ("...OK failed with: %s.\n", dlerror ());
|
|
||||||
+
|
|
||||||
+ xpthread_barrier_wait (&barrier);
|
|
||||||
+ xpthread_join (blocked_thread);
|
|
||||||
+
|
|
||||||
+ /* Close the modules. */
|
|
||||||
+ for (int i = 0; i < 5; ++i)
|
|
||||||
+ xdlclose (mods[i]);
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
diff --git a/elf/tst-tls-ie-mod.h b/elf/tst-tls-ie-mod.h
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..46b362a
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-tls-ie-mod.h
|
|
||||||
@@ -0,0 +1,40 @@
|
|
||||||
+/* Module with specified TLS size and model.
|
|
||||||
+ Copyright (C) 2020 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/>. */
|
|
||||||
+
|
|
||||||
+/* This file is parameterized by macros N, SIZE and MODEL. */
|
|
||||||
+
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+
|
|
||||||
+#define CONCATX(x, y) x ## y
|
|
||||||
+#define CONCAT(x, y) CONCATX (x, y)
|
|
||||||
+#define STRX(x) #x
|
|
||||||
+#define STR(x) STRX (x)
|
|
||||||
+
|
|
||||||
+#define VAR CONCAT (var, N)
|
|
||||||
+
|
|
||||||
+__attribute__ ((aligned (8), tls_model (MODEL)))
|
|
||||||
+__thread char VAR[SIZE];
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+CONCAT (access, N) (void)
|
|
||||||
+{
|
|
||||||
+ printf (STR (VAR) "[%d]:\t %p .. %p " MODEL "\n", SIZE, VAR, VAR + SIZE);
|
|
||||||
+ fflush (stdout);
|
|
||||||
+ memset (VAR, 1, SIZE);
|
|
||||||
+}
|
|
||||||
diff --git a/elf/tst-tls-ie-mod0.c b/elf/tst-tls-ie-mod0.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..2450686
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-tls-ie-mod0.c
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+#define N 0
|
|
||||||
+#define SIZE 480
|
|
||||||
+#define MODEL "global-dynamic"
|
|
||||||
+#include "tst-tls-ie-mod.h"
|
|
||||||
diff --git a/elf/tst-tls-ie-mod1.c b/elf/tst-tls-ie-mod1.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..849ff91
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-tls-ie-mod1.c
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+#define N 1
|
|
||||||
+#define SIZE 120
|
|
||||||
+#define MODEL "global-dynamic"
|
|
||||||
+#include "tst-tls-ie-mod.h"
|
|
||||||
diff --git a/elf/tst-tls-ie-mod2.c b/elf/tst-tls-ie-mod2.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..23915ab
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-tls-ie-mod2.c
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+#define N 2
|
|
||||||
+#define SIZE 24
|
|
||||||
+#define MODEL "global-dynamic"
|
|
||||||
+#include "tst-tls-ie-mod.h"
|
|
||||||
diff --git a/elf/tst-tls-ie-mod3.c b/elf/tst-tls-ie-mod3.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..5395f84
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-tls-ie-mod3.c
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+#define N 3
|
|
||||||
+#define SIZE 16
|
|
||||||
+#define MODEL "global-dynamic"
|
|
||||||
+#include "tst-tls-ie-mod.h"
|
|
||||||
diff --git a/elf/tst-tls-ie-mod4.c b/elf/tst-tls-ie-mod4.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..93ac2ea
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-tls-ie-mod4.c
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+#define N 4
|
|
||||||
+#define SIZE 1024
|
|
||||||
+#define MODEL "initial-exec"
|
|
||||||
+#include "tst-tls-ie-mod.h"
|
|
||||||
diff --git a/elf/tst-tls-ie-mod5.c b/elf/tst-tls-ie-mod5.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..84b3fd2
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-tls-ie-mod5.c
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+#define N 5
|
|
||||||
+#define SIZE 128
|
|
||||||
+#define MODEL "initial-exec"
|
|
||||||
+#include "tst-tls-ie-mod.h"
|
|
||||||
diff --git a/elf/tst-tls-ie-mod6.c b/elf/tst-tls-ie-mod6.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..c736bf0
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-tls-ie-mod6.c
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+#define N 6
|
|
||||||
+#define SIZE 576
|
|
||||||
+#define MODEL "initial-exec"
|
|
||||||
+#include "tst-tls-ie-mod.h"
|
|
||||||
diff --git a/elf/tst-tls-ie.c b/elf/tst-tls-ie.c
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..2dc0894
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/elf/tst-tls-ie.c
|
|
||||||
@@ -0,0 +1,111 @@
|
|
||||||
+/* Test dlopen of modules with initial-exec TLS.
|
|
||||||
+ Copyright (C) 2016-2020 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/>. */
|
|
||||||
+
|
|
||||||
+/* This test tries to check that surplus static TLS is not used up for
|
|
||||||
+ dynamic TLS optimizations and 3*192 + 4*144 = 1152 bytes of static
|
|
||||||
+ TLS is available for dlopening modules with initial-exec TLS. It
|
|
||||||
+ depends on rtld.nns=4 and rtld.optional_static_tls=512 tunable setting. */
|
|
||||||
+
|
|
||||||
+#include <errno.h>
|
|
||||||
+#include <pthread.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+
|
|
||||||
+static int do_test (void);
|
|
||||||
+#include <support/xthread.h>
|
|
||||||
+#include <support/xdlfcn.h>
|
|
||||||
+#include <support/check.h>
|
|
||||||
+#include <support/test-driver.c>
|
|
||||||
+
|
|
||||||
+/* Have some big TLS in the main exe: should not use surplus TLS. */
|
|
||||||
+__thread char maintls[1000];
|
|
||||||
+
|
|
||||||
+static pthread_barrier_t barrier;
|
|
||||||
+
|
|
||||||
+/* Forces multi-threaded behaviour. */
|
|
||||||
+static void *
|
|
||||||
+blocked_thread_func (void *closure)
|
|
||||||
+{
|
|
||||||
+ xpthread_barrier_wait (&barrier);
|
|
||||||
+ /* TLS load and access tests run here in the main thread. */
|
|
||||||
+ xpthread_barrier_wait (&barrier);
|
|
||||||
+ return NULL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void *
|
|
||||||
+load_and_access (const char *mod, const char *func)
|
|
||||||
+{
|
|
||||||
+ /* Load module with TLS. */
|
|
||||||
+ void *p = xdlopen (mod, RTLD_NOW);
|
|
||||||
+ /* Access the TLS variable to ensure it is allocated. */
|
|
||||||
+ void (*f) (void) = (void (*) (void))xdlsym (p, func);
|
|
||||||
+ f ();
|
|
||||||
+ return p;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
+do_test (void)
|
|
||||||
+{
|
|
||||||
+ void *mods[6];
|
|
||||||
+
|
|
||||||
+ {
|
|
||||||
+ int ret = pthread_barrier_init (&barrier, NULL, 2);
|
|
||||||
+ if (ret != 0)
|
|
||||||
+ {
|
|
||||||
+ errno = ret;
|
|
||||||
+ printf ("error: pthread_barrier_init: %m\n");
|
|
||||||
+ exit (1);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ pthread_t blocked_thread = xpthread_create (NULL, blocked_thread_func, NULL);
|
|
||||||
+ xpthread_barrier_wait (&barrier);
|
|
||||||
+
|
|
||||||
+ printf ("maintls[%zu]:\t %p .. %p\n",
|
|
||||||
+ sizeof maintls, maintls, maintls + sizeof maintls);
|
|
||||||
+ memset (maintls, 1, sizeof maintls);
|
|
||||||
+
|
|
||||||
+ /* Load modules with dynamic TLS (may use surplus static TLS
|
|
||||||
+ opportunistically). */
|
|
||||||
+ mods[0] = load_and_access ("tst-tls-ie-mod0.so", "access0");
|
|
||||||
+ mods[1] = load_and_access ("tst-tls-ie-mod1.so", "access1");
|
|
||||||
+ mods[2] = load_and_access ("tst-tls-ie-mod2.so", "access2");
|
|
||||||
+ mods[3] = load_and_access ("tst-tls-ie-mod3.so", "access3");
|
|
||||||
+ /* Load modules with initial-exec TLS (can only use surplus static TLS). */
|
|
||||||
+ mods[4] = load_and_access ("tst-tls-ie-mod4.so", "access4");
|
|
||||||
+ mods[5] = load_and_access ("tst-tls-ie-mod5.so", "access5");
|
|
||||||
+
|
|
||||||
+ /* Here 1152 bytes of surplus static TLS is in use and at most 512 bytes
|
|
||||||
+ are available (depending on TLS optimizations). */
|
|
||||||
+ printf ("The next dlopen should fail...\n");
|
|
||||||
+ void *p = dlopen ("tst-tls-ie-mod6.so", RTLD_NOW);
|
|
||||||
+ if (p != NULL)
|
|
||||||
+ FAIL_EXIT1 ("error: expected dlopen to fail because there is "
|
|
||||||
+ "not enough surplus static TLS.\n");
|
|
||||||
+ printf ("...OK failed with: %s.\n", dlerror ());
|
|
||||||
+
|
|
||||||
+ xpthread_barrier_wait (&barrier);
|
|
||||||
+ xpthread_join (blocked_thread);
|
|
||||||
+
|
|
||||||
+ /* Close the modules. */
|
|
||||||
+ for (int i = 0; i < 6; ++i)
|
|
||||||
+ xdlclose (mods[i]);
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
|
|
||||||
index eb3ef5b..ba114ab 100644
|
|
||||||
--- a/sysdeps/generic/ldsodefs.h
|
|
||||||
+++ b/sysdeps/generic/ldsodefs.h
|
|
||||||
@@ -442,6 +442,9 @@ struct rtld_global
|
|
||||||
EXTERN size_t _dl_tls_static_used;
|
|
||||||
/* Alignment requirement of the static TLS block. */
|
|
||||||
EXTERN size_t _dl_tls_static_align;
|
|
||||||
+ /* Remaining amount of static TLS that may be used for optimizing
|
|
||||||
+ dynamic TLS access (e.g. with TLSDESC). */
|
|
||||||
+ EXTERN size_t _dl_tls_static_optional;
|
|
||||||
|
|
||||||
/* Number of additional entries in the slotinfo array of each slotinfo
|
|
||||||
list element. A large number makes it almost certain take we never
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
@ -1,25 +1,45 @@
|
|||||||
From 44314a556239a7524b5a6451025737c1bdbb1cd0 Mon Sep 17 00:00:00 2001
|
From dc8c5d3ba8ec3c2de8ca0898d682d89492d275b3 Mon Sep 17 00:00:00 2001
|
||||||
From: Wang Shuo <wangshuo47@huawei.com>
|
From: Shuo Wang <wangshuo_1994@foxmail.com>
|
||||||
Date: Thu, 21 May 2020 11:23:06 +0800
|
Date: Tue, 2 Mar 2021 10:41:09 +0800
|
||||||
Subject: [PATCH] turn REP_STOSB_THRESHOLD from 2k to 1M
|
Subject: [PATCH] turn REP_STOSB_THRESHOLD from 2k to 1M
|
||||||
|
|
||||||
|
REP_STOSB_THRESHOLD is designed to choose vec mov or stosb.
|
||||||
|
The default threshold (2k) will lead to performance degradation if the
|
||||||
|
memcpy size is between 2k and 1M.
|
||||||
---
|
---
|
||||||
sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S | 2 +-
|
sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S | 12 +++++++++++-
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
|
diff --git a/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
|
||||||
index dcd63c92..92c08eed 100644
|
index faa40856..76f84748 100644
|
||||||
--- a/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
|
--- a/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
|
||||||
+++ b/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
|
+++ b/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
|
||||||
@@ -65,7 +65,7 @@
|
@@ -58,6 +58,16 @@
|
||||||
Enhanced REP STOSB. Since the stored value is fixed, larger register
|
# endif
|
||||||
size has minimal impact on threshold. */
|
|
||||||
#ifndef REP_STOSB_THRESHOLD
|
|
||||||
-# define REP_STOSB_THRESHOLD 2048
|
|
||||||
+# define REP_STOSB_THRESHOLD 1048576
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
+/* Threshold to use Enhanced REP STOSB. Since there is overhead to set
|
||||||
|
+ up REP STOSB operation, REP STOSB isn't faster on short data. The
|
||||||
|
+ memset micro benchmark in glibc shows that 2KB is the approximate
|
||||||
|
+ value above which REP STOSB becomes faster on processors with
|
||||||
|
+ Enhanced REP STOSB. Since the stored value is fixed, larger register
|
||||||
|
+ size has minimal impact on threshold. */
|
||||||
|
+#ifndef REP_STOSB_THRESHOLD
|
||||||
|
+# define REP_STOSB_THRESHOLD 1048576
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
#ifndef SECTION
|
#ifndef SECTION
|
||||||
|
# error SECTION is not defined!
|
||||||
|
#endif
|
||||||
|
@@ -171,7 +181,7 @@ ENTRY (MEMSET_SYMBOL (__memset, unaligned_erms))
|
||||||
|
ret
|
||||||
|
|
||||||
|
L(stosb_more_2x_vec):
|
||||||
|
- cmp __x86_rep_stosb_threshold(%rip), %RDX_LP
|
||||||
|
+ cmp $REP_STOSB_THRESHOLD, %RDX_LP
|
||||||
|
ja L(stosb)
|
||||||
|
#endif
|
||||||
|
L(more_2x_vec):
|
||||||
--
|
--
|
||||||
2.19.1
|
2.23.0
|
||||||
|
|
||||||
|
|||||||
@ -1,50 +0,0 @@
|
|||||||
From 55c7bcc71b84123d5d4bd2814366a6b05fcf8ebd Mon Sep 17 00:00:00 2001
|
|
||||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
|
||||||
Date: Sat, 9 May 2020 12:04:23 -0700
|
|
||||||
Subject: [PATCH] x86-64: Use RDX_LP on __x86_shared_non_temporal_threshold [BZ
|
|
||||||
#25966]
|
|
||||||
|
|
||||||
Since __x86_shared_non_temporal_threshold is defined as
|
|
||||||
|
|
||||||
long int __x86_shared_non_temporal_threshold;
|
|
||||||
|
|
||||||
and long int is 4 bytes for x32, use RDX_LP to compare against
|
|
||||||
__x86_shared_non_temporal_threshold in assembly code.
|
|
||||||
---
|
|
||||||
sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
|
|
||||||
index c763b7d871..74953245aa 100644
|
|
||||||
--- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
|
|
||||||
+++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
|
|
||||||
@@ -244,7 +244,7 @@ L(return):
|
|
||||||
ret
|
|
||||||
|
|
||||||
L(movsb):
|
|
||||||
- cmpq __x86_shared_non_temporal_threshold(%rip), %rdx
|
|
||||||
+ cmp __x86_shared_non_temporal_threshold(%rip), %RDX_LP
|
|
||||||
jae L(more_8x_vec)
|
|
||||||
cmpq %rsi, %rdi
|
|
||||||
jb 1f
|
|
||||||
@@ -402,7 +402,7 @@ L(more_8x_vec):
|
|
||||||
addq %r8, %rdx
|
|
||||||
#if (defined USE_MULTIARCH || VEC_SIZE == 16) && IS_IN (libc)
|
|
||||||
/* Check non-temporal store threshold. */
|
|
||||||
- cmpq __x86_shared_non_temporal_threshold(%rip), %rdx
|
|
||||||
+ cmp __x86_shared_non_temporal_threshold(%rip), %RDX_LP
|
|
||||||
ja L(large_forward)
|
|
||||||
#endif
|
|
||||||
L(loop_4x_vec_forward):
|
|
||||||
@@ -454,7 +454,7 @@ L(more_8x_vec_backward):
|
|
||||||
subq %r8, %rdx
|
|
||||||
#if (defined USE_MULTIARCH || VEC_SIZE == 16) && IS_IN (libc)
|
|
||||||
/* Check non-temporal store threshold. */
|
|
||||||
- cmpq __x86_shared_non_temporal_threshold(%rip), %rdx
|
|
||||||
+ cmp __x86_shared_non_temporal_threshold(%rip), %RDX_LP
|
|
||||||
ja L(large_backward)
|
|
||||||
#endif
|
|
||||||
L(loop_4x_vec_backward):
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
From a35a59036ebae3efcdf5e8167610e0656fca9770 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
|
||||||
Date: Thu, 11 Jun 2020 12:41:18 -0700
|
|
||||||
Subject: [PATCH] x86_64: Use %xmmN with vpxor to clear a vector register
|
|
||||||
|
|
||||||
Since "vpxor %xmmN, %xmmN, %xmmN" clears the whole vector register, use
|
|
||||||
%xmmN, instead of %ymmN, with vpxor to clear a vector register.
|
|
||||||
---
|
|
||||||
sysdeps/x86_64/multiarch/strcmp-avx2.S | 4 ++--
|
|
||||||
sysdeps/x86_64/multiarch/strrchr-avx2.S | 2 +-
|
|
||||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
|
||||||
index 48d03a9f46..5f88a68262 100644
|
|
||||||
--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
|
||||||
+++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S
|
|
||||||
@@ -91,8 +91,8 @@ ENTRY (STRCMP)
|
|
||||||
# endif
|
|
||||||
movl %edi, %eax
|
|
||||||
xorl %edx, %edx
|
|
||||||
- /* Make %ymm7 all zeros in this function. */
|
|
||||||
- vpxor %ymm7, %ymm7, %ymm7
|
|
||||||
+ /* Make %xmm7 (%ymm7) all zeros in this function. */
|
|
||||||
+ vpxor %xmm7, %xmm7, %xmm7
|
|
||||||
orl %esi, %eax
|
|
||||||
andl $(PAGE_SIZE - 1), %eax
|
|
||||||
cmpl $(PAGE_SIZE - (VEC_SIZE * 4)), %eax
|
|
||||||
diff --git a/sysdeps/x86_64/multiarch/strrchr-avx2.S b/sysdeps/x86_64/multiarch/strrchr-avx2.S
|
|
||||||
index 23077b4c45..146bdd51d0 100644
|
|
||||||
--- a/sysdeps/x86_64/multiarch/strrchr-avx2.S
|
|
||||||
+++ b/sysdeps/x86_64/multiarch/strrchr-avx2.S
|
|
||||||
@@ -44,7 +44,7 @@ ENTRY (STRRCHR)
|
|
||||||
movl %edi, %ecx
|
|
||||||
/* Broadcast CHAR to YMM4. */
|
|
||||||
VPBROADCAST %xmm4, %ymm4
|
|
||||||
- vpxor %ymm0, %ymm0, %ymm0
|
|
||||||
+ vpxor %xmm0, %xmm0, %xmm0
|
|
||||||
|
|
||||||
/* Check if we may cross page boundary with one vector load. */
|
|
||||||
andl $(2 * VEC_SIZE - 1), %ecx
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user