diff options
author | Danny Rawlins <contact@romster.me> | 2021-09-18 23:32:19 +1000 |
---|---|---|
committer | Danny Rawlins <contact@romster.me> | 2021-09-18 23:32:19 +1000 |
commit | 181932982d2d6aa16fbc5739e72341eadb672e09 (patch) | |
tree | 2edde03e85e3c160d459eb154b49d627e982996f /glibc-32 | |
parent | 2d4cd0f65844495a17fb6694f9991fd43ba5c325 (diff) | |
download | core-181932982d2d6aa16fbc5739e72341eadb672e09.tar.gz core-181932982d2d6aa16fbc5739e72341eadb672e09.tar.xz |
[notify] glibc-32: fixed upstream bugs and CVE-2021-33574 denial of service (application crash) bug
Diffstat (limited to 'glibc-32')
-rw-r--r-- | glibc-32/.signature | 6 | ||||
-rw-r--r-- | glibc-32/Pkgfile | 10 | ||||
-rw-r--r-- | glibc-32/glibc-2.32-5.patch (renamed from glibc-32/glibc-2.32-3.patch) | 2336 |
3 files changed, 1731 insertions, 621 deletions
diff --git a/glibc-32/.signature b/glibc-32/.signature index f749425f..2fb0c92f 100644 --- a/glibc-32/.signature +++ b/glibc-32/.signature @@ -1,8 +1,8 @@ untrusted comment: verify with /etc/ports/core.pub -RWRJc1FUaeVeqsImCrnu91cf6KEXS52UXALzInBBj8j/7tdWU6W8GeQhtQXjP2SxeFlpihMX07JTxkM9R4VuH9jYZbLwbZa+pwQ= -SHA256 (Pkgfile) = 246974317c78736d3518e5bf328b3908d3af6e7c05527b468d5cd28ca283d74e +RWRJc1FUaeVeqj6i1SWfeAprBs5+hbHng33d+BFxFRGCsMbJ+3fw/owHyw4U56/PmHiA9H2OW0HGk1rpe0oXfsWs33xYl4FLNQ8= +SHA256 (Pkgfile) = 7e8956b17109fe3f039c196484c4bc2a443601d32646cca1b04f3628791daa96 SHA256 (.footprint) = 45836a310a6801080a61130aca376091caab990a0c75d9fc039fcb7ad7298642 SHA256 (glibc-2.32.tar.xz) = 1627ea54f5a1a8467032563393e0901077626dc66f37f10ee6363bb722222836 SHA256 (linux-5.4.72.tar.xz) = 0e24645bd56fe5b55a7a662895f5562c103d71b54d097281f0c9c71ff22c1172 -SHA256 (glibc-2.32-3.patch) = 6d84a6054984e89c4b139dfa1a29561ee2f146bafa479f1c465700220a6aee73 +SHA256 (glibc-2.32-5.patch) = 195b66ab42fd8fa82119b720e0432faebac2087cd16943d230d4839e4d308dcf SHA256 (lib32.conf) = 2f174d2bcefe1c29327690514f34d6970fffdd54398320ca23a11b5f1e3c9b2d diff --git a/glibc-32/Pkgfile b/glibc-32/Pkgfile index c0ceb173..b5e259fc 100644 --- a/glibc-32/Pkgfile +++ b/glibc-32/Pkgfile @@ -4,10 +4,10 @@ name=glibc-32 version=2.32 -release=3 -source=(http://ftp.gnu.org/gnu/glibc/glibc-$version.tar.xz \ - http://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.72.tar.xz \ - glibc-$version-3.patch lib32.conf) +release=4 +source=(https://ftp.gnu.org/gnu/glibc/glibc-$version.tar.xz \ + https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.72.tar.xz \ + glibc-$version-5.patch lib32.conf) build() { # install kernel headers @@ -17,7 +17,7 @@ build() { make INSTALL_HDR_PATH=$PKG/usr headers_install chown root:root $PKG/usr - patch -p1 -d $SRC/glibc-${version:0:4} -i $SRC/glibc-$version-3.patch + patch -p1 -d $SRC/glibc-${version:0:4} -i $SRC/glibc-$version-5.patch mkdir $SRC/build cd $SRC/build diff --git a/glibc-32/glibc-2.32-3.patch b/glibc-32/glibc-2.32-5.patch index 8195ec34..b08b1624 100644 --- a/glibc-32/glibc-2.32-3.patch +++ b/glibc-32/glibc-2.32-5.patch @@ -1,114 +1,7 @@ -diff --git a/NEWS b/NEWS -index 485b8ddffa..f278041512 100644 ---- a/NEWS -+++ b/NEWS -@@ -5,6 +5,25 @@ See the end for copying conditions. - Please send GNU C library bug reports via <https://sourceware.org/bugzilla/> - using `glibc' in the "product" field. - -+The following bugs are resolved with this release: -+ -+ [20019] NULL pointer dereference in libc.so.6 IFUNC due to uninitialized GOT -+ [26224] iconv hangs when converting some invalid inputs from several IBM -+ character sets (CVE-2020-27618) -+ [26534] libm.so 2.32 SIGILL in pow() due to FMA4 instruction on non-FMA4 -+ system -+ [26555] string: strerrorname_np does not return the documented value -+ [26600] Transaction ID collisions cause slow DNS lookups in getaddrinfo -+ [26636] libc: 32-bit shmctl(IPC_INFO) crashes when shminfo struct is -+ at the end of a memory mapping -+ [26637] libc: semctl SEM_STAT_ANY fails to pass the buffer specified -+ by the caller to the kernel -+ [26639] libc: msgctl IPC_INFO and MSG_INFO return garbage -+ [26853] aarch64: Missing unwind information in statically linked startup code -+ [26932] libc: sh: Multiple floating point functions defined as stubs only -+ [27130] "rep movsb" performance issue -+ [27177] GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on doesn't work -+ - Version 2.32 - - Major new features: -@@ -185,6 +204,10 @@ Security related changes: - Dytrych of the Cisco Security Assessment and Penetration Team (See - TALOS-2020-1019). - -+ CVE-2020-27618: An infinite loop has been fixed in the iconv program when -+ invoked with input containing redundant shift sequences in the IBM1364, -+ IBM1371, IBM1388, IBM1390, or IBM1399 character sets. -+ - The following bugs are resolved with this release: - - [9809] localedata: ckb_IQ: new Kurdish Sorani locale -diff --git a/Rules b/Rules -index 8b771f6095..beab969fde 100644 ---- a/Rules -+++ b/Rules -@@ -155,6 +155,7 @@ xtests: tests $(xtests-special) - else - tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \ - $(tests-container:%=$(objpfx)%.out) \ -+ $(tests-mcheck:%=$(objpfx)%-mcheck.out) \ - $(tests-special) $(tests-printers-out) - xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special) - endif -@@ -165,7 +166,7 @@ ifeq ($(run-built-tests),no) - tests-expected = - else - tests-expected = $(tests) $(tests-internal) $(tests-printers) \ -- $(tests-container) -+ $(tests-container) $(tests-mcheck:%=%-mcheck) - endif - tests: - $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ -@@ -191,6 +192,7 @@ else - binaries-pie-tests = - binaries-pie-notests = - endif -+binaries-mcheck-tests = $(tests-mcheck:%=%-mcheck) - else - binaries-all-notests = - binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs) -@@ -200,6 +202,7 @@ binaries-static-tests = - binaries-static = - binaries-pie-tests = - binaries-pie-notests = -+binaries-mcheck-tests = - endif - - binaries-pie = $(binaries-pie-tests) $(binaries-pie-notests) -@@ -223,6 +226,14 @@ $(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \ - $(+link-tests) - endif - -+ifneq "$(strip $(binaries-mcheck-tests))" "" -+$(addprefix $(objpfx),$(binaries-mcheck-tests)): %-mcheck: %.o \ -+ $(link-extra-libs-tests) \ -+ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ -+ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) -+ $(+link-tests) -+endif -+ - ifneq "$(strip $(binaries-pie-tests))" "" - $(addprefix $(objpfx),$(binaries-pie-tests)): %: %.o \ - $(link-extra-libs-tests) \ -@@ -253,6 +264,12 @@ $(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \ - $(+link-static-tests) - endif - -+# All mcheck tests will be run with MALLOC_CHECK_=3 -+define mcheck-ENVS -+$(1)-mcheck-ENV = MALLOC_CHECK_=3 -+endef -+$(foreach t,$(tests-mcheck),$(eval $(call mcheck-ENVS,$(t)))) -+ - ifneq "$(strip $(tests) $(tests-internal) $(xtests) $(test-srcs))" "" - # These are the implicit rules for making test outputs - # from the test programs and whatever input files are present. -diff --git a/debug/Makefile b/debug/Makefile -index 3a60d7af7a..0036edd187 100644 ---- a/debug/Makefile -+++ b/debug/Makefile -@@ -51,7 +51,7 @@ routines = backtrace backtracesyms backtracesymsfd noophooks \ +diff -pruN glibc-2.32.orig/debug/Makefile glibc-2.32/debug/Makefile +--- glibc-2.32.orig/debug/Makefile 2021-09-18 21:02:32.642182626 +1000 ++++ glibc-2.32/debug/Makefile 2021-09-18 21:03:05.310302219 +1000 +@@ -51,7 +51,7 @@ routines = backtrace backtracesyms back explicit_bzero_chk \ stack_chk_fail fortify_fail \ $(static-only-routines) @@ -117,11 +10,9 @@ index 3a60d7af7a..0036edd187 100644 # Don't add stack_chk_fail_local.o to libc.a since __stack_chk_fail_local # is an alias of __stack_chk_fail in stack_chk_fail.o. -diff --git a/debug/warning-nop.c b/debug/warning-nop.c -deleted file mode 100644 -index 4ab7e182b7..0000000000 ---- a/debug/warning-nop.c -+++ /dev/null +diff -pruN glibc-2.32.orig/debug/warning-nop.c glibc-2.32/debug/warning-nop.c +--- glibc-2.32.orig/debug/warning-nop.c 2021-09-18 21:02:32.642182626 +1000 ++++ glibc-2.32/debug/warning-nop.c 1970-01-01 10:00:00.000000000 +1000 @@ -1,70 +0,0 @@ -/* Dummy nop functions to elicit link-time warnings. - Copyright (C) 2005-2020 Free Software Foundation, Inc. @@ -193,24 +84,10 @@ index 4ab7e182b7..0000000000 -#define __builtin_object_size(bos, level) 0 - -#include <string.h> -diff --git a/elf/Makefile b/elf/Makefile -index 0b78721848..355e70037b 100644 ---- a/elf/Makefile -+++ b/elf/Makefile -@@ -1381,6 +1381,8 @@ CFLAGS-ifuncmain7pie.c += $(pie-ccflag) - CFLAGS-ifuncmain9pie.c += $(pie-ccflag) - CFLAGS-tst-ifunc-textrel.c += $(pic-ccflag) - -+LDFLAGS-ifuncmain6pie = -Wl,-z,lazy -+ - $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so - $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o - $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so -diff --git a/elf/dl-load.c b/elf/dl-load.c -index e39980fb19..71867e7c1a 100644 ---- a/elf/dl-load.c -+++ b/elf/dl-load.c -@@ -855,10 +855,12 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l, +diff -pruN glibc-2.32.orig/elf/dl-load.c glibc-2.32/elf/dl-load.c +--- glibc-2.32.orig/elf/dl-load.c 2021-09-18 21:02:32.643182660 +1000 ++++ glibc-2.32/elf/dl-load.c 2021-09-18 21:03:05.311302253 +1000 +@@ -855,10 +855,12 @@ lose (int code, int fd, const char *name /* Process PT_GNU_PROPERTY program header PH in module L after PT_LOAD segments are mapped. Only one NT_GNU_PROPERTY_TYPE_0 @@ -225,7 +102,7 @@ index e39980fb19..71867e7c1a 100644 { const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr); const ElfW(Addr) size = ph->p_memsz; -@@ -905,7 +907,7 @@ _dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph) +@@ -905,7 +907,7 @@ _dl_process_pt_gnu_property (struct link last_type = type; /* Target specific property processing. */ @@ -234,7 +111,7 @@ index e39980fb19..71867e7c1a 100644 return; /* Check the next property item. */ -@@ -1251,21 +1253,6 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, +@@ -1251,21 +1253,6 @@ _dl_map_object_from_fd (const char *name maplength, has_holes, loader); if (__glibc_unlikely (errstring != NULL)) goto call_lose; @@ -256,7 +133,7 @@ index e39980fb19..71867e7c1a 100644 } if (l->l_ld == 0) -@@ -1377,6 +1364,21 @@ cannot enable executable stack as shared object requires"); +@@ -1377,6 +1364,21 @@ cannot enable executable stack as shared if (l->l_tls_initimage != NULL) l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_addr; @@ -278,10 +155,99 @@ index e39980fb19..71867e7c1a 100644 /* We are done mapping in the file. We no longer need the descriptor. */ if (__glibc_unlikely (__close_nocancel (fd) != 0)) { -diff --git a/elf/ifuncmain6pie.c b/elf/ifuncmain6pie.c -index 04faeb86ef..4a01906836 100644 ---- a/elf/ifuncmain6pie.c -+++ b/elf/ifuncmain6pie.c +diff -pruN glibc-2.32.orig/elf/dl-tunables.c glibc-2.32/elf/dl-tunables.c +--- glibc-2.32.orig/elf/dl-tunables.c 2021-09-18 21:02:32.643182660 +1000 ++++ glibc-2.32/elf/dl-tunables.c 2021-09-18 21:03:05.311302253 +1000 +@@ -177,6 +177,7 @@ parse_tunables (char *tunestr, char *val + return; + + char *p = tunestr; ++ size_t off = 0; + + while (true) + { +@@ -190,7 +191,11 @@ parse_tunables (char *tunestr, char *val + /* If we reach the end of the string before getting a valid name-value + pair, bail out. */ + if (p[len] == '\0') +- return; ++ { ++ if (__libc_enable_secure) ++ tunestr[off] = '\0'; ++ return; ++ } + + /* We did not find a valid name-value pair before encountering the + colon. */ +@@ -216,35 +221,28 @@ parse_tunables (char *tunestr, char *val + + if (tunable_is_name (cur->name, name)) + { +- /* If we are in a secure context (AT_SECURE) then ignore the tunable +- unless it is explicitly marked as secure. Tunable values take +- precedence over their envvar aliases. */ ++ /* If we are in a secure context (AT_SECURE) then ignore the ++ tunable unless it is explicitly marked as secure. Tunable ++ values take precedence over their envvar aliases. We write ++ the tunables that are not SXID_ERASE back to TUNESTR, thus ++ dropping all SXID_ERASE tunables and any invalid or ++ unrecognized tunables. */ + if (__libc_enable_secure) + { +- if (cur->security_level == TUNABLE_SECLEVEL_SXID_ERASE) ++ if (cur->security_level != TUNABLE_SECLEVEL_SXID_ERASE) + { +- if (p[len] == '\0') +- { +- /* Last tunable in the valstring. Null-terminate and +- return. */ +- *name = '\0'; +- return; +- } +- else +- { +- /* Remove the current tunable from the string. We do +- this by overwriting the string starting from NAME +- (which is where the current tunable begins) with +- the remainder of the string. We then have P point +- to NAME so that we continue in the correct +- position in the valstring. */ +- char *q = &p[len + 1]; +- p = name; +- while (*q != '\0') +- *name++ = *q++; +- name[0] = '\0'; +- len = 0; +- } ++ if (off > 0) ++ tunestr[off++] = ':'; ++ ++ const char *n = cur->name; ++ ++ while (*n != '\0') ++ tunestr[off++] = *n++; ++ ++ tunestr[off++] = '='; ++ ++ for (size_t j = 0; j < len; j++) ++ tunestr[off++] = value[j]; + } + + if (cur->security_level != TUNABLE_SECLEVEL_NONE) +@@ -257,9 +255,7 @@ parse_tunables (char *tunestr, char *val + } + } + +- if (p[len] == '\0') +- return; +- else ++ if (p[len] != '\0') + p += len + 1; + } + } +diff -pruN glibc-2.32.orig/elf/ifuncmain6pie.c glibc-2.32/elf/ifuncmain6pie.c +--- glibc-2.32.orig/elf/ifuncmain6pie.c 2021-09-18 21:02:32.643182660 +1000 ++++ glibc-2.32/elf/ifuncmain6pie.c 2021-09-18 21:03:05.311302253 +1000 @@ -9,7 +9,6 @@ #include "ifunc-sel.h" @@ -327,10 +293,9 @@ index 04faeb86ef..4a01906836 100644 if (foo () != -30) abort (); -diff --git a/elf/ifuncmod6.c b/elf/ifuncmod6.c -index 2e16c1d06d..2f6d0715e6 100644 ---- a/elf/ifuncmod6.c -+++ b/elf/ifuncmod6.c +diff -pruN glibc-2.32.orig/elf/ifuncmod6.c glibc-2.32/elf/ifuncmod6.c +--- glibc-2.32.orig/elf/ifuncmod6.c 2021-09-18 21:02:32.643182660 +1000 ++++ glibc-2.32/elf/ifuncmod6.c 2021-09-18 21:03:05.311302253 +1000 @@ -4,7 +4,7 @@ extern int foo (void); typedef int (*foo_p) (void); @@ -352,11 +317,31 @@ index 2e16c1d06d..2f6d0715e6 100644 - return foo; + return foo (); } -diff --git a/elf/rtld.c b/elf/rtld.c -index 5b882163fa..14a42ed00a 100644 ---- a/elf/rtld.c -+++ b/elf/rtld.c -@@ -1534,10 +1534,10 @@ of this helper program; chances are you did not intend to run this program.\n\ +diff -pruN glibc-2.32.orig/elf/Makefile glibc-2.32/elf/Makefile +--- glibc-2.32.orig/elf/Makefile 2021-09-18 21:02:32.643182660 +1000 ++++ glibc-2.32/elf/Makefile 2021-09-18 21:03:05.311302253 +1000 +@@ -1381,6 +1381,8 @@ CFLAGS-ifuncmain7pie.c += $(pie-ccflag) + CFLAGS-ifuncmain9pie.c += $(pie-ccflag) + CFLAGS-tst-ifunc-textrel.c += $(pic-ccflag) + ++LDFLAGS-ifuncmain6pie = -Wl,-z,lazy ++ + $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so + $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o + $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so +@@ -1630,8 +1632,6 @@ $(objpfx)tst-nodelete-dlclose.out: $(obj + + tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 \ + LD_HWCAP_MASK=0x1 +-tst-env-setuid-tunables-ENV = \ +- GLIBC_TUNABLES=glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096 + + $(objpfx)tst-debug1: $(libdl) + $(objpfx)tst-debug1.out: $(objpfx)tst-debug1mod1.so +diff -pruN glibc-2.32.orig/elf/rtld.c glibc-2.32/elf/rtld.c +--- glibc-2.32.orig/elf/rtld.c 2021-09-18 21:02:32.644182694 +1000 ++++ glibc-2.32/elf/rtld.c 2021-09-18 21:03:05.311302253 +1000 +@@ -1534,10 +1534,10 @@ of this helper program; chances are you switch (ph[-1].p_type) { case PT_NOTE: @@ -369,25 +354,390 @@ index 5b882163fa..14a42ed00a 100644 break; } -diff --git a/iconv/Versions b/iconv/Versions -index 8a5f4cf780..d51af52fa3 100644 ---- a/iconv/Versions -+++ b/iconv/Versions -@@ -6,7 +6,9 @@ libc { - GLIBC_PRIVATE { - # functions shared with iconv program - __gconv_get_alias_db; __gconv_get_cache; __gconv_get_modules_db; -- __gconv_open; __gconv_create_spec; +diff -pruN glibc-2.32.orig/elf/tst-env-setuid.c glibc-2.32/elf/tst-env-setuid.c +--- glibc-2.32.orig/elf/tst-env-setuid.c 2021-09-18 21:02:32.644182694 +1000 ++++ glibc-2.32/elf/tst-env-setuid.c 2021-09-18 21:03:05.311302253 +1000 +@@ -29,173 +29,12 @@ + #include <sys/wait.h> + #include <unistd.h> + ++#include <support/check.h> + #include <support/support.h> + #include <support/test-driver.h> ++#include <support/capture_subprocess.h> + + static char SETGID_CHILD[] = "setgid-child"; +-#define CHILD_STATUS 42 +- +-/* Return a GID which is not our current GID, but is present in the +- supplementary group list. */ +-static gid_t +-choose_gid (void) +-{ +- const int count = 64; +- gid_t groups[count]; +- int ret = getgroups (count, groups); +- if (ret < 0) +- { +- printf ("getgroups: %m\n"); +- exit (1); +- } +- gid_t current = getgid (); +- for (int i = 0; i < ret; ++i) +- { +- if (groups[i] != current) +- return groups[i]; +- } +- return 0; +-} +- +-/* Spawn and execute a program and verify that it returns the CHILD_STATUS. */ +-static pid_t +-do_execve (char **args) +-{ +- pid_t kid = vfork (); +- +- if (kid < 0) +- { +- printf ("vfork: %m\n"); +- return -1; +- } +- +- if (kid == 0) +- { +- /* Child process. */ +- execve (args[0], args, environ); +- _exit (-errno); +- } +- +- if (kid < 0) +- return 1; +- +- int status; +- +- if (waitpid (kid, &status, 0) < 0) +- { +- printf ("waitpid: %m\n"); +- return 1; +- } +- +- if (WEXITSTATUS (status) == EXIT_UNSUPPORTED) +- return EXIT_UNSUPPORTED; +- +- if (!WIFEXITED (status) || WEXITSTATUS (status) != CHILD_STATUS) +- { +- printf ("Unexpected exit status %d from child process\n", +- WEXITSTATUS (status)); +- return 1; +- } +- return 0; +-} +- +-/* Copies the executable into a restricted directory, so that we can +- safely make it SGID with the TARGET group ID. Then runs the +- executable. */ +-static int +-run_executable_sgid (gid_t target) +-{ +- char *dirname = xasprintf ("%s/tst-tunables-setuid.%jd", +- test_dir, (intmax_t) getpid ()); +- char *execname = xasprintf ("%s/bin", dirname); +- int infd = -1; +- int outfd = -1; +- int ret = 0; +- if (mkdir (dirname, 0700) < 0) +- { +- printf ("mkdir: %m\n"); +- goto err; +- } +- infd = open ("/proc/self/exe", O_RDONLY); +- if (infd < 0) +- { +- printf ("open (/proc/self/exe): %m\n"); +- goto err; +- } +- outfd = open (execname, O_WRONLY | O_CREAT | O_EXCL, 0700); +- if (outfd < 0) +- { +- printf ("open (%s): %m\n", execname); +- goto err; +- } +- char buf[4096]; +- for (;;) +- { +- ssize_t rdcount = read (infd, buf, sizeof (buf)); +- if (rdcount < 0) +- { +- printf ("read: %m\n"); +- goto err; +- } +- if (rdcount == 0) +- break; +- char *p = buf; +- char *end = buf + rdcount; +- while (p != end) +- { +- ssize_t wrcount = write (outfd, buf, end - p); +- if (wrcount == 0) +- errno = ENOSPC; +- if (wrcount <= 0) +- { +- printf ("write: %m\n"); +- goto err; +- } +- p += wrcount; +- } +- } +- if (fchown (outfd, getuid (), target) < 0) +- { +- printf ("fchown (%s): %m\n", execname); +- goto err; +- } +- if (fchmod (outfd, 02750) < 0) +- { +- printf ("fchmod (%s): %m\n", execname); +- goto err; +- } +- if (close (outfd) < 0) +- { +- printf ("close (outfd): %m\n"); +- goto err; +- } +- if (close (infd) < 0) +- { +- printf ("close (infd): %m\n"); +- goto err; +- } +- +- char *args[] = {execname, SETGID_CHILD, NULL}; +- +- ret = do_execve (args); +- +-err: +- if (outfd >= 0) +- close (outfd); +- if (infd >= 0) +- close (infd); +- if (execname) +- { +- unlink (execname); +- free (execname); +- } +- if (dirname) +- { +- rmdir (dirname); +- free (dirname); +- } +- return ret; +-} + + #ifndef test_child + static int +@@ -256,40 +95,32 @@ do_test (int argc, char **argv) + if (argc == 2 && strcmp (argv[1], SETGID_CHILD) == 0) + { + if (getgid () == getegid ()) +- { +- /* This can happen if the file system is mounted nosuid. */ +- fprintf (stderr, "SGID failed: GID and EGID match (%jd)\n", +- (intmax_t) getgid ()); +- exit (EXIT_UNSUPPORTED); +- } ++ /* This can happen if the file system is mounted nosuid. */ ++ FAIL_UNSUPPORTED ("SGID failed: GID and EGID match (%jd)\n", ++ (intmax_t) getgid ()); + + int ret = test_child (); + + if (ret != 0) + exit (1); + +- exit (CHILD_STATUS); ++ exit (EXIT_SUCCESS); + } + else + { + if (test_parent () != 0) + exit (1); + +- /* Try running a setgid program. */ +- gid_t target = choose_gid (); +- if (target == 0) +- { +- fprintf (stderr, +- "Could not find a suitable GID for user %jd, skipping test\n", +- (intmax_t) getuid ()); +- exit (0); +- } ++ int status = support_capture_subprogram_self_sgid (SETGID_CHILD); + +- return run_executable_sgid (target); +- } ++ if (WEXITSTATUS (status) == EXIT_UNSUPPORTED) ++ return EXIT_UNSUPPORTED; + -+ # functions used elsewhere in glibc -+ __gconv_open; __gconv_create_spec; __gconv_destroy_spec; ++ if (!WIFEXITED (status)) ++ FAIL_EXIT1 ("Unexpected exit status %d from child process\n", status); - # function used by the gconv modules - __gconv_transliterate; -diff --git a/iconv/gconv_charset.c b/iconv/gconv_charset.c -index 6ccd0773cc..4ba0aa99f5 100644 ---- a/iconv/gconv_charset.c -+++ b/iconv/gconv_charset.c +- /* Something went wrong and our argv was corrupted. */ +- _exit (1); ++ return 0; ++ } + } + + #define TEST_FUNCTION_ARGV do_test +diff -pruN glibc-2.32.orig/elf/tst-env-setuid-tunables.c glibc-2.32/elf/tst-env-setuid-tunables.c +--- glibc-2.32.orig/elf/tst-env-setuid-tunables.c 2021-09-18 21:02:32.644182694 +1000 ++++ glibc-2.32/elf/tst-env-setuid-tunables.c 2021-09-18 21:03:05.311302253 +1000 +@@ -25,35 +25,76 @@ + #include "config.h" + #undef _LIBC + +-#define test_parent test_parent_tunables +-#define test_child test_child_tunables ++#include <errno.h> ++#include <fcntl.h> ++#include <stdlib.h> ++#include <stdint.h> ++#include <stdio.h> ++#include <string.h> ++#include <sys/stat.h> ++#include <sys/wait.h> ++#include <unistd.h> ++#include <intprops.h> ++#include <array_length.h> ++ ++#include <support/check.h> ++#include <support/support.h> ++#include <support/test-driver.h> ++#include <support/capture_subprocess.h> + +-static int test_child_tunables (void); +-static int test_parent_tunables (void); +- +-#include "tst-env-setuid.c" ++const char *teststrings[] = ++{ ++ "glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096", ++ "glibc.malloc.check=2:glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096", ++ "glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096:glibc.malloc.check=2", ++ "glibc.malloc.perturb=0x800", ++ "glibc.malloc.perturb=0x800:glibc.malloc.mmap_threshold=4096", ++ "glibc.malloc.perturb=0x800:not_valid.malloc.check=2:glibc.malloc.mmap_threshold=4096", ++ "glibc.not_valid.check=2:glibc.malloc.mmap_threshold=4096", ++ "not_valid.malloc.check=2:glibc.malloc.mmap_threshold=4096", ++ "glibc.malloc.garbage=2:glibc.maoc.mmap_threshold=4096:glibc.malloc.check=2", ++ "glibc.malloc.check=4:glibc.malloc.garbage=2:glibc.maoc.mmap_threshold=4096", ++ ":glibc.malloc.garbage=2:glibc.malloc.check=1", ++ "glibc.malloc.check=1:glibc.malloc.check=2", ++ "not_valid.malloc.check=2", ++ "glibc.not_valid.check=2", ++}; + +-#define CHILD_VALSTRING_VALUE "glibc.malloc.mmap_threshold=4096" +-#define PARENT_VALSTRING_VALUE \ +- "glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096" ++const char *resultstrings[] = ++{ ++ "glibc.malloc.mmap_threshold=4096", ++ "glibc.malloc.mmap_threshold=4096", ++ "glibc.malloc.mmap_threshold=4096", ++ "glibc.malloc.perturb=0x800", ++ "glibc.malloc.perturb=0x800:glibc.malloc.mmap_threshold=4096", ++ "glibc.malloc.perturb=0x800:glibc.malloc.mmap_threshold=4096", ++ "glibc.malloc.mmap_threshold=4096", ++ "glibc.malloc.mmap_threshold=4096", ++ "", ++ "", ++ "", ++ "", ++ "", ++ "", ++}; + + static int +-test_child_tunables (void) ++test_child (int off) + { + const char *val = getenv ("GLIBC_TUNABLES"); + + #if HAVE_TUNABLES +- if (val != NULL && strcmp (val, CHILD_VALSTRING_VALUE) == 0) ++ if (val != NULL && strcmp (val, resultstrings[off]) == 0) + return 0; + + if (val != NULL) +- printf ("Unexpected GLIBC_TUNABLES VALUE %s\n", val); ++ printf ("[%d] Unexpected GLIBC_TUNABLES VALUE %s\n", off, val); + + return 1; + #else + if (val != NULL) + { +- printf ("GLIBC_TUNABLES not cleared\n"); ++ printf ("[%d] GLIBC_TUNABLES not cleared\n", off); + return 1; + } + return 0; +@@ -61,15 +102,48 @@ test_child_tunables (void) + } + + static int +-test_parent_tunables (void) ++do_test (int argc, char **argv) + { +- const char *val = getenv ("GLIBC_TUNABLES"); ++ /* Setgid child process. */ ++ if (argc == 2) ++ { ++ if (getgid () == getegid ()) ++ /* This can happen if the file system is mounted nosuid. */ ++ FAIL_UNSUPPORTED ("SGID failed: GID and EGID match (%jd)\n", ++ (intmax_t) getgid ()); + +- if (val != NULL && strcmp (val, PARENT_VALSTRING_VALUE) == 0) +- return 0; ++ int ret = test_child (atoi (argv[1])); + +- if (val != NULL) +- printf ("Unexpected GLIBC_TUNABLES VALUE %s\n", val); ++ if (ret != 0) ++ exit (1); + +- return 1; ++ exit (EXIT_SUCCESS); ++ } ++ else ++ { ++ int ret = 0; ++ ++ /* Spawn tests. */ ++ for (int i = 0; i < array_length (teststrings); i++) ++ { ++ char buf[INT_BUFSIZE_BOUND (int)]; ++ ++ printf ("Spawned test for %s (%d)\n", teststrings[i], i); ++ snprintf (buf, sizeof (buf), "%d\n", i); ++ if (setenv ("GLIBC_TUNABLES", teststrings[i], 1) != 0) ++ exit (1); ++ ++ int status = support_capture_subprogram_self_sgid (buf); ++ ++ /* Bail out early if unsupported. */ ++ if (WEXITSTATUS (status) == EXIT_UNSUPPORTED) ++ return EXIT_UNSUPPORTED; ++ ++ ret |= status; ++ } ++ return ret; ++ } + } ++ ++#define TEST_FUNCTION_ARGV do_test ++#include <support/test-driver.c> +diff -pruN glibc-2.32.orig/iconv/gconv_charset.c glibc-2.32/iconv/gconv_charset.c +--- glibc-2.32.orig/iconv/gconv_charset.c 2021-09-18 21:02:32.646182763 +1000 ++++ glibc-2.32/iconv/gconv_charset.c 2021-09-18 21:03:05.311302253 +1000 @@ -216,3 +216,13 @@ out: return ret; } @@ -402,10 +752,9 @@ index 6ccd0773cc..4ba0aa99f5 100644 + return; +} +libc_hidden_def (__gconv_destroy_spec) -diff --git a/iconv/gconv_charset.h b/iconv/gconv_charset.h -index b39b09aea1..e9c122cf7e 100644 ---- a/iconv/gconv_charset.h -+++ b/iconv/gconv_charset.h +diff -pruN glibc-2.32.orig/iconv/gconv_charset.h glibc-2.32/iconv/gconv_charset.h +--- glibc-2.32.orig/iconv/gconv_charset.h 2021-09-18 21:02:32.646182763 +1000 ++++ glibc-2.32/iconv/gconv_charset.h 2021-09-18 21:03:05.311302253 +1000 @@ -48,33 +48,6 @@ #define GCONV_IGNORE_ERRORS_SUFFIX "IGNORE" @@ -440,11 +789,10 @@ index b39b09aea1..e9c122cf7e 100644 /* This function copies in-order, characters from the source 's' that are either alpha-numeric or one in one of these: "_-.,:/" - into the destination 'wp' while dropping all other characters. In the process, it converts all -diff --git a/iconv/gconv_int.h b/iconv/gconv_int.h -index e86938dae7..f721ce30ff 100644 ---- a/iconv/gconv_int.h -+++ b/iconv/gconv_int.h -@@ -152,6 +152,27 @@ extern int __gconv_open (struct gconv_spec *conv_spec, +diff -pruN glibc-2.32.orig/iconv/gconv_int.h glibc-2.32/iconv/gconv_int.h +--- glibc-2.32.orig/iconv/gconv_int.h 2021-09-18 21:02:32.646182763 +1000 ++++ glibc-2.32/iconv/gconv_int.h 2021-09-18 21:03:05.311302253 +1000 +@@ -152,6 +152,27 @@ extern int __gconv_open (struct gconv_sp __gconv_t *handle, int flags); libc_hidden_proto (__gconv_open) @@ -472,11 +820,10 @@ index e86938dae7..f721ce30ff 100644 /* Free resources associated with transformation descriptor CD. */ extern int __gconv_close (__gconv_t cd) attribute_hidden; -diff --git a/iconv/iconv_open.c b/iconv/iconv_open.c -index dd54bc12e0..5b30055c04 100644 ---- a/iconv/iconv_open.c -+++ b/iconv/iconv_open.c -@@ -39,7 +39,7 @@ iconv_open (const char *tocode, const char *fromcode) +diff -pruN glibc-2.32.orig/iconv/iconv_open.c glibc-2.32/iconv/iconv_open.c +--- glibc-2.32.orig/iconv/iconv_open.c 2021-09-18 21:02:32.646182763 +1000 ++++ glibc-2.32/iconv/iconv_open.c 2021-09-18 21:03:05.311302253 +1000 +@@ -39,7 +39,7 @@ iconv_open (const char *tocode, const ch int res = __gconv_open (&conv_spec, &cd, 0); @@ -485,10 +832,9 @@ index dd54bc12e0..5b30055c04 100644 if (__builtin_expect (res, __GCONV_OK) != __GCONV_OK) { -diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c -index b4334faa57..d59979759c 100644 ---- a/iconv/iconv_prog.c -+++ b/iconv/iconv_prog.c +diff -pruN glibc-2.32.orig/iconv/iconv_prog.c glibc-2.32/iconv/iconv_prog.c +--- glibc-2.32.orig/iconv/iconv_prog.c 2021-09-18 21:02:32.646182763 +1000 ++++ glibc-2.32/iconv/iconv_prog.c 2021-09-18 21:03:05.311302253 +1000 @@ -184,7 +184,7 @@ main (int argc, char *argv[]) /* Let's see whether we have these coded character sets. */ res = __gconv_open (&conv_spec, &cd, 0); @@ -498,10 +844,9 @@ index b4334faa57..d59979759c 100644 if (res != __GCONV_OK) { -diff --git a/iconv/tst-iconv_prog.sh b/iconv/tst-iconv_prog.sh -index 8298136b7f..d8db7b335c 100644 ---- a/iconv/tst-iconv_prog.sh -+++ b/iconv/tst-iconv_prog.sh +diff -pruN glibc-2.32.orig/iconv/tst-iconv_prog.sh glibc-2.32/iconv/tst-iconv_prog.sh +--- glibc-2.32.orig/iconv/tst-iconv_prog.sh 2021-09-18 21:02:32.646182763 +1000 ++++ glibc-2.32/iconv/tst-iconv_prog.sh 2021-09-18 21:03:05.311302253 +1000 @@ -102,12 +102,16 @@ hangarray=( "\x00\x80;-c;IBM1161;UTF-8//TRANSLIT//IGNORE" "\x00\xdb;-c;IBM1162;UTF-8//TRANSLIT//IGNORE" @@ -525,34 +870,23 @@ index 8298136b7f..d8db7b335c 100644 "\x00\x53;-c;IBM16804;UTF-8//TRANSLIT//IGNORE" "\x00\x41;-c;IBM274;UTF-8//TRANSLIT//IGNORE" "\x00\x41;-c;IBM275;UTF-8//TRANSLIT//IGNORE" -diff --git a/iconvdata/Makefile b/iconvdata/Makefile -index 4ec2741cdc..4eef07557e 100644 ---- a/iconvdata/Makefile -+++ b/iconvdata/Makefile -@@ -73,7 +73,8 @@ modules.so := $(addsuffix .so, $(modules)) - ifeq (yes,$(build-shared)) - tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \ - tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \ -- bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 -+ bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 \ -+ bug-iconv13 bug-iconv14 - ifeq ($(have-thread-library),yes) - tests += bug-iconv3 - endif -@@ -321,6 +322,8 @@ $(objpfx)bug-iconv10.out: $(objpfx)gconv-modules \ - $(addprefix $(objpfx),$(modules.so)) - $(objpfx)bug-iconv12.out: $(objpfx)gconv-modules \ - $(addprefix $(objpfx),$(modules.so)) -+$(objpfx)bug-iconv14.out: $(objpfx)gconv-modules \ -+ $(addprefix $(objpfx),$(modules.so)) +diff -pruN glibc-2.32.orig/iconv/Versions glibc-2.32/iconv/Versions +--- glibc-2.32.orig/iconv/Versions 2021-09-18 21:02:32.646182763 +1000 ++++ glibc-2.32/iconv/Versions 2021-09-18 21:03:05.311302253 +1000 +@@ -6,7 +6,9 @@ libc { + GLIBC_PRIVATE { + # functions shared with iconv program + __gconv_get_alias_db; __gconv_get_cache; __gconv_get_modules_db; +- __gconv_open; __gconv_create_spec; ++ ++ # functions used elsewhere in glibc ++ __gconv_open; __gconv_create_spec; __gconv_destroy_spec; - $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \ - $(addprefix $(objpfx),$(modules.so)) \ -diff --git a/iconvdata/bug-iconv13.c b/iconvdata/bug-iconv13.c -new file mode 100644 -index 0000000000..87aaff398e ---- /dev/null -+++ b/iconvdata/bug-iconv13.c + # function used by the gconv modules + __gconv_transliterate; +diff -pruN glibc-2.32.orig/iconvdata/bug-iconv13.c glibc-2.32/iconvdata/bug-iconv13.c +--- glibc-2.32.orig/iconvdata/bug-iconv13.c 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/iconvdata/bug-iconv13.c 2021-09-18 21:03:05.311302253 +1000 @@ -0,0 +1,53 @@ +/* bug 24973: Test EUC-KR module + Copyright (C) 2020 Free Software Foundation, Inc. @@ -607,11 +941,9 @@ index 0000000000..87aaff398e +} + +#include <support/test-driver.c> -diff --git a/iconvdata/bug-iconv14.c b/iconvdata/bug-iconv14.c -new file mode 100644 -index 0000000000..902f140fa9 ---- /dev/null -+++ b/iconvdata/bug-iconv14.c +diff -pruN glibc-2.32.orig/iconvdata/bug-iconv14.c glibc-2.32/iconvdata/bug-iconv14.c +--- glibc-2.32.orig/iconvdata/bug-iconv14.c 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/iconvdata/bug-iconv14.c 2021-09-18 21:03:05.311302253 +1000 @@ -0,0 +1,127 @@ +/* Assertion in ISO-2022-JP-3 due to two-character sequence (bug 27256). + Copyright (C) 2021 Free Software Foundation, Inc. @@ -740,11 +1072,10 @@ index 0000000000..902f140fa9 +} + +#include <support/test-driver.c> -diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c -index b0d56cf3ee..1045bae926 100644 ---- a/iconvdata/euc-kr.c -+++ b/iconvdata/euc-kr.c -@@ -80,11 +80,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp) +diff -pruN glibc-2.32.orig/iconvdata/euc-kr.c glibc-2.32/iconvdata/euc-kr.c +--- glibc-2.32.orig/iconvdata/euc-kr.c 2021-09-18 21:02:32.648182831 +1000 ++++ glibc-2.32/iconvdata/euc-kr.c 2021-09-18 21:03:05.311302253 +1000 +@@ -80,11 +80,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned c \ if (ch <= 0x9f) \ ++inptr; \ @@ -757,10 +1088,9 @@ index b0d56cf3ee..1045bae926 100644 { \ /* This is illegal. */ \ STANDARD_FROM_LOOP_ERR_HANDLER (1); \ -diff --git a/iconvdata/ibm1364.c b/iconvdata/ibm1364.c -index 49e7267ab4..521f0825b7 100644 ---- a/iconvdata/ibm1364.c -+++ b/iconvdata/ibm1364.c +diff -pruN glibc-2.32.orig/iconvdata/ibm1364.c glibc-2.32/iconvdata/ibm1364.c +--- glibc-2.32.orig/iconvdata/ibm1364.c 2021-09-18 21:02:32.649182866 +1000 ++++ glibc-2.32/iconvdata/ibm1364.c 2021-09-18 21:03:05.311302253 +1000 @@ -158,24 +158,14 @@ enum \ if (__builtin_expect (ch, 0) == SO) \ @@ -788,10 +1118,9 @@ index 49e7267ab4..521f0825b7 100644 curcs = sb; \ ++inptr; \ continue; \ -diff --git a/iconvdata/iso-2022-jp-3.c b/iconvdata/iso-2022-jp-3.c -index 8c3b7e627e..62cbc54a11 100644 ---- a/iconvdata/iso-2022-jp-3.c -+++ b/iconvdata/iso-2022-jp-3.c +diff -pruN glibc-2.32.orig/iconvdata/iso-2022-jp-3.c glibc-2.32/iconvdata/iso-2022-jp-3.c +--- glibc-2.32.orig/iconvdata/iso-2022-jp-3.c 2021-09-18 21:02:32.651182934 +1000 ++++ glibc-2.32/iconvdata/iso-2022-jp-3.c 2021-09-18 21:03:05.311302253 +1000 @@ -67,23 +67,34 @@ enum CURRENT_SEL_MASK = 7 << 3 }; @@ -894,11 +1223,10 @@ index 8c3b7e627e..62cbc54a11 100644 } \ \ inptr += 2; \ -diff --git a/iconvdata/ksc5601.h b/iconvdata/ksc5601.h -index d3eb3a4ff8..f5cdc72797 100644 ---- a/iconvdata/ksc5601.h -+++ b/iconvdata/ksc5601.h -@@ -50,15 +50,15 @@ ksc5601_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset) +diff -pruN glibc-2.32.orig/iconvdata/ksc5601.h glibc-2.32/iconvdata/ksc5601.h +--- glibc-2.32.orig/iconvdata/ksc5601.h 2021-09-18 21:02:32.652182968 +1000 ++++ glibc-2.32/iconvdata/ksc5601.h 2021-09-18 21:03:05.311302253 +1000 +@@ -50,15 +50,15 @@ ksc5601_to_ucs4 (const unsigned char **s unsigned char ch2; int idx; @@ -917,11 +1245,32 @@ index d3eb3a4ff8..f5cdc72797 100644 ch2 = (*s)[1]; if (ch2 < offset || (ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f) return __UNKNOWN_10646_CHAR; -diff --git a/intl/dcigettext.c b/intl/dcigettext.c -index 2e7c662bc7..bd332e71da 100644 ---- a/intl/dcigettext.c -+++ b/intl/dcigettext.c -@@ -1120,15 +1120,18 @@ _nl_find_msg (struct loaded_l10nfile *domain_file, +diff -pruN glibc-2.32.orig/iconvdata/Makefile glibc-2.32/iconvdata/Makefile +--- glibc-2.32.orig/iconvdata/Makefile 2021-09-18 21:02:32.647182797 +1000 ++++ glibc-2.32/iconvdata/Makefile 2021-09-18 21:03:05.311302253 +1000 +@@ -73,7 +73,8 @@ modules.so := $(addsuffix .so, $(modules + ifeq (yes,$(build-shared)) + tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \ + tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \ +- bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 ++ bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 \ ++ bug-iconv13 bug-iconv14 + ifeq ($(have-thread-library),yes) + tests += bug-iconv3 + endif +@@ -321,6 +322,8 @@ $(objpfx)bug-iconv10.out: $(objpfx)gconv + $(addprefix $(objpfx),$(modules.so)) + $(objpfx)bug-iconv12.out: $(objpfx)gconv-modules \ + $(addprefix $(objpfx),$(modules.so)) ++$(objpfx)bug-iconv14.out: $(objpfx)gconv-modules \ ++ $(addprefix $(objpfx),$(modules.so)) + + $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \ + $(addprefix $(objpfx),$(modules.so)) \ +diff -pruN glibc-2.32.orig/intl/dcigettext.c glibc-2.32/intl/dcigettext.c +--- glibc-2.32.orig/intl/dcigettext.c 2021-09-18 21:02:32.656183106 +1000 ++++ glibc-2.32/intl/dcigettext.c 2021-09-18 21:03:05.311302253 +1000 +@@ -1120,15 +1120,18 @@ _nl_find_msg (struct loaded_l10nfile *do # ifdef _LIBC @@ -947,10 +1296,9 @@ index 2e7c662bc7..bd332e71da 100644 if (__builtin_expect (r != __GCONV_OK, 0)) { /* If the output encoding is the same there is -diff --git a/intl/tst-codeset.c b/intl/tst-codeset.c -index fd70432eca..e9f6e5e09f 100644 ---- a/intl/tst-codeset.c -+++ b/intl/tst-codeset.c +diff -pruN glibc-2.32.orig/intl/tst-codeset.c glibc-2.32/intl/tst-codeset.c +--- glibc-2.32.orig/intl/tst-codeset.c 2021-09-18 21:02:32.656183106 +1000 ++++ glibc-2.32/intl/tst-codeset.c 2021-09-18 21:03:05.311302253 +1000 @@ -22,13 +22,11 @@ #include <stdio.h> #include <stdlib.h> @@ -989,8 +1337,6 @@ index fd70432eca..e9f6e5e09f 100644 - printf ("call 2 returned: %s\n", s); - result = 1; - } -- -- return result; + /* `a with umlaut' is transliterated to `ae'. */ + bind_textdomain_codeset ("codeset", "ASCII//TRANSLIT"); + TEST_COMPARE_STRING (gettext ("cheese"), "Kaese"); @@ -998,17 +1344,17 @@ index fd70432eca..e9f6e5e09f 100644 + /* Transliteration also works by default even if not set. */ + bind_textdomain_codeset ("codeset", "ASCII"); + TEST_COMPARE_STRING (gettext ("cheese"), "Kaese"); -+ + +- return result; + return 0; } -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" +#include <support/test-driver.c> -diff --git a/malloc/Makefile b/malloc/Makefile -index e22cbde22d..5093e8730e 100644 ---- a/malloc/Makefile -+++ b/malloc/Makefile +diff -pruN glibc-2.32.orig/malloc/Makefile glibc-2.32/malloc/Makefile +--- glibc-2.32.orig/malloc/Makefile 2021-09-18 21:02:32.670183585 +1000 ++++ glibc-2.32/malloc/Makefile 2021-09-18 21:03:05.312302287 +1000 @@ -62,6 +62,16 @@ endif tests += $(tests-static) test-srcs = tst-mtrace @@ -1026,7 +1372,7 @@ index e22cbde22d..5093e8730e 100644 routines = malloc morecore mcheck mtrace obstack reallocarray \ scratch_buffer_grow scratch_buffer_grow_preserve \ scratch_buffer_set_array_size \ -@@ -100,6 +110,11 @@ $(objpfx)tst-malloc-thread-exit: $(shared-thread-library) +@@ -100,6 +110,11 @@ $(objpfx)tst-malloc-thread-exit: $(share $(objpfx)tst-malloc-thread-fail: $(shared-thread-library) $(objpfx)tst-malloc-fork-deadlock: $(shared-thread-library) $(objpfx)tst-malloc-stats-cancellation: $(shared-thread-library) @@ -1038,7 +1384,7 @@ index e22cbde22d..5093e8730e 100644 # Export the __malloc_initialize_hook variable to libc.so. LDFLAGS-tst-mallocstate = -rdynamic -@@ -239,6 +254,8 @@ $(tests:%=$(objpfx)%.o): CPPFLAGS += -DTEST_NO_MALLOPT +@@ -239,6 +254,8 @@ $(tests:%=$(objpfx)%.o): CPPFLAGS += -DT $(objpfx)tst-interpose-nothread: $(objpfx)tst-interpose-aux-nothread.o $(objpfx)tst-interpose-thread: \ $(objpfx)tst-interpose-aux-thread.o $(shared-thread-library) @@ -1047,18 +1393,17 @@ index e22cbde22d..5093e8730e 100644 $(objpfx)tst-interpose-static-nothread: $(objpfx)tst-interpose-aux-nothread.o $(objpfx)tst-interpose-static-thread: \ $(objpfx)tst-interpose-aux-thread.o $(static-thread-library) -@@ -256,3 +273,6 @@ $(objpfx)tst-dynarray-fail-mem.out: $(objpfx)tst-dynarray-fail.out +@@ -256,3 +273,6 @@ $(objpfx)tst-dynarray-fail-mem.out: $(ob $(objpfx)tst-malloc-tcache-leak: $(shared-thread-library) $(objpfx)tst-malloc_info: $(shared-thread-library) $(objpfx)tst-mallocfork2: $(shared-thread-library) +$(objpfx)tst-malloc-tcache-leak-mcheck: $(shared-thread-library) +$(objpfx)tst-malloc_info-mcheck: $(shared-thread-library) +$(objpfx)tst-mallocfork2-mcheck: $(shared-thread-library) -diff --git a/manual/tunables.texi b/manual/tunables.texi -index 23ef0d40e7..d72d7a5ec0 100644 ---- a/manual/tunables.texi -+++ b/manual/tunables.texi -@@ -432,7 +432,11 @@ set shared cache size in bytes for use in memory and string routines. +diff -pruN glibc-2.32.orig/manual/tunables.texi glibc-2.32/manual/tunables.texi +--- glibc-2.32.orig/manual/tunables.texi 2021-09-18 21:02:32.672183654 +1000 ++++ glibc-2.32/manual/tunables.texi 2021-09-18 21:03:05.312302287 +1000 +@@ -432,7 +432,11 @@ set shared cache size in bytes for use i @deftp Tunable glibc.cpu.x86_non_temporal_threshold The @code{glibc.cpu.x86_non_temporal_threshold} tunable allows the user @@ -1071,10 +1416,9 @@ index 23ef0d40e7..d72d7a5ec0 100644 This tunable is specific to i386 and x86-64. @end deftp -diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h -index 19d9cc5cfe..38221d0b2a 100644 ---- a/misc/sys/cdefs.h -+++ b/misc/sys/cdefs.h +diff -pruN glibc-2.32.orig/misc/sys/cdefs.h glibc-2.32/misc/sys/cdefs.h +--- glibc-2.32.orig/misc/sys/cdefs.h 2021-09-18 21:02:32.690184271 +1000 ++++ glibc-2.32/misc/sys/cdefs.h 2021-09-18 21:03:05.312302287 +1000 @@ -124,13 +124,10 @@ #define __bos0(ptr) __builtin_object_size (ptr, 0) @@ -1089,11 +1433,62 @@ index 19d9cc5cfe..38221d0b2a 100644 # define __warnattr(msg) # define __errordecl(name, msg) extern void name (void) #endif -diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c -index 88c69d1e9c..381aa721ef 100644 ---- a/nscd/netgroupcache.c -+++ b/nscd/netgroupcache.c -@@ -248,7 +248,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req, +diff -pruN glibc-2.32.orig/NEWS glibc-2.32/NEWS +--- glibc-2.32.orig/NEWS 2021-09-18 21:02:32.639182523 +1000 ++++ glibc-2.32/NEWS 2021-09-18 21:30:11.284117111 +1000 +@@ -5,6 +5,33 @@ See the end for copying conditions. + Please send GNU C library bug reports via <https://sourceware.org/bugzilla/> + using `glibc' in the "product" field. + ++The following bugs are resolved with this release: ++ ++ [20019] NULL pointer dereference in libc.so.6 IFUNC due to uninitialized GOT ++ [25399] Remove __warn_memset_zero_len ++ [26224] iconv hangs when converting some invalid inputs from several IBM ++ character sets (CVE-2020-27618) ++ [26534] libm.so 2.32 SIGILL in pow() due to FMA4 instruction on non-FMA4 ++ system ++ [26555] string: strerrorname_np does not return the documented value ++ [26600] Transaction ID collisions cause slow DNS lookups in getaddrinfo ++ [26636] libc: 32-bit shmctl(IPC_INFO) crashes when shminfo struct is ++ at the end of a memory mapping ++ [26637] libc: semctl SEM_STAT_ANY fails to pass the buffer specified ++ by the caller to the kernel ++ [26639] libc: msgctl IPC_INFO and MSG_INFO return garbage ++ [26690] __vfscanf_internal: fix aliasing violation ++ [26853] aarch64: Missing unwind information in statically linked startup code ++ [26932] libc: sh: Multiple floating point functions defined as stubs only ++ [27024] posix: Correct attribute access mode on readlinkat ++ [27130] "rep movsb" performance issue ++ [27177] GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on doesn't work ++ [27256] gconv: Fix assertion failure in ISO-2022-JP-3 module ++ [27462] nscd: Fix double free in netgroupcache ++ [27471] Fix SXID_ERASE behavior in setuid programs ++ [27896] Use __pthread_attr_copy in mq_notify (CVE-2021-33574) ++ [28213] librt: fix NULL pointer dereference ++ + Version 2.32 + + Major new features: +@@ -185,6 +212,14 @@ Security related changes: + Dytrych of the Cisco Security Assessment and Penetration Team (See + TALOS-2020-1019). + ++ CVE-2020-27618: An infinite loop has been fixed in the iconv program when ++ invoked with input containing redundant shift sequences in the IBM1364, ++ IBM1371, IBM1388, IBM1390, or IBM1399 character sets. ++ ++ CVE-2021-33574: The mq_notify function has a potential use-after-free ++ issue when using a notification type of SIGEV_THREAD and a thread ++ attribute with a non-default affinity mask. ++ + The following bugs are resolved with this release: + + [9809] localedata: ckb_IQ: new Kurdish Sorani locale +diff -pruN glibc-2.32.orig/nscd/netgroupcache.c glibc-2.32/nscd/netgroupcache.c +--- glibc-2.32.orig/nscd/netgroupcache.c 2021-09-18 21:02:32.692184339 +1000 ++++ glibc-2.32/nscd/netgroupcache.c 2021-09-18 21:03:05.312302287 +1000 +@@ -248,7 +248,7 @@ addgetnetgrentX (struct database_dyn *db : NULL); ndomain = (ndomain ? newbuf + ndomaindiff : NULL); @@ -1102,7 +1497,7 @@ index 88c69d1e9c..381aa721ef 100644 } nhost = memcpy (buffer + bufused, -@@ -319,7 +319,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req, +@@ -319,7 +319,7 @@ addgetnetgrentX (struct database_dyn *db else if (status == NSS_STATUS_TRYAGAIN && e == ERANGE) { buflen *= 2; @@ -1111,10 +1506,44 @@ index 88c69d1e9c..381aa721ef 100644 } else if (status == NSS_STATUS_RETURN || status == NSS_STATUS_NOTFOUND -diff --git a/resolv/Makefile b/resolv/Makefile -index b61c0c3e0c..dbd8f8bf4f 100644 ---- a/resolv/Makefile -+++ b/resolv/Makefile +diff -pruN glibc-2.32.orig/posix/unistd.h glibc-2.32/posix/unistd.h +--- glibc-2.32.orig/posix/unistd.h 2021-09-18 21:02:32.696184476 +1000 ++++ glibc-2.32/posix/unistd.h 2021-09-18 21:04:13.411636170 +1000 +@@ -831,7 +831,7 @@ extern int symlinkat (const char *__from + /* Like readlink but a relative PATH is interpreted relative to FD. */ + extern ssize_t readlinkat (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len) +- __THROW __nonnull ((2, 3)) __wur __attr_access ((__read_only__, 3, 4)); ++ __THROW __nonnull ((2, 3)) __wur __attr_access ((__write_only__, 3, 4)); + #endif + + /* Remove the link NAME. */ +diff -pruN glibc-2.32.orig/posix/wordexp.c glibc-2.32/posix/wordexp.c +--- glibc-2.32.orig/posix/wordexp.c 2021-09-18 21:02:32.696184476 +1000 ++++ glibc-2.32/posix/wordexp.c 2021-09-18 21:03:05.312302287 +1000 +@@ -1399,7 +1399,7 @@ envsubst: + /* Is it a numeric parameter? */ + else if (isdigit (env[0])) + { +- int n = atoi (env); ++ unsigned long n = strtoul (env, NULL, 10); + + if (n >= __libc_argc) + /* Substitute NULL. */ +diff -pruN glibc-2.32.orig/posix/wordexp-test.c glibc-2.32/posix/wordexp-test.c +--- glibc-2.32.orig/posix/wordexp-test.c 2021-09-18 21:02:32.696184476 +1000 ++++ glibc-2.32/posix/wordexp-test.c 2021-09-18 21:03:05.312302287 +1000 +@@ -183,6 +183,7 @@ struct test_case_struct + { 0, NULL, "$var", 0, 0, { NULL, }, IFS }, + { 0, NULL, "\"\\n\"", 0, 1, { "\\n", }, IFS }, + { 0, NULL, "", 0, 0, { NULL, }, IFS }, ++ { 0, NULL, "${1234567890123456789012}", 0, 0, { NULL, }, IFS }, + + /* Flags not already covered (testit() has special handling for these) */ + { 0, NULL, "one two", WRDE_DOOFFS, 2, { "one", "two", }, IFS }, +diff -pruN glibc-2.32.orig/resolv/Makefile glibc-2.32/resolv/Makefile +--- glibc-2.32.orig/resolv/Makefile 2021-09-18 21:02:32.696184476 +1000 ++++ glibc-2.32/resolv/Makefile 2021-09-18 21:03:05.312302287 +1000 @@ -61,6 +61,11 @@ tests += \ tst-resolv-search \ tst-resolv-trailing \ @@ -1127,7 +1556,7 @@ index b61c0c3e0c..dbd8f8bf4f 100644 # These tests need libdl. ifeq (yes,$(build-shared)) tests += \ -@@ -191,6 +196,8 @@ $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library) +@@ -191,6 +196,8 @@ $(objpfx)tst-resolv-search: $(objpfx)lib $(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library) $(objpfx)tst-resolv-threads: \ $(libdl) $(objpfx)libresolv.so $(shared-thread-library) @@ -1136,10 +1565,9 @@ index b61c0c3e0c..dbd8f8bf4f 100644 $(objpfx)tst-resolv-canonname: \ $(libdl) $(objpfx)libresolv.so $(shared-thread-library) $(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library) -diff --git a/resolv/res_send.c b/resolv/res_send.c -index 7e5fec6646..70e5066031 100644 ---- a/resolv/res_send.c -+++ b/resolv/res_send.c +diff -pruN glibc-2.32.orig/resolv/res_send.c glibc-2.32/resolv/res_send.c +--- glibc-2.32.orig/resolv/res_send.c 2021-09-18 21:02:32.696184476 +1000 ++++ glibc-2.32/resolv/res_send.c 2021-09-18 21:03:05.312302287 +1000 @@ -1342,15 +1342,6 @@ send_dg(res_state statp, *terrno = EMSGSIZE; return close_and_return_error (statp, resplen2); @@ -1208,11 +1636,9 @@ index 7e5fec6646..70e5066031 100644 recvresp1 = 1; else recvresp2 = 1; -diff --git a/resolv/tst-resolv-txnid-collision.c b/resolv/tst-resolv-txnid-collision.c -new file mode 100644 -index 0000000000..189b76f126 ---- /dev/null -+++ b/resolv/tst-resolv-txnid-collision.c +diff -pruN glibc-2.32.orig/resolv/tst-resolv-txnid-collision.c glibc-2.32/resolv/tst-resolv-txnid-collision.c +--- glibc-2.32.orig/resolv/tst-resolv-txnid-collision.c 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/resolv/tst-resolv-txnid-collision.c 2021-09-18 21:03:05.312302287 +1000 @@ -0,0 +1,334 @@ +/* Test parallel queries with transaction ID collisions. + Copyright (C) 2020 Free Software Foundation, Inc. @@ -1548,24 +1974,73 @@ index 0000000000..189b76f126 +} + +#include <support/test-driver.c> -diff --git a/stdio-common/Makefile b/stdio-common/Makefile -index 8475fd1f09..eff0c98d82 100644 ---- a/stdio-common/Makefile -+++ b/stdio-common/Makefile -@@ -69,7 +69,8 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \ - tst-printf-bz25691 \ - tst-vfprintf-width-prec-alloc \ - tst-printf-fp-free \ -- tst-printf-fp-leak -+ tst-printf-fp-leak \ -+ test-strerr +diff -pruN glibc-2.32.orig/Rules glibc-2.32/Rules +--- glibc-2.32.orig/Rules 2021-09-18 21:02:32.639182523 +1000 ++++ glibc-2.32/Rules 2021-09-18 21:03:05.310302219 +1000 +@@ -155,6 +155,7 @@ xtests: tests $(xtests-special) + else + tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \ + $(tests-container:%=$(objpfx)%.out) \ ++ $(tests-mcheck:%=$(objpfx)%-mcheck.out) \ + $(tests-special) $(tests-printers-out) + xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special) + endif +@@ -165,7 +166,7 @@ ifeq ($(run-built-tests),no) + tests-expected = + else + tests-expected = $(tests) $(tests-internal) $(tests-printers) \ +- $(tests-container) ++ $(tests-container) $(tests-mcheck:%=%-mcheck) + endif + tests: + $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ +@@ -191,6 +192,7 @@ else + binaries-pie-tests = + binaries-pie-notests = + endif ++binaries-mcheck-tests = $(tests-mcheck:%=%-mcheck) + else + binaries-all-notests = + binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs) +@@ -200,6 +202,7 @@ binaries-static-tests = + binaries-static = + binaries-pie-tests = + binaries-pie-notests = ++binaries-mcheck-tests = + endif + binaries-pie = $(binaries-pie-tests) $(binaries-pie-notests) +@@ -223,6 +226,14 @@ $(addprefix $(objpfx),$(binaries-shared- + $(+link-tests) + endif - test-srcs = tst-unbputc tst-printf tst-printfsz-islongdouble -diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c -index d15f13a22a..2ecf121674 100644 ---- a/stdio-common/errlist.c -+++ b/stdio-common/errlist.c ++ifneq "$(strip $(binaries-mcheck-tests))" "" ++$(addprefix $(objpfx),$(binaries-mcheck-tests)): %-mcheck: %.o \ ++ $(link-extra-libs-tests) \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-tests) ++endif ++ + ifneq "$(strip $(binaries-pie-tests))" "" + $(addprefix $(objpfx),$(binaries-pie-tests)): %: %.o \ + $(link-extra-libs-tests) \ +@@ -253,6 +264,12 @@ $(addprefix $(objpfx),$(binaries-static- + $(+link-static-tests) + endif + ++# All mcheck tests will be run with MALLOC_CHECK_=3 ++define mcheck-ENVS ++$(1)-mcheck-ENV = MALLOC_CHECK_=3 ++endef ++$(foreach t,$(tests-mcheck),$(eval $(call mcheck-ENVS,$(t)))) ++ + ifneq "$(strip $(tests) $(tests-internal) $(xtests) $(test-srcs))" "" + # These are the implicit rules for making test outputs + # from the test programs and whatever input files are present. +diff -pruN glibc-2.32.orig/stdio-common/errlist.c glibc-2.32/stdio-common/errlist.c +--- glibc-2.32.orig/stdio-common/errlist.c 2021-09-18 21:02:32.698184545 +1000 ++++ glibc-2.32/stdio-common/errlist.c 2021-09-18 21:03:05.312302287 +1000 @@ -20,9 +20,13 @@ #include <libintl.h> #include <array_length.h> @@ -1606,10 +2081,22 @@ index d15f13a22a..2ecf121674 100644 #include <errlist.h> #undef _S }; -diff --git a/stdio-common/test-strerr.c b/stdio-common/test-strerr.c -index fded208118..d77b81d507 100644 ---- a/stdio-common/test-strerr.c -+++ b/stdio-common/test-strerr.c +diff -pruN glibc-2.32.orig/stdio-common/Makefile glibc-2.32/stdio-common/Makefile +--- glibc-2.32.orig/stdio-common/Makefile 2021-09-18 21:02:32.698184545 +1000 ++++ glibc-2.32/stdio-common/Makefile 2021-09-18 21:03:05.312302287 +1000 +@@ -69,7 +69,8 @@ tests := tstscanf test_rdwr test-popen t + tst-printf-bz25691 \ + tst-vfprintf-width-prec-alloc \ + tst-printf-fp-free \ +- tst-printf-fp-leak ++ tst-printf-fp-leak \ ++ test-strerr + + + test-srcs = tst-unbputc tst-printf tst-printfsz-islongdouble +diff -pruN glibc-2.32.orig/stdio-common/test-strerr.c glibc-2.32/stdio-common/test-strerr.c +--- glibc-2.32.orig/stdio-common/test-strerr.c 2021-09-18 21:02:32.698184545 +1000 ++++ glibc-2.32/stdio-common/test-strerr.c 2021-09-18 21:03:05.312302287 +1000 @@ -18,46 +18,672 @@ #include <string.h> @@ -2315,11 +2802,10 @@ index fded208118..d77b81d507 100644 return 0; } -diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c -index 95b46dcbeb..3a323547f9 100644 ---- a/stdio-common/vfscanf-internal.c -+++ b/stdio-common/vfscanf-internal.c -@@ -277,7 +277,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr, +diff -pruN glibc-2.32.orig/stdio-common/vfscanf-internal.c glibc-2.32/stdio-common/vfscanf-internal.c +--- glibc-2.32.orig/stdio-common/vfscanf-internal.c 2021-09-18 21:02:32.699184579 +1000 ++++ glibc-2.32/stdio-common/vfscanf-internal.c 2021-09-18 21:03:05.312302287 +1000 +@@ -277,7 +277,7 @@ __vfscanf_internal (FILE *s, const char #endif { va_list arg; @@ -2328,7 +2814,7 @@ index 95b46dcbeb..3a323547f9 100644 UCHAR_T fc; /* Current character of the format. */ WINT_T done = 0; /* Assignments done. */ size_t read_in = 0; /* Chars read in. */ -@@ -415,10 +415,11 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr, +@@ -415,10 +415,11 @@ __vfscanf_internal (FILE *s, const char #endif #ifndef COMPILE_WSCANF @@ -2342,7 +2828,7 @@ index 95b46dcbeb..3a323547f9 100644 if (len > 0) { do -@@ -426,7 +427,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr, +@@ -426,7 +427,7 @@ __vfscanf_internal (FILE *s, const char c = inchar (); if (__glibc_unlikely (c == EOF)) input_error (); @@ -2351,7 +2837,7 @@ index 95b46dcbeb..3a323547f9 100644 { ungetc_not_eof (c, s); conv_error (); -@@ -484,9 +485,9 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr, +@@ -484,9 +485,9 @@ __vfscanf_internal (FILE *s, const char char_buffer_rewind (&charbuf); /* Check for a positional parameter specification. */ @@ -2363,7 +2849,7 @@ index 95b46dcbeb..3a323547f9 100644 if (*f == L_('$')) ++f; else -@@ -521,8 +522,8 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr, +@@ -521,8 +522,8 @@ __vfscanf_internal (FILE *s, const char /* Find the maximum field width. */ width = 0; @@ -2374,7 +2860,7 @@ index 95b46dcbeb..3a323547f9 100644 got_width: if (width == 0) width = -1; -@@ -2522,12 +2523,11 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr, +@@ -2522,12 +2523,11 @@ __vfscanf_internal (FILE *s, const char } while ((fc = *f++) != '\0' && fc != ']') @@ -2389,10 +2875,238 @@ index 95b46dcbeb..3a323547f9 100644 ((char *)charbuf.scratch.data)[fc] = 1; } else -diff --git a/string/bits/string_fortified.h b/string/bits/string_fortified.h -index 309d0f39b2..c8d3051af8 100644 ---- a/string/bits/string_fortified.h -+++ b/string/bits/string_fortified.h +diff -pruN glibc-2.32.orig/stdlib/tst-secure-getenv.c glibc-2.32/stdlib/tst-secure-getenv.c +--- glibc-2.32.orig/stdlib/tst-secure-getenv.c 2021-09-18 21:02:32.700184614 +1000 ++++ glibc-2.32/stdlib/tst-secure-getenv.c 2021-09-18 21:03:05.312302287 +1000 +@@ -30,167 +30,12 @@ + #include <sys/wait.h> + #include <unistd.h> + ++#include <support/check.h> + #include <support/support.h> ++#include <support/capture_subprocess.h> + #include <support/test-driver.h> + + static char MAGIC_ARGUMENT[] = "run-actual-test"; +-#define MAGIC_STATUS 19 +- +-/* Return a GID which is not our current GID, but is present in the +- supplementary group list. */ +-static gid_t +-choose_gid (void) +-{ +- int count = getgroups (0, NULL); +- if (count < 0) +- { +- printf ("getgroups: %m\n"); +- exit (1); +- } +- gid_t *groups; +- groups = xcalloc (count, sizeof (*groups)); +- int ret = getgroups (count, groups); +- if (ret < 0) +- { +- printf ("getgroups: %m\n"); +- exit (1); +- } +- gid_t current = getgid (); +- gid_t not_current = 0; +- for (int i = 0; i < ret; ++i) +- { +- if (groups[i] != current) +- { +- not_current = groups[i]; +- break; +- } +- } +- free (groups); +- return not_current; +-} +- +- +-/* Copies the executable into a restricted directory, so that we can +- safely make it SGID with the TARGET group ID. Then runs the +- executable. */ +-static int +-run_executable_sgid (gid_t target) +-{ +- char *dirname = xasprintf ("%s/secure-getenv.%jd", +- test_dir, (intmax_t) getpid ()); +- char *execname = xasprintf ("%s/bin", dirname); +- int infd = -1; +- int outfd = -1; +- int ret = -1; +- if (mkdir (dirname, 0700) < 0) +- { +- printf ("mkdir: %m\n"); +- goto err; +- } +- infd = open ("/proc/self/exe", O_RDONLY); +- if (infd < 0) +- { +- printf ("open (/proc/self/exe): %m\n"); +- goto err; +- } +- outfd = open (execname, O_WRONLY | O_CREAT | O_EXCL, 0700); +- if (outfd < 0) +- { +- printf ("open (%s): %m\n", execname); +- goto err; +- } +- char buf[4096]; +- for (;;) +- { +- ssize_t rdcount = read (infd, buf, sizeof (buf)); +- if (rdcount < 0) +- { +- printf ("read: %m\n"); +- goto err; +- } +- if (rdcount == 0) +- break; +- char *p = buf; +- char *end = buf + rdcount; +- while (p != end) +- { +- ssize_t wrcount = write (outfd, buf, end - p); +- if (wrcount == 0) +- errno = ENOSPC; +- if (wrcount <= 0) +- { +- printf ("write: %m\n"); +- goto err; +- } +- p += wrcount; +- } +- } +- if (fchown (outfd, getuid (), target) < 0) +- { +- printf ("fchown (%s): %m\n", execname); +- goto err; +- } +- if (fchmod (outfd, 02750) < 0) +- { +- printf ("fchmod (%s): %m\n", execname); +- goto err; +- } +- if (close (outfd) < 0) +- { +- printf ("close (outfd): %m\n"); +- goto err; +- } +- if (close (infd) < 0) +- { +- printf ("close (infd): %m\n"); +- goto err; +- } +- +- int kid = fork (); +- if (kid < 0) +- { +- printf ("fork: %m\n"); +- goto err; +- } +- if (kid == 0) +- { +- /* Child process. */ +- char *args[] = { execname, MAGIC_ARGUMENT, NULL }; +- execve (execname, args, environ); +- printf ("execve (%s): %m\n", execname); +- _exit (1); +- } +- int status; +- if (waitpid (kid, &status, 0) < 0) +- { +- printf ("waitpid: %m\n"); +- goto err; +- } +- if (!WIFEXITED (status) || WEXITSTATUS (status) != MAGIC_STATUS) +- { +- printf ("Unexpected exit status %d from child process\n", +- status); +- goto err; +- } +- ret = 0; +- +-err: +- if (outfd >= 0) +- close (outfd); +- if (infd >= 0) +- close (infd); +- if (execname) +- { +- unlink (execname); +- free (execname); +- } +- if (dirname) +- { +- rmdir (dirname); +- free (dirname); +- } +- return ret; +-} + + static int + do_test (void) +@@ -212,15 +57,15 @@ do_test (void) + exit (1); + } + +- gid_t target = choose_gid (); +- if (target == 0) +- { +- fprintf (stderr, +- "Could not find a suitable GID for user %jd, skipping test\n", +- (intmax_t) getuid ()); +- exit (0); +- } +- return run_executable_sgid (target); ++ int status = support_capture_subprogram_self_sgid (MAGIC_ARGUMENT); ++ ++ if (WEXITSTATUS (status) == EXIT_UNSUPPORTED) ++ return EXIT_UNSUPPORTED; ++ ++ if (!WIFEXITED (status)) ++ FAIL_EXIT1 ("Unexpected exit status %d from child process\n", status); ++ ++ return 0; + } + + static void +@@ -229,23 +74,15 @@ alternative_main (int argc, char **argv) + if (argc == 2 && strcmp (argv[1], MAGIC_ARGUMENT) == 0) + { + if (getgid () == getegid ()) +- { +- /* This can happen if the file system is mounted nosuid. */ +- fprintf (stderr, "SGID failed: GID and EGID match (%jd)\n", +- (intmax_t) getgid ()); +- exit (MAGIC_STATUS); +- } ++ /* This can happen if the file system is mounted nosuid. */ ++ FAIL_UNSUPPORTED ("SGID failed: GID and EGID match (%jd)\n", ++ (intmax_t) getgid ()); + if (getenv ("PATH") == NULL) +- { +- printf ("PATH variable not present\n"); +- exit (3); +- } ++ FAIL_EXIT (3, "PATH variable not present\n"); + if (secure_getenv ("PATH") != NULL) +- { +- printf ("PATH variable not filtered out\n"); +- exit (4); +- } +- exit (MAGIC_STATUS); ++ FAIL_EXIT (4, "PATH variable not filtered out\n"); ++ ++ exit (EXIT_SUCCESS); + } + } + +diff -pruN glibc-2.32.orig/string/bits/string_fortified.h glibc-2.32/string/bits/string_fortified.h +--- glibc-2.32.orig/string/bits/string_fortified.h 2021-09-18 21:02:32.700184614 +1000 ++++ glibc-2.32/string/bits/string_fortified.h 2021-09-18 21:03:05.312302287 +1000 @@ -22,11 +22,6 @@ # error "Never use <bits/string_fortified.h> directly; include <string.h> instead." #endif @@ -2405,7 +3119,7 @@ index 309d0f39b2..c8d3051af8 100644 __fortify_function void * __NTH (memcpy (void *__restrict __dest, const void *__restrict __src, size_t __len)) -@@ -58,16 +53,6 @@ __NTH (mempcpy (void *__restrict __dest, const void *__restrict __src, +@@ -58,16 +53,6 @@ __NTH (mempcpy (void *__restrict __dest, __fortify_function void * __NTH (memset (void *__dest, int __ch, size_t __len)) { @@ -2422,10 +3136,25 @@ index 309d0f39b2..c8d3051af8 100644 return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); } -diff --git a/support/Makefile b/support/Makefile -index 93faafddf9..4154863511 100644 ---- a/support/Makefile -+++ b/support/Makefile +diff -pruN glibc-2.32.orig/support/capture_subprocess.h glibc-2.32/support/capture_subprocess.h +--- glibc-2.32.orig/support/capture_subprocess.h 2021-09-18 21:02:32.701184648 +1000 ++++ glibc-2.32/support/capture_subprocess.h 2021-09-18 21:03:05.312302287 +1000 +@@ -41,6 +41,12 @@ struct support_capture_subprocess suppor + struct support_capture_subprocess support_capture_subprogram + (const char *file, char *const argv[]); + ++/* Copy the running program into a setgid binary and run it with CHILD_ID ++ argument. If execution is successful, return the exit status of the child ++ program, otherwise return a non-zero failure exit code. */ ++int support_capture_subprogram_self_sgid ++ (char *child_id); ++ + /* Deallocate the subprocess data captured by + support_capture_subprocess. */ + void support_capture_subprocess_free (struct support_capture_subprocess *); +diff -pruN glibc-2.32.orig/support/Makefile glibc-2.32/support/Makefile +--- glibc-2.32.orig/support/Makefile 2021-09-18 21:02:32.701184648 +1000 ++++ glibc-2.32/support/Makefile 2021-09-18 21:03:05.312302287 +1000 @@ -35,6 +35,8 @@ libsupport-routines = \ ignore_stderr \ next_to_fault \ @@ -2435,11 +3164,9 @@ index 93faafddf9..4154863511 100644 resolv_test \ set_fortify_handler \ support-xfstat \ -diff --git a/support/resolv_response_context_duplicate.c b/support/resolv_response_context_duplicate.c -new file mode 100644 -index 0000000000..f9c5c3462a ---- /dev/null -+++ b/support/resolv_response_context_duplicate.c +diff -pruN glibc-2.32.orig/support/resolv_response_context_duplicate.c glibc-2.32/support/resolv_response_context_duplicate.c +--- glibc-2.32.orig/support/resolv_response_context_duplicate.c 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/support/resolv_response_context_duplicate.c 2021-09-18 21:03:05.312302287 +1000 @@ -0,0 +1,37 @@ +/* Duplicate a response context used in DNS resolver tests. + Copyright (C) 2020 Free Software Foundation, Inc. @@ -2478,11 +3205,9 @@ index 0000000000..f9c5c3462a + memcpy (result->query_buffer, ctx->query_buffer, result->query_length); + return result; +} -diff --git a/support/resolv_response_context_free.c b/support/resolv_response_context_free.c -new file mode 100644 -index 0000000000..b88c05ffd4 ---- /dev/null -+++ b/support/resolv_response_context_free.c +diff -pruN glibc-2.32.orig/support/resolv_response_context_free.c glibc-2.32/support/resolv_response_context_free.c +--- glibc-2.32.orig/support/resolv_response_context_free.c 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/support/resolv_response_context_free.c 2021-09-18 21:03:05.312302287 +1000 @@ -0,0 +1,28 @@ +/* Free a response context used in DNS resolver tests. + Copyright (C) 2020 Free Software Foundation, Inc. @@ -2512,11 +3237,10 @@ index 0000000000..b88c05ffd4 + free (ctx->client_address); + free (ctx); +} -diff --git a/support/resolv_test.c b/support/resolv_test.c -index 53b7fc41ab..9878a040a3 100644 ---- a/support/resolv_test.c -+++ b/support/resolv_test.c -@@ -181,7 +181,9 @@ resolv_response_init (struct resolv_response_builder *b, +diff -pruN glibc-2.32.orig/support/resolv_test.c glibc-2.32/support/resolv_test.c +--- glibc-2.32.orig/support/resolv_test.c 2021-09-18 21:02:32.701184648 +1000 ++++ glibc-2.32/support/resolv_test.c 2021-09-18 21:03:05.312302287 +1000 +@@ -181,7 +181,9 @@ resolv_response_init (struct resolv_resp b->buffer[2] |= b->query_buffer[2] & 0x01; /* Copy the RD bit. */ if (flags.tc) b->buffer[2] |= 0x02; @@ -2527,7 +3251,7 @@ index 53b7fc41ab..9878a040a3 100644 if (flags.ad) b->buffer[3] |= 0x20; -@@ -434,9 +436,9 @@ resolv_response_buffer (const struct resolv_response_builder *b) +@@ -434,9 +436,9 @@ resolv_response_buffer (const struct res return result; } @@ -2551,7 +3275,7 @@ index 53b7fc41ab..9878a040a3 100644 { tdestroy (b->compression_offsets, free); free (b); -@@ -661,13 +663,17 @@ server_thread_udp_process_one (struct resolv_test *obj, int server_index) +@@ -661,13 +663,17 @@ server_thread_udp_process_one (struct re struct resolv_response_context ctx = { @@ -2570,7 +3294,7 @@ index 53b7fc41ab..9878a040a3 100644 obj->config.response_callback (&ctx, b, qinfo.qname, qinfo.qclass, qinfo.qtype); -@@ -684,7 +690,7 @@ server_thread_udp_process_one (struct resolv_test *obj, int server_index) +@@ -684,7 +690,7 @@ server_thread_udp_process_one (struct re if (b->offset >= 12) printf ("info: UDP server %d: sending response:" " %zu bytes, RCODE %d (for %s/%u/%u)\n", @@ -2579,7 +3303,7 @@ index 53b7fc41ab..9878a040a3 100644 qinfo.qname, qinfo.qclass, qinfo.qtype); else printf ("info: UDP server %d: sending response: %zu bytes" -@@ -694,23 +700,31 @@ server_thread_udp_process_one (struct resolv_test *obj, int server_index) +@@ -694,23 +700,31 @@ server_thread_udp_process_one (struct re if (b->truncate_bytes > 0) printf ("info: truncated by %u bytes\n", b->truncate_bytes); } @@ -2651,10 +3375,9 @@ index 53b7fc41ab..9878a040a3 100644 free (query_buffer); if (close_flag) break; -diff --git a/support/resolv_test.h b/support/resolv_test.h -index 67819469a0..31a5c1c3e7 100644 ---- a/support/resolv_test.h -+++ b/support/resolv_test.h +diff -pruN glibc-2.32.orig/support/resolv_test.h glibc-2.32/support/resolv_test.h +--- glibc-2.32.orig/support/resolv_test.h 2021-09-18 21:02:32.701184648 +1000 ++++ glibc-2.32/support/resolv_test.h 2021-09-18 21:03:05.312302287 +1000 @@ -35,25 +35,36 @@ struct resolv_edns_info uint16_t payload_size; }; @@ -2708,7 +3431,7 @@ index 67819469a0..31a5c1c3e7 100644 /* Initial section count values. Can be used to artificially increase the counts, for malformed packet testing.*/ unsigned short qdcount; -@@ -188,6 +203,22 @@ void resolv_response_close (struct resolv_response_builder *); +@@ -188,6 +203,22 @@ void resolv_response_close (struct resol /* The size of the response packet built so far. */ size_t resolv_response_length (const struct resolv_response_builder *); @@ -2731,10 +3454,240 @@ index 67819469a0..31a5c1c3e7 100644 __END_DECLS #endif /* SUPPORT_RESOLV_TEST_H */ -diff --git a/sysdeps/aarch64/dl-bti.c b/sysdeps/aarch64/dl-bti.c -index 196e462520..cf7624aaa2 100644 ---- a/sysdeps/aarch64/dl-bti.c -+++ b/sysdeps/aarch64/dl-bti.c +diff -pruN glibc-2.32.orig/support/subprocess.h glibc-2.32/support/subprocess.h +--- glibc-2.32.orig/support/subprocess.h 2021-09-18 21:02:32.701184648 +1000 ++++ glibc-2.32/support/subprocess.h 2021-09-18 21:03:05.312302287 +1000 +@@ -38,6 +38,11 @@ struct support_subprocess support_subpro + struct support_subprocess support_subprogram + (const char *file, char *const argv[]); + ++/* Invoke program FILE with ARGV arguments by using posix_spawn and wait for it ++ to complete. Return program exit status. */ ++int support_subprogram_wait ++ (const char *file, char *const argv[]); ++ + /* Wait for the subprocess indicated by PROC::PID. Return the status + indicate by waitpid call. */ + int support_process_wait (struct support_subprocess *proc); +diff -pruN glibc-2.32.orig/support/support_capture_subprocess.c glibc-2.32/support/support_capture_subprocess.c +--- glibc-2.32.orig/support/support_capture_subprocess.c 2021-09-18 21:02:32.701184648 +1000 ++++ glibc-2.32/support/support_capture_subprocess.c 2021-09-18 21:03:05.313302322 +1000 +@@ -20,11 +20,14 @@ + #include <support/capture_subprocess.h> + + #include <errno.h> ++#include <fcntl.h> + #include <stdlib.h> + #include <support/check.h> + #include <support/xunistd.h> + #include <support/xsocket.h> + #include <support/xspawn.h> ++#include <support/support.h> ++#include <support/test-driver.h> + + static void + transfer (const char *what, struct pollfd *pfd, struct xmemstream *stream) +@@ -36,7 +39,7 @@ transfer (const char *what, struct pollf + if (ret < 0) + { + support_record_failure (); +- printf ("error: reading from subprocess %s: %m", what); ++ printf ("error: reading from subprocess %s: %m\n", what); + pfd->events = 0; + pfd->revents = 0; + } +@@ -102,6 +105,129 @@ support_capture_subprogram (const char * + return result; + } + ++/* Copies the executable into a restricted directory, so that we can ++ safely make it SGID with the TARGET group ID. Then runs the ++ executable. */ ++static int ++copy_and_spawn_sgid (char *child_id, gid_t gid) ++{ ++ char *dirname = xasprintf ("%s/tst-tunables-setuid.%jd", ++ test_dir, (intmax_t) getpid ()); ++ char *execname = xasprintf ("%s/bin", dirname); ++ int infd = -1; ++ int outfd = -1; ++ int ret = 1, status = 1; ++ ++ TEST_VERIFY (mkdir (dirname, 0700) == 0); ++ if (support_record_failure_is_failed ()) ++ goto err; ++ ++ infd = open ("/proc/self/exe", O_RDONLY); ++ if (infd < 0) ++ FAIL_UNSUPPORTED ("unsupported: Cannot read binary from procfs\n"); ++ ++ outfd = open (execname, O_WRONLY | O_CREAT | O_EXCL, 0700); ++ TEST_VERIFY (outfd >= 0); ++ if (support_record_failure_is_failed ()) ++ goto err; ++ ++ char buf[4096]; ++ for (;;) ++ { ++ ssize_t rdcount = read (infd, buf, sizeof (buf)); ++ TEST_VERIFY (rdcount >= 0); ++ if (support_record_failure_is_failed ()) ++ goto err; ++ if (rdcount == 0) ++ break; ++ char *p = buf; ++ char *end = buf + rdcount; ++ while (p != end) ++ { ++ ssize_t wrcount = write (outfd, buf, end - p); ++ if (wrcount == 0) ++ errno = ENOSPC; ++ TEST_VERIFY (wrcount > 0); ++ if (support_record_failure_is_failed ()) ++ goto err; ++ p += wrcount; ++ } ++ } ++ TEST_VERIFY (fchown (outfd, getuid (), gid) == 0); ++ if (support_record_failure_is_failed ()) ++ goto err; ++ TEST_VERIFY (fchmod (outfd, 02750) == 0); ++ if (support_record_failure_is_failed ()) ++ goto err; ++ TEST_VERIFY (close (outfd) == 0); ++ if (support_record_failure_is_failed ()) ++ goto err; ++ TEST_VERIFY (close (infd) == 0); ++ if (support_record_failure_is_failed ()) ++ goto err; ++ ++ /* We have the binary, now spawn the subprocess. Avoid using ++ support_subprogram because we only want the program exit status, not the ++ contents. */ ++ ret = 0; ++ ++ char * const args[] = {execname, child_id, NULL}; ++ ++ status = support_subprogram_wait (args[0], args); ++ ++err: ++ if (outfd >= 0) ++ close (outfd); ++ if (infd >= 0) ++ close (infd); ++ if (execname != NULL) ++ { ++ unlink (execname); ++ free (execname); ++ } ++ if (dirname != NULL) ++ { ++ rmdir (dirname); ++ free (dirname); ++ } ++ ++ if (ret != 0) ++ FAIL_EXIT1("Failed to make sgid executable for test\n"); ++ ++ return status; ++} ++ ++int ++support_capture_subprogram_self_sgid (char *child_id) ++{ ++ gid_t target = 0; ++ const int count = 64; ++ gid_t groups[count]; ++ ++ /* Get a GID which is not our current GID, but is present in the ++ supplementary group list. */ ++ int ret = getgroups (count, groups); ++ if (ret < 0) ++ FAIL_UNSUPPORTED("Could not get group list for user %jd\n", ++ (intmax_t) getuid ()); ++ ++ gid_t current = getgid (); ++ for (int i = 0; i < ret; ++i) ++ { ++ if (groups[i] != current) ++ { ++ target = groups[i]; ++ break; ++ } ++ } ++ ++ if (target == 0) ++ FAIL_UNSUPPORTED("Could not find a suitable GID for user %jd\n", ++ (intmax_t) getuid ()); ++ ++ return copy_and_spawn_sgid (child_id, target); ++} ++ + void + support_capture_subprocess_free (struct support_capture_subprocess *p) + { +diff -pruN glibc-2.32.orig/support/support_subprocess.c glibc-2.32/support/support_subprocess.c +--- glibc-2.32.orig/support/support_subprocess.c 2021-09-18 21:02:32.701184648 +1000 ++++ glibc-2.32/support/support_subprocess.c 2021-09-18 21:03:05.313302322 +1000 +@@ -27,7 +27,7 @@ + #include <support/subprocess.h> + + static struct support_subprocess +-support_suprocess_init (void) ++support_subprocess_init (void) + { + struct support_subprocess result; + +@@ -48,7 +48,7 @@ support_suprocess_init (void) + struct support_subprocess + support_subprocess (void (*callback) (void *), void *closure) + { +- struct support_subprocess result = support_suprocess_init (); ++ struct support_subprocess result = support_subprocess_init (); + + result.pid = xfork (); + if (result.pid == 0) +@@ -71,7 +71,7 @@ support_subprocess (void (*callback) (vo + struct support_subprocess + support_subprogram (const char *file, char *const argv[]) + { +- struct support_subprocess result = support_suprocess_init (); ++ struct support_subprocess result = support_subprocess_init (); + + posix_spawn_file_actions_t fa; + /* posix_spawn_file_actions_init does not fail. */ +@@ -84,7 +84,7 @@ support_subprogram (const char *file, ch + xposix_spawn_file_actions_addclose (&fa, result.stdout_pipe[1]); + xposix_spawn_file_actions_addclose (&fa, result.stderr_pipe[1]); + +- result.pid = xposix_spawn (file, &fa, NULL, argv, NULL); ++ result.pid = xposix_spawn (file, &fa, NULL, argv, environ); + + xclose (result.stdout_pipe[1]); + xclose (result.stderr_pipe[1]); +@@ -93,6 +93,19 @@ support_subprogram (const char *file, ch + } + + int ++support_subprogram_wait (const char *file, char *const argv[]) ++{ ++ posix_spawn_file_actions_t fa; ++ ++ posix_spawn_file_actions_init (&fa); ++ struct support_subprocess res = support_subprocess_init (); ++ ++ res.pid = xposix_spawn (file, &fa, NULL, argv, environ); ++ ++ return support_process_wait (&res); ++} ++ ++int + support_process_wait (struct support_subprocess *proc) + { + xclose (proc->stdout_pipe[0]); +diff -pruN glibc-2.32.orig/sysdeps/aarch64/dl-bti.c glibc-2.32/sysdeps/aarch64/dl-bti.c +--- glibc-2.32.orig/sysdeps/aarch64/dl-bti.c 2021-09-18 21:02:32.702184682 +1000 ++++ glibc-2.32/sysdeps/aarch64/dl-bti.c 2021-09-18 21:03:05.313302322 +1000 @@ -19,43 +19,76 @@ #include <errno.h> #include <libintl.h> @@ -2831,11 +3784,10 @@ index 196e462520..cf7624aaa2 100644 + bti_failed (dep, program); + } } -diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h -index 70b9ed3925..fde7cfd9e2 100644 ---- a/sysdeps/aarch64/dl-machine.h -+++ b/sysdeps/aarch64/dl-machine.h -@@ -395,13 +395,6 @@ elf_machine_lazy_rel (struct link_map *map, +diff -pruN glibc-2.32.orig/sysdeps/aarch64/dl-machine.h glibc-2.32/sysdeps/aarch64/dl-machine.h +--- glibc-2.32.orig/sysdeps/aarch64/dl-machine.h 2021-09-18 21:02:32.702184682 +1000 ++++ glibc-2.32/sysdeps/aarch64/dl-machine.h 2021-09-18 21:03:05.313302322 +1000 +@@ -395,13 +395,6 @@ elf_machine_lazy_rel (struct link_map *m /* Check for unexpected PLT reloc type. */ if (__builtin_expect (r_type == AARCH64_R(JUMP_SLOT), 1)) { @@ -2849,7 +3801,7 @@ index 70b9ed3925..fde7cfd9e2 100644 if (__glibc_unlikely (map->l_info[DT_AARCH64 (VARIANT_PCS)] != NULL)) { /* Check the symbol table for variant PCS symbols. */ -@@ -425,7 +418,10 @@ elf_machine_lazy_rel (struct link_map *map, +@@ -425,7 +418,10 @@ elf_machine_lazy_rel (struct link_map *m } } @@ -2861,10 +3813,9 @@ index 70b9ed3925..fde7cfd9e2 100644 } else if (__builtin_expect (r_type == AARCH64_R(TLSDESC), 1)) { -diff --git a/sysdeps/aarch64/dl-prop.h b/sysdeps/aarch64/dl-prop.h -index b0785bda83..e926e54984 100644 ---- a/sysdeps/aarch64/dl-prop.h -+++ b/sysdeps/aarch64/dl-prop.h +diff -pruN glibc-2.32.orig/sysdeps/aarch64/dl-prop.h glibc-2.32/sysdeps/aarch64/dl-prop.h +--- glibc-2.32.orig/sysdeps/aarch64/dl-prop.h 2021-09-18 21:02:32.702184682 +1000 ++++ glibc-2.32/sysdeps/aarch64/dl-prop.h 2021-09-18 21:03:05.313302322 +1000 @@ -19,6 +19,8 @@ #ifndef _DL_PROP_H #define _DL_PROP_H @@ -2896,7 +3847,7 @@ index b0785bda83..e926e54984 100644 if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) { /* Stop if the property note is ill-formed. */ -@@ -51,7 +57,7 @@ _dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz, +@@ -51,7 +57,7 @@ _dl_process_gnu_property (struct link_ma unsigned int feature_1 = *(unsigned int *) data; if (feature_1 & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) @@ -2905,10 +3856,9 @@ index b0785bda83..e926e54984 100644 /* Stop if we processed the property note. */ return 0; -diff --git a/sysdeps/aarch64/linkmap.h b/sysdeps/aarch64/linkmap.h -index 847a03ace2..b3f7663b07 100644 ---- a/sysdeps/aarch64/linkmap.h -+++ b/sysdeps/aarch64/linkmap.h +diff -pruN glibc-2.32.orig/sysdeps/aarch64/linkmap.h glibc-2.32/sysdeps/aarch64/linkmap.h +--- glibc-2.32.orig/sysdeps/aarch64/linkmap.h 2021-09-18 21:02:32.702184682 +1000 ++++ glibc-2.32/sysdeps/aarch64/linkmap.h 2021-09-18 21:03:05.313302322 +1000 @@ -22,5 +22,5 @@ struct link_map_machine { ElfW(Addr) plt; /* Address of .plt */ @@ -2916,24 +3866,9 @@ index 847a03ace2..b3f7663b07 100644 - bool bti; /* Branch Target Identification is enabled. */ + bool bti_fail; /* Failed to enable Branch Target Identification. */ }; -diff --git a/sysdeps/aarch64/multiarch/memcpy.c b/sysdeps/aarch64/multiarch/memcpy.c -index 7cf5f033e8..799d60c98c 100644 ---- a/sysdeps/aarch64/multiarch/memcpy.c -+++ b/sysdeps/aarch64/multiarch/memcpy.c -@@ -41,7 +41,8 @@ libc_ifunc (__libc_memcpy, - ? __memcpy_falkor - : (IS_THUNDERX2 (midr) || IS_THUNDERX2PA (midr) - ? __memcpy_thunderx2 -- : (IS_NEOVERSE_N1 (midr) -+ : (IS_NEOVERSE_N1 (midr) || IS_NEOVERSE_N2 (midr) -+ || IS_NEOVERSE_V1 (midr) - ? __memcpy_simd - : __memcpy_generic))))); - -diff --git a/sysdeps/aarch64/multiarch/memcpy_advsimd.S b/sysdeps/aarch64/multiarch/memcpy_advsimd.S -index d4ba747777..48bb6d7ca4 100644 ---- a/sysdeps/aarch64/multiarch/memcpy_advsimd.S -+++ b/sysdeps/aarch64/multiarch/memcpy_advsimd.S +diff -pruN glibc-2.32.orig/sysdeps/aarch64/multiarch/memcpy_advsimd.S glibc-2.32/sysdeps/aarch64/multiarch/memcpy_advsimd.S +--- glibc-2.32.orig/sysdeps/aarch64/multiarch/memcpy_advsimd.S 2021-09-18 21:02:32.702184682 +1000 ++++ glibc-2.32/sysdeps/aarch64/multiarch/memcpy_advsimd.S 2021-09-18 21:03:05.313302322 +1000 @@ -223,12 +223,13 @@ L(copy_long_backwards): b.ls L(copy64_from_start) @@ -2951,10 +3886,22 @@ index d4ba747777..48bb6d7ca4 100644 subs count, count, 64 b.hi L(loop64_backwards) -diff --git a/sysdeps/aarch64/multiarch/memmove.c b/sysdeps/aarch64/multiarch/memmove.c -index ad10aa8ac6..46a4cb3a54 100644 ---- a/sysdeps/aarch64/multiarch/memmove.c -+++ b/sysdeps/aarch64/multiarch/memmove.c +diff -pruN glibc-2.32.orig/sysdeps/aarch64/multiarch/memcpy.c glibc-2.32/sysdeps/aarch64/multiarch/memcpy.c +--- glibc-2.32.orig/sysdeps/aarch64/multiarch/memcpy.c 2021-09-18 21:02:32.702184682 +1000 ++++ glibc-2.32/sysdeps/aarch64/multiarch/memcpy.c 2021-09-18 21:03:05.313302322 +1000 +@@ -41,7 +41,8 @@ libc_ifunc (__libc_memcpy, + ? __memcpy_falkor + : (IS_THUNDERX2 (midr) || IS_THUNDERX2PA (midr) + ? __memcpy_thunderx2 +- : (IS_NEOVERSE_N1 (midr) ++ : (IS_NEOVERSE_N1 (midr) || IS_NEOVERSE_N2 (midr) ++ || IS_NEOVERSE_V1 (midr) + ? __memcpy_simd + : __memcpy_generic))))); + +diff -pruN glibc-2.32.orig/sysdeps/aarch64/multiarch/memmove.c glibc-2.32/sysdeps/aarch64/multiarch/memmove.c +--- glibc-2.32.orig/sysdeps/aarch64/multiarch/memmove.c 2021-09-18 21:02:32.702184682 +1000 ++++ glibc-2.32/sysdeps/aarch64/multiarch/memmove.c 2021-09-18 21:03:05.313302322 +1000 @@ -41,7 +41,8 @@ libc_ifunc (__libc_memmove, ? __memmove_falkor : (IS_THUNDERX2 (midr) || IS_THUNDERX2PA (midr) @@ -2965,10 +3912,9 @@ index ad10aa8ac6..46a4cb3a54 100644 ? __memmove_simd : __memmove_generic))))); -diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S -index 75393e1c18..1998ea95d4 100644 ---- a/sysdeps/aarch64/start.S -+++ b/sysdeps/aarch64/start.S +diff -pruN glibc-2.32.orig/sysdeps/aarch64/start.S glibc-2.32/sysdeps/aarch64/start.S +--- glibc-2.32.orig/sysdeps/aarch64/start.S 2021-09-18 21:02:32.702184682 +1000 ++++ glibc-2.32/sysdeps/aarch64/start.S 2021-09-18 21:03:05.313302322 +1000 @@ -43,11 +43,9 @@ */ @@ -2994,10 +3940,9 @@ index 75393e1c18..1998ea95d4 100644 /* Define a symbol for the first piece of initialized data. */ .data -diff --git a/sysdeps/generic/dl-prop.h b/sysdeps/generic/dl-prop.h -index f1cf576fe3..df27ff8e6a 100644 ---- a/sysdeps/generic/dl-prop.h -+++ b/sysdeps/generic/dl-prop.h +diff -pruN glibc-2.32.orig/sysdeps/generic/dl-prop.h glibc-2.32/sysdeps/generic/dl-prop.h +--- glibc-2.32.orig/sysdeps/generic/dl-prop.h 2021-09-18 21:02:32.705184785 +1000 ++++ glibc-2.32/sysdeps/generic/dl-prop.h 2021-09-18 21:03:05.313302322 +1000 @@ -37,15 +37,15 @@ _dl_open_check (struct link_map *m) } @@ -3017,11 +3962,10 @@ index f1cf576fe3..df27ff8e6a 100644 { return 0; } -diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h -index ba114ab4b1..62ac40d81b 100644 ---- a/sysdeps/generic/ldsodefs.h -+++ b/sysdeps/generic/ldsodefs.h -@@ -919,8 +919,9 @@ extern void _dl_rtld_di_serinfo (struct link_map *loader, +diff -pruN glibc-2.32.orig/sysdeps/generic/ldsodefs.h glibc-2.32/sysdeps/generic/ldsodefs.h +--- glibc-2.32.orig/sysdeps/generic/ldsodefs.h 2021-09-18 21:02:32.705184785 +1000 ++++ glibc-2.32/sysdeps/generic/ldsodefs.h 2021-09-18 21:03:05.313302322 +1000 +@@ -919,8 +919,9 @@ extern void _dl_rtld_di_serinfo (struct Dl_serinfo *si, bool counting); /* Process PT_GNU_PROPERTY program header PH in module L after @@ -3033,11 +3977,10 @@ index ba114ab4b1..62ac40d81b 100644 /* Search loaded objects' symbol tables for a definition of the symbol -diff --git a/sysdeps/generic/unwind.h b/sysdeps/generic/unwind.h -index b667a5b652..c229603af3 100644 ---- a/sysdeps/generic/unwind.h -+++ b/sysdeps/generic/unwind.h -@@ -75,15 +75,21 @@ typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, +diff -pruN glibc-2.32.orig/sysdeps/generic/unwind.h glibc-2.32/sysdeps/generic/unwind.h +--- glibc-2.32.orig/sysdeps/generic/unwind.h 2021-09-18 21:02:32.706184819 +1000 ++++ glibc-2.32/sysdeps/generic/unwind.h 2021-09-18 21:03:05.313302322 +1000 +@@ -75,15 +75,21 @@ typedef void (*_Unwind_Exception_Cleanup struct _Unwind_Exception { @@ -3045,11 +3988,6 @@ index b667a5b652..c229603af3 100644 - _Unwind_Exception_Cleanup_Fn exception_cleanup; - _Unwind_Word private_1; - _Unwind_Word private_2; -- -- /* @@@ The IA-64 ABI says that this structure must be double-word aligned. -- Taking that literally does not make much sense generically. Instead we -- provide the maximum alignment required by any type for the machine. */ --} __attribute__((__aligned__)); + union + { + struct @@ -3059,7 +3997,11 @@ index b667a5b652..c229603af3 100644 + _Unwind_Word private_1; + _Unwind_Word private_2; + }; -+ + +- /* @@@ The IA-64 ABI says that this structure must be double-word aligned. +- Taking that literally does not make much sense generically. Instead we +- provide the maximum alignment required by any type for the machine. */ +-} __attribute__((__aligned__)); + /* The IA-64 ABI says that this structure must be double-word aligned. */ + _Unwind_Word unwind_exception_align[2] + __attribute__ ((__aligned__ (2 * sizeof (_Unwind_Word)))); @@ -3068,10 +4010,9 @@ index b667a5b652..c229603af3 100644 /* The ACTIONS argument to the personality routine is a bitwise OR of one -diff --git a/sysdeps/gnu/errlist.h b/sysdeps/gnu/errlist.h -index 5d11ed723d..6329e5f393 100644 ---- a/sysdeps/gnu/errlist.h -+++ b/sysdeps/gnu/errlist.h +diff -pruN glibc-2.32.orig/sysdeps/gnu/errlist.h glibc-2.32/sysdeps/gnu/errlist.h +--- glibc-2.32.orig/sysdeps/gnu/errlist.h 2021-09-18 21:02:32.706184819 +1000 ++++ glibc-2.32/sysdeps/gnu/errlist.h 2021-09-18 21:03:05.313302322 +1000 @@ -1,24 +1,21 @@ -#ifndef ERR_MAP -#define ERR_MAP(value) value @@ -3116,7 +4057,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef ENXIO /* -@@ -43,7 +40,7 @@ TRANS represented by a file you specified, and it couldn't find the device. +@@ -43,7 +40,7 @@ TRANS represented by a file you specifie TRANS This can mean that the device file was installed incorrectly, or that TRANS the physical device is missing or not correctly attached to the TRANS computer. */ @@ -3125,7 +4066,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef E2BIG /* -@@ -51,27 +48,27 @@ TRANS Used when the arguments passed to a new program +@@ -51,27 +48,27 @@ TRANS Used when the arguments passed to TRANS being executed with one of the @code{exec} functions (@pxref{Executing a TRANS File}) occupy too much memory space. This condition never arises on TRANS @gnuhurdsystems{}. */ @@ -3157,7 +4098,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef EDEADLK /* -@@ -79,74 +76,74 @@ TRANS Allocating a system resource would have resulted in a +@@ -79,74 +76,74 @@ TRANS Allocating a system resource would TRANS deadlock situation. The system does not guarantee that it will notice TRANS all such situations. This error means you got lucky and the system TRANS noticed; it might just hang. @xref{File Locks}, for an example. */ @@ -3244,7 +4185,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef EMFILE /* -@@ -157,20 +154,20 @@ TRANS In BSD and GNU, the number of open files is controlled by a resource +@@ -157,20 +154,20 @@ TRANS In BSD and GNU, the number of open TRANS limit that can usually be increased. If you get this error, you might TRANS want to increase the @code{RLIMIT_NOFILE} limit or make it unlimited; TRANS @pxref{Limits on Resources}. */ @@ -3268,7 +4209,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef ETXTBSY /* -@@ -179,35 +176,35 @@ TRANS write to a file that is currently being executed. Often using a +@@ -179,35 +176,35 @@ TRANS write to a file that is currently TRANS debugger to run a program is considered having it open for writing and TRANS will cause this error. (The name stands for ``text file busy''.) This TRANS is not an error on @gnuhurdsystems{}; the text is copied as necessary. */ @@ -3310,7 +4251,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef EPIPE /* -@@ -216,19 +213,19 @@ TRANS Every library function that returns this error code also generates a +@@ -216,19 +213,19 @@ TRANS Every library function that return TRANS @code{SIGPIPE} signal; this signal terminates the program if not handled TRANS or blocked. Thus, your program will never actually see @code{EPIPE} TRANS unless it has handled or blocked @code{SIGPIPE}. */ @@ -3333,7 +4274,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef EAGAIN /* -@@ -261,7 +258,7 @@ TRANS Such shortages are usually fairly serious and affect the whole system, +@@ -261,7 +258,7 @@ TRANS Such shortages are usually fairly TRANS so usually an interactive program should report the error to the user TRANS and return to its command loop. TRANS @end itemize */ @@ -3342,7 +4283,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef EINPROGRESS /* -@@ -273,47 +270,47 @@ TRANS the operation has begun and will take some time. Attempts to manipulate +@@ -273,47 +270,47 @@ TRANS the operation has begun and will t TRANS the object before the call completes return @code{EALREADY}. You can TRANS use the @code{select} function to find out when the pending operation TRANS has completed; @pxref{Waiting for I/O}. */ @@ -3398,7 +4339,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef EOPNOTSUPP /* -@@ -323,71 +320,71 @@ TRANS implemented for all communications protocols. On @gnuhurdsystems{}, this +@@ -323,71 +320,71 @@ TRANS implemented for all communications TRANS error can happen for many calls when the object does not support the TRANS particular operation; it is a generic indication that the server knows TRANS nothing to do for that call. */ @@ -3482,7 +4423,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef ENOTCONN /* -@@ -395,74 +392,74 @@ TRANS The socket is not connected to anything. You get this error when you +@@ -395,74 +392,74 @@ TRANS The socket is not connected to any TRANS try to transmit data over a socket, without first specifying a TRANS destination for the data. For a connectionless socket (for datagram TRANS protocols, such as UDP), you get @code{EDESTADDRREQ} instead. */ @@ -3570,7 +4511,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef ESTALE /* -@@ -471,7 +468,7 @@ TRANS file system which is due to file system rearrangements on the server host +@@ -471,7 +468,7 @@ TRANS file system which is due to file s TRANS for NFS file systems or corruption in other file systems. TRANS Repairing this condition usually requires unmounting, possibly repairing TRANS and remounting the file system. */ @@ -3579,7 +4520,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef EREMOTE /* -@@ -479,7 +476,7 @@ TRANS An attempt was made to NFS-mount a remote file system with a file name tha +@@ -479,7 +476,7 @@ TRANS An attempt was made to NFS-mount a TRANS already specifies an NFS-mounted file. TRANS (This is an error on some operating systems, but we expect it to work TRANS properly on @gnuhurdsystems{}, making this error code impossible.) */ @@ -3588,7 +4529,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef ENOLCK /* -@@ -487,7 +484,7 @@ TRANS This is used by the file locking facilities; see +@@ -487,7 +484,7 @@ TRANS This is used by the file locking f TRANS @ref{File Locks}. This error is never generated by @gnuhurdsystems{}, but TRANS it can result from an operation to an NFS server running another TRANS operating system. */ @@ -3597,7 +4538,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef ENOSYS /* -@@ -496,46 +493,46 @@ TRANS not implemented at all, either in the C library itself or in the +@@ -496,46 +493,46 @@ TRANS not implemented at all, either in TRANS operating system. When you get this error, you can be sure that this TRANS particular function will always fail with @code{ENOSYS} unless you TRANS install a new version of the C library or the operating system. */ @@ -3657,7 +4598,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef ECANCELED /* -@@ -543,148 +540,148 @@ TRANS An asynchronous operation was canceled before it +@@ -543,148 +540,148 @@ TRANS An asynchronous operation was canc TRANS completed. @xref{Asynchronous I/O}. When you call @code{aio_cancel}, TRANS the normal result is for the operations affected to complete with this TRANS error; @pxref{Cancel AIO Operations}. */ @@ -3854,7 +4795,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef EFTYPE /* -@@ -693,40 +690,40 @@ TRANS operation, or a data file had the wrong format. +@@ -693,40 +690,40 @@ TRANS operation, or a data file had the TRANS TRANS On some systems @code{chmod} returns this error if you try to set the TRANS sticky bit on a non-directory file; @pxref{Setting Permissions}. */ @@ -3916,7 +4857,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef EBACKGROUND /* -@@ -755,7 +752,7 @@ TRANS foreground process group of the terminal. Users do not usually see this +@@ -755,7 +752,7 @@ TRANS foreground process group of the te TRANS error because functions such as @code{read} and @code{write} translate TRANS it into a @code{SIGTTIN} or @code{SIGTTOU} signal. @xref{Job Control}, TRANS for information on process groups and these signals. */ @@ -3925,7 +4866,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #ifdef EIEIO /* -@@ -773,7 +770,7 @@ TRANS @c "bought the farm" means "died". -jtobey +@@ -773,7 +770,7 @@ TRANS @c "bought the farm" means "died". TRANS @c TRANS @c Translators, please do not translate this litteraly, translate it into TRANS @c an idiomatic funny way of saying that the computer died. */ @@ -3934,7 +4875,7 @@ index 5d11ed723d..6329e5f393 100644 #endif #if defined (EWOULDBLOCK) && EWOULDBLOCK != EAGAIN /* -@@ -782,18 +779,18 @@ TRANS The values are always the same, on every operating system. +@@ -782,18 +779,18 @@ TRANS The values are always the same, on TRANS TRANS C libraries in many older Unix systems have @code{EWOULDBLOCK} as a TRANS separate error code. */ @@ -3957,11 +4898,10 @@ index 5d11ed723d..6329e5f393 100644 -_S(ERR_MAP(EPROGUNAVAIL), N_("RPC program not available")) +_S(EPROGUNAVAIL, N_("RPC program not available")) #endif -diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h -index 0f08079e48..672d8f27ce 100644 ---- a/sysdeps/i386/dl-machine.h -+++ b/sysdeps/i386/dl-machine.h -@@ -338,16 +338,22 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, +diff -pruN glibc-2.32.orig/sysdeps/i386/dl-machine.h glibc-2.32/sysdeps/i386/dl-machine.h +--- glibc-2.32.orig/sysdeps/i386/dl-machine.h 2021-09-18 21:02:32.707184853 +1000 ++++ glibc-2.32/sysdeps/i386/dl-machine.h 2021-09-18 21:03:05.313302322 +1000 +@@ -338,16 +338,22 @@ elf_machine_rel (struct link_map *map, c { # ifndef RTLD_BOOTSTRAP if (sym_map != map @@ -3989,10 +4929,9 @@ index 0f08079e48..672d8f27ce 100644 } # endif value = ((Elf32_Addr (*) (void)) value) (); -diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c -index 8a53a1088f..362a2b713c 100644 ---- a/sysdeps/powerpc/powerpc64/backtrace.c -+++ b/sysdeps/powerpc/powerpc64/backtrace.c +diff -pruN glibc-2.32.orig/sysdeps/powerpc/powerpc64/backtrace.c glibc-2.32/sysdeps/powerpc/powerpc64/backtrace.c +--- glibc-2.32.orig/sysdeps/powerpc/powerpc64/backtrace.c 2021-09-18 21:02:32.723185402 +1000 ++++ glibc-2.32/sysdeps/powerpc/powerpc64/backtrace.c 2021-09-18 21:03:05.313302322 +1000 @@ -54,11 +54,22 @@ struct signal_frame_64 { /* We don't care about the rest, since the IP value is at 'uc' field. */ }; @@ -4017,37 +4956,94 @@ index 8a53a1088f..362a2b713c 100644 return true; #endif return false; -diff --git a/sysdeps/sh/be/sh4/fpu/Implies b/sysdeps/sh/be/sh4/fpu/Implies -new file mode 100644 -index 0000000000..71b28ee1a4 ---- /dev/null -+++ b/sysdeps/sh/be/sh4/fpu/Implies +diff -pruN glibc-2.32.orig/sysdeps/s390/configure glibc-2.32/sysdeps/s390/configure +--- glibc-2.32.orig/sysdeps/s390/configure 2021-09-18 21:02:32.727185539 +1000 ++++ glibc-2.32/sysdeps/s390/configure 2021-09-18 21:03:05.313302322 +1000 +@@ -123,7 +123,9 @@ void testinsn (char *buf) + __asm__ (".machine \"arch13\" \n\t" + ".machinemode \"zarch_nohighgprs\" \n\t" + "lghi %%r0,16 \n\t" +- "mvcrl 0(%0),32(%0)" : : "a" (buf) : "memory", "r0"); ++ "mvcrl 0(%0),32(%0) \n\t" ++ "vstrs %%v20,%%v20,%%v20,%%v20,0,2" ++ : : "a" (buf) : "memory", "r0"); + } + EOF + if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c +@@ -271,7 +273,9 @@ else + void testinsn (char *buf) + { + __asm__ ("lghi %%r0,16 \n\t" +- "mvcrl 0(%0),32(%0)" : : "a" (buf) : "memory", "r0"); ++ "mvcrl 0(%0),32(%0) \n\t" ++ "vstrs %%v20,%%v20,%%v20,%%v20,0,2" ++ : : "a" (buf) : "memory", "r0"); + } + EOF + if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS --shared conftest.c +diff -pruN glibc-2.32.orig/sysdeps/s390/configure.ac glibc-2.32/sysdeps/s390/configure.ac +--- glibc-2.32.orig/sysdeps/s390/configure.ac 2021-09-18 21:02:32.727185539 +1000 ++++ glibc-2.32/sysdeps/s390/configure.ac 2021-09-18 21:03:05.313302322 +1000 +@@ -88,7 +88,9 @@ void testinsn (char *buf) + __asm__ (".machine \"arch13\" \n\t" + ".machinemode \"zarch_nohighgprs\" \n\t" + "lghi %%r0,16 \n\t" +- "mvcrl 0(%0),32(%0)" : : "a" (buf) : "memory", "r0"); ++ "mvcrl 0(%0),32(%0) \n\t" ++ "vstrs %%v20,%%v20,%%v20,%%v20,0,2" ++ : : "a" (buf) : "memory", "r0"); + } + EOF + dnl test, if assembler supports S390 arch13 instructions +@@ -195,7 +197,9 @@ cat > conftest.c <<\EOF + void testinsn (char *buf) + { + __asm__ ("lghi %%r0,16 \n\t" +- "mvcrl 0(%0),32(%0)" : : "a" (buf) : "memory", "r0"); ++ "mvcrl 0(%0),32(%0) \n\t" ++ "vstrs %%v20,%%v20,%%v20,%%v20,0,2" ++ : : "a" (buf) : "memory", "r0"); + } + EOF + dnl test, if assembler supports S390 arch13 zarch instructions as default +diff -pruN glibc-2.32.orig/sysdeps/s390/memmove.c glibc-2.32/sysdeps/s390/memmove.c +--- glibc-2.32.orig/sysdeps/s390/memmove.c 2021-09-18 21:02:32.727185539 +1000 ++++ glibc-2.32/sysdeps/s390/memmove.c 2021-09-18 21:03:05.313302322 +1000 +@@ -43,7 +43,7 @@ extern __typeof (__redirect_memmove) MEM + s390_libc_ifunc_expr (__redirect_memmove, memmove, + ({ + s390_libc_ifunc_expr_stfle_init (); +- (HAVE_MEMMOVE_ARCH13 ++ (HAVE_MEMMOVE_ARCH13 && (hwcap & HWCAP_S390_VXRS_EXT2) + && S390_IS_ARCH13_MIE3 (stfle_bits)) + ? MEMMOVE_ARCH13 + : (HAVE_MEMMOVE_Z13 && (hwcap & HWCAP_S390_VX)) +diff -pruN glibc-2.32.orig/sysdeps/s390/multiarch/ifunc-impl-list.c glibc-2.32/sysdeps/s390/multiarch/ifunc-impl-list.c +--- glibc-2.32.orig/sysdeps/s390/multiarch/ifunc-impl-list.c 2021-09-18 21:02:32.727185539 +1000 ++++ glibc-2.32/sysdeps/s390/multiarch/ifunc-impl-list.c 2021-09-18 21:03:05.313302322 +1000 +@@ -171,7 +171,8 @@ __libc_ifunc_impl_list (const char *name + IFUNC_IMPL (i, name, memmove, + # if HAVE_MEMMOVE_ARCH13 + IFUNC_IMPL_ADD (array, i, memmove, +- S390_IS_ARCH13_MIE3 (stfle_bits), ++ ((dl_hwcap & HWCAP_S390_VXRS_EXT2) ++ && S390_IS_ARCH13_MIE3 (stfle_bits)), + MEMMOVE_ARCH13) + # endif + # if HAVE_MEMMOVE_Z13 +diff -pruN glibc-2.32.orig/sysdeps/sh/be/sh4/fpu/Implies glibc-2.32/sysdeps/sh/be/sh4/fpu/Implies +--- glibc-2.32.orig/sysdeps/sh/be/sh4/fpu/Implies 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/sysdeps/sh/be/sh4/fpu/Implies 2021-09-18 21:03:05.313302322 +1000 @@ -0,0 +1 @@ +sh/sh4/fpu -diff --git a/sysdeps/sh/le/sh4/fpu/Implies b/sysdeps/sh/le/sh4/fpu/Implies -new file mode 100644 -index 0000000000..71b28ee1a4 ---- /dev/null -+++ b/sysdeps/sh/le/sh4/fpu/Implies +diff -pruN glibc-2.32.orig/sysdeps/sh/le/sh4/fpu/Implies glibc-2.32/sysdeps/sh/le/sh4/fpu/Implies +--- glibc-2.32.orig/sysdeps/sh/le/sh4/fpu/Implies 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/sysdeps/sh/le/sh4/fpu/Implies 2021-09-18 21:03:05.313302322 +1000 @@ -0,0 +1 @@ +sh/sh4/fpu -diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile -index 9b2a253032..34748ffcd1 100644 ---- a/sysdeps/unix/sysv/linux/Makefile -+++ b/sysdeps/unix/sysv/linux/Makefile -@@ -100,7 +100,7 @@ tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ - tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \ - test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \ - tst-rlimit-infinity tst-ofdlocks tst-gettid tst-gettid-kill \ -- tst-tgkill -+ tst-tgkill tst-sysvsem-linux tst-sysvmsg-linux tst-sysvshm-linux - tests-internal += tst-ofdlocks-compat tst-sigcontext-get_pc - - CFLAGS-tst-sigcontext-get_pc.c = -fasynchronous-unwind-tables -diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h -index fc688450ee..00a4d0c8e7 100644 ---- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h -+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/aarch64/cpu-features.h glibc-2.32/sysdeps/unix/sysv/linux/aarch64/cpu-features.h +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/aarch64/cpu-features.h 2021-09-18 21:02:32.731185676 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/aarch64/cpu-features.h 2021-09-18 21:03:05.313302322 +1000 @@ -54,6 +54,10 @@ && MIDR_PARTNUM(midr) == 0x000) #define IS_NEOVERSE_N1(midr) (MIDR_IMPLEMENTOR(midr) == 'A' \ @@ -4059,11 +5055,72 @@ index fc688450ee..00a4d0c8e7 100644 #define IS_EMAG(midr) (MIDR_IMPLEMENTOR(midr) == 'P' \ && MIDR_PARTNUM(midr) == 0x000) -diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c -index 0776472d5e..a1f24ab242 100644 ---- a/sysdeps/unix/sysv/linux/msgctl.c -+++ b/sysdeps/unix/sysv/linux/msgctl.c -@@ -90,8 +90,15 @@ __msgctl64 (int msqid, int cmd, struct __msqid64_ds *buf) +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.32/sysdeps/unix/sysv/linux/Makefile +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/Makefile 2021-09-18 21:02:32.731185676 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/Makefile 2021-09-18 21:03:05.313302322 +1000 +@@ -100,7 +100,7 @@ tests += tst-clone tst-clone2 tst-clone3 + tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \ + test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \ + tst-rlimit-infinity tst-ofdlocks tst-gettid tst-gettid-kill \ +- tst-tgkill ++ tst-tgkill tst-sysvsem-linux tst-sysvmsg-linux tst-sysvshm-linux + tests-internal += tst-ofdlocks-compat tst-sigcontext-get_pc + + CFLAGS-tst-sigcontext-get_pc.c = -fasynchronous-unwind-tables +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/mq_notify.c glibc-2.32/sysdeps/unix/sysv/linux/mq_notify.c +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/mq_notify.c 2021-09-18 21:02:32.736185847 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/mq_notify.c 2021-09-18 21:09:50.680196980 +1000 +@@ -132,9 +132,12 @@ helper_thread (void *arg) + to wait until it is done with it. */ + (void) __pthread_barrier_wait (¬ify_barrier); + } +- else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED) +- /* The only state we keep is the copy of the thread attributes. */ +- free (data.attr); ++ else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED && data.attr != NULL) ++ { ++ /* The only state we keep is the copy of the thread attributes. */ ++ pthread_attr_destroy (data.attr); ++ free (data.attr); ++ } + } + return NULL; + } +@@ -255,8 +258,14 @@ mq_notify (mqd_t mqdes, const struct sig + if (data.attr == NULL) + return -1; + +- memcpy (data.attr, notification->sigev_notify_attributes, +- sizeof (pthread_attr_t)); ++ int ret = __pthread_attr_copy (data.attr, ++ notification->sigev_notify_attributes); ++ if (ret != 0) ++ { ++ free (data.attr); ++ __set_errno (ret); ++ return -1; ++ } + } + + /* Construct the new request. */ +@@ -269,8 +278,11 @@ mq_notify (mqd_t mqdes, const struct sig + int retval = INLINE_SYSCALL (mq_notify, 2, mqdes, &se); + + /* If it failed, free the allocated memory. */ +- if (__glibc_unlikely (retval != 0)) +- free (data.attr); ++ if (retval != 0 && data.attr != NULL) ++ { ++ pthread_attr_destroy (data.attr); ++ free (data.attr); ++ } + + return retval; + } +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/msgctl.c glibc-2.32/sysdeps/unix/sysv/linux/msgctl.c +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/msgctl.c 2021-09-18 21:02:32.736185847 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/msgctl.c 2021-09-18 21:03:05.313302322 +1000 +@@ -90,8 +90,15 @@ __msgctl64 (int msqid, int cmd, struct _ struct kernel_msqid64_ds ksemid, *arg = NULL; if (buf != NULL) { @@ -4081,7 +5138,7 @@ index 0776472d5e..a1f24ab242 100644 } # ifdef __ASSUME_SYSVIPC_BROKEN_MODE_T if (cmd == IPC_SET) -@@ -169,8 +176,15 @@ __msgctl (int msqid, int cmd, struct msqid_ds *buf) +@@ -169,8 +176,15 @@ __msgctl (int msqid, int cmd, struct msq struct __msqid64_ds msqid64, *buf64 = NULL; if (buf != NULL) { @@ -4099,11 +5156,10 @@ index 0776472d5e..a1f24ab242 100644 } int ret = __msgctl64 (msqid, cmd, buf64); -diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c -index f131a26fc7..1cdabde8f2 100644 ---- a/sysdeps/unix/sysv/linux/semctl.c -+++ b/sysdeps/unix/sysv/linux/semctl.c -@@ -102,6 +102,7 @@ semun64_to_ksemun64 (int cmd, union semun64 semun64, +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/semctl.c glibc-2.32/sysdeps/unix/sysv/linux/semctl.c +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/semctl.c 2021-09-18 21:02:32.739185950 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/semctl.c 2021-09-18 21:03:05.313302322 +1000 +@@ -102,6 +102,7 @@ semun64_to_ksemun64 (int cmd, union semu r.array = semun64.array; break; case SEM_STAT: @@ -4111,7 +5167,7 @@ index f131a26fc7..1cdabde8f2 100644 case IPC_STAT: case IPC_SET: r.buf = buf; -@@ -150,6 +151,7 @@ __semctl64 (int semid, int semnum, int cmd, ...) +@@ -150,6 +151,7 @@ __semctl64 (int semid, int semnum, int c case IPC_STAT: /* arg.buf */ case IPC_SET: case SEM_STAT: @@ -4119,7 +5175,7 @@ index f131a26fc7..1cdabde8f2 100644 case IPC_INFO: /* arg.__buf */ case SEM_INFO: va_start (ap, cmd); -@@ -238,6 +240,7 @@ semun_to_semun64 (int cmd, union semun semun, struct __semid64_ds *semid64) +@@ -238,6 +240,7 @@ semun_to_semun64 (int cmd, union semun s r.array = semun.array; break; case SEM_STAT: @@ -4127,7 +5183,7 @@ index f131a26fc7..1cdabde8f2 100644 case IPC_STAT: case IPC_SET: r.buf = semid64; -@@ -267,6 +270,7 @@ __semctl (int semid, int semnum, int cmd, ...) +@@ -267,6 +270,7 @@ __semctl (int semid, int semnum, int cmd case IPC_STAT: /* arg.buf */ case IPC_SET: case SEM_STAT: @@ -4135,7 +5191,7 @@ index f131a26fc7..1cdabde8f2 100644 case IPC_INFO: /* arg.__buf */ case SEM_INFO: va_start (ap, cmd); -@@ -321,6 +325,7 @@ __semctl_mode16 (int semid, int semnum, int cmd, ...) +@@ -321,6 +325,7 @@ __semctl_mode16 (int semid, int semnum, case IPC_STAT: /* arg.buf */ case IPC_SET: case SEM_STAT: @@ -4143,7 +5199,7 @@ index f131a26fc7..1cdabde8f2 100644 case IPC_INFO: /* arg.__buf */ case SEM_INFO: va_start (ap, cmd); -@@ -354,6 +359,7 @@ __old_semctl (int semid, int semnum, int cmd, ...) +@@ -354,6 +359,7 @@ __old_semctl (int semid, int semnum, int case IPC_STAT: /* arg.buf */ case IPC_SET: case SEM_STAT: @@ -4151,25 +5207,20 @@ index f131a26fc7..1cdabde8f2 100644 case IPC_INFO: /* arg.__buf */ case SEM_INFO: va_start (ap, cmd); -diff --git a/sysdeps/unix/sysv/linux/sh/be/sh4/fpu/Implies b/sysdeps/unix/sysv/linux/sh/be/sh4/fpu/Implies -new file mode 100644 -index 0000000000..7eeaf15a5a ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/sh/be/sh4/fpu/Implies +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/sh/be/sh4/fpu/Implies glibc-2.32/sysdeps/unix/sysv/linux/sh/be/sh4/fpu/Implies +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/sh/be/sh4/fpu/Implies 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/sh/be/sh4/fpu/Implies 2021-09-18 21:03:05.313302322 +1000 @@ -0,0 +1 @@ +unix/sysv/linux/sh/sh4/fpu -diff --git a/sysdeps/unix/sysv/linux/sh/le/sh4/fpu/Implies b/sysdeps/unix/sysv/linux/sh/le/sh4/fpu/Implies -new file mode 100644 -index 0000000000..7eeaf15a5a ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/sh/le/sh4/fpu/Implies +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/sh/le/sh4/fpu/Implies glibc-2.32/sysdeps/unix/sysv/linux/sh/le/sh4/fpu/Implies +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/sh/le/sh4/fpu/Implies 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/sh/le/sh4/fpu/Implies 2021-09-18 21:03:05.313302322 +1000 @@ -0,0 +1 @@ +unix/sysv/linux/sh/sh4/fpu -diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c -index 76d88441f1..1d19a798b1 100644 ---- a/sysdeps/unix/sysv/linux/shmctl.c -+++ b/sysdeps/unix/sysv/linux/shmctl.c -@@ -90,8 +90,15 @@ __shmctl64 (int shmid, int cmd, struct __shmid64_ds *buf) +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/shmctl.c glibc-2.32/sysdeps/unix/sysv/linux/shmctl.c +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/shmctl.c 2021-09-18 21:02:32.740185984 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/shmctl.c 2021-09-18 21:03:05.313302322 +1000 +@@ -90,8 +90,15 @@ __shmctl64 (int shmid, int cmd, struct _ struct kernel_shmid64_ds kshmid, *arg = NULL; if (buf != NULL) { @@ -4187,7 +5238,7 @@ index 76d88441f1..1d19a798b1 100644 } # ifdef __ASSUME_SYSVIPC_BROKEN_MODE_T if (cmd == IPC_SET) -@@ -107,7 +114,6 @@ __shmctl64 (int shmid, int cmd, struct __shmid64_ds *buf) +@@ -107,7 +114,6 @@ __shmctl64 (int shmid, int cmd, struct _ switch (cmd) { @@ -4195,7 +5246,7 @@ index 76d88441f1..1d19a798b1 100644 case IPC_STAT: case SHM_STAT: case SHM_STAT_ANY: -@@ -168,8 +174,15 @@ __shmctl (int shmid, int cmd, struct shmid_ds *buf) +@@ -168,8 +174,15 @@ __shmctl (int shmid, int cmd, struct shm struct __shmid64_ds shmid64, *buf64 = NULL; if (buf != NULL) { @@ -4213,7 +5264,7 @@ index 76d88441f1..1d19a798b1 100644 } int ret = __shmctl64 (shmid, cmd, buf64); -@@ -178,7 +191,6 @@ __shmctl (int shmid, int cmd, struct shmid_ds *buf) +@@ -178,7 +191,6 @@ __shmctl (int shmid, int cmd, struct shm switch (cmd) { @@ -4221,11 +5272,9 @@ index 76d88441f1..1d19a798b1 100644 case IPC_STAT: case SHM_STAT: case SHM_STAT_ANY: -diff --git a/sysdeps/unix/sysv/linux/tst-sysvmsg-linux.c b/sysdeps/unix/sysv/linux/tst-sysvmsg-linux.c -new file mode 100644 -index 0000000000..630f4f792c ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/tst-sysvmsg-linux.c +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/tst-sysvmsg-linux.c glibc-2.32/sysdeps/unix/sysv/linux/tst-sysvmsg-linux.c +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/tst-sysvmsg-linux.c 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/tst-sysvmsg-linux.c 2021-09-18 21:03:05.313302322 +1000 @@ -0,0 +1,177 @@ +/* Basic tests for Linux SYSV message queue extensions. + Copyright (C) 2020 Free Software Foundation, Inc. @@ -4404,11 +5453,9 @@ index 0000000000..630f4f792c +} + +#include <support/test-driver.c> -diff --git a/sysdeps/unix/sysv/linux/tst-sysvsem-linux.c b/sysdeps/unix/sysv/linux/tst-sysvsem-linux.c -new file mode 100644 -index 0000000000..45f19e2d37 ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/tst-sysvsem-linux.c +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/tst-sysvsem-linux.c glibc-2.32/sysdeps/unix/sysv/linux/tst-sysvsem-linux.c +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/tst-sysvsem-linux.c 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/tst-sysvsem-linux.c 2021-09-18 21:03:05.314302356 +1000 @@ -0,0 +1,184 @@ +/* Basic tests for Linux SYSV semaphore extensions. + Copyright (C) 2020 Free Software Foundation, Inc. @@ -4594,11 +5641,9 @@ index 0000000000..45f19e2d37 +} + +#include <support/test-driver.c> -diff --git a/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c b/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c -new file mode 100644 -index 0000000000..7128ae2e14 ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c glibc-2.32/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c 2021-09-18 21:03:05.314302356 +1000 @@ -0,0 +1,185 @@ +/* Basic tests for Linux SYSV shared memory extensions. + Copyright (C) 2020 Free Software Foundation, Inc. @@ -4785,27 +5830,41 @@ index 0000000000..7128ae2e14 +} + +#include <support/test-driver.c> -diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile -index a6736aef25..9736a13e7b 100644 ---- a/sysdeps/x86/Makefile -+++ b/sysdeps/x86/Makefile -@@ -12,6 +12,12 @@ endif - ifeq ($(subdir),setjmp) - gen-as-const-headers += jmp_buf-ssp.sym - sysdep_routines += __longjmp_cancel -+ifneq ($(enable-cet),no) -+ifneq ($(have-tunables),no) -+tests += tst-setjmp-cet -+tst-setjmp-cet-ENV = GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on -+endif -+endif - endif +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/x86_64/64/configure glibc-2.32/sysdeps/unix/sysv/linux/x86_64/64/configure +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/x86_64/64/configure 2021-09-18 21:02:32.741186019 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/x86_64/64/configure 2021-09-18 21:03:05.314302356 +1000 +@@ -4,10 +4,10 @@ + test -n "$libc_cv_slibdir" || + case "$prefix" in + /usr | /usr/) +- libc_cv_slibdir='/lib64' +- libc_cv_rtlddir='/lib64' ++ libc_cv_slibdir='/lib' ++ libc_cv_rtlddir='/lib' + if test "$libdir" = '${exec_prefix}/lib'; then +- libdir='${exec_prefix}/lib64'; ++ libdir='${exec_prefix}/lib'; + # Locale data can be shared between 32-bit and 64-bit libraries. + libc_cv_complocaledir='${exec_prefix}/lib/locale' + fi +diff -pruN glibc-2.32.orig/sysdeps/unix/sysv/linux/x86_64/ldconfig.h glibc-2.32/sysdeps/unix/sysv/linux/x86_64/ldconfig.h +--- glibc-2.32.orig/sysdeps/unix/sysv/linux/x86_64/ldconfig.h 2021-09-18 21:02:32.742186053 +1000 ++++ glibc-2.32/sysdeps/unix/sysv/linux/x86_64/ldconfig.h 2021-09-18 21:03:05.314302356 +1000 +@@ -18,9 +18,9 @@ + #include <sysdeps/generic/ldconfig.h> - ifeq ($(subdir),string) -diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c -index 217c21c34f..3fb4a028d8 100644 ---- a/sysdeps/x86/cacheinfo.c -+++ b/sysdeps/x86/cacheinfo.c + #define SYSDEP_KNOWN_INTERPRETER_NAMES \ +- { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \ ++ { "/lib32/ld-linux.so.2", FLAG_ELF_LIBC6 }, \ + { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \ +- { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 }, ++ { "/lib/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 }, + #define SYSDEP_KNOWN_LIBRARY_NAMES \ + { "libc.so.6", FLAG_ELF_LIBC6 }, \ + { "libm.so.6", FLAG_ELF_LIBC6 }, +diff -pruN glibc-2.32.orig/sysdeps/x86/cacheinfo.c glibc-2.32/sysdeps/x86/cacheinfo.c +--- glibc-2.32.orig/sysdeps/x86/cacheinfo.c 2021-09-18 21:02:32.742186053 +1000 ++++ glibc-2.32/sysdeps/x86/cacheinfo.c 2021-09-18 21:03:05.314302356 +1000 @@ -808,7 +808,7 @@ init_cacheinfo (void) threads = 1 << ((ecx >> 12) & 0x0f); } @@ -4866,11 +5925,10 @@ index 217c21c34f..3fb4a028d8 100644 /* NB: The REP MOVSB threshold must be greater than VEC_SIZE * 8. */ unsigned int minimum_rep_movsb_threshold; -diff --git a/sysdeps/x86/dl-cet.c b/sysdeps/x86/dl-cet.c -index 03572f7af6..3cc54a8d53 100644 ---- a/sysdeps/x86/dl-cet.c -+++ b/sysdeps/x86/dl-cet.c -@@ -47,7 +47,10 @@ dl_cet_check (struct link_map *m, const char *program) +diff -pruN glibc-2.32.orig/sysdeps/x86/dl-cet.c glibc-2.32/sysdeps/x86/dl-cet.c +--- glibc-2.32.orig/sysdeps/x86/dl-cet.c 2021-09-18 21:02:32.742186053 +1000 ++++ glibc-2.32/sysdeps/x86/dl-cet.c 2021-09-18 21:03:05.314302356 +1000 +@@ -47,7 +47,10 @@ dl_cet_check (struct link_map *m, const /* No legacy object check if both IBT and SHSTK are always on. */ if (enable_ibt_type == cet_always_on && enable_shstk_type == cet_always_on) @@ -4882,11 +5940,10 @@ index 03572f7af6..3cc54a8d53 100644 /* Check if IBT is enabled by kernel. */ bool ibt_enabled -diff --git a/sysdeps/x86/dl-prop.h b/sysdeps/x86/dl-prop.h -index 89911e19e2..4eb3b85a7b 100644 ---- a/sysdeps/x86/dl-prop.h -+++ b/sysdeps/x86/dl-prop.h -@@ -145,15 +145,15 @@ _dl_process_cet_property_note (struct link_map *l, +diff -pruN glibc-2.32.orig/sysdeps/x86/dl-prop.h glibc-2.32/sysdeps/x86/dl-prop.h +--- glibc-2.32.orig/sysdeps/x86/dl-prop.h 2021-09-18 21:02:32.742186053 +1000 ++++ glibc-2.32/sysdeps/x86/dl-prop.h 2021-09-18 21:03:05.314302356 +1000 +@@ -145,15 +145,15 @@ _dl_process_cet_property_note (struct li } static inline void __attribute__ ((unused)) @@ -4905,18 +5962,109 @@ index 89911e19e2..4eb3b85a7b 100644 { return 0; } -diff --git a/sysdeps/x86/tst-setjmp-cet.c b/sysdeps/x86/tst-setjmp-cet.c -new file mode 100644 -index 0000000000..42c795d2a8 ---- /dev/null -+++ b/sysdeps/x86/tst-setjmp-cet.c +diff -pruN glibc-2.32.orig/sysdeps/x86/Makefile glibc-2.32/sysdeps/x86/Makefile +--- glibc-2.32.orig/sysdeps/x86/Makefile 2021-09-18 21:02:32.742186053 +1000 ++++ glibc-2.32/sysdeps/x86/Makefile 2021-09-18 21:03:05.314302356 +1000 +@@ -12,6 +12,12 @@ endif + ifeq ($(subdir),setjmp) + gen-as-const-headers += jmp_buf-ssp.sym + sysdep_routines += __longjmp_cancel ++ifneq ($(enable-cet),no) ++ifneq ($(have-tunables),no) ++tests += tst-setjmp-cet ++tst-setjmp-cet-ENV = GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on ++endif ++endif + endif + + ifeq ($(subdir),string) +diff -pruN glibc-2.32.orig/sysdeps/x86/tst-setjmp-cet.c glibc-2.32/sysdeps/x86/tst-setjmp-cet.c +--- glibc-2.32.orig/sysdeps/x86/tst-setjmp-cet.c 1970-01-01 10:00:00.000000000 +1000 ++++ glibc-2.32/sysdeps/x86/tst-setjmp-cet.c 2021-09-18 21:03:05.314302356 +1000 @@ -0,0 +1 @@ +#include <setjmp/tst-setjmp.c> -diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h -index ca73d8fef9..363a749cb2 100644 ---- a/sysdeps/x86_64/dl-machine.h -+++ b/sysdeps/x86_64/dl-machine.h -@@ -315,16 +315,22 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, +diff -pruN glibc-2.32.orig/sysdeps/x86_64/configure glibc-2.32/sysdeps/x86_64/configure +--- glibc-2.32.orig/sysdeps/x86_64/configure 2021-09-18 21:02:32.743186087 +1000 ++++ glibc-2.32/sysdeps/x86_64/configure 2021-09-18 21:03:05.314302356 +1000 +@@ -107,39 +107,6 @@ if test x"$build_mathvec" = xnotset; the + build_mathvec=yes + fi + +-if test "$static_pie" = yes; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker static PIE support" >&5 +-$as_echo_n "checking for linker static PIE support... " >&6; } +-if ${libc_cv_ld_static_pie+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- cat > conftest.s <<\EOF +- .text +- .global _start +- .weak foo +-_start: +- leaq foo(%rip), %rax +-EOF +- libc_cv_pie_option="-Wl,-pie" +- if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp $libc_cv_pie_option -o conftest conftest.s 1>&5' +- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 +- (eval $ac_try) 2>&5 +- ac_status=$? +- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +- test $ac_status = 0; }; }; then +- libc_cv_ld_static_pie=yes +- else +- libc_cv_ld_static_pie=no +- fi +-rm -f conftest* +-fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ld_static_pie" >&5 +-$as_echo "$libc_cv_ld_static_pie" >&6; } +- if test "$libc_cv_ld_static_pie" != yes; then +- as_fn_error $? "linker support for static PIE needed" "$LINENO" 5 +- fi +-fi +- + $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h + + +diff -pruN glibc-2.32.orig/sysdeps/x86_64/configure.ac glibc-2.32/sysdeps/x86_64/configure.ac +--- glibc-2.32.orig/sysdeps/x86_64/configure.ac 2021-09-18 21:02:32.743186087 +1000 ++++ glibc-2.32/sysdeps/x86_64/configure.ac 2021-09-18 21:03:05.314302356 +1000 +@@ -53,31 +53,6 @@ if test x"$build_mathvec" = xnotset; the + build_mathvec=yes + fi + +-dnl Check if linker supports static PIE with the fix for +-dnl +-dnl https://sourceware.org/bugzilla/show_bug.cgi?id=21782 +-dnl +-if test "$static_pie" = yes; then +- AC_CACHE_CHECK(for linker static PIE support, libc_cv_ld_static_pie, [dnl +-cat > conftest.s <<\EOF +- .text +- .global _start +- .weak foo +-_start: +- leaq foo(%rip), %rax +-EOF +- libc_cv_pie_option="-Wl,-pie" +- if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp $libc_cv_pie_option -o conftest conftest.s 1>&AS_MESSAGE_LOG_FD); then +- libc_cv_ld_static_pie=yes +- else +- libc_cv_ld_static_pie=no +- fi +-rm -f conftest*]) +- if test "$libc_cv_ld_static_pie" != yes; then +- AC_MSG_ERROR([linker support for static PIE needed]) +- fi +-fi +- + dnl It is always possible to access static and hidden symbols in an + dnl position independent way. + AC_DEFINE(PI_STATIC_AND_HIDDEN) +diff -pruN glibc-2.32.orig/sysdeps/x86_64/dl-machine.h glibc-2.32/sysdeps/x86_64/dl-machine.h +--- glibc-2.32.orig/sysdeps/x86_64/dl-machine.h 2021-09-18 21:02:32.743186087 +1000 ++++ glibc-2.32/sysdeps/x86_64/dl-machine.h 2021-09-18 21:03:05.314302356 +1000 +@@ -315,16 +315,22 @@ elf_machine_rela (struct link_map *map, { # ifndef RTLD_BOOTSTRAP if (sym_map != map @@ -4944,10 +6092,9 @@ index ca73d8fef9..363a749cb2 100644 } # endif value = ((ElfW(Addr) (*) (void)) value) (); -diff --git a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h -index 7659758972..e5fd5ac9cb 100644 ---- a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h -+++ b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h +diff -pruN glibc-2.32.orig/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h glibc-2.32/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h +--- glibc-2.32.orig/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h 2021-09-18 21:02:32.743186087 +1000 ++++ glibc-2.32/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h 2021-09-18 21:03:05.314302356 +1000 @@ -32,7 +32,7 @@ IFUNC_SELECTOR (void) && CPU_FEATURE_USABLE_P (cpu_features, AVX2)) return OPTIMIZE (fma); @@ -4957,10 +6104,9 @@ index 7659758972..e5fd5ac9cb 100644 return OPTIMIZE (fma4); return OPTIMIZE (sse2); -diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S -index bd5dc1a3f3..092f364bb6 100644 ---- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S -+++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S +diff -pruN glibc-2.32.orig/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S glibc-2.32/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S +--- glibc-2.32.orig/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S 2021-09-18 21:02:32.745186156 +1000 ++++ glibc-2.32/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S 2021-09-18 21:03:05.314302356 +1000 @@ -56,6 +56,13 @@ # endif #endif @@ -4997,10 +6143,9 @@ index bd5dc1a3f3..092f364bb6 100644 mov %RDX_LP, %RCX_LP rep movsb L(nop): -diff --git a/sysvipc/test-sysvsem.c b/sysvipc/test-sysvsem.c -index 01dbff343a..b7284e0b48 100644 ---- a/sysvipc/test-sysvsem.c -+++ b/sysvipc/test-sysvsem.c +diff -pruN glibc-2.32.orig/sysvipc/test-sysvsem.c glibc-2.32/sysvipc/test-sysvsem.c +--- glibc-2.32.orig/sysvipc/test-sysvsem.c 2021-09-18 21:02:32.746186190 +1000 ++++ glibc-2.32/sysvipc/test-sysvsem.c 2021-09-18 21:03:05.314302356 +1000 @@ -20,6 +20,7 @@ #include <stdlib.h> #include <errno.h> @@ -5009,47 +6154,12 @@ index 01dbff343a..b7284e0b48 100644 #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> -diff --git a/version.h b/version.h -index 83cd196798..e6ca7a8857 100644 ---- a/version.h -+++ b/version.h +diff -pruN glibc-2.32.orig/version.h glibc-2.32/version.h +--- glibc-2.32.orig/version.h 2021-09-18 21:02:32.746186190 +1000 ++++ glibc-2.32/version.h 2021-09-18 21:03:05.314302356 +1000 @@ -1,4 +1,4 @@ /* This file just defines the current version number of libc. */ -#define RELEASE "release" +#define RELEASE "stable" #define VERSION "2.32" -diff --git a/sysdeps/unix/sysv/linux/x86_64/64/configure b/sysdeps/unix/sysv/linux/x86_64/64/configure -index 9d298faba7..cef1ec842c 100644 ---- a/sysdeps/unix/sysv/linux/x86_64/64/configure -+++ b/sysdeps/unix/sysv/linux/x86_64/64/configure -@@ -4,10 +4,10 @@ - test -n "$libc_cv_slibdir" || - case "$prefix" in - /usr | /usr/) -- libc_cv_slibdir='/lib64' -- libc_cv_rtlddir='/lib64' -+ libc_cv_slibdir='/lib' -+ libc_cv_rtlddir='/lib' - if test "$libdir" = '${exec_prefix}/lib'; then -- libdir='${exec_prefix}/lib64'; -+ libdir='${exec_prefix}/lib'; - # Locale data can be shared between 32-bit and 64-bit libraries. - libc_cv_complocaledir='${exec_prefix}/lib/locale' - fi -diff --git a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h -index 062c04689d..7783757726 100644 ---- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h -+++ b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h -@@ -18,9 +18,9 @@ - #include <sysdeps/generic/ldconfig.h> - - #define SYSDEP_KNOWN_INTERPRETER_NAMES \ -- { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \ -+ { "/lib32/ld-linux.so.2", FLAG_ELF_LIBC6 }, \ - { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \ -- { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 }, -+ { "/lib/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 }, - #define SYSDEP_KNOWN_LIBRARY_NAMES \ - { "libc.so.6", FLAG_ELF_LIBC6 }, \ - { "libm.so.6", FLAG_ELF_LIBC6 }, |