commit
adc3267f20
@ -0,0 +1 @@
|
||||
SOURCES/glibc-2.39.tar.xz
|
@ -0,0 +1 @@
|
||||
4b043eaba31efbdfc92c85d062e975141870295e SOURCES/glibc-2.39.tar.xz
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,79 @@
|
||||
commit 95f61610f3e481d191b6184432342236fd59186d
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Wed Jul 24 12:06:47 2024 +0200
|
||||
|
||||
resolv: Support clearing option flags with a “-” prefix (bug 14799)
|
||||
|
||||
I think using a “-” prefix is less confusing than introducing
|
||||
double-negation construct (“no-no-tld-query”).
|
||||
|
||||
Reviewed-by: DJ Delorie <dj@redhat.com>
|
||||
|
||||
diff --git a/resolv/res_init.c b/resolv/res_init.c
|
||||
index 263263d474721545..243532b3ade338d8 100644
|
||||
--- a/resolv/res_init.c
|
||||
+++ b/resolv/res_init.c
|
||||
@@ -682,27 +682,29 @@ res_setoptions (struct resolv_conf_parser *parser, const char *options)
|
||||
{
|
||||
char str[22];
|
||||
uint8_t len;
|
||||
- uint8_t clear;
|
||||
unsigned long int flag;
|
||||
} options[] = {
|
||||
#define STRnLEN(str) str, sizeof (str) - 1
|
||||
- { STRnLEN ("rotate"), 0, RES_ROTATE },
|
||||
- { STRnLEN ("edns0"), 0, RES_USE_EDNS0 },
|
||||
- { STRnLEN ("single-request-reopen"), 0, RES_SNGLKUPREOP },
|
||||
- { STRnLEN ("single-request"), 0, RES_SNGLKUP },
|
||||
- { STRnLEN ("no_tld_query"), 0, RES_NOTLDQUERY },
|
||||
- { STRnLEN ("no-tld-query"), 0, RES_NOTLDQUERY },
|
||||
- { STRnLEN ("no-reload"), 0, RES_NORELOAD },
|
||||
- { STRnLEN ("use-vc"), 0, RES_USEVC },
|
||||
- { STRnLEN ("trust-ad"), 0, RES_TRUSTAD },
|
||||
- { STRnLEN ("no-aaaa"), 0, RES_NOAAAA },
|
||||
+ { STRnLEN ("rotate"), RES_ROTATE },
|
||||
+ { STRnLEN ("edns0"), RES_USE_EDNS0 },
|
||||
+ { STRnLEN ("single-request-reopen"), RES_SNGLKUPREOP },
|
||||
+ { STRnLEN ("single-request"), RES_SNGLKUP },
|
||||
+ { STRnLEN ("no_tld_query"), RES_NOTLDQUERY },
|
||||
+ { STRnLEN ("no-tld-query"), RES_NOTLDQUERY },
|
||||
+ { STRnLEN ("no-reload"), RES_NORELOAD },
|
||||
+ { STRnLEN ("use-vc"), RES_USEVC },
|
||||
+ { STRnLEN ("trust-ad"), RES_TRUSTAD },
|
||||
+ { STRnLEN ("no-aaaa"), RES_NOAAAA },
|
||||
};
|
||||
#define noptions (sizeof (options) / sizeof (options[0]))
|
||||
+ bool negate_option = *cp == '-';
|
||||
+ if (negate_option)
|
||||
+ ++cp;
|
||||
for (int i = 0; i < noptions; ++i)
|
||||
if (strncmp (cp, options[i].str, options[i].len) == 0)
|
||||
{
|
||||
- if (options[i].clear)
|
||||
- parser->template.options &= options[i].flag;
|
||||
+ if (negate_option)
|
||||
+ parser->template.options &= ~options[i].flag;
|
||||
else
|
||||
parser->template.options |= options[i].flag;
|
||||
break;
|
||||
diff --git a/resolv/tst-resolv-res_init-skeleton.c b/resolv/tst-resolv-res_init-skeleton.c
|
||||
index 6bef62cde2cbf8cd..d3a19eb305d41467 100644
|
||||
--- a/resolv/tst-resolv-res_init-skeleton.c
|
||||
+++ b/resolv/tst-resolv-res_init-skeleton.c
|
||||
@@ -679,6 +679,16 @@ struct test_case test_cases[] =
|
||||
"; nameserver[0]: [192.0.2.1]:53\n",
|
||||
.res_options = "attempts:5 ndots:3 edns0 ",
|
||||
},
|
||||
+ {.name = "RES_OPTIONS can clear flags",
|
||||
+ .conf = "options ndots:2 use-vc no-aaaa edns0\n"
|
||||
+ "nameserver 192.0.2.1\n",
|
||||
+ .expected = "options ndots:3 use-vc\n"
|
||||
+ "search example.com\n"
|
||||
+ "; search[0]: example.com\n"
|
||||
+ "nameserver 192.0.2.1\n"
|
||||
+ "; nameserver[0]: [192.0.2.1]:53\n",
|
||||
+ .res_options = "ndots:3 -edns0 -no-aaaa",
|
||||
+ },
|
||||
{.name = "many search list entries (bug 19569)",
|
||||
.conf = "nameserver 192.0.2.1\n"
|
||||
"search corp.example.com support.example.com"
|
@ -0,0 +1,204 @@
|
||||
commit 765325951ac5c7d072278c9424930b29657e9758
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Wed Jul 24 12:06:47 2024 +0200
|
||||
|
||||
resolv: Implement strict-error stub resolver option (bug 27929)
|
||||
|
||||
For now, do not enable this mode by default due to the potential
|
||||
impact on compatibility with existing deployments.
|
||||
|
||||
Reviewed-by: DJ Delorie <dj@redhat.com>
|
||||
|
||||
diff --git a/resolv/res_init.c b/resolv/res_init.c
|
||||
index 243532b3ade338d8..b838dc70642e1935 100644
|
||||
--- a/resolv/res_init.c
|
||||
+++ b/resolv/res_init.c
|
||||
@@ -695,6 +695,7 @@ res_setoptions (struct resolv_conf_parser *parser, const char *options)
|
||||
{ STRnLEN ("use-vc"), RES_USEVC },
|
||||
{ STRnLEN ("trust-ad"), RES_TRUSTAD },
|
||||
{ STRnLEN ("no-aaaa"), RES_NOAAAA },
|
||||
+ { STRnLEN ("strict-error"), RES_STRICTERR },
|
||||
};
|
||||
#define noptions (sizeof (options) / sizeof (options[0]))
|
||||
bool negate_option = *cp == '-';
|
||||
diff --git a/resolv/res_send.c b/resolv/res_send.c
|
||||
index 9c77613f374e5469..9a284ed44aa8cc2e 100644
|
||||
--- a/resolv/res_send.c
|
||||
+++ b/resolv/res_send.c
|
||||
@@ -1234,21 +1234,38 @@ send_dg(res_state statp,
|
||||
|
||||
if (thisansp_error) {
|
||||
next_ns:
|
||||
- if (recvresp1 || (buf2 != NULL && recvresp2)) {
|
||||
- *resplen2 = 0;
|
||||
- return resplen;
|
||||
- }
|
||||
- if (buf2 != NULL && !single_request)
|
||||
+ /* Outside of strict-error mode, use the first
|
||||
+ response even if the second response is an
|
||||
+ error. This allows parallel resolution to
|
||||
+ succeed even if the recursive resolver
|
||||
+ always answers with SERVFAIL for AAAA
|
||||
+ queries (which still happens in practice
|
||||
+ unfortunately).
|
||||
+
|
||||
+ In strict-error mode, always switch to the
|
||||
+ next server and try to get a response from
|
||||
+ there. */
|
||||
+ if ((statp->options & RES_STRICTERR) == 0)
|
||||
{
|
||||
- /* No data from the first reply. */
|
||||
- resplen = 0;
|
||||
- /* We are waiting for a possible second reply. */
|
||||
- if (matching_query == 1)
|
||||
- recvresp1 = 1;
|
||||
- else
|
||||
- recvresp2 = 1;
|
||||
-
|
||||
- goto wait;
|
||||
+ if (recvresp1 || (buf2 != NULL && recvresp2))
|
||||
+ {
|
||||
+ *resplen2 = 0;
|
||||
+ return resplen;
|
||||
+ }
|
||||
+
|
||||
+ if (buf2 != NULL && !single_request)
|
||||
+ {
|
||||
+ /* No data from the first reply. */
|
||||
+ resplen = 0;
|
||||
+ /* We are waiting for a possible
|
||||
+ second reply. */
|
||||
+ if (matching_query == 1)
|
||||
+ recvresp1 = 1;
|
||||
+ else
|
||||
+ recvresp2 = 1;
|
||||
+
|
||||
+ goto wait;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* don't retry if called from dig */
|
||||
diff --git a/resolv/resolv.h b/resolv/resolv.h
|
||||
index f40d6c58cee0f585..b8a0f66a5fd50e22 100644
|
||||
--- a/resolv/resolv.h
|
||||
+++ b/resolv/resolv.h
|
||||
@@ -133,6 +133,7 @@ struct res_sym {
|
||||
#define RES_NORELOAD 0x02000000 /* No automatic configuration reload. */
|
||||
#define RES_TRUSTAD 0x04000000 /* Request AD bit, keep it in responses. */
|
||||
#define RES_NOAAAA 0x08000000 /* Suppress AAAA queries. */
|
||||
+#define RES_STRICTERR 0x10000000 /* Report more DNS errors as errors. */
|
||||
|
||||
#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH)
|
||||
|
||||
diff --git a/resolv/tst-resolv-res_init-skeleton.c b/resolv/tst-resolv-res_init-skeleton.c
|
||||
index d3a19eb305d41467..e41bcebd9d9a8024 100644
|
||||
--- a/resolv/tst-resolv-res_init-skeleton.c
|
||||
+++ b/resolv/tst-resolv-res_init-skeleton.c
|
||||
@@ -129,6 +129,7 @@ print_resp (FILE *fp, res_state resp)
|
||||
print_option_flag (fp, &options, RES_NORELOAD, "no-reload");
|
||||
print_option_flag (fp, &options, RES_TRUSTAD, "trust-ad");
|
||||
print_option_flag (fp, &options, RES_NOAAAA, "no-aaaa");
|
||||
+ print_option_flag (fp, &options, RES_STRICTERR, "strict-error");
|
||||
fputc ('\n', fp);
|
||||
if (options != 0)
|
||||
fprintf (fp, "; error: unresolved option bits: 0x%x\n", options);
|
||||
@@ -741,6 +742,15 @@ struct test_case test_cases[] =
|
||||
"nameserver 192.0.2.1\n"
|
||||
"; nameserver[0]: [192.0.2.1]:53\n"
|
||||
},
|
||||
+ {.name = "strict-error flag",
|
||||
+ .conf = "options strict-error\n"
|
||||
+ "nameserver 192.0.2.1\n",
|
||||
+ .expected = "options strict-error\n"
|
||||
+ "search example.com\n"
|
||||
+ "; search[0]: example.com\n"
|
||||
+ "nameserver 192.0.2.1\n"
|
||||
+ "; nameserver[0]: [192.0.2.1]:53\n"
|
||||
+ },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
diff --git a/resolv/tst-resolv-semi-failure.c b/resolv/tst-resolv-semi-failure.c
|
||||
index aa9798b5a7dfaa88..b7681210f450bb5a 100644
|
||||
--- a/resolv/tst-resolv-semi-failure.c
|
||||
+++ b/resolv/tst-resolv-semi-failure.c
|
||||
@@ -67,6 +67,9 @@ response (const struct resolv_response_context *ctx,
|
||||
resolv_response_close_record (b);
|
||||
}
|
||||
|
||||
+/* Set to 1 if strict error checking is enabled. */
|
||||
+static int do_strict_error;
|
||||
+
|
||||
static void
|
||||
check_one (void)
|
||||
{
|
||||
@@ -83,7 +86,10 @@ check_one (void)
|
||||
struct addrinfo *ai;
|
||||
int ret = getaddrinfo ("www.example", "80", &hints, &ai);
|
||||
const char *expected;
|
||||
- if (ret == 0 && ai->ai_next != NULL)
|
||||
+ /* In strict-error mode, a switch to the second name server
|
||||
+ happens, and both responses are received, so a single
|
||||
+ response is a bug. */
|
||||
+ if (do_strict_error || (ret == 0 && ai->ai_next != NULL))
|
||||
expected = ("address: STREAM/TCP 192.0.2.17 80\n"
|
||||
"address: STREAM/TCP 2001:db8::1 80\n");
|
||||
else
|
||||
@@ -99,33 +105,36 @@ check_one (void)
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
- for (int do_single_lookup = 0; do_single_lookup < 2; ++do_single_lookup)
|
||||
- {
|
||||
- struct resolv_test *aux = resolv_test_start
|
||||
- ((struct resolv_redirect_config)
|
||||
- {
|
||||
- .response_callback = response,
|
||||
- });
|
||||
+ for (do_strict_error = 0; do_strict_error < 2; ++do_strict_error)
|
||||
+ for (int do_single_lookup = 0; do_single_lookup < 2; ++do_single_lookup)
|
||||
+ {
|
||||
+ struct resolv_test *aux = resolv_test_start
|
||||
+ ((struct resolv_redirect_config)
|
||||
+ {
|
||||
+ .response_callback = response,
|
||||
+ });
|
||||
|
||||
- if (do_single_lookup)
|
||||
- _res.options |= RES_SNGLKUP;
|
||||
+ if (do_strict_error)
|
||||
+ _res.options |= RES_STRICTERR;
|
||||
+ if (do_single_lookup)
|
||||
+ _res.options |= RES_SNGLKUP;
|
||||
|
||||
- for (int do_fail_aaaa = 0; do_fail_aaaa < 2; ++do_fail_aaaa)
|
||||
- {
|
||||
- fail_aaaa = do_fail_aaaa;
|
||||
+ for (int do_fail_aaaa = 0; do_fail_aaaa < 2; ++do_fail_aaaa)
|
||||
+ {
|
||||
+ fail_aaaa = do_fail_aaaa;
|
||||
|
||||
- rcode = 2; /* SERVFAIL. */
|
||||
- check_one ();
|
||||
+ rcode = 2; /* SERVFAIL. */
|
||||
+ check_one ();
|
||||
|
||||
- rcode = 4; /* NOTIMP. */
|
||||
- check_one ();
|
||||
+ rcode = 4; /* NOTIMP. */
|
||||
+ check_one ();
|
||||
|
||||
- rcode = 5; /* REFUSED. */
|
||||
- check_one ();
|
||||
- }
|
||||
+ rcode = 5; /* REFUSED. */
|
||||
+ check_one ();
|
||||
+ }
|
||||
|
||||
- resolv_test_end (aux);
|
||||
- }
|
||||
+ resolv_test_end (aux);
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
objpfx = $(prefix)/$(ver)/usr/libexec/glibc-benchtests/
|
||||
|
||||
bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 ffs ffsll \
|
||||
log log2 modf pow rint sin sincos sinh sqrt tan tanh
|
||||
|
||||
bench-pthread := pthread_once
|
||||
|
||||
bench := $(bench-math) $(bench-pthread)
|
||||
|
||||
run-bench := $(prefix)/$(ver)/lib64/ld-linux-x86-64.so.2 --library-path $(prefix)/$(ver)/lib64 $${run}
|
||||
|
||||
# String function benchmarks.
|
||||
string-bench := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
|
||||
mempcpy memset rawmemchr stpcpy stpncpy strcasecmp strcasestr \
|
||||
strcat strchr strchrnul strcmp strcpy strcspn strlen \
|
||||
strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
|
||||
strspn strstr strcpy_chk stpcpy_chk memrchr strsep strtok
|
||||
string-bench-all := $(string-bench)
|
||||
|
||||
stdlib-bench := strtod
|
||||
|
||||
benchset := $(string-bench-all) $(stdlib-bench)
|
||||
|
||||
bench-malloc := malloc-thread
|
||||
|
||||
binaries-bench := $(addprefix $(objpfx)bench-,$(bench))
|
||||
binaries-benchset := $(addprefix $(objpfx)bench-,$(benchset))
|
||||
binaries-bench-malloc := $(addprefix $(objpfx)bench-,$(bench-malloc))
|
||||
|
||||
DETAILED_OPT :=
|
||||
|
||||
ifdef DETAILED
|
||||
DETAILED_OPT := -d
|
||||
endif
|
||||
|
||||
bench: bench-set bench-func bench-malloc
|
||||
|
||||
bench-set: $(binaries-benchset)
|
||||
for run in $^; do \
|
||||
outfile=$(prefix)/$$(basename $${run}.$(ver).out); \
|
||||
echo "Running $${run}"; \
|
||||
$(run-bench) > $${outfile}.tmp; \
|
||||
mv $${outfile}{.tmp,}; \
|
||||
done
|
||||
|
||||
bench-malloc: $(binaries-bench-malloc)
|
||||
run=$(objpfx)bench-malloc-thread; \
|
||||
outfile=$(prefix)/$$(basename $${run}.$(ver).out); \
|
||||
for thr in 1 8 16 32; do \
|
||||
echo "Running $${run} $${thr}"; \
|
||||
$(run-bench) $${thr} > $${outfile}.tmp; \
|
||||
mv $${outfile}{.tmp,}; \
|
||||
done
|
||||
|
||||
# Build and execute the benchmark functions. This target generates JSON
|
||||
# formatted bench.out. Each of the programs produce independent JSON output,
|
||||
# so one could even execute them individually and process it using any JSON
|
||||
# capable language or tool.
|
||||
bench-func: $(binaries-bench)
|
||||
{ echo "{\"timing_type\": \"hp-timing\","; \
|
||||
echo " \"functions\": {"; \
|
||||
for run in $^; do \
|
||||
if ! [ "x$${run}" = "x$<" ]; then \
|
||||
echo ","; \
|
||||
fi; \
|
||||
echo "Running $${run}" >&2; \
|
||||
$(run-bench) $(DETAILED_OPT); \
|
||||
done; \
|
||||
echo; \
|
||||
echo " }"; \
|
||||
echo "}"; } > $(prefix)/bench.$(ver).out-tmp; \
|
||||
if [ -f $(prefix)/bench.$(ver).out ]; then \
|
||||
mv -f $(prefix)/bench.$(ver).out{,.old}; \
|
||||
fi; \
|
||||
mv -f $(prefix)/bench.$(ver).out{-tmp,}
|
||||
# scripts/validate_benchout.py bench.out \
|
||||
# scripts/benchout.schema.json
|
@ -0,0 +1,121 @@
|
||||
commit 5361ad3910c257bc327567be76fde532ed238e42
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Apr 19 14:38:17 2024 +0200
|
||||
|
||||
login: Use unsigned 32-bit types for seconds-since-epoch
|
||||
|
||||
These fields store timestamps when the system was running. No Linux
|
||||
systems existed before 1970, so these values are unused. Switching
|
||||
to unsigned types allows continued use of the existing struct layouts
|
||||
beyond the year 2038.
|
||||
|
||||
The intent is to give distributions more time to switch to improved
|
||||
interfaces that also avoid locking/data corruption issues.
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
diff --git a/bits/utmp.h b/bits/utmp.h
|
||||
index f2d1c13d8cd205b2..27cb536800c46d67 100644
|
||||
--- a/bits/utmp.h
|
||||
+++ b/bits/utmp.h
|
||||
@@ -36,7 +36,7 @@
|
||||
struct lastlog
|
||||
{
|
||||
#if __WORDSIZE_TIME64_COMPAT32
|
||||
- int32_t ll_time;
|
||||
+ __uint32_t ll_time;
|
||||
#else
|
||||
__time_t ll_time;
|
||||
#endif
|
||||
@@ -76,7 +76,7 @@ struct utmp
|
||||
int32_t ut_session; /* Session ID, used for windowing. */
|
||||
struct
|
||||
{
|
||||
- int32_t tv_sec; /* Seconds. */
|
||||
+ __uint32_t tv_sec; /* Seconds. */
|
||||
int32_t tv_usec; /* Microseconds. */
|
||||
} ut_tv; /* Time entry was made. */
|
||||
#else
|
||||
diff --git a/login/Makefile b/login/Makefile
|
||||
index f91190e3dcd1e6c6..84563230ef665f9c 100644
|
||||
--- a/login/Makefile
|
||||
+++ b/login/Makefile
|
||||
@@ -44,9 +44,11 @@ subdir-dirs = programs
|
||||
vpath %.c programs
|
||||
|
||||
tests := tst-utmp tst-utmpx tst-grantpt tst-ptsname tst-getlogin tst-updwtmpx \
|
||||
- tst-pututxline-lockfail tst-pututxline-cache tst-utmp-size tst-utmp-size-64
|
||||
+ tst-pututxline-lockfail tst-pututxline-cache tst-utmp-size tst-utmp-size-64 \
|
||||
+ tst-utmp-unsigned tst-utmp-unsigned-64
|
||||
|
||||
CFLAGS-tst-utmp-size-64.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
|
||||
+CFLAGS-tst-utmp-unsigned-64.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
|
||||
|
||||
# Empty compatibility library for old binaries.
|
||||
extra-libs := libutil
|
||||
diff --git a/login/tst-utmp-unsigned-64.c b/login/tst-utmp-unsigned-64.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..940e7654f8dc5fd6
|
||||
--- /dev/null
|
||||
+++ b/login/tst-utmp-unsigned-64.c
|
||||
@@ -0,0 +1 @@
|
||||
+#include "tst-utmp-unsigned.c"
|
||||
diff --git a/login/tst-utmp-unsigned.c b/login/tst-utmp-unsigned.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..27ad03a7d608e83d
|
||||
--- /dev/null
|
||||
+++ b/login/tst-utmp-unsigned.c
|
||||
@@ -0,0 +1,40 @@
|
||||
+/* Check that struct utmp, struct utmpx, struct lastlog use unsigned epoch.
|
||||
+ Copyright (C) 2024 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 <utmp.h>
|
||||
+#include <utmpx.h>
|
||||
+#include <utmp-size.h>
|
||||
+
|
||||
+/* Undefined. Used to check that the conditions below are optimized away. */
|
||||
+void link_failure_utmp (void);
|
||||
+void link_failure_utmpx (void);
|
||||
+void link_failure_lastlog (void);
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ if ((struct utmp) { .ut_tv = { 0x80000000U, }, }.ut_tv.tv_sec <= 0)
|
||||
+ link_failure_utmp ();
|
||||
+ if ((struct utmpx) { .ut_tv = { 0x80000000U, }, }.ut_tv.tv_sec <= 0)
|
||||
+ link_failure_utmpx ();
|
||||
+ if ((struct lastlog) { .ll_time = 0x80000000U, }.ll_time <= 0)
|
||||
+ link_failure_lastlog ();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/sysdeps/gnu/bits/utmpx.h b/sysdeps/gnu/bits/utmpx.h
|
||||
index 34b4afbc6ac25968..ed0df9bd8141d4e6 100644
|
||||
--- a/sysdeps/gnu/bits/utmpx.h
|
||||
+++ b/sysdeps/gnu/bits/utmpx.h
|
||||
@@ -74,7 +74,7 @@ struct utmpx
|
||||
__int32_t ut_session; /* Session ID, used for windowing. */
|
||||
struct
|
||||
{
|
||||
- __int32_t tv_sec; /* Seconds. */
|
||||
+ __uint32_t tv_sec; /* Seconds. */
|
||||
__int32_t tv_usec; /* Microseconds. */
|
||||
} ut_tv; /* Time entry was made. */
|
||||
#else
|
@ -0,0 +1,153 @@
|
||||
#!/usr/bin/bash
|
||||
# This script can be invoked as follows:
|
||||
#
|
||||
# glibc-bench-compare [options] <BUILD> [BUILD]
|
||||
#
|
||||
# Options may be one of the following:
|
||||
#
|
||||
# -t The BUILD arguments are task ids and not a version-release string
|
||||
# -a ARCH Do comparison for ARCH architecture
|
||||
#
|
||||
# If any of the above options are given, both BUILD arguments must be given.
|
||||
# Otherwise, if only one BUILD is specified, then it is compared against the
|
||||
# installed glibc.
|
||||
|
||||
# Silence the pushd/popd messages
|
||||
pushd() {
|
||||
command pushd "$@" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
popd() {
|
||||
command popd "$@" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# Clean up any downloaded files before we exit
|
||||
trap "rm -rf /tmp/glibc-bench-compare.$BASHPID.*" EXIT
|
||||
|
||||
task=0
|
||||
arch=$(uname -i)
|
||||
options=0
|
||||
path=0
|
||||
installed=
|
||||
|
||||
# Look for any commandline options
|
||||
while getopts ":tpa:" opt; do
|
||||
case $opt in
|
||||
p)
|
||||
path=1
|
||||
;;
|
||||
t)
|
||||
task=1
|
||||
options=1
|
||||
echo "Not implemented."
|
||||
exit 1
|
||||
;;
|
||||
a)
|
||||
arch=$OPTARG
|
||||
options=1
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Done, now shift all option arguments out.
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [ $# -gt 2 ] || [ $# -eq 0 ] || [ $# -lt 2 -a $options -eq 1 ]; then
|
||||
echo "Usage: $0 [OPTIONS] <old> [new]"
|
||||
echo
|
||||
echo "OPTIONS:"
|
||||
echo -e "\t-t\tCompare two brew tasks"
|
||||
echo -e "\t-a ARCH\tGet rpms for the ARCH architecture"
|
||||
echo -e "\t-p\tCompare built rpms in two paths."
|
||||
echo -e "\t\tThis minimally needs glibc, glibc-common and glibc-benchtests"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z $2 ]; then
|
||||
new="$1"
|
||||
old=$(rpm --queryformat "%{VERSION}-%{RELEASE}\n" -q glibc | head -1)
|
||||
installed=$old
|
||||
else
|
||||
new="$2"
|
||||
old="$1"
|
||||
fi
|
||||
|
||||
decompress_rpms() {
|
||||
# We were given a path to the rpms. Figure out the version-release and
|
||||
# decompress the rpms.
|
||||
if [ -n $1 ]; then
|
||||
vr=$(rpm --queryformat="%{VERSION}-%{RELEASE}" -qp $1/glibc-2*.rpm | head -1)
|
||||
mkdir $vr && pushd $vr
|
||||
fi
|
||||
|
||||
for r in $1*.rpm; do
|
||||
( rpm2cpio $r | cpio -di ) > /dev/null
|
||||
done
|
||||
|
||||
if [ -n $1 ]; then
|
||||
popd
|
||||
echo $vr
|
||||
fi
|
||||
}
|
||||
|
||||
# Get rpms for a build and decompress them
|
||||
get_build() {
|
||||
echo "Processing build $1"
|
||||
mkdir $1 && pushd $1
|
||||
brew buildinfo "glibc-$1" |
|
||||
sed -n -e "s|/mnt/koji\(.\+$arch.\+\)|http://kojipkgs.fedoraproject.org\1|p" |
|
||||
while read url; do
|
||||
echo "Downloading $url"
|
||||
wget -q $url
|
||||
done
|
||||
decompress_rpms
|
||||
|
||||
echo "Removing rpms"
|
||||
rm -f $1/*.rpm
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
# Run benchmarks for a build
|
||||
run_bench() {
|
||||
if [ -z $1 ]; then
|
||||
make DETAILED=1 ver=$installed prefix= -f /usr/libexec/glibc-benchtests/bench.mk bench
|
||||
else
|
||||
make DETAILED=1 ver=$1 prefix=$PWD -f $1/usr/libexec/glibc-benchtests/bench.mk bench
|
||||
fi
|
||||
}
|
||||
|
||||
# Get absolute paths if needed, since we will change into the working directory
|
||||
# next.
|
||||
if [ $path -eq 1 ]; then
|
||||
old_path=$(realpath $old)/
|
||||
new_path=$(realpath $new)/
|
||||
fi
|
||||
|
||||
tmpdir=$(mktemp -p /tmp -d glibc-bench-compare.$$.XXXX)
|
||||
pushd $tmpdir
|
||||
|
||||
# Get both builds.
|
||||
if [ $path -eq 0 ]; then
|
||||
if [ -z $installed ]; then
|
||||
get_build $old
|
||||
fi
|
||||
get_build $new
|
||||
else
|
||||
old=$(decompress_rpms $old_path)
|
||||
new=$(decompress_rpms $new_path)
|
||||
fi
|
||||
|
||||
# make bench for each of those.
|
||||
if [ -z $installed ]; then
|
||||
run_bench $old
|
||||
else
|
||||
run_bench
|
||||
fi
|
||||
run_bench $new
|
||||
|
||||
# Now run the comparison script.
|
||||
$old/usr/libexec/glibc-benchtests/compare_bench.py $old/usr/libexec/glibc-benchtests/benchout.schema.json \
|
||||
bench.$old.out bench.$new.out
|
@ -0,0 +1,44 @@
|
||||
Short description: Adjust CS_PATH and the test container layout.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Upstream status: not-needed
|
||||
|
||||
In Fedora we should return only /usr/bin as CS_PATH because /bin is just
|
||||
a symlink to /usr/bin after MoveToUsr transition (which glibc has not
|
||||
really completed).
|
||||
|
||||
We also create /{bin,lib,lib64,sbin} in the test container as symbolic
|
||||
links. This brings the test container in line with Fedora's filesystem
|
||||
layout and avoids some test failures. For example, because Fedora's
|
||||
CS_PATH is /usr/bin, tst-vfork3 will try to execute /usr/bin/echo in the
|
||||
container. Without this change the container installs `echo' in /bin
|
||||
not /usr/bin, causing the test to fail.
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index a49870d3d1e636a9..feb2599203b10098 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -598,9 +598,13 @@ $(tests-container) $(addsuffix /tests,$(subdirs)) : \
|
||||
$(objpfx)testroot.pristine/install.stamp :
|
||||
test -d $(objpfx)testroot.pristine || \
|
||||
mkdir $(objpfx)testroot.pristine
|
||||
- # We need a working /bin/sh for some of the tests.
|
||||
- test -d $(objpfx)testroot.pristine/bin || \
|
||||
- mkdir $(objpfx)testroot.pristine/bin
|
||||
+ # Set up symlinks to directories whose contents got moved to /usr
|
||||
+ for moved in bin lib lib64 sbin; do \
|
||||
+ test -d $(objpfx)testroot.pristine/usr/$$moved || \
|
||||
+ mkdir -p $(objpfx)testroot.pristine/usr/$$moved ;\
|
||||
+ test -e $(objpfx)testroot.pristine/$$moved || \
|
||||
+ ln -s usr/$$moved $(objpfx)testroot.pristine/$$moved ;\
|
||||
+ done
|
||||
# We need the compiled locale dir for localedef tests.
|
||||
test -d $(objpfx)testroot.pristine/$(complocaledir) || \
|
||||
mkdir -p $(objpfx)testroot.pristine/$(complocaledir)
|
||||
diff --git a/sysdeps/unix/confstr.h b/sysdeps/unix/confstr.h
|
||||
index 15859c3b2759878e..9b63b7f8069866fd 100644
|
||||
--- a/sysdeps/unix/confstr.h
|
||||
+++ b/sysdeps/unix/confstr.h
|
||||
@@ -1 +1 @@
|
||||
-#define CS_PATH "/bin:/usr/bin"
|
||||
+#define CS_PATH "/usr/bin"
|
@ -0,0 +1,61 @@
|
||||
Short description: Fedora-specific workaround for kernel pty bug.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Upstream status: not-submitted
|
||||
|
||||
This is a Fedora-specific workaround for a kernel bug where calling
|
||||
ioctl on a pty will silently ignore the invalid c_cflag. The
|
||||
workaround is to use TCGETS to verify the setting matches. This is
|
||||
not upstream and needs to either be removed or submitted upstream
|
||||
after analysis.
|
||||
|
||||
Index: b/sysdeps/unix/sysv/linux/tcsetattr.c
|
||||
===================================================================
|
||||
--- a/sysdeps/unix/sysv/linux/tcsetattr.c
|
||||
+++ b/sysdeps/unix/sysv/linux/tcsetattr.c
|
||||
@@ -45,6 +45,7 @@ __tcsetattr (int fd, int optional_action
|
||||
{
|
||||
struct __kernel_termios k_termios;
|
||||
unsigned long int cmd;
|
||||
+ int retval;
|
||||
|
||||
switch (optional_actions)
|
||||
{
|
||||
@@ -75,7 +76,36 @@ __tcsetattr (int fd, int optional_action
|
||||
memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
|
||||
__KERNEL_NCCS * sizeof (cc_t));
|
||||
|
||||
- return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
|
||||
+ retval = INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
|
||||
+
|
||||
+ if (retval == 0 && cmd == TCSETS)
|
||||
+ {
|
||||
+ /* The Linux kernel has a bug which silently ignore the invalid
|
||||
+ c_cflag on pty. We have to check it here. */
|
||||
+ int save = errno;
|
||||
+ retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
|
||||
+ if (retval)
|
||||
+ {
|
||||
+ /* We cannot verify if the setting is ok. We don't return
|
||||
+ an error (?). */
|
||||
+ __set_errno (save);
|
||||
+ retval = 0;
|
||||
+ }
|
||||
+ else if ((termios_p->c_cflag & (PARENB | CREAD))
|
||||
+ != (k_termios.c_cflag & (PARENB | CREAD))
|
||||
+ || ((termios_p->c_cflag & CSIZE)
|
||||
+ && ((termios_p->c_cflag & CSIZE)
|
||||
+ != (k_termios.c_cflag & CSIZE))))
|
||||
+ {
|
||||
+ /* It looks like the Linux kernel silently changed the
|
||||
+ PARENB/CREAD/CSIZE bits in c_cflag. Report it as an
|
||||
+ error. */
|
||||
+ __set_errno (EINVAL);
|
||||
+ retval = -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return retval;
|
||||
}
|
||||
weak_alias (__tcsetattr, tcsetattr)
|
||||
libc_hidden_def (tcsetattr)
|
@ -0,0 +1,50 @@
|
||||
Short description: Add 4 ISO-8859-15 locales to SUPPORTED for Euro symbol.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Bug-RHEL: #61908
|
||||
Upstream status: not-needed
|
||||
|
||||
Very early RHL 7.3 requirement to add these locales so users can
|
||||
get access to Euro symbol. We should review this bug and decide if
|
||||
the UTF-8 locales are now serving the same purpose and drop the
|
||||
additional locales.
|
||||
|
||||
* Tue Mar 26 2002 Jakub Jelinek <jakub@redhat.com> 2.2.5-28
|
||||
- add a couple of .ISO-8859-15 locales (#61908)
|
||||
|
||||
diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
|
||||
index c8b63cc2fe2b4547..32088fdef06a14a3 100644
|
||||
--- a/localedata/SUPPORTED
|
||||
+++ b/localedata/SUPPORTED
|
||||
@@ -103,6 +103,7 @@ cy_GB.UTF-8/UTF-8 \
|
||||
cy_GB/ISO-8859-14 \
|
||||
da_DK.UTF-8/UTF-8 \
|
||||
da_DK/ISO-8859-1 \
|
||||
+da_DK.ISO-8859-15/ISO-8859-15 \
|
||||
de_AT.UTF-8/UTF-8 \
|
||||
de_AT/ISO-8859-1 \
|
||||
de_AT@euro/ISO-8859-15 \
|
||||
@@ -140,6 +141,7 @@ en_DK.UTF-8/UTF-8 \
|
||||
en_DK/ISO-8859-1 \
|
||||
en_GB.UTF-8/UTF-8 \
|
||||
en_GB/ISO-8859-1 \
|
||||
+en_GB.ISO-8859-15/ISO-8859-15 \
|
||||
en_HK.UTF-8/UTF-8 \
|
||||
en_HK/ISO-8859-1 \
|
||||
en_IE.UTF-8/UTF-8 \
|
||||
@@ -157,6 +159,7 @@ en_SG.UTF-8/UTF-8 \
|
||||
en_SG/ISO-8859-1 \
|
||||
en_US.UTF-8/UTF-8 \
|
||||
en_US/ISO-8859-1 \
|
||||
+en_US.ISO-8859-15/ISO-8859-15 \
|
||||
en_ZA.UTF-8/UTF-8 \
|
||||
en_ZA/ISO-8859-1 \
|
||||
en_ZM/UTF-8 \
|
||||
@@ -425,6 +428,7 @@ sv_FI/ISO-8859-1 \
|
||||
sv_FI@euro/ISO-8859-15 \
|
||||
sv_SE.UTF-8/UTF-8 \
|
||||
sv_SE/ISO-8859-1 \
|
||||
+sv_SE.ISO-8859-15/ISO-8859-15 \
|
||||
sw_KE/UTF-8 \
|
||||
sw_TZ/UTF-8 \
|
||||
syr/UTF-8 \
|
@ -0,0 +1,31 @@
|
||||
Short description: Place glibc info into "Libraries" category.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Upstream status: not-needed
|
||||
|
||||
The category names for libraries is completely random including
|
||||
"Libraries", "GNU Libraries", "GNU libraries", and "Software libraries."
|
||||
In the GNU info manual the "Software libraries" category is given as an
|
||||
example, but really we need to standardize on a category for upstream.
|
||||
I suggest we drop this change after some upstream discussion.
|
||||
|
||||
From 4820b9175535e13df79ce816106016040014916e Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Jelinek <jakub@redhat.com>
|
||||
Date: Fri, 3 Nov 2006 16:31:21 +0000
|
||||
Subject: [PATCH] Change @dircategory.
|
||||
|
||||
---
|
||||
manual/libc.texinfo | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
--- a/manual/libc.texinfo
|
||||
+++ b/manual/libc.texinfo
|
||||
@@ -7,7 +7,7 @@
|
||||
@include macros.texi
|
||||
|
||||
@comment Tell install-info what to do.
|
||||
-@dircategory Software libraries
|
||||
+@dircategory Libraries
|
||||
@direntry
|
||||
* Libc: (libc). C library.
|
||||
@end direntry
|
@ -0,0 +1,30 @@
|
||||
Use python3 for installed executable python scripts.
|
||||
|
||||
Fedora is a Python3-only distribution:
|
||||
https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
|
||||
|
||||
This fixes build failures where builders may strictly enforce only
|
||||
python3 during a transitional phase.
|
||||
|
||||
Author: Carlos O'Donell <carlos@redhat.com>
|
||||
|
||||
diff --git a/benchtests/scripts/compare_bench.py b/benchtests/scripts/compare_bench.py
|
||||
index d4370d723f313a0e..2bbb91d6ea9f6c18 100755
|
||||
--- a/benchtests/scripts/compare_bench.py
|
||||
+++ b/benchtests/scripts/compare_bench.py
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/python
|
||||
+#!/usr/bin/python3
|
||||
# Copyright (C) 2015-2024 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
#
|
||||
diff --git a/benchtests/scripts/import_bench.py b/benchtests/scripts/import_bench.py
|
||||
index fac2945f6d36db13..ac40878934490380 100644
|
||||
--- a/benchtests/scripts/import_bench.py
|
||||
+++ b/benchtests/scripts/import_bench.py
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/python
|
||||
+#!/usr/bin/python3
|
||||
# Copyright (C) 2015-2024 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
#
|
@ -0,0 +1,72 @@
|
||||
commit 086910fc41655152812b515dc324d2ac0dc36e67
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Jun 20 10:32:16 2024 +0200
|
||||
|
||||
malloc: Always install mtrace (bug 31892)
|
||||
|
||||
Generation of the Perl script does not depend on Perl, so we can
|
||||
always install it even if $(PERL) is not set during the build.
|
||||
|
||||
Change the malloc/mtrace.pl text substition not to rely on $(PERL).
|
||||
Instead use PATH at run time to find the Perl interpreter. The Perl
|
||||
interpreter cannot execute directly a script that starts with
|
||||
“#! /bin/sh”: it always executes it with /bin/sh. There is no
|
||||
perl command line switch to disable this behavior. Instead, use
|
||||
the Perl require function to execute the script. The additional
|
||||
shift calls remove the “.” shell arguments. Perl interprets the
|
||||
“.” as a string concatenation operator, making the expression
|
||||
syntactically valid.
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
|
||||
diff --git a/malloc/Makefile b/malloc/Makefile
|
||||
index cc14cf66c9661f99..02aff1bd1dc664c3 100644
|
||||
--- a/malloc/Makefile
|
||||
+++ b/malloc/Makefile
|
||||
@@ -250,7 +250,6 @@ others-extras = mcheck-init.o
|
||||
aux := set-freeres thread-freeres
|
||||
|
||||
# The Perl script to analyze the output of the mtrace functions.
|
||||
-ifneq ($(PERL),no)
|
||||
install-bin-script = mtrace
|
||||
generated += mtrace
|
||||
|
||||
@@ -261,7 +260,6 @@ address-width=10
|
||||
else
|
||||
address-width=18
|
||||
endif
|
||||
-endif
|
||||
|
||||
# Unless we get a test for the availability of libgd which also works
|
||||
# for cross-compiling we disable the memusagestat generation in this
|
||||
@@ -349,7 +347,7 @@ sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,')
|
||||
|
||||
$(objpfx)mtrace: mtrace.pl
|
||||
rm -f $@.new
|
||||
- sed -e 's|@PERL@|$(PERL)|' -e 's|@XXX@|$(address-width)|' \
|
||||
+ sed -e 's|@XXX@|$(address-width)|' \
|
||||
-e 's|@VERSION@|$(version)|' \
|
||||
-e 's|@PKGVERSION@|$(PKGVERSION)|' \
|
||||
-e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \
|
||||
diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
|
||||
index 075da0d9f11da15c..dc6085820e62092c 100644
|
||||
--- a/malloc/mtrace.pl
|
||||
+++ b/malloc/mtrace.pl
|
||||
@@ -1,6 +1,6 @@
|
||||
-#! @PERL@
|
||||
-eval "exec @PERL@ -S $0 $@"
|
||||
- if 0;
|
||||
+#! /bin/sh
|
||||
+eval exec "perl -e 'shift; \$progname=shift; shift; require \$progname'" . "$0" . "$@"
|
||||
+ if 0;
|
||||
# Copyright (C) 1997-2024 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
# Based on the mtrace.awk script.
|
||||
@@ -22,7 +22,6 @@ eval "exec @PERL@ -S $0 $@"
|
||||
$VERSION = "@VERSION@";
|
||||
$PKGVERSION = "@PKGVERSION@";
|
||||
$REPORT_BUGS_TO = '@REPORT_BUGS_TO@';
|
||||
-$progname = $0;
|
||||
|
||||
sub usage {
|
||||
print "Usage: mtrace [OPTION]... [Binary] MtraceData\n";
|
@ -0,0 +1,84 @@
|
||||
commit dd144dce21c864781fade4561581d50fb4549956
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Jun 20 20:55:10 2024 +0200
|
||||
|
||||
malloc: Replace shell/Perl gate in mtrace
|
||||
|
||||
The previous version expanded $0 and $@ twice.
|
||||
|
||||
The new version defines a q no-op shell command. The Perl syntax
|
||||
error is masked by the eval Perl function. The q { … } construct
|
||||
is executed by the shell without errors because the q shell function
|
||||
was defined, but treated as a non-expanding quoted string by Perl,
|
||||
effectively hiding its context from the Perl interpreter. As before
|
||||
the script is read by require instead of executed directly, to avoid
|
||||
infinite recursion because the #! line contains /bin/sh.
|
||||
|
||||
Introduce the “fatal” function to produce diagnostics that are not
|
||||
suppressed by “do”. Use “do” instead of “require” because it has
|
||||
fewer requirements on the executed script than “require”.
|
||||
|
||||
Prefix relative paths with './' because “do” (and “require“ before)
|
||||
searches for the script in @INC if the path is relative and does not
|
||||
start with './'. Use $_ to make the trampoline shorter.
|
||||
|
||||
Add an Emacs mode marker to indentify the script as a Perl script.
|
||||
|
||||
diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
|
||||
index dc6085820e62092c..0a631a07bc4cfbb6 100644
|
||||
--- a/malloc/mtrace.pl
|
||||
+++ b/malloc/mtrace.pl
|
||||
@@ -1,6 +1,12 @@
|
||||
#! /bin/sh
|
||||
-eval exec "perl -e 'shift; \$progname=shift; shift; require \$progname'" . "$0" . "$@"
|
||||
- if 0;
|
||||
+# -*- perl -*-
|
||||
+eval "q () {
|
||||
+ :
|
||||
+}";
|
||||
+q {
|
||||
+ exec perl -e '$_ = shift; $_ = "./$_" unless m,^/,; do $_' "$0" "$@"
|
||||
+}
|
||||
+;
|
||||
# Copyright (C) 1997-2024 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
# Based on the mtrace.awk script.
|
||||
@@ -22,6 +28,7 @@ eval exec "perl -e 'shift; \$progname=shift; shift; require \$progname'" . "$0"
|
||||
$VERSION = "@VERSION@";
|
||||
$PKGVERSION = "@PKGVERSION@";
|
||||
$REPORT_BUGS_TO = '@REPORT_BUGS_TO@';
|
||||
+$progname = $_;
|
||||
|
||||
sub usage {
|
||||
print "Usage: mtrace [OPTION]... [Binary] MtraceData\n";
|
||||
@@ -33,6 +40,11 @@ sub usage {
|
||||
exit 0;
|
||||
}
|
||||
|
||||
+sub fatal {
|
||||
+ print STDERR "$_[0]\n";
|
||||
+ exit 1;
|
||||
+}
|
||||
+
|
||||
# We expect two arguments:
|
||||
# #1: the complete path to the binary
|
||||
# #2: the mtrace data filename
|
||||
@@ -86,7 +98,7 @@ if ($#ARGV == 0) {
|
||||
close (LOCS);
|
||||
}
|
||||
} else {
|
||||
- die "Wrong number of arguments, run $progname --help for help.";
|
||||
+ fatal "Wrong number of arguments, run $progname --help for help.";
|
||||
}
|
||||
|
||||
sub addr2line {
|
||||
@@ -148,7 +160,8 @@ sub location {
|
||||
}
|
||||
|
||||
$nr=0;
|
||||
-open(DATA, "<$data") || die "Cannot open mtrace data file";
|
||||
+open(DATA, "<$data")
|
||||
+ or fatal "$progname: Cannot open mtrace data file $data: $!";
|
||||
while (<DATA>) {
|
||||
my @cols = split (' ');
|
||||
my $n, $where;
|
@ -0,0 +1,31 @@
|
||||
commit 2a6c922f09e7a1c206e0cbdb4424f1cf101a5bda
|
||||
Author: Andreas Schwab <schwab@suse.de>
|
||||
Date: Thu Jun 20 14:13:01 2024 +0200
|
||||
|
||||
mtrace: make shell commands robust against meta characters
|
||||
|
||||
Use the list form of the open function to avoid interpreting meta
|
||||
characters in the arguments.
|
||||
|
||||
diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
|
||||
index 0a631a07bc4cfbb6..32b4da935f7c7c4a 100644
|
||||
--- a/malloc/mtrace.pl
|
||||
+++ b/malloc/mtrace.pl
|
||||
@@ -87,7 +87,7 @@ if ($#ARGV == 0) {
|
||||
}
|
||||
# Set the environment variable LD_TRACE_LOADED_OBJECTS to 2 so the
|
||||
# executable is also printed.
|
||||
- if (open (locs, "env LD_TRACE_LOADED_OBJECTS=2 $prog |")) {
|
||||
+ if (open (locs, "-|", "env", "LD_TRACE_LOADED_OBJECTS=2", $prog)) {
|
||||
while (<locs>) {
|
||||
chop;
|
||||
if (/^.*=> (.*) .(0x[0123456789abcdef]*).$/) {
|
||||
@@ -104,7 +104,7 @@ if ($#ARGV == 0) {
|
||||
sub addr2line {
|
||||
my $addr = pop(@_);
|
||||
my $prog = pop(@_);
|
||||
- if (open (ADDR, "addr2line -e $prog $addr|")) {
|
||||
+ if (open (ADDR, "-|", "addr2line", "-e", $prog, $addr)) {
|
||||
my $line = <ADDR>;
|
||||
chomp $line;
|
||||
close (ADDR);
|
@ -0,0 +1,37 @@
|
||||
Short description: Fix newlocale error return.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Bug-RHEL: #832516
|
||||
Bug-Fedora: #827510
|
||||
Bug-Upstream: #14247
|
||||
Upstream status: not-submitted
|
||||
|
||||
This needs to go upstream right away to fix the error case for
|
||||
newlocale not correctly returning an error.
|
||||
|
||||
2012-06-14 Jeff Law <law@redhat.com>
|
||||
|
||||
* locale/loadlocale.c (_nl_load_locale): Delay setting
|
||||
file->decided until we have successfully loaded the file's
|
||||
data.
|
||||
|
||||
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
|
||||
index e3fa187..9fd9216 100644
|
||||
--- a/locale/loadlocale.c
|
||||
+++ b/locale/loadlocale.c
|
||||
@@ -169,7 +169,6 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
int save_err;
|
||||
int alloc = ld_mapped;
|
||||
|
||||
- file->decided = 1;
|
||||
file->data = NULL;
|
||||
|
||||
fd = __open_nocancel (file->filename, O_RDONLY | O_CLOEXEC);
|
||||
@@ -278,6 +277,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
newdata->alloc = alloc;
|
||||
|
||||
file->data = newdata;
|
||||
+ file->decided = 1;
|
||||
}
|
||||
|
||||
void
|
@ -0,0 +1,264 @@
|
||||
commit 6d1e3fb07b45e2e31e469b16cf21b24bccf8914c
|
||||
Author: Andreas K. Hüttel <dilfridge@gentoo.org>
|
||||
Date: Wed Jan 31 02:12:43 2024 +0100
|
||||
|
||||
Replace advisories directory
|
||||
|
||||
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
|
||||
|
||||
diff --git a/ADVISORIES b/ADVISORIES
|
||||
new file mode 100644
|
||||
index 0000000000000000..d4e33f2df3d74cd8
|
||||
--- /dev/null
|
||||
+++ b/ADVISORIES
|
||||
@@ -0,0 +1,2 @@
|
||||
+For the GNU C Library Security Advisories, see the git master branch:
|
||||
+https://sourceware.org/git/?p=glibc.git;a=tree;f=advisories;hb=HEAD
|
||||
diff --git a/advisories/GLIBC-SA-2023-0001 b/advisories/GLIBC-SA-2023-0001
|
||||
deleted file mode 100644
|
||||
index 3d19c91b6a676ffd..0000000000000000
|
||||
--- a/advisories/GLIBC-SA-2023-0001
|
||||
+++ /dev/null
|
||||
@@ -1,14 +0,0 @@
|
||||
-printf: incorrect output for integers with thousands separator and width field
|
||||
-
|
||||
-When the printf family of functions is called with a format specifier
|
||||
-that uses an <apostrophe> (enable grouping) and a minimum width
|
||||
-specifier, the resulting output could be larger than reasonably expected
|
||||
-by a caller that computed a tight bound on the buffer size. The
|
||||
-resulting larger than expected output could result in a buffer overflow
|
||||
-in the printf family of functions.
|
||||
-
|
||||
-CVE-Id: CVE-2023-25139
|
||||
-Public-Date: 2023-02-02
|
||||
-Vulnerable-Commit: e88b9f0e5cc50cab57a299dc7efe1a4eb385161d (2.37)
|
||||
-Fix-Commit: c980549cc6a1c03c23cc2fe3e7b0fe626a0364b0 (2.38)
|
||||
-Fix-Commit: 07b9521fc6369d000216b96562ff7c0ed32a16c4 (2.37-4)
|
||||
diff --git a/advisories/GLIBC-SA-2023-0002 b/advisories/GLIBC-SA-2023-0002
|
||||
deleted file mode 100644
|
||||
index 5122669a6451f803..0000000000000000
|
||||
--- a/advisories/GLIBC-SA-2023-0002
|
||||
+++ /dev/null
|
||||
@@ -1,15 +0,0 @@
|
||||
-getaddrinfo: Stack read overflow in no-aaaa mode
|
||||
-
|
||||
-If the system is configured in no-aaaa mode via /etc/resolv.conf,
|
||||
-getaddrinfo is called for the AF_UNSPEC address family, and a DNS
|
||||
-response is received over TCP that is larger than 2048 bytes,
|
||||
-getaddrinfo may potentially disclose stack contents via the returned
|
||||
-address data, or crash.
|
||||
-
|
||||
-CVE-Id: CVE-2023-4527
|
||||
-Public-Date: 2023-09-12
|
||||
-Vulnerable-Commit: f282cdbe7f436c75864e5640a409a10485e9abb2 (2.36)
|
||||
-Fix-Commit: bd77dd7e73e3530203be1c52c8a29d08270cb25d (2.39)
|
||||
-Fix-Commit: 4ea972b7edd7e36610e8cde18bf7a8149d7bac4f (2.36-113)
|
||||
-Fix-Commit: b7529346025a130fee483d42178b5c118da971bb (2.37-38)
|
||||
-Fix-Commit: b25508dd774b617f99419bdc3cf2ace4560cd2d6 (2.38-19)
|
||||
diff --git a/advisories/GLIBC-SA-2023-0003 b/advisories/GLIBC-SA-2023-0003
|
||||
deleted file mode 100644
|
||||
index d3aef803480bc298..0000000000000000
|
||||
--- a/advisories/GLIBC-SA-2023-0003
|
||||
+++ /dev/null
|
||||
@@ -1,15 +0,0 @@
|
||||
-getaddrinfo: Potential use-after-free
|
||||
-
|
||||
-When an NSS plugin only implements the _gethostbyname2_r and
|
||||
-_getcanonname_r callbacks, getaddrinfo could use memory that was freed
|
||||
-during buffer resizing, potentially causing a crash or read or write to
|
||||
-arbitrary memory.
|
||||
-
|
||||
-CVE-Id: CVE-2023-4806
|
||||
-Public-Date: 2023-09-12
|
||||
-Fix-Commit: 973fe93a5675c42798b2161c6f29c01b0e243994 (2.39)
|
||||
-Fix-Commit: e09ee267c03e3150c2c9ba28625ab130705a485e (2.34-420)
|
||||
-Fix-Commit: e3ccb230a961b4797510e6a1f5f21fd9021853e7 (2.35-270)
|
||||
-Fix-Commit: a9728f798ec7f05454c95637ee6581afaa9b487d (2.36-115)
|
||||
-Fix-Commit: 6529a7466c935f36e9006b854d6f4e1d4876f942 (2.37-39)
|
||||
-Fix-Commit: 00ae4f10b504bc4564e9f22f00907093f1ab9338 (2.38-20)
|
||||
diff --git a/advisories/GLIBC-SA-2023-0004 b/advisories/GLIBC-SA-2023-0004
|
||||
deleted file mode 100644
|
||||
index 5286a7aa545cd942..0000000000000000
|
||||
--- a/advisories/GLIBC-SA-2023-0004
|
||||
+++ /dev/null
|
||||
@@ -1,16 +0,0 @@
|
||||
-tunables: local privilege escalation through buffer overflow
|
||||
-
|
||||
-If a tunable of the form NAME=NAME=VAL is passed in the environment of a
|
||||
-setuid program and NAME is valid, it may result in a buffer overflow,
|
||||
-which could be exploited to achieve escalated privileges. This flaw was
|
||||
-introduced in glibc 2.34.
|
||||
-
|
||||
-CVE-Id: CVE-2023-4911
|
||||
-Public-Date: 2023-10-03
|
||||
-Vulnerable-Commit: 2ed18c5b534d9e92fc006202a5af0df6b72e7aca (2.34)
|
||||
-Fix-Commit: 1056e5b4c3f2d90ed2b4a55f96add28da2f4c8fa (2.39)
|
||||
-Fix-Commit: dcc367f148bc92e7f3778a125f7a416b093964d9 (2.34-423)
|
||||
-Fix-Commit: c84018a05aec80f5ee6f682db0da1130b0196aef (2.35-274)
|
||||
-Fix-Commit: 22955ad85186ee05834e47e665056148ca07699c (2.36-118)
|
||||
-Fix-Commit: b4e23c75aea756b4bddc4abcf27a1c6dca8b6bd3 (2.37-45)
|
||||
-Fix-Commit: 750a45a783906a19591fb8ff6b7841470f1f5701 (2.38-27)
|
||||
diff --git a/advisories/GLIBC-SA-2023-0005 b/advisories/GLIBC-SA-2023-0005
|
||||
deleted file mode 100644
|
||||
index cc4eb90b8283dc14..0000000000000000
|
||||
--- a/advisories/GLIBC-SA-2023-0005
|
||||
+++ /dev/null
|
||||
@@ -1,18 +0,0 @@
|
||||
-getaddrinfo: DoS due to memory leak
|
||||
-
|
||||
-The fix for CVE-2023-4806 introduced a memory leak when an application
|
||||
-calls getaddrinfo for AF_INET6 with AI_CANONNAME, AI_ALL and AI_V4MAPPED
|
||||
-flags set.
|
||||
-
|
||||
-CVE-Id: CVE-2023-5156
|
||||
-Public-Date: 2023-09-25
|
||||
-Vulnerable-Commit: e09ee267c03e3150c2c9ba28625ab130705a485e (2.34-420)
|
||||
-Vulnerable-Commit: e3ccb230a961b4797510e6a1f5f21fd9021853e7 (2.35-270)
|
||||
-Vulnerable-Commit: a9728f798ec7f05454c95637ee6581afaa9b487d (2.36-115)
|
||||
-Vulnerable-Commit: 6529a7466c935f36e9006b854d6f4e1d4876f942 (2.37-39)
|
||||
-Vulnerable-Commit: 00ae4f10b504bc4564e9f22f00907093f1ab9338 (2.38-20)
|
||||
-Fix-Commit: 8006457ab7e1cd556b919f477348a96fe88f2e49 (2.34-421)
|
||||
-Fix-Commit: 17092c0311f954e6f3c010f73ce3a78c24ac279a (2.35-272)
|
||||
-Fix-Commit: 856bac55f98dc840e7c27cfa82262b933385de90 (2.36-116)
|
||||
-Fix-Commit: 4473d1b87d04b25cdd0e0354814eeaa421328268 (2.37-42)
|
||||
-Fix-Commit: 5ee59ca371b99984232d7584fe2b1a758b4421d3 (2.38-24)
|
||||
diff --git a/advisories/GLIBC-SA-2024-0001 b/advisories/GLIBC-SA-2024-0001
|
||||
deleted file mode 100644
|
||||
index 28931c75ae018cc3..0000000000000000
|
||||
--- a/advisories/GLIBC-SA-2024-0001
|
||||
+++ /dev/null
|
||||
@@ -1,15 +0,0 @@
|
||||
-syslog: Heap buffer overflow in __vsyslog_internal
|
||||
-
|
||||
-__vsyslog_internal did not handle a case where printing a SYSLOG_HEADER
|
||||
-containing a long program name failed to update the required buffer
|
||||
-size, leading to the allocation and overflow of a too-small buffer on
|
||||
-the heap.
|
||||
-
|
||||
-CVE-Id: CVE-2023-6246
|
||||
-Public-Date: 2024-01-30
|
||||
-Vulnerable-Commit: 52a5be0df411ef3ff45c10c7c308cb92993d15b1 (2.37)
|
||||
-Fix-Commit: 6bd0e4efcc78f3c0115e5ea9739a1642807450da (2.39)
|
||||
-Fix-Commit: 23514c72b780f3da097ecf33a793b7ba9c2070d2 (2.38-42)
|
||||
-Fix-Commit: 97a4292aa4a2642e251472b878d0ec4c46a0e59a (2.37-57)
|
||||
-Vulnerable-Commit: b0e7888d1fa2dbd2d9e1645ec8c796abf78880b9 (2.36-16)
|
||||
-Fix-Commit: d1a83b6767f68b3cb5b4b4ea2617254acd040c82 (2.36-126)
|
||||
diff --git a/advisories/GLIBC-SA-2024-0002 b/advisories/GLIBC-SA-2024-0002
|
||||
deleted file mode 100644
|
||||
index 940bfcf2fcb76050..0000000000000000
|
||||
--- a/advisories/GLIBC-SA-2024-0002
|
||||
+++ /dev/null
|
||||
@@ -1,15 +0,0 @@
|
||||
-syslog: Heap buffer overflow in __vsyslog_internal
|
||||
-
|
||||
-__vsyslog_internal used the return value of snprintf/vsnprintf to
|
||||
-calculate buffer sizes for memory allocation. If these functions (for
|
||||
-any reason) failed and returned -1, the resulting buffer would be too
|
||||
-small to hold output.
|
||||
-
|
||||
-CVE-Id: CVE-2023-6779
|
||||
-Public-Date: 2024-01-30
|
||||
-Vulnerable-Commit: 52a5be0df411ef3ff45c10c7c308cb92993d15b1 (2.37)
|
||||
-Fix-Commit: 7e5a0c286da33159d47d0122007aac016f3e02cd (2.39)
|
||||
-Fix-Commit: d0338312aace5bbfef85e03055e1212dd0e49578 (2.38-43)
|
||||
-Fix-Commit: 67062eccd9a65d7fda9976a56aeaaf6c25a80214 (2.37-58)
|
||||
-Vulnerable-Commit: b0e7888d1fa2dbd2d9e1645ec8c796abf78880b9 (2.36-16)
|
||||
-Fix-Commit: 2bc9d7c002bdac38b5c2a3f11b78e309d7765b83 (2.36-127)
|
||||
diff --git a/advisories/GLIBC-SA-2024-0003 b/advisories/GLIBC-SA-2024-0003
|
||||
deleted file mode 100644
|
||||
index b43a5150ab1b0cc4..0000000000000000
|
||||
--- a/advisories/GLIBC-SA-2024-0003
|
||||
+++ /dev/null
|
||||
@@ -1,13 +0,0 @@
|
||||
-syslog: Integer overflow in __vsyslog_internal
|
||||
-
|
||||
-__vsyslog_internal calculated a buffer size by adding two integers, but
|
||||
-did not first check if the addition would overflow.
|
||||
-
|
||||
-CVE-Id: CVE-2023-6780
|
||||
-Public-Date: 2024-01-30
|
||||
-Vulnerable-Commit: 52a5be0df411ef3ff45c10c7c308cb92993d15b1 (2.37)
|
||||
-Fix-Commit: ddf542da94caf97ff43cc2875c88749880b7259b (2.39)
|
||||
-Fix-Commit: d37c2b20a4787463d192b32041c3406c2bd91de0 (2.38-44)
|
||||
-Fix-Commit: 2b58cba076e912961ceaa5fa58588e4b10f791c0 (2.37-59)
|
||||
-Vulnerable-Commit: b0e7888d1fa2dbd2d9e1645ec8c796abf78880b9 (2.36-16)
|
||||
-Fix-Commit: b9b7d6a27aa0632f334352fa400771115b3c69b7 (2.36-128)
|
||||
diff --git a/advisories/README b/advisories/README
|
||||
deleted file mode 100644
|
||||
index 94e68b1350bbad0e..0000000000000000
|
||||
--- a/advisories/README
|
||||
+++ /dev/null
|
||||
@@ -1,73 +0,0 @@
|
||||
-GNU C Library Security Advisory Format
|
||||
-======================================
|
||||
-
|
||||
-Security advisories in this directory follow a simple git commit log
|
||||
-format, with a heading and free-format description augmented with tags
|
||||
-to allow parsing key information. References to code changes are
|
||||
-specific to the glibc repository and follow a specific format:
|
||||
-
|
||||
- Tag-name: <commit-ref> (release-version)
|
||||
-
|
||||
-The <commit-ref> indicates a specific commit in the repository. The
|
||||
-release-version indicates the publicly consumable release in which this
|
||||
-commit is known to exist. The release-version is derived from the
|
||||
-git-describe format, (i.e. stripped out from glibc-2.34.NNN-gxxxx) and
|
||||
-is of the form 2.34-NNN. If the -NNN suffix is absent, it means that
|
||||
-the change is in that release tarball, otherwise the change is on the
|
||||
-release/2.YY/master branch and not in any released tarball.
|
||||
-
|
||||
-The following tags are currently being used:
|
||||
-
|
||||
-CVE-Id:
|
||||
-This is the CVE-Id assigned under the CVE Program
|
||||
-(https://www.cve.org/).
|
||||
-
|
||||
-Public-Date:
|
||||
-The date this issue became publicly known.
|
||||
-
|
||||
-Vulnerable-Commit:
|
||||
-The commit that introduced this vulnerability. There could be multiple
|
||||
-entries, one for each release branch in the glibc repository; the
|
||||
-release-version portion of this tag should tell you which branch this is
|
||||
-on.
|
||||
-
|
||||
-Fix-Commit:
|
||||
-The commit that fixed this vulnerability. There could be multiple
|
||||
-entries for each release branch in the glibc repository, indicating that
|
||||
-all of those commits contributed to fixing that issue in each of those
|
||||
-branches.
|
||||
-
|
||||
-Adding an Advisory
|
||||
-------------------
|
||||
-
|
||||
-An advisory for a CVE needs to be added on the master branch in two steps:
|
||||
-
|
||||
-1. Add the text of the advisory without any Fix-Commit tags along with
|
||||
- the fix for the CVE. Add the Vulnerable-Commit tag, if applicable.
|
||||
- The advisories directory does not exist in release branches, so keep
|
||||
- the advisory text commit distinct from the code changes, to ease
|
||||
- backports. Ask for the GLIBC-SA advisory number from the security
|
||||
- team.
|
||||
-
|
||||
-2. Finish all backports on release branches and then back on the msater
|
||||
- branch, add all commit refs to the advisory using the Fix-Commit
|
||||
- tags. Don't bother adding the release-version subscript since the
|
||||
- next step will overwrite it.
|
||||
-
|
||||
-3. Run the process-advisories.sh script in the scripts directory on the
|
||||
- advisory:
|
||||
-
|
||||
- scripts/process-advisories.sh update GLIBC-SA-YYYY-NNNN
|
||||
-
|
||||
- (replace YYYY-NNNN with the actual advisory number).
|
||||
-
|
||||
-4. Verify the updated advisory and push the result.
|
||||
-
|
||||
-Getting a NEWS snippet from advisories
|
||||
---------------------------------------
|
||||
-
|
||||
-Run:
|
||||
-
|
||||
- scripts/process-advisories.sh news
|
||||
-
|
||||
-and copy the content into the NEWS file.
|
@ -0,0 +1,16 @@
|
||||
commit 983f34a1252de3ca6f2305c211d86530ea42010e
|
||||
Author: caiyinyu <caiyinyu@loongson.cn>
|
||||
Date: Mon Mar 11 16:07:48 2024 +0800
|
||||
|
||||
LoongArch: Correct {__ieee754, _}_scalb -> {__ieee754, _}_scalbf
|
||||
|
||||
diff --git a/sysdeps/loongarch/fpu/e_scalbf.c b/sysdeps/loongarch/fpu/e_scalbf.c
|
||||
index 9f054852362e2d76..7c0395fbb5afbc58 100644
|
||||
--- a/sysdeps/loongarch/fpu/e_scalbf.c
|
||||
+++ b/sysdeps/loongarch/fpu/e_scalbf.c
|
||||
@@ -57,4 +57,4 @@ __ieee754_scalbf (float x, float fn)
|
||||
|
||||
return x;
|
||||
}
|
||||
-libm_alias_finite (__ieee754_scalb, __scalb)
|
||||
+libm_alias_finite (__ieee754_scalbf, __scalbf)
|
@ -0,0 +1,80 @@
|
||||
commit 7fc8242bf87828c935ac5df5cafb9dc7ab635fd9
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Fri Feb 16 07:17:10 2024 -0800
|
||||
|
||||
x86-64: Save APX registers in ld.so trampoline
|
||||
|
||||
Add APX registers to STATE_SAVE_MASK so that APX registers are saved in
|
||||
ld.so trampoline. This fixes BZ #31371.
|
||||
|
||||
Also update STATE_SAVE_OFFSET and STATE_SAVE_MASK for i386 which will
|
||||
be used by i386 _dl_tlsdesc_dynamic.
|
||||
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
||||
|
||||
(cherry picked from commit dfb05f8e704edac70db38c4c8ee700769d91a413)
|
||||
|
||||
diff --git a/sysdeps/x86/sysdep.h b/sysdeps/x86/sysdep.h
|
||||
index 85d0a8c943cbb218..837fd28734914a1c 100644
|
||||
--- a/sysdeps/x86/sysdep.h
|
||||
+++ b/sysdeps/x86/sysdep.h
|
||||
@@ -21,14 +21,54 @@
|
||||
|
||||
#include <sysdeps/generic/sysdep.h>
|
||||
|
||||
+/* The extended state feature IDs in the state component bitmap. */
|
||||
+#define X86_XSTATE_X87_ID 0
|
||||
+#define X86_XSTATE_SSE_ID 1
|
||||
+#define X86_XSTATE_AVX_ID 2
|
||||
+#define X86_XSTATE_BNDREGS_ID 3
|
||||
+#define X86_XSTATE_BNDCFG_ID 4
|
||||
+#define X86_XSTATE_K_ID 5
|
||||
+#define X86_XSTATE_ZMM_H_ID 6
|
||||
+#define X86_XSTATE_ZMM_ID 7
|
||||
+#define X86_XSTATE_PKRU_ID 9
|
||||
+#define X86_XSTATE_TILECFG_ID 17
|
||||
+#define X86_XSTATE_TILEDATA_ID 18
|
||||
+#define X86_XSTATE_APX_F_ID 19
|
||||
+
|
||||
+#ifdef __x86_64__
|
||||
/* Offset for fxsave/xsave area used by _dl_runtime_resolve. Also need
|
||||
space to preserve RCX, RDX, RSI, RDI, R8, R9 and RAX. It must be
|
||||
- aligned to 16 bytes for fxsave and 64 bytes for xsave. */
|
||||
-#define STATE_SAVE_OFFSET (8 * 7 + 8)
|
||||
-
|
||||
-/* Save SSE, AVX, AVX512, mask and bound registers. */
|
||||
-#define STATE_SAVE_MASK \
|
||||
- ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7))
|
||||
+ aligned to 16 bytes for fxsave and 64 bytes for xsave.
|
||||
+
|
||||
+ NB: Is is non-zero because of the 128-byte red-zone. Some registers
|
||||
+ are saved on stack without adjusting stack pointer first. When we
|
||||
+ update stack pointer to allocate more space, we need to take the
|
||||
+ red-zone into account. */
|
||||
+# define STATE_SAVE_OFFSET (8 * 7 + 8)
|
||||
+
|
||||
+/* Save SSE, AVX, AVX512, mask, bound and APX registers. Bound and APX
|
||||
+ registers are mutually exclusive. */
|
||||
+# define STATE_SAVE_MASK \
|
||||
+ ((1 << X86_XSTATE_SSE_ID) \
|
||||
+ | (1 << X86_XSTATE_AVX_ID) \
|
||||
+ | (1 << X86_XSTATE_BNDREGS_ID) \
|
||||
+ | (1 << X86_XSTATE_K_ID) \
|
||||
+ | (1 << X86_XSTATE_ZMM_H_ID) \
|
||||
+ | (1 << X86_XSTATE_ZMM_ID) \
|
||||
+ | (1 << X86_XSTATE_APX_F_ID))
|
||||
+#else
|
||||
+/* Offset for fxsave/xsave area used by _dl_tlsdesc_dynamic. Since i386
|
||||
+ doesn't have red-zone, use 0 here. */
|
||||
+# define STATE_SAVE_OFFSET 0
|
||||
+
|
||||
+/* Save SSE, AVX, AXV512, mask and bound registers. */
|
||||
+# define STATE_SAVE_MASK \
|
||||
+ ((1 << X86_XSTATE_SSE_ID) \
|
||||
+ | (1 << X86_XSTATE_AVX_ID) \
|
||||
+ | (1 << X86_XSTATE_BNDREGS_ID) \
|
||||
+ | (1 << X86_XSTATE_K_ID) \
|
||||
+ | (1 << X86_XSTATE_ZMM_H_ID))
|
||||
+#endif
|
||||
|
||||
/* Constants for bits in __x86_string_control: */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,496 @@
|
||||
commit 853e915fdd6ae6c5f1a7a68d2594ec8dbfef1286
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Wed Feb 28 12:08:03 2024 -0800
|
||||
|
||||
x86-64: Update _dl_tlsdesc_dynamic to preserve AMX registers
|
||||
|
||||
_dl_tlsdesc_dynamic should also preserve AMX registers which are
|
||||
caller-saved. Add X86_XSTATE_TILECFG_ID and X86_XSTATE_TILEDATA_ID
|
||||
to x86-64 TLSDESC_CALL_STATE_SAVE_MASK. Compute the AMX state size
|
||||
and save it in xsave_state_full_size which is only used by
|
||||
_dl_tlsdesc_dynamic_xsave and _dl_tlsdesc_dynamic_xsavec. This fixes
|
||||
the AMX part of BZ #31372. Tested on AMX processor.
|
||||
|
||||
AMX test is enabled only for compilers with the fix for
|
||||
|
||||
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114098
|
||||
|
||||
GCC 14 and GCC 11/12/13 branches have the bug fix.
|
||||
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
|
||||
|
||||
(cherry picked from commit 9b7091415af47082664717210ac49d51551456ab)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/x86_64/Makefile b/sysdeps/unix/sysv/linux/x86_64/Makefile
|
||||
index 4223feb95f6fe2f5..9a1e7aa6461725af 100644
|
||||
--- a/sysdeps/unix/sysv/linux/x86_64/Makefile
|
||||
+++ b/sysdeps/unix/sysv/linux/x86_64/Makefile
|
||||
@@ -63,6 +63,33 @@ $(objpfx)libx86-64-isa-level%.os: $(..)/sysdeps/unix/sysv/linux/x86_64/x86-64-is
|
||||
$(objpfx)libx86-64-isa-level.so: $(objpfx)libx86-64-isa-level-1.so
|
||||
cp $< $@
|
||||
endif
|
||||
+
|
||||
+ifeq (yes,$(have-mamx-tile))
|
||||
+tests += \
|
||||
+ tst-gnu2-tls2-amx \
|
||||
+# tests
|
||||
+
|
||||
+modules-names += \
|
||||
+ tst-gnu2-tls2-amx-mod0 \
|
||||
+ tst-gnu2-tls2-amx-mod1 \
|
||||
+ tst-gnu2-tls2-amx-mod2 \
|
||||
+# modules-names
|
||||
+
|
||||
+$(objpfx)tst-gnu2-tls2-amx: $(shared-thread-library)
|
||||
+$(objpfx)tst-gnu2-tls2-amx.out: \
|
||||
+ $(objpfx)tst-gnu2-tls2-amx-mod0.so \
|
||||
+ $(objpfx)tst-gnu2-tls2-amx-mod1.so \
|
||||
+ $(objpfx)tst-gnu2-tls2-amx-mod2.so
|
||||
+$(objpfx)tst-gnu2-tls2-amx-mod0.so: $(libsupport)
|
||||
+$(objpfx)tst-gnu2-tls2-amx-mod1.so: $(libsupport)
|
||||
+$(objpfx)tst-gnu2-tls2-amx-mod2.so: $(libsupport)
|
||||
+
|
||||
+CFLAGS-tst-gnu2-tls2-amx.c += -mamx-tile
|
||||
+CFLAGS-tst-gnu2-tls2-amx-mod0.c += -mamx-tile -mtls-dialect=gnu2
|
||||
+CFLAGS-tst-gnu2-tls2-amx-mod1.c += -mamx-tile -mtls-dialect=gnu2
|
||||
+CFLAGS-tst-gnu2-tls2-amx-mod2.c += -mamx-tile -mtls-dialect=gnu2
|
||||
+endif
|
||||
+
|
||||
endif # $(subdir) == elf
|
||||
|
||||
ifneq ($(enable-cet),no)
|
||||
diff --git a/sysdeps/unix/sysv/linux/x86_64/include/asm/prctl.h b/sysdeps/unix/sysv/linux/x86_64/include/asm/prctl.h
|
||||
index 2f511321ad3b3ac1..ef4631bf4b2fd9aa 100644
|
||||
--- a/sysdeps/unix/sysv/linux/x86_64/include/asm/prctl.h
|
||||
+++ b/sysdeps/unix/sysv/linux/x86_64/include/asm/prctl.h
|
||||
@@ -20,3 +20,8 @@
|
||||
# define ARCH_SHSTK_SHSTK 0x1
|
||||
# define ARCH_SHSTK_WRSS 0x2
|
||||
#endif
|
||||
+
|
||||
+#ifndef ARCH_GET_XCOMP_PERM
|
||||
+# define ARCH_GET_XCOMP_PERM 0x1022
|
||||
+# define ARCH_REQ_XCOMP_PERM 0x1023
|
||||
+#endif
|
||||
diff --git a/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx-mod0.c b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx-mod0.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..2e0c7b91b7caf3ab
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx-mod0.c
|
||||
@@ -0,0 +1,2 @@
|
||||
+#include "tst-gnu2-tls2-amx.h"
|
||||
+#include <tst-gnu2-tls2mod0.c>
|
||||
diff --git a/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx-mod1.c b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx-mod1.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..b8a8ccf1c119d443
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx-mod1.c
|
||||
@@ -0,0 +1,2 @@
|
||||
+#include "tst-gnu2-tls2-amx.h"
|
||||
+#include <tst-gnu2-tls2mod1.c>
|
||||
diff --git a/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx-mod2.c b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx-mod2.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..cdf4a8f3635b327c
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx-mod2.c
|
||||
@@ -0,0 +1,2 @@
|
||||
+#include "tst-gnu2-tls2-amx.h"
|
||||
+#include <tst-gnu2-tls2mod2.c>
|
||||
diff --git a/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.c b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..ae4dd82556c9b2ef
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.c
|
||||
@@ -0,0 +1,83 @@
|
||||
+/* Test TLSDESC relocation with AMX.
|
||||
+ Copyright (C) 2024 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
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <stdbool.h>
|
||||
+#include <asm/prctl.h>
|
||||
+#include <support/check.h>
|
||||
+#include "tst-gnu2-tls2-amx.h"
|
||||
+
|
||||
+extern int arch_prctl (int, ...);
|
||||
+
|
||||
+#define X86_XSTATE_TILECFG_ID 17
|
||||
+#define X86_XSTATE_TILEDATA_ID 18
|
||||
+
|
||||
+/* Initialize tile config. */
|
||||
+__attribute__ ((noinline, noclone))
|
||||
+static void
|
||||
+init_tile_config (__tilecfg *tileinfo)
|
||||
+{
|
||||
+ int i;
|
||||
+ tileinfo->palette_id = 1;
|
||||
+ tileinfo->start_row = 0;
|
||||
+
|
||||
+ tileinfo->colsb[0] = MAX_ROWS;
|
||||
+ tileinfo->rows[0] = MAX_ROWS;
|
||||
+
|
||||
+ for (i = 1; i < 4; ++i)
|
||||
+ {
|
||||
+ tileinfo->colsb[i] = MAX_COLS;
|
||||
+ tileinfo->rows[i] = MAX_ROWS;
|
||||
+ }
|
||||
+
|
||||
+ _tile_loadconfig (tileinfo);
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+enable_amx (void)
|
||||
+{
|
||||
+ uint64_t bitmask;
|
||||
+ if (arch_prctl (ARCH_GET_XCOMP_PERM, &bitmask) != 0)
|
||||
+ return false;
|
||||
+
|
||||
+ if ((bitmask & (1 << X86_XSTATE_TILECFG_ID)) == 0)
|
||||
+ return false;
|
||||
+
|
||||
+ if (arch_prctl (ARCH_REQ_XCOMP_PERM, X86_XSTATE_TILEDATA_ID) != 0)
|
||||
+ return false;
|
||||
+
|
||||
+ /* Load tile configuration. */
|
||||
+ __tilecfg tile_data = { 0 };
|
||||
+ init_tile_config (&tile_data);
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+/* An architecture can define it to clobber caller-saved registers in
|
||||
+ malloc below to verify that the implicit TLSDESC call won't change
|
||||
+ caller-saved registers. */
|
||||
+static void
|
||||
+clear_tile_register (void)
|
||||
+{
|
||||
+ _tile_zero (2);
|
||||
+}
|
||||
+
|
||||
+#define MOD(i) "tst-gnu2-tls2-amx-mod" #i ".so"
|
||||
+#define IS_SUPPORTED() enable_amx ()
|
||||
+#define PREPARE_MALLOC() clear_tile_register ()
|
||||
+
|
||||
+#include <elf/tst-gnu2-tls2.c>
|
||||
diff --git a/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.h b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..1845a3caba43a0f1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.h
|
||||
@@ -0,0 +1,63 @@
|
||||
+/* Test TLSDESC relocation with AMX.
|
||||
+ Copyright (C) 2024 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
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include <string.h>
|
||||
+#include <x86intrin.h>
|
||||
+#include <support/check.h>
|
||||
+
|
||||
+#define MAX_ROWS 16
|
||||
+#define MAX_COLS 64
|
||||
+#define MAX 1024
|
||||
+#define STRIDE 64
|
||||
+
|
||||
+typedef struct __tile_config
|
||||
+{
|
||||
+ uint8_t palette_id;
|
||||
+ uint8_t start_row;
|
||||
+ uint8_t reserved_0[14];
|
||||
+ uint16_t colsb[16];
|
||||
+ uint8_t rows[16];
|
||||
+} __tilecfg __attribute__ ((aligned (64)));
|
||||
+
|
||||
+/* Initialize int8_t buffer */
|
||||
+static inline void
|
||||
+init_buffer (int8_t *buf, int8_t value)
|
||||
+{
|
||||
+ int rows, colsb, i, j;
|
||||
+ rows = MAX_ROWS;
|
||||
+ colsb = MAX_COLS;
|
||||
+
|
||||
+ for (i = 0; i < rows; i++)
|
||||
+ for (j = 0; j < colsb; j++)
|
||||
+ buf[i * colsb + j] = value;
|
||||
+}
|
||||
+
|
||||
+#define BEFORE_TLSDESC_CALL() \
|
||||
+ int8_t src[MAX]; \
|
||||
+ int8_t res[MAX]; \
|
||||
+ /* Initialize src with data */ \
|
||||
+ init_buffer (src, 2); \
|
||||
+ /* Load tile rows from memory. */ \
|
||||
+ _tile_loadd (2, src, STRIDE);
|
||||
+
|
||||
+#define AFTER_TLSDESC_CALL() \
|
||||
+ /* Store the tile data to memory. */ \
|
||||
+ _tile_stored (2, res, STRIDE); \
|
||||
+ _tile_release (); \
|
||||
+ TEST_VERIFY_EXIT (memcmp (src, res, sizeof (res)) == 0);
|
||||
diff --git a/sysdeps/x86/cpu-features-offsets.sym b/sysdeps/x86/cpu-features-offsets.sym
|
||||
index 6a8fd298137b7f23..21fc88d6510840e6 100644
|
||||
--- a/sysdeps/x86/cpu-features-offsets.sym
|
||||
+++ b/sysdeps/x86/cpu-features-offsets.sym
|
||||
@@ -3,3 +3,4 @@
|
||||
#include <ldsodefs.h>
|
||||
|
||||
XSAVE_STATE_SIZE_OFFSET offsetof (struct cpu_features, xsave_state_size)
|
||||
+XSAVE_STATE_FULL_SIZE_OFFSET offsetof (struct cpu_features, xsave_state_full_size)
|
||||
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
|
||||
index 835113b42f924b83..d71e8d3d2e0e49f9 100644
|
||||
--- a/sysdeps/x86/cpu-features.c
|
||||
+++ b/sysdeps/x86/cpu-features.c
|
||||
@@ -307,6 +307,8 @@ update_active (struct cpu_features *cpu_features)
|
||||
__cpuid_count (0xd, 0, eax, ebx, ecx, edx);
|
||||
if (ebx != 0)
|
||||
{
|
||||
+ /* NB: On AMX capable processors, ebx always includes AMX
|
||||
+ states. */
|
||||
unsigned int xsave_state_full_size
|
||||
= ALIGN_UP (ebx + STATE_SAVE_OFFSET, 64);
|
||||
|
||||
@@ -320,6 +322,11 @@ update_active (struct cpu_features *cpu_features)
|
||||
{
|
||||
unsigned int xstate_comp_offsets[32];
|
||||
unsigned int xstate_comp_sizes[32];
|
||||
+#ifdef __x86_64__
|
||||
+ unsigned int xstate_amx_comp_offsets[32];
|
||||
+ unsigned int xstate_amx_comp_sizes[32];
|
||||
+ unsigned int amx_ecx;
|
||||
+#endif
|
||||
unsigned int i;
|
||||
|
||||
xstate_comp_offsets[0] = 0;
|
||||
@@ -327,16 +334,39 @@ update_active (struct cpu_features *cpu_features)
|
||||
xstate_comp_offsets[2] = 576;
|
||||
xstate_comp_sizes[0] = 160;
|
||||
xstate_comp_sizes[1] = 256;
|
||||
+#ifdef __x86_64__
|
||||
+ xstate_amx_comp_offsets[0] = 0;
|
||||
+ xstate_amx_comp_offsets[1] = 160;
|
||||
+ xstate_amx_comp_offsets[2] = 576;
|
||||
+ xstate_amx_comp_sizes[0] = 160;
|
||||
+ xstate_amx_comp_sizes[1] = 256;
|
||||
+#endif
|
||||
|
||||
for (i = 2; i < 32; i++)
|
||||
{
|
||||
- if ((STATE_SAVE_MASK & (1 << i)) != 0)
|
||||
+ if ((FULL_STATE_SAVE_MASK & (1 << i)) != 0)
|
||||
{
|
||||
__cpuid_count (0xd, i, eax, ebx, ecx, edx);
|
||||
- xstate_comp_sizes[i] = eax;
|
||||
+#ifdef __x86_64__
|
||||
+ /* Include this in xsave_state_full_size. */
|
||||
+ amx_ecx = ecx;
|
||||
+ xstate_amx_comp_sizes[i] = eax;
|
||||
+ if ((AMX_STATE_SAVE_MASK & (1 << i)) != 0)
|
||||
+ {
|
||||
+ /* Exclude this from xsave_state_size. */
|
||||
+ ecx = 0;
|
||||
+ xstate_comp_sizes[i] = 0;
|
||||
+ }
|
||||
+ else
|
||||
+#endif
|
||||
+ xstate_comp_sizes[i] = eax;
|
||||
}
|
||||
else
|
||||
{
|
||||
+#ifdef __x86_64__
|
||||
+ amx_ecx = 0;
|
||||
+ xstate_amx_comp_sizes[i] = 0;
|
||||
+#endif
|
||||
ecx = 0;
|
||||
xstate_comp_sizes[i] = 0;
|
||||
}
|
||||
@@ -349,6 +379,15 @@ update_active (struct cpu_features *cpu_features)
|
||||
if ((ecx & (1 << 1)) != 0)
|
||||
xstate_comp_offsets[i]
|
||||
= ALIGN_UP (xstate_comp_offsets[i], 64);
|
||||
+#ifdef __x86_64__
|
||||
+ xstate_amx_comp_offsets[i]
|
||||
+ = (xstate_amx_comp_offsets[i - 1]
|
||||
+ + xstate_amx_comp_sizes[i - 1]);
|
||||
+ if ((amx_ecx & (1 << 1)) != 0)
|
||||
+ xstate_amx_comp_offsets[i]
|
||||
+ = ALIGN_UP (xstate_amx_comp_offsets[i],
|
||||
+ 64);
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,6 +396,18 @@ update_active (struct cpu_features *cpu_features)
|
||||
= xstate_comp_offsets[31] + xstate_comp_sizes[31];
|
||||
if (size)
|
||||
{
|
||||
+#ifdef __x86_64__
|
||||
+ unsigned int amx_size
|
||||
+ = (xstate_amx_comp_offsets[31]
|
||||
+ + xstate_amx_comp_sizes[31]);
|
||||
+ amx_size = ALIGN_UP (amx_size + STATE_SAVE_OFFSET,
|
||||
+ 64);
|
||||
+ /* Set xsave_state_full_size to the compact AMX
|
||||
+ state size for XSAVEC. NB: xsave_state_full_size
|
||||
+ is only used in _dl_tlsdesc_dynamic_xsave and
|
||||
+ _dl_tlsdesc_dynamic_xsavec. */
|
||||
+ cpu_features->xsave_state_full_size = amx_size;
|
||||
+#endif
|
||||
cpu_features->xsave_state_size
|
||||
= ALIGN_UP (size + STATE_SAVE_OFFSET, 64);
|
||||
CPU_FEATURE_SET (cpu_features, XSAVEC);
|
||||
diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h
|
||||
index b9bf3115b616f05f..cd7bd27cf35959fd 100644
|
||||
--- a/sysdeps/x86/include/cpu-features.h
|
||||
+++ b/sysdeps/x86/include/cpu-features.h
|
||||
@@ -934,6 +934,8 @@ struct cpu_features
|
||||
/* The full state size for XSAVE when XSAVEC is disabled by
|
||||
|
||||
GLIBC_TUNABLES=glibc.cpu.hwcaps=-XSAVEC
|
||||
+
|
||||
+ and the AMX state size when XSAVEC is available.
|
||||
*/
|
||||
unsigned int xsave_state_full_size;
|
||||
/* Data cache size for use in memory and string routines, typically
|
||||
diff --git a/sysdeps/x86/sysdep.h b/sysdeps/x86/sysdep.h
|
||||
index 485cad9c0283b334..db8e576e91767db5 100644
|
||||
--- a/sysdeps/x86/sysdep.h
|
||||
+++ b/sysdeps/x86/sysdep.h
|
||||
@@ -56,6 +56,14 @@
|
||||
| (1 << X86_XSTATE_ZMM_H_ID) \
|
||||
| (1 << X86_XSTATE_ZMM_ID) \
|
||||
| (1 << X86_XSTATE_APX_F_ID))
|
||||
+
|
||||
+/* AMX state mask. */
|
||||
+# define AMX_STATE_SAVE_MASK \
|
||||
+ ((1 << X86_XSTATE_TILECFG_ID) | (1 << X86_XSTATE_TILEDATA_ID))
|
||||
+
|
||||
+/* States to be included in xsave_state_full_size. */
|
||||
+# define FULL_STATE_SAVE_MASK \
|
||||
+ (STATE_SAVE_MASK | AMX_STATE_SAVE_MASK)
|
||||
#else
|
||||
/* Offset for fxsave/xsave area used by _dl_tlsdesc_dynamic. Since i386
|
||||
doesn't have red-zone, use 0 here. */
|
||||
@@ -68,13 +76,17 @@
|
||||
| (1 << X86_XSTATE_BNDREGS_ID) \
|
||||
| (1 << X86_XSTATE_K_ID) \
|
||||
| (1 << X86_XSTATE_ZMM_H_ID))
|
||||
+
|
||||
+/* States to be included in xsave_state_size. */
|
||||
+# define FULL_STATE_SAVE_MASK STATE_SAVE_MASK
|
||||
#endif
|
||||
|
||||
/* States which should be saved for TLSDESC_CALL and TLS_DESC_CALL.
|
||||
- Compiler assumes that all registers, including x87 FPU stack registers,
|
||||
- are unchanged after CALL, except for EFLAGS and RAX/EAX. */
|
||||
+ Compiler assumes that all registers, including AMX and x87 FPU
|
||||
+ stack registers, are unchanged after CALL, except for EFLAGS and
|
||||
+ RAX/EAX. */
|
||||
#define TLSDESC_CALL_STATE_SAVE_MASK \
|
||||
- (STATE_SAVE_MASK | (1 << X86_XSTATE_X87_ID))
|
||||
+ (FULL_STATE_SAVE_MASK | (1 << X86_XSTATE_X87_ID))
|
||||
|
||||
/* Constants for bits in __x86_string_control: */
|
||||
|
||||
diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
|
||||
index 418cc4a9b862f7e0..04a534fa126a7bf7 100755
|
||||
--- a/sysdeps/x86_64/configure
|
||||
+++ b/sysdeps/x86_64/configure
|
||||
@@ -134,6 +134,34 @@ fi
|
||||
config_vars="$config_vars
|
||||
enable-cet = $enable_cet"
|
||||
|
||||
+# Check if -mamx-tile works properly.
|
||||
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -mamx-tile works properly" >&5
|
||||
+printf %s "checking whether -mamx-tile works properly... " >&6; }
|
||||
+if test ${libc_cv_x86_have_amx_tile+y}
|
||||
+then :
|
||||
+ printf %s "(cached) " >&6
|
||||
+else $as_nop
|
||||
+ cat > conftest.c <<EOF
|
||||
+#include <x86intrin.h>
|
||||
+EOF
|
||||
+ libc_cv_x86_have_amx_tile=no
|
||||
+ if { ac_try='${CC-cc} -E $CFLAGS -mamx-tile conftest.c > conftest.i'
|
||||
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
+ (eval $ac_try) 2>&5
|
||||
+ ac_status=$?
|
||||
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
+ test $ac_status = 0; }; }; then
|
||||
+ if grep -q __builtin_ia32_ldtilecfg conftest.i; then
|
||||
+ libc_cv_x86_have_amx_tile=yes
|
||||
+ fi
|
||||
+ fi
|
||||
+ rm -rf conftest*
|
||||
+fi
|
||||
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_x86_have_amx_tile" >&5
|
||||
+printf "%s\n" "$libc_cv_x86_have_amx_tile" >&6; }
|
||||
+config_vars="$config_vars
|
||||
+have-mamx-tile = $libc_cv_x86_have_amx_tile"
|
||||
+
|
||||
test -n "$critic_missing" && as_fn_error $? "
|
||||
*** $critic_missing" "$LINENO" 5
|
||||
|
||||
diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
|
||||
index d1f803c02ee67fc5..c714c47351e70390 100644
|
||||
--- a/sysdeps/x86_64/configure.ac
|
||||
+++ b/sysdeps/x86_64/configure.ac
|
||||
@@ -61,5 +61,20 @@ elif test $enable_cet = permissive; then
|
||||
fi
|
||||
LIBC_CONFIG_VAR([enable-cet], [$enable_cet])
|
||||
|
||||
+# Check if -mamx-tile works properly.
|
||||
+AC_CACHE_CHECK(whether -mamx-tile works properly,
|
||||
+ libc_cv_x86_have_amx_tile, [dnl
|
||||
+cat > conftest.c <<EOF
|
||||
+#include <x86intrin.h>
|
||||
+EOF
|
||||
+ libc_cv_x86_have_amx_tile=no
|
||||
+ if AC_TRY_COMMAND(${CC-cc} -E $CFLAGS -mamx-tile conftest.c > conftest.i); then
|
||||
+ if grep -q __builtin_ia32_ldtilecfg conftest.i; then
|
||||
+ libc_cv_x86_have_amx_tile=yes
|
||||
+ fi
|
||||
+ fi
|
||||
+ rm -rf conftest*])
|
||||
+LIBC_CONFIG_VAR([have-mamx-tile], [$libc_cv_x86_have_amx_tile])
|
||||
+
|
||||
test -n "$critic_missing" && AC_MSG_ERROR([
|
||||
*** $critic_missing])
|
||||
diff --git a/sysdeps/x86_64/dl-tlsdesc-dynamic.h b/sysdeps/x86_64/dl-tlsdesc-dynamic.h
|
||||
index 0c2e8d5320d0bd26..9f02cfc3eb297ed2 100644
|
||||
--- a/sysdeps/x86_64/dl-tlsdesc-dynamic.h
|
||||
+++ b/sysdeps/x86_64/dl-tlsdesc-dynamic.h
|
||||
@@ -99,7 +99,7 @@ _dl_tlsdesc_dynamic:
|
||||
# endif
|
||||
#else
|
||||
/* Allocate stack space of the required size to save the state. */
|
||||
- sub _rtld_local_ro+RTLD_GLOBAL_RO_DL_X86_CPU_FEATURES_OFFSET+XSAVE_STATE_SIZE_OFFSET(%rip), %RSP_LP
|
||||
+ sub _rtld_local_ro+RTLD_GLOBAL_RO_DL_X86_CPU_FEATURES_OFFSET+XSAVE_STATE_FULL_SIZE_OFFSET(%rip), %RSP_LP
|
||||
#endif
|
||||
/* Besides rdi and rsi, saved above, save rcx, rdx, r8, r9,
|
||||
r10 and r11. */
|
@ -0,0 +1,250 @@
|
||||
commit 354cabcb2634abe16da7a2ba5e648aac1204b58e
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Mon Mar 18 06:40:16 2024 -0700
|
||||
|
||||
x86-64: Allocate state buffer space for RDI, RSI and RBX
|
||||
|
||||
_dl_tlsdesc_dynamic preserves RDI, RSI and RBX before realigning stack.
|
||||
After realigning stack, it saves RCX, RDX, R8, R9, R10 and R11. Define
|
||||
TLSDESC_CALL_REGISTER_SAVE_AREA to allocate space for RDI, RSI and RBX
|
||||
to avoid clobbering saved RDI, RSI and RBX values on stack by xsave to
|
||||
STATE_SAVE_OFFSET(%rsp).
|
||||
|
||||
+==================+<- stack frame start aligned at 8 or 16 bytes
|
||||
| |<- RDI saved in the red zone
|
||||
| |<- RSI saved in the red zone
|
||||
| |<- RBX saved in the red zone
|
||||
| |<- paddings for stack realignment of 64 bytes
|
||||
|------------------|<- xsave buffer end aligned at 64 bytes
|
||||
| |<-
|
||||
| |<-
|
||||
| |<-
|
||||
|------------------|<- xsave buffer start at STATE_SAVE_OFFSET(%rsp)
|
||||
| |<- 8-byte padding for 64-byte alignment
|
||||
| |<- 8-byte padding for 64-byte alignment
|
||||
| |<- R11
|
||||
| |<- R10
|
||||
| |<- R9
|
||||
| |<- R8
|
||||
| |<- RDX
|
||||
| |<- RCX
|
||||
+==================+<- RSP aligned at 64 bytes
|
||||
|
||||
Define TLSDESC_CALL_REGISTER_SAVE_AREA, the total register save area size
|
||||
for all integer registers by adding 24 to STATE_SAVE_OFFSET since RDI, RSI
|
||||
and RBX are saved onto stack without adjusting stack pointer first, using
|
||||
the red-zone. This fixes BZ #31501.
|
||||
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
|
||||
|
||||
(cherry picked from commit 717ebfa85c8240d32d0d19d86a484c31c55c9617)
|
||||
|
||||
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
|
||||
index d71e8d3d2e0e49f9..6fe1b728c607f39e 100644
|
||||
--- a/sysdeps/x86/cpu-features.c
|
||||
+++ b/sysdeps/x86/cpu-features.c
|
||||
@@ -310,7 +310,7 @@ update_active (struct cpu_features *cpu_features)
|
||||
/* NB: On AMX capable processors, ebx always includes AMX
|
||||
states. */
|
||||
unsigned int xsave_state_full_size
|
||||
- = ALIGN_UP (ebx + STATE_SAVE_OFFSET, 64);
|
||||
+ = ALIGN_UP (ebx + TLSDESC_CALL_REGISTER_SAVE_AREA, 64);
|
||||
|
||||
cpu_features->xsave_state_size
|
||||
= xsave_state_full_size;
|
||||
@@ -400,8 +400,10 @@ update_active (struct cpu_features *cpu_features)
|
||||
unsigned int amx_size
|
||||
= (xstate_amx_comp_offsets[31]
|
||||
+ xstate_amx_comp_sizes[31]);
|
||||
- amx_size = ALIGN_UP (amx_size + STATE_SAVE_OFFSET,
|
||||
- 64);
|
||||
+ amx_size
|
||||
+ = ALIGN_UP ((amx_size
|
||||
+ + TLSDESC_CALL_REGISTER_SAVE_AREA),
|
||||
+ 64);
|
||||
/* Set xsave_state_full_size to the compact AMX
|
||||
state size for XSAVEC. NB: xsave_state_full_size
|
||||
is only used in _dl_tlsdesc_dynamic_xsave and
|
||||
@@ -409,7 +411,8 @@ update_active (struct cpu_features *cpu_features)
|
||||
cpu_features->xsave_state_full_size = amx_size;
|
||||
#endif
|
||||
cpu_features->xsave_state_size
|
||||
- = ALIGN_UP (size + STATE_SAVE_OFFSET, 64);
|
||||
+ = ALIGN_UP (size + TLSDESC_CALL_REGISTER_SAVE_AREA,
|
||||
+ 64);
|
||||
CPU_FEATURE_SET (cpu_features, XSAVEC);
|
||||
}
|
||||
}
|
||||
diff --git a/sysdeps/x86/sysdep.h b/sysdeps/x86/sysdep.h
|
||||
index db8e576e91767db5..7359149e17ccf341 100644
|
||||
--- a/sysdeps/x86/sysdep.h
|
||||
+++ b/sysdeps/x86/sysdep.h
|
||||
@@ -38,14 +38,59 @@
|
||||
#ifdef __x86_64__
|
||||
/* Offset for fxsave/xsave area used by _dl_runtime_resolve. Also need
|
||||
space to preserve RCX, RDX, RSI, RDI, R8, R9 and RAX. It must be
|
||||
- aligned to 16 bytes for fxsave and 64 bytes for xsave.
|
||||
-
|
||||
- NB: Is is non-zero because of the 128-byte red-zone. Some registers
|
||||
- are saved on stack without adjusting stack pointer first. When we
|
||||
- update stack pointer to allocate more space, we need to take the
|
||||
- red-zone into account. */
|
||||
+ aligned to 16 bytes for fxsave and 64 bytes for xsave. It is non-zero
|
||||
+ because MOV, instead of PUSH, is used to save registers onto stack.
|
||||
+
|
||||
+ +==================+<- stack frame start aligned at 8 or 16 bytes
|
||||
+ | |<- paddings for stack realignment of 64 bytes
|
||||
+ |------------------|<- xsave buffer end aligned at 64 bytes
|
||||
+ | |<-
|
||||
+ | |<-
|
||||
+ | |<-
|
||||
+ |------------------|<- xsave buffer start at STATE_SAVE_OFFSET(%rsp)
|
||||
+ | |<- 8-byte padding for 64-byte alignment
|
||||
+ | |<- R9
|
||||
+ | |<- R8
|
||||
+ | |<- RDI
|
||||
+ | |<- RSI
|
||||
+ | |<- RDX
|
||||
+ | |<- RCX
|
||||
+ | |<- RAX
|
||||
+ +==================+<- RSP aligned at 64 bytes
|
||||
+
|
||||
+ */
|
||||
# define STATE_SAVE_OFFSET (8 * 7 + 8)
|
||||
|
||||
+/* _dl_tlsdesc_dynamic preserves RDI, RSI and RBX before realigning
|
||||
+ stack. After realigning stack, it saves RCX, RDX, R8, R9, R10 and
|
||||
+ R11. Allocate space for RDI, RSI and RBX to avoid clobbering saved
|
||||
+ RDI, RSI and RBX values on stack by xsave.
|
||||
+
|
||||
+ +==================+<- stack frame start aligned at 8 or 16 bytes
|
||||
+ | |<- RDI saved in the red zone
|
||||
+ | |<- RSI saved in the red zone
|
||||
+ | |<- RBX saved in the red zone
|
||||
+ | |<- paddings for stack realignment of 64 bytes
|
||||
+ |------------------|<- xsave buffer end aligned at 64 bytes
|
||||
+ | |<-
|
||||
+ | |<-
|
||||
+ | |<-
|
||||
+ |------------------|<- xsave buffer start at STATE_SAVE_OFFSET(%rsp)
|
||||
+ | |<- 8-byte padding for 64-byte alignment
|
||||
+ | |<- 8-byte padding for 64-byte alignment
|
||||
+ | |<- R11
|
||||
+ | |<- R10
|
||||
+ | |<- R9
|
||||
+ | |<- R8
|
||||
+ | |<- RDX
|
||||
+ | |<- RCX
|
||||
+ +==================+<- RSP aligned at 64 bytes
|
||||
+
|
||||
+ Define the total register save area size for all integer registers by
|
||||
+ adding 24 to STATE_SAVE_OFFSET since RDI, RSI and RBX are saved onto
|
||||
+ stack without adjusting stack pointer first, using the red-zone. */
|
||||
+# define TLSDESC_CALL_REGISTER_SAVE_AREA (STATE_SAVE_OFFSET + 24)
|
||||
+
|
||||
/* Save SSE, AVX, AVX512, mask, bound and APX registers. Bound and APX
|
||||
registers are mutually exclusive. */
|
||||
# define STATE_SAVE_MASK \
|
||||
@@ -66,8 +111,9 @@
|
||||
(STATE_SAVE_MASK | AMX_STATE_SAVE_MASK)
|
||||
#else
|
||||
/* Offset for fxsave/xsave area used by _dl_tlsdesc_dynamic. Since i386
|
||||
- doesn't have red-zone, use 0 here. */
|
||||
+ uses PUSH to save registers onto stack, use 0 here. */
|
||||
# define STATE_SAVE_OFFSET 0
|
||||
+# define TLSDESC_CALL_REGISTER_SAVE_AREA 0
|
||||
|
||||
/* Save SSE, AVX, AXV512, mask and bound registers. */
|
||||
# define STATE_SAVE_MASK \
|
||||
diff --git a/sysdeps/x86_64/tst-gnu2-tls2mod1.S b/sysdeps/x86_64/tst-gnu2-tls2mod1.S
|
||||
new file mode 100644
|
||||
index 0000000000000000..1d636669ba255724
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/x86_64/tst-gnu2-tls2mod1.S
|
||||
@@ -0,0 +1,87 @@
|
||||
+/* Check if TLSDESC relocation preserves %rdi, %rsi and %rbx.
|
||||
+ Copyright (C) 2024 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
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <sysdep.h>
|
||||
+
|
||||
+/* On AVX512 machines, OFFSET == 40 caused _dl_tlsdesc_dynamic_xsavec
|
||||
+ to clobber %rdi, %rsi and %rbx. On Intel AVX CPUs, the state size
|
||||
+ is 960 bytes and this test didn't fail. It may be due to the unused
|
||||
+ last 128 bytes. On AMD AVX CPUs, the state size is 832 bytes and
|
||||
+ this test might fail without the fix. */
|
||||
+#ifndef OFFSET
|
||||
+# define OFFSET 40
|
||||
+#endif
|
||||
+
|
||||
+ .text
|
||||
+ .p2align 4
|
||||
+ .globl apply_tls
|
||||
+ .type apply_tls, @function
|
||||
+apply_tls:
|
||||
+ cfi_startproc
|
||||
+ _CET_ENDBR
|
||||
+ pushq %rbp
|
||||
+ cfi_def_cfa_offset (16)
|
||||
+ cfi_offset (6, -16)
|
||||
+ movdqu (%RDI_LP), %xmm0
|
||||
+ lea tls_var1@TLSDESC(%rip), %RAX_LP
|
||||
+ mov %RSP_LP, %RBP_LP
|
||||
+ cfi_def_cfa_register (6)
|
||||
+ /* Align stack to 64 bytes. */
|
||||
+ and $-64, %RSP_LP
|
||||
+ sub $OFFSET, %RSP_LP
|
||||
+ pushq %rbx
|
||||
+ /* Set %ebx to 0xbadbeef. */
|
||||
+ movl $0xbadbeef, %ebx
|
||||
+ movl $0xbadbeef, %esi
|
||||
+ movq %rdi, saved_rdi(%rip)
|
||||
+ movq %rsi, saved_rsi(%rip)
|
||||
+ call *tls_var1@TLSCALL(%RAX_LP)
|
||||
+ /* Check if _dl_tlsdesc_dynamic preserves %rdi, %rsi and %rbx. */
|
||||
+ cmpq saved_rdi(%rip), %rdi
|
||||
+ jne L(hlt)
|
||||
+ cmpq saved_rsi(%rip), %rsi
|
||||
+ jne L(hlt)
|
||||
+ cmpl $0xbadbeef, %ebx
|
||||
+ jne L(hlt)
|
||||
+ add %fs:0, %RAX_LP
|
||||
+ movups %xmm0, 32(%RAX_LP)
|
||||
+ movdqu 16(%RDI_LP), %xmm1
|
||||
+ mov %RAX_LP, %RBX_LP
|
||||
+ movups %xmm1, 48(%RAX_LP)
|
||||
+ lea 32(%RBX_LP), %RAX_LP
|
||||
+ pop %rbx
|
||||
+ leave
|
||||
+ cfi_def_cfa (7, 8)
|
||||
+ ret
|
||||
+L(hlt):
|
||||
+ hlt
|
||||
+ cfi_endproc
|
||||
+ .size apply_tls, .-apply_tls
|
||||
+ .hidden tls_var1
|
||||
+ .globl tls_var1
|
||||
+ .section .tbss,"awT",@nobits
|
||||
+ .align 16
|
||||
+ .type tls_var1, @object
|
||||
+ .size tls_var1, 3200
|
||||
+tls_var1:
|
||||
+ .zero 3200
|
||||
+ .local saved_rdi
|
||||
+ .comm saved_rdi,8,8
|
||||
+ .local saved_rsi
|
||||
+ .comm saved_rsi,8,8
|
||||
+ .section .note.GNU-stack,"",@progbits
|
@ -0,0 +1,38 @@
|
||||
commit 15aebdbada54098787715448c94701f17033fc92
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Tue Mar 12 13:21:18 2024 -0300
|
||||
|
||||
Ignore undefined symbols for -mtls-dialect=gnu2
|
||||
|
||||
So it does not fail for arm config that defaults to -mtp=soft (which
|
||||
issues a call to __aeabi_read_tp).
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
|
||||
(cherry picked from commit 968b0ca9440040a2b31248a572891f0e55c1ab10)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 59ff1e415dda4fbf..117b48a421792eda 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -7020,7 +7020,7 @@ void foo (void)
|
||||
}
|
||||
EOF
|
||||
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
|
||||
- conftest.c -o conftest 1>&5'
|
||||
+ -shared conftest.c -o conftest 1>&5'
|
||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 65799e56852a5356..19b88a47a52508a1 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1297,7 +1297,7 @@ void foo (void)
|
||||
}
|
||||
EOF
|
||||
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
|
||||
- conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
|
||||
+ -shared conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
|
||||
then
|
||||
libc_cv_mtls_dialect_gnu2=yes
|
||||
else
|
@ -0,0 +1,446 @@
|
||||
commit a8ba52bde58c69f2b31da62ad2311f119adf6cb9
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Tue Mar 12 13:21:19 2024 -0300
|
||||
|
||||
arm: Update _dl_tlsdesc_dynamic to preserve caller-saved registers (BZ 31372)
|
||||
|
||||
ARM _dl_tlsdesc_dynamic slow path has two issues:
|
||||
|
||||
* The ip/r12 is defined by AAPCS as a scratch register, and gcc is
|
||||
used to save the stack pointer before on some function calls. So it
|
||||
should also be saved/restored as well. It fixes the tst-gnu2-tls2.
|
||||
|
||||
* None of the possible VFP registers are saved/restored. ARM has the
|
||||
additional complexity to have different VFP bank sizes (depending of
|
||||
VFP support by the chip).
|
||||
|
||||
The tst-gnu2-tls2 test is extended to check for VFP registers, although
|
||||
only for hardfp builds. Different than setcontext, _dl_tlsdesc_dynamic
|
||||
does not have HWCAP_ARM_IWMMXT (I don't have a way to properly test
|
||||
it and it is almost a decade since newer hardware was released).
|
||||
|
||||
With this patch there is no need to mark tst-gnu2-tls2 as XFAIL.
|
||||
|
||||
Checked on arm-linux-gnueabihf.
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
|
||||
(cherry picked from commit 64c7e344289ed085517c2227d8e3b06388242c13)
|
||||
|
||||
diff --git a/config.h.in b/config.h.in
|
||||
index 44a34072a47aa008..4d33c63a841d3d6d 100644
|
||||
--- a/config.h.in
|
||||
+++ b/config.h.in
|
||||
@@ -141,6 +141,9 @@
|
||||
/* LOONGARCH floating-point ABI for ld.so. */
|
||||
#undef LOONGARCH_ABI_FRLEN
|
||||
|
||||
+/* Define whether ARM used hard-float and support VFPvX-D32. */
|
||||
+#undef HAVE_ARM_PCS_VFP_D32
|
||||
+
|
||||
/* Linux specific: minimum supported kernel version. */
|
||||
#undef __LINUX_KERNEL_VERSION
|
||||
|
||||
diff --git a/elf/Makefile b/elf/Makefile
|
||||
index c5c37a9147e69d83..030db4d207d3491e 100644
|
||||
--- a/elf/Makefile
|
||||
+++ b/elf/Makefile
|
||||
@@ -3056,10 +3056,6 @@ $(objpfx)tst-gnu2-tls2.out: \
|
||||
$(objpfx)tst-gnu2-tls2mod2.so
|
||||
|
||||
ifeq (yes,$(have-mtls-dialect-gnu2))
|
||||
-# This test fails if dl_tlsdesc_dynamic doesn't preserve all caller-saved
|
||||
-# registers. See https://sourceware.org/bugzilla/show_bug.cgi?id=31372
|
||||
-test-xfail-tst-gnu2-tls2 = yes
|
||||
-
|
||||
CFLAGS-tst-tlsgap-mod0.c += -mtls-dialect=gnu2
|
||||
CFLAGS-tst-tlsgap-mod1.c += -mtls-dialect=gnu2
|
||||
CFLAGS-tst-tlsgap-mod2.c += -mtls-dialect=gnu2
|
||||
diff --git a/elf/tst-gnu2-tls2.h b/elf/tst-gnu2-tls2.h
|
||||
index 77964a57a352e6a4..1ade8151e200af68 100644
|
||||
--- a/elf/tst-gnu2-tls2.h
|
||||
+++ b/elf/tst-gnu2-tls2.h
|
||||
@@ -27,6 +27,10 @@ extern struct tls *apply_tls (struct tls *);
|
||||
|
||||
/* An architecture can define them to verify that clobber caller-saved
|
||||
registers aren't changed by the implicit TLSDESC call. */
|
||||
+#ifndef INIT_TLSDESC_CALL
|
||||
+# define INIT_TLSDESC_CALL()
|
||||
+#endif
|
||||
+
|
||||
#ifndef BEFORE_TLSDESC_CALL
|
||||
# define BEFORE_TLSDESC_CALL()
|
||||
#endif
|
||||
diff --git a/elf/tst-gnu2-tls2mod0.c b/elf/tst-gnu2-tls2mod0.c
|
||||
index 45556a0e173922cc..3fe3c142777abe04 100644
|
||||
--- a/elf/tst-gnu2-tls2mod0.c
|
||||
+++ b/elf/tst-gnu2-tls2mod0.c
|
||||
@@ -16,13 +16,14 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
-#include "tst-gnu2-tls2.h"
|
||||
+#include <tst-gnu2-tls2.h>
|
||||
|
||||
__thread struct tls tls_var0 __attribute__ ((visibility ("hidden")));
|
||||
|
||||
struct tls *
|
||||
apply_tls (struct tls *p)
|
||||
{
|
||||
+ INIT_TLSDESC_CALL ();
|
||||
BEFORE_TLSDESC_CALL ();
|
||||
tls_var0 = *p;
|
||||
struct tls *ret = &tls_var0;
|
||||
diff --git a/elf/tst-gnu2-tls2mod1.c b/elf/tst-gnu2-tls2mod1.c
|
||||
index e10b9dbc0a7573c7..e2105384689e2d2e 100644
|
||||
--- a/elf/tst-gnu2-tls2mod1.c
|
||||
+++ b/elf/tst-gnu2-tls2mod1.c
|
||||
@@ -16,13 +16,14 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
-#include "tst-gnu2-tls2.h"
|
||||
+#include <tst-gnu2-tls2.h>
|
||||
|
||||
__thread struct tls tls_var1[100] __attribute__ ((visibility ("hidden")));
|
||||
|
||||
struct tls *
|
||||
apply_tls (struct tls *p)
|
||||
{
|
||||
+ INIT_TLSDESC_CALL ();
|
||||
BEFORE_TLSDESC_CALL ();
|
||||
tls_var1[1] = *p;
|
||||
struct tls *ret = &tls_var1[1];
|
||||
diff --git a/elf/tst-gnu2-tls2mod2.c b/elf/tst-gnu2-tls2mod2.c
|
||||
index 141af51e55b8bf34..6d3031dc5fbc1041 100644
|
||||
--- a/elf/tst-gnu2-tls2mod2.c
|
||||
+++ b/elf/tst-gnu2-tls2mod2.c
|
||||
@@ -16,13 +16,14 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
-#include "tst-gnu2-tls2.h"
|
||||
+#include <tst-gnu2-tls2.h>
|
||||
|
||||
__thread struct tls tls_var2 __attribute__ ((visibility ("hidden")));
|
||||
|
||||
struct tls *
|
||||
apply_tls (struct tls *p)
|
||||
{
|
||||
+ INIT_TLSDESC_CALL ();
|
||||
BEFORE_TLSDESC_CALL ();
|
||||
tls_var2 = *p;
|
||||
struct tls *ret = &tls_var2;
|
||||
diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure
|
||||
index 35e2918922300956..4ef4d46cbd5384e9 100644
|
||||
--- a/sysdeps/arm/configure
|
||||
+++ b/sysdeps/arm/configure
|
||||
@@ -187,6 +187,38 @@ else
|
||||
default-abi = soft"
|
||||
fi
|
||||
|
||||
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether VFP supports 32 registers" >&5
|
||||
+printf %s "checking whether VFP supports 32 registers... " >&6; }
|
||||
+if test ${libc_cv_arm_pcs_vfp_d32+y}
|
||||
+then :
|
||||
+ printf %s "(cached) " >&6
|
||||
+else $as_nop
|
||||
+
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+void foo (void)
|
||||
+{
|
||||
+ asm volatile ("vldr d16,=17" : : : "d16");
|
||||
+}
|
||||
+
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_compile "$LINENO"
|
||||
+then :
|
||||
+ libc_cv_arm_pcs_vfp_d32=yes
|
||||
+else $as_nop
|
||||
+ libc_cv_arm_pcs_vfp_d32=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
+fi
|
||||
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_arm_pcs_vfp_d32" >&5
|
||||
+printf "%s\n" "$libc_cv_arm_pcs_vfp_d32" >&6; }
|
||||
+if test "$libc_cv_arm_pcs_vfp_d32" = yes ;
|
||||
+then
|
||||
+ printf "%s\n" "#define HAVE_ARM_PCS_VFP_D32 1" >>confdefs.h
|
||||
+
|
||||
+fi
|
||||
+
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether PC-relative relocs in movw/movt work properly" >&5
|
||||
printf %s "checking whether PC-relative relocs in movw/movt work properly... " >&6; }
|
||||
if test ${libc_cv_arm_pcrel_movw+y}
|
||||
diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac
|
||||
index 5172e30bbe79f995..cd00ddc9d9ade5d7 100644
|
||||
--- a/sysdeps/arm/configure.ac
|
||||
+++ b/sysdeps/arm/configure.ac
|
||||
@@ -21,6 +21,21 @@ else
|
||||
LIBC_CONFIG_VAR([default-abi], [soft])
|
||||
fi
|
||||
|
||||
+AC_CACHE_CHECK([whether VFP supports 32 registers],
|
||||
+ libc_cv_arm_pcs_vfp_d32, [
|
||||
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
+void foo (void)
|
||||
+{
|
||||
+ asm volatile ("vldr d16,=17" : : : "d16");
|
||||
+}
|
||||
+]])],
|
||||
+ [libc_cv_arm_pcs_vfp_d32=yes],
|
||||
+ [libc_cv_arm_pcs_vfp_d32=no])])
|
||||
+if test "$libc_cv_arm_pcs_vfp_d32" = yes ;
|
||||
+then
|
||||
+ AC_DEFINE(HAVE_ARM_PCS_VFP_D32)
|
||||
+fi
|
||||
+
|
||||
AC_CACHE_CHECK([whether PC-relative relocs in movw/movt work properly],
|
||||
libc_cv_arm_pcrel_movw, [
|
||||
cat > conftest.s <<\EOF
|
||||
diff --git a/sysdeps/arm/dl-tlsdesc.S b/sysdeps/arm/dl-tlsdesc.S
|
||||
index 764c56e70f046b03..ada106521da8971a 100644
|
||||
--- a/sysdeps/arm/dl-tlsdesc.S
|
||||
+++ b/sysdeps/arm/dl-tlsdesc.S
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <sysdep.h>
|
||||
#include <arm-features.h>
|
||||
#include <tls.h>
|
||||
+#include <rtld-global-offsets.h>
|
||||
#include "tlsdesc.h"
|
||||
|
||||
.text
|
||||
@@ -83,14 +84,20 @@ _dl_tlsdesc_dynamic(struct tlsdesc *tdp)
|
||||
.align 2
|
||||
_dl_tlsdesc_dynamic:
|
||||
/* Our calling convention is to clobber r0, r1 and the processor
|
||||
- flags. All others that are modified must be saved */
|
||||
- eabi_save ({r2,r3,r4,lr})
|
||||
- push {r2,r3,r4,lr}
|
||||
- cfi_adjust_cfa_offset (16)
|
||||
+ flags. All others that are modified must be saved. r5 is
|
||||
+ used as the hwcap value to avoid reload after __tls_get_addr
|
||||
+ call. If required we will save the vector register on the slow
|
||||
+ path. */
|
||||
+ eabi_save ({r2,r3,r4,r5,ip,lr})
|
||||
+ push {r2,r3,r4,r5,ip,lr}
|
||||
+ cfi_adjust_cfa_offset (24)
|
||||
cfi_rel_offset (r2,0)
|
||||
cfi_rel_offset (r3,4)
|
||||
cfi_rel_offset (r4,8)
|
||||
- cfi_rel_offset (lr,12)
|
||||
+ cfi_rel_offset (r5,12)
|
||||
+ cfi_rel_offset (ip,16)
|
||||
+ cfi_rel_offset (lr,20)
|
||||
+
|
||||
ldr r1, [r0] /* td */
|
||||
GET_TLS (lr)
|
||||
mov r4, r0 /* r4 = tp */
|
||||
@@ -113,22 +120,69 @@ _dl_tlsdesc_dynamic:
|
||||
rsbne r0, r4, r3
|
||||
bne 2f
|
||||
1: mov r0, r1
|
||||
+
|
||||
+ /* Load the hwcap to check for vector support. */
|
||||
+ ldr r2, 3f
|
||||
+ ldr r1, .Lrtld_global_ro
|
||||
+0: add r2, pc, r2
|
||||
+ ldr r2, [r2, r1]
|
||||
+ ldr r5, [r2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
|
||||
+
|
||||
+#ifdef __SOFTFP__
|
||||
+ tst r5, #HWCAP_ARM_VFP
|
||||
+ beq .Lno_vfp
|
||||
+#endif
|
||||
+
|
||||
+ /* Store the VFP registers. Don't use VFP instructions directly
|
||||
+ because this code is used in non-VFP multilibs. */
|
||||
+#define VFP_STACK_REQ (32*8 + 8)
|
||||
+ sub sp, sp, VFP_STACK_REQ
|
||||
+ cfi_adjust_cfa_offset (VFP_STACK_REQ)
|
||||
+ mov r3, sp
|
||||
+ .inst 0xeca30b20 /* vstmia r3!, {d0-d15} */
|
||||
+ tst r5, #HWCAP_ARM_VFPD32
|
||||
+ beq 4f
|
||||
+ .inst 0xece30b20 /* vstmia r3!, {d16-d31} */
|
||||
+ /* Store the floating-point status register. */
|
||||
+4: .inst 0xeef12a10 /* vmrs r2, fpscr */
|
||||
+ str r2, [r3]
|
||||
+.Lno_vfp:
|
||||
bl __tls_get_addr
|
||||
rsb r0, r4, r0
|
||||
+#ifdef __SOFTFP__
|
||||
+ tst r5, #HWCAP_ARM_VFP
|
||||
+ beq 2f
|
||||
+#endif
|
||||
+ mov r3, sp
|
||||
+ .inst 0xecb30b20 /* vldmia r3!, {d0-d15} */
|
||||
+ tst r5, #HWCAP_ARM_VFPD32
|
||||
+ beq 5f
|
||||
+ .inst 0xecf30b20 /* vldmia r3!, {d16-d31} */
|
||||
+ ldr r4, [r3]
|
||||
+5: .inst 0xeee14a10 /* vmsr fpscr, r4 */
|
||||
+ add sp, sp, VFP_STACK_REQ
|
||||
+ cfi_adjust_cfa_offset (-VFP_STACK_REQ)
|
||||
+
|
||||
2:
|
||||
#if ((defined (__ARM_ARCH_4T__) && defined (__THUMB_INTERWORK__)) \
|
||||
|| defined (ARM_ALWAYS_BX))
|
||||
- pop {r2,r3,r4, lr}
|
||||
- cfi_adjust_cfa_offset (-16)
|
||||
+ pop {r2,r3,r4,r5,ip, lr}
|
||||
+ cfi_adjust_cfa_offset (-20)
|
||||
cfi_restore (lr)
|
||||
+ cfi_restore (ip)
|
||||
+ cfi_restore (r5)
|
||||
cfi_restore (r4)
|
||||
cfi_restore (r3)
|
||||
cfi_restore (r2)
|
||||
bx lr
|
||||
#else
|
||||
- pop {r2,r3,r4, pc}
|
||||
+ pop {r2,r3,r4,r5,ip, pc}
|
||||
#endif
|
||||
eabi_fnend
|
||||
cfi_endproc
|
||||
.size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic
|
||||
+
|
||||
+3: .long _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
|
||||
+.Lrtld_global_ro:
|
||||
+ .long C_SYMBOL_NAME(_rtld_global_ro)(GOT)
|
||||
#endif /* SHARED */
|
||||
diff --git a/sysdeps/arm/tst-gnu2-tls2.h b/sysdeps/arm/tst-gnu2-tls2.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..e413ac21fb9ed9bf
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/arm/tst-gnu2-tls2.h
|
||||
@@ -0,0 +1,128 @@
|
||||
+/* Test TLSDESC relocation. ARM version.
|
||||
+ Copyright (C) 2024 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 <config.h>
|
||||
+#include <sys/auxv.h>
|
||||
+#include <string.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <endian.h>
|
||||
+
|
||||
+#ifndef __SOFTFP__
|
||||
+
|
||||
+# ifdef HAVE_ARM_PCS_VFP_D32
|
||||
+# define SAVE_VFP_D32 \
|
||||
+ asm volatile ("vldr d16,=17" : : : "d16"); \
|
||||
+ asm volatile ("vldr d17,=18" : : : "d17"); \
|
||||
+ asm volatile ("vldr d18,=19" : : : "d18"); \
|
||||
+ asm volatile ("vldr d19,=20" : : : "d19"); \
|
||||
+ asm volatile ("vldr d20,=21" : : : "d20"); \
|
||||
+ asm volatile ("vldr d21,=22" : : : "d21"); \
|
||||
+ asm volatile ("vldr d22,=23" : : : "d22"); \
|
||||
+ asm volatile ("vldr d23,=24" : : : "d23"); \
|
||||
+ asm volatile ("vldr d24,=25" : : : "d24"); \
|
||||
+ asm volatile ("vldr d25,=26" : : : "d25"); \
|
||||
+ asm volatile ("vldr d26,=27" : : : "d26"); \
|
||||
+ asm volatile ("vldr d27,=28" : : : "d27"); \
|
||||
+ asm volatile ("vldr d28,=29" : : : "d28"); \
|
||||
+ asm volatile ("vldr d29,=30" : : : "d29"); \
|
||||
+ asm volatile ("vldr d30,=31" : : : "d30"); \
|
||||
+ asm volatile ("vldr d31,=32" : : : "d31");
|
||||
+# else
|
||||
+# define SAVE_VFP_D32
|
||||
+# endif
|
||||
+
|
||||
+# define INIT_TLSDESC_CALL() \
|
||||
+ unsigned long hwcap = getauxval (AT_HWCAP)
|
||||
+
|
||||
+/* Set each vector register to a value from 1 to 32 before the TLS access,
|
||||
+ dump to memory after TLS access, and compare with the expected values. */
|
||||
+
|
||||
+# define BEFORE_TLSDESC_CALL() \
|
||||
+ if (hwcap & HWCAP_ARM_VFP) \
|
||||
+ { \
|
||||
+ asm volatile ("vldr d0,=1" : : : "d0"); \
|
||||
+ asm volatile ("vldr d1,=2" : : : "d1"); \
|
||||
+ asm volatile ("vldr d2,=3" : : : "d1"); \
|
||||
+ asm volatile ("vldr d3,=4" : : : "d3"); \
|
||||
+ asm volatile ("vldr d4,=5" : : : "d4"); \
|
||||
+ asm volatile ("vldr d5,=6" : : : "d5"); \
|
||||
+ asm volatile ("vldr d6,=7" : : : "d6"); \
|
||||
+ asm volatile ("vldr d7,=8" : : : "d7"); \
|
||||
+ asm volatile ("vldr d8,=9" : : : "d8"); \
|
||||
+ asm volatile ("vldr d9,=10" : : : "d9"); \
|
||||
+ asm volatile ("vldr d10,=11" : : : "d10"); \
|
||||
+ asm volatile ("vldr d11,=12" : : : "d11"); \
|
||||
+ asm volatile ("vldr d12,=13" : : : "d12"); \
|
||||
+ asm volatile ("vldr d13,=14" : : : "d13"); \
|
||||
+ asm volatile ("vldr d14,=15" : : : "d14"); \
|
||||
+ asm volatile ("vldr d15,=16" : : : "d15"); \
|
||||
+ } \
|
||||
+ if (hwcap & HWCAP_ARM_VFPD32) \
|
||||
+ { \
|
||||
+ SAVE_VFP_D32 \
|
||||
+ }
|
||||
+
|
||||
+# define VFP_STACK_REQ (16*8)
|
||||
+# if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+# define DISP 7
|
||||
+# else
|
||||
+# define DISP 0
|
||||
+# endif
|
||||
+
|
||||
+# ifdef HAVE_ARM_PCS_VFP_D32
|
||||
+# define CHECK_VFP_D32 \
|
||||
+ char vfp[VFP_STACK_REQ]; \
|
||||
+ asm volatile ("vstmia %0, {d16-d31}\n" \
|
||||
+ : \
|
||||
+ : "r" (vfp) \
|
||||
+ : "memory"); \
|
||||
+ \
|
||||
+ char expected[VFP_STACK_REQ] = { 0 }; \
|
||||
+ for (int i = 0; i < 16; ++i) \
|
||||
+ expected[i * 8 + DISP] = i + 17; \
|
||||
+ \
|
||||
+ if (memcmp (vfp, expected, VFP_STACK_REQ) != 0) \
|
||||
+ abort ();
|
||||
+# else
|
||||
+# define CHECK_VFP_D32
|
||||
+# endif
|
||||
+
|
||||
+# define AFTER_TLSDESC_CALL() \
|
||||
+ if (hwcap & HWCAP_ARM_VFP) \
|
||||
+ { \
|
||||
+ char vfp[VFP_STACK_REQ]; \
|
||||
+ asm volatile ("vstmia %0, {d0-d15}\n" \
|
||||
+ : \
|
||||
+ : "r" (vfp) \
|
||||
+ : "memory"); \
|
||||
+ \
|
||||
+ char expected[VFP_STACK_REQ] = { 0 }; \
|
||||
+ for (int i = 0; i < 16; ++i) \
|
||||
+ expected[i * 8 + DISP] = i + 1; \
|
||||
+ \
|
||||
+ if (memcmp (vfp, expected, VFP_STACK_REQ) != 0) \
|
||||
+ abort (); \
|
||||
+ } \
|
||||
+ if (hwcap & HWCAP_ARM_VFPD32) \
|
||||
+ { \
|
||||
+ CHECK_VFP_D32 \
|
||||
+ }
|
||||
+
|
||||
+#endif /* __SOFTFP__ */
|
||||
+
|
||||
+#include_next <tst-gnu2-tls2.h>
|
@ -0,0 +1,221 @@
|
||||
commit aded2fc004e7ee85cf0b45b1382552d41e555a23
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Tue Mar 12 13:21:20 2024 -0300
|
||||
|
||||
elf: Enable TLS descriptor tests on aarch64
|
||||
|
||||
The aarch64 uses 'trad' for traditional tls and 'desc' for tls
|
||||
descriptors, but unlike other targets it defaults to 'desc'. The
|
||||
gnutls2 configure check does not set aarch64 as an ABI that uses
|
||||
TLS descriptors, which then disable somes stests.
|
||||
|
||||
Also rename the internal machinery fron gnu2 to tls descriptors.
|
||||
|
||||
Checked on aarch64-linux-gnu.
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
|
||||
(cherry picked from commit 3d53d18fc71c5d9ef4773b8bce04d54b80181926)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 117b48a421792eda..432e40a59295cffd 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -653,7 +653,7 @@ LIBGD
|
||||
libc_cv_cc_loop_to_function
|
||||
libc_cv_cc_submachine
|
||||
libc_cv_cc_nofma
|
||||
-libc_cv_mtls_dialect_gnu2
|
||||
+libc_cv_mtls_descriptor
|
||||
libc_cv_has_glob_dat
|
||||
libc_cv_fpie
|
||||
libc_cv_z_execstack
|
||||
@@ -4760,6 +4760,9 @@ libc_config_ok=no
|
||||
# whether to use such directories.
|
||||
with_fp_cond=1
|
||||
|
||||
+# A preconfigure script may define another name to TLS descriptor variant
|
||||
+mtls_descriptor=gnu2
|
||||
+
|
||||
if frags=`ls -d $srcdir/sysdeps/*/preconfigure 2> /dev/null`
|
||||
then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysdeps preconfigure fragments" >&5
|
||||
@@ -7006,9 +7009,9 @@ fi
|
||||
printf "%s\n" "$libc_cv_has_glob_dat" >&6; }
|
||||
|
||||
|
||||
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -mtls-dialect=gnu2" >&5
|
||||
-printf %s "checking for -mtls-dialect=gnu2... " >&6; }
|
||||
-if test ${libc_cv_mtls_dialect_gnu2+y}
|
||||
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tls descriptor support" >&5
|
||||
+printf %s "checking for tls descriptor support... " >&6; }
|
||||
+if test ${libc_cv_mtls_descriptor+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
@@ -7019,7 +7022,7 @@ void foo (void)
|
||||
i = 10;
|
||||
}
|
||||
EOF
|
||||
-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
|
||||
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=$mtls_descriptor -nostdlib -nostartfiles
|
||||
-shared conftest.c -o conftest 1>&5'
|
||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
(eval $ac_try) 2>&5
|
||||
@@ -7027,17 +7030,17 @@ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nost
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; }
|
||||
then
|
||||
- libc_cv_mtls_dialect_gnu2=yes
|
||||
+ libc_cv_mtls_descriptor=$mtls_descriptor
|
||||
else
|
||||
- libc_cv_mtls_dialect_gnu2=no
|
||||
+ libc_cv_mtls_descriptor=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mtls_dialect_gnu2" >&5
|
||||
-printf "%s\n" "$libc_cv_mtls_dialect_gnu2" >&6; }
|
||||
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mtls_descriptor" >&5
|
||||
+printf "%s\n" "$libc_cv_mtls_descriptor" >&6; }
|
||||
|
||||
config_vars="$config_vars
|
||||
-have-mtls-dialect-gnu2 = $libc_cv_mtls_dialect_gnu2"
|
||||
+have-mtls-descriptor = $libc_cv_mtls_descriptor"
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if -Wno-ignored-attributes is required for aliases" >&5
|
||||
printf %s "checking if -Wno-ignored-attributes is required for aliases... " >&6; }
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 19b88a47a52508a1..bdc385d03c3dc7f5 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -442,6 +442,9 @@ libc_config_ok=no
|
||||
# whether to use such directories.
|
||||
with_fp_cond=1
|
||||
|
||||
+# A preconfigure script may define another name to TLS descriptor variant
|
||||
+mtls_descriptor=gnu2
|
||||
+
|
||||
dnl Let sysdeps/*/preconfigure act here.
|
||||
LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
|
||||
|
||||
@@ -1287,7 +1290,7 @@ fi
|
||||
rm -f conftest*])
|
||||
AC_SUBST(libc_cv_has_glob_dat)
|
||||
|
||||
-AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2,
|
||||
+AC_CACHE_CHECK([for tls descriptor support], libc_cv_mtls_descriptor,
|
||||
[dnl
|
||||
cat > conftest.c <<EOF
|
||||
__thread int i;
|
||||
@@ -1296,16 +1299,16 @@ void foo (void)
|
||||
i = 10;
|
||||
}
|
||||
EOF
|
||||
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
|
||||
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=$mtls_descriptor -nostdlib -nostartfiles
|
||||
-shared conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
|
||||
then
|
||||
- libc_cv_mtls_dialect_gnu2=yes
|
||||
+ libc_cv_mtls_descriptor=$mtls_descriptor
|
||||
else
|
||||
- libc_cv_mtls_dialect_gnu2=no
|
||||
+ libc_cv_mtls_descriptor=no
|
||||
fi
|
||||
rm -f conftest*])
|
||||
-AC_SUBST(libc_cv_mtls_dialect_gnu2)
|
||||
-LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
|
||||
+AC_SUBST(libc_cv_mtls_descriptor)
|
||||
+LIBC_CONFIG_VAR([have-mtls-descriptor], [$libc_cv_mtls_descriptor])
|
||||
|
||||
dnl clang emits an warning for a double alias redirection, to warn the
|
||||
dnl original symbol is sed even when weak definition overrides it.
|
||||
diff --git a/elf/Makefile b/elf/Makefile
|
||||
index 030db4d207d3491e..69aa423c4b90127d 100644
|
||||
--- a/elf/Makefile
|
||||
+++ b/elf/Makefile
|
||||
@@ -999,13 +999,13 @@ modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\
|
||||
# For +depfiles in Makerules.
|
||||
extra-test-objs += tst-auditmod17.os
|
||||
|
||||
-ifeq (yes,$(have-mtls-dialect-gnu2))
|
||||
+ifneq (no,$(have-mtls-descriptor))
|
||||
tests += tst-gnu2-tls1
|
||||
modules-names += tst-gnu2-tls1mod
|
||||
$(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
|
||||
tst-gnu2-tls1mod.so-no-z-defs = yes
|
||||
-CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=gnu2
|
||||
-endif # $(have-mtls-dialect-gnu2)
|
||||
+CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
+endif # $(have-mtls-descriptor)
|
||||
|
||||
ifeq (yes,$(have-protected-data))
|
||||
modules-names += tst-protected1moda tst-protected1modb
|
||||
@@ -2972,11 +2972,11 @@ $(objpfx)tst-tls-allocation-failure-static-patched.out: \
|
||||
$(objpfx)tst-audit-tlsdesc: $(objpfx)tst-audit-tlsdesc-mod1.so \
|
||||
$(objpfx)tst-audit-tlsdesc-mod2.so \
|
||||
$(shared-thread-library)
|
||||
-ifeq (yes,$(have-mtls-dialect-gnu2))
|
||||
+ifneq (no,$(have-mtls-descriptor))
|
||||
# The test is valid for all TLS types, but we want to exercise GNU2
|
||||
# TLS if possible.
|
||||
-CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=gnu2
|
||||
-CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=gnu2
|
||||
+CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
+CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
endif
|
||||
$(objpfx)tst-audit-tlsdesc-dlopen: $(shared-thread-library)
|
||||
$(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-audit-tlsdesc-mod1.so \
|
||||
@@ -3055,11 +3055,11 @@ $(objpfx)tst-gnu2-tls2.out: \
|
||||
$(objpfx)tst-gnu2-tls2mod1.so \
|
||||
$(objpfx)tst-gnu2-tls2mod2.so
|
||||
|
||||
-ifeq (yes,$(have-mtls-dialect-gnu2))
|
||||
-CFLAGS-tst-tlsgap-mod0.c += -mtls-dialect=gnu2
|
||||
-CFLAGS-tst-tlsgap-mod1.c += -mtls-dialect=gnu2
|
||||
-CFLAGS-tst-tlsgap-mod2.c += -mtls-dialect=gnu2
|
||||
-CFLAGS-tst-gnu2-tls2mod0.c += -mtls-dialect=gnu2
|
||||
-CFLAGS-tst-gnu2-tls2mod1.c += -mtls-dialect=gnu2
|
||||
-CFLAGS-tst-gnu2-tls2mod2.c += -mtls-dialect=gnu2
|
||||
+ifneq (no,$(have-mtls-descriptor))
|
||||
+CFLAGS-tst-tlsgap-mod0.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
+CFLAGS-tst-tlsgap-mod1.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
+CFLAGS-tst-tlsgap-mod2.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
+CFLAGS-tst-gnu2-tls2mod0.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
+CFLAGS-tst-gnu2-tls2mod1.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
+CFLAGS-tst-gnu2-tls2mod2.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
endif
|
||||
diff --git a/sysdeps/aarch64/preconfigure b/sysdeps/aarch64/preconfigure
|
||||
index d9bd1f8558a079cb..19657b627bc84c4e 100644
|
||||
--- a/sysdeps/aarch64/preconfigure
|
||||
+++ b/sysdeps/aarch64/preconfigure
|
||||
@@ -2,5 +2,6 @@ case "$machine" in
|
||||
aarch64*)
|
||||
base_machine=aarch64
|
||||
machine=aarch64
|
||||
+ mtls_descriptor=desc
|
||||
;;
|
||||
esac
|
||||
diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile
|
||||
index d5cea717a9c201aa..619474eca94fe8e4 100644
|
||||
--- a/sysdeps/arm/Makefile
|
||||
+++ b/sysdeps/arm/Makefile
|
||||
@@ -13,15 +13,15 @@ $(objpfx)libgcc-stubs.a: $(objpfx)aeabi_unwind_cpp_pr1.os
|
||||
lib-noranlib: $(objpfx)libgcc-stubs.a
|
||||
|
||||
ifeq ($(build-shared),yes)
|
||||
-ifeq (yes,$(have-mtls-dialect-gnu2))
|
||||
+ifneq (no,$(have-mtls-descriptor))
|
||||
tests += tst-armtlsdescloc tst-armtlsdescextnow tst-armtlsdescextlazy
|
||||
modules-names += tst-armtlsdesclocmod
|
||||
modules-names += tst-armtlsdescextlazymod tst-armtlsdescextnowmod
|
||||
CPPFLAGS-tst-armtlsdescextnowmod.c += -Dstatic=
|
||||
CPPFLAGS-tst-armtlsdescextlazymod.c += -Dstatic=
|
||||
-CFLAGS-tst-armtlsdesclocmod.c += -mtls-dialect=gnu2
|
||||
-CFLAGS-tst-armtlsdescextnowmod.c += -mtls-dialect=gnu2
|
||||
-CFLAGS-tst-armtlsdescextlazymod.c += -mtls-dialect=gnu2
|
||||
+CFLAGS-tst-armtlsdesclocmod.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
+CFLAGS-tst-armtlsdescextnowmod.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
+CFLAGS-tst-armtlsdescextlazymod.c += -mtls-dialect=$(have-mtls-descriptor)
|
||||
LDFLAGS-tst-armtlsdescextnowmod.so += -Wl,-z,now
|
||||
tst-armtlsdescloc-ENV = LD_BIND_NOW=1
|
||||
tst-armtlsdescextnow-ENV = LD_BIND_NOW=1
|
@ -0,0 +1,24 @@
|
||||
commit 5a461f2949ded98d8211939f84988bc464c7b4fe
|
||||
Author: Andreas Schwab <schwab@suse.de>
|
||||
Date: Tue Mar 19 13:49:50 2024 +0100
|
||||
|
||||
Add tst-gnu2-tls2mod1 to test-internal-extras
|
||||
|
||||
That allows sysdeps/x86_64/tst-gnu2-tls2mod1.S to use internal headers.
|
||||
|
||||
Fixes: 717ebfa85c ("x86-64: Allocate state buffer space for RDI, RSI and RBX")
|
||||
(cherry picked from commit fd7ee2e6c5eb49e4a630a9978b4d668bff6354ee)
|
||||
|
||||
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
|
||||
index e8babc9a4edbf90b..9d374a329916fc45 100644
|
||||
--- a/sysdeps/x86_64/Makefile
|
||||
+++ b/sysdeps/x86_64/Makefile
|
||||
@@ -210,6 +210,8 @@ tst-plt-rewrite2-ENV = GLIBC_TUNABLES=glibc.cpu.plt_rewrite=2
|
||||
$(objpfx)tst-plt-rewrite2: $(objpfx)tst-plt-rewritemod2.so
|
||||
endif
|
||||
|
||||
+test-internal-extras += tst-gnu2-tls2mod1
|
||||
+
|
||||
endif # $(subdir) == elf
|
||||
|
||||
ifeq ($(subdir),csu)
|
@ -0,0 +1,146 @@
|
||||
commit aa4249266e9906c4bc833e4847f4d8feef59504f
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Thu Feb 8 10:08:38 2024 -0300
|
||||
|
||||
x86: Fix Zen3/Zen4 ERMS selection (BZ 30994)
|
||||
|
||||
The REP MOVSB usage on memcpy/memmove does not show much performance
|
||||
improvement on Zen3/Zen4 cores compared to the vectorized loops. Also,
|
||||
as from BZ 30994, if the source is aligned and the destination is not
|
||||
the performance can be 20x slower.
|
||||
|
||||
The performance difference is noticeable with small buffer sizes, closer
|
||||
to the lower bounds limits when memcpy/memmove starts to use ERMS. The
|
||||
performance of REP MOVSB is similar to vectorized instruction on the
|
||||
size limit (the L2 cache). Also, there is no drawback to multiple cores
|
||||
sharing the cache.
|
||||
|
||||
Checked on x86_64-linux-gnu on Zen3.
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
|
||||
(cherry picked from commit 0c0d39fe4aeb0f69b26e76337c5dfd5530d5d44e)
|
||||
|
||||
diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
|
||||
index d5101615e348e5c2..f34d12846caf9422 100644
|
||||
--- a/sysdeps/x86/dl-cacheinfo.h
|
||||
+++ b/sysdeps/x86/dl-cacheinfo.h
|
||||
@@ -791,7 +791,6 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||
long int data = -1;
|
||||
long int shared = -1;
|
||||
long int shared_per_thread = -1;
|
||||
- long int core = -1;
|
||||
unsigned int threads = 0;
|
||||
unsigned long int level1_icache_size = -1;
|
||||
unsigned long int level1_icache_linesize = -1;
|
||||
@@ -809,7 +808,6 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||
if (cpu_features->basic.kind == arch_kind_intel)
|
||||
{
|
||||
data = handle_intel (_SC_LEVEL1_DCACHE_SIZE, cpu_features);
|
||||
- core = handle_intel (_SC_LEVEL2_CACHE_SIZE, cpu_features);
|
||||
shared = handle_intel (_SC_LEVEL3_CACHE_SIZE, cpu_features);
|
||||
shared_per_thread = shared;
|
||||
|
||||
@@ -822,7 +820,8 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||
= handle_intel (_SC_LEVEL1_DCACHE_ASSOC, cpu_features);
|
||||
level1_dcache_linesize
|
||||
= handle_intel (_SC_LEVEL1_DCACHE_LINESIZE, cpu_features);
|
||||
- level2_cache_size = core;
|
||||
+ level2_cache_size
|
||||
+ = handle_intel (_SC_LEVEL2_CACHE_SIZE, cpu_features);
|
||||
level2_cache_assoc
|
||||
= handle_intel (_SC_LEVEL2_CACHE_ASSOC, cpu_features);
|
||||
level2_cache_linesize
|
||||
@@ -835,12 +834,12 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||
level4_cache_size
|
||||
= handle_intel (_SC_LEVEL4_CACHE_SIZE, cpu_features);
|
||||
|
||||
- get_common_cache_info (&shared, &shared_per_thread, &threads, core);
|
||||
+ get_common_cache_info (&shared, &shared_per_thread, &threads,
|
||||
+ level2_cache_size);
|
||||
}
|
||||
else if (cpu_features->basic.kind == arch_kind_zhaoxin)
|
||||
{
|
||||
data = handle_zhaoxin (_SC_LEVEL1_DCACHE_SIZE);
|
||||
- core = handle_zhaoxin (_SC_LEVEL2_CACHE_SIZE);
|
||||
shared = handle_zhaoxin (_SC_LEVEL3_CACHE_SIZE);
|
||||
shared_per_thread = shared;
|
||||
|
||||
@@ -849,19 +848,19 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||
level1_dcache_size = data;
|
||||
level1_dcache_assoc = handle_zhaoxin (_SC_LEVEL1_DCACHE_ASSOC);
|
||||
level1_dcache_linesize = handle_zhaoxin (_SC_LEVEL1_DCACHE_LINESIZE);
|
||||
- level2_cache_size = core;
|
||||
+ level2_cache_size = handle_zhaoxin (_SC_LEVEL2_CACHE_SIZE);
|
||||
level2_cache_assoc = handle_zhaoxin (_SC_LEVEL2_CACHE_ASSOC);
|
||||
level2_cache_linesize = handle_zhaoxin (_SC_LEVEL2_CACHE_LINESIZE);
|
||||
level3_cache_size = shared;
|
||||
level3_cache_assoc = handle_zhaoxin (_SC_LEVEL3_CACHE_ASSOC);
|
||||
level3_cache_linesize = handle_zhaoxin (_SC_LEVEL3_CACHE_LINESIZE);
|
||||
|
||||
- get_common_cache_info (&shared, &shared_per_thread, &threads, core);
|
||||
+ get_common_cache_info (&shared, &shared_per_thread, &threads,
|
||||
+ level2_cache_size);
|
||||
}
|
||||
else if (cpu_features->basic.kind == arch_kind_amd)
|
||||
{
|
||||
data = handle_amd (_SC_LEVEL1_DCACHE_SIZE);
|
||||
- core = handle_amd (_SC_LEVEL2_CACHE_SIZE);
|
||||
shared = handle_amd (_SC_LEVEL3_CACHE_SIZE);
|
||||
|
||||
level1_icache_size = handle_amd (_SC_LEVEL1_ICACHE_SIZE);
|
||||
@@ -869,7 +868,7 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||
level1_dcache_size = data;
|
||||
level1_dcache_assoc = handle_amd (_SC_LEVEL1_DCACHE_ASSOC);
|
||||
level1_dcache_linesize = handle_amd (_SC_LEVEL1_DCACHE_LINESIZE);
|
||||
- level2_cache_size = core;
|
||||
+ level2_cache_size = handle_amd (_SC_LEVEL2_CACHE_SIZE);;
|
||||
level2_cache_assoc = handle_amd (_SC_LEVEL2_CACHE_ASSOC);
|
||||
level2_cache_linesize = handle_amd (_SC_LEVEL2_CACHE_LINESIZE);
|
||||
level3_cache_size = shared;
|
||||
@@ -880,12 +879,12 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||
if (shared <= 0)
|
||||
{
|
||||
/* No shared L3 cache. All we have is the L2 cache. */
|
||||
- shared = core;
|
||||
+ shared = level2_cache_size;
|
||||
}
|
||||
else if (cpu_features->basic.family < 0x17)
|
||||
{
|
||||
/* Account for exclusive L2 and L3 caches. */
|
||||
- shared += core;
|
||||
+ shared += level2_cache_size;
|
||||
}
|
||||
|
||||
shared_per_thread = shared;
|
||||
@@ -987,6 +986,12 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||
if (CPU_FEATURE_USABLE_P (cpu_features, FSRM))
|
||||
rep_movsb_threshold = 2112;
|
||||
|
||||
+ /* For AMD CPUs that support ERMS (Zen3+), REP MOVSB is in a lot of
|
||||
+ cases slower than the vectorized path (and for some alignments,
|
||||
+ it is really slow, check BZ #30994). */
|
||||
+ if (cpu_features->basic.kind == arch_kind_amd)
|
||||
+ rep_movsb_threshold = non_temporal_threshold;
|
||||
+
|
||||
/* The default threshold to use Enhanced REP STOSB. */
|
||||
unsigned long int rep_stosb_threshold = 2048;
|
||||
|
||||
@@ -1028,16 +1033,9 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||
SIZE_MAX);
|
||||
|
||||
unsigned long int rep_movsb_stop_threshold;
|
||||
- /* ERMS feature is implemented from AMD Zen3 architecture and it is
|
||||
- performing poorly for data above L2 cache size. Henceforth, adding
|
||||
- an upper bound threshold parameter to limit the usage of Enhanced
|
||||
- REP MOVSB operations and setting its value to L2 cache size. */
|
||||
- if (cpu_features->basic.kind == arch_kind_amd)
|
||||
- rep_movsb_stop_threshold = core;
|
||||
/* Setting the upper bound of ERMS to the computed value of
|
||||
- non-temporal threshold for architectures other than AMD. */
|
||||
- else
|
||||
- rep_movsb_stop_threshold = non_temporal_threshold;
|
||||
+ non-temporal threshold for all architectures. */
|
||||
+ rep_movsb_stop_threshold = non_temporal_threshold;
|
||||
|
||||
cpu_features->data_cache_size = data;
|
||||
cpu_features->shared_cache_size = shared;
|
@ -0,0 +1,35 @@
|
||||
commit 63295e4fda1f6dab4bf7442706fe303bf283036c
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Mon Feb 5 16:10:24 2024 +0000
|
||||
|
||||
arm: Remove wrong ldr from _dl_start_user (BZ 31339)
|
||||
|
||||
The commit 49d877a80b29d3002887b084eec6676d9f5fec18 (arm: Remove
|
||||
_dl_skip_args usage) removed the _SKIP_ARGS literal, which was
|
||||
previously loader to r4 on loader _start. However, the cleanup did not
|
||||
remove the following 'ldr r4, [sl, r4]' on _dl_start_user, used to check
|
||||
to skip the arguments after ld self-relocations.
|
||||
|
||||
In my testing, the kernel initially set r4 to 0, which makes the
|
||||
ldr instruction just read the _GLOBAL_OFFSET_TABLE_. However, since r4
|
||||
is a callee-saved register; a different runtime might not zero
|
||||
initialize it and thus trigger an invalid memory access.
|
||||
|
||||
Checked on arm-linux-gnu.
|
||||
|
||||
Reported-by: Adrian Ratiu <adrian.ratiu@collabora.com>
|
||||
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
|
||||
(cherry picked from commit 1e25112dc0cb2515d27d8d178b1ecce778a9d37a)
|
||||
|
||||
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
|
||||
index b857bbc868ea2ce4..dd1a0f6b6e7a5ea8 100644
|
||||
--- a/sysdeps/arm/dl-machine.h
|
||||
+++ b/sysdeps/arm/dl-machine.h
|
||||
@@ -139,7 +139,6 @@ _start:\n\
|
||||
_dl_start_user:\n\
|
||||
adr r6, .L_GET_GOT\n\
|
||||
add sl, sl, r6\n\
|
||||
- ldr r4, [sl, r4]\n\
|
||||
@ save the entry point in another register\n\
|
||||
mov r6, r0\n\
|
||||
@ get the original arg count\n\
|
@ -0,0 +1,30 @@
|
||||
commit 6484a92698039c4a7a510f0214e22d067b0d78b3
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Thu Feb 8 10:08:39 2024 -0300
|
||||
|
||||
x86: Do not prefer ERMS for memset on Zen3+
|
||||
|
||||
For AMD Zen3+ architecture, the performance of the vectorized loop is
|
||||
slightly better than ERMS.
|
||||
|
||||
Checked on x86_64-linux-gnu on Zen3.
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
|
||||
(cherry picked from commit 272708884cb750f12f5c74a00e6620c19dc6d567)
|
||||
|
||||
diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
|
||||
index f34d12846caf9422..5a98f70364220da4 100644
|
||||
--- a/sysdeps/x86/dl-cacheinfo.h
|
||||
+++ b/sysdeps/x86/dl-cacheinfo.h
|
||||
@@ -1021,6 +1021,11 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
|
||||
minimum value is fixed. */
|
||||
rep_stosb_threshold = TUNABLE_GET (x86_rep_stosb_threshold,
|
||||
long int, NULL);
|
||||
+ if (cpu_features->basic.kind == arch_kind_amd
|
||||
+ && !TUNABLE_IS_INITIALIZED (x86_rep_stosb_threshold))
|
||||
+ /* For AMD Zen3+ architecture, the performance of the vectorized loop is
|
||||
+ slightly better than ERMS. */
|
||||
+ rep_stosb_threshold = SIZE_MAX;
|
||||
|
||||
TUNABLE_SET_WITH_BOUNDS (x86_data_cache_size, data, 0, SIZE_MAX);
|
||||
TUNABLE_SET_WITH_BOUNDS (x86_shared_cache_size, shared, 0, SIZE_MAX);
|
@ -0,0 +1,24 @@
|
||||
commit 5d070d12b3a52bc44dd1b71743abc4b6243862ae
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Thu Feb 8 10:08:40 2024 -0300
|
||||
|
||||
x86: Expand the comment on when REP STOSB is used on memset
|
||||
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
(cherry picked from commit 491e55beab7457ed310a4a47496f4a333c5d1032)
|
||||
|
||||
diff --git a/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
|
||||
index 9984c3ca0fafab6a..97839a22483b0613 100644
|
||||
--- a/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
|
||||
+++ b/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
|
||||
@@ -21,7 +21,9 @@
|
||||
2. If size is less than VEC, use integer register stores.
|
||||
3. If size is from VEC_SIZE to 2 * VEC_SIZE, use 2 VEC stores.
|
||||
4. If size is from 2 * VEC_SIZE to 4 * VEC_SIZE, use 4 VEC stores.
|
||||
- 5. If size is more to 4 * VEC_SIZE, align to 4 * VEC_SIZE with
|
||||
+ 5. On machines ERMS feature, if size is greater or equal than
|
||||
+ __x86_rep_stosb_threshold then REP STOSB will be used.
|
||||
+ 6. If size is more to 4 * VEC_SIZE, align to 4 * VEC_SIZE with
|
||||
4 VEC stores and store 4 * VEC at a time until done. */
|
||||
|
||||
#include <sysdep.h>
|
@ -0,0 +1,32 @@
|
||||
commit 31c7d69af59da0da80caa74b2ec6ae149013384d
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Feb 16 07:40:37 2024 +0100
|
||||
|
||||
i386: Use generic memrchr in libc (bug 31316)
|
||||
|
||||
Before this change, we incorrectly used the SSE2 variant in the
|
||||
implementation, without checking that the system actually supports
|
||||
SSE2.
|
||||
|
||||
Tested-by: Sam James <sam@gentoo.org>
|
||||
(cherry picked from commit 0d9166c2245cad4ac520b337dee40c9a583872b6)
|
||||
|
||||
diff --git a/sysdeps/i386/i686/multiarch/memrchr-c.c b/sysdeps/i386/i686/multiarch/memrchr-c.c
|
||||
index ef7bbbe792afc78e..20bfdf3af35b66e4 100644
|
||||
--- a/sysdeps/i386/i686/multiarch/memrchr-c.c
|
||||
+++ b/sysdeps/i386/i686/multiarch/memrchr-c.c
|
||||
@@ -5,3 +5,4 @@ extern void *__memrchr_ia32 (const void *, int, size_t);
|
||||
#endif
|
||||
|
||||
#include "string/memrchr.c"
|
||||
+strong_alias (__memrchr_ia32, __GI___memrchr)
|
||||
diff --git a/sysdeps/i386/i686/multiarch/memrchr-sse2.S b/sysdeps/i386/i686/multiarch/memrchr-sse2.S
|
||||
index d9dae04171bfedff..e123f87435b3c6a6 100644
|
||||
--- a/sysdeps/i386/i686/multiarch/memrchr-sse2.S
|
||||
+++ b/sysdeps/i386/i686/multiarch/memrchr-sse2.S
|
||||
@@ -720,5 +720,4 @@ L(ret_null):
|
||||
ret
|
||||
|
||||
END (__memrchr_sse2)
|
||||
-strong_alias (__memrchr_sse2, __GI___memrchr)
|
||||
#endif
|
@ -0,0 +1,669 @@
|
||||
commit b0e0a07018098c2c5927796be5681a298c312626
|
||||
Author: Joe Ramsay <Joe.Ramsay@arm.com>
|
||||
Date: Tue Feb 20 16:44:13 2024 +0000
|
||||
|
||||
aarch64/fpu: Sync libmvec routines from 2.39 and before with AOR
|
||||
|
||||
This includes a fix for big-endian in AdvSIMD log, some cosmetic
|
||||
changes, and numerous small optimisations mainly around inlining and
|
||||
using indexed variants of MLA intrinsics.
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
(cherry picked from commit e302e1021391d13a9611ba3a910df128830bd19e)
|
||||
|
||||
diff --git a/sysdeps/aarch64/fpu/acos_advsimd.c b/sysdeps/aarch64/fpu/acos_advsimd.c
|
||||
index a8eabb5e7155360f..0a86c9823a279766 100644
|
||||
--- a/sysdeps/aarch64/fpu/acos_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/acos_advsimd.c
|
||||
@@ -40,8 +40,8 @@ static const struct data
|
||||
};
|
||||
|
||||
#define AllMask v_u64 (0xffffffffffffffff)
|
||||
-#define Oneu (0x3ff0000000000000)
|
||||
-#define Small (0x3e50000000000000) /* 2^-53. */
|
||||
+#define Oneu 0x3ff0000000000000
|
||||
+#define Small 0x3e50000000000000 /* 2^-53. */
|
||||
|
||||
#if WANT_SIMD_EXCEPT
|
||||
static float64x2_t VPCS_ATTR NOINLINE
|
||||
diff --git a/sysdeps/aarch64/fpu/asin_advsimd.c b/sysdeps/aarch64/fpu/asin_advsimd.c
|
||||
index 141646e954aa8ba1..2de6eff40782bc79 100644
|
||||
--- a/sysdeps/aarch64/fpu/asin_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/asin_advsimd.c
|
||||
@@ -39,8 +39,8 @@ static const struct data
|
||||
};
|
||||
|
||||
#define AllMask v_u64 (0xffffffffffffffff)
|
||||
-#define One (0x3ff0000000000000)
|
||||
-#define Small (0x3e50000000000000) /* 2^-12. */
|
||||
+#define One 0x3ff0000000000000
|
||||
+#define Small 0x3e50000000000000 /* 2^-12. */
|
||||
|
||||
#if WANT_SIMD_EXCEPT
|
||||
static float64x2_t VPCS_ATTR NOINLINE
|
||||
diff --git a/sysdeps/aarch64/fpu/atan2_sve.c b/sysdeps/aarch64/fpu/atan2_sve.c
|
||||
index 09a4c559b8afbe95..04fa71fa37c3de29 100644
|
||||
--- a/sysdeps/aarch64/fpu/atan2_sve.c
|
||||
+++ b/sysdeps/aarch64/fpu/atan2_sve.c
|
||||
@@ -37,9 +37,6 @@ static const struct data
|
||||
.pi_over_2 = 0x1.921fb54442d18p+0,
|
||||
};
|
||||
|
||||
-/* Useful constants. */
|
||||
-#define SignMask sv_u64 (0x8000000000000000)
|
||||
-
|
||||
/* Special cases i.e. 0, infinity, nan (fall back to scalar calls). */
|
||||
static svfloat64_t NOINLINE
|
||||
special_case (svfloat64_t y, svfloat64_t x, svfloat64_t ret,
|
||||
@@ -72,14 +69,15 @@ svfloat64_t SV_NAME_D2 (atan2) (svfloat64_t y, svfloat64_t x, const svbool_t pg)
|
||||
svbool_t cmp_y = zeroinfnan (iy, pg);
|
||||
svbool_t cmp_xy = svorr_z (pg, cmp_x, cmp_y);
|
||||
|
||||
- svuint64_t sign_x = svand_x (pg, ix, SignMask);
|
||||
- svuint64_t sign_y = svand_x (pg, iy, SignMask);
|
||||
- svuint64_t sign_xy = sveor_x (pg, sign_x, sign_y);
|
||||
-
|
||||
svfloat64_t ax = svabs_x (pg, x);
|
||||
svfloat64_t ay = svabs_x (pg, y);
|
||||
+ svuint64_t iax = svreinterpret_u64 (ax);
|
||||
+ svuint64_t iay = svreinterpret_u64 (ay);
|
||||
+
|
||||
+ svuint64_t sign_x = sveor_x (pg, ix, iax);
|
||||
+ svuint64_t sign_y = sveor_x (pg, iy, iay);
|
||||
+ svuint64_t sign_xy = sveor_x (pg, sign_x, sign_y);
|
||||
|
||||
- svbool_t pred_xlt0 = svcmplt (pg, x, 0.0);
|
||||
svbool_t pred_aygtax = svcmpgt (pg, ay, ax);
|
||||
|
||||
/* Set up z for call to atan. */
|
||||
@@ -88,8 +86,9 @@ svfloat64_t SV_NAME_D2 (atan2) (svfloat64_t y, svfloat64_t x, const svbool_t pg)
|
||||
svfloat64_t z = svdiv_x (pg, n, d);
|
||||
|
||||
/* Work out the correct shift. */
|
||||
- svfloat64_t shift = svsel (pred_xlt0, sv_f64 (-2.0), sv_f64 (0.0));
|
||||
- shift = svsel (pred_aygtax, svadd_x (pg, shift, 1.0), shift);
|
||||
+ svfloat64_t shift = svreinterpret_f64 (svlsr_x (pg, sign_x, 1));
|
||||
+ shift = svsel (pred_aygtax, sv_f64 (1.0), shift);
|
||||
+ shift = svreinterpret_f64 (svorr_x (pg, sign_x, svreinterpret_u64 (shift)));
|
||||
shift = svmul_x (pg, shift, data_ptr->pi_over_2);
|
||||
|
||||
/* Use split Estrin scheme for P(z^2) with deg(P)=19. */
|
||||
@@ -109,10 +108,10 @@ svfloat64_t SV_NAME_D2 (atan2) (svfloat64_t y, svfloat64_t x, const svbool_t pg)
|
||||
ret = svadd_m (pg, ret, shift);
|
||||
|
||||
/* Account for the sign of x and y. */
|
||||
- ret = svreinterpret_f64 (sveor_x (pg, svreinterpret_u64 (ret), sign_xy));
|
||||
-
|
||||
if (__glibc_unlikely (svptest_any (pg, cmp_xy)))
|
||||
- return special_case (y, x, ret, cmp_xy);
|
||||
-
|
||||
- return ret;
|
||||
+ return special_case (
|
||||
+ y, x,
|
||||
+ svreinterpret_f64 (sveor_x (pg, svreinterpret_u64 (ret), sign_xy)),
|
||||
+ cmp_xy);
|
||||
+ return svreinterpret_f64 (sveor_x (pg, svreinterpret_u64 (ret), sign_xy));
|
||||
}
|
||||
diff --git a/sysdeps/aarch64/fpu/atan2f_sve.c b/sysdeps/aarch64/fpu/atan2f_sve.c
|
||||
index b92f83cdea4fb2da..9ea197147ccca0ac 100644
|
||||
--- a/sysdeps/aarch64/fpu/atan2f_sve.c
|
||||
+++ b/sysdeps/aarch64/fpu/atan2f_sve.c
|
||||
@@ -32,10 +32,8 @@ static const struct data
|
||||
.pi_over_2 = 0x1.921fb6p+0f,
|
||||
};
|
||||
|
||||
-#define SignMask sv_u32 (0x80000000)
|
||||
-
|
||||
/* Special cases i.e. 0, infinity, nan (fall back to scalar calls). */
|
||||
-static inline svfloat32_t
|
||||
+static svfloat32_t NOINLINE
|
||||
special_case (svfloat32_t y, svfloat32_t x, svfloat32_t ret,
|
||||
const svbool_t cmp)
|
||||
{
|
||||
@@ -67,14 +65,15 @@ svfloat32_t SV_NAME_F2 (atan2) (svfloat32_t y, svfloat32_t x, const svbool_t pg)
|
||||
svbool_t cmp_y = zeroinfnan (iy, pg);
|
||||
svbool_t cmp_xy = svorr_z (pg, cmp_x, cmp_y);
|
||||
|
||||
- svuint32_t sign_x = svand_x (pg, ix, SignMask);
|
||||
- svuint32_t sign_y = svand_x (pg, iy, SignMask);
|
||||
- svuint32_t sign_xy = sveor_x (pg, sign_x, sign_y);
|
||||
-
|
||||
svfloat32_t ax = svabs_x (pg, x);
|
||||
svfloat32_t ay = svabs_x (pg, y);
|
||||
+ svuint32_t iax = svreinterpret_u32 (ax);
|
||||
+ svuint32_t iay = svreinterpret_u32 (ay);
|
||||
+
|
||||
+ svuint32_t sign_x = sveor_x (pg, ix, iax);
|
||||
+ svuint32_t sign_y = sveor_x (pg, iy, iay);
|
||||
+ svuint32_t sign_xy = sveor_x (pg, sign_x, sign_y);
|
||||
|
||||
- svbool_t pred_xlt0 = svcmplt (pg, x, 0.0);
|
||||
svbool_t pred_aygtax = svcmpgt (pg, ay, ax);
|
||||
|
||||
/* Set up z for call to atan. */
|
||||
@@ -83,11 +82,12 @@ svfloat32_t SV_NAME_F2 (atan2) (svfloat32_t y, svfloat32_t x, const svbool_t pg)
|
||||
svfloat32_t z = svdiv_x (pg, n, d);
|
||||
|
||||
/* Work out the correct shift. */
|
||||
- svfloat32_t shift = svsel (pred_xlt0, sv_f32 (-2.0), sv_f32 (0.0));
|
||||
- shift = svsel (pred_aygtax, svadd_x (pg, shift, 1.0), shift);
|
||||
+ svfloat32_t shift = svreinterpret_f32 (svlsr_x (pg, sign_x, 1));
|
||||
+ shift = svsel (pred_aygtax, sv_f32 (1.0), shift);
|
||||
+ shift = svreinterpret_f32 (svorr_x (pg, sign_x, svreinterpret_u32 (shift)));
|
||||
shift = svmul_x (pg, shift, sv_f32 (data_ptr->pi_over_2));
|
||||
|
||||
- /* Use split Estrin scheme for P(z^2) with deg(P)=7. */
|
||||
+ /* Use pure Estrin scheme for P(z^2) with deg(P)=7. */
|
||||
svfloat32_t z2 = svmul_x (pg, z, z);
|
||||
svfloat32_t z4 = svmul_x (pg, z2, z2);
|
||||
svfloat32_t z8 = svmul_x (pg, z4, z4);
|
||||
@@ -101,10 +101,12 @@ svfloat32_t SV_NAME_F2 (atan2) (svfloat32_t y, svfloat32_t x, const svbool_t pg)
|
||||
ret = svadd_m (pg, ret, shift);
|
||||
|
||||
/* Account for the sign of x and y. */
|
||||
- ret = svreinterpret_f32 (sveor_x (pg, svreinterpret_u32 (ret), sign_xy));
|
||||
|
||||
if (__glibc_unlikely (svptest_any (pg, cmp_xy)))
|
||||
- return special_case (y, x, ret, cmp_xy);
|
||||
+ return special_case (
|
||||
+ y, x,
|
||||
+ svreinterpret_f32 (sveor_x (pg, svreinterpret_u32 (ret), sign_xy)),
|
||||
+ cmp_xy);
|
||||
|
||||
- return ret;
|
||||
+ return svreinterpret_f32 (sveor_x (pg, svreinterpret_u32 (ret), sign_xy));
|
||||
}
|
||||
diff --git a/sysdeps/aarch64/fpu/cos_advsimd.c b/sysdeps/aarch64/fpu/cos_advsimd.c
|
||||
index 2897e8b909bbcb66..3924c9ce44c30d4d 100644
|
||||
--- a/sysdeps/aarch64/fpu/cos_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/cos_advsimd.c
|
||||
@@ -63,8 +63,7 @@ float64x2_t VPCS_ATTR V_NAME_D1 (cos) (float64x2_t x)
|
||||
special-case handler later. */
|
||||
r = vbslq_f64 (cmp, v_f64 (1.0), r);
|
||||
#else
|
||||
- cmp = vcageq_f64 (d->range_val, x);
|
||||
- cmp = vceqzq_u64 (cmp); /* cmp = ~cmp. */
|
||||
+ cmp = vcageq_f64 (x, d->range_val);
|
||||
r = x;
|
||||
#endif
|
||||
|
||||
diff --git a/sysdeps/aarch64/fpu/cosf_advsimd.c b/sysdeps/aarch64/fpu/cosf_advsimd.c
|
||||
index 60abc8dfcfff9ed4..d0c285b03a8bfe22 100644
|
||||
--- a/sysdeps/aarch64/fpu/cosf_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/cosf_advsimd.c
|
||||
@@ -64,8 +64,7 @@ float32x4_t VPCS_ATTR NOINLINE V_NAME_F1 (cos) (float32x4_t x)
|
||||
special-case handler later. */
|
||||
r = vbslq_f32 (cmp, v_f32 (1.0f), r);
|
||||
#else
|
||||
- cmp = vcageq_f32 (d->range_val, x);
|
||||
- cmp = vceqzq_u32 (cmp); /* cmp = ~cmp. */
|
||||
+ cmp = vcageq_f32 (x, d->range_val);
|
||||
r = x;
|
||||
#endif
|
||||
|
||||
diff --git a/sysdeps/aarch64/fpu/exp10_advsimd.c b/sysdeps/aarch64/fpu/exp10_advsimd.c
|
||||
index fe7149b19176da21..eeb31ca839c1f671 100644
|
||||
--- a/sysdeps/aarch64/fpu/exp10_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/exp10_advsimd.c
|
||||
@@ -57,7 +57,7 @@ const static struct data
|
||||
# define BigBound v_u64 (0x4070000000000000) /* asuint64 (0x1p8). */
|
||||
# define Thres v_u64 (0x2070000000000000) /* BigBound - TinyBound. */
|
||||
|
||||
-static inline float64x2_t VPCS_ATTR
|
||||
+static float64x2_t VPCS_ATTR NOINLINE
|
||||
special_case (float64x2_t x, float64x2_t y, uint64x2_t cmp)
|
||||
{
|
||||
/* If fenv exceptions are to be triggered correctly, fall back to the scalar
|
||||
@@ -72,7 +72,7 @@ special_case (float64x2_t x, float64x2_t y, uint64x2_t cmp)
|
||||
# define SpecialBias1 v_u64 (0x7000000000000000) /* 0x1p769. */
|
||||
# define SpecialBias2 v_u64 (0x3010000000000000) /* 0x1p-254. */
|
||||
|
||||
-static float64x2_t VPCS_ATTR NOINLINE
|
||||
+static inline float64x2_t VPCS_ATTR
|
||||
special_case (float64x2_t s, float64x2_t y, float64x2_t n,
|
||||
const struct data *d)
|
||||
{
|
||||
diff --git a/sysdeps/aarch64/fpu/exp10f_advsimd.c b/sysdeps/aarch64/fpu/exp10f_advsimd.c
|
||||
index 7ee0c909487c32b7..ab117b69da23e5f3 100644
|
||||
--- a/sysdeps/aarch64/fpu/exp10f_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/exp10f_advsimd.c
|
||||
@@ -25,7 +25,8 @@
|
||||
static const struct data
|
||||
{
|
||||
float32x4_t poly[5];
|
||||
- float32x4_t shift, log10_2, log2_10_hi, log2_10_lo;
|
||||
+ float32x4_t log10_2_and_inv, shift;
|
||||
+
|
||||
#if !WANT_SIMD_EXCEPT
|
||||
float32x4_t scale_thresh;
|
||||
#endif
|
||||
@@ -38,9 +39,9 @@ static const struct data
|
||||
.poly = { V4 (0x1.26bb16p+1f), V4 (0x1.5350d2p+1f), V4 (0x1.04744ap+1f),
|
||||
V4 (0x1.2d8176p+0f), V4 (0x1.12b41ap-1f) },
|
||||
.shift = V4 (0x1.8p23f),
|
||||
- .log10_2 = V4 (0x1.a934fp+1),
|
||||
- .log2_10_hi = V4 (0x1.344136p-2),
|
||||
- .log2_10_lo = V4 (-0x1.ec10cp-27),
|
||||
+
|
||||
+ /* Stores constants 1/log10(2), log10(2)_high, log10(2)_low, 0. */
|
||||
+ .log10_2_and_inv = { 0x1.a934fp+1, 0x1.344136p-2, -0x1.ec10cp-27, 0 },
|
||||
#if !WANT_SIMD_EXCEPT
|
||||
.scale_thresh = V4 (ScaleBound)
|
||||
#endif
|
||||
@@ -98,24 +99,22 @@ float32x4_t VPCS_ATTR NOINLINE V_NAME_F1 (exp10) (float32x4_t x)
|
||||
#if WANT_SIMD_EXCEPT
|
||||
/* asuint(x) - TinyBound >= BigBound - TinyBound. */
|
||||
uint32x4_t cmp = vcgeq_u32 (
|
||||
- vsubq_u32 (vandq_u32 (vreinterpretq_u32_f32 (x), v_u32 (0x7fffffff)),
|
||||
- TinyBound),
|
||||
- Thres);
|
||||
+ vsubq_u32 (vreinterpretq_u32_f32 (vabsq_f32 (x)), TinyBound), Thres);
|
||||
float32x4_t xm = x;
|
||||
/* If any lanes are special, mask them with 1 and retain a copy of x to allow
|
||||
special case handler to fix special lanes later. This is only necessary if
|
||||
fenv exceptions are to be triggered correctly. */
|
||||
if (__glibc_unlikely (v_any_u32 (cmp)))
|
||||
- x = vbslq_f32 (cmp, v_f32 (1), x);
|
||||
+ x = v_zerofy_f32 (x, cmp);
|
||||
#endif
|
||||
|
||||
/* exp10(x) = 2^n * 10^r = 2^n * (1 + poly (r)),
|
||||
with poly(r) in [1/sqrt(2), sqrt(2)] and
|
||||
x = r + n * log10 (2), with r in [-log10(2)/2, log10(2)/2]. */
|
||||
- float32x4_t z = vfmaq_f32 (d->shift, x, d->log10_2);
|
||||
+ float32x4_t z = vfmaq_laneq_f32 (d->shift, x, d->log10_2_and_inv, 0);
|
||||
float32x4_t n = vsubq_f32 (z, d->shift);
|
||||
- float32x4_t r = vfmsq_f32 (x, n, d->log2_10_hi);
|
||||
- r = vfmsq_f32 (r, n, d->log2_10_lo);
|
||||
+ float32x4_t r = vfmsq_laneq_f32 (x, n, d->log10_2_and_inv, 1);
|
||||
+ r = vfmsq_laneq_f32 (r, n, d->log10_2_and_inv, 2);
|
||||
uint32x4_t e = vshlq_n_u32 (vreinterpretq_u32_f32 (z), 23);
|
||||
|
||||
float32x4_t scale = vreinterpretq_f32_u32 (vaddq_u32 (e, ExponentBias));
|
||||
diff --git a/sysdeps/aarch64/fpu/exp2_advsimd.c b/sysdeps/aarch64/fpu/exp2_advsimd.c
|
||||
index 391a93180c93427d..ae1e63d5030633d5 100644
|
||||
--- a/sysdeps/aarch64/fpu/exp2_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/exp2_advsimd.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#define IndexMask (N - 1)
|
||||
#define BigBound 1022.0
|
||||
#define UOFlowBound 1280.0
|
||||
+#define TinyBound 0x2000000000000000 /* asuint64(0x1p-511). */
|
||||
|
||||
static const struct data
|
||||
{
|
||||
@@ -48,14 +49,13 @@ lookup_sbits (uint64x2_t i)
|
||||
|
||||
#if WANT_SIMD_EXCEPT
|
||||
|
||||
-# define TinyBound 0x2000000000000000 /* asuint64(0x1p-511). */
|
||||
# define Thres 0x2080000000000000 /* asuint64(512.0) - TinyBound. */
|
||||
|
||||
/* Call scalar exp2 as a fallback. */
|
||||
static float64x2_t VPCS_ATTR NOINLINE
|
||||
-special_case (float64x2_t x)
|
||||
+special_case (float64x2_t x, float64x2_t y, uint64x2_t is_special)
|
||||
{
|
||||
- return v_call_f64 (exp2, x, x, v_u64 (0xffffffffffffffff));
|
||||
+ return v_call_f64 (exp2, x, y, is_special);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -65,7 +65,7 @@ special_case (float64x2_t x)
|
||||
# define SpecialBias1 0x7000000000000000 /* 0x1p769. */
|
||||
# define SpecialBias2 0x3010000000000000 /* 0x1p-254. */
|
||||
|
||||
-static float64x2_t VPCS_ATTR
|
||||
+static inline float64x2_t VPCS_ATTR
|
||||
special_case (float64x2_t s, float64x2_t y, float64x2_t n,
|
||||
const struct data *d)
|
||||
{
|
||||
@@ -94,10 +94,10 @@ float64x2_t V_NAME_D1 (exp2) (float64x2_t x)
|
||||
#if WANT_SIMD_EXCEPT
|
||||
uint64x2_t ia = vreinterpretq_u64_f64 (vabsq_f64 (x));
|
||||
cmp = vcgeq_u64 (vsubq_u64 (ia, v_u64 (TinyBound)), v_u64 (Thres));
|
||||
- /* If any special case (inf, nan, small and large x) is detected,
|
||||
- fall back to scalar for all lanes. */
|
||||
- if (__glibc_unlikely (v_any_u64 (cmp)))
|
||||
- return special_case (x);
|
||||
+ /* Mask special lanes and retain a copy of x for passing to special-case
|
||||
+ handler. */
|
||||
+ float64x2_t xc = x;
|
||||
+ x = v_zerofy_f64 (x, cmp);
|
||||
#else
|
||||
cmp = vcagtq_f64 (x, d->scale_big_bound);
|
||||
#endif
|
||||
@@ -120,9 +120,11 @@ float64x2_t V_NAME_D1 (exp2) (float64x2_t x)
|
||||
float64x2_t y = v_pairwise_poly_3_f64 (r, r2, d->poly);
|
||||
y = vmulq_f64 (r, y);
|
||||
|
||||
-#if !WANT_SIMD_EXCEPT
|
||||
if (__glibc_unlikely (v_any_u64 (cmp)))
|
||||
+#if !WANT_SIMD_EXCEPT
|
||||
return special_case (s, y, n, d);
|
||||
+#else
|
||||
+ return special_case (xc, vfmaq_f64 (s, s, y), cmp);
|
||||
#endif
|
||||
return vfmaq_f64 (s, s, y);
|
||||
}
|
||||
diff --git a/sysdeps/aarch64/fpu/exp2f_sve.c b/sysdeps/aarch64/fpu/exp2f_sve.c
|
||||
index 9a5a523a10280d1d..8a686e3e054cb7f5 100644
|
||||
--- a/sysdeps/aarch64/fpu/exp2f_sve.c
|
||||
+++ b/sysdeps/aarch64/fpu/exp2f_sve.c
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "sv_math.h"
|
||||
#include "poly_sve_f32.h"
|
||||
|
||||
+#define Thres 0x1.5d5e2ap+6f
|
||||
+
|
||||
static const struct data
|
||||
{
|
||||
float poly[5];
|
||||
@@ -33,7 +35,7 @@ static const struct data
|
||||
.shift = 0x1.903f8p17f,
|
||||
/* Roughly 87.3. For x < -Thres, the result is subnormal and not handled
|
||||
correctly by FEXPA. */
|
||||
- .thres = 0x1.5d5e2ap+6f,
|
||||
+ .thres = Thres,
|
||||
};
|
||||
|
||||
static svfloat32_t NOINLINE
|
||||
diff --git a/sysdeps/aarch64/fpu/exp_advsimd.c b/sysdeps/aarch64/fpu/exp_advsimd.c
|
||||
index fd215f1d2c5e9eea..5e3a9a0d44a43656 100644
|
||||
--- a/sysdeps/aarch64/fpu/exp_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/exp_advsimd.c
|
||||
@@ -54,7 +54,7 @@ const static volatile struct
|
||||
# define BigBound v_u64 (0x4080000000000000) /* asuint64 (0x1p9). */
|
||||
# define SpecialBound v_u64 (0x2080000000000000) /* BigBound - TinyBound. */
|
||||
|
||||
-static inline float64x2_t VPCS_ATTR
|
||||
+static float64x2_t VPCS_ATTR NOINLINE
|
||||
special_case (float64x2_t x, float64x2_t y, uint64x2_t cmp)
|
||||
{
|
||||
/* If fenv exceptions are to be triggered correctly, fall back to the scalar
|
||||
@@ -69,7 +69,7 @@ special_case (float64x2_t x, float64x2_t y, uint64x2_t cmp)
|
||||
# define SpecialBias1 v_u64 (0x7000000000000000) /* 0x1p769. */
|
||||
# define SpecialBias2 v_u64 (0x3010000000000000) /* 0x1p-254. */
|
||||
|
||||
-static float64x2_t VPCS_ATTR NOINLINE
|
||||
+static inline float64x2_t VPCS_ATTR
|
||||
special_case (float64x2_t s, float64x2_t y, float64x2_t n)
|
||||
{
|
||||
/* 2^(n/N) may overflow, break it up into s1*s2. */
|
||||
diff --git a/sysdeps/aarch64/fpu/expm1_advsimd.c b/sysdeps/aarch64/fpu/expm1_advsimd.c
|
||||
index 0b85bd06f3c10068..3628398674468131 100644
|
||||
--- a/sysdeps/aarch64/fpu/expm1_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/expm1_advsimd.c
|
||||
@@ -23,7 +23,7 @@
|
||||
static const struct data
|
||||
{
|
||||
float64x2_t poly[11];
|
||||
- float64x2_t invln2, ln2_lo, ln2_hi, shift;
|
||||
+ float64x2_t invln2, ln2, shift;
|
||||
int64x2_t exponent_bias;
|
||||
#if WANT_SIMD_EXCEPT
|
||||
uint64x2_t thresh, tiny_bound;
|
||||
@@ -38,8 +38,7 @@ static const struct data
|
||||
V2 (0x1.71ddf82db5bb4p-19), V2 (0x1.27e517fc0d54bp-22),
|
||||
V2 (0x1.af5eedae67435p-26), V2 (0x1.1f143d060a28ap-29) },
|
||||
.invln2 = V2 (0x1.71547652b82fep0),
|
||||
- .ln2_hi = V2 (0x1.62e42fefa39efp-1),
|
||||
- .ln2_lo = V2 (0x1.abc9e3b39803fp-56),
|
||||
+ .ln2 = { 0x1.62e42fefa39efp-1, 0x1.abc9e3b39803fp-56 },
|
||||
.shift = V2 (0x1.8p52),
|
||||
.exponent_bias = V2 (0x3ff0000000000000),
|
||||
#if WANT_SIMD_EXCEPT
|
||||
@@ -83,7 +82,7 @@ float64x2_t VPCS_ATTR V_NAME_D1 (expm1) (float64x2_t x)
|
||||
x = v_zerofy_f64 (x, special);
|
||||
#else
|
||||
/* Large input, NaNs and Infs. */
|
||||
- uint64x2_t special = vceqzq_u64 (vcaltq_f64 (x, d->oflow_bound));
|
||||
+ uint64x2_t special = vcageq_f64 (x, d->oflow_bound);
|
||||
#endif
|
||||
|
||||
/* Reduce argument to smaller range:
|
||||
@@ -93,8 +92,8 @@ float64x2_t VPCS_ATTR V_NAME_D1 (expm1) (float64x2_t x)
|
||||
where 2^i is exact because i is an integer. */
|
||||
float64x2_t n = vsubq_f64 (vfmaq_f64 (d->shift, d->invln2, x), d->shift);
|
||||
int64x2_t i = vcvtq_s64_f64 (n);
|
||||
- float64x2_t f = vfmsq_f64 (x, n, d->ln2_hi);
|
||||
- f = vfmsq_f64 (f, n, d->ln2_lo);
|
||||
+ float64x2_t f = vfmsq_laneq_f64 (x, n, d->ln2, 0);
|
||||
+ f = vfmsq_laneq_f64 (f, n, d->ln2, 1);
|
||||
|
||||
/* Approximate expm1(f) using polynomial.
|
||||
Taylor expansion for expm1(x) has the form:
|
||||
diff --git a/sysdeps/aarch64/fpu/expm1f_advsimd.c b/sysdeps/aarch64/fpu/expm1f_advsimd.c
|
||||
index 8d4c9a21936d31dd..93db200f618379be 100644
|
||||
--- a/sysdeps/aarch64/fpu/expm1f_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/expm1f_advsimd.c
|
||||
@@ -23,7 +23,8 @@
|
||||
static const struct data
|
||||
{
|
||||
float32x4_t poly[5];
|
||||
- float32x4_t invln2, ln2_lo, ln2_hi, shift;
|
||||
+ float32x4_t invln2_and_ln2;
|
||||
+ float32x4_t shift;
|
||||
int32x4_t exponent_bias;
|
||||
#if WANT_SIMD_EXCEPT
|
||||
uint32x4_t thresh;
|
||||
@@ -34,9 +35,8 @@ static const struct data
|
||||
/* Generated using fpminimax with degree=5 in [-log(2)/2, log(2)/2]. */
|
||||
.poly = { V4 (0x1.fffffep-2), V4 (0x1.5554aep-3), V4 (0x1.555736p-5),
|
||||
V4 (0x1.12287cp-7), V4 (0x1.6b55a2p-10) },
|
||||
- .invln2 = V4 (0x1.715476p+0f),
|
||||
- .ln2_hi = V4 (0x1.62e4p-1f),
|
||||
- .ln2_lo = V4 (0x1.7f7d1cp-20f),
|
||||
+ /* Stores constants: invln2, ln2_hi, ln2_lo, 0. */
|
||||
+ .invln2_and_ln2 = { 0x1.715476p+0f, 0x1.62e4p-1f, 0x1.7f7d1cp-20f, 0 },
|
||||
.shift = V4 (0x1.8p23f),
|
||||
.exponent_bias = V4 (0x3f800000),
|
||||
#if !WANT_SIMD_EXCEPT
|
||||
@@ -80,7 +80,7 @@ float32x4_t VPCS_ATTR NOINLINE V_NAME_F1 (expm1) (float32x4_t x)
|
||||
x = v_zerofy_f32 (x, special);
|
||||
#else
|
||||
/* Handles very large values (+ve and -ve), +/-NaN, +/-Inf. */
|
||||
- uint32x4_t special = vceqzq_u32 (vcaltq_f32 (x, d->oflow_bound));
|
||||
+ uint32x4_t special = vcagtq_f32 (x, d->oflow_bound);
|
||||
#endif
|
||||
|
||||
/* Reduce argument to smaller range:
|
||||
@@ -88,10 +88,11 @@ float32x4_t VPCS_ATTR NOINLINE V_NAME_F1 (expm1) (float32x4_t x)
|
||||
and f = x - i * ln2, then f is in [-ln2/2, ln2/2].
|
||||
exp(x) - 1 = 2^i * (expm1(f) + 1) - 1
|
||||
where 2^i is exact because i is an integer. */
|
||||
- float32x4_t j = vsubq_f32 (vfmaq_f32 (d->shift, d->invln2, x), d->shift);
|
||||
+ float32x4_t j = vsubq_f32 (
|
||||
+ vfmaq_laneq_f32 (d->shift, x, d->invln2_and_ln2, 0), d->shift);
|
||||
int32x4_t i = vcvtq_s32_f32 (j);
|
||||
- float32x4_t f = vfmsq_f32 (x, j, d->ln2_hi);
|
||||
- f = vfmsq_f32 (f, j, d->ln2_lo);
|
||||
+ float32x4_t f = vfmsq_laneq_f32 (x, j, d->invln2_and_ln2, 1);
|
||||
+ f = vfmsq_laneq_f32 (f, j, d->invln2_and_ln2, 2);
|
||||
|
||||
/* Approximate expm1(f) using polynomial.
|
||||
Taylor expansion for expm1(x) has the form:
|
||||
diff --git a/sysdeps/aarch64/fpu/log_advsimd.c b/sysdeps/aarch64/fpu/log_advsimd.c
|
||||
index 067ae7961300c66b..21df61728ca87374 100644
|
||||
--- a/sysdeps/aarch64/fpu/log_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/log_advsimd.c
|
||||
@@ -58,8 +58,13 @@ lookup (uint64x2_t i)
|
||||
uint64_t i1 = (i[1] >> (52 - V_LOG_TABLE_BITS)) & IndexMask;
|
||||
float64x2_t e0 = vld1q_f64 (&__v_log_data.table[i0].invc);
|
||||
float64x2_t e1 = vld1q_f64 (&__v_log_data.table[i1].invc);
|
||||
+#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
e.invc = vuzp1q_f64 (e0, e1);
|
||||
e.logc = vuzp2q_f64 (e0, e1);
|
||||
+#else
|
||||
+ e.invc = vuzp1q_f64 (e1, e0);
|
||||
+ e.logc = vuzp2q_f64 (e1, e0);
|
||||
+#endif
|
||||
return e;
|
||||
}
|
||||
|
||||
diff --git a/sysdeps/aarch64/fpu/sin_advsimd.c b/sysdeps/aarch64/fpu/sin_advsimd.c
|
||||
index efce183e86e319f1..a0d9d3b81965db76 100644
|
||||
--- a/sysdeps/aarch64/fpu/sin_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/sin_advsimd.c
|
||||
@@ -75,8 +75,7 @@ float64x2_t VPCS_ATTR V_NAME_D1 (sin) (float64x2_t x)
|
||||
r = vbslq_f64 (cmp, vreinterpretq_f64_u64 (cmp), x);
|
||||
#else
|
||||
r = x;
|
||||
- cmp = vcageq_f64 (d->range_val, x);
|
||||
- cmp = vceqzq_u64 (cmp); /* cmp = ~cmp. */
|
||||
+ cmp = vcageq_f64 (x, d->range_val);
|
||||
#endif
|
||||
|
||||
/* n = rint(|x|/pi). */
|
||||
diff --git a/sysdeps/aarch64/fpu/sinf_advsimd.c b/sysdeps/aarch64/fpu/sinf_advsimd.c
|
||||
index 60cf3f2ca102619c..375dfc3331fa6a9c 100644
|
||||
--- a/sysdeps/aarch64/fpu/sinf_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/sinf_advsimd.c
|
||||
@@ -67,8 +67,7 @@ float32x4_t VPCS_ATTR NOINLINE V_NAME_F1 (sin) (float32x4_t x)
|
||||
r = vbslq_f32 (cmp, vreinterpretq_f32_u32 (cmp), x);
|
||||
#else
|
||||
r = x;
|
||||
- cmp = vcageq_f32 (d->range_val, x);
|
||||
- cmp = vceqzq_u32 (cmp); /* cmp = ~cmp. */
|
||||
+ cmp = vcageq_f32 (x, d->range_val);
|
||||
#endif
|
||||
|
||||
/* n = rint(|x|/pi) */
|
||||
diff --git a/sysdeps/aarch64/fpu/tan_advsimd.c b/sysdeps/aarch64/fpu/tan_advsimd.c
|
||||
index d7e5ba7b1ab941e8..0459821ab25487a8 100644
|
||||
--- a/sysdeps/aarch64/fpu/tan_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/tan_advsimd.c
|
||||
@@ -23,7 +23,7 @@
|
||||
static const struct data
|
||||
{
|
||||
float64x2_t poly[9];
|
||||
- float64x2_t half_pi_hi, half_pi_lo, two_over_pi, shift;
|
||||
+ float64x2_t half_pi, two_over_pi, shift;
|
||||
#if !WANT_SIMD_EXCEPT
|
||||
float64x2_t range_val;
|
||||
#endif
|
||||
@@ -34,8 +34,7 @@ static const struct data
|
||||
V2 (0x1.226e5e5ecdfa3p-7), V2 (0x1.d6c7ddbf87047p-9),
|
||||
V2 (0x1.7ea75d05b583ep-10), V2 (0x1.289f22964a03cp-11),
|
||||
V2 (0x1.4e4fd14147622p-12) },
|
||||
- .half_pi_hi = V2 (0x1.921fb54442d18p0),
|
||||
- .half_pi_lo = V2 (0x1.1a62633145c07p-54),
|
||||
+ .half_pi = { 0x1.921fb54442d18p0, 0x1.1a62633145c07p-54 },
|
||||
.two_over_pi = V2 (0x1.45f306dc9c883p-1),
|
||||
.shift = V2 (0x1.8p52),
|
||||
#if !WANT_SIMD_EXCEPT
|
||||
@@ -56,15 +55,15 @@ special_case (float64x2_t x)
|
||||
|
||||
/* Vector approximation for double-precision tan.
|
||||
Maximum measured error is 3.48 ULP:
|
||||
- __v_tan(0x1.4457047ef78d8p+20) got -0x1.f6ccd8ecf7dedp+37
|
||||
- want -0x1.f6ccd8ecf7deap+37. */
|
||||
+ _ZGVnN2v_tan(0x1.4457047ef78d8p+20) got -0x1.f6ccd8ecf7dedp+37
|
||||
+ want -0x1.f6ccd8ecf7deap+37. */
|
||||
float64x2_t VPCS_ATTR V_NAME_D1 (tan) (float64x2_t x)
|
||||
{
|
||||
const struct data *dat = ptr_barrier (&data);
|
||||
- /* Our argument reduction cannot calculate q with sufficient accuracy for very
|
||||
- large inputs. Fall back to scalar routine for all lanes if any are too
|
||||
- large, or Inf/NaN. If fenv exceptions are expected, also fall back for tiny
|
||||
- input to avoid underflow. */
|
||||
+ /* Our argument reduction cannot calculate q with sufficient accuracy for
|
||||
+ very large inputs. Fall back to scalar routine for all lanes if any are
|
||||
+ too large, or Inf/NaN. If fenv exceptions are expected, also fall back for
|
||||
+ tiny input to avoid underflow. */
|
||||
#if WANT_SIMD_EXCEPT
|
||||
uint64x2_t iax = vreinterpretq_u64_f64 (vabsq_f64 (x));
|
||||
/* iax - tiny_bound > range_val - tiny_bound. */
|
||||
@@ -82,8 +81,8 @@ float64x2_t VPCS_ATTR V_NAME_D1 (tan) (float64x2_t x)
|
||||
/* Use q to reduce x to r in [-pi/4, pi/4], by:
|
||||
r = x - q * pi/2, in extended precision. */
|
||||
float64x2_t r = x;
|
||||
- r = vfmsq_f64 (r, q, dat->half_pi_hi);
|
||||
- r = vfmsq_f64 (r, q, dat->half_pi_lo);
|
||||
+ r = vfmsq_laneq_f64 (r, q, dat->half_pi, 0);
|
||||
+ r = vfmsq_laneq_f64 (r, q, dat->half_pi, 1);
|
||||
/* Further reduce r to [-pi/8, pi/8], to be reconstructed using double angle
|
||||
formula. */
|
||||
r = vmulq_n_f64 (r, 0.5);
|
||||
@@ -106,14 +105,15 @@ float64x2_t VPCS_ATTR V_NAME_D1 (tan) (float64x2_t x)
|
||||
and reciprocity around pi/2:
|
||||
tan(x) = 1 / (tan(pi/2 - x))
|
||||
to assemble result using change-of-sign and conditional selection of
|
||||
- numerator/denominator, dependent on odd/even-ness of q (hence quadrant). */
|
||||
+ numerator/denominator, dependent on odd/even-ness of q (hence quadrant).
|
||||
+ */
|
||||
float64x2_t n = vfmaq_f64 (v_f64 (-1), p, p);
|
||||
float64x2_t d = vaddq_f64 (p, p);
|
||||
|
||||
uint64x2_t no_recip = vtstq_u64 (vreinterpretq_u64_s64 (qi), v_u64 (1));
|
||||
|
||||
#if !WANT_SIMD_EXCEPT
|
||||
- uint64x2_t special = vceqzq_u64 (vcaleq_f64 (x, dat->range_val));
|
||||
+ uint64x2_t special = vcageq_f64 (x, dat->range_val);
|
||||
if (__glibc_unlikely (v_any_u64 (special)))
|
||||
return special_case (x);
|
||||
#endif
|
||||
diff --git a/sysdeps/aarch64/fpu/tanf_advsimd.c b/sysdeps/aarch64/fpu/tanf_advsimd.c
|
||||
index 1f16103f8a7668f8..5a7489390a9692c6 100644
|
||||
--- a/sysdeps/aarch64/fpu/tanf_advsimd.c
|
||||
+++ b/sysdeps/aarch64/fpu/tanf_advsimd.c
|
||||
@@ -23,7 +23,8 @@
|
||||
static const struct data
|
||||
{
|
||||
float32x4_t poly[6];
|
||||
- float32x4_t neg_half_pi_1, neg_half_pi_2, neg_half_pi_3, two_over_pi, shift;
|
||||
+ float32x4_t pi_consts;
|
||||
+ float32x4_t shift;
|
||||
#if !WANT_SIMD_EXCEPT
|
||||
float32x4_t range_val;
|
||||
#endif
|
||||
@@ -31,10 +32,9 @@ static const struct data
|
||||
/* Coefficients generated using FPMinimax. */
|
||||
.poly = { V4 (0x1.55555p-2f), V4 (0x1.11166p-3f), V4 (0x1.b88a78p-5f),
|
||||
V4 (0x1.7b5756p-6f), V4 (0x1.4ef4cep-8f), V4 (0x1.0e1e74p-7f) },
|
||||
- .neg_half_pi_1 = V4 (-0x1.921fb6p+0f),
|
||||
- .neg_half_pi_2 = V4 (0x1.777a5cp-25f),
|
||||
- .neg_half_pi_3 = V4 (0x1.ee59dap-50f),
|
||||
- .two_over_pi = V4 (0x1.45f306p-1f),
|
||||
+ /* Stores constants: (-pi/2)_high, (-pi/2)_mid, (-pi/2)_low, and 2/pi. */
|
||||
+ .pi_consts
|
||||
+ = { -0x1.921fb6p+0f, 0x1.777a5cp-25f, 0x1.ee59dap-50f, 0x1.45f306p-1f },
|
||||
.shift = V4 (0x1.8p+23f),
|
||||
#if !WANT_SIMD_EXCEPT
|
||||
.range_val = V4 (0x1p15f),
|
||||
@@ -58,10 +58,11 @@ eval_poly (float32x4_t z, const struct data *d)
|
||||
{
|
||||
float32x4_t z2 = vmulq_f32 (z, z);
|
||||
#if WANT_SIMD_EXCEPT
|
||||
- /* Tiny z (<= 0x1p-31) will underflow when calculating z^4. If fp exceptions
|
||||
- are to be triggered correctly, sidestep this by fixing such lanes to 0. */
|
||||
+ /* Tiny z (<= 0x1p-31) will underflow when calculating z^4.
|
||||
+ If fp exceptions are to be triggered correctly,
|
||||
+ sidestep this by fixing such lanes to 0. */
|
||||
uint32x4_t will_uflow
|
||||
- = vcleq_u32 (vreinterpretq_u32_f32 (vabsq_f32 (z)), TinyBound);
|
||||
+ = vcleq_u32 (vreinterpretq_u32_f32 (vabsq_f32 (z)), TinyBound);
|
||||
if (__glibc_unlikely (v_any_u32 (will_uflow)))
|
||||
z2 = vbslq_f32 (will_uflow, v_f32 (0), z2);
|
||||
#endif
|
||||
@@ -94,16 +95,16 @@ float32x4_t VPCS_ATTR NOINLINE V_NAME_F1 (tan) (float32x4_t x)
|
||||
#endif
|
||||
|
||||
/* n = rint(x/(pi/2)). */
|
||||
- float32x4_t q = vfmaq_f32 (d->shift, d->two_over_pi, x);
|
||||
+ float32x4_t q = vfmaq_laneq_f32 (d->shift, x, d->pi_consts, 3);
|
||||
float32x4_t n = vsubq_f32 (q, d->shift);
|
||||
/* Determine if x lives in an interval, where |tan(x)| grows to infinity. */
|
||||
uint32x4_t pred_alt = vtstq_u32 (vreinterpretq_u32_f32 (q), v_u32 (1));
|
||||
|
||||
/* r = x - n * (pi/2) (range reduction into -pi./4 .. pi/4). */
|
||||
float32x4_t r;
|
||||
- r = vfmaq_f32 (x, d->neg_half_pi_1, n);
|
||||
- r = vfmaq_f32 (r, d->neg_half_pi_2, n);
|
||||
- r = vfmaq_f32 (r, d->neg_half_pi_3, n);
|
||||
+ r = vfmaq_laneq_f32 (x, n, d->pi_consts, 0);
|
||||
+ r = vfmaq_laneq_f32 (r, n, d->pi_consts, 1);
|
||||
+ r = vfmaq_laneq_f32 (r, n, d->pi_consts, 2);
|
||||
|
||||
/* If x lives in an interval, where |tan(x)|
|
||||
- is finite, then use a polynomial approximation of the form
|
@ -0,0 +1,54 @@
|
||||
commit 395a89f61e19fa916ae4cc93fc10d81a28ce3039
|
||||
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
|
||||
Date: Wed Mar 13 14:34:14 2024 +0000
|
||||
|
||||
aarch64: fix check for SVE support in assembler
|
||||
|
||||
Due to GCC bug 110901 -mcpu can override -march setting when compiling
|
||||
asm code and thus a compiler targetting a specific cpu can fail the
|
||||
configure check even when binutils gas supports SVE.
|
||||
|
||||
The workaround is that explicit .arch directive overrides both -mcpu
|
||||
and -march, and since that's what the actual SVE memcpy uses the
|
||||
configure check should use that too even if the GCC issue is fixed
|
||||
independently.
|
||||
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
(cherry picked from commit 73c26018ed0ecd9c807bb363cc2c2ab4aca66a82)
|
||||
|
||||
diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
index ca57edce472e4507..9606137e8ddae545
|
||||
--- a/sysdeps/aarch64/configure
|
||||
+++ b/sysdeps/aarch64/configure
|
||||
@@ -325,9 +325,10 @@ then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
cat > conftest.s <<\EOF
|
||||
- ptrue p0.b
|
||||
+ .arch armv8.2-a+sve
|
||||
+ ptrue p0.b
|
||||
EOF
|
||||
-if { ac_try='${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&5'
|
||||
+if { ac_try='${CC-cc} -c conftest.s 1>&5'
|
||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
|
||||
index 27874eceb44911e4..56d12d661d726892 100644
|
||||
--- a/sysdeps/aarch64/configure.ac
|
||||
+++ b/sysdeps/aarch64/configure.ac
|
||||
@@ -90,9 +90,10 @@ LIBC_CONFIG_VAR([aarch64-variant-pcs], [$libc_cv_aarch64_variant_pcs])
|
||||
# Check if asm support armv8.2-a+sve
|
||||
AC_CACHE_CHECK([for SVE support in assembler], [libc_cv_aarch64_sve_asm], [dnl
|
||||
cat > conftest.s <<\EOF
|
||||
- ptrue p0.b
|
||||
+ .arch armv8.2-a+sve
|
||||
+ ptrue p0.b
|
||||
EOF
|
||||
-if AC_TRY_COMMAND(${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then
|
||||
+if AC_TRY_COMMAND(${CC-cc} -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
|
||||
libc_cv_aarch64_sve_asm=yes
|
||||
else
|
||||
libc_cv_aarch64_sve_asm=no
|
@ -0,0 +1,144 @@
|
||||
commit 9d92452c70805a2e2dbbdb2b1ffc34bd86e1c8df
|
||||
Author: Wilco Dijkstra <wilco.dijkstra@arm.com>
|
||||
Date: Thu Mar 21 16:48:33 2024 +0000
|
||||
|
||||
AArch64: Check kernel version for SVE ifuncs
|
||||
|
||||
Old Linux kernels disable SVE after every system call. Calling the
|
||||
SVE-optimized memcpy afterwards will then cause a trap to reenable SVE.
|
||||
As a result, applications with a high use of syscalls may run slower with
|
||||
the SVE memcpy. This is true for kernels between 4.15.0 and before 6.2.0,
|
||||
except for 5.14.0 which was patched. Avoid this by checking the kernel
|
||||
version and selecting the SVE ifunc on modern kernels.
|
||||
|
||||
Parse the kernel version reported by uname() into a 24-bit kernel.major.minor
|
||||
value without calling any library functions. If uname() is not supported or
|
||||
if the version format is not recognized, assume the kernel is modern.
|
||||
|
||||
Tested-by: Florian Weimer <fweimer@redhat.com>
|
||||
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
|
||||
(cherry picked from commit 2e94e2f5d2bf2de124c8ad7da85463355e54ccb2)
|
||||
|
||||
diff --git a/sysdeps/aarch64/cpu-features.h b/sysdeps/aarch64/cpu-features.h
|
||||
index 77a782422af1b6e4..5f2da91ebbd0adaf 100644
|
||||
--- a/sysdeps/aarch64/cpu-features.h
|
||||
+++ b/sysdeps/aarch64/cpu-features.h
|
||||
@@ -71,6 +71,7 @@ struct cpu_features
|
||||
/* Currently, the GLIBC memory tagging tunable only defines 8 bits. */
|
||||
uint8_t mte_state;
|
||||
bool sve;
|
||||
+ bool prefer_sve_ifuncs;
|
||||
bool mops;
|
||||
};
|
||||
|
||||
diff --git a/sysdeps/aarch64/multiarch/init-arch.h b/sysdeps/aarch64/multiarch/init-arch.h
|
||||
index c52860efb22d70eb..61dc40088f4d9e5e 100644
|
||||
--- a/sysdeps/aarch64/multiarch/init-arch.h
|
||||
+++ b/sysdeps/aarch64/multiarch/init-arch.h
|
||||
@@ -36,5 +36,7 @@
|
||||
MTE_ENABLED (); \
|
||||
bool __attribute__((unused)) sve = \
|
||||
GLRO(dl_aarch64_cpu_features).sve; \
|
||||
+ bool __attribute__((unused)) prefer_sve_ifuncs = \
|
||||
+ GLRO(dl_aarch64_cpu_features).prefer_sve_ifuncs; \
|
||||
bool __attribute__((unused)) mops = \
|
||||
GLRO(dl_aarch64_cpu_features).mops;
|
||||
diff --git a/sysdeps/aarch64/multiarch/memcpy.c b/sysdeps/aarch64/multiarch/memcpy.c
|
||||
index d12eccfca51f4bcf..ce53567dab33c2f0 100644
|
||||
--- a/sysdeps/aarch64/multiarch/memcpy.c
|
||||
+++ b/sysdeps/aarch64/multiarch/memcpy.c
|
||||
@@ -47,7 +47,7 @@ select_memcpy_ifunc (void)
|
||||
{
|
||||
if (IS_A64FX (midr))
|
||||
return __memcpy_a64fx;
|
||||
- return __memcpy_sve;
|
||||
+ return prefer_sve_ifuncs ? __memcpy_sve : __memcpy_generic;
|
||||
}
|
||||
|
||||
if (IS_THUNDERX (midr))
|
||||
diff --git a/sysdeps/aarch64/multiarch/memmove.c b/sysdeps/aarch64/multiarch/memmove.c
|
||||
index 2081eeb4d40e0240..fe95037be391896c 100644
|
||||
--- a/sysdeps/aarch64/multiarch/memmove.c
|
||||
+++ b/sysdeps/aarch64/multiarch/memmove.c
|
||||
@@ -47,7 +47,7 @@ select_memmove_ifunc (void)
|
||||
{
|
||||
if (IS_A64FX (midr))
|
||||
return __memmove_a64fx;
|
||||
- return __memmove_sve;
|
||||
+ return prefer_sve_ifuncs ? __memmove_sve : __memmove_generic;
|
||||
}
|
||||
|
||||
if (IS_THUNDERX (midr))
|
||||
diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
|
||||
index b1a3f673f067280b..c0b047bc0dbeae42 100644
|
||||
--- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
|
||||
+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <sys/auxv.h>
|
||||
#include <elf/dl-hwcaps.h>
|
||||
#include <sys/prctl.h>
|
||||
+#include <sys/utsname.h>
|
||||
#include <dl-tunables-parse.h>
|
||||
|
||||
#define DCZID_DZP_MASK (1 << 4)
|
||||
@@ -62,6 +63,46 @@ get_midr_from_mcpu (const struct tunable_str_t *mcpu)
|
||||
return UINT64_MAX;
|
||||
}
|
||||
|
||||
+#if __LINUX_KERNEL_VERSION < 0x060200
|
||||
+
|
||||
+/* Return true if we prefer using SVE in string ifuncs. Old kernels disable
|
||||
+ SVE after every system call which results in unnecessary traps if memcpy
|
||||
+ uses SVE. This is true for kernels between 4.15.0 and before 6.2.0, except
|
||||
+ for 5.14.0 which was patched. For these versions return false to avoid using
|
||||
+ SVE ifuncs.
|
||||
+ Parse the kernel version into a 24-bit kernel.major.minor value without
|
||||
+ calling any library functions. If uname() is not supported or if the version
|
||||
+ format is not recognized, assume the kernel is modern and return true. */
|
||||
+
|
||||
+static inline bool
|
||||
+prefer_sve_ifuncs (void)
|
||||
+{
|
||||
+ struct utsname buf;
|
||||
+ const char *p = &buf.release[0];
|
||||
+ int kernel = 0;
|
||||
+ int val;
|
||||
+
|
||||
+ if (__uname (&buf) < 0)
|
||||
+ return true;
|
||||
+
|
||||
+ for (int shift = 16; shift >= 0; shift -= 8)
|
||||
+ {
|
||||
+ for (val = 0; *p >= '0' && *p <= '9'; p++)
|
||||
+ val = val * 10 + *p - '0';
|
||||
+ kernel |= (val & 255) << shift;
|
||||
+ if (*p++ != '.')
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (kernel >= 0x060200 || kernel == 0x050e00)
|
||||
+ return true;
|
||||
+ if (kernel >= 0x040f00)
|
||||
+ return false;
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
static inline void
|
||||
init_cpu_features (struct cpu_features *cpu_features)
|
||||
{
|
||||
@@ -126,6 +167,13 @@ init_cpu_features (struct cpu_features *cpu_features)
|
||||
/* Check if SVE is supported. */
|
||||
cpu_features->sve = GLRO (dl_hwcap) & HWCAP_SVE;
|
||||
|
||||
+ cpu_features->prefer_sve_ifuncs = cpu_features->sve;
|
||||
+
|
||||
+#if __LINUX_KERNEL_VERSION < 0x060200
|
||||
+ if (cpu_features->sve)
|
||||
+ cpu_features->prefer_sve_ifuncs = prefer_sve_ifuncs ();
|
||||
+#endif
|
||||
+
|
||||
/* Check if MOPS is supported. */
|
||||
cpu_features->mops = GLRO (dl_hwcap2) & HWCAP2_MOPS;
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
commit 9883f4304cfb1558d0f1e6d9f48c4ab0a35355fe
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Wed Feb 28 09:51:14 2024 -0800
|
||||
|
||||
x86-64: Don't use SSE resolvers for ISA level 3 or above
|
||||
|
||||
When glibc is built with ISA level 3 or above enabled, SSE resolvers
|
||||
aren't available and glibc fails to build:
|
||||
|
||||
ld: .../elf/librtld.os: in function `init_cpu_features':
|
||||
.../elf/../sysdeps/x86/cpu-features.c:1200:(.text+0x1445f): undefined reference to `_dl_runtime_resolve_fxsave'
|
||||
ld: .../elf/librtld.os: relocation R_X86_64_PC32 against undefined hidden symbol `_dl_runtime_resolve_fxsave' can not be used when making a shared object
|
||||
/usr/local/bin/ld: final link failed: bad value
|
||||
|
||||
For ISA level 3 or above, don't use _dl_runtime_resolve_fxsave nor
|
||||
_dl_tlsdesc_dynamic_fxsave.
|
||||
|
||||
This fixes BZ #31429.
|
||||
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
||||
|
||||
(cherry picked from commit befe2d3c4dec8be2cdd01a47132e47bdb7020922)
|
||||
|
||||
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
|
||||
index 6fe1b728c607f39e..b8abe733abe54fc4 100644
|
||||
--- a/sysdeps/x86/cpu-features.c
|
||||
+++ b/sysdeps/x86/cpu-features.c
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <dl-hwcap.h>
|
||||
#include <libc-pointer-arith.h>
|
||||
+#include <isa-level.h>
|
||||
#include <get-isa-level.h>
|
||||
#include <cacheinfo.h>
|
||||
#include <dl-cacheinfo.h>
|
||||
@@ -1198,7 +1199,9 @@ no_cpuid:
|
||||
TUNABLE_CALLBACK (set_x86_shstk));
|
||||
#endif
|
||||
|
||||
+#if MINIMUM_X86_ISA_LEVEL < AVX_X86_ISA_LEVEL
|
||||
if (GLRO(dl_x86_cpu_features).xsave_state_size != 0)
|
||||
+#endif
|
||||
{
|
||||
if (CPU_FEATURE_USABLE_P (cpu_features, XSAVEC))
|
||||
{
|
||||
@@ -1219,22 +1222,24 @@ no_cpuid:
|
||||
#endif
|
||||
}
|
||||
}
|
||||
+#if MINIMUM_X86_ISA_LEVEL < AVX_X86_ISA_LEVEL
|
||||
else
|
||||
{
|
||||
-#ifdef __x86_64__
|
||||
+# ifdef __x86_64__
|
||||
GLRO(dl_x86_64_runtime_resolve) = _dl_runtime_resolve_fxsave;
|
||||
-# ifdef SHARED
|
||||
+# ifdef SHARED
|
||||
GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fxsave;
|
||||
-# endif
|
||||
-#else
|
||||
-# ifdef SHARED
|
||||
+# endif
|
||||
+# else
|
||||
+# ifdef SHARED
|
||||
if (CPU_FEATURE_USABLE_P (cpu_features, FXSR))
|
||||
GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fxsave;
|
||||
else
|
||||
GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fnsave;
|
||||
+# endif
|
||||
# endif
|
||||
-#endif
|
||||
}
|
||||
+#endif
|
||||
|
||||
#ifdef SHARED
|
||||
# ifdef __x86_64__
|
||||
diff --git a/sysdeps/x86_64/dl-tlsdesc.S b/sysdeps/x86_64/dl-tlsdesc.S
|
||||
index ea69f5223a77e0c0..057a10862afd6208 100644
|
||||
--- a/sysdeps/x86_64/dl-tlsdesc.S
|
||||
+++ b/sysdeps/x86_64/dl-tlsdesc.S
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <tls.h>
|
||||
#include <cpu-features-offsets.h>
|
||||
#include <features-offsets.h>
|
||||
+#include <isa-level.h>
|
||||
#include "tlsdesc.h"
|
||||
#include "dl-trampoline-save.h"
|
||||
|
||||
@@ -79,12 +80,14 @@ _dl_tlsdesc_undefweak:
|
||||
.size _dl_tlsdesc_undefweak, .-_dl_tlsdesc_undefweak
|
||||
|
||||
#ifdef SHARED
|
||||
-# define USE_FXSAVE
|
||||
-# define STATE_SAVE_ALIGNMENT 16
|
||||
-# define _dl_tlsdesc_dynamic _dl_tlsdesc_dynamic_fxsave
|
||||
-# include "dl-tlsdesc-dynamic.h"
|
||||
-# undef _dl_tlsdesc_dynamic
|
||||
-# undef USE_FXSAVE
|
||||
+# if MINIMUM_X86_ISA_LEVEL < AVX_X86_ISA_LEVEL
|
||||
+# define USE_FXSAVE
|
||||
+# define STATE_SAVE_ALIGNMENT 16
|
||||
+# define _dl_tlsdesc_dynamic _dl_tlsdesc_dynamic_fxsave
|
||||
+# include "dl-tlsdesc-dynamic.h"
|
||||
+# undef _dl_tlsdesc_dynamic
|
||||
+# undef USE_FXSAVE
|
||||
+# endif
|
||||
|
||||
# define USE_XSAVE
|
||||
# define STATE_SAVE_ALIGNMENT 64
|
@ -0,0 +1,61 @@
|
||||
commit 7b92f46f04c6cbce19d19ae1099628431858996c
|
||||
Author: Sunil K Pandey <skpgkp2@gmail.com>
|
||||
Date: Thu Feb 29 17:57:02 2024 -0800
|
||||
|
||||
x86-64: Simplify minimum ISA check ifdef conditional with if
|
||||
|
||||
Replace minimum ISA check ifdef conditional with if. Since
|
||||
MINIMUM_X86_ISA_LEVEL and AVX_X86_ISA_LEVEL are compile time constants,
|
||||
compiler will perform constant folding optimization, getting same
|
||||
results.
|
||||
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
(cherry picked from commit b6e3898194bbae78910bbe9cd086937014961e45)
|
||||
|
||||
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
|
||||
index b8abe733abe54fc4..3d7c2819d7cc6643 100644
|
||||
--- a/sysdeps/x86/cpu-features.c
|
||||
+++ b/sysdeps/x86/cpu-features.c
|
||||
@@ -1199,9 +1199,8 @@ no_cpuid:
|
||||
TUNABLE_CALLBACK (set_x86_shstk));
|
||||
#endif
|
||||
|
||||
-#if MINIMUM_X86_ISA_LEVEL < AVX_X86_ISA_LEVEL
|
||||
- if (GLRO(dl_x86_cpu_features).xsave_state_size != 0)
|
||||
-#endif
|
||||
+ if (MINIMUM_X86_ISA_LEVEL >= AVX_X86_ISA_LEVEL
|
||||
+ || (GLRO(dl_x86_cpu_features).xsave_state_size != 0))
|
||||
{
|
||||
if (CPU_FEATURE_USABLE_P (cpu_features, XSAVEC))
|
||||
{
|
||||
@@ -1222,24 +1221,22 @@ no_cpuid:
|
||||
#endif
|
||||
}
|
||||
}
|
||||
-#if MINIMUM_X86_ISA_LEVEL < AVX_X86_ISA_LEVEL
|
||||
else
|
||||
{
|
||||
-# ifdef __x86_64__
|
||||
+#ifdef __x86_64__
|
||||
GLRO(dl_x86_64_runtime_resolve) = _dl_runtime_resolve_fxsave;
|
||||
-# ifdef SHARED
|
||||
+# ifdef SHARED
|
||||
GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fxsave;
|
||||
-# endif
|
||||
-# else
|
||||
-# ifdef SHARED
|
||||
+# endif
|
||||
+#else
|
||||
+# ifdef SHARED
|
||||
if (CPU_FEATURE_USABLE_P (cpu_features, FXSR))
|
||||
GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fxsave;
|
||||
else
|
||||
GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fnsave;
|
||||
-# endif
|
||||
# endif
|
||||
- }
|
||||
#endif
|
||||
+ }
|
||||
|
||||
#ifdef SHARED
|
||||
# ifdef __x86_64__
|
@ -0,0 +1,50 @@
|
||||
commit edb9a76e3008725e9dc035d38a58e849a3bde0f1
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Sun Apr 14 08:24:51 2024 +0200
|
||||
|
||||
powerpc: Fix ld.so address determination for PCREL mode (bug 31640)
|
||||
|
||||
This seems to have stopped working with some GCC 14 versions,
|
||||
which clobber r2. With other compilers, the kernel-provided
|
||||
r2 value is still available at this point.
|
||||
|
||||
Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
|
||||
(cherry picked from commit 14e56bd4ce15ac2d1cc43f762eb2e6b83fec1afe)
|
||||
|
||||
diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
|
||||
index c6682f3445615636..2b6f5d2b08cb10b8 100644
|
||||
--- a/sysdeps/powerpc/powerpc64/dl-machine.h
|
||||
+++ b/sysdeps/powerpc/powerpc64/dl-machine.h
|
||||
@@ -78,6 +78,7 @@ elf_host_tolerates_class (const Elf64_Ehdr *ehdr)
|
||||
static inline Elf64_Addr
|
||||
elf_machine_load_address (void) __attribute__ ((const));
|
||||
|
||||
+#ifndef __PCREL__
|
||||
static inline Elf64_Addr
|
||||
elf_machine_load_address (void)
|
||||
{
|
||||
@@ -105,6 +106,24 @@ elf_machine_dynamic (void)
|
||||
/* Then subtract off the load address offset. */
|
||||
return runtime_dynamic - elf_machine_load_address() ;
|
||||
}
|
||||
+#else /* __PCREL__ */
|
||||
+/* In PCREL mode, r2 may have been clobbered. Rely on relative
|
||||
+ relocations instead. */
|
||||
+
|
||||
+static inline ElfW(Addr)
|
||||
+elf_machine_load_address (void)
|
||||
+{
|
||||
+ extern const ElfW(Ehdr) __ehdr_start attribute_hidden;
|
||||
+ return (ElfW(Addr)) &__ehdr_start;
|
||||
+}
|
||||
+
|
||||
+static inline ElfW(Addr)
|
||||
+elf_machine_dynamic (void)
|
||||
+{
|
||||
+ extern ElfW(Dyn) _DYNAMIC[] attribute_hidden;
|
||||
+ return (ElfW(Addr)) _DYNAMIC - elf_machine_load_address ();
|
||||
+}
|
||||
+#endif /* __PCREL__ */
|
||||
|
||||
/* The PLT uses Elf64_Rela relocs. */
|
||||
#define elf_machine_relplt elf_machine_rela
|
@ -0,0 +1,246 @@
|
||||
commit 04df8652eb1919da18d54b3dcd6db1675993d45d
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Thu Feb 15 11:19:56 2024 -0800
|
||||
|
||||
Apply the Makefile sorting fix
|
||||
|
||||
Apply the Makefile sorting fix generated by sort-makefile-lines.py.
|
||||
|
||||
(cherry picked from commit ef7f4b1fef67430a8f3cfc77fa6aada2add851d7)
|
||||
|
||||
diff --git a/sysdeps/loongarch/lp64/multiarch/Makefile b/sysdeps/loongarch/lp64/multiarch/Makefile
|
||||
index fe863e1ba411cc4b..01762ef526854d54 100644
|
||||
--- a/sysdeps/loongarch/lp64/multiarch/Makefile
|
||||
+++ b/sysdeps/loongarch/lp64/multiarch/Makefile
|
||||
@@ -1,52 +1,52 @@
|
||||
ifeq ($(subdir),string)
|
||||
sysdep_routines += \
|
||||
- strlen-aligned \
|
||||
- strlen-lsx \
|
||||
- strlen-lasx \
|
||||
- strnlen-aligned \
|
||||
- strnlen-lsx \
|
||||
- strnlen-lasx \
|
||||
+ memchr-aligned \
|
||||
+ memchr-lasx \
|
||||
+ memchr-lsx \
|
||||
+ memcmp-aligned \
|
||||
+ memcmp-lasx \
|
||||
+ memcmp-lsx \
|
||||
+ memcpy-aligned \
|
||||
+ memcpy-unaligned \
|
||||
+ memmove-lasx \
|
||||
+ memmove-lsx \
|
||||
+ memmove-unaligned \
|
||||
+ memrchr-generic \
|
||||
+ memrchr-lasx \
|
||||
+ memrchr-lsx \
|
||||
+ memset-aligned \
|
||||
+ memset-lasx \
|
||||
+ memset-lsx \
|
||||
+ memset-unaligned \
|
||||
+ rawmemchr-aligned \
|
||||
+ rawmemchr-lasx \
|
||||
+ rawmemchr-lsx \
|
||||
+ stpcpy-aligned \
|
||||
+ stpcpy-lasx \
|
||||
+ stpcpy-lsx \
|
||||
+ stpcpy-unaligned \
|
||||
strchr-aligned \
|
||||
- strchr-lsx \
|
||||
strchr-lasx \
|
||||
- strrchr-aligned \
|
||||
- strrchr-lsx \
|
||||
- strrchr-lasx \
|
||||
+ strchr-lsx \
|
||||
strchrnul-aligned \
|
||||
- strchrnul-lsx \
|
||||
strchrnul-lasx \
|
||||
+ strchrnul-lsx \
|
||||
strcmp-aligned \
|
||||
strcmp-lsx \
|
||||
- strncmp-aligned \
|
||||
- strncmp-lsx \
|
||||
strcpy-aligned \
|
||||
- strcpy-unaligned \
|
||||
- strcpy-lsx \
|
||||
strcpy-lasx \
|
||||
- stpcpy-aligned \
|
||||
- stpcpy-unaligned \
|
||||
- stpcpy-lsx \
|
||||
- stpcpy-lasx \
|
||||
- memcpy-aligned \
|
||||
- memcpy-unaligned \
|
||||
- memmove-unaligned \
|
||||
- memmove-lsx \
|
||||
- memmove-lasx \
|
||||
- rawmemchr-aligned \
|
||||
- rawmemchr-lsx \
|
||||
- rawmemchr-lasx \
|
||||
- memchr-aligned \
|
||||
- memchr-lsx \
|
||||
- memchr-lasx \
|
||||
- memrchr-generic \
|
||||
- memrchr-lsx \
|
||||
- memrchr-lasx \
|
||||
- memset-aligned \
|
||||
- memset-unaligned \
|
||||
- memset-lsx \
|
||||
- memset-lasx \
|
||||
- memcmp-aligned \
|
||||
- memcmp-lsx \
|
||||
- memcmp-lasx \
|
||||
+ strcpy-lsx \
|
||||
+ strcpy-unaligned \
|
||||
+ strlen-aligned \
|
||||
+ strlen-lasx \
|
||||
+ strlen-lsx \
|
||||
+ strncmp-aligned \
|
||||
+ strncmp-lsx \
|
||||
+ strnlen-aligned \
|
||||
+ strnlen-lasx \
|
||||
+ strnlen-lsx \
|
||||
+ strrchr-aligned \
|
||||
+ strrchr-lasx \
|
||||
+ strrchr-lsx \
|
||||
# sysdep_routines
|
||||
endif
|
||||
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
|
||||
index 992aabe43ec60abf..5311b594aff62f7c 100644
|
||||
--- a/sysdeps/x86/Makefile
|
||||
+++ b/sysdeps/x86/Makefile
|
||||
@@ -15,18 +15,18 @@ CFLAGS-dl-get-cpu-features.os += $(rtld-early-cflags)
|
||||
CFLAGS-get-cpuid-feature-leaf.o += $(no-stack-protector)
|
||||
|
||||
tests += \
|
||||
- tst-get-cpu-features \
|
||||
- tst-get-cpu-features-static \
|
||||
tst-cpu-features-cpuinfo \
|
||||
tst-cpu-features-cpuinfo-static \
|
||||
tst-cpu-features-supports \
|
||||
tst-cpu-features-supports-static \
|
||||
+ tst-get-cpu-features \
|
||||
+ tst-get-cpu-features-static \
|
||||
tst-hwcap-tunables \
|
||||
# tests
|
||||
tests-static += \
|
||||
- tst-get-cpu-features-static \
|
||||
tst-cpu-features-cpuinfo-static \
|
||||
tst-cpu-features-supports-static \
|
||||
+ tst-get-cpu-features-static \
|
||||
# tests-static
|
||||
ifeq (yes,$(have-ifunc))
|
||||
ifeq (yes,$(have-gcc-ifunc))
|
||||
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
|
||||
index 9d374a329916fc45..0ede447405d549b5 100644
|
||||
--- a/sysdeps/x86_64/Makefile
|
||||
+++ b/sysdeps/x86_64/Makefile
|
||||
@@ -252,6 +252,10 @@ sysdep-dl-routines += dl-cet
|
||||
|
||||
tests += \
|
||||
tst-cet-legacy-1 \
|
||||
+ tst-cet-legacy-10 \
|
||||
+ tst-cet-legacy-10-static \
|
||||
+ tst-cet-legacy-10a \
|
||||
+ tst-cet-legacy-10a-static \
|
||||
tst-cet-legacy-1a \
|
||||
tst-cet-legacy-2 \
|
||||
tst-cet-legacy-2a \
|
||||
@@ -263,15 +267,11 @@ tests += \
|
||||
tst-cet-legacy-8 \
|
||||
tst-cet-legacy-9 \
|
||||
tst-cet-legacy-9-static \
|
||||
- tst-cet-legacy-10 \
|
||||
- tst-cet-legacy-10-static \
|
||||
- tst-cet-legacy-10a \
|
||||
- tst-cet-legacy-10a-static \
|
||||
# tests
|
||||
tests-static += \
|
||||
- tst-cet-legacy-9-static \
|
||||
tst-cet-legacy-10-static \
|
||||
tst-cet-legacy-10a-static \
|
||||
+ tst-cet-legacy-9-static \
|
||||
# tests-static
|
||||
tst-cet-legacy-1a-ARGS = -- $(host-test-program-cmd)
|
||||
|
||||
diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile
|
||||
index ea81753b708fcb8d..e1a490dd98b4be07 100644
|
||||
--- a/sysdeps/x86_64/fpu/multiarch/Makefile
|
||||
+++ b/sysdeps/x86_64/fpu/multiarch/Makefile
|
||||
@@ -4,10 +4,10 @@ libm-sysdep_routines += \
|
||||
s_ceilf-c \
|
||||
s_floor-c \
|
||||
s_floorf-c \
|
||||
- s_rint-c \
|
||||
- s_rintf-c \
|
||||
s_nearbyint-c \
|
||||
s_nearbyintf-c \
|
||||
+ s_rint-c \
|
||||
+ s_rintf-c \
|
||||
s_roundeven-c \
|
||||
s_roundevenf-c \
|
||||
s_trunc-c \
|
||||
@@ -21,10 +21,10 @@ libm-sysdep_routines += \
|
||||
s_floorf-sse4_1 \
|
||||
s_nearbyint-sse4_1 \
|
||||
s_nearbyintf-sse4_1 \
|
||||
- s_roundeven-sse4_1 \
|
||||
- s_roundevenf-sse4_1 \
|
||||
s_rint-sse4_1 \
|
||||
s_rintf-sse4_1 \
|
||||
+ s_roundeven-sse4_1 \
|
||||
+ s_roundevenf-sse4_1 \
|
||||
s_trunc-sse4_1 \
|
||||
s_truncf-sse4_1 \
|
||||
# libm-sysdep_routines
|
||||
@@ -84,12 +84,12 @@ CFLAGS-s_cosf-fma.c = -mfma -mavx2
|
||||
CFLAGS-s_sincosf-fma.c = -mfma -mavx2
|
||||
|
||||
libm-sysdep_routines += \
|
||||
+ e_asin-fma4 \
|
||||
+ e_atan2-fma4 \
|
||||
e_exp-fma4 \
|
||||
e_log-fma4 \
|
||||
e_pow-fma4 \
|
||||
- e_asin-fma4 \
|
||||
s_atan-fma4 \
|
||||
- e_atan2-fma4 \
|
||||
s_sin-fma4 \
|
||||
s_sincos-fma4 \
|
||||
s_tan-fma4 \
|
||||
@@ -106,10 +106,10 @@ CFLAGS-s_tan-fma4.c = -mfma4
|
||||
CFLAGS-s_sincos-fma4.c = -mfma4
|
||||
|
||||
libm-sysdep_routines += \
|
||||
+ e_atan2-avx \
|
||||
e_exp-avx \
|
||||
e_log-avx \
|
||||
s_atan-avx \
|
||||
- e_atan2-avx \
|
||||
s_sin-avx \
|
||||
s_sincos-avx \
|
||||
s_tan-avx \
|
||||
diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
|
||||
index e1e894c963afb8b1..d3d2270394bd635d 100644
|
||||
--- a/sysdeps/x86_64/multiarch/Makefile
|
||||
+++ b/sysdeps/x86_64/multiarch/Makefile
|
||||
@@ -4,8 +4,8 @@ sysdep_routines += \
|
||||
memchr-avx2 \
|
||||
memchr-avx2-rtm \
|
||||
memchr-evex \
|
||||
- memchr-evex512 \
|
||||
memchr-evex-rtm \
|
||||
+ memchr-evex512 \
|
||||
memchr-sse2 \
|
||||
memcmp-avx2-movbe \
|
||||
memcmp-avx2-movbe-rtm \
|
||||
@@ -37,8 +37,8 @@ sysdep_routines += \
|
||||
rawmemchr-avx2 \
|
||||
rawmemchr-avx2-rtm \
|
||||
rawmemchr-evex \
|
||||
- rawmemchr-evex512 \
|
||||
rawmemchr-evex-rtm \
|
||||
+ rawmemchr-evex512 \
|
||||
rawmemchr-sse2 \
|
||||
stpcpy-avx2 \
|
||||
stpcpy-avx2-rtm \
|
@ -0,0 +1,78 @@
|
||||
commit 312e159626b67fe11f39e83e222cf4348a3962f3
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Thu Feb 1 14:29:53 2024 -0300
|
||||
|
||||
mips: FIx clone3 implementation (BZ 31325)
|
||||
|
||||
For o32 we need to setup a minimal stack frame to allow cprestore
|
||||
on __thread_start_clone3 (which instruct the linker to save the
|
||||
gp for PIC). Also, there is no guarantee by kABI that $8 will be
|
||||
preserved after syscall execution, so we need to save it on the
|
||||
provided stack.
|
||||
|
||||
Checked on mipsel-linux-gnu.
|
||||
|
||||
Reported-by: Khem Raj <raj.khem@gmail.com>
|
||||
Tested-by: Khem Raj <raj.khem@gmail.com>
|
||||
(cherry picked from commit bbd248ac0d75efdef8fe61ea69b1fb25fb95b6e7)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/mips/clone3.S b/sysdeps/unix/sysv/linux/mips/clone3.S
|
||||
index e9fec2fa471b99ba..481b8ae96366fc70 100644
|
||||
--- a/sysdeps/unix/sysv/linux/mips/clone3.S
|
||||
+++ b/sysdeps/unix/sysv/linux/mips/clone3.S
|
||||
@@ -37,11 +37,6 @@
|
||||
|
||||
.text
|
||||
.set nomips16
|
||||
-#if _MIPS_SIM == _ABIO32
|
||||
-# define EXTRA_LOCALS 1
|
||||
-#else
|
||||
-# define EXTRA_LOCALS 0
|
||||
-#endif
|
||||
#define FRAMESZ ((NARGSAVE*SZREG)+ALSZ)&ALMASK
|
||||
GPOFF= FRAMESZ-(1*SZREG)
|
||||
NESTED(__clone3, SZREG, sp)
|
||||
@@ -68,8 +63,31 @@ NESTED(__clone3, SZREG, sp)
|
||||
beqz a0, L(error) /* No NULL cl_args pointer. */
|
||||
beqz a2, L(error) /* No NULL function pointer. */
|
||||
|
||||
+#if _MIPS_SIM == _ABIO32
|
||||
+ /* Both stack and stack_size on clone_args are defined as uint64_t, and
|
||||
+ there is no need to handle values larger than to 32 bits for o32. */
|
||||
+# if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+# define CL_STACKPOINTER_OFFSET 44
|
||||
+# define CL_STACKSIZE_OFFSET 52
|
||||
+# else
|
||||
+# define CL_STACKPOINTER_OFFSET 40
|
||||
+# define CL_STACKSIZE_OFFSET 48
|
||||
+# endif
|
||||
+
|
||||
+ /* For o32 we need to setup a minimal stack frame to allow cprestore
|
||||
+ on __thread_start_clone3. Also there is no guarantee by kABI that
|
||||
+ $8 will be preserved after syscall execution (so we need to save it
|
||||
+ on the provided stack). */
|
||||
+ lw t0, CL_STACKPOINTER_OFFSET(a0) /* Load the stack pointer. */
|
||||
+ lw t1, CL_STACKSIZE_OFFSET(a0) /* Load the stack_size. */
|
||||
+ addiu t1, -32 /* Update the stack size. */
|
||||
+ addu t2, t1, t0 /* Calculate the thread stack. */
|
||||
+ sw a3, 0(t2) /* Save argument pointer. */
|
||||
+ sw t1, CL_STACKSIZE_OFFSET(a0) /* Save the new stack size. */
|
||||
+#else
|
||||
move $8, a3 /* a3 is set to 0/1 for syscall success/error
|
||||
while a4/$8 is returned unmodified. */
|
||||
+#endif
|
||||
|
||||
/* Do the system call, the kernel expects:
|
||||
v0: system call number
|
||||
@@ -125,7 +143,11 @@ L(thread_start_clone3):
|
||||
|
||||
/* Restore the arg for user's function. */
|
||||
move t9, a2 /* Function pointer. */
|
||||
+#if _MIPS_SIM == _ABIO32
|
||||
+ PTR_L a0, 0(sp)
|
||||
+#else
|
||||
move a0, $8 /* Argument pointer. */
|
||||
+#endif
|
||||
|
||||
/* Call the user's function. */
|
||||
jal t9
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,207 @@
|
||||
commit 31da30f23cddd36db29d5b6a1c7619361b271fb4
|
||||
Author: Charles Fol <folcharles@gmail.com>
|
||||
Date: Thu Mar 28 12:25:38 2024 -0300
|
||||
|
||||
iconv: ISO-2022-CN-EXT: fix out-of-bound writes when writing escape sequence (CVE-2024-2961)
|
||||
|
||||
ISO-2022-CN-EXT uses escape sequences to indicate character set changes
|
||||
(as specified by RFC 1922). While the SOdesignation has the expected
|
||||
bounds checks, neither SS2designation nor SS3designation have its;
|
||||
allowing a write overflow of 1, 2, or 3 bytes with fixed values:
|
||||
'$+I', '$+J', '$+K', '$+L', '$+M', or '$*H'.
|
||||
|
||||
Checked on aarch64-linux-gnu.
|
||||
|
||||
Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
Tested-by: Carlos O'Donell <carlos@redhat.com>
|
||||
|
||||
(cherry picked from commit f9dc609e06b1136bb0408be9605ce7973a767ada)
|
||||
|
||||
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
|
||||
index ea019ce5c0e67e98..7196a8744bb66e8c 100644
|
||||
--- a/iconvdata/Makefile
|
||||
+++ b/iconvdata/Makefile
|
||||
@@ -75,7 +75,8 @@ ifeq (yes,$(build-shared))
|
||||
tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
|
||||
tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \
|
||||
bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 \
|
||||
- bug-iconv13 bug-iconv14 bug-iconv15
|
||||
+ bug-iconv13 bug-iconv14 bug-iconv15 \
|
||||
+ tst-iconv-iso-2022-cn-ext
|
||||
ifeq ($(have-thread-library),yes)
|
||||
tests += bug-iconv3
|
||||
endif
|
||||
@@ -330,6 +331,8 @@ $(objpfx)bug-iconv14.out: $(addprefix $(objpfx), $(gconv-modules)) \
|
||||
$(addprefix $(objpfx),$(modules.so))
|
||||
$(objpfx)bug-iconv15.out: $(addprefix $(objpfx), $(gconv-modules)) \
|
||||
$(addprefix $(objpfx),$(modules.so))
|
||||
+$(objpfx)tst-iconv-iso-2022-cn-ext.out: $(addprefix $(objpfx), $(gconv-modules)) \
|
||||
+ $(addprefix $(objpfx),$(modules.so))
|
||||
|
||||
$(objpfx)iconv-test.out: run-iconv-test.sh \
|
||||
$(addprefix $(objpfx), $(gconv-modules)) \
|
||||
diff --git a/iconvdata/iso-2022-cn-ext.c b/iconvdata/iso-2022-cn-ext.c
|
||||
index b34c8a36f4564c11..cce29b19692263d6 100644
|
||||
--- a/iconvdata/iso-2022-cn-ext.c
|
||||
+++ b/iconvdata/iso-2022-cn-ext.c
|
||||
@@ -574,6 +574,12 @@ DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
|
||||
{ \
|
||||
const char *escseq; \
|
||||
\
|
||||
+ if (outptr + 4 > outend) \
|
||||
+ { \
|
||||
+ result = __GCONV_FULL_OUTPUT; \
|
||||
+ break; \
|
||||
+ } \
|
||||
+ \
|
||||
assert (used == CNS11643_2_set); /* XXX */ \
|
||||
escseq = "*H"; \
|
||||
*outptr++ = ESC; \
|
||||
@@ -587,6 +593,12 @@ DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
|
||||
{ \
|
||||
const char *escseq; \
|
||||
\
|
||||
+ if (outptr + 4 > outend) \
|
||||
+ { \
|
||||
+ result = __GCONV_FULL_OUTPUT; \
|
||||
+ break; \
|
||||
+ } \
|
||||
+ \
|
||||
assert ((used >> 5) >= 3 && (used >> 5) <= 7); \
|
||||
escseq = "+I+J+K+L+M" + ((used >> 5) - 3) * 2; \
|
||||
*outptr++ = ESC; \
|
||||
diff --git a/iconvdata/tst-iconv-iso-2022-cn-ext.c b/iconvdata/tst-iconv-iso-2022-cn-ext.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..96a8765fd5369681
|
||||
--- /dev/null
|
||||
+++ b/iconvdata/tst-iconv-iso-2022-cn-ext.c
|
||||
@@ -0,0 +1,128 @@
|
||||
+/* Verify ISO-2022-CN-EXT does not write out of the bounds.
|
||||
+ Copyright (C) 2024 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 <errno.h>
|
||||
+#include <iconv.h>
|
||||
+#include <sys/mman.h>
|
||||
+
|
||||
+#include <support/xunistd.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/support.h>
|
||||
+
|
||||
+/* The test sets up a two memory page buffer with the second page marked
|
||||
+ PROT_NONE to trigger a fault if the conversion writes beyond the exact
|
||||
+ expected amount. Then we carry out various conversions and precisely
|
||||
+ place the start of the output buffer in order to trigger a SIGSEGV if the
|
||||
+ process writes anywhere between 1 and page sized bytes more (only one
|
||||
+ PROT_NONE page is setup as a canary) than expected. These tests exercise
|
||||
+ all three of the cases in ISO-2022-CN-EXT where the converter must switch
|
||||
+ character sets and may run out of buffer space while doing the
|
||||
+ operation. */
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ iconv_t cd = iconv_open ("ISO-2022-CN-EXT", "UTF-8");
|
||||
+ TEST_VERIFY_EXIT (cd != (iconv_t) -1);
|
||||
+
|
||||
+ char *ntf;
|
||||
+ size_t ntfsize;
|
||||
+ char *outbufbase;
|
||||
+ {
|
||||
+ int pgz = getpagesize ();
|
||||
+ TEST_VERIFY_EXIT (pgz > 0);
|
||||
+ ntfsize = 2 * pgz;
|
||||
+
|
||||
+ ntf = xmmap (NULL, ntfsize, PROT_READ | PROT_WRITE, MAP_PRIVATE
|
||||
+ | MAP_ANONYMOUS, -1);
|
||||
+ xmprotect (ntf + pgz, pgz, PROT_NONE);
|
||||
+
|
||||
+ outbufbase = ntf + pgz;
|
||||
+ }
|
||||
+
|
||||
+ /* Check if SOdesignation escape sequence does not trigger an OOB write. */
|
||||
+ {
|
||||
+ char inbuf[] = "\xe4\xba\xa4\xe6\x8d\xa2";
|
||||
+
|
||||
+ for (int i = 0; i < 9; i++)
|
||||
+ {
|
||||
+ char *inp = inbuf;
|
||||
+ size_t inleft = sizeof (inbuf) - 1;
|
||||
+
|
||||
+ char *outp = outbufbase - i;
|
||||
+ size_t outleft = i;
|
||||
+
|
||||
+ TEST_VERIFY_EXIT (iconv (cd, &inp, &inleft, &outp, &outleft)
|
||||
+ == (size_t) -1);
|
||||
+ TEST_COMPARE (errno, E2BIG);
|
||||
+
|
||||
+ TEST_VERIFY_EXIT (iconv (cd, NULL, NULL, NULL, NULL) == 0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Same as before for SS2designation. */
|
||||
+ {
|
||||
+ char inbuf[] = "㴽 \xe3\xb4\xbd";
|
||||
+
|
||||
+ for (int i = 0; i < 14; i++)
|
||||
+ {
|
||||
+ char *inp = inbuf;
|
||||
+ size_t inleft = sizeof (inbuf) - 1;
|
||||
+
|
||||
+ char *outp = outbufbase - i;
|
||||
+ size_t outleft = i;
|
||||
+
|
||||
+ TEST_VERIFY_EXIT (iconv (cd, &inp, &inleft, &outp, &outleft)
|
||||
+ == (size_t) -1);
|
||||
+ TEST_COMPARE (errno, E2BIG);
|
||||
+
|
||||
+ TEST_VERIFY_EXIT (iconv (cd, NULL, NULL, NULL, NULL) == 0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Same as before for SS3designation. */
|
||||
+ {
|
||||
+ char inbuf[] = "劄 \xe5\x8a\x84";
|
||||
+
|
||||
+ for (int i = 0; i < 14; i++)
|
||||
+ {
|
||||
+ char *inp = inbuf;
|
||||
+ size_t inleft = sizeof (inbuf) - 1;
|
||||
+
|
||||
+ char *outp = outbufbase - i;
|
||||
+ size_t outleft = i;
|
||||
+
|
||||
+ TEST_VERIFY_EXIT (iconv (cd, &inp, &inleft, &outp, &outleft)
|
||||
+ == (size_t) -1);
|
||||
+ TEST_COMPARE (errno, E2BIG);
|
||||
+
|
||||
+ TEST_VERIFY_EXIT (iconv (cd, NULL, NULL, NULL, NULL) == 0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ TEST_VERIFY_EXIT (iconv_close (cd) != -1);
|
||||
+
|
||||
+ xmunmap (ntf, ntfsize);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
@ -0,0 +1,49 @@
|
||||
commit e828914cf9f2fc2caa5bced0fc6a03cb78324979
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Tue Apr 23 21:16:32 2024 +0200
|
||||
|
||||
nptl: Fix tst-cancel30 on kernels without ppoll_time64 support
|
||||
|
||||
Fall back to ppoll if ppoll_time64 fails with ENOSYS.
|
||||
Fixes commit 370da8a121c3ba9eeb2f13da15fc0f21f4136b25 ("nptl: Fix
|
||||
tst-cancel30 on sparc64").
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
(cherry picked from commit f4724843ada64a51d66f65d3199fe431f9d4c254)
|
||||
|
||||
diff --git a/sysdeps/pthread/tst-cancel30.c b/sysdeps/pthread/tst-cancel30.c
|
||||
index 3030660e5fd93e2c..94ad6281bcf080f4 100644
|
||||
--- a/sysdeps/pthread/tst-cancel30.c
|
||||
+++ b/sysdeps/pthread/tst-cancel30.c
|
||||
@@ -18,6 +18,7 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
+#include <errno.h>
|
||||
#include <support/check.h>
|
||||
#include <support/xstdio.h>
|
||||
#include <support/xthread.h>
|
||||
@@ -46,13 +47,19 @@ tf (void *arg)
|
||||
|
||||
/* Wait indefinitely for cancellation, which only works if asynchronous
|
||||
cancellation is enabled. */
|
||||
-#if defined SYS_ppoll || defined SYS_ppoll_time64
|
||||
-# ifndef SYS_ppoll_time64
|
||||
-# define SYS_ppoll_time64 SYS_ppoll
|
||||
+#ifdef SYS_ppoll_time64
|
||||
+ long int ret = syscall (SYS_ppoll_time64, NULL, 0, NULL, NULL);
|
||||
+ (void) ret;
|
||||
+# ifdef SYS_ppoll
|
||||
+ if (ret == -1 && errno == ENOSYS)
|
||||
+ syscall (SYS_ppoll, NULL, 0, NULL, NULL);
|
||||
# endif
|
||||
- syscall (SYS_ppoll_time64, NULL, 0, NULL, NULL);
|
||||
#else
|
||||
+# ifdef SYS_ppoll
|
||||
+ syscall (SYS_ppoll, NULL, 0, NULL, NULL);
|
||||
+# else
|
||||
for (;;);
|
||||
+# endif
|
||||
#endif
|
||||
|
||||
return 0;
|
@ -0,0 +1,20 @@
|
||||
commit e701c7d761f6e5c48d8e9dd5da88cbe2e94943f4
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Apr 25 12:56:48 2024 +0200
|
||||
|
||||
i386: ulp update for SSE2 --disable-multi-arch configurations
|
||||
|
||||
(cherry picked from commit 3a3a4497421422aa854c855cbe5110ca7d598ffc)
|
||||
|
||||
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
|
||||
index 84e6686eba5fe79a..f2139fc172ceef7b 100644
|
||||
--- a/sysdeps/i386/fpu/libm-test-ulps
|
||||
+++ b/sysdeps/i386/fpu/libm-test-ulps
|
||||
@@ -1232,6 +1232,7 @@ ldouble: 6
|
||||
|
||||
Function: "hypot":
|
||||
double: 1
|
||||
+float: 1
|
||||
float128: 1
|
||||
ldouble: 1
|
||||
|
@ -0,0 +1,89 @@
|
||||
commit 2f8f157eb0cc7f1d8d9a3fcaa8c55bed53b092a8
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Tue Apr 23 13:59:50 2024 -0700
|
||||
|
||||
x86: Define MINIMUM_X86_ISA_LEVEL in config.h [BZ #31676]
|
||||
|
||||
Define MINIMUM_X86_ISA_LEVEL at configure time to avoid
|
||||
|
||||
/usr/bin/ld: …/build/elf/librtld.os: in function `init_cpu_features':
|
||||
…/git/elf/../sysdeps/x86/cpu-features.c:1202: undefined reference to `_dl_runtime_resolve_fxsave'
|
||||
/usr/bin/ld: …/build/elf/librtld.os: relocation R_X86_64_PC32 against undefined hidden symbol `_dl_runtime_resolve_fxsave' can not be used when making a shared object
|
||||
/usr/bin/ld: final link failed: bad value
|
||||
collect2: error: ld returned 1 exit status
|
||||
|
||||
when glibc is built with -march=x86-64-v3 and configured with
|
||||
--with-rtld-early-cflags=-march=x86-64, which is used to allow ld.so to
|
||||
print an error message on unsupported CPUs:
|
||||
|
||||
Fatal glibc error: CPU does not support x86-64-v3
|
||||
|
||||
This fixes BZ #31676.
|
||||
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
|
||||
|
||||
(cherry picked from commit 46c999741340ea559784c20a45077955b50aca43)
|
||||
|
||||
diff --git a/config.h.in b/config.h.in
|
||||
index 4d33c63a841d3d6d..1e647de58580bc2d 100644
|
||||
--- a/config.h.in
|
||||
+++ b/config.h.in
|
||||
@@ -286,6 +286,9 @@
|
||||
/* Define if x86 ISA level should be included in shared libraries. */
|
||||
#undef INCLUDE_X86_ISA_LEVEL
|
||||
|
||||
+/* The x86 ISA level. 1 for baseline. Undefined on non-x86. */
|
||||
+#undef MINIMUM_X86_ISA_LEVEL
|
||||
+
|
||||
/* Define if -msahf is enabled by default on x86. */
|
||||
#undef HAVE_X86_LAHF_SAHF
|
||||
|
||||
diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
|
||||
index 2a5421bb31e9efe4..d28d9bcb296c6380 100644
|
||||
--- a/sysdeps/x86/configure
|
||||
+++ b/sysdeps/x86/configure
|
||||
@@ -151,6 +151,13 @@ printf "%s\n" "$libc_cv_have_x86_isa_level" >&6; }
|
||||
else
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
fi
|
||||
+if test $libc_cv_have_x86_isa_level = baseline; then
|
||||
+ printf "%s\n" "#define MINIMUM_X86_ISA_LEVEL 1" >>confdefs.h
|
||||
+
|
||||
+else
|
||||
+ printf "%s\n" "#define MINIMUM_X86_ISA_LEVEL $libc_cv_have_x86_isa_level" >>confdefs.h
|
||||
+
|
||||
+fi
|
||||
config_vars="$config_vars
|
||||
have-x86-isa-level = $libc_cv_have_x86_isa_level"
|
||||
config_vars="$config_vars
|
||||
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
|
||||
index 78ff7c8f41c552bc..5b0acd03d2a30c9b 100644
|
||||
--- a/sysdeps/x86/configure.ac
|
||||
+++ b/sysdeps/x86/configure.ac
|
||||
@@ -105,6 +105,11 @@ EOF
|
||||
else
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
fi
|
||||
+if test $libc_cv_have_x86_isa_level = baseline; then
|
||||
+ AC_DEFINE_UNQUOTED(MINIMUM_X86_ISA_LEVEL, 1)
|
||||
+else
|
||||
+ AC_DEFINE_UNQUOTED(MINIMUM_X86_ISA_LEVEL, $libc_cv_have_x86_isa_level)
|
||||
+fi
|
||||
LIBC_CONFIG_VAR([have-x86-isa-level], [$libc_cv_have_x86_isa_level])
|
||||
LIBC_CONFIG_VAR([x86-isa-level-3-or-above], [3 4])
|
||||
LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level])
|
||||
diff --git a/sysdeps/x86/isa-level.h b/sysdeps/x86/isa-level.h
|
||||
index 11fe1ca90c5bfedf..2c7f74212b9a27e5 100644
|
||||
--- a/sysdeps/x86/isa-level.h
|
||||
+++ b/sysdeps/x86/isa-level.h
|
||||
@@ -61,8 +61,10 @@
|
||||
# define __X86_ISA_V4 0
|
||||
#endif
|
||||
|
||||
-#define MINIMUM_X86_ISA_LEVEL \
|
||||
+#ifndef MINIMUM_X86_ISA_LEVEL
|
||||
+# define MINIMUM_X86_ISA_LEVEL \
|
||||
(__X86_ISA_V1 + __X86_ISA_V2 + __X86_ISA_V3 + __X86_ISA_V4)
|
||||
+#endif
|
||||
|
||||
/* Depending on the minimum ISA level, a feature check result can be a
|
||||
compile-time constant.. */
|
@ -0,0 +1,32 @@
|
||||
commit 1263d583d2e28afb8be53f8d6922f0842036f35d
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Apr 25 15:00:45 2024 +0200
|
||||
|
||||
CVE-2024-33599: nscd: Stack-based buffer overflow in netgroup cache (bug 31677)
|
||||
|
||||
Using alloca matches what other caches do. The request length is
|
||||
bounded by MAXKEYLEN.
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit 87801a8fd06db1d654eea3e4f7626ff476a9bdaa)
|
||||
|
||||
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
|
||||
index 0c6e46f15c5d7139..f227dc7fa2856e38 100644
|
||||
--- a/nscd/netgroupcache.c
|
||||
+++ b/nscd/netgroupcache.c
|
||||
@@ -502,12 +502,13 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
|
||||
= (struct indataset *) mempool_alloc (db,
|
||||
sizeof (*dataset) + req->key_len,
|
||||
1);
|
||||
- struct indataset dataset_mem;
|
||||
bool cacheable = true;
|
||||
if (__glibc_unlikely (dataset == NULL))
|
||||
{
|
||||
cacheable = false;
|
||||
- dataset = &dataset_mem;
|
||||
+ /* The alloca is safe because nscd_run_worker verfies that
|
||||
+ key_len is not larger than MAXKEYLEN. */
|
||||
+ dataset = alloca (sizeof (*dataset) + req->key_len);
|
||||
}
|
||||
|
||||
datahead_init_pos (&dataset->head, sizeof (*dataset) + req->key_len,
|
@ -0,0 +1,53 @@
|
||||
commit 5a508e0b508c8ad53bd0d2fb48fd71b242626341
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Apr 25 15:01:07 2024 +0200
|
||||
|
||||
CVE-2024-33600: nscd: Do not send missing not-found response in addgetnetgrentX (bug 31678)
|
||||
|
||||
If we failed to add a not-found response to the cache, the dataset
|
||||
point can be null, resulting in a null pointer dereference.
|
||||
|
||||
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
(cherry picked from commit 7835b00dbce53c3c87bbbb1754a95fb5e58187aa)
|
||||
|
||||
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
|
||||
index f227dc7fa2856e38..c18fe111f37496d7 100644
|
||||
--- a/nscd/netgroupcache.c
|
||||
+++ b/nscd/netgroupcache.c
|
||||
@@ -147,7 +147,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
/* No such service. */
|
||||
cacheable = do_notfound (db, fd, req, key, &dataset, &total, &timeout,
|
||||
&key_copy);
|
||||
- goto writeout;
|
||||
+ goto maybe_cache_add;
|
||||
}
|
||||
|
||||
memset (&data, '\0', sizeof (data));
|
||||
@@ -348,7 +348,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
{
|
||||
cacheable = do_notfound (db, fd, req, key, &dataset, &total, &timeout,
|
||||
&key_copy);
|
||||
- goto writeout;
|
||||
+ goto maybe_cache_add;
|
||||
}
|
||||
|
||||
total = buffilled;
|
||||
@@ -410,14 +410,12 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
}
|
||||
|
||||
if (he == NULL && fd != -1)
|
||||
- {
|
||||
- /* We write the dataset before inserting it to the database
|
||||
- since while inserting this thread might block and so would
|
||||
- unnecessarily let the receiver wait. */
|
||||
- writeout:
|
||||
+ /* We write the dataset before inserting it to the database since
|
||||
+ while inserting this thread might block and so would
|
||||
+ unnecessarily let the receiver wait. */
|
||||
writeall (fd, &dataset->resp, dataset->head.recsize);
|
||||
- }
|
||||
|
||||
+ maybe_cache_add:
|
||||
if (cacheable)
|
||||
{
|
||||
/* If necessary, we also propagate the data to disk. */
|
@ -0,0 +1,54 @@
|
||||
commit c99f886de54446cd4447db6b44be93dabbdc2f8b
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Apr 25 15:01:07 2024 +0200
|
||||
|
||||
CVE-2024-33600: nscd: Avoid null pointer crashes after notfound response (bug 31678)
|
||||
|
||||
The addgetnetgrentX call in addinnetgrX may have failed to produce
|
||||
a result, so the result variable in addinnetgrX can be NULL.
|
||||
Use db->negtimeout as the fallback value if there is no result data;
|
||||
the timeout is also overwritten below.
|
||||
|
||||
Also avoid sending a second not-found response. (The client
|
||||
disconnects after receiving the first response, so the data stream did
|
||||
not go out of sync even without this fix.) It is still beneficial to
|
||||
add the negative response to the mapping, so that the client can get
|
||||
it from there in the future, instead of going through the socket.
|
||||
|
||||
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
(cherry picked from commit b048a482f088e53144d26a61c390bed0210f49f2)
|
||||
|
||||
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
|
||||
index c18fe111f37496d7..e22ffa5884e36260 100644
|
||||
--- a/nscd/netgroupcache.c
|
||||
+++ b/nscd/netgroupcache.c
|
||||
@@ -511,14 +511,15 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
|
||||
|
||||
datahead_init_pos (&dataset->head, sizeof (*dataset) + req->key_len,
|
||||
sizeof (innetgroup_response_header),
|
||||
- he == NULL ? 0 : dh->nreloads + 1, result->head.ttl);
|
||||
+ he == NULL ? 0 : dh->nreloads + 1,
|
||||
+ result == NULL ? db->negtimeout : result->head.ttl);
|
||||
/* Set the notfound status and timeout based on the result from
|
||||
getnetgrent. */
|
||||
- dataset->head.notfound = result->head.notfound;
|
||||
+ dataset->head.notfound = result == NULL || result->head.notfound;
|
||||
dataset->head.timeout = timeout;
|
||||
|
||||
dataset->resp.version = NSCD_VERSION;
|
||||
- dataset->resp.found = result->resp.found;
|
||||
+ dataset->resp.found = result != NULL && result->resp.found;
|
||||
/* Until we find a matching entry the result is 0. */
|
||||
dataset->resp.result = 0;
|
||||
|
||||
@@ -566,7 +567,9 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (he == NULL)
|
||||
+ /* addgetnetgrentX may have already sent a notfound response. Do
|
||||
+ not send another one. */
|
||||
+ if (he == NULL && dataset->resp.found)
|
||||
{
|
||||
/* We write the dataset before inserting it to the database
|
||||
since while inserting this thread might block and so would
|
@ -0,0 +1,384 @@
|
||||
commit a9a8d3eebb145779a18d90e3966009a1daa63cd8
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Apr 25 15:01:07 2024 +0200
|
||||
|
||||
CVE-2024-33601, CVE-2024-33602: nscd: netgroup: Use two buffers in addgetnetgrentX (bug 31680)
|
||||
|
||||
This avoids potential memory corruption when the underlying NSS
|
||||
callback function does not use the buffer space to store all strings
|
||||
(e.g., for constant strings).
|
||||
|
||||
Instead of custom buffer management, two scratch buffers are used.
|
||||
This increases stack usage somewhat.
|
||||
|
||||
Scratch buffer allocation failure is handled by return -1
|
||||
(an invalid timeout value) instead of terminating the process.
|
||||
This fixes bug 31679.
|
||||
|
||||
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
(cherry picked from commit c04a21e050d64a1193a6daab872bca2528bda44b)
|
||||
|
||||
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
|
||||
index e22ffa5884e36260..e8fe041846b75cb9 100644
|
||||
--- a/nscd/netgroupcache.c
|
||||
+++ b/nscd/netgroupcache.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
+#include <scratch_buffer.h>
|
||||
|
||||
#include "../nss/netgroup.h"
|
||||
#include "nscd.h"
|
||||
@@ -65,6 +66,16 @@ struct dataset
|
||||
char strdata[0];
|
||||
};
|
||||
|
||||
+/* Send a notfound response to FD. Always returns -1 to indicate an
|
||||
+ ephemeral error. */
|
||||
+static time_t
|
||||
+send_notfound (int fd)
|
||||
+{
|
||||
+ if (fd != -1)
|
||||
+ TEMP_FAILURE_RETRY (send (fd, ¬found, sizeof (notfound), MSG_NOSIGNAL));
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
/* Sends a notfound message and prepares a notfound dataset to write to the
|
||||
cache. Returns true if there was enough memory to allocate the dataset and
|
||||
returns the dataset in DATASETP, total bytes to write in TOTALP and the
|
||||
@@ -83,8 +94,7 @@ do_notfound (struct database_dyn *db, int fd, request_header *req,
|
||||
total = sizeof (notfound);
|
||||
timeout = time (NULL) + db->negtimeout;
|
||||
|
||||
- if (fd != -1)
|
||||
- TEMP_FAILURE_RETRY (send (fd, ¬found, total, MSG_NOSIGNAL));
|
||||
+ send_notfound (fd);
|
||||
|
||||
dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1);
|
||||
/* If we cannot permanently store the result, so be it. */
|
||||
@@ -109,11 +119,78 @@ do_notfound (struct database_dyn *db, int fd, request_header *req,
|
||||
return cacheable;
|
||||
}
|
||||
|
||||
+struct addgetnetgrentX_scratch
|
||||
+{
|
||||
+ /* This is the result that the caller should use. It can be NULL,
|
||||
+ point into buffer, or it can be in the cache. */
|
||||
+ struct dataset *dataset;
|
||||
+
|
||||
+ struct scratch_buffer buffer;
|
||||
+
|
||||
+ /* Used internally in addgetnetgrentX as a staging area. */
|
||||
+ struct scratch_buffer tmp;
|
||||
+
|
||||
+ /* Number of bytes in buffer that are actually used. */
|
||||
+ size_t buffer_used;
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+addgetnetgrentX_scratch_init (struct addgetnetgrentX_scratch *scratch)
|
||||
+{
|
||||
+ scratch->dataset = NULL;
|
||||
+ scratch_buffer_init (&scratch->buffer);
|
||||
+ scratch_buffer_init (&scratch->tmp);
|
||||
+
|
||||
+ /* Reserve space for the header. */
|
||||
+ scratch->buffer_used = sizeof (struct dataset);
|
||||
+ static_assert (sizeof (struct dataset) < sizeof (scratch->tmp.__space),
|
||||
+ "initial buffer space");
|
||||
+ memset (scratch->tmp.data, 0, sizeof (struct dataset));
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+addgetnetgrentX_scratch_free (struct addgetnetgrentX_scratch *scratch)
|
||||
+{
|
||||
+ scratch_buffer_free (&scratch->buffer);
|
||||
+ scratch_buffer_free (&scratch->tmp);
|
||||
+}
|
||||
+
|
||||
+/* Copy LENGTH bytes from S into SCRATCH. Returns NULL if SCRATCH
|
||||
+ could not be resized, otherwise a pointer to the copy. */
|
||||
+static char *
|
||||
+addgetnetgrentX_append_n (struct addgetnetgrentX_scratch *scratch,
|
||||
+ const char *s, size_t length)
|
||||
+{
|
||||
+ while (true)
|
||||
+ {
|
||||
+ size_t remaining = scratch->buffer.length - scratch->buffer_used;
|
||||
+ if (remaining >= length)
|
||||
+ break;
|
||||
+ if (!scratch_buffer_grow_preserve (&scratch->buffer))
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ char *copy = scratch->buffer.data + scratch->buffer_used;
|
||||
+ memcpy (copy, s, length);
|
||||
+ scratch->buffer_used += length;
|
||||
+ return copy;
|
||||
+}
|
||||
+
|
||||
+/* Copy S into SCRATCH, including its null terminator. Returns false
|
||||
+ if SCRATCH could not be resized. */
|
||||
+static bool
|
||||
+addgetnetgrentX_append (struct addgetnetgrentX_scratch *scratch, const char *s)
|
||||
+{
|
||||
+ if (s == NULL)
|
||||
+ s = "";
|
||||
+ return addgetnetgrentX_append_n (scratch, s, strlen (s) + 1) != NULL;
|
||||
+}
|
||||
+
|
||||
+/* Caller must initialize and free *SCRATCH. If the return value is
|
||||
+ negative, this function has sent a notfound response. */
|
||||
static time_t
|
||||
addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
const char *key, uid_t uid, struct hashentry *he,
|
||||
- struct datahead *dh, struct dataset **resultp,
|
||||
- void **tofreep)
|
||||
+ struct datahead *dh, struct addgetnetgrentX_scratch *scratch)
|
||||
{
|
||||
if (__glibc_unlikely (debug_level > 0))
|
||||
{
|
||||
@@ -132,14 +209,10 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
|
||||
char *key_copy = NULL;
|
||||
struct __netgrent data;
|
||||
- size_t buflen = MAX (1024, sizeof (*dataset) + req->key_len);
|
||||
- size_t buffilled = sizeof (*dataset);
|
||||
- char *buffer = NULL;
|
||||
size_t nentries = 0;
|
||||
size_t group_len = strlen (key) + 1;
|
||||
struct name_list *first_needed
|
||||
= alloca (sizeof (struct name_list) + group_len);
|
||||
- *tofreep = NULL;
|
||||
|
||||
if (netgroup_database == NULL
|
||||
&& !__nss_database_get (nss_database_netgroup, &netgroup_database))
|
||||
@@ -151,8 +224,6 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
}
|
||||
|
||||
memset (&data, '\0', sizeof (data));
|
||||
- buffer = xmalloc (buflen);
|
||||
- *tofreep = buffer;
|
||||
first_needed->next = first_needed;
|
||||
memcpy (first_needed->name, key, group_len);
|
||||
data.needed_groups = first_needed;
|
||||
@@ -195,8 +266,8 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
while (1)
|
||||
{
|
||||
int e;
|
||||
- status = getfct.f (&data, buffer + buffilled,
|
||||
- buflen - buffilled - req->key_len, &e);
|
||||
+ status = getfct.f (&data, scratch->tmp.data,
|
||||
+ scratch->tmp.length, &e);
|
||||
if (status == NSS_STATUS_SUCCESS)
|
||||
{
|
||||
if (data.type == triple_val)
|
||||
@@ -204,68 +275,10 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
const char *nhost = data.val.triple.host;
|
||||
const char *nuser = data.val.triple.user;
|
||||
const char *ndomain = data.val.triple.domain;
|
||||
-
|
||||
- size_t hostlen = strlen (nhost ?: "") + 1;
|
||||
- size_t userlen = strlen (nuser ?: "") + 1;
|
||||
- size_t domainlen = strlen (ndomain ?: "") + 1;
|
||||
-
|
||||
- if (nhost == NULL || nuser == NULL || ndomain == NULL
|
||||
- || nhost > nuser || nuser > ndomain)
|
||||
- {
|
||||
- const char *last = nhost;
|
||||
- if (last == NULL
|
||||
- || (nuser != NULL && nuser > last))
|
||||
- last = nuser;
|
||||
- if (last == NULL
|
||||
- || (ndomain != NULL && ndomain > last))
|
||||
- last = ndomain;
|
||||
-
|
||||
- size_t bufused
|
||||
- = (last == NULL
|
||||
- ? buffilled
|
||||
- : last + strlen (last) + 1 - buffer);
|
||||
-
|
||||
- /* We have to make temporary copies. */
|
||||
- size_t needed = hostlen + userlen + domainlen;
|
||||
-
|
||||
- if (buflen - req->key_len - bufused < needed)
|
||||
- {
|
||||
- buflen += MAX (buflen, 2 * needed);
|
||||
- /* Save offset in the old buffer. We don't
|
||||
- bother with the NULL check here since
|
||||
- we'll do that later anyway. */
|
||||
- size_t nhostdiff = nhost - buffer;
|
||||
- size_t nuserdiff = nuser - buffer;
|
||||
- size_t ndomaindiff = ndomain - buffer;
|
||||
-
|
||||
- char *newbuf = xrealloc (buffer, buflen);
|
||||
- /* Fix up the triplet pointers into the new
|
||||
- buffer. */
|
||||
- nhost = (nhost ? newbuf + nhostdiff
|
||||
- : NULL);
|
||||
- nuser = (nuser ? newbuf + nuserdiff
|
||||
- : NULL);
|
||||
- ndomain = (ndomain ? newbuf + ndomaindiff
|
||||
- : NULL);
|
||||
- *tofreep = buffer = newbuf;
|
||||
- }
|
||||
-
|
||||
- nhost = memcpy (buffer + bufused,
|
||||
- nhost ?: "", hostlen);
|
||||
- nuser = memcpy ((char *) nhost + hostlen,
|
||||
- nuser ?: "", userlen);
|
||||
- ndomain = memcpy ((char *) nuser + userlen,
|
||||
- ndomain ?: "", domainlen);
|
||||
- }
|
||||
-
|
||||
- char *wp = buffer + buffilled;
|
||||
- wp = memmove (wp, nhost ?: "", hostlen);
|
||||
- wp += hostlen;
|
||||
- wp = memmove (wp, nuser ?: "", userlen);
|
||||
- wp += userlen;
|
||||
- wp = memmove (wp, ndomain ?: "", domainlen);
|
||||
- wp += domainlen;
|
||||
- buffilled = wp - buffer;
|
||||
+ if (!(addgetnetgrentX_append (scratch, nhost)
|
||||
+ && addgetnetgrentX_append (scratch, nuser)
|
||||
+ && addgetnetgrentX_append (scratch, ndomain)))
|
||||
+ return send_notfound (fd);
|
||||
++nentries;
|
||||
}
|
||||
else
|
||||
@@ -317,8 +330,8 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
}
|
||||
else if (status == NSS_STATUS_TRYAGAIN && e == ERANGE)
|
||||
{
|
||||
- buflen *= 2;
|
||||
- *tofreep = buffer = xrealloc (buffer, buflen);
|
||||
+ if (!scratch_buffer_grow (&scratch->tmp))
|
||||
+ return send_notfound (fd);
|
||||
}
|
||||
else if (status == NSS_STATUS_RETURN
|
||||
|| status == NSS_STATUS_NOTFOUND
|
||||
@@ -351,10 +364,17 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
goto maybe_cache_add;
|
||||
}
|
||||
|
||||
- total = buffilled;
|
||||
+ /* Capture the result size without the key appended. */
|
||||
+ total = scratch->buffer_used;
|
||||
+
|
||||
+ /* Make a copy of the key. The scratch buffer must not move after
|
||||
+ this point. */
|
||||
+ key_copy = addgetnetgrentX_append_n (scratch, key, req->key_len);
|
||||
+ if (key_copy == NULL)
|
||||
+ return send_notfound (fd);
|
||||
|
||||
/* Fill in the dataset. */
|
||||
- dataset = (struct dataset *) buffer;
|
||||
+ dataset = scratch->buffer.data;
|
||||
timeout = datahead_init_pos (&dataset->head, total + req->key_len,
|
||||
total - offsetof (struct dataset, resp),
|
||||
he == NULL ? 0 : dh->nreloads + 1,
|
||||
@@ -363,11 +383,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
dataset->resp.version = NSCD_VERSION;
|
||||
dataset->resp.found = 1;
|
||||
dataset->resp.nresults = nentries;
|
||||
- dataset->resp.result_len = buffilled - sizeof (*dataset);
|
||||
-
|
||||
- assert (buflen - buffilled >= req->key_len);
|
||||
- key_copy = memcpy (buffer + buffilled, key, req->key_len);
|
||||
- buffilled += req->key_len;
|
||||
+ dataset->resp.result_len = total - sizeof (*dataset);
|
||||
|
||||
/* Now we can determine whether on refill we have to create a new
|
||||
record or not. */
|
||||
@@ -398,7 +414,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
if (__glibc_likely (newp != NULL))
|
||||
{
|
||||
/* Adjust pointer into the memory block. */
|
||||
- key_copy = (char *) newp + (key_copy - buffer);
|
||||
+ key_copy = (char *) newp + (key_copy - (char *) dataset);
|
||||
|
||||
dataset = memcpy (newp, dataset, total + req->key_len);
|
||||
cacheable = true;
|
||||
@@ -439,7 +455,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
|
||||
}
|
||||
|
||||
out:
|
||||
- *resultp = dataset;
|
||||
+ scratch->dataset = dataset;
|
||||
|
||||
return timeout;
|
||||
}
|
||||
@@ -460,6 +476,9 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
|
||||
if (user != NULL)
|
||||
key = strchr (key, '\0') + 1;
|
||||
const char *domain = *key++ ? key : NULL;
|
||||
+ struct addgetnetgrentX_scratch scratch;
|
||||
+
|
||||
+ addgetnetgrentX_scratch_init (&scratch);
|
||||
|
||||
if (__glibc_unlikely (debug_level > 0))
|
||||
{
|
||||
@@ -475,12 +494,8 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
|
||||
group, group_len,
|
||||
db, uid);
|
||||
time_t timeout;
|
||||
- void *tofree;
|
||||
if (result != NULL)
|
||||
- {
|
||||
- timeout = result->head.timeout;
|
||||
- tofree = NULL;
|
||||
- }
|
||||
+ timeout = result->head.timeout;
|
||||
else
|
||||
{
|
||||
request_header req_get =
|
||||
@@ -489,7 +504,10 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
|
||||
.key_len = group_len
|
||||
};
|
||||
timeout = addgetnetgrentX (db, -1, &req_get, group, uid, NULL, NULL,
|
||||
- &result, &tofree);
|
||||
+ &scratch);
|
||||
+ result = scratch.dataset;
|
||||
+ if (timeout < 0)
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
struct indataset
|
||||
@@ -603,7 +621,7 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
|
||||
}
|
||||
|
||||
out:
|
||||
- free (tofree);
|
||||
+ addgetnetgrentX_scratch_free (&scratch);
|
||||
return timeout;
|
||||
}
|
||||
|
||||
@@ -613,11 +631,12 @@ addgetnetgrentX_ignore (struct database_dyn *db, int fd, request_header *req,
|
||||
const char *key, uid_t uid, struct hashentry *he,
|
||||
struct datahead *dh)
|
||||
{
|
||||
- struct dataset *ignore;
|
||||
- void *tofree;
|
||||
- time_t timeout = addgetnetgrentX (db, fd, req, key, uid, he, dh,
|
||||
- &ignore, &tofree);
|
||||
- free (tofree);
|
||||
+ struct addgetnetgrentX_scratch scratch;
|
||||
+ addgetnetgrentX_scratch_init (&scratch);
|
||||
+ time_t timeout = addgetnetgrentX (db, fd, req, key, uid, he, dh, &scratch);
|
||||
+ addgetnetgrentX_scratch_free (&scratch);
|
||||
+ if (timeout < 0)
|
||||
+ timeout = 0;
|
||||
return timeout;
|
||||
}
|
||||
|
||||
@@ -661,5 +680,9 @@ readdinnetgr (struct database_dyn *db, struct hashentry *he,
|
||||
.key_len = he->len
|
||||
};
|
||||
|
||||
- return addinnetgrX (db, -1, &req, db->data + he->key, he->owner, he, dh);
|
||||
+ int timeout = addinnetgrX (db, -1, &req, db->data + he->key, he->owner,
|
||||
+ he, dh);
|
||||
+ if (timeout < 0)
|
||||
+ timeout = 0;
|
||||
+ return timeout;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
commit fd658f026f25cf59e8db243bc3b3e09cd5a20ba0
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Thu Apr 25 08:06:52 2024 -0700
|
||||
|
||||
elf: Also compile dl-misc.os with $(rtld-early-cflags)
|
||||
|
||||
Also compile dl-misc.os with $(rtld-early-cflags) to avoid
|
||||
|
||||
Program received signal SIGILL, Illegal instruction.
|
||||
0x00007ffff7fd36ea in _dl_strtoul (nptr=nptr@entry=0x7fffffffe2c9 "2",
|
||||
endptr=endptr@entry=0x7fffffffd728) at dl-misc.c:156
|
||||
156 bool positive = true;
|
||||
(gdb) bt
|
||||
#0 0x00007ffff7fd36ea in _dl_strtoul (nptr=nptr@entry=0x7fffffffe2c9 "2",
|
||||
endptr=endptr@entry=0x7fffffffd728) at dl-misc.c:156
|
||||
#1 0x00007ffff7fdb1a9 in tunable_initialize (
|
||||
cur=cur@entry=0x7ffff7ffbc00 <tunable_list+2176>,
|
||||
strval=strval@entry=0x7fffffffe2c9 "2", len=len@entry=1)
|
||||
at dl-tunables.c:131
|
||||
#2 0x00007ffff7fdb3a2 in parse_tunables (valstring=<optimized out>)
|
||||
at dl-tunables.c:258
|
||||
#3 0x00007ffff7fdb5d9 in __GI___tunables_init (envp=0x7fffffffdd58)
|
||||
at dl-tunables.c:288
|
||||
#4 0x00007ffff7fe44c3 in _dl_sysdep_start (
|
||||
start_argptr=start_argptr@entry=0x7fffffffdcb0,
|
||||
dl_main=dl_main@entry=0x7ffff7fe5f80 <dl_main>)
|
||||
at ../sysdeps/unix/sysv/linux/dl-sysdep.c:110
|
||||
#5 0x00007ffff7fe5cae in _dl_start_final (arg=0x7fffffffdcb0) at rtld.c:494
|
||||
#6 _dl_start (arg=0x7fffffffdcb0) at rtld.c:581
|
||||
#7 0x00007ffff7fe4b38 in _start ()
|
||||
(gdb)
|
||||
|
||||
when setting GLIBC_TUNABLES in glibc compiled with APX.
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
(cherry picked from commit 049b7684c912dd32b67b1b15b0f43bf07d5f512e)
|
||||
|
||||
diff --git a/elf/Makefile b/elf/Makefile
|
||||
index 69aa423c4b90127d..a50a988e7362cf3b 100644
|
||||
--- a/elf/Makefile
|
||||
+++ b/elf/Makefile
|
||||
@@ -170,6 +170,7 @@ CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
|
||||
CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
|
||||
|
||||
# Add the requested compiler flags to the early startup code.
|
||||
+CFLAGS-dl-misc.os += $(rtld-early-cflags)
|
||||
CFLAGS-dl-printf.os += $(rtld-early-cflags)
|
||||
CFLAGS-dl-setup_hash.os += $(rtld-early-cflags)
|
||||
CFLAGS-dl-sysdep.os += $(rtld-early-cflags)
|
@ -0,0 +1,42 @@
|
||||
commit d0724994de40934c552f1f68de89053848a44927
|
||||
Author: Xi Ruoyao <xry111@xry111.site>
|
||||
Date: Thu Feb 22 21:26:55 2024 +0100
|
||||
|
||||
math: Update mips64 ulps
|
||||
|
||||
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
|
||||
(cherry picked from commit e2a65ecc4b30a797df7dc6529f09b712aa256029)
|
||||
|
||||
diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
|
||||
index 78969745b245d094..933aba47350b777d 100644
|
||||
--- a/sysdeps/mips/mips64/libm-test-ulps
|
||||
+++ b/sysdeps/mips/mips64/libm-test-ulps
|
||||
@@ -1066,17 +1066,17 @@ double: 1
|
||||
ldouble: 1
|
||||
|
||||
Function: "j0":
|
||||
-double: 2
|
||||
+double: 3
|
||||
float: 9
|
||||
ldouble: 2
|
||||
|
||||
Function: "j0_downward":
|
||||
-double: 5
|
||||
+double: 6
|
||||
float: 9
|
||||
ldouble: 9
|
||||
|
||||
Function: "j0_towardzero":
|
||||
-double: 6
|
||||
+double: 7
|
||||
float: 9
|
||||
ldouble: 9
|
||||
|
||||
@@ -1146,6 +1146,7 @@ float: 6
|
||||
ldouble: 8
|
||||
|
||||
Function: "log":
|
||||
+double: 1
|
||||
float: 1
|
||||
ldouble: 1
|
||||
|
@ -0,0 +1,209 @@
|
||||
commit 9831f98c266a8d56d1bf729b709c08e40375540c
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Apr 19 14:38:17 2024 +0200
|
||||
|
||||
login: Check default sizes of structs utmp, utmpx, lastlog
|
||||
|
||||
The default <utmp-size.h> is for ports with a 64-bit time_t.
|
||||
Ports with a 32-bit time_t or with __WORDSIZE_TIME64_COMPAT32=1
|
||||
need to override it.
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
(cherry picked from commit 4d4da5aab936504b2d3eca3146e109630d9093c4)
|
||||
|
||||
diff --git a/login/Makefile b/login/Makefile
|
||||
index 1e22008a61e99083..b26ac42bfceadf89 100644
|
||||
--- a/login/Makefile
|
||||
+++ b/login/Makefile
|
||||
@@ -44,7 +44,7 @@ subdir-dirs = programs
|
||||
vpath %.c programs
|
||||
|
||||
tests := tst-utmp tst-utmpx tst-grantpt tst-ptsname tst-getlogin tst-updwtmpx \
|
||||
- tst-pututxline-lockfail tst-pututxline-cache
|
||||
+ tst-pututxline-lockfail tst-pututxline-cache tst-utmp-size
|
||||
|
||||
# Empty compatibility library for old binaries.
|
||||
extra-libs := libutil
|
||||
diff --git a/login/tst-utmp-size.c b/login/tst-utmp-size.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..1b7f7ff04224efb5
|
||||
--- /dev/null
|
||||
+++ b/login/tst-utmp-size.c
|
||||
@@ -0,0 +1,33 @@
|
||||
+/* Check expected sizes of struct utmp, struct utmpx, struct lastlog.
|
||||
+ Copyright (C) 2024 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 <utmp.h>
|
||||
+#include <utmpx.h>
|
||||
+#include <utmp-size.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ _Static_assert (sizeof (struct utmp) == UTMP_SIZE, "struct utmp size");
|
||||
+ _Static_assert (sizeof (struct utmpx) == UTMP_SIZE, "struct utmpx size");
|
||||
+ _Static_assert (sizeof (struct lastlog) == LASTLOG_SIZE,
|
||||
+ "struct lastlog size");
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/sysdeps/arc/utmp-size.h b/sysdeps/arc/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..a247fcd3dab15f81
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/arc/utmp-size.h
|
||||
@@ -0,0 +1,3 @@
|
||||
+/* arc has less padding than other architectures with 64-bit time_t. */
|
||||
+#define UTMP_SIZE 392
|
||||
+#define LASTLOG_SIZE 296
|
||||
diff --git a/sysdeps/arm/utmp-size.h b/sysdeps/arm/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/arm/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/csky/utmp-size.h b/sysdeps/csky/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/csky/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/generic/utmp-size.h b/sysdeps/generic/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..89dbe878b02301e9
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/generic/utmp-size.h
|
||||
@@ -0,0 +1,23 @@
|
||||
+/* Expected sizes of utmp-related structures stored in files. 64-bit version.
|
||||
+ Copyright (C) 2024 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/>. */
|
||||
+
|
||||
+/* Expected size, in bytes, of struct utmp and struct utmpx. */
|
||||
+#define UTMP_SIZE 400
|
||||
+
|
||||
+/* Expected size, in bytes, of struct lastlog. */
|
||||
+#define LASTLOG_SIZE 296
|
||||
diff --git a/sysdeps/hppa/utmp-size.h b/sysdeps/hppa/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/hppa/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/m68k/utmp-size.h b/sysdeps/m68k/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..5946685819d60289
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/m68k/utmp-size.h
|
||||
@@ -0,0 +1,3 @@
|
||||
+/* m68k has 2-byte alignment. */
|
||||
+#define UTMP_SIZE 382
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/microblaze/utmp-size.h b/sysdeps/microblaze/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/microblaze/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/mips/utmp-size.h b/sysdeps/mips/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/mips/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/nios2/utmp-size.h b/sysdeps/nios2/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/nios2/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/or1k/utmp-size.h b/sysdeps/or1k/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..6b3653aa4dccd59d
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/or1k/utmp-size.h
|
||||
@@ -0,0 +1,3 @@
|
||||
+/* or1k has less padding than other architectures with 64-bit time_t. */
|
||||
+#define UTMP_SIZE 392
|
||||
+#define LASTLOG_SIZE 296
|
||||
diff --git a/sysdeps/powerpc/utmp-size.h b/sysdeps/powerpc/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/powerpc/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/riscv/utmp-size.h b/sysdeps/riscv/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/riscv/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/sh/utmp-size.h b/sysdeps/sh/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/sh/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/sparc/utmp-size.h b/sysdeps/sparc/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/sparc/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
||||
diff --git a/sysdeps/x86/utmp-size.h b/sysdeps/x86/utmp-size.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..8f21ebe1b6c26ea1
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/x86/utmp-size.h
|
||||
@@ -0,0 +1,2 @@
|
||||
+#define UTMP_SIZE 384
|
||||
+#define LASTLOG_SIZE 292
|
@ -0,0 +1,368 @@
|
||||
commit 836d43b98973e0845b739ff5d3aad3af09dc7d0f
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Apr 19 14:38:17 2024 +0200
|
||||
|
||||
login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701)
|
||||
|
||||
These structs describe file formats under /var/log, and should not
|
||||
depend on the definition of _TIME_BITS. This is achieved by
|
||||
defining __WORDSIZE_TIME64_COMPAT32 to 1 on 32-bit ports that
|
||||
support 32-bit time_t values (where __time_t is 32 bits).
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
(cherry picked from commit 9abdae94c7454c45e02e97e4ed1eb1b1915d13d8)
|
||||
|
||||
diff --git a/bits/wordsize.h b/bits/wordsize.h
|
||||
index 14edae3a11d01c97..53013a9275c7c81e 100644
|
||||
--- a/bits/wordsize.h
|
||||
+++ b/bits/wordsize.h
|
||||
@@ -21,7 +21,9 @@
|
||||
#define __WORDSIZE32_PTRDIFF_LONG
|
||||
|
||||
/* Set to 1 in order to force time types to be 32 bits instead of 64 bits in
|
||||
- struct lastlog and struct utmp{,x} on 64-bit ports. This may be done in
|
||||
+ struct lastlog and struct utmp{,x}. This may be done in
|
||||
order to make 64-bit ports compatible with 32-bit ports. Set to 0 for
|
||||
- 64-bit ports where the time types are 64-bits or for any 32-bit ports. */
|
||||
+ 64-bit ports where the time types are 64-bits and new 32-bit ports
|
||||
+ where time_t is 64 bits, and there is no companion architecture with
|
||||
+ 32-bit time_t. */
|
||||
#define __WORDSIZE_TIME64_COMPAT32
|
||||
diff --git a/login/Makefile b/login/Makefile
|
||||
index b26ac42bfceadf89..f91190e3dcd1e6c6 100644
|
||||
--- a/login/Makefile
|
||||
+++ b/login/Makefile
|
||||
@@ -44,7 +44,9 @@ subdir-dirs = programs
|
||||
vpath %.c programs
|
||||
|
||||
tests := tst-utmp tst-utmpx tst-grantpt tst-ptsname tst-getlogin tst-updwtmpx \
|
||||
- tst-pututxline-lockfail tst-pututxline-cache tst-utmp-size
|
||||
+ tst-pututxline-lockfail tst-pututxline-cache tst-utmp-size tst-utmp-size-64
|
||||
+
|
||||
+CFLAGS-tst-utmp-size-64.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
|
||||
|
||||
# Empty compatibility library for old binaries.
|
||||
extra-libs := libutil
|
||||
diff --git a/login/tst-utmp-size-64.c b/login/tst-utmp-size-64.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..7a581a4c1254644a
|
||||
--- /dev/null
|
||||
+++ b/login/tst-utmp-size-64.c
|
||||
@@ -0,0 +1,2 @@
|
||||
+/* The on-disk layout must not change in time64 mode. */
|
||||
+#include "tst-utmp-size.c"
|
||||
diff --git a/sysdeps/arm/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..6ecbfe7c863f3a17
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/arm/bits/wordsize.h
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* Copyright (C) 1999-2024 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/>. */
|
||||
+
|
||||
+#define __WORDSIZE 32
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
+#define __WORDSIZE32_SIZE_ULONG 0
|
||||
+#define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
diff --git a/sysdeps/csky/bits/wordsize.h b/sysdeps/csky/bits/wordsize.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..6ecbfe7c863f3a17
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/csky/bits/wordsize.h
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* Copyright (C) 1999-2024 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/>. */
|
||||
+
|
||||
+#define __WORDSIZE 32
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
+#define __WORDSIZE32_SIZE_ULONG 0
|
||||
+#define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
diff --git a/sysdeps/m68k/bits/wordsize.h b/sysdeps/m68k/bits/wordsize.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..6ecbfe7c863f3a17
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/m68k/bits/wordsize.h
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* Copyright (C) 1999-2024 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/>. */
|
||||
+
|
||||
+#define __WORDSIZE 32
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
+#define __WORDSIZE32_SIZE_ULONG 0
|
||||
+#define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
diff --git a/sysdeps/microblaze/bits/wordsize.h b/sysdeps/microblaze/bits/wordsize.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..6ecbfe7c863f3a17
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/microblaze/bits/wordsize.h
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* Copyright (C) 1999-2024 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/>. */
|
||||
+
|
||||
+#define __WORDSIZE 32
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
+#define __WORDSIZE32_SIZE_ULONG 0
|
||||
+#define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
diff --git a/sysdeps/mips/bits/wordsize.h b/sysdeps/mips/bits/wordsize.h
|
||||
index 57f0f2a22f81745c..30dd3fd85db1f966 100644
|
||||
--- a/sysdeps/mips/bits/wordsize.h
|
||||
+++ b/sysdeps/mips/bits/wordsize.h
|
||||
@@ -19,11 +19,7 @@
|
||||
|
||||
#define __WORDSIZE _MIPS_SZPTR
|
||||
|
||||
-#if _MIPS_SIM == _ABI64
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 1
|
||||
-#else
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 0
|
||||
-#endif
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
|
||||
#if __WORDSIZE == 32
|
||||
#define __WORDSIZE32_SIZE_ULONG 0
|
||||
diff --git a/sysdeps/nios2/bits/wordsize.h b/sysdeps/nios2/bits/wordsize.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..6ecbfe7c863f3a17
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/nios2/bits/wordsize.h
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* Copyright (C) 1999-2024 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/>. */
|
||||
+
|
||||
+#define __WORDSIZE 32
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
+#define __WORDSIZE32_SIZE_ULONG 0
|
||||
+#define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
diff --git a/sysdeps/powerpc/powerpc32/bits/wordsize.h b/sysdeps/powerpc/powerpc32/bits/wordsize.h
|
||||
index 04ca9debf00d7ee9..6993fb6b29ea3f74 100644
|
||||
--- a/sysdeps/powerpc/powerpc32/bits/wordsize.h
|
||||
+++ b/sysdeps/powerpc/powerpc32/bits/wordsize.h
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
#if defined __powerpc64__
|
||||
# define __WORDSIZE 64
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 1
|
||||
#else
|
||||
# define __WORDSIZE 32
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 0
|
||||
# define __WORDSIZE32_SIZE_ULONG 0
|
||||
# define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
#endif
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
diff --git a/sysdeps/powerpc/powerpc64/bits/wordsize.h b/sysdeps/powerpc/powerpc64/bits/wordsize.h
|
||||
index 04ca9debf00d7ee9..6993fb6b29ea3f74 100644
|
||||
--- a/sysdeps/powerpc/powerpc64/bits/wordsize.h
|
||||
+++ b/sysdeps/powerpc/powerpc64/bits/wordsize.h
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
#if defined __powerpc64__
|
||||
# define __WORDSIZE 64
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 1
|
||||
#else
|
||||
# define __WORDSIZE 32
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 0
|
||||
# define __WORDSIZE32_SIZE_ULONG 0
|
||||
# define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
#endif
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
diff --git a/sysdeps/sh/bits/wordsize.h b/sysdeps/sh/bits/wordsize.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..6ecbfe7c863f3a17
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/sh/bits/wordsize.h
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* Copyright (C) 1999-2024 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/>. */
|
||||
+
|
||||
+#define __WORDSIZE 32
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
+#define __WORDSIZE32_SIZE_ULONG 0
|
||||
+#define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
diff --git a/sysdeps/sparc/sparc32/bits/wordsize.h b/sysdeps/sparc/sparc32/bits/wordsize.h
|
||||
index 4bbd2e63b49bb2e2..a2e79e0fa9dc41d9 100644
|
||||
--- a/sysdeps/sparc/sparc32/bits/wordsize.h
|
||||
+++ b/sysdeps/sparc/sparc32/bits/wordsize.h
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Determine the wordsize from the preprocessor defines. */
|
||||
|
||||
#define __WORDSIZE 32
|
||||
-#define __WORDSIZE_TIME64_COMPAT32 0
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
#define __WORDSIZE32_SIZE_ULONG 0
|
||||
#define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
diff --git a/sysdeps/sparc/sparc64/bits/wordsize.h b/sysdeps/sparc/sparc64/bits/wordsize.h
|
||||
index 2f66f10d7206731a..ea103e5970829abc 100644
|
||||
--- a/sysdeps/sparc/sparc64/bits/wordsize.h
|
||||
+++ b/sysdeps/sparc/sparc64/bits/wordsize.h
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
#if defined __arch64__ || defined __sparcv9
|
||||
# define __WORDSIZE 64
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 1
|
||||
#else
|
||||
# define __WORDSIZE 32
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 0
|
||||
# define __WORDSIZE32_SIZE_ULONG 0
|
||||
# define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
#endif
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/wordsize.h b/sysdeps/unix/sysv/linux/hppa/bits/wordsize.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..6ecbfe7c863f3a17
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/unix/sysv/linux/hppa/bits/wordsize.h
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* Copyright (C) 1999-2024 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/>. */
|
||||
+
|
||||
+#define __WORDSIZE 32
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
+#define __WORDSIZE32_SIZE_ULONG 0
|
||||
+#define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
|
||||
index 04ca9debf00d7ee9..6993fb6b29ea3f74 100644
|
||||
--- a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
|
||||
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
#if defined __powerpc64__
|
||||
# define __WORDSIZE 64
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 1
|
||||
#else
|
||||
# define __WORDSIZE 32
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 0
|
||||
# define __WORDSIZE32_SIZE_ULONG 0
|
||||
# define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
#endif
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
|
||||
index 7562875ee23ba8c5..ea103e5970829abc 100644
|
||||
--- a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
|
||||
+++ b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
#if defined __arch64__ || defined __sparcv9
|
||||
# define __WORDSIZE 64
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 1
|
||||
#else
|
||||
# define __WORDSIZE 32
|
||||
# define __WORDSIZE32_SIZE_ULONG 0
|
||||
# define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 0
|
||||
#endif
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
diff --git a/sysdeps/x86/bits/wordsize.h b/sysdeps/x86/bits/wordsize.h
|
||||
index 70f652bca14d65c1..3f40aa76f99c75e5 100644
|
||||
--- a/sysdeps/x86/bits/wordsize.h
|
||||
+++ b/sysdeps/x86/bits/wordsize.h
|
||||
@@ -8,10 +8,9 @@
|
||||
#define __WORDSIZE32_PTRDIFF_LONG 0
|
||||
#endif
|
||||
|
||||
+#define __WORDSIZE_TIME64_COMPAT32 1
|
||||
+
|
||||
#ifdef __x86_64__
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 1
|
||||
/* Both x86-64 and x32 use the 64-bit system call interface. */
|
||||
# define __SYSCALL_WORDSIZE 64
|
||||
-#else
|
||||
-# define __WORDSIZE_TIME64_COMPAT32 0
|
||||
#endif
|
@ -0,0 +1,31 @@
|
||||
commit acc56074b0a5127631a64640aef1b7c5c103ebd8
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu May 2 17:06:19 2024 +0200
|
||||
|
||||
nscd: Use time_t for return type of addgetnetgrentX
|
||||
|
||||
Using int may give false results for future dates (timeouts after the
|
||||
year 2028).
|
||||
|
||||
Fixes commit 04a21e050d64a1193a6daab872bca2528bda44b ("CVE-2024-33601,
|
||||
CVE-2024-33602: nscd: netgroup: Use two buffers in addgetnetgrentX
|
||||
(bug 31680)").
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit 4bbca1a44691a6e9adcee5c6798a707b626bc331)
|
||||
|
||||
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
|
||||
index e8fe041846b75cb9..01d554af9c407739 100644
|
||||
--- a/nscd/netgroupcache.c
|
||||
+++ b/nscd/netgroupcache.c
|
||||
@@ -680,8 +680,8 @@ readdinnetgr (struct database_dyn *db, struct hashentry *he,
|
||||
.key_len = he->len
|
||||
};
|
||||
|
||||
- int timeout = addinnetgrX (db, -1, &req, db->data + he->key, he->owner,
|
||||
- he, dh);
|
||||
+ time_t timeout = addinnetgrX (db, -1, &req, db->data + he->key, he->owner,
|
||||
+ he, dh);
|
||||
if (timeout < 0)
|
||||
timeout = 0;
|
||||
return timeout;
|
@ -0,0 +1,73 @@
|
||||
commit 273a835fe7c685cc54266bb8b502787bad5e9bae
|
||||
Author: Carlos O'Donell <carlos@redhat.com>
|
||||
Date: Tue Apr 23 13:30:37 2024 -0400
|
||||
|
||||
time: Allow later version licensing.
|
||||
|
||||
The FSF's Licensing and Compliance Lab noted a discrepancy in the
|
||||
licensing of several files in the glibc package.
|
||||
|
||||
When timespect_get.c was impelemented the license did not include
|
||||
the standard ", or (at your option) any later version." text.
|
||||
|
||||
Change the license in timespec_get.c and all copied files to match
|
||||
the expected license.
|
||||
|
||||
This change was previously approved in principle by the FSF in
|
||||
RT ticket #1316403. And a similar instance was fixed in
|
||||
commit 46703efa02f6ddebce5ee54c92f7c32598de0de6.
|
||||
|
||||
(cherry picked from commit 91695ee4598b39d181ab8df579b888a8863c4cab)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/timespec_get.c b/sysdeps/unix/sysv/linux/timespec_get.c
|
||||
index c6e5e6628928523b..778d1e33548d2369 100644
|
||||
--- a/sysdeps/unix/sysv/linux/timespec_get.c
|
||||
+++ b/sysdeps/unix/sysv/linux/timespec_get.c
|
||||
@@ -5,7 +5,7 @@
|
||||
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.
|
||||
+ 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
|
||||
diff --git a/sysdeps/unix/sysv/linux/timespec_getres.c b/sysdeps/unix/sysv/linux/timespec_getres.c
|
||||
index 5acebe2a2cb99ccf..2eef9e512c6f650e 100644
|
||||
--- a/sysdeps/unix/sysv/linux/timespec_getres.c
|
||||
+++ b/sysdeps/unix/sysv/linux/timespec_getres.c
|
||||
@@ -5,7 +5,7 @@
|
||||
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.
|
||||
+ 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
|
||||
diff --git a/time/timespec_get.c b/time/timespec_get.c
|
||||
index b031e42ca20c1eea..26a044bca6e7f9fe 100644
|
||||
--- a/time/timespec_get.c
|
||||
+++ b/time/timespec_get.c
|
||||
@@ -4,7 +4,7 @@
|
||||
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.
|
||||
+ 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
|
||||
diff --git a/time/timespec_getres.c b/time/timespec_getres.c
|
||||
index edb397507cdfc2fa..2e18b8bcacfec498 100644
|
||||
--- a/time/timespec_getres.c
|
||||
+++ b/time/timespec_getres.c
|
||||
@@ -5,7 +5,7 @@
|
||||
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.
|
||||
+ 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
|
@ -0,0 +1,34 @@
|
||||
commit 3148714ab61ad61281bae5a30f530d637034ac3b
|
||||
Author: Gabi Falk <gabifalk@gmx.com>
|
||||
Date: Tue Apr 30 20:05:02 2024 +0000
|
||||
|
||||
i586: Fix multiple definitions of __memcpy_chk and __mempcpy_chk
|
||||
|
||||
/home/bmg/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/13.2.1/../../../../x86_64-glibc-linux-gnu/bin/ld: /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(memcpy_chk.o): in function `__memcpy_chk':
|
||||
/home/bmg/src/glibc/debug/../sysdeps/i386/memcpy_chk.S:29: multiple definition of `__memcpy_chk';/home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(memcpy.o):/home/bmg/src/glibc/string/../sysdeps/i386/i586/memcpy.S:31: first defined here /home/bmg/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/13.2.1/../../../../x86_64-glibc-linux-gnu/bin/ld: /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(mempcpy_chk.o): in function `__mempcpy_chk': /home/bmg/src/glibc/debug/../sysdeps/i386/mempcpy_chk.S:28: multiple definition of `__mempcpy_chk'; /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(mempcpy.o):/home/bmg/src/glibc/string/../sysdeps/i386/i586/memcpy.S:31: first defined here
|
||||
|
||||
After this change, the static library built for i586, regardless of PIC
|
||||
options, contains implementations of these functions respectively from
|
||||
sysdeps/i386/memcpy_chk.S and sysdeps/i386/mempcpy_chk.S. This ensures
|
||||
that memcpy and mempcpy won't pull in __chk_fail and the routines it
|
||||
calls.
|
||||
|
||||
Reported-by: Florian Weimer <fweimer@redhat.com>
|
||||
Signed-off-by: Gabi Falk <gabifalk@gmx.com>
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
|
||||
(cherry picked from commit 789894a2f554d4503ecb2f13b2b4e93e43414f33)
|
||||
|
||||
diff --git a/sysdeps/i386/i586/memcpy.S b/sysdeps/i386/i586/memcpy.S
|
||||
index 3e26f112d685e148..79856d498af90f66 100644
|
||||
--- a/sysdeps/i386/i586/memcpy.S
|
||||
+++ b/sysdeps/i386/i586/memcpy.S
|
||||
@@ -26,7 +26,7 @@
|
||||
#define LEN SRC+4
|
||||
|
||||
.text
|
||||
-#if defined PIC && IS_IN (libc)
|
||||
+#if defined SHARED && IS_IN (libc)
|
||||
ENTRY (__memcpy_chk)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
@ -0,0 +1,57 @@
|
||||
commit ad92c483a4bd34db1cfb3eb625212ea64848244f
|
||||
Author: Gabi Falk <gabifalk@gmx.com>
|
||||
Date: Tue Apr 30 20:05:03 2024 +0000
|
||||
|
||||
i686: Fix multiple definitions of __memmove_chk and __memset_chk
|
||||
|
||||
Commit c73c96a4a1af1326df7f96eec58209e1e04066d8 updated memcpy.S and
|
||||
mempcpy.S, but omitted memmove.S and memset.S. As a result, the static
|
||||
library built as PIC, whether with or without multiarch support,
|
||||
contains two definitions for each of the __memmove_chk and __memset_chk
|
||||
symbols.
|
||||
|
||||
/usr/lib/gcc/i686-pc-linux-gnu/14/../../../../i686-pc-linux-gnu/bin/ld: /usr/lib/gcc/i686-pc-linux-gnu/14/../../../../lib/libc.a(memset-ia32.o): in function `__memset_chk':
|
||||
/var/tmp/portage/sys-libs/glibc-2.39-r3/work/glibc-2.39/string/../sysdeps/i386/i686/memset.S:32: multiple definition of `__memset_chk'; /usr/lib/gcc/i686-pc-linux-gnu/14/../../../../lib/libc.a(memset_chk.o):/var/tmp/portage/sys-libs/glibc-2.39-r3/work/glibc-2.39/debug/../sysdeps/i386/i686/multiarch/memset_chk.c:24: first defined here
|
||||
|
||||
After this change, regardless of PIC options, the static library, built
|
||||
for i686 with multiarch contains implementations of these functions
|
||||
respectively from debug/memmove_chk.c and debug/memset_chk.c, and
|
||||
without multiarch contains implementations of these functions
|
||||
respectively from sysdeps/i386/memmove_chk.S and
|
||||
sysdeps/i386/memset_chk.S. This ensures that memmove and memset won't
|
||||
pull in __chk_fail and the routines it calls.
|
||||
|
||||
Reported-by: Sam James <sam@gentoo.org>
|
||||
Tested-by: Sam James <sam@gentoo.org>
|
||||
Fixes: c73c96a4a1 ("i686: Fix build with --disable-multiarch")
|
||||
Signed-off-by: Gabi Falk <gabifalk@gmx.com>
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
|
||||
(cherry picked from commit 5a2cf833f5772d6c37c7adac388dd9af9cc1c4b9)
|
||||
|
||||
diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S
|
||||
index f230359ad62b2443..effd958120082b04 100644
|
||||
--- a/sysdeps/i386/i686/memmove.S
|
||||
+++ b/sysdeps/i386/i686/memmove.S
|
||||
@@ -29,7 +29,7 @@
|
||||
#define SRC DEST+4
|
||||
#define LEN SRC+4
|
||||
|
||||
-#if defined PIC && IS_IN (libc)
|
||||
+#if defined SHARED && IS_IN (libc)
|
||||
ENTRY_CHK (__memmove_chk)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
||||
diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S
|
||||
index f02f5a6df763d4e9..ab06771ea0ca071f 100644
|
||||
--- a/sysdeps/i386/i686/memset.S
|
||||
+++ b/sysdeps/i386/i686/memset.S
|
||||
@@ -27,7 +27,7 @@
|
||||
#define LEN CHR+4
|
||||
|
||||
.text
|
||||
-#if defined PIC && IS_IN (libc)
|
||||
+#if defined SHARED && IS_IN (libc)
|
||||
ENTRY_CHK (__memset_chk)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
@ -0,0 +1,34 @@
|
||||
commit ff110b2591f0bdeccd121c3726af19c62d6fb184
|
||||
Author: Gabi Falk <gabifalk@gmx.com>
|
||||
Date: Tue Apr 30 20:05:04 2024 +0000
|
||||
|
||||
Add a test to check for duplicate definitions in the static library
|
||||
|
||||
This change follows two previous fixes addressing multiple definitions
|
||||
of __memcpy_chk and __mempcpy_chk functions on i586, and __memmove_chk
|
||||
and __memset_chk functions on i686. The test is intended to prevent
|
||||
such issues from occurring in the future.
|
||||
|
||||
Signed-off-by: Gabi Falk <gabifalk@gmx.com>
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
|
||||
(cherry picked from commit ded2e0753e9c46debeb2e0d26c5e560d2581d314)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index f7e4eb9ff2cc464c..37bf70aa4ad4403f 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -577,6 +577,13 @@ $(objpfx)lint-makefiles.out: scripts/lint-makefiles.sh
|
||||
$(SHELL) $< "$(PYTHON)" `pwd` > $@ ; \
|
||||
$(evaluate-test)
|
||||
|
||||
+# Link libc.a as a whole to verify that it does not contain multiple
|
||||
+# definitions of any symbols.
|
||||
+tests-special += $(objpfx)link-static-libc.out
|
||||
+$(objpfx)link-static-libc.out:
|
||||
+ $(LINK.o) $(whole-archive) -r $(objpfx)libc.a -o /dev/null > $@ 2>&1; \
|
||||
+ $(evaluate-test)
|
||||
+
|
||||
# Print test summary for tests in $1 .sum file;
|
||||
# $2 is optional test identifier.
|
||||
# Fail if there are unexpected failures in the test results.
|
@ -0,0 +1,32 @@
|
||||
commit fa616ea3730cb42046d19f28d611be0bc390af7c
|
||||
Author: Sam James <sam@gentoo.org>
|
||||
Date: Sat May 4 13:28:13 2024 +0100
|
||||
|
||||
Revert "Add a test to check for duplicate definitions in the static library"
|
||||
|
||||
This reverts commit ff110b2591f0bdeccd121c3726af19c62d6fb184.
|
||||
|
||||
I had the wrong cherry-pick reference (the commit content is right; it's
|
||||
just referring to a base that isn't upstream), but let's revert and reapply
|
||||
for clarity.
|
||||
|
||||
Signed-off-by: Sam James <sam@gentoo.org>
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 37bf70aa4ad4403f..f7e4eb9ff2cc464c 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -577,13 +577,6 @@ $(objpfx)lint-makefiles.out: scripts/lint-makefiles.sh
|
||||
$(SHELL) $< "$(PYTHON)" `pwd` > $@ ; \
|
||||
$(evaluate-test)
|
||||
|
||||
-# Link libc.a as a whole to verify that it does not contain multiple
|
||||
-# definitions of any symbols.
|
||||
-tests-special += $(objpfx)link-static-libc.out
|
||||
-$(objpfx)link-static-libc.out:
|
||||
- $(LINK.o) $(whole-archive) -r $(objpfx)libc.a -o /dev/null > $@ 2>&1; \
|
||||
- $(evaluate-test)
|
||||
-
|
||||
# Print test summary for tests in $1 .sum file;
|
||||
# $2 is optional test identifier.
|
||||
# Fail if there are unexpected failures in the test results.
|
@ -0,0 +1,40 @@
|
||||
commit c16871e662cd0f3370173d916864b19e69f1bc9a
|
||||
Author: Sam James <sam@gentoo.org>
|
||||
Date: Sat May 4 13:28:51 2024 +0100
|
||||
|
||||
Revert "i686: Fix multiple definitions of __memmove_chk and __memset_chk"
|
||||
|
||||
This reverts commit ad92c483a4bd34db1cfb3eb625212ea64848244f.
|
||||
|
||||
I had the wrong cherry-pick reference (the commit content is right; it's
|
||||
just referring to a base that isn't upstream), but let's revert and reapply
|
||||
for clarity.
|
||||
|
||||
Signed-off-by: Sam James <sam@gentoo.org>
|
||||
|
||||
diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S
|
||||
index effd958120082b04..f230359ad62b2443 100644
|
||||
--- a/sysdeps/i386/i686/memmove.S
|
||||
+++ b/sysdeps/i386/i686/memmove.S
|
||||
@@ -29,7 +29,7 @@
|
||||
#define SRC DEST+4
|
||||
#define LEN SRC+4
|
||||
|
||||
-#if defined SHARED && IS_IN (libc)
|
||||
+#if defined PIC && IS_IN (libc)
|
||||
ENTRY_CHK (__memmove_chk)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
||||
diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S
|
||||
index ab06771ea0ca071f..f02f5a6df763d4e9 100644
|
||||
--- a/sysdeps/i386/i686/memset.S
|
||||
+++ b/sysdeps/i386/i686/memset.S
|
||||
@@ -27,7 +27,7 @@
|
||||
#define LEN CHR+4
|
||||
|
||||
.text
|
||||
-#if defined SHARED && IS_IN (libc)
|
||||
+#if defined PIC && IS_IN (libc)
|
||||
ENTRY_CHK (__memset_chk)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
@ -0,0 +1,27 @@
|
||||
commit 5141d4d83c17406f0eaea3e345ef2b52e10f386e
|
||||
Author: Sam James <sam@gentoo.org>
|
||||
Date: Sat May 4 13:28:54 2024 +0100
|
||||
|
||||
Revert "i586: Fix multiple definitions of __memcpy_chk and __mempcpy_chk"
|
||||
|
||||
This reverts commit 3148714ab61ad61281bae5a30f530d637034ac3b.
|
||||
|
||||
I had the wrong cherry-pick reference (the commit content is right; it's
|
||||
just referring to a base that isn't upstream), but let's revert and reapply
|
||||
for clarity.
|
||||
|
||||
Signed-off-by: Sam James <sam@gentoo.org>
|
||||
|
||||
diff --git a/sysdeps/i386/i586/memcpy.S b/sysdeps/i386/i586/memcpy.S
|
||||
index 79856d498af90f66..3e26f112d685e148 100644
|
||||
--- a/sysdeps/i386/i586/memcpy.S
|
||||
+++ b/sysdeps/i386/i586/memcpy.S
|
||||
@@ -26,7 +26,7 @@
|
||||
#define LEN SRC+4
|
||||
|
||||
.text
|
||||
-#if defined SHARED && IS_IN (libc)
|
||||
+#if defined PIC && IS_IN (libc)
|
||||
ENTRY (__memcpy_chk)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
@ -0,0 +1,143 @@
|
||||
commit e0910f1d3278f05439fb434ee528fc9be1b6bd5e
|
||||
Author: Stefan Liebler <stli@linux.ibm.com>
|
||||
Date: Thu Feb 22 15:03:27 2024 +0100
|
||||
|
||||
S390: Do not clobber r7 in clone [BZ #31402]
|
||||
|
||||
Starting with commit e57d8fc97b90127de4ed3e3a9cdf663667580935
|
||||
"S390: Always use svc 0"
|
||||
clone clobbers the call-saved register r7 in error case:
|
||||
function or stack is NULL.
|
||||
|
||||
This patch restores the saved registers also in the error case.
|
||||
Furthermore the existing test misc/tst-clone is extended to check
|
||||
all error cases and that clone does not clobber registers in this
|
||||
error case.
|
||||
|
||||
(cherry picked from commit 02782fd12849b6673cb5c2728cb750e8ec295aa3)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
|
||||
index 4c882ef2ee3f5b81..a7a863242c4ebd84 100644
|
||||
--- a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
|
||||
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
|
||||
@@ -53,6 +53,7 @@ ENTRY(__clone)
|
||||
br %r14
|
||||
error:
|
||||
lhi %r2,-EINVAL
|
||||
+ lm %r6,%r7,24(%r15) /* Load registers. */
|
||||
j SYSCALL_ERROR_LABEL
|
||||
PSEUDO_END (__clone)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
|
||||
index 4eb104be71ee565a..c552a6b8decb63de 100644
|
||||
--- a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
|
||||
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
|
||||
@@ -54,6 +54,7 @@ ENTRY(__clone)
|
||||
br %r14
|
||||
error:
|
||||
lghi %r2,-EINVAL
|
||||
+ lmg %r6,%r7,48(%r15) /* Restore registers. */
|
||||
jg SYSCALL_ERROR_LABEL
|
||||
PSEUDO_END (__clone)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/tst-clone.c b/sysdeps/unix/sysv/linux/tst-clone.c
|
||||
index 470676ab2bb3fc31..2bc71249837fbb66 100644
|
||||
--- a/sysdeps/unix/sysv/linux/tst-clone.c
|
||||
+++ b/sysdeps/unix/sysv/linux/tst-clone.c
|
||||
@@ -16,12 +16,16 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
-/* BZ #2386 */
|
||||
+/* BZ #2386, BZ #31402 */
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
+#include <stackinfo.h> /* For _STACK_GROWS_{UP,DOWN}. */
|
||||
+#include <support/check.h>
|
||||
+
|
||||
+volatile unsigned v = 0xdeadbeef;
|
||||
|
||||
int child_fn(void *arg)
|
||||
{
|
||||
@@ -30,22 +34,67 @@ int child_fn(void *arg)
|
||||
}
|
||||
|
||||
static int
|
||||
-do_test (void)
|
||||
+__attribute__((noinline))
|
||||
+do_clone (int (*fn)(void *), void *stack)
|
||||
{
|
||||
int result;
|
||||
+ unsigned int a = v;
|
||||
+ unsigned int b = v;
|
||||
+ unsigned int c = v;
|
||||
+ unsigned int d = v;
|
||||
+ unsigned int e = v;
|
||||
+ unsigned int f = v;
|
||||
+ unsigned int g = v;
|
||||
+ unsigned int h = v;
|
||||
+ unsigned int i = v;
|
||||
+ unsigned int j = v;
|
||||
+ unsigned int k = v;
|
||||
+ unsigned int l = v;
|
||||
+ unsigned int m = v;
|
||||
+ unsigned int n = v;
|
||||
+ unsigned int o = v;
|
||||
+
|
||||
+ result = clone (fn, stack, 0, NULL);
|
||||
+
|
||||
+ /* Check that clone does not clobber call-saved registers. */
|
||||
+ TEST_VERIFY (a == v && b == v && c == v && d == v && e == v && f == v
|
||||
+ && g == v && h == v && i == v && j == v && k == v && l == v
|
||||
+ && m == v && n == v && o == v);
|
||||
+
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+__attribute__((noinline))
|
||||
+do_test_single (int (*fn)(void *), void *stack)
|
||||
+{
|
||||
+ printf ("%s (fn=%p, stack=%p)\n", __FUNCTION__, fn, stack);
|
||||
+ errno = 0;
|
||||
+
|
||||
+ int result = do_clone (fn, stack);
|
||||
+
|
||||
+ TEST_COMPARE (errno, EINVAL);
|
||||
+ TEST_COMPARE (result, -1);
|
||||
+}
|
||||
|
||||
- result = clone (child_fn, NULL, 0, NULL);
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ char st[128 * 1024] __attribute__ ((aligned));
|
||||
+ void *stack = NULL;
|
||||
+#if _STACK_GROWS_DOWN
|
||||
+ stack = st + sizeof (st);
|
||||
+#elif _STACK_GROWS_UP
|
||||
+ stack = st;
|
||||
+#else
|
||||
+# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
|
||||
+#endif
|
||||
|
||||
- if (errno != EINVAL || result != -1)
|
||||
- {
|
||||
- printf ("FAIL: clone()=%d (wanted -1) errno=%d (wanted %d)\n",
|
||||
- result, errno, EINVAL);
|
||||
- return 1;
|
||||
- }
|
||||
+ do_test_single (child_fn, NULL);
|
||||
+ do_test_single (NULL, stack);
|
||||
+ do_test_single (NULL, NULL);
|
||||
|
||||
- puts ("All OK");
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#define TEST_FUNCTION do_test ()
|
||||
-#include "../test-skeleton.c"
|
||||
+#include <support/test-driver.c>
|
@ -0,0 +1,34 @@
|
||||
commit 8323a83abd73446dc434aceff66219712c09140b
|
||||
Author: Gabi Falk <gabifalk@gmx.com>
|
||||
Date: Tue Apr 30 20:05:02 2024 +0000
|
||||
|
||||
i586: Fix multiple definitions of __memcpy_chk and __mempcpy_chk
|
||||
|
||||
/home/bmg/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/13.2.1/../../../../x86_64-glibc-linux-gnu/bin/ld: /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(memcpy_chk.o): in function `__memcpy_chk':
|
||||
/home/bmg/src/glibc/debug/../sysdeps/i386/memcpy_chk.S:29: multiple definition of `__memcpy_chk';/home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(memcpy.o):/home/bmg/src/glibc/string/../sysdeps/i386/i586/memcpy.S:31: first defined here /home/bmg/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/13.2.1/../../../../x86_64-glibc-linux-gnu/bin/ld: /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(mempcpy_chk.o): in function `__mempcpy_chk': /home/bmg/src/glibc/debug/../sysdeps/i386/mempcpy_chk.S:28: multiple definition of `__mempcpy_chk'; /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(mempcpy.o):/home/bmg/src/glibc/string/../sysdeps/i386/i586/memcpy.S:31: first defined here
|
||||
|
||||
After this change, the static library built for i586, regardless of PIC
|
||||
options, contains implementations of these functions respectively from
|
||||
sysdeps/i386/memcpy_chk.S and sysdeps/i386/mempcpy_chk.S. This ensures
|
||||
that memcpy and mempcpy won't pull in __chk_fail and the routines it
|
||||
calls.
|
||||
|
||||
Reported-by: Florian Weimer <fweimer@redhat.com>
|
||||
Signed-off-by: Gabi Falk <gabifalk@gmx.com>
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
|
||||
(cherry picked from commit 0fdf4ba48ccce5abf567340b0ab8fa8ed8a9bc6e)
|
||||
|
||||
diff --git a/sysdeps/i386/i586/memcpy.S b/sysdeps/i386/i586/memcpy.S
|
||||
index 3e26f112d685e148..79856d498af90f66 100644
|
||||
--- a/sysdeps/i386/i586/memcpy.S
|
||||
+++ b/sysdeps/i386/i586/memcpy.S
|
||||
@@ -26,7 +26,7 @@
|
||||
#define LEN SRC+4
|
||||
|
||||
.text
|
||||
-#if defined PIC && IS_IN (libc)
|
||||
+#if defined SHARED && IS_IN (libc)
|
||||
ENTRY (__memcpy_chk)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
@ -0,0 +1,57 @@
|
||||
commit 8b005d7869debac4d5cd67f65e49a0fad89da9ad
|
||||
Author: Gabi Falk <gabifalk@gmx.com>
|
||||
Date: Tue Apr 30 20:05:03 2024 +0000
|
||||
|
||||
i686: Fix multiple definitions of __memmove_chk and __memset_chk
|
||||
|
||||
Commit c73c96a4a1af1326df7f96eec58209e1e04066d8 updated memcpy.S and
|
||||
mempcpy.S, but omitted memmove.S and memset.S. As a result, the static
|
||||
library built as PIC, whether with or without multiarch support,
|
||||
contains two definitions for each of the __memmove_chk and __memset_chk
|
||||
symbols.
|
||||
|
||||
/usr/lib/gcc/i686-pc-linux-gnu/14/../../../../i686-pc-linux-gnu/bin/ld: /usr/lib/gcc/i686-pc-linux-gnu/14/../../../../lib/libc.a(memset-ia32.o): in function `__memset_chk':
|
||||
/var/tmp/portage/sys-libs/glibc-2.39-r3/work/glibc-2.39/string/../sysdeps/i386/i686/memset.S:32: multiple definition of `__memset_chk'; /usr/lib/gcc/i686-pc-linux-gnu/14/../../../../lib/libc.a(memset_chk.o):/var/tmp/portage/sys-libs/glibc-2.39-r3/work/glibc-2.39/debug/../sysdeps/i386/i686/multiarch/memset_chk.c:24: first defined here
|
||||
|
||||
After this change, regardless of PIC options, the static library, built
|
||||
for i686 with multiarch contains implementations of these functions
|
||||
respectively from debug/memmove_chk.c and debug/memset_chk.c, and
|
||||
without multiarch contains implementations of these functions
|
||||
respectively from sysdeps/i386/memmove_chk.S and
|
||||
sysdeps/i386/memset_chk.S. This ensures that memmove and memset won't
|
||||
pull in __chk_fail and the routines it calls.
|
||||
|
||||
Reported-by: Sam James <sam@gentoo.org>
|
||||
Tested-by: Sam James <sam@gentoo.org>
|
||||
Fixes: c73c96a4a1 ("i686: Fix build with --disable-multiarch")
|
||||
Signed-off-by: Gabi Falk <gabifalk@gmx.com>
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
|
||||
(cherry picked from commit 5a2cf833f5772d6c37c7adac388dd9af9cc1c4b9)
|
||||
|
||||
diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S
|
||||
index f230359ad62b2443..effd958120082b04 100644
|
||||
--- a/sysdeps/i386/i686/memmove.S
|
||||
+++ b/sysdeps/i386/i686/memmove.S
|
||||
@@ -29,7 +29,7 @@
|
||||
#define SRC DEST+4
|
||||
#define LEN SRC+4
|
||||
|
||||
-#if defined PIC && IS_IN (libc)
|
||||
+#if defined SHARED && IS_IN (libc)
|
||||
ENTRY_CHK (__memmove_chk)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
||||
diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S
|
||||
index f02f5a6df763d4e9..ab06771ea0ca071f 100644
|
||||
--- a/sysdeps/i386/i686/memset.S
|
||||
+++ b/sysdeps/i386/i686/memset.S
|
||||
@@ -27,7 +27,7 @@
|
||||
#define LEN CHR+4
|
||||
|
||||
.text
|
||||
-#if defined PIC && IS_IN (libc)
|
||||
+#if defined SHARED && IS_IN (libc)
|
||||
ENTRY_CHK (__memset_chk)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
@ -0,0 +1,34 @@
|
||||
commit f8e462342189525e4605cf233b8f798d1c7f398d
|
||||
Author: Gabi Falk <gabifalk@gmx.com>
|
||||
Date: Tue Apr 30 20:05:04 2024 +0000
|
||||
|
||||
Add a test to check for duplicate definitions in the static library
|
||||
|
||||
This change follows two previous fixes addressing multiple definitions
|
||||
of __memcpy_chk and __mempcpy_chk functions on i586, and __memmove_chk
|
||||
and __memset_chk functions on i686. The test is intended to prevent
|
||||
such issues from occurring in the future.
|
||||
|
||||
Signed-off-by: Gabi Falk <gabifalk@gmx.com>
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
|
||||
(cherry picked from commit ded2e0753e9c46debeb2e0d26c5e560d2581d314)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index f7e4eb9ff2cc464c..37bf70aa4ad4403f 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -577,6 +577,13 @@ $(objpfx)lint-makefiles.out: scripts/lint-makefiles.sh
|
||||
$(SHELL) $< "$(PYTHON)" `pwd` > $@ ; \
|
||||
$(evaluate-test)
|
||||
|
||||
+# Link libc.a as a whole to verify that it does not contain multiple
|
||||
+# definitions of any symbols.
|
||||
+tests-special += $(objpfx)link-static-libc.out
|
||||
+$(objpfx)link-static-libc.out:
|
||||
+ $(LINK.o) $(whole-archive) -r $(objpfx)libc.a -o /dev/null > $@ 2>&1; \
|
||||
+ $(evaluate-test)
|
||||
+
|
||||
# Print test summary for tests in $1 .sum file;
|
||||
# $2 is optional test identifier.
|
||||
# Fail if there are unexpected failures in the test results.
|
@ -0,0 +1,207 @@
|
||||
commit 71149c2a2e85a8233631cc816030d449f021bb2a
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Mon May 6 13:18:45 2024 -0300
|
||||
|
||||
elf: Only process multiple tunable once (BZ 31686)
|
||||
|
||||
The 680c597e9c3 commit made loader reject ill-formatted strings by
|
||||
first tracking all set tunables and then applying them. However, it does
|
||||
not take into consideration if the same tunable is set multiple times,
|
||||
where parse_tunables_string appends the found tunable without checking
|
||||
if it was already in the list. It leads to a stack-based buffer overflow
|
||||
if the tunable is specified more than the total number of tunables. For
|
||||
instance:
|
||||
|
||||
GLIBC_TUNABLES=glibc.malloc.check=2:... (repeat over the number of
|
||||
total support for different tunable).
|
||||
|
||||
Instead, use the index of the tunable list to get the expected tunable
|
||||
entry. Since now the initial list is zero-initialized, the compiler
|
||||
might emit an extra memset and this requires some minor adjustment
|
||||
on some ports.
|
||||
|
||||
Checked on x86_64-linux-gnu and aarch64-linux-gnu.
|
||||
|
||||
Reported-by: Yuto Maeda <maeda@cyberdefense.jp>
|
||||
Reported-by: Yutaro Shimizu <shimizu@cyberdefense.jp>
|
||||
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
(cherry picked from commit bcae44ea8536b30a7119c0986ff5692bddacb672)
|
||||
|
||||
diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
|
||||
index 03e1a68675d65224..614ac9c0471c5963 100644
|
||||
--- a/elf/dl-tunables.c
|
||||
+++ b/elf/dl-tunables.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <ldsodefs.h>
|
||||
#include <array_length.h>
|
||||
#include <dl-minimal-malloc.h>
|
||||
+#include <dl-symbol-redir-ifunc.h>
|
||||
|
||||
#define TUNABLES_INTERNAL 1
|
||||
#include "dl-tunables.h"
|
||||
@@ -223,6 +224,7 @@ parse_tunables_string (const char *valstring, struct tunable_toset_t *tunables)
|
||||
{
|
||||
tunables[ntunables++] =
|
||||
(struct tunable_toset_t) { cur, value, p - value };
|
||||
+
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -234,23 +236,27 @@ parse_tunables_string (const char *valstring, struct tunable_toset_t *tunables)
|
||||
static void
|
||||
parse_tunables (const char *valstring)
|
||||
{
|
||||
- struct tunable_toset_t tunables[tunables_list_size];
|
||||
- int ntunables = parse_tunables_string (valstring, tunables);
|
||||
- if (ntunables == -1)
|
||||
+ struct tunable_toset_t tunables[tunables_list_size] = { 0 };
|
||||
+ if (parse_tunables_string (valstring, tunables) == -1)
|
||||
{
|
||||
_dl_error_printf (
|
||||
"WARNING: ld.so: invalid GLIBC_TUNABLES `%s': ignored.\n", valstring);
|
||||
return;
|
||||
}
|
||||
|
||||
- for (int i = 0; i < ntunables; i++)
|
||||
- if (!tunable_initialize (tunables[i].t, tunables[i].value,
|
||||
- tunables[i].len))
|
||||
- _dl_error_printf ("WARNING: ld.so: invalid GLIBC_TUNABLES value `%.*s' "
|
||||
- "for option `%s': ignored.\n",
|
||||
- (int) tunables[i].len,
|
||||
- tunables[i].value,
|
||||
- tunables[i].t->name);
|
||||
+ for (int i = 0; i < tunables_list_size; i++)
|
||||
+ {
|
||||
+ if (tunables[i].t == NULL)
|
||||
+ continue;
|
||||
+
|
||||
+ if (!tunable_initialize (tunables[i].t, tunables[i].value,
|
||||
+ tunables[i].len))
|
||||
+ _dl_error_printf ("WARNING: ld.so: invalid GLIBC_TUNABLES value `%.*s' "
|
||||
+ "for option `%s': ignored.\n",
|
||||
+ (int) tunables[i].len,
|
||||
+ tunables[i].value,
|
||||
+ tunables[i].t->name);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Initialize the tunables list from the environment. For now we only use the
|
||||
diff --git a/elf/tst-tunables.c b/elf/tst-tunables.c
|
||||
index 095b5c81d95c8760..dff34ed748b4ae83 100644
|
||||
--- a/elf/tst-tunables.c
|
||||
+++ b/elf/tst-tunables.c
|
||||
@@ -17,6 +17,10 @@
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <array_length.h>
|
||||
+/* The test uses the tunable_list size, which is only exported for
|
||||
+ ld.so. This will result in a copy of tunable_list, which is ununsed by
|
||||
+ the test itself. */
|
||||
+#define TUNABLES_INTERNAL 1
|
||||
#include <dl-tunables.h>
|
||||
#include <getopt.h>
|
||||
#include <intprops.h>
|
||||
@@ -24,12 +28,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <support/capture_subprocess.h>
|
||||
#include <support/check.h>
|
||||
+#include <support/support.h>
|
||||
|
||||
static int restart;
|
||||
#define CMDLINE_OPTIONS \
|
||||
{ "restart", no_argument, &restart, 1 },
|
||||
|
||||
-static const struct test_t
|
||||
+static struct test_t
|
||||
{
|
||||
const char *name;
|
||||
const char *value;
|
||||
@@ -284,6 +289,29 @@ static const struct test_t
|
||||
0,
|
||||
0,
|
||||
},
|
||||
+ /* Also check for repeated tunables with a count larger than the total number
|
||||
+ of tunables. */
|
||||
+ {
|
||||
+ "GLIBC_TUNABLES",
|
||||
+ NULL,
|
||||
+ 2,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ },
|
||||
+ {
|
||||
+ "GLIBC_TUNABLES",
|
||||
+ NULL,
|
||||
+ 1,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ },
|
||||
+ {
|
||||
+ "GLIBC_TUNABLES",
|
||||
+ NULL,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ },
|
||||
};
|
||||
|
||||
static int
|
||||
@@ -327,6 +355,37 @@ do_test (int argc, char *argv[])
|
||||
spargv[i] = NULL;
|
||||
}
|
||||
|
||||
+ /* Create a tunable line with the duplicate values with a total number
|
||||
+ larger than the different number of tunables. */
|
||||
+ {
|
||||
+ enum { tunables_list_size = array_length (tunable_list) };
|
||||
+ const char *value = "";
|
||||
+ for (int i = 0; i < tunables_list_size; i++)
|
||||
+ value = xasprintf ("%sglibc.malloc.check=2%c",
|
||||
+ value,
|
||||
+ i == (tunables_list_size - 1) ? '\0' : ':');
|
||||
+ tests[33].value = value;
|
||||
+ }
|
||||
+ /* Same as before, but the last tunable values is differen than the
|
||||
+ rest. */
|
||||
+ {
|
||||
+ enum { tunables_list_size = array_length (tunable_list) };
|
||||
+ const char *value = "";
|
||||
+ for (int i = 0; i < tunables_list_size - 1; i++)
|
||||
+ value = xasprintf ("%sglibc.malloc.check=2:", value);
|
||||
+ value = xasprintf ("%sglibc.malloc.check=1", value);
|
||||
+ tests[34].value = value;
|
||||
+ }
|
||||
+ /* Same as before, but with an invalid last entry. */
|
||||
+ {
|
||||
+ enum { tunables_list_size = array_length (tunable_list) };
|
||||
+ const char *value = "";
|
||||
+ for (int i = 0; i < tunables_list_size - 1; i++)
|
||||
+ value = xasprintf ("%sglibc.malloc.check=2:", value);
|
||||
+ value = xasprintf ("%sglibc.malloc.check=1=1", value);
|
||||
+ tests[35].value = value;
|
||||
+ }
|
||||
+
|
||||
for (int i = 0; i < array_length (tests); i++)
|
||||
{
|
||||
snprintf (nteststr, sizeof nteststr, "%d", i);
|
||||
diff --git a/sysdeps/aarch64/multiarch/memset_generic.S b/sysdeps/aarch64/multiarch/memset_generic.S
|
||||
index 81748bdbce53e636..e125a5ed853301e1 100644
|
||||
--- a/sysdeps/aarch64/multiarch/memset_generic.S
|
||||
+++ b/sysdeps/aarch64/multiarch/memset_generic.S
|
||||
@@ -33,3 +33,7 @@
|
||||
#endif
|
||||
|
||||
#include <../memset.S>
|
||||
+
|
||||
+#if IS_IN (rtld)
|
||||
+strong_alias (memset, __memset_generic)
|
||||
+#endif
|
||||
diff --git a/sysdeps/sparc/sparc64/rtld-memset.c b/sysdeps/sparc/sparc64/rtld-memset.c
|
||||
index 55f38357902933b5..a19202a620fb8f7d 100644
|
||||
--- a/sysdeps/sparc/sparc64/rtld-memset.c
|
||||
+++ b/sysdeps/sparc/sparc64/rtld-memset.c
|
||||
@@ -1 +1,4 @@
|
||||
#include <string/memset.c>
|
||||
+#if IS_IN(rtld)
|
||||
+strong_alias (memset, __memset_ultra1)
|
||||
+#endif
|
@ -0,0 +1,45 @@
|
||||
commit 97bb89668d7171164975f3dc895e38343a2f3a95
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Thu May 9 20:07:01 2024 -0700
|
||||
|
||||
Force DT_RPATH for --enable-hardcoded-path-in-tests
|
||||
|
||||
On Fedora 40/x86-64, linker enables --enable-new-dtags by default which
|
||||
generates DT_RUNPATH instead of DT_RPATH. Unlike DT_RPATH, DT_RUNPATH
|
||||
only applies to DT_NEEDED entries in the executable and doesn't applies
|
||||
to DT_NEEDED entries in shared libraries which are loaded via DT_NEEDED
|
||||
entries in the executable. Some glibc tests have libstdc++.so.6 in
|
||||
DT_NEEDED, which has libm.so.6 in DT_NEEDED. When DT_RUNPATH is generated,
|
||||
/lib64/libm.so.6 is loaded for such tests. If the newly built glibc is
|
||||
older than glibc 2.36, these tests fail with
|
||||
|
||||
assert/tst-assert-c++: /export/build/gnu/tools-build/glibc-gitlab-release/build-x86_64-linux/libc.so.6: version `GLIBC_2.36' not found (required by /lib64/libm.so.6)
|
||||
assert/tst-assert-c++: /export/build/gnu/tools-build/glibc-gitlab-release/build-x86_64-linux/libc.so.6: version `GLIBC_ABI_DT_RELR' not found (required by /lib64/libm.so.6)
|
||||
|
||||
Pass -Wl,--disable-new-dtags to linker when building glibc tests with
|
||||
--enable-hardcoded-path-in-tests. This fixes BZ #31719.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
(cherry picked from commit 2dcaf70643710e22f92a351e36e3cff8b48c60dc)
|
||||
|
||||
diff --git a/Makeconfig b/Makeconfig
|
||||
index 85e00cef94e9deb4..522182abdc426e70 100644
|
||||
--- a/Makeconfig
|
||||
+++ b/Makeconfig
|
||||
@@ -586,10 +586,13 @@ link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link)
|
||||
# before the expansion of LDLIBS-* variables).
|
||||
|
||||
# Tests use -Wl,-rpath instead of -Wl,-rpath-link for
|
||||
-# build-hardcoded-path-in-tests.
|
||||
+# build-hardcoded-path-in-tests. Add -Wl,--disable-new-dtags to force
|
||||
+# DT_RPATH instead of DT_RUNPATH which only applies to DT_NEEDED entries
|
||||
+# in the executable and doesn't applies to DT_NEEDED entries in shared
|
||||
+# libraries which are loaded via DT_NEEDED entries in the executable.
|
||||
ifeq (yes,$(build-hardcoded-path-in-tests))
|
||||
-link-libc-tests-rpath-link = $(link-libc-rpath)
|
||||
-link-test-modules-rpath-link = $(link-libc-rpath)
|
||||
+link-libc-tests-rpath-link = $(link-libc-rpath) -Wl,--disable-new-dtags
|
||||
+link-test-modules-rpath-link = $(link-libc-rpath) -Wl,--disable-new-dtags
|
||||
else
|
||||
link-libc-tests-rpath-link = $(link-libc-rpath-link)
|
||||
link-test-modules-rpath-link =
|
@ -0,0 +1,38 @@
|
||||
commit ab4ef4421f85ea7afeb482ded51003658b08de7e
|
||||
Author: Gabi Falk <gabifalk@gmx.com>
|
||||
Date: Tue May 7 18:25:00 2024 +0000
|
||||
|
||||
x86_64: Fix missing wcsncat function definition without multiarch (x86-64-v4)
|
||||
|
||||
This code expects the WCSCAT preprocessor macro to be predefined in case
|
||||
the evex implementation of the function should be defined with a name
|
||||
different from __wcsncat_evex. However, when glibc is built for
|
||||
x86-64-v4 without multiarch support, sysdeps/x86_64/wcsncat.S defines
|
||||
WCSNCAT variable instead of WCSCAT to build it as wcsncat. Rename the
|
||||
variable to WCSNCAT, as it is actually a better naming choice for the
|
||||
variable in this case.
|
||||
|
||||
Reported-by: Kenton Groombridge
|
||||
Link: https://bugs.gentoo.org/921945
|
||||
Fixes: 64b8b6516b ("x86: Add evex optimized functions for the wchar_t strcpy family")
|
||||
Signed-off-by: Gabi Falk <gabifalk@gmx.com>
|
||||
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
|
||||
(cherry picked from commit dd5f891c1ad9f1b43b9db93afe2a55cbb7a6194e)
|
||||
|
||||
diff --git a/sysdeps/x86_64/multiarch/wcsncat-evex.S b/sysdeps/x86_64/multiarch/wcsncat-evex.S
|
||||
index 392215950afd56be..10bfb0a5314130cf 100644
|
||||
--- a/sysdeps/x86_64/multiarch/wcsncat-evex.S
|
||||
+++ b/sysdeps/x86_64/multiarch/wcsncat-evex.S
|
||||
@@ -1,9 +1,9 @@
|
||||
-#ifndef WCSCAT
|
||||
-# define WCSCAT __wcsncat_evex
|
||||
+#ifndef WCSNCAT
|
||||
+# define WCSNCAT __wcsncat_evex
|
||||
#endif
|
||||
|
||||
#define USE_AS_WCSCPY
|
||||
#define USE_AS_STRCAT
|
||||
|
||||
-#define STRNCAT WCSCAT
|
||||
+#define STRNCAT WCSNCAT
|
||||
#include "strncat-evex.S"
|
@ -0,0 +1,71 @@
|
||||
commit 2db79c96baa1256b8fc2656596143da92fabd074
|
||||
Author: Sergey Kolosov <skolosov@redhat.com>
|
||||
Date: Wed Apr 10 17:58:04 2024 +0200
|
||||
|
||||
libsupport: Add xgetpeername
|
||||
|
||||
The patch adds redirections for getpeername.
|
||||
|
||||
Reviewed-by: Arjun Shankar <arjun@redhat.com>
|
||||
(cherry picked from commit 6687a6e3f962759536a8019d31c68c1009ccd6eb)
|
||||
|
||||
diff --git a/support/Makefile b/support/Makefile
|
||||
index 362a51f882787f2b..aa57207bdccc852d 100644
|
||||
--- a/support/Makefile
|
||||
+++ b/support/Makefile
|
||||
@@ -131,6 +131,7 @@ libsupport-routines = \
|
||||
xfreopen \
|
||||
xftruncate \
|
||||
xgetline \
|
||||
+ xgetpeername \
|
||||
xgetsockname \
|
||||
xlisten \
|
||||
xlseek \
|
||||
diff --git a/support/xgetpeername.c b/support/xgetpeername.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..6f448e456a1d9e1e
|
||||
--- /dev/null
|
||||
+++ b/support/xgetpeername.c
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* getpeername with error checking.
|
||||
+ Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <https://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <support/xsocket.h>
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <support/check.h>
|
||||
+
|
||||
+void
|
||||
+xgetpeername (int fd, struct sockaddr *sa, socklen_t *plen)
|
||||
+{
|
||||
+ if (getpeername (fd, sa, plen) != 0)
|
||||
+ FAIL_EXIT1 ("getpeername (%d): %m", fd);
|
||||
+}
|
||||
diff --git a/support/xsocket.h b/support/xsocket.h
|
||||
index 3e4410354676cb2a..4ac0e1f5ffe35dc2 100644
|
||||
--- a/support/xsocket.h
|
||||
+++ b/support/xsocket.h
|
||||
@@ -26,6 +26,7 @@
|
||||
int xsocket (int, int, int);
|
||||
void xsetsockopt (int, int, int, const void *, socklen_t);
|
||||
void xgetsockname (int, struct sockaddr *, socklen_t *);
|
||||
+void xgetpeername (int, struct sockaddr *, socklen_t *);
|
||||
void xconnect (int, const struct sockaddr *, socklen_t);
|
||||
void xbind (int, const struct sockaddr *, socklen_t);
|
||||
void xlisten (int, int);
|
@ -0,0 +1,143 @@
|
||||
commit 32969a2b36b8cc74343182b768b3babe6f81c3aa
|
||||
Author: Sergey Kolosov <skolosov@redhat.com>
|
||||
Date: Wed Apr 10 17:58:05 2024 +0200
|
||||
|
||||
socket: Add new test for connect
|
||||
|
||||
This commit adds a simple bind/accept/connect test for an IPv4 TCP
|
||||
connection to a local process via the loopback interface.
|
||||
|
||||
Reviewed-by: Arjun Shankar <arjun@redhat.com>
|
||||
(cherry picked from commit 3a83f79024cc023a74c3892a1673542e8e972485)
|
||||
|
||||
diff --git a/socket/Makefile b/socket/Makefile
|
||||
index 74ca5b8452cd15d3..fc1bd0a2608f04bc 100644
|
||||
--- a/socket/Makefile
|
||||
+++ b/socket/Makefile
|
||||
@@ -70,6 +70,7 @@ tests := \
|
||||
tst-accept4 \
|
||||
tst-cmsg_cloexec \
|
||||
tst-cmsghdr \
|
||||
+ tst-connect \
|
||||
tst-sockopt \
|
||||
# tests
|
||||
|
||||
diff --git a/socket/tst-connect.c b/socket/tst-connect.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..ec2fdd92c0a6f1be
|
||||
--- /dev/null
|
||||
+++ b/socket/tst-connect.c
|
||||
@@ -0,0 +1,113 @@
|
||||
+/* Test the connect function.
|
||||
+ Copyright (C) 2024 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 <arpa/inet.h>
|
||||
+#include <errno.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <signal.h>
|
||||
+#include <stdbool.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/xsocket.h>
|
||||
+#include <support/xunistd.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+static struct sockaddr_in server_address;
|
||||
+
|
||||
+int
|
||||
+open_socket_inet_tcp (void)
|
||||
+{
|
||||
+ int fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
+ if (fd < 0)
|
||||
+ {
|
||||
+ if (errno == EAFNOSUPPORT)
|
||||
+ FAIL_UNSUPPORTED ("The host does not support IPv4");
|
||||
+ else
|
||||
+ FAIL_EXIT1 ("socket (AF_INET, SOCK_STREAM, IPPROTO_TCP): %m\n");
|
||||
+ }
|
||||
+ return fd;
|
||||
+}
|
||||
+
|
||||
+static pid_t
|
||||
+start_server (void)
|
||||
+{
|
||||
+ server_address.sin_family = AF_INET;
|
||||
+ server_address.sin_port = 0;
|
||||
+ server_address.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
|
||||
+
|
||||
+ int server_sock = open_socket_inet_tcp ();
|
||||
+
|
||||
+ xbind (server_sock, (struct sockaddr *) &server_address,
|
||||
+ sizeof (server_address));
|
||||
+
|
||||
+ socklen_t sa_len = sizeof (server_address);
|
||||
+ xgetsockname (server_sock, (struct sockaddr *) &server_address, &sa_len);
|
||||
+ xlisten (server_sock, 5);
|
||||
+
|
||||
+ pid_t my_pid = xfork ();
|
||||
+ if (my_pid > 0)
|
||||
+ {
|
||||
+ xclose (server_sock);
|
||||
+ return my_pid;
|
||||
+ }
|
||||
+
|
||||
+ struct sockaddr_in client_address;
|
||||
+ socklen_t ca_len = sizeof (server_address);
|
||||
+ int client_sock = xaccept (server_sock, (struct sockaddr *) &client_address,
|
||||
+ &ca_len);
|
||||
+ printf ("socket accepted %d\n", client_sock);
|
||||
+
|
||||
+ _exit (0);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ pid_t serv_pid;
|
||||
+ struct sockaddr_in peer;
|
||||
+ socklen_t peer_len;
|
||||
+
|
||||
+ serv_pid = start_server ();
|
||||
+ int client_sock = open_socket_inet_tcp ();
|
||||
+ xconnect (client_sock, (const struct sockaddr *) &server_address,
|
||||
+ sizeof (server_address));
|
||||
+
|
||||
+ /* A second connect with same arguments should fail with EISCONN. */
|
||||
+ int result = connect (client_sock,
|
||||
+ (const struct sockaddr *) &server_address,
|
||||
+ sizeof (server_address));
|
||||
+ if (result == 0 || errno != EISCONN)
|
||||
+ FAIL_EXIT1 ("Second connect (%d), should fail with EISCONN: %m",
|
||||
+ client_sock);
|
||||
+
|
||||
+ peer_len = sizeof (peer);
|
||||
+ xgetpeername (client_sock, (struct sockaddr *) &peer, &peer_len);
|
||||
+ TEST_COMPARE (peer_len, sizeof (peer));
|
||||
+ TEST_COMPARE (peer.sin_port, server_address.sin_port);
|
||||
+ TEST_COMPARE_BLOB (&peer.sin_addr, sizeof (peer.sin_addr),
|
||||
+ &server_address.sin_addr,
|
||||
+ sizeof (server_address.sin_addr));
|
||||
+
|
||||
+ int status;
|
||||
+ xwaitpid (serv_pid, &status, 0);
|
||||
+ TEST_COMPARE (status, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
@ -0,0 +1,23 @@
|
||||
commit c7c3f5bf80ae86b34501f473f1a9fc545c911b7f
|
||||
Author: caiyinyu <caiyinyu@loongson.cn>
|
||||
Date: Sat May 11 10:25:54 2024 +0800
|
||||
|
||||
LoongArch: Fix undefined `__memset_aligned` reference in ld.so linking.
|
||||
|
||||
This patch from 095067efdf68c8061d6f99a21a0300841bede999 (LoongArch: Add
|
||||
glibc.cpu.hwcap support.)
|
||||
|
||||
diff --git a/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h
|
||||
index cb640d77b7695b93..a73390b12f67a3fc 100644
|
||||
--- a/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h
|
||||
+++ b/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h
|
||||
@@ -19,6 +19,9 @@
|
||||
#ifndef _DL_IFUNC_GENERIC_H
|
||||
#define _DL_IFUNC_GENERIC_H
|
||||
|
||||
+#ifndef SHARED
|
||||
asm ("memset = __memset_aligned");
|
||||
+asm ("memcmp = __memcmp_aligned");
|
||||
+#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,40 @@
|
||||
commit 9f2b100d6705b9bbb25206b53e80d7759644e06e
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Sat May 25 05:13:41 2024 -0700
|
||||
|
||||
parse_fdinfo: Don't advance pointer twice [BZ #31798]
|
||||
|
||||
pidfd_getpid.c has
|
||||
|
||||
/* Ignore invalid large values. */
|
||||
if (INT_MULTIPLY_WRAPV (10, n, &n)
|
||||
|| INT_ADD_WRAPV (n, *l++ - '0', &n))
|
||||
return -1;
|
||||
|
||||
For GCC older than GCC 7, INT_ADD_WRAPV(a, b, r) is defined as
|
||||
|
||||
_GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW)
|
||||
|
||||
and *l++ - '0' is evaluated twice. Fix BZ #31798 by moving "l++" out of
|
||||
the if statement. Tested with GCC 6.4 and GCC 14.1.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
(cherry picked from commit f981bf6b9db87e0732b46bfe92fdad4d363225e8)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/pidfd_getpid.c b/sysdeps/unix/sysv/linux/pidfd_getpid.c
|
||||
index 8567b413dd2c210b..30025e5863f7b956 100644
|
||||
--- a/sysdeps/unix/sysv/linux/pidfd_getpid.c
|
||||
+++ b/sysdeps/unix/sysv/linux/pidfd_getpid.c
|
||||
@@ -74,8 +74,10 @@ parse_fdinfo (const char *l, void *arg)
|
||||
|
||||
/* Ignore invalid large values. */
|
||||
if (INT_MULTIPLY_WRAPV (10, n, &n)
|
||||
- || INT_ADD_WRAPV (n, *l++ - '0', &n))
|
||||
+ || INT_ADD_WRAPV (n, *l - '0', &n))
|
||||
return -1;
|
||||
+
|
||||
+ l++;
|
||||
}
|
||||
|
||||
/* -1 indicates that the process is terminated. */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,195 @@
|
||||
commit 26e7005728f0eea2972474e6be2905c467661237
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Sat May 18 09:33:19 2024 +0200
|
||||
|
||||
socket: Use may_alias on sockaddr structs (bug 19622)
|
||||
|
||||
This supports common coding patterns. The GCC C front end before
|
||||
version 7 rejects the may_alias attribute on a struct definition
|
||||
if it was not present in a previous forward declaration, so this
|
||||
attribute can only be conditionally applied.
|
||||
|
||||
This implements the spirit of the change in Austin Group issue 1641.
|
||||
|
||||
Suggested-by: Marek Polacek <polacek@redhat.com>
|
||||
Suggested-by: Jakub Jelinek <jakub@redhat.com>
|
||||
Reviewed-by: Sam James <sam@gentoo.org>
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit 8d7b6b4cb27d4dec1dd5f7960298c1699275f962)
|
||||
|
||||
diff --git a/bits/socket.h b/bits/socket.h
|
||||
index 13de124bac67c217..772074d52ab957df 100644
|
||||
--- a/bits/socket.h
|
||||
+++ b/bits/socket.h
|
||||
@@ -149,7 +149,7 @@ enum __socket_type
|
||||
#include <bits/sockaddr.h>
|
||||
|
||||
/* Structure describing a generic socket address. */
|
||||
-struct sockaddr
|
||||
+struct __attribute_struct_may_alias__ sockaddr
|
||||
{
|
||||
__SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
|
||||
char sa_data[14]; /* Address data. */
|
||||
@@ -166,7 +166,7 @@ struct sockaddr
|
||||
#define _SS_PADSIZE \
|
||||
(_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype))
|
||||
|
||||
-struct sockaddr_storage
|
||||
+struct __attribute_struct_may_alias__ sockaddr_storage
|
||||
{
|
||||
__SOCKADDR_COMMON (ss_); /* Address family, etc. */
|
||||
char __ss_padding[_SS_PADSIZE];
|
||||
diff --git a/inet/netinet/in.h b/inet/netinet/in.h
|
||||
index fa57b6107908590c..f684be5beb26fc62 100644
|
||||
--- a/inet/netinet/in.h
|
||||
+++ b/inet/netinet/in.h
|
||||
@@ -244,7 +244,7 @@ extern const struct in6_addr in6addr_loopback; /* ::1 */
|
||||
|
||||
|
||||
/* Structure describing an Internet socket address. */
|
||||
-struct sockaddr_in
|
||||
+struct __attribute_struct_may_alias__ sockaddr_in
|
||||
{
|
||||
__SOCKADDR_COMMON (sin_);
|
||||
in_port_t sin_port; /* Port number. */
|
||||
@@ -257,9 +257,11 @@ struct sockaddr_in
|
||||
- sizeof (struct in_addr)];
|
||||
};
|
||||
|
||||
-#if !__USE_KERNEL_IPV6_DEFS
|
||||
+#if __USE_KERNEL_IPV6_DEFS
|
||||
+struct __attribute_struct_may_alias__ sockaddr_in6;
|
||||
+#else
|
||||
/* Ditto, for IPv6. */
|
||||
-struct sockaddr_in6
|
||||
+struct __attribute_struct_may_alias__ sockaddr_in6
|
||||
{
|
||||
__SOCKADDR_COMMON (sin6_);
|
||||
in_port_t sin6_port; /* Transport layer port # */
|
||||
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
|
||||
index 520231dbea3a4e24..399ee7d24cae9446 100644
|
||||
--- a/misc/sys/cdefs.h
|
||||
+++ b/misc/sys/cdefs.h
|
||||
@@ -720,4 +720,13 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
|
||||
# define __attribute_returns_twice__ /* Ignore. */
|
||||
#endif
|
||||
|
||||
+/* Mark struct types as aliasable. Restricted to compilers that
|
||||
+ support forward declarations of structs in the presence of the
|
||||
+ attribute. */
|
||||
+#if __GNUC_PREREQ (7, 1) || defined __clang__
|
||||
+# define __attribute_struct_may_alias__ __attribute__ ((__may_alias__))
|
||||
+#else
|
||||
+# define __attribute_struct_may_alias__
|
||||
+#endif
|
||||
+
|
||||
#endif /* sys/cdefs.h */
|
||||
diff --git a/socket/sys/un.h b/socket/sys/un.h
|
||||
index bf03b7d6ce959065..ff9cbd6efa7693d5 100644
|
||||
--- a/socket/sys/un.h
|
||||
+++ b/socket/sys/un.h
|
||||
@@ -26,7 +26,7 @@
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */
|
||||
-struct sockaddr_un
|
||||
+struct __attribute_struct_may_alias__ sockaddr_un
|
||||
{
|
||||
__SOCKADDR_COMMON (sun_);
|
||||
char sun_path[108]; /* Path name. */
|
||||
diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h
|
||||
index 3e72f9fa93add888..b5eeac373111e694 100644
|
||||
--- a/sysdeps/mach/hurd/bits/socket.h
|
||||
+++ b/sysdeps/mach/hurd/bits/socket.h
|
||||
@@ -153,7 +153,7 @@ enum __socket_type
|
||||
#include <bits/sockaddr.h>
|
||||
|
||||
/* Structure describing a generic socket address. */
|
||||
-struct sockaddr
|
||||
+struct __attribute_struct_may_alias__ sockaddr
|
||||
{
|
||||
__SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
|
||||
char sa_data[14]; /* Address data. */
|
||||
@@ -170,7 +170,7 @@ struct sockaddr
|
||||
#define _SS_PADSIZE \
|
||||
(_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype))
|
||||
|
||||
-struct sockaddr_storage
|
||||
+struct __attribute_struct_may_alias__ sockaddr_storage
|
||||
{
|
||||
__SOCKADDR_COMMON (ss_); /* Address family, etc. */
|
||||
char __ss_padding[_SS_PADSIZE];
|
||||
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
|
||||
index 0d86feb4cadc13e3..6dab283a2ebeaed1 100644
|
||||
--- a/sysdeps/unix/sysv/linux/bits/socket.h
|
||||
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
|
||||
@@ -180,7 +180,7 @@ typedef __socklen_t socklen_t;
|
||||
#include <bits/sockaddr.h>
|
||||
|
||||
/* Structure describing a generic socket address. */
|
||||
-struct sockaddr
|
||||
+struct __attribute_struct_may_alias__ sockaddr
|
||||
{
|
||||
__SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
|
||||
char sa_data[14]; /* Address data. */
|
||||
@@ -193,7 +193,7 @@ struct sockaddr
|
||||
#define _SS_PADSIZE \
|
||||
(_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype))
|
||||
|
||||
-struct sockaddr_storage
|
||||
+struct __attribute_struct_may_alias__ sockaddr_storage
|
||||
{
|
||||
__SOCKADDR_COMMON (ss_); /* Address family, etc. */
|
||||
char __ss_padding[_SS_PADSIZE];
|
||||
diff --git a/sysdeps/unix/sysv/linux/net/if_packet.h b/sysdeps/unix/sysv/linux/net/if_packet.h
|
||||
index 9ffb69b508cc8ca7..c17e1c23c5cf9169 100644
|
||||
--- a/sysdeps/unix/sysv/linux/net/if_packet.h
|
||||
+++ b/sysdeps/unix/sysv/linux/net/if_packet.h
|
||||
@@ -26,7 +26,7 @@
|
||||
From Linux 2.1 the AF_PACKET interface is preferred and you should
|
||||
consider using it in place of this one. */
|
||||
|
||||
-struct sockaddr_pkt
|
||||
+struct __attribute_struct_may_alias__ sockaddr_pkt
|
||||
{
|
||||
__SOCKADDR_COMMON (spkt_);
|
||||
unsigned char spkt_device[14];
|
||||
diff --git a/sysdeps/unix/sysv/linux/netash/ash.h b/sysdeps/unix/sysv/linux/netash/ash.h
|
||||
index 7d885d17cc9ec313..7a6ff50b17b370c4 100644
|
||||
--- a/sysdeps/unix/sysv/linux/netash/ash.h
|
||||
+++ b/sysdeps/unix/sysv/linux/netash/ash.h
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <features.h>
|
||||
#include <bits/sockaddr.h>
|
||||
|
||||
-struct sockaddr_ash
|
||||
+struct __attribute_struct_may_alias__ sockaddr_ash
|
||||
{
|
||||
__SOCKADDR_COMMON (sash_); /* Common data: address family etc. */
|
||||
int sash_ifindex; /* Interface to use. */
|
||||
diff --git a/sysdeps/unix/sysv/linux/neteconet/ec.h b/sysdeps/unix/sysv/linux/neteconet/ec.h
|
||||
index b07a10796196e28e..f3132f06ff9f8dee 100644
|
||||
--- a/sysdeps/unix/sysv/linux/neteconet/ec.h
|
||||
+++ b/sysdeps/unix/sysv/linux/neteconet/ec.h
|
||||
@@ -28,7 +28,7 @@ struct ec_addr
|
||||
unsigned char net; /* Network number. */
|
||||
};
|
||||
|
||||
-struct sockaddr_ec
|
||||
+struct __attribute_struct_may_alias__ sockaddr_ec
|
||||
{
|
||||
__SOCKADDR_COMMON (sec_);
|
||||
unsigned char port; /* Port number. */
|
||||
diff --git a/sysdeps/unix/sysv/linux/netiucv/iucv.h b/sysdeps/unix/sysv/linux/netiucv/iucv.h
|
||||
index f5fad817513f3c46..27151e8bbe1e7fa2 100644
|
||||
--- a/sysdeps/unix/sysv/linux/netiucv/iucv.h
|
||||
+++ b/sysdeps/unix/sysv/linux/netiucv/iucv.h
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
-struct sockaddr_iucv
|
||||
+struct __attribute_struct_may_alias__ sockaddr_iucv
|
||||
{
|
||||
__SOCKADDR_COMMON (siucv_);
|
||||
unsigned short siucv_port; /* Reserved */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,38 @@
|
||||
commit aee37de299af95007a1f00f2cdf6c1452f39e682
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Fri Apr 5 09:02:36 2024 -0300
|
||||
|
||||
Reinstate generic features-time64.h
|
||||
|
||||
The a4ed0471d7 removed the generic version which is included by
|
||||
features.h and used by Hurd.
|
||||
|
||||
Checked by building i686-gnu and x86_64-gnu with build-many-glibc.py.
|
||||
|
||||
(cherry picked from commit c27f8763cffbb7db9b3f1f5e09ef24d26cbb63f4)
|
||||
|
||||
diff --git a/sysdeps/generic/features-time64.h b/sysdeps/generic/features-time64.h
|
||||
new file mode 100644
|
||||
index 0000000000000000..4d38b8ba766b34f5
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/generic/features-time64.h
|
||||
@@ -0,0 +1,19 @@
|
||||
+/* Features part to handle 64-bit time_t support. Generic version.
|
||||
+ Copyright (C) 2021-2024 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <https://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* The generic configuration only support _TIME_BITS=32. */
|
@ -0,0 +1,62 @@
|
||||
commit c9d8534406ab69b9bc1fd3fdfb9e88c9580d3f24
|
||||
Author: Sunil K Pandey <skpgkp2@gmail.com>
|
||||
Date: Mon May 27 10:08:18 2024 -0700
|
||||
|
||||
i386: Disable Intel Xeon Phi tests for GCC 15 and above (BZ 31782)
|
||||
|
||||
This patch disables Intel Xeon Phi tests for GCC 15 and above.
|
||||
|
||||
GCC 15 removed Intel Xeon Phi ISA support.
|
||||
commit e1a7e2c54d52d0ba374735e285b617af44841ace
|
||||
Author: Haochen Jiang <haochen.jiang@intel.com>
|
||||
Date: Mon May 20 10:43:44 2024 +0800
|
||||
|
||||
i386: Remove Xeon Phi ISA support
|
||||
|
||||
Fixes BZ 31782.
|
||||
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
(cherry picked from commit 1b713c9a5349ef3cd1a8ccf9de017c7865713c67)
|
||||
|
||||
diff --git a/sysdeps/x86/tst-cpu-features-supports.c b/sysdeps/x86/tst-cpu-features-supports.c
|
||||
index 93008dac703e762f..0f43ef2b2da0d3db 100644
|
||||
--- a/sysdeps/x86/tst-cpu-features-supports.c
|
||||
+++ b/sysdeps/x86/tst-cpu-features-supports.c
|
||||
@@ -65,7 +65,7 @@ do_test (int argc, char **argv)
|
||||
#endif
|
||||
fails += CHECK_FEATURE_ACTIVE (avx, AVX);
|
||||
fails += CHECK_FEATURE_ACTIVE (avx2, AVX2);
|
||||
-#if __GNUC_PREREQ (7, 0)
|
||||
+#if __GNUC_PREREQ (7, 0) && !__GNUC_PREREQ (15, 0)
|
||||
fails += CHECK_FEATURE_ACTIVE (avx5124fmaps, AVX512_4FMAPS);
|
||||
fails += CHECK_FEATURE_ACTIVE (avx5124vnniw, AVX512_4VNNIW);
|
||||
#endif
|
||||
@@ -92,14 +92,18 @@ do_test (int argc, char **argv)
|
||||
#if __GNUC_PREREQ (6, 0)
|
||||
fails += CHECK_FEATURE_ACTIVE (avx512bw, AVX512BW);
|
||||
fails += CHECK_FEATURE_ACTIVE (avx512cd, AVX512CD);
|
||||
+# if !__GNUC_PREREQ (15, 0)
|
||||
fails += CHECK_FEATURE_ACTIVE (avx512er, AVX512ER);
|
||||
+# endif
|
||||
fails += CHECK_FEATURE_ACTIVE (avx512dq, AVX512DQ);
|
||||
#endif
|
||||
#if __GNUC_PREREQ (5, 0)
|
||||
fails += CHECK_FEATURE_ACTIVE (avx512f, AVX512F);
|
||||
#endif
|
||||
#if __GNUC_PREREQ (6, 0)
|
||||
+# if !__GNUC_PREREQ (15, 0)
|
||||
fails += CHECK_FEATURE_ACTIVE (avx512pf, AVX512PF);
|
||||
+# endif
|
||||
fails += CHECK_FEATURE_ACTIVE (avx512vl, AVX512VL);
|
||||
#endif
|
||||
#if __GNUC_PREREQ (5, 0)
|
||||
@@ -148,7 +152,9 @@ do_test (int argc, char **argv)
|
||||
#endif
|
||||
fails += CHECK_FEATURE_ACTIVE (popcnt, POPCNT);
|
||||
#if __GNUC_PREREQ (11, 0)
|
||||
+# if !__GNUC_PREREQ (15, 0)
|
||||
fails += CHECK_FEATURE_ACTIVE (prefetchwt1, PREFETCHWT1);
|
||||
+# endif
|
||||
fails += CHECK_FEATURE_ACTIVE (ptwrite, PTWRITE);
|
||||
fails += CHECK_FEATURE_ACTIVE (rdpid, RDPID);
|
||||
fails += CHECK_FEATURE_ACTIVE (rdrnd, RDRAND);
|
@ -0,0 +1,68 @@
|
||||
commit 70f560fc22212f733647c9121c26bbb2307f2e10
|
||||
Author: Stafford Horne <shorne@gmail.com>
|
||||
Date: Wed Apr 3 06:40:37 2024 +0100
|
||||
|
||||
misc: Add support for Linux uio.h RWF_NOAPPEND flag
|
||||
|
||||
In Linux 6.9 a new flag is added to allow for Per-io operations to
|
||||
disable append mode even if a file was opened with the flag O_APPEND.
|
||||
This is done with the new RWF_NOAPPEND flag.
|
||||
|
||||
This caused two test failures as these tests expected the flag 0x00000020
|
||||
to be unused. Adding the flag definition now fixes these tests on Linux
|
||||
6.9 (v6.9-rc1).
|
||||
|
||||
FAIL: misc/tst-preadvwritev2
|
||||
FAIL: misc/tst-preadvwritev64v2
|
||||
|
||||
This patch adds the flag, adjusts the test and adds details to
|
||||
documentation.
|
||||
|
||||
Link: https://lore.kernel.org/all/20200831153207.GO3265@brightrain.aerifal.cx/
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
(cherry picked from commit 3db9d208dd5f30b12900989c6d2214782b8e2011)
|
||||
|
||||
diff --git a/manual/llio.texi b/manual/llio.texi
|
||||
index 0b61d491f50b763a..fae49d14332db675 100644
|
||||
--- a/manual/llio.texi
|
||||
+++ b/manual/llio.texi
|
||||
@@ -1339,6 +1339,10 @@ will fail and set @code{errno} to @code{EAGAIN} if the operation would block.
|
||||
|
||||
@item RWF_APPEND
|
||||
Per-IO synchronization as if the file was opened with @code{O_APPEND} flag.
|
||||
+
|
||||
+@item RWF_NOAPPEND
|
||||
+This flag allows an offset to be honored, even if the file was opened with
|
||||
+@code{O_APPEND} flag.
|
||||
@end vtable
|
||||
|
||||
When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
|
||||
diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c
|
||||
index b5f19f002cd1653e..8e04ff7282e727b6 100644
|
||||
--- a/misc/tst-preadvwritev2-common.c
|
||||
+++ b/misc/tst-preadvwritev2-common.c
|
||||
@@ -34,8 +34,11 @@
|
||||
#ifndef RWF_APPEND
|
||||
# define RWF_APPEND 0
|
||||
#endif
|
||||
+#ifndef RWF_NOAPPEND
|
||||
+# define RWF_NOAPPEND 0
|
||||
+#endif
|
||||
#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT \
|
||||
- | RWF_APPEND)
|
||||
+ | RWF_APPEND | RWF_NOAPPEND)
|
||||
|
||||
/* Generic uio_lim.h does not define IOV_MAX. */
|
||||
#ifndef IOV_MAX
|
||||
diff --git a/sysdeps/unix/sysv/linux/bits/uio-ext.h b/sysdeps/unix/sysv/linux/bits/uio-ext.h
|
||||
index 7854cccef3e0a618..ead7a091566aa295 100644
|
||||
--- a/sysdeps/unix/sysv/linux/bits/uio-ext.h
|
||||
+++ b/sysdeps/unix/sysv/linux/bits/uio-ext.h
|
||||
@@ -47,6 +47,7 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec,
|
||||
#define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */
|
||||
#define RWF_NOWAIT 0x00000008 /* per-IO nonblocking mode. */
|
||||
#define RWF_APPEND 0x00000010 /* per-IO O_APPEND. */
|
||||
+#define RWF_NOAPPEND 0x00000020 /* per-IO negation of O_APPEND */
|
||||
|
||||
__END_DECLS
|
||||
|
@ -0,0 +1,44 @@
|
||||
commit 6ade91c21140d8c803c289932dbfc74537f65a1f
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Mon Jun 3 10:49:40 2024 +0200
|
||||
|
||||
elf: Avoid some free (NULL) calls in _dl_update_slotinfo
|
||||
|
||||
This has been confirmed to work around some interposed mallocs. Here
|
||||
is a discussion of the impact test ust/libc-wrapper/test_libc-wrapper
|
||||
in lttng-tools:
|
||||
|
||||
New TLS usage in libgcc_s.so.1, compatibility impact
|
||||
<https://inbox.sourceware.org/libc-alpha/8734v1ieke.fsf@oldenburg.str.redhat.com/>
|
||||
|
||||
Reportedly, this patch also papers over a similar issue when tcmalloc
|
||||
2.9.1 is not compiled with -ftls-model=initial-exec. Of course the
|
||||
goal really should be to compile mallocs with the initial-exec TLS
|
||||
model, but this commit appears to be a useful interim workaround.
|
||||
|
||||
Fixes commit d2123d68275acc0f061e73d5f86ca504e0d5a344 ("elf: Fix slow
|
||||
tls access after dlopen [BZ #19924]").
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit afe42e935b3ee97bac9a7064157587777259c60e)
|
||||
|
||||
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
|
||||
index 7b3dd9ab60e89ae9..670dbc42fc2e3334 100644
|
||||
--- a/elf/dl-tls.c
|
||||
+++ b/elf/dl-tls.c
|
||||
@@ -819,7 +819,14 @@ _dl_update_slotinfo (unsigned long int req_modid, size_t new_gen)
|
||||
dtv entry free it. Note: this is not AS-safe. */
|
||||
/* XXX Ideally we will at some point create a memory
|
||||
pool. */
|
||||
- free (dtv[modid].pointer.to_free);
|
||||
+ /* Avoid calling free on a null pointer. Some mallocs
|
||||
+ incorrectly use dynamic TLS, and depending on how the
|
||||
+ free function was compiled, it could call
|
||||
+ __tls_get_addr before the null pointer check in the
|
||||
+ free implementation. Checking here papers over at
|
||||
+ least some dynamic TLS usage by interposed mallocs. */
|
||||
+ if (dtv[modid].pointer.to_free != NULL)
|
||||
+ free (dtv[modid].pointer.to_free);
|
||||
dtv[modid].pointer.val = TLS_DTV_UNALLOCATED;
|
||||
dtv[modid].pointer.to_free = NULL;
|
||||
|
@ -0,0 +1,57 @@
|
||||
commit 00899eba260ff3edb62bc6f45c1860bc64fd59e0
|
||||
Author: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Mon Feb 5 15:22:39 2024 -0500
|
||||
|
||||
x86/cet: fix shadow stack test scripts
|
||||
|
||||
Some shadow stack test scripts use the '==' operator with the 'test'
|
||||
command to validate exit codes resulting in the following error:
|
||||
|
||||
sysdeps/x86_64/tst-shstk-legacy-1e.sh: 31: test: 139: unexpected operator
|
||||
|
||||
The '==' operator is invalid for the 'test' command, use '-eq' like the
|
||||
previous call to 'test'.
|
||||
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
(cherry picked from commit 155bb9d036646138348fee0ac045de601811e0c5)
|
||||
|
||||
diff --git a/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh b/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh
|
||||
index 46f12337571127c6..0a9a164a3e8f4610 100755
|
||||
--- a/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh
|
||||
+++ b/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh
|
||||
@@ -26,7 +26,7 @@ ${common_objpfx}elf/tst-shstk-legacy-1e-static
|
||||
status=$?
|
||||
if test $status -eq 77; then
|
||||
exit 77
|
||||
-elif test $status == 139; then
|
||||
+elif test $status -eq 139; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
diff --git a/sysdeps/x86_64/tst-shstk-legacy-1e.sh b/sysdeps/x86_64/tst-shstk-legacy-1e.sh
|
||||
index 31212453d9374013..3dec5623e41dc3c8 100755
|
||||
--- a/sysdeps/x86_64/tst-shstk-legacy-1e.sh
|
||||
+++ b/sysdeps/x86_64/tst-shstk-legacy-1e.sh
|
||||
@@ -28,7 +28,7 @@ ${test_program_prefix} \
|
||||
status=$?
|
||||
if test $status -eq 77; then
|
||||
exit 77
|
||||
-elif test $status == 139; then
|
||||
+elif test $status -eq 139; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
diff --git a/sysdeps/x86_64/tst-shstk-legacy-1g.sh b/sysdeps/x86_64/tst-shstk-legacy-1g.sh
|
||||
index e84087068e6b7b15..249831e816f6589c 100755
|
||||
--- a/sysdeps/x86_64/tst-shstk-legacy-1g.sh
|
||||
+++ b/sysdeps/x86_64/tst-shstk-legacy-1g.sh
|
||||
@@ -28,7 +28,7 @@ ${test_program_prefix} \
|
||||
status=$?
|
||||
if test $status -eq 77; then
|
||||
exit 77
|
||||
-elif test $status == 139; then
|
||||
+elif test $status -eq 139; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
@ -0,0 +1,232 @@
|
||||
commit 305ee48826961b9b2ad2b2fb36ec19622d8e1d77
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Thu May 9 20:27:39 2024 -0700
|
||||
|
||||
malloc/Makefile: Split and sort tests
|
||||
|
||||
Put each test on a separate line and sort tests.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit d49cd6a1913da9744b9a0ffbefb3f7958322382e)
|
||||
|
||||
diff --git a/malloc/Makefile b/malloc/Makefile
|
||||
index c83ade5f10063113..77ba1a91093ebc55 100644
|
||||
--- a/malloc/Makefile
|
||||
+++ b/malloc/Makefile
|
||||
@@ -24,60 +24,92 @@ include ../Makeconfig
|
||||
|
||||
dist-headers := malloc.h
|
||||
headers := $(dist-headers) obstack.h mcheck.h
|
||||
-tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
|
||||
- tst-malloc-check tst-mallocfork tst-trim1 \
|
||||
- tst-malloc-usable tst-realloc tst-reallocarray tst-posix_memalign \
|
||||
- tst-pvalloc tst-pvalloc-fortify tst-memalign tst-mallopt \
|
||||
- tst-malloc-backtrace tst-malloc-thread-exit \
|
||||
- tst-malloc-thread-fail tst-malloc-fork-deadlock \
|
||||
- tst-mallocfork2 \
|
||||
- tst-mallocfork3 \
|
||||
- tst-interpose-nothread \
|
||||
- tst-interpose-thread \
|
||||
- tst-alloc_buffer \
|
||||
- tst-free-errno \
|
||||
- tst-malloc-tcache-leak \
|
||||
- tst-malloc_info tst-mallinfo2 \
|
||||
- tst-malloc-too-large \
|
||||
- tst-malloc-stats-cancellation \
|
||||
- tst-tcfree1 tst-tcfree2 tst-tcfree3 \
|
||||
- tst-safe-linking \
|
||||
- tst-mallocalign1 \
|
||||
- tst-memalign-2 \
|
||||
- tst-memalign-3 \
|
||||
- tst-aligned-alloc
|
||||
+tests := \
|
||||
+ mallocbug \
|
||||
+ tst-aligned-alloc \
|
||||
+ tst-alloc_buffer \
|
||||
+ tst-calloc \
|
||||
+ tst-free-errno \
|
||||
+ tst-interpose-nothread \
|
||||
+ tst-interpose-thread \
|
||||
+ tst-malloc \
|
||||
+ tst-malloc-backtrace \
|
||||
+ tst-malloc-check \
|
||||
+ tst-malloc-fork-deadlock \
|
||||
+ tst-malloc-stats-cancellation \
|
||||
+ tst-malloc-tcache-leak \
|
||||
+ tst-malloc-thread-exit \
|
||||
+ tst-malloc-thread-fail \
|
||||
+ tst-malloc-too-large \
|
||||
+ tst-malloc-usable \
|
||||
+ tst-malloc_info tst-mallinfo2 \
|
||||
+ tst-mallocalign1 \
|
||||
+ tst-mallocfork \
|
||||
+ tst-mallocfork2 \
|
||||
+ tst-mallocfork3 \
|
||||
+ tst-mallopt \
|
||||
+ tst-memalign \
|
||||
+ tst-memalign-2 \
|
||||
+ tst-memalign-3 \
|
||||
+ tst-obstack \
|
||||
+ tst-posix_memalign \
|
||||
+ tst-pvalloc \
|
||||
+ tst-pvalloc-fortify \
|
||||
+ tst-realloc \
|
||||
+ tst-reallocarray \
|
||||
+ tst-safe-linking \
|
||||
+ tst-tcfree1 tst-tcfree2 tst-tcfree3 \
|
||||
+ tst-trim1 \
|
||||
+ tst-valloc \
|
||||
+# tests
|
||||
|
||||
tests-static := \
|
||||
- tst-interpose-static-nothread \
|
||||
- tst-interpose-static-thread \
|
||||
- tst-aligned-alloc-static
|
||||
+ tst-aligned-alloc-static \
|
||||
+ tst-interpose-static-nothread \
|
||||
+ tst-interpose-static-thread \
|
||||
+# tests-static
|
||||
|
||||
# Test for the malloc_set_state symbol removed in glibc 2.25.
|
||||
ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)
|
||||
-tests += tst-mallocstate tst-compathooks-off tst-compathooks-on
|
||||
+tests += \
|
||||
+ tst-compathooks-off \
|
||||
+ tst-compathooks-on \
|
||||
+ tst-mallocstate \
|
||||
+# tests
|
||||
endif
|
||||
|
||||
tests-internal := tst-scratch_buffer
|
||||
|
||||
# The dynarray framework is only available inside glibc.
|
||||
tests-internal += \
|
||||
- tst-dynarray \
|
||||
- tst-dynarray-fail \
|
||||
- tst-dynarray-at-fail \
|
||||
+ tst-dynarray \
|
||||
+ tst-dynarray-at-fail \
|
||||
+ tst-dynarray-fail \
|
||||
+# tests-internal
|
||||
|
||||
-tests += tst-malloc-usable-tunables tst-mxfast
|
||||
+tests += \
|
||||
+ tst-malloc-usable-tunables \
|
||||
+ tst-mxfast \
|
||||
+# tests
|
||||
|
||||
tests += $(tests-static)
|
||||
test-srcs = tst-mtrace
|
||||
|
||||
# These tests either are run with MALLOC_CHECK_=3 by default or do not work
|
||||
# with MALLOC_CHECK_=3 because they expect a specific failure.
|
||||
-tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \
|
||||
- tst-mxfast tst-safe-linking \
|
||||
- tst-compathooks-off tst-compathooks-on tst-memalign-2 tst-memalign-3 \
|
||||
- tst-mallocfork2 \
|
||||
- tst-mallocfork3 \
|
||||
- tst-malloc-tcache-leak
|
||||
+tests-exclude-malloc-check = \
|
||||
+ tst-compathooks-off \
|
||||
+ tst-compathooks-on \
|
||||
+ tst-malloc-check \
|
||||
+ tst-malloc-tcache-leak \
|
||||
+ tst-malloc-usable \
|
||||
+ tst-mallocfork2 \
|
||||
+ tst-mallocfork3 \
|
||||
+ tst-memalign-2 \
|
||||
+ tst-memalign-3 \
|
||||
+ tst-mxfast \
|
||||
+ tst-safe-linking \
|
||||
+# tests-exclude-malloc-check
|
||||
|
||||
# Run all tests with MALLOC_CHECK_=3
|
||||
tests-malloc-check = $(filter-out $(tests-exclude-malloc-check) \
|
||||
@@ -87,18 +119,19 @@ tests-malloc-check = $(filter-out $(tests-exclude-malloc-check) \
|
||||
# the Transparent Huge Pages support (1) or automatic huge page support (2).
|
||||
# We need exclude some tests that define the ENV vars.
|
||||
tests-exclude-hugetlb1 = \
|
||||
- tst-compathooks-off \
|
||||
- tst-compathooks-on \
|
||||
- tst-interpose-nothread \
|
||||
- tst-interpose-thread \
|
||||
- tst-interpose-static-nothread \
|
||||
- tst-interpose-static-thread \
|
||||
- tst-malloc-usable \
|
||||
- tst-malloc-usable-tunables \
|
||||
- tst-mallocstate \
|
||||
- tst-malloc-tcache-leak \
|
||||
- tst-mallocfork2 \
|
||||
- tst-mallocfork3
|
||||
+ tst-compathooks-off \
|
||||
+ tst-compathooks-on \
|
||||
+ tst-interpose-nothread \
|
||||
+ tst-interpose-static-nothread \
|
||||
+ tst-interpose-static-thread \
|
||||
+ tst-interpose-thread \
|
||||
+ tst-malloc-tcache-leak \
|
||||
+ tst-malloc-usable \
|
||||
+ tst-malloc-usable-tunables \
|
||||
+ tst-mallocfork2 \
|
||||
+ tst-mallocfork3 \
|
||||
+ tst-mallocstate \
|
||||
+# tests-exclude-hugetlb1
|
||||
# The tst-free-errno relies on the used malloc page size to mmap an
|
||||
# overlapping region.
|
||||
tests-exclude-hugetlb2 = \
|
||||
@@ -114,22 +147,25 @@ ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)
|
||||
# Tests that don't play well with mcheck. They are either bugs in mcheck or
|
||||
# the tests expect specific internal behavior that is changed due to linking to
|
||||
# libmcheck.a.
|
||||
-tests-exclude-mcheck = tst-mallocstate \
|
||||
- tst-safe-linking \
|
||||
- tst-malloc-backtrace \
|
||||
- tst-malloc-fork-deadlock \
|
||||
- tst-malloc-stats-cancellation \
|
||||
- tst-malloc-tcache-leak \
|
||||
- tst-malloc-thread-exit \
|
||||
- tst-malloc-thread-fail \
|
||||
- tst-malloc-usable-tunables \
|
||||
- tst-malloc_info \
|
||||
- tst-compathooks-off tst-compathooks-on \
|
||||
- tst-memalign-2 \
|
||||
- tst-memalign-3 \
|
||||
- tst-mxfast \
|
||||
- tst-mallocfork2 \
|
||||
- tst-mallocfork3
|
||||
+tests-exclude-mcheck = \
|
||||
+ tst-compathooks-off \
|
||||
+ tst-compathooks-on \
|
||||
+ tst-malloc-backtrace \
|
||||
+ tst-malloc-fork-deadlock \
|
||||
+ tst-malloc-stats-cancellation \
|
||||
+ tst-malloc-tcache-leak \
|
||||
+ tst-malloc-thread-exit \
|
||||
+ tst-malloc-thread-fail \
|
||||
+ tst-malloc-usable-tunables \
|
||||
+ tst-malloc_info \
|
||||
+ tst-mallocfork2 \
|
||||
+ tst-mallocfork3 \
|
||||
+ tst-mallocstate \
|
||||
+ tst-memalign-2 \
|
||||
+ tst-memalign-3 \
|
||||
+ tst-mxfast \
|
||||
+ tst-safe-linking \
|
||||
+# tests-exclude-mcheck
|
||||
|
||||
tests-mcheck = $(filter-out $(tests-exclude-mcheck) $(tests-static), $(tests))
|
||||
endif
|
||||
@@ -159,10 +195,12 @@ extra-libs-others = $(extra-libs)
|
||||
extra-test-objs += \
|
||||
tst-interpose-aux-nothread.o \
|
||||
tst-interpose-aux-thread.o \
|
||||
+# extra-test-objs
|
||||
|
||||
test-extras = \
|
||||
tst-interpose-aux-nothread \
|
||||
tst-interpose-aux-thread \
|
||||
+# test-extras
|
||||
|
||||
libmemusage-routines = memusage
|
||||
libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
|
@ -0,0 +1,244 @@
|
||||
commit a2da98aa2a13b1bde7fd3a98f31b04ddecfafa8f
|
||||
Author: Joe Simmons-Talbott <josimmon@redhat.com>
|
||||
Date: Tue May 14 14:36:50 2024 +0000
|
||||
|
||||
malloc: Improve aligned_alloc and calloc test coverage.
|
||||
|
||||
Add a DSO (malloc/tst-aligned_alloc-lib.so) that can be used during
|
||||
testing to interpose malloc with a call that randomly uses either
|
||||
aligned_alloc, __libc_malloc, or __libc_calloc in the place of malloc.
|
||||
Use LD_PRELOAD with the DSO to mirror malloc/tst-malloc.c testing as an
|
||||
example in malloc/tst-malloc-random.c. Add malloc/tst-aligned-alloc-random.c
|
||||
as another example that does a number of malloc calls with randomly sized,
|
||||
but limited to 0xffff, requests.
|
||||
|
||||
The intention is to be able to utilize existing malloc testing to ensure
|
||||
that similar allocation APIs are also exposed to the same rigors.
|
||||
|
||||
Reviewed-by: DJ Delorie <dj@redhat.com>
|
||||
(cherry picked from commit 3395157ff2b0657d70c36169156f67440205c8bf)
|
||||
|
||||
diff --git a/malloc/Makefile b/malloc/Makefile
|
||||
index 77ba1a91093ebc55..c1a03f3cb02c464d 100644
|
||||
--- a/malloc/Makefile
|
||||
+++ b/malloc/Makefile
|
||||
@@ -27,6 +27,7 @@ headers := $(dist-headers) obstack.h mcheck.h
|
||||
tests := \
|
||||
mallocbug \
|
||||
tst-aligned-alloc \
|
||||
+ tst-aligned-alloc-random \
|
||||
tst-alloc_buffer \
|
||||
tst-calloc \
|
||||
tst-free-errno \
|
||||
@@ -36,6 +37,7 @@ tests := \
|
||||
tst-malloc-backtrace \
|
||||
tst-malloc-check \
|
||||
tst-malloc-fork-deadlock \
|
||||
+ tst-malloc-random \
|
||||
tst-malloc-stats-cancellation \
|
||||
tst-malloc-tcache-leak \
|
||||
tst-malloc-thread-exit \
|
||||
@@ -193,6 +195,7 @@ extra-libs-others = $(extra-libs)
|
||||
|
||||
# Helper objects for some tests.
|
||||
extra-test-objs += \
|
||||
+ tst-aligned_alloc-lib.so \
|
||||
tst-interpose-aux-nothread.o \
|
||||
tst-interpose-aux-thread.o \
|
||||
# extra-test-objs
|
||||
@@ -202,6 +205,9 @@ test-extras = \
|
||||
tst-interpose-aux-thread \
|
||||
# test-extras
|
||||
|
||||
+modules-names = \
|
||||
+ tst-aligned_alloc-lib
|
||||
+
|
||||
libmemusage-routines = memusage
|
||||
libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
|
||||
|
||||
@@ -408,3 +414,9 @@ tst-mallocstate-malloc-check-ENV = LD_PRELOAD=$(objpfx)libc_malloc_debug.so
|
||||
# libc_malloc_debug.so.
|
||||
$(objpfx)tst-mallocstate: $(objpfx)libc_malloc_debug.so
|
||||
$(objpfx)tst-mallocstate-malloc-check: $(objpfx)libc_malloc_debug.so
|
||||
+
|
||||
+$(objpfx)tst-aligned-alloc-random.out: $(objpfx)tst-aligned_alloc-lib.so
|
||||
+$(objpfx)tst-malloc-random.out: $(objpfx)tst-aligned_alloc-lib.so
|
||||
+
|
||||
+tst-aligned-alloc-random-ENV = LD_PRELOAD=$(objpfx)tst-aligned_alloc-lib.so
|
||||
+tst-malloc-random-ENV = LD_PRELOAD=$(objpfx)tst-aligned_alloc-lib.so
|
||||
diff --git a/malloc/tst-aligned-alloc-random.c b/malloc/tst-aligned-alloc-random.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..f2825ce38f04e04e
|
||||
--- /dev/null
|
||||
+++ b/malloc/tst-aligned-alloc-random.c
|
||||
@@ -0,0 +1,43 @@
|
||||
+/* Test for randomized malloc that calls aligned_alloc
|
||||
+ Copyright (C) 2024 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 <stdlib.h>
|
||||
+#include <support/check.h>
|
||||
+#include <time.h>
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ void *p1;
|
||||
+ int i;
|
||||
+
|
||||
+ srandom (time (NULL));
|
||||
+
|
||||
+ for (i = 0; i < 1024; i++)
|
||||
+ {
|
||||
+ size_t size = random () & 0xffff;
|
||||
+
|
||||
+ p1 = malloc (size);
|
||||
+ TEST_VERIFY (p1 != NULL);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/malloc/tst-aligned_alloc-lib.c b/malloc/tst-aligned_alloc-lib.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..0205df5acf6297a5
|
||||
--- /dev/null
|
||||
+++ b/malloc/tst-aligned_alloc-lib.c
|
||||
@@ -0,0 +1,72 @@
|
||||
+/* Module used for improved aligned_alloc testing.
|
||||
+ Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
+ Copyright The GNU Toolchain Authors.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public License as
|
||||
+ published by the Free Software Foundation; either version 2.1 of the
|
||||
+ License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
+ not, see <https://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <array_length.h>
|
||||
+#include <libc-symbols.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+extern void *__libc_malloc (size_t size);
|
||||
+extern void *__libc_calloc (size_t n, size_t size);
|
||||
+
|
||||
+int aligned_alloc_count = 0;
|
||||
+int libc_malloc_count = 0;
|
||||
+int libc_calloc_count = 0;
|
||||
+
|
||||
+/* Get a random alignment value. Biased towards the smaller values. Must be
|
||||
+ a power of 2. */
|
||||
+static size_t get_random_alignment (void)
|
||||
+{
|
||||
+ size_t aligns[] = {
|
||||
+ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384
|
||||
+ };
|
||||
+
|
||||
+ return aligns[random () % array_length (aligns)];
|
||||
+}
|
||||
+
|
||||
+static void *get_random_alloc (size_t size)
|
||||
+{
|
||||
+ void *retval;
|
||||
+ size_t align;
|
||||
+
|
||||
+ switch (random() % 3)
|
||||
+ {
|
||||
+ case 1:
|
||||
+ align = get_random_alignment ();
|
||||
+ retval = aligned_alloc (align, size);
|
||||
+ aligned_alloc_count++;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ retval = __libc_calloc (1, size);
|
||||
+ libc_calloc_count++;
|
||||
+ break;
|
||||
+ default:
|
||||
+ retval = __libc_malloc (size);
|
||||
+ libc_malloc_count++;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void * __random_malloc (size_t size)
|
||||
+{
|
||||
+ return get_random_alloc (size);
|
||||
+}
|
||||
+strong_alias (__random_malloc, malloc)
|
||||
diff --git a/malloc/tst-malloc-random.c b/malloc/tst-malloc-random.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..762b70c918cc6004
|
||||
--- /dev/null
|
||||
+++ b/malloc/tst-malloc-random.c
|
||||
@@ -0,0 +1,20 @@
|
||||
+/* Test malloc with random calls to aligned_alloc and calloc.
|
||||
+
|
||||
+ Copyright (C) 2024 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-malloc.c"
|
||||
diff --git a/malloc/tst-malloc.c b/malloc/tst-malloc.c
|
||||
index a7491d3d00f9525f..f7a6e4654c374d01 100644
|
||||
--- a/malloc/tst-malloc.c
|
||||
+++ b/malloc/tst-malloc.c
|
||||
@@ -18,7 +18,9 @@
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <libc-diag.h>
|
||||
+#include <time.h>
|
||||
|
||||
static int errors = 0;
|
||||
|
||||
@@ -35,6 +37,8 @@ do_test (void)
|
||||
void *p, *q;
|
||||
int save;
|
||||
|
||||
+ srandom (time (NULL));
|
||||
+
|
||||
errno = 0;
|
||||
|
||||
DIAG_PUSH_NEEDS_COMMENT;
|
@ -0,0 +1,107 @@
|
||||
commit 9de9cd17e73db0ba9af9ef11dc12d490fb59720c
|
||||
Author: sayan paul <saypaul@redhat.com>
|
||||
Date: Wed May 29 15:31:04 2024 +0530
|
||||
|
||||
malloc: New test to check malloc alternate path using memory obstruction
|
||||
|
||||
The test aims to ensure that malloc uses the alternate path to
|
||||
allocate memory when sbrk() or brk() fails.To achieve this,
|
||||
the test first creates an obstruction at current program break,
|
||||
tests that obstruction with a failing sbrk(), then checks if malloc
|
||||
is still returning a valid ptr thus inferring that malloc() used
|
||||
mmap() instead of brk() or sbrk() to allocate the memory.
|
||||
Reviewed-by: Arjun Shankar <arjun@redhat.com>
|
||||
Reviewed-by: Zack Weinberg <zack@owlfolio.org>
|
||||
|
||||
(cherry picked from commit 127fc56152347d73cb7c1c283e60e1cb1f15e9f9)
|
||||
|
||||
diff --git a/malloc/Makefile b/malloc/Makefile
|
||||
index c1a03f3cb02c464d..cc14cf66c9661f99 100644
|
||||
--- a/malloc/Makefile
|
||||
+++ b/malloc/Makefile
|
||||
@@ -34,6 +34,7 @@ tests := \
|
||||
tst-interpose-nothread \
|
||||
tst-interpose-thread \
|
||||
tst-malloc \
|
||||
+ tst-malloc-alternate-path \
|
||||
tst-malloc-backtrace \
|
||||
tst-malloc-check \
|
||||
tst-malloc-fork-deadlock \
|
||||
diff --git a/malloc/tst-malloc-alternate-path.c b/malloc/tst-malloc-alternate-path.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..43ae916815d6ff47
|
||||
--- /dev/null
|
||||
+++ b/malloc/tst-malloc-alternate-path.c
|
||||
@@ -0,0 +1,72 @@
|
||||
+/* Test that malloc uses mmap when sbrk or brk fails.
|
||||
+ Copyright (C) 2024 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 sets up an obstruction to ensure that brk/sbrk fails to
|
||||
+ grow the heap, then verifies that malloc uses mmap for allocations
|
||||
+ instead. */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+#include <sys/mman.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <libc-pointer-arith.h>
|
||||
+#include <support/check.h>
|
||||
+#include <stddef.h>
|
||||
+#include <stdalign.h>
|
||||
+
|
||||
+#define LARGE_SIZE (10 * (1 << 20)) // 10 MB
|
||||
+static long page_size;
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ /* Get current program break. */
|
||||
+ void *current_brk = sbrk (0);
|
||||
+
|
||||
+ page_size = sysconf (_SC_PAGESIZE);
|
||||
+
|
||||
+ /* Round up to the next page boundary. */
|
||||
+ void *next_page_boundary = PTR_ALIGN_UP (current_brk, page_size);
|
||||
+
|
||||
+ /* Place a mapping using mmap at the next page boundary. */
|
||||
+ void *obstruction_addr
|
||||
+ = mmap (next_page_boundary, page_size, PROT_READ,
|
||||
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
|
||||
+
|
||||
+ /* Check if memory obstruction is set up correctly. */
|
||||
+ TEST_VERIFY_EXIT (obstruction_addr == next_page_boundary);
|
||||
+
|
||||
+ /* Try to extend the heap beyond the obstruction using sbrk */
|
||||
+ int *ptr = sbrk (page_size);
|
||||
+ TEST_VERIFY_EXIT (ptr == (void *) -1);
|
||||
+
|
||||
+ /* Attempt multiple small allocations using malloc. */
|
||||
+ for (size_t i = 0; i < page_size / alignof (max_align_t); i++)
|
||||
+ {
|
||||
+ TEST_VERIFY (malloc (alignof (max_align_t)));
|
||||
+ }
|
||||
+
|
||||
+ /* Attempt to allocate a large block of memory using malloc. */
|
||||
+ TEST_VERIFY_EXIT (malloc (LARGE_SIZE) != NULL);
|
||||
+
|
||||
+ /* Check if malloc changed current program break. */
|
||||
+ TEST_VERIFY_EXIT (current_brk == sbrk (0));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
@ -0,0 +1,46 @@
|
||||
commit 71fcdba577884627c3ee4e43beb915da752efb1f
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Mar 15 19:08:24 2024 +0100
|
||||
|
||||
linux: Use rseq area unconditionally in sched_getcpu (bug 31479)
|
||||
|
||||
Originally, nptl/descr.h included <sys/rseq.h>, but we removed that
|
||||
in commit 2c6b4b272e6b4d07303af25709051c3e96288f2d ("nptl:
|
||||
Unconditionally use a 32-byte rseq area"). After that, it was
|
||||
not ensured that the RSEQ_SIG macro was defined during sched_getcpu.c
|
||||
compilation that provided a definition. This commit always checks
|
||||
the rseq area for CPU number information before using the other
|
||||
approaches.
|
||||
|
||||
This adds an unnecessary (but well-predictable) branch on
|
||||
architectures which do not define RSEQ_SIG, but its cost is small
|
||||
compared to the system call. Most architectures that have vDSO
|
||||
acceleration for getcpu also have rseq support.
|
||||
|
||||
Fixes: 2c6b4b272e6b4d07303af25709051c3e96288f2d
|
||||
Fixes: 1d350aa06091211863e41169729cee1bca39f72f
|
||||
Reviewed-by: Arjun Shankar <arjun@redhat.com>
|
||||
(cherry picked from commit 7a76f218677d149d8b7875b336722108239f7ee9)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/sched_getcpu.c b/sysdeps/unix/sysv/linux/sched_getcpu.c
|
||||
index dfb884568d154537..72a3360550b8667a 100644
|
||||
--- a/sysdeps/unix/sysv/linux/sched_getcpu.c
|
||||
+++ b/sysdeps/unix/sysv/linux/sched_getcpu.c
|
||||
@@ -33,17 +33,9 @@ vsyscall_sched_getcpu (void)
|
||||
return r == -1 ? r : cpu;
|
||||
}
|
||||
|
||||
-#ifdef RSEQ_SIG
|
||||
int
|
||||
sched_getcpu (void)
|
||||
{
|
||||
int cpu_id = THREAD_GETMEM_VOLATILE (THREAD_SELF, rseq_area.cpu_id);
|
||||
return __glibc_likely (cpu_id >= 0) ? cpu_id : vsyscall_sched_getcpu ();
|
||||
}
|
||||
-#else /* RSEQ_SIG */
|
||||
-int
|
||||
-sched_getcpu (void)
|
||||
-{
|
||||
- return vsyscall_sched_getcpu ();
|
||||
-}
|
||||
-#endif /* RSEQ_SIG */
|
@ -0,0 +1,21 @@
|
||||
commit e1d0040a6d1b0714e1ad14abeb7b90bfbd86a8dc
|
||||
Author: Mike FABIAN <mfabian@redhat.com>
|
||||
Date: Wed Feb 7 18:41:02 2024 +0100
|
||||
|
||||
localedata: ssy_ER: Fix syntax error
|
||||
|
||||
(cherry picked from commit 07fd072caff50bca2a7e9f5737a5b38280d2ffda)
|
||||
|
||||
diff --git a/localedata/locales/ssy_ER b/localedata/locales/ssy_ER
|
||||
index 05d94c9f10398c45..43a16e0f5452ad6a 100644
|
||||
--- a/localedata/locales/ssy_ER
|
||||
+++ b/localedata/locales/ssy_ER
|
||||
@@ -106,7 +106,7 @@ country_ab3 "ERI"
|
||||
country_num 232
|
||||
country_car "ER"
|
||||
% country_isbn unknown, Need ISO 2108
|
||||
-# https://en.wikipedia.org/wiki/Saho_language has "Saaho" as the endonym but CLDR has "Saho"
|
||||
+% https://en.wikipedia.org/wiki/Saho_language has "Saaho" as the endonym but CLDR has "Saho"
|
||||
lang_name "Saho"
|
||||
lang_ab ""
|
||||
lang_term "ssy"
|
@ -0,0 +1,69 @@
|
||||
commit b7f5b0a7114e29577daf64e68970673b61e5fcba
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Mon Jun 10 13:02:06 2024 -0700
|
||||
|
||||
x86: Properly set MINIMUM_X86_ISA_LEVEL for i386 [BZ #31867]
|
||||
|
||||
On i386, set the default minimum ISA level to 0, not 1 (baseline which
|
||||
includes SSE2). There are no changes in config.h nor in config.make on
|
||||
x86-64. This fixes BZ #31867.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Tested-by: Ian Jordan <immoloism@gmail.com>
|
||||
Reviewed-by: Sam James <sam@gentoo.org>
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
(cherry picked from commit 09bc68b0ac26331a0109f0578c9368e09176da18)
|
||||
|
||||
diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
|
||||
index d28d9bcb296c6380..1e2325d0d7212d67 100644
|
||||
--- a/sysdeps/x86/configure
|
||||
+++ b/sysdeps/x86/configure
|
||||
@@ -139,8 +139,10 @@ libc_cv_have_x86_isa_level=4
|
||||
libc_cv_have_x86_isa_level=3
|
||||
#elif MINIMUM_X86_ISA_LEVEL == 2
|
||||
libc_cv_have_x86_isa_level=2
|
||||
-#else
|
||||
+#elif defined __x86_64__
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+#else
|
||||
+libc_cv_have_x86_isa_level=MINIMUM_X86_ISA_LEVEL
|
||||
#endif
|
||||
EOF
|
||||
eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level`
|
||||
@@ -148,8 +150,10 @@ EOF
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_have_x86_isa_level" >&5
|
||||
printf "%s\n" "$libc_cv_have_x86_isa_level" >&6; }
|
||||
-else
|
||||
+elif test $base_machine = x86_64; then
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+else
|
||||
+ libc_cv_have_x86_isa_level=0
|
||||
fi
|
||||
if test $libc_cv_have_x86_isa_level = baseline; then
|
||||
printf "%s\n" "#define MINIMUM_X86_ISA_LEVEL 1" >>confdefs.h
|
||||
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
|
||||
index 5b0acd03d2a30c9b..0b32fdfd4f1bb115 100644
|
||||
--- a/sysdeps/x86/configure.ac
|
||||
+++ b/sysdeps/x86/configure.ac
|
||||
@@ -96,14 +96,18 @@ libc_cv_have_x86_isa_level=4
|
||||
libc_cv_have_x86_isa_level=3
|
||||
#elif MINIMUM_X86_ISA_LEVEL == 2
|
||||
libc_cv_have_x86_isa_level=2
|
||||
-#else
|
||||
+#elif defined __x86_64__
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+#else
|
||||
+libc_cv_have_x86_isa_level=MINIMUM_X86_ISA_LEVEL
|
||||
#endif
|
||||
EOF
|
||||
eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level`
|
||||
rm -rf conftest*])
|
||||
-else
|
||||
+elif test $base_machine = x86_64; then
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+else
|
||||
+ libc_cv_have_x86_isa_level=0
|
||||
fi
|
||||
if test $libc_cv_have_x86_isa_level = baseline; then
|
||||
AC_DEFINE_UNQUOTED(MINIMUM_X86_ISA_LEVEL, 1)
|
@ -0,0 +1,82 @@
|
||||
commit f05638731eeaae70c53b4fb30bfc58bc3c52a6d5
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Tue Jun 11 20:14:56 2024 -0700
|
||||
|
||||
x86: Properly set x86 minimum ISA level [BZ #31883]
|
||||
|
||||
Properly set libc_cv_have_x86_isa_level in shell for MINIMUM_X86_ISA_LEVEL
|
||||
defined as
|
||||
|
||||
(__X86_ISA_V1 + __X86_ISA_V2 + __X86_ISA_V3 + __X86_ISA_V4)
|
||||
|
||||
Also set __X86_ISA_V2 to 1 for i386 if __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
is defined. There are no changes in config.h nor in config.make on x86-64.
|
||||
On i386, -march=x86-64-v2 with GCC generates
|
||||
|
||||
#define MINIMUM_X86_ISA_LEVEL 2
|
||||
|
||||
in config.h and
|
||||
|
||||
have-x86-isa-level = 2
|
||||
|
||||
in config.make. This fixes BZ #31883.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
||||
(cherry picked from commit 29807a271edca3e47195bda0c69ae45e245551a9)
|
||||
|
||||
diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
|
||||
index 1e2325d0d7212d67..04c6ba3e6ca53fb6 100644
|
||||
--- a/sysdeps/x86/configure
|
||||
+++ b/sysdeps/x86/configure
|
||||
@@ -141,8 +141,10 @@ libc_cv_have_x86_isa_level=3
|
||||
libc_cv_have_x86_isa_level=2
|
||||
#elif defined __x86_64__
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+#elif MINIMUM_X86_ISA_LEVEL == 1
|
||||
+libc_cv_have_x86_isa_level=1
|
||||
#else
|
||||
-libc_cv_have_x86_isa_level=MINIMUM_X86_ISA_LEVEL
|
||||
+libc_cv_have_x86_isa_level=0
|
||||
#endif
|
||||
EOF
|
||||
eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level`
|
||||
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
|
||||
index 0b32fdfd4f1bb115..8a259d3971488e4b 100644
|
||||
--- a/sysdeps/x86/configure.ac
|
||||
+++ b/sysdeps/x86/configure.ac
|
||||
@@ -98,8 +98,10 @@ libc_cv_have_x86_isa_level=3
|
||||
libc_cv_have_x86_isa_level=2
|
||||
#elif defined __x86_64__
|
||||
libc_cv_have_x86_isa_level=baseline
|
||||
+#elif MINIMUM_X86_ISA_LEVEL == 1
|
||||
+libc_cv_have_x86_isa_level=1
|
||||
#else
|
||||
-libc_cv_have_x86_isa_level=MINIMUM_X86_ISA_LEVEL
|
||||
+libc_cv_have_x86_isa_level=0
|
||||
#endif
|
||||
EOF
|
||||
eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level`
|
||||
diff --git a/sysdeps/x86/isa-level.h b/sysdeps/x86/isa-level.h
|
||||
index 2c7f74212b9a27e5..03c1fe2bf54e0673 100644
|
||||
--- a/sysdeps/x86/isa-level.h
|
||||
+++ b/sysdeps/x86/isa-level.h
|
||||
@@ -35,7 +35,17 @@
|
||||
# define __X86_ISA_V1 0
|
||||
#endif
|
||||
|
||||
-#if __X86_ISA_V1 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 \
|
||||
+#ifdef __x86_64__
|
||||
+# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
|
||||
+# define __GCC_HAVE_SYNC_COMPARE_AND_SWAP
|
||||
+# endif
|
||||
+#else
|
||||
+# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
+# define __GCC_HAVE_SYNC_COMPARE_AND_SWAP
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#if __X86_ISA_V1 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP \
|
||||
&& defined HAVE_X86_LAHF_SAHF && defined __POPCNT__ && defined __SSE3__ \
|
||||
&& defined __SSSE3__ && defined __SSE4_1__ && defined __SSE4_2__
|
||||
/* NB: ISAs in x86-64 ISA level v2 are used. */
|
@ -0,0 +1,28 @@
|
||||
commit 7f9f25f255ee2c00178779fbce502f4b94b848b9
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Tue Jun 18 10:56:34 2024 +0200
|
||||
|
||||
Linux: Include <dl-symbol-redir-ifunc.h> in dl-sysdep.c
|
||||
|
||||
The _dl_sysdep_parse_arguments function contains initalization
|
||||
of a large on-stack variable:
|
||||
|
||||
dl_parse_auxv_t auxv_values = { 0, };
|
||||
|
||||
This uses a non-inline version of memset on powerpc64le-linux-gnu,
|
||||
so it must use the baseline memset.
|
||||
|
||||
(cherry picked from commit f6ea5d1291cf3f264514d03872ebae84e0293b69)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
|
||||
index e1b14e9eb34ff5cb..a8ec2d7c18cc423e 100644
|
||||
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
|
||||
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <sys/utsname.h>
|
||||
#include <tls.h>
|
||||
#include <unistd.h>
|
||||
+#include <dl-symbol-redir-ifunc.h>
|
||||
|
||||
#include <dl-machine.h>
|
||||
#include <dl-hwcap-check.h>
|
@ -0,0 +1,155 @@
|
||||
commit 74630b1bb717fb98f4692261f2be8d5c84851fa3
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Mon May 6 13:20:56 2024 -0300
|
||||
|
||||
posix: Fix pidfd_spawn/pidfd_spawnp leak if execve fails (BZ 31695)
|
||||
|
||||
If the pidfd_spawn/pidfd_spawnp helper process succeeds, but evecve
|
||||
fails for some reason (either with an invalid/non-existent, memory
|
||||
allocation, etc.) the resulting pidfd is never closed, nor returned
|
||||
to caller (so it can call close).
|
||||
|
||||
Since the process creation failed, it should be up to posix_spawn to
|
||||
also, close the file descriptor in this case (similar to what it
|
||||
does to reap the process).
|
||||
|
||||
This patch also changes the waitpid with waitid (P_PIDFD) for pidfd
|
||||
case, to avoid a possible pid re-use.
|
||||
|
||||
Checked on x86_64-linux-gnu.
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
|
||||
(cherry picked from commit c90cfce849d010474e8cccf3e5bff49a2c8b141f)
|
||||
|
||||
diff --git a/posix/tst-spawn2.c b/posix/tst-spawn2.c
|
||||
index bb507204a2b25271..b2bad3f1f7e026fd 100644
|
||||
--- a/posix/tst-spawn2.c
|
||||
+++ b/posix/tst-spawn2.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <support/check.h>
|
||||
+#include <support/descriptors.h>
|
||||
#include <tst-spawn.h>
|
||||
|
||||
int
|
||||
@@ -38,38 +39,53 @@ do_test (void)
|
||||
char * const args[] = { 0 };
|
||||
PID_T_TYPE pid = -1;
|
||||
|
||||
- int ret = POSIX_SPAWN (&pid, program, 0, 0, args, environ);
|
||||
- if (ret != ENOENT)
|
||||
- {
|
||||
- errno = ret;
|
||||
- FAIL_EXIT1 ("posix_spawn: %m");
|
||||
- }
|
||||
-
|
||||
- /* POSIX states the value returned on pid variable in case of an error
|
||||
- is not specified. GLIBC will update the value iff the child
|
||||
- execution is successful. */
|
||||
- if (pid != -1)
|
||||
- FAIL_EXIT1 ("posix_spawn returned pid != -1 (%i)", (int) pid);
|
||||
-
|
||||
- /* Check if no child is actually created. */
|
||||
- TEST_COMPARE (WAITID (P_ALL, 0, NULL, WEXITED), -1);
|
||||
- TEST_COMPARE (errno, ECHILD);
|
||||
-
|
||||
- /* Same as before, but with posix_spawnp. */
|
||||
- char *args2[] = { (char*) program, 0 };
|
||||
-
|
||||
- ret = POSIX_SPAWNP (&pid, args2[0], 0, 0, args2, environ);
|
||||
- if (ret != ENOENT)
|
||||
- {
|
||||
- errno = ret;
|
||||
- FAIL_EXIT1 ("posix_spawnp: %m");
|
||||
- }
|
||||
-
|
||||
- if (pid != -1)
|
||||
- FAIL_EXIT1 ("posix_spawnp returned pid != -1 (%i)", (int) pid);
|
||||
-
|
||||
- TEST_COMPARE (WAITID (P_ALL, 0, NULL, WEXITED), -1);
|
||||
- TEST_COMPARE (errno, ECHILD);
|
||||
+ {
|
||||
+ struct support_descriptors *descrs = support_descriptors_list ();
|
||||
+
|
||||
+ int ret = POSIX_SPAWN (&pid, program, 0, 0, args, environ);
|
||||
+ if (ret != ENOENT)
|
||||
+ {
|
||||
+ errno = ret;
|
||||
+ FAIL_EXIT1 ("posix_spawn: %m");
|
||||
+ }
|
||||
+
|
||||
+ /* POSIX states the value returned on pid variable in case of an error
|
||||
+ is not specified. GLIBC will update the value iff the child
|
||||
+ execution is successful. */
|
||||
+ if (pid != -1)
|
||||
+ FAIL_EXIT1 ("posix_spawn returned pid != -1 (%i)", (int) pid);
|
||||
+
|
||||
+ /* Check if no child is actually created. */
|
||||
+ TEST_COMPARE (WAITID (P_ALL, 0, NULL, WEXITED), -1);
|
||||
+ TEST_COMPARE (errno, ECHILD);
|
||||
+
|
||||
+ /* Also check if there is no leak descriptors. */
|
||||
+ support_descriptors_check (descrs);
|
||||
+ support_descriptors_free (descrs);
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ /* Same as before, but with posix_spawnp. */
|
||||
+ char *args2[] = { (char*) program, 0 };
|
||||
+
|
||||
+ struct support_descriptors *descrs = support_descriptors_list ();
|
||||
+
|
||||
+ int ret = POSIX_SPAWNP (&pid, args2[0], 0, 0, args2, environ);
|
||||
+ if (ret != ENOENT)
|
||||
+ {
|
||||
+ errno = ret;
|
||||
+ FAIL_EXIT1 ("posix_spawnp: %m");
|
||||
+ }
|
||||
+
|
||||
+ if (pid != -1)
|
||||
+ FAIL_EXIT1 ("posix_spawnp returned pid != -1 (%i)", (int) pid);
|
||||
+
|
||||
+ TEST_COMPARE (WAITID (P_ALL, 0, NULL, WEXITED), -1);
|
||||
+ TEST_COMPARE (errno, ECHILD);
|
||||
+
|
||||
+ support_descriptors_check (descrs);
|
||||
+ support_descriptors_free (descrs);
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
|
||||
index e8ed2babb9b13969..f57e92815eaf3c7b 100644
|
||||
--- a/sysdeps/unix/sysv/linux/spawni.c
|
||||
+++ b/sysdeps/unix/sysv/linux/spawni.c
|
||||
@@ -449,13 +449,22 @@ __spawnix (int *pid, const char *file,
|
||||
caller to actually collect it. */
|
||||
ec = args.err;
|
||||
if (ec > 0)
|
||||
- /* There still an unlikely case where the child is cancelled after
|
||||
- setting args.err, due to a positive error value. Also there is
|
||||
- possible pid reuse race (where the kernel allocated the same pid
|
||||
- to an unrelated process). Unfortunately due synchronization
|
||||
- issues where the kernel might not have the process collected
|
||||
- the waitpid below can not use WNOHANG. */
|
||||
- __waitpid (new_pid, NULL, 0);
|
||||
+ {
|
||||
+ /* There still an unlikely case where the child is cancelled after
|
||||
+ setting args.err, due to a positive error value. Also there is
|
||||
+ possible pid reuse race (where the kernel allocated the same pid
|
||||
+ to an unrelated process). Unfortunately due synchronization
|
||||
+ issues where the kernel might not have the process collected
|
||||
+ the waitpid below can not use WNOHANG. */
|
||||
+ __waitid (use_pidfd ? P_PIDFD : P_PID,
|
||||
+ use_pidfd ? args.pidfd : new_pid,
|
||||
+ NULL,
|
||||
+ WEXITED);
|
||||
+ /* For pidfd we need to also close the file descriptor for the case
|
||||
+ where execve fails. */
|
||||
+ if (use_pidfd)
|
||||
+ __close_nocancel_nostatus (args.pidfd);
|
||||
+ }
|
||||
}
|
||||
else
|
||||
ec = errno;
|
@ -0,0 +1,107 @@
|
||||
commit 6cb25aff8583421cf7a55ddd40abd7bd49176c60
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Thu Mar 14 14:59:35 2024 -0300
|
||||
|
||||
math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
|
||||
|
||||
The commit 16439f419b removed the static fmod/fmodf on i386 and m68k
|
||||
with and empty w_fmod.c (required for the ABIs that uses the newly
|
||||
implementation). This patch fixes by adding the required symbols on
|
||||
the arch-specific w_fmod{f}_compat.c implementation.
|
||||
|
||||
To statically build fmod fails on some ABI (alpha, s390, sparc) because
|
||||
it does not export the ldexpf128, this is also fixed by this patch.
|
||||
|
||||
Checked on i686-linux-gnu and with a build for m68k-linux-gnu.
|
||||
|
||||
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
|
||||
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
|
||||
(cherry picked from commit 0b716305dfb48c2d13ed4f7d06c082b90c1d226f)
|
||||
|
||||
diff --git a/sysdeps/i386/fpu/w_fmod_compat.c b/sysdeps/i386/fpu/w_fmod_compat.c
|
||||
index 5ac9995ffd862a7f..528bfc2a135b5251 100644
|
||||
--- a/sysdeps/i386/fpu/w_fmod_compat.c
|
||||
+++ b/sysdeps/i386/fpu/w_fmod_compat.c
|
||||
@@ -7,8 +7,9 @@
|
||||
# define LIBM_SVID_COMPAT 1
|
||||
# undef compat_symbol
|
||||
# define compat_symbol(a, b, c, d)
|
||||
-#endif
|
||||
-#include <math/w_fmod_compat.c>
|
||||
-#ifdef SHARED
|
||||
+# include <math/w_fmod_compat.c>
|
||||
libm_alias_double (__fmod_compat, fmod)
|
||||
+#else
|
||||
+#include <math-type-macros-double.h>
|
||||
+#include <w_fmod_template.c>
|
||||
#endif
|
||||
diff --git a/sysdeps/i386/fpu/w_fmodf_compat.c b/sysdeps/i386/fpu/w_fmodf_compat.c
|
||||
index cc417e07d39b271d..5a61693e51f98f8f 100644
|
||||
--- a/sysdeps/i386/fpu/w_fmodf_compat.c
|
||||
+++ b/sysdeps/i386/fpu/w_fmodf_compat.c
|
||||
@@ -7,8 +7,9 @@
|
||||
# define LIBM_SVID_COMPAT 1
|
||||
# undef compat_symbol
|
||||
# define compat_symbol(a, b, c, d)
|
||||
-#endif
|
||||
-#include <math/w_fmodf_compat.c>
|
||||
-#ifdef SHARED
|
||||
+# include <math/w_fmodf_compat.c>
|
||||
libm_alias_float (__fmod_compat, fmod)
|
||||
+#else
|
||||
+#include <math-type-macros-float.h>
|
||||
+#include <w_fmod_template.c>
|
||||
#endif
|
||||
diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
|
||||
index 1afbe7d8adbb00ae..932cc4341c53dec3 100644
|
||||
--- a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
|
||||
+++ b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
|
||||
@@ -17,13 +17,13 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
-#if IS_IN (libc)
|
||||
+#if IS_IN (libc) && defined SHARED
|
||||
# define declare_mgen_alias(f,t)
|
||||
#endif
|
||||
#include <math-type-macros-ldouble.h>
|
||||
#include <s_ldexp_template.c>
|
||||
|
||||
-#if IS_IN (libc)
|
||||
+#if IS_IN (libc) && defined SHARED
|
||||
long_double_symbol (libc, __ldexpl, ldexpl);
|
||||
long_double_symbol (libc, __wrap_scalbnl, scalbnl);
|
||||
#endif
|
||||
diff --git a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
|
||||
index 527d4fbed201d4b4..57f38091e6724848 100644
|
||||
--- a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
|
||||
+++ b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
|
||||
@@ -7,8 +7,9 @@
|
||||
# define LIBM_SVID_COMPAT 1
|
||||
# undef compat_symbol
|
||||
# define compat_symbol(a, b, c, d)
|
||||
-#endif
|
||||
#include <math/w_fmod_compat.c>
|
||||
-#ifdef SHARED
|
||||
libm_alias_double (__fmod_compat, fmod)
|
||||
+#else
|
||||
+#include <math-type-macros-double.h>
|
||||
+#include <w_fmod_template.c>
|
||||
#endif
|
||||
diff --git a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
|
||||
index 5043586b910e765f..88db07f443b0c339 100644
|
||||
--- a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
|
||||
+++ b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
|
||||
@@ -7,8 +7,9 @@
|
||||
# define LIBM_SVID_COMPAT 1
|
||||
# undef compat_symbol
|
||||
# define compat_symbol(a, b, c, d)
|
||||
-#endif
|
||||
-#include <math/w_fmodf_compat.c>
|
||||
-#ifdef SHARED
|
||||
+# include <math/w_fmodf_compat.c>
|
||||
libm_alias_float (__fmod_compat, fmod)
|
||||
+#else
|
||||
+#include <math-type-macros-float.h>
|
||||
+#include <w_fmod_template.c>
|
||||
#endif
|
@ -0,0 +1,46 @@
|
||||
commit 3950cbd7a18b48c0f272ca41fa60cc135ff3175a
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Wed Mar 20 11:31:54 2024 -0300
|
||||
|
||||
math: Fix i386 and m68k exp10 on static build (BZ 31775)
|
||||
|
||||
The commit 08ddd26814 removed the static exp10 on i386 and m68k with an
|
||||
empty w_exp10.c (required for the ABIs that uses the newly
|
||||
implementation). This patch fixes by adding the required symbols on the
|
||||
arch-specific w_exp{f}_compat.c implementation.
|
||||
|
||||
Checked on i686-linux-gnu and with a build for m68k-linux-gnu.
|
||||
|
||||
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
|
||||
(cherry picked from commit 1f09aae36aa185b8b1100dfa6b776442279bf580)
|
||||
|
||||
diff --git a/sysdeps/i386/fpu/w_exp10_compat.c b/sysdeps/i386/fpu/w_exp10_compat.c
|
||||
index b53455386ed8e189..49a0e03385e4bfe3 100644
|
||||
--- a/sysdeps/i386/fpu/w_exp10_compat.c
|
||||
+++ b/sysdeps/i386/fpu/w_exp10_compat.c
|
||||
@@ -1,3 +1,8 @@
|
||||
/* i386 provides an optimized __ieee754_exp10. */
|
||||
-#define NO_COMPAT_NEEDED 1
|
||||
-#include <math/w_exp10_compat.c>
|
||||
+#ifdef SHARED
|
||||
+# define NO_COMPAT_NEEDED 1
|
||||
+# include <math/w_exp10_compat.c>
|
||||
+#else
|
||||
+# include <math-type-macros-double.h>
|
||||
+# include <w_exp10_template.c>
|
||||
+#endif
|
||||
diff --git a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c
|
||||
index 0d3e7186261041e3..350f2e4b4d37e569 100644
|
||||
--- a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c
|
||||
+++ b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c
|
||||
@@ -1,3 +1,8 @@
|
||||
/* m68k provides an optimized __ieee754_exp10. */
|
||||
-#define NO_COMPAT_NEEDED 1
|
||||
-#include <math/w_exp10_compat.c>
|
||||
+#ifdef SHARED
|
||||
+# define NO_COMPAT_NEEDED 1
|
||||
+# include <math/w_exp10_compat.c>
|
||||
+#else
|
||||
+# include <math-type-macros-double.h>
|
||||
+# include <w_exp10_template.c>
|
||||
+#endif
|
@ -0,0 +1,30 @@
|
||||
commit d473c9bb3b6b0448985cd195c558de2a49fd2dc2
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Tue May 21 13:52:54 2024 -0300
|
||||
|
||||
math: Fix isnanf128 static build (BZ 31774)
|
||||
|
||||
Some static implementation of float128 routines might call __isnanf128,
|
||||
which is not provided by the static object.
|
||||
|
||||
Checked on x86_64-linux-gnu.
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
|
||||
(cherry picked from commit 5d4999e519ec77e75bef920e2540e8605015680a)
|
||||
|
||||
diff --git a/sysdeps/ieee754/float128/s_isnanf128.c b/sysdeps/ieee754/float128/s_isnanf128.c
|
||||
index 59f71533cedc752e..b73a4e80d707eeb8 100644
|
||||
--- a/sysdeps/ieee754/float128/s_isnanf128.c
|
||||
+++ b/sysdeps/ieee754/float128/s_isnanf128.c
|
||||
@@ -11,7 +11,11 @@
|
||||
#include "../ldbl-128/s_isnanl.c"
|
||||
#if !IS_IN (libm)
|
||||
#include <float128-abi.h>
|
||||
+#ifdef SHARED
|
||||
hidden_ver (__isnanf128_impl, __isnanf128)
|
||||
+#else
|
||||
+strong_alias (__isnanf128_impl, __isnanf128)
|
||||
+#endif
|
||||
_weak_alias (__isnanf128_impl, isnanl)
|
||||
versioned_symbol (libc, __isnanf128_impl, __isnanf128, GLIBC_2_34);
|
||||
#if (SHLIB_COMPAT (libc, FLOAT128_VERSION_M, GLIBC_2_34))
|
@ -0,0 +1,66 @@
|
||||
commit d2cbfcf1d9a4b539007fe04d33e0bdb82d02a2f2
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Wed May 22 15:07:12 2024 -0300
|
||||
|
||||
math: Provide missing math symbols on libc.a (BZ 31781)
|
||||
|
||||
The libc.a for alpha, s390, and sparcv9 does not provide
|
||||
copysignf64x, copysignf128, frexpf64x, frexpf128, modff64x, and
|
||||
modff128.
|
||||
|
||||
Checked with a static build for the affected ABIs.
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
|
||||
(cherry picked from commit eaa8113bf0eb599025e3efdbe1bb214ee8dc645a)
|
||||
|
||||
diff --git a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
|
||||
index 11b42d04ba61b446..80137847d32c7c08 100644
|
||||
--- a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
|
||||
+++ b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
|
||||
@@ -1,10 +1,10 @@
|
||||
#include <math_ldbl_opt.h>
|
||||
#include <libm-alias-ldouble.h>
|
||||
-#if IS_IN (libc)
|
||||
+#if IS_IN (libc) && defined SHARED
|
||||
# undef libm_alias_ldouble
|
||||
# define libm_alias_ldouble(from, to)
|
||||
#endif
|
||||
#include <sysdeps/ieee754/ldbl-128/s_copysignl.c>
|
||||
-#if IS_IN (libc)
|
||||
+#if IS_IN (libc) && defined SHARED
|
||||
long_double_symbol (libc, __copysignl, copysignl);
|
||||
#endif
|
||||
diff --git a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
|
||||
index 73ac41e40c214394..f5f7d349f78ab64e 100644
|
||||
--- a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
|
||||
+++ b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
|
||||
@@ -1,10 +1,10 @@
|
||||
#include <math_ldbl_opt.h>
|
||||
#include <libm-alias-ldouble.h>
|
||||
-#if IS_IN (libc)
|
||||
+#if IS_IN (libc) && defined SHARED
|
||||
# undef libm_alias_ldouble
|
||||
# define libm_alias_ldouble(from, to)
|
||||
#endif
|
||||
#include <sysdeps/ieee754/ldbl-128/s_frexpl.c>
|
||||
-#if IS_IN (libc)
|
||||
+#if IS_IN (libc) && defined SHARED
|
||||
long_double_symbol (libc, __frexpl, frexpl);
|
||||
#endif
|
||||
diff --git a/sysdeps/ieee754/ldbl-64-128/s_modfl.c b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
|
||||
index 7d7aeae111fc6e7a..ba3d31334a0fefa0 100644
|
||||
--- a/sysdeps/ieee754/ldbl-64-128/s_modfl.c
|
||||
+++ b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
|
||||
@@ -1,10 +1,10 @@
|
||||
#include <math_ldbl_opt.h>
|
||||
#include <libm-alias-ldouble.h>
|
||||
-#if IS_IN (libc)
|
||||
+#if IS_IN (libc) && defined SHARED
|
||||
# undef libm_alias_ldouble
|
||||
# define libm_alias_ldouble(from, to)
|
||||
#endif
|
||||
#include <sysdeps/ieee754/ldbl-128/s_modfl.c>
|
||||
-#if IS_IN (libc)
|
||||
+#if IS_IN (libc) && defined SHARED
|
||||
long_double_symbol (libc, __modfl, modfl);
|
||||
#endif
|
@ -0,0 +1,32 @@
|
||||
commit a03631124602f2dcef40d46660b96d2e51c44bfd
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Fri Apr 5 10:27:29 2024 -0300
|
||||
|
||||
stdlib: fix arc4random fallback to /dev/urandom (BZ 31612)
|
||||
|
||||
The __getrandom_nocancel used by __arc4random_buf uses
|
||||
INLINE_SYSCALL_CALL (which returns -1/errno) and the loop checks for
|
||||
the return value instead of errno to fallback to /dev/urandom.
|
||||
|
||||
The malloc code now uses __getrandom_nocancel_nostatus, which uses
|
||||
INTERNAL_SYSCALL_CALL, so there is no need to use the variant that does
|
||||
not set errno (BZ#29624).
|
||||
|
||||
Checked on x86_64-linux-gnu.
|
||||
|
||||
Reviewed-by: Xi Ruoyao <xry111@xry111.site>
|
||||
(cherry picked from commit 184b9e530e6326e668709826903b6d30dc6cac3f)
|
||||
|
||||
diff --git a/stdlib/arc4random.c b/stdlib/arc4random.c
|
||||
index 3ae8fc130234b04d..7818cb9cf66e0f3b 100644
|
||||
--- a/stdlib/arc4random.c
|
||||
+++ b/stdlib/arc4random.c
|
||||
@@ -51,7 +51,7 @@ __arc4random_buf (void *p, size_t n)
|
||||
n -= l;
|
||||
continue; /* Interrupted by a signal; keep going. */
|
||||
}
|
||||
- else if (l == -ENOSYS)
|
||||
+ else if (l < 0 && errno == ENOSYS)
|
||||
break; /* No syscall, so fallback to /dev/urandom. */
|
||||
arc4random_getrandom_failure ();
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
commit 5c46e6b66636be0010e9a732d5ba1e65ebd54687
|
||||
Author: Stefan Liebler <stli@linux.ibm.com>
|
||||
Date: Thu Jul 11 11:28:53 2024 +0200
|
||||
|
||||
s390x: Fix segfault in wcsncmp [BZ #31934]
|
||||
|
||||
The z13/vector-optimized wcsncmp implementation segfaults if n=1
|
||||
and there is only one character (equal on both strings) before
|
||||
the page end. Then it loads and compares one character and misses
|
||||
to check n again. The following load fails.
|
||||
|
||||
This patch removes the extra load and compare of the first character
|
||||
and just start with the loop which uses vector-load-to-block-boundary.
|
||||
This code-path also checks n.
|
||||
|
||||
With this patch both tests are passing:
|
||||
- the simplified one mentioned in the bugzilla 31934
|
||||
- the full one in Florian Weimer's patch:
|
||||
"manual: Document a GNU extension for strncmp/wcsncmp"
|
||||
(https://patchwork.sourceware.org/project/glibc/patch/874j9eml6y.fsf@oldenburg.str.redhat.com/):
|
||||
On s390x-linux-gnu (z16), the new wcsncmp test fails due to bug 31934.
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
|
||||
(cherry picked from commit 9b7651410375ec8848a1944992d663d514db4ba7)
|
||||
|
||||
diff --git a/sysdeps/s390/wcsncmp-vx.S b/sysdeps/s390/wcsncmp-vx.S
|
||||
index bf6dfa6bc2b904b5..8b081567a2a5732c 100644
|
||||
--- a/sysdeps/s390/wcsncmp-vx.S
|
||||
+++ b/sysdeps/s390/wcsncmp-vx.S
|
||||
@@ -59,14 +59,7 @@ ENTRY(WCSNCMP_Z13)
|
||||
sllg %r4,%r4,2 /* Convert character-count to byte-count. */
|
||||
locgrne %r4,%r1 /* Use max byte-count, if bit 0/1 was one. */
|
||||
|
||||
- /* Check first character without vector load. */
|
||||
- lghi %r5,4 /* current_len = 4 bytes. */
|
||||
- /* Check s1/2[0]. */
|
||||
- lt %r0,0(%r2)
|
||||
- l %r1,0(%r3)
|
||||
- je .Lend_cmp_one_char
|
||||
- crjne %r0,%r1,.Lend_cmp_one_char
|
||||
-
|
||||
+ lghi %r5,0 /* current_len = 0 bytes. */
|
||||
.Lloop:
|
||||
vlbb %v17,0(%r5,%r3),6 /* Load s2 to block boundary. */
|
||||
vlbb %v16,0(%r5,%r2),6 /* Load s1 to block boundary. */
|
||||
@@ -167,7 +160,6 @@ ENTRY(WCSNCMP_Z13)
|
||||
srl %r4,2 /* And convert it to character-index. */
|
||||
vlgvf %r0,%v16,0(%r4) /* Load character-values. */
|
||||
vlgvf %r1,%v17,0(%r4)
|
||||
-.Lend_cmp_one_char:
|
||||
cr %r0,%r1
|
||||
je .Lend_equal
|
||||
lghi %r2,1
|
@ -0,0 +1,153 @@
|
||||
commit 1062ebbd1911ec9efe909765ca3ee3809ec3fd67
|
||||
Author: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Wed Jul 3 12:35:34 2024 -0400
|
||||
|
||||
nptl: fix potential merge of __rseq_* relro symbols
|
||||
|
||||
While working on a patch to add support for the extensible rseq ABI, we
|
||||
came across an issue where a new 'const' variable would be merged with
|
||||
the existing '__rseq_size' variable. We tracked this to the use of
|
||||
'-fmerge-all-constants' which allows the compiler to merge identical
|
||||
constant variables. This means that all 'const' variables in a compile
|
||||
unit that are of the same size and are initialized to the same value can
|
||||
be merged.
|
||||
|
||||
In this specific case, on 32 bit systems 'unsigned int' and 'ptrdiff_t'
|
||||
are both 4 bytes and initialized to 0 which should trigger the merge.
|
||||
However for reasons we haven't delved into when the attribute 'section
|
||||
(".data.rel.ro")' is added to the mix, only variables of the same exact
|
||||
types are merged. As far as we know this behavior is not specified
|
||||
anywhere and could change with a new compiler version, hence this patch.
|
||||
|
||||
Move the definitions of these variables into an assembler file and add
|
||||
hidden writable aliases for internal use. This has the added bonus of
|
||||
removing the asm workaround to set the values on rseq registration.
|
||||
|
||||
Tested on Debian 12 with GCC 12.2.
|
||||
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
(cherry picked from commit 2b92982e2369d292560793bee8e730f695f48ff3)
|
||||
|
||||
diff --git a/elf/Makefile b/elf/Makefile
|
||||
index a50a988e7362cf3b..0049ffa13c8d3e51 100644
|
||||
--- a/elf/Makefile
|
||||
+++ b/elf/Makefile
|
||||
@@ -73,6 +73,7 @@ dl-routines = \
|
||||
dl-origin \
|
||||
dl-printf \
|
||||
dl-reloc \
|
||||
+ dl-rseq-symbols \
|
||||
dl-runtime \
|
||||
dl-scope \
|
||||
dl-setup_hash \
|
||||
diff --git a/elf/dl-rseq-symbols.S b/elf/dl-rseq-symbols.S
|
||||
new file mode 100644
|
||||
index 0000000000000000..b4bba06a99b0a486
|
||||
--- /dev/null
|
||||
+++ b/elf/dl-rseq-symbols.S
|
||||
@@ -0,0 +1,64 @@
|
||||
+/* Define symbols used by rseq.
|
||||
+ Copyright (C) 2024 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 <sysdep.h>
|
||||
+
|
||||
+#if __WORDSIZE == 64
|
||||
+#define RSEQ_OFFSET_SIZE 8
|
||||
+#else
|
||||
+#define RSEQ_OFFSET_SIZE 4
|
||||
+#endif
|
||||
+
|
||||
+/* Some targets define a macro to denote the zero register. */
|
||||
+#undef zero
|
||||
+
|
||||
+/* Define 2 symbols: '__rseq_size' is public const and '_rseq_size' (an
|
||||
+ alias of '__rseq_size') is hidden and writable for internal use by the
|
||||
+ dynamic linker which will initialize the value both symbols point to
|
||||
+ before copy relocations take place. */
|
||||
+
|
||||
+ .globl __rseq_size
|
||||
+ .type __rseq_size, %object
|
||||
+ .size __rseq_size, 4
|
||||
+ .hidden _rseq_size
|
||||
+ .globl _rseq_size
|
||||
+ .type _rseq_size, %object
|
||||
+ .size _rseq_size, 4
|
||||
+ .section .data.rel.ro
|
||||
+ .balign 4
|
||||
+__rseq_size:
|
||||
+_rseq_size:
|
||||
+ .zero 4
|
||||
+
|
||||
+/* Define 2 symbols: '__rseq_offset' is public const and '_rseq_offset' (an
|
||||
+ alias of '__rseq_offset') is hidden and writable for internal use by the
|
||||
+ dynamic linker which will initialize the value both symbols point to
|
||||
+ before copy relocations take place. */
|
||||
+
|
||||
+ .globl __rseq_offset
|
||||
+ .type __rseq_offset, %object
|
||||
+ .size __rseq_offset, RSEQ_OFFSET_SIZE
|
||||
+ .hidden _rseq_offset
|
||||
+ .globl _rseq_offset
|
||||
+ .type _rseq_offset, %object
|
||||
+ .size _rseq_offset, RSEQ_OFFSET_SIZE
|
||||
+ .section .data.rel.ro
|
||||
+ .balign RSEQ_OFFSET_SIZE
|
||||
+__rseq_offset:
|
||||
+_rseq_offset:
|
||||
+ .zero RSEQ_OFFSET_SIZE
|
||||
diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c
|
||||
index 092c274f369dd046..7eb35fb13384f6ac 100644
|
||||
--- a/sysdeps/nptl/dl-tls_init_tp.c
|
||||
+++ b/sysdeps/nptl/dl-tls_init_tp.c
|
||||
@@ -45,8 +45,10 @@ rtld_mutex_dummy (pthread_mutex_t *lock)
|
||||
#endif
|
||||
|
||||
const unsigned int __rseq_flags;
|
||||
-const unsigned int __rseq_size attribute_relro;
|
||||
-const ptrdiff_t __rseq_offset attribute_relro;
|
||||
+
|
||||
+/* The variables are in .data.relro but are not yet write-protected. */
|
||||
+extern unsigned int _rseq_size attribute_hidden;
|
||||
+extern ptrdiff_t _rseq_offset attribute_hidden;
|
||||
|
||||
void
|
||||
__tls_pre_init_tp (void)
|
||||
@@ -105,10 +107,7 @@ __tls_init_tp (void)
|
||||
do_rseq = TUNABLE_GET (rseq, int, NULL);
|
||||
if (rseq_register_current_thread (pd, do_rseq))
|
||||
{
|
||||
- /* We need a writable view of the variables. They are in
|
||||
- .data.relro and are not yet write-protected. */
|
||||
- extern unsigned int size __asm__ ("__rseq_size");
|
||||
- size = sizeof (pd->rseq_area);
|
||||
+ _rseq_size = sizeof (pd->rseq_area);
|
||||
}
|
||||
|
||||
#ifdef RSEQ_SIG
|
||||
@@ -117,8 +116,7 @@ __tls_init_tp (void)
|
||||
all targets support __thread_pointer, so set __rseq_offset only
|
||||
if the rseq registration may have happened because RSEQ_SIG is
|
||||
defined. */
|
||||
- extern ptrdiff_t offset __asm__ ("__rseq_offset");
|
||||
- offset = (char *) &pd->rseq_area - (char *) __thread_pointer ();
|
||||
+ _rseq_offset = (char *) &pd->rseq_area - (char *) __thread_pointer ();
|
||||
#endif
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
commit 143a7a06235cf091b63f58a739c8367ffe54a722
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Thu Jul 4 10:09:07 2024 -0300
|
||||
|
||||
elf: Make dl-rseq-symbols Linux only
|
||||
|
||||
And avoid a Hurd build failures.
|
||||
|
||||
Checked on x86_64-linux-gnu.
|
||||
|
||||
(cherry picked from commit 9fc639f654dc004736836613be703e6bed0c36a8)
|
||||
|
||||
diff --git a/elf/Makefile b/elf/Makefile
|
||||
index 0049ffa13c8d3e51..a50a988e7362cf3b 100644
|
||||
--- a/elf/Makefile
|
||||
+++ b/elf/Makefile
|
||||
@@ -73,7 +73,6 @@ dl-routines = \
|
||||
dl-origin \
|
||||
dl-printf \
|
||||
dl-reloc \
|
||||
- dl-rseq-symbols \
|
||||
dl-runtime \
|
||||
dl-scope \
|
||||
dl-setup_hash \
|
||||
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
|
||||
index 415aa1f14dd20ba6..6ab9b901234dc72e 100644
|
||||
--- a/sysdeps/unix/sysv/linux/Makefile
|
||||
+++ b/sysdeps/unix/sysv/linux/Makefile
|
||||
@@ -615,6 +615,10 @@ tests += \
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),elf)
|
||||
+dl-routines += \
|
||||
+ dl-rseq-symbols \
|
||||
+ # dl-routines
|
||||
+
|
||||
sysdep-rtld-routines += \
|
||||
dl-brk \
|
||||
dl-getcwd \
|
||||
diff --git a/elf/dl-rseq-symbols.S b/sysdeps/unix/sysv/linux/dl-rseq-symbols.S
|
||||
similarity index 100%
|
||||
rename from elf/dl-rseq-symbols.S
|
||||
rename to sysdeps/unix/sysv/linux/dl-rseq-symbols.S
|
@ -0,0 +1,137 @@
|
||||
commit e8f521709731ce3ae8d6f1eca30135d5c0606f02
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Mon Jul 8 21:14:00 2024 +0200
|
||||
|
||||
Linux: Make __rseq_size useful for feature detection (bug 31965)
|
||||
|
||||
The __rseq_size value is now the active area of struct rseq
|
||||
(so 20 initially), not the full struct size including padding
|
||||
at the end (32 initially).
|
||||
|
||||
Update misc/tst-rseq to print some additional diagnostics.
|
||||
|
||||
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
(cherry picked from commit 2e456ccf0c34a056e3ccafac4a0c7effef14d918)
|
||||
|
||||
diff --git a/manual/threads.texi b/manual/threads.texi
|
||||
index e5544ff3da8733f4..25e99c9606dcad77 100644
|
||||
--- a/manual/threads.texi
|
||||
+++ b/manual/threads.texi
|
||||
@@ -1007,8 +1007,12 @@ This variable is either zero (if restartable sequence registration
|
||||
failed or has been disabled) or the size of the restartable sequence
|
||||
registration. This can be different from the size of @code{struct rseq}
|
||||
if the kernel has extended the size of the registration. If
|
||||
-registration is successful, @code{__rseq_size} is at least 32 (the
|
||||
-initial size of @code{struct rseq}).
|
||||
+registration is successful, @code{__rseq_size} is at least 20 (the
|
||||
+initially active size of @code{struct rseq}).
|
||||
+
|
||||
+Previous versions of @theglibc{} set this to 32 even if the kernel only
|
||||
+supported the initial area of 20 bytes because the value included unused
|
||||
+padding at the end of the restartable sequence area.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {unsigned int} __rseq_flags
|
||||
diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c
|
||||
index 7eb35fb13384f6ac..7803e19fd16ad803 100644
|
||||
--- a/sysdeps/nptl/dl-tls_init_tp.c
|
||||
+++ b/sysdeps/nptl/dl-tls_init_tp.c
|
||||
@@ -46,10 +46,6 @@ rtld_mutex_dummy (pthread_mutex_t *lock)
|
||||
|
||||
const unsigned int __rseq_flags;
|
||||
|
||||
-/* The variables are in .data.relro but are not yet write-protected. */
|
||||
-extern unsigned int _rseq_size attribute_hidden;
|
||||
-extern ptrdiff_t _rseq_offset attribute_hidden;
|
||||
-
|
||||
void
|
||||
__tls_pre_init_tp (void)
|
||||
{
|
||||
@@ -106,9 +102,7 @@ __tls_init_tp (void)
|
||||
bool do_rseq = true;
|
||||
do_rseq = TUNABLE_GET (rseq, int, NULL);
|
||||
if (rseq_register_current_thread (pd, do_rseq))
|
||||
- {
|
||||
- _rseq_size = sizeof (pd->rseq_area);
|
||||
- }
|
||||
+ _rseq_size = RSEQ_AREA_SIZE_INITIAL_USED;
|
||||
|
||||
#ifdef RSEQ_SIG
|
||||
/* This should be a compile-time constant, but the current
|
||||
diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h
|
||||
index 48eebc1e168fad1e..7ea935b4adab8c20 100644
|
||||
--- a/sysdeps/unix/sysv/linux/rseq-internal.h
|
||||
+++ b/sysdeps/unix/sysv/linux/rseq-internal.h
|
||||
@@ -25,15 +25,34 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/rseq.h>
|
||||
|
||||
+/* 32 is the initially required value for the area size. The
|
||||
+ actually used rseq size may be less (20 bytes initially). */
|
||||
+#define RSEQ_AREA_SIZE_INITIAL 32
|
||||
+#define RSEQ_AREA_SIZE_INITIAL_USED 20
|
||||
+
|
||||
+/* The variables are in .data.relro but are not yet write-protected. */
|
||||
+extern unsigned int _rseq_size attribute_hidden;
|
||||
+extern ptrdiff_t _rseq_offset attribute_hidden;
|
||||
+
|
||||
#ifdef RSEQ_SIG
|
||||
static inline bool
|
||||
rseq_register_current_thread (struct pthread *self, bool do_rseq)
|
||||
{
|
||||
if (do_rseq)
|
||||
{
|
||||
+ unsigned int size;
|
||||
+#if IS_IN (rtld)
|
||||
+ /* Use the hidden symbol in ld.so. */
|
||||
+ size = _rseq_size;
|
||||
+#else
|
||||
+ size = __rseq_size;
|
||||
+#endif
|
||||
+ if (size < RSEQ_AREA_SIZE_INITIAL)
|
||||
+ /* The initial implementation used only 20 bytes out of 32,
|
||||
+ but still expected size 32. */
|
||||
+ size = RSEQ_AREA_SIZE_INITIAL;
|
||||
int ret = INTERNAL_SYSCALL_CALL (rseq, &self->rseq_area,
|
||||
- sizeof (self->rseq_area),
|
||||
- 0, RSEQ_SIG);
|
||||
+ size, 0, RSEQ_SIG);
|
||||
if (!INTERNAL_SYSCALL_ERROR_P (ret))
|
||||
return true;
|
||||
}
|
||||
diff --git a/sysdeps/unix/sysv/linux/tst-rseq.c b/sysdeps/unix/sysv/linux/tst-rseq.c
|
||||
index 2c90409ba02182e7..08a95331306b2a12 100644
|
||||
--- a/sysdeps/unix/sysv/linux/tst-rseq.c
|
||||
+++ b/sysdeps/unix/sysv/linux/tst-rseq.c
|
||||
@@ -29,6 +29,7 @@
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <syscall.h>
|
||||
+# include <sys/auxv.h>
|
||||
# include <thread_pointer.h>
|
||||
# include <tls.h>
|
||||
# include "tst-rseq.h"
|
||||
@@ -42,7 +43,8 @@ do_rseq_main_test (void)
|
||||
TEST_COMPARE (__rseq_flags, 0);
|
||||
TEST_VERIFY ((char *) __thread_pointer () + __rseq_offset
|
||||
== (char *) &pd->rseq_area);
|
||||
- TEST_COMPARE (__rseq_size, sizeof (pd->rseq_area));
|
||||
+ /* The current implementation only supports the initial size. */
|
||||
+ TEST_COMPARE (__rseq_size, 20);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -52,6 +54,12 @@ do_rseq_test (void)
|
||||
{
|
||||
FAIL_UNSUPPORTED ("kernel does not support rseq, skipping test");
|
||||
}
|
||||
+ printf ("info: __rseq_size: %u\n", __rseq_size);
|
||||
+ printf ("info: __rseq_offset: %td\n", __rseq_offset);
|
||||
+ printf ("info: __rseq_flags: %u\n", __rseq_flags);
|
||||
+ printf ("info: getauxval (AT_RSEQ_FEATURE_SIZE): %ld\n",
|
||||
+ getauxval (AT_RSEQ_FEATURE_SIZE));
|
||||
+ printf ("info: getauxval (AT_RSEQ_ALIGN): %ld\n", getauxval (AT_RSEQ_ALIGN));
|
||||
do_rseq_main_test ();
|
||||
}
|
||||
#else /* RSEQ_SIG */
|
@ -0,0 +1,58 @@
|
||||
commit f6a75fddf4e71545c63dfcad99cc2df9bac38093
|
||||
Author: John David Anglin <danglin@gcc.gnu.org>
|
||||
Date: Fri Jul 19 10:10:17 2024 -0400
|
||||
|
||||
Fix usage of _STACK_GROWS_DOWN and _STACK_GROWS_UP defines [BZ 31989]
|
||||
|
||||
Signed-off-by: John David Anglin <dave.anglin@bell.net>
|
||||
Reviewed-By: Andreas K. Hüttel <dilfridge@gentoo.org>
|
||||
(cherry picked from commit 8cfa4ecff21adf226984f135aa576dd8063bbba3)
|
||||
|
||||
diff --git a/malloc/memusage.c b/malloc/memusage.c
|
||||
index e8ae80dc74af4585..f80225b95a36707b 100644
|
||||
--- a/malloc/memusage.c
|
||||
+++ b/malloc/memusage.c
|
||||
@@ -172,7 +172,7 @@ update_data (struct header *result, size_t len, size_t old_len)
|
||||
start_sp = __thread_stack_pointer ();
|
||||
|
||||
uintptr_t sp = __thread_stack_pointer ();
|
||||
-#ifdef _STACK_GROWS_UP
|
||||
+#if _STACK_GROWS_UP
|
||||
/* This can happen in threads where we didn't catch the thread's
|
||||
stack early enough. */
|
||||
if (__glibc_unlikely (sp < start_sp))
|
||||
diff --git a/stdlib/tst-swapcontext2.c b/stdlib/tst-swapcontext2.c
|
||||
index f679755649809653..a9c1dc827cb897f3 100644
|
||||
--- a/stdlib/tst-swapcontext2.c
|
||||
+++ b/stdlib/tst-swapcontext2.c
|
||||
@@ -85,7 +85,7 @@ do_test (void)
|
||||
{
|
||||
/* ____longjmp_chk has */
|
||||
#if 0
|
||||
-#ifdef _STACK_GROWS_DOWN
|
||||
+#if _STACK_GROWS_DOWN
|
||||
#define called_from(this, saved) ((this) < (saved))
|
||||
#else
|
||||
#define called_from(this, saved) ((this) > (saved))
|
||||
@@ -98,7 +98,7 @@ do_test (void)
|
||||
/* Arrange stacks for uctx_func1 and uctx_func2 so that called_from
|
||||
is true when setjmp is called from uctx_func1 and longjmp is called
|
||||
from uctx_func2. */
|
||||
-#ifdef _STACK_GROWS_DOWN
|
||||
+#if _STACK_GROWS_DOWN
|
||||
# define UCTX_FUNC1_STACK 1
|
||||
# define UCTX_FUNC2_STACK 0
|
||||
#else
|
||||
diff --git a/sysdeps/unix/sysv/linux/____longjmp_chk.c b/sysdeps/unix/sysv/linux/____longjmp_chk.c
|
||||
index 0896dc5755dfa1db..3c66a4638eedbbea 100644
|
||||
--- a/sysdeps/unix/sysv/linux/____longjmp_chk.c
|
||||
+++ b/sysdeps/unix/sysv/linux/____longjmp_chk.c
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stackinfo.h>
|
||||
|
||||
-#ifdef _STACK_GROWS_DOWN
|
||||
+#if _STACK_GROWS_DOWN
|
||||
#define called_from(this, saved) ((this) < (saved))
|
||||
#else
|
||||
#define called_from(this, saved) ((this) > (saved))
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue