From 1350c45433cf880b612a05d955de61f74c5c7a7c Mon Sep 17 00:00:00 2001 From: aekoroglu Date: May 04 2022 13:49:21 +0000 Subject: not necessary patches removed --- diff --git a/SOURCES/0001-Backport-of-Add-NT_VMCOREDD-AT_MINSIGSTKSZ-from-Linu.patch b/SOURCES/0001-Backport-of-Add-NT_VMCOREDD-AT_MINSIGSTKSZ-from-Linu.patch deleted file mode 100644 index 90de4ca..0000000 --- a/SOURCES/0001-Backport-of-Add-NT_VMCOREDD-AT_MINSIGSTKSZ-from-Linu.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 174195409d6a3d639dd28e08cf99d6f2559eca9c Mon Sep 17 00:00:00 2001 -From: Joseph Myers -Date: Mon, 20 Aug 2018 15:46:26 +0000 -Subject: [PATCH] Add NT_VMCOREDD, AT_MINSIGSTKSZ from Linux 4.18 to elf.h. - -This patch adds two new constants from Linux 4.18 to elf.h, -NT_VMCOREDD and AT_MINSIGSTKSZ. - -Tested for x86_64. - - * elf/elf.c (NT_VMCOREDD): New macro. - (AT_MINSIGSTKSZ): Likewise. - - -UPDATE: - -Backported to glibc 2.28 - -Signed-off-by: Jair Gonzalez ---- - ChangeLog | 6 +++++- - elf/elf.h | 4 ++++ - 2 files changed, 9 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 74e63467..e1f1e8ed 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,5 +1,9 @@ --2019-03-25 Mike Crowe -+2018-08-20 Joseph Myers -+ -+ * elf/elf.c (NT_VMCOREDD): New macro. -+ (AT_MINSIGSTKSZ): Likewise. - -+2019-03-25 Mike Crowe - * nptl/tst-rwlock14.c (do_test): Replace duplicate calls to - pthread_rwlock_timedrdlock with calls to - pthread_rwlock_timedwrlock to ensure that the latter is tested -diff --git a/elf/elf.h b/elf/elf.h -index d6506ea1..9b4d56b0 100644 ---- a/elf/elf.h -+++ b/elf/elf.h -@@ -808,6 +808,7 @@ typedef struct - #define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */ - #define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension - registers */ -+#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */ - - /* Legal values for the note segment descriptor types for object files. */ - -@@ -1214,6 +1215,9 @@ typedef struct - #define AT_L3_CACHESIZE 46 - #define AT_L3_CACHEGEOMETRY 47 - -+#define AT_MINSIGSTKSZ 51 /* Stack needed for signal delivery -+ (AArch64). */ -+ - /* Note section contents. Each entry in the note section begins with - a header of a fixed form. */ - --- -2.27.0 - diff --git a/SOURCES/0001-void-short-distance-rep-movsb.patch b/SOURCES/0001-void-short-distance-rep-movsb.patch new file mode 100644 index 0000000..9964e15 --- /dev/null +++ b/SOURCES/0001-void-short-distance-rep-movsb.patch @@ -0,0 +1,53 @@ +From ff7e299914a2dfa1c3fd7abd267535f7586ac413 Mon Sep 17 00:00:00 2001 +From: Wangyang Guo +Date: Mon, 15 Nov 2021 06:12:16 +0000 +Subject: [PATCH 1/2] Avoid short distance rep movsb + +--- + .../multiarch/memmove-vec-unaligned-erms.S | 22 +++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S +index c952576c..07299dc0 100644 +--- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S ++++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S +@@ -56,6 +56,14 @@ + # endif + #endif + ++/* Avoid short distance rep movsb only with non-SSE vector. */ ++#ifndef AVOID_SHORT_DISTANCE_REP_MOVSB ++# define AVOID_SHORT_DISTANCE_REP_MOVSB 1 ++#else ++# define AVOID_SHORT_DISTANCE_REP_MOVSB 0 ++#endif ++ ++ + #ifndef PREFETCH + # define PREFETCH(addr) prefetcht0 addr + #endif +@@ -235,7 +243,21 @@ L(movsb): + cmpq %r9, %rdi + /* Avoid slow backward REP MOVSB. */ + jb L(more_8x_vec_backward) ++# if AVOID_SHORT_DISTANCE_REP_MOVSB ++ movq %rdi, %rcx ++ subq %rsi, %rcx ++ jmp 2f ++# endif + 1: ++# if AVOID_SHORT_DISTANCE_REP_MOVSB ++ movq %rsi, %rcx ++ subq %rdi, %rcx ++2: ++/* Avoid "rep movsb" if RCX, the distance between source and destination, ++ is N*4GB + [1..63] with N >= 0. */ ++ cmpl $63, %ecx ++ jbe L(more_2x_vec) /* Avoid "rep movsb" if ECX <= 63. */ ++# endif + movq %rdx, %rcx + rep movsb + L(nop): +-- +2.27.0 + diff --git a/SOURCES/0002-Backport-of-Print-cache-size-and-geometry-auxv-types.patch b/SOURCES/0002-Backport-of-Print-cache-size-and-geometry-auxv-types.patch deleted file mode 100644 index 9d11d24..0000000 --- a/SOURCES/0002-Backport-of-Print-cache-size-and-geometry-auxv-types.patch +++ /dev/null @@ -1,259 +0,0 @@ -From 1616d034b61622836d3a36af53dcfca7624c844e Mon Sep 17 00:00:00 2001 -From: Tulio Magno Quites Machado Filho -Date: Wed, 19 Dec 2018 19:03:12 -0200 -Subject: [PATCH] Print cache size and geometry auxv types on LD_SHOW_AUXV=1 - -Add support for AT_L1I_CACHESIZE, AT_L1I_CACHEGEOMETRY, -AT_L1D_CACHESIZE, AT_L1D_CACHEGEOMETRY, AT_L2_CACHESIZE, -AT_L2_CACHEGEOMETRY, AT_L3_CACHESIZE and AT_L3_CACHEGEOMETRY when -LD_SHOW_AUXV=1. - -AT_L*_CACHESIZE is printed as decimal and represent the number of -bytes of the cache. - -AT_L*_CACHEGEOMETRY is treated in order to specify the cache line size -and its associativity. - -Example output from a POWER8: - -AT_L1I_CACHESIZE: 32768 -AT_L1I_CACHEGEOMETRY: 128B line size, 8-way set associative -AT_L1D_CACHESIZE: 65536 -AT_L1D_CACHEGEOMETRY: 128B line size, 8-way set associative -AT_L2_CACHESIZE: 524288 -AT_L2_CACHEGEOMETRY: 128B line size, 8-way set associative -AT_L3_CACHESIZE: 8388608 -AT_L3_CACHEGEOMETRY: 128B line size, 8-way set associative - -Some of the new types are longer than the previous ones, requiring to -increase the indentation in order to keep the values aligned. - - * elf/dl-sysdep.c (auxvars): Add AT_L1I_CACHESIZE, - AT_L1I_CACHEGEOMETRY, AT_L1D_CACHESIZE, AT_L1D_CACHEGEOMETRY, - AT_L2_CACHESIZE, AT_L2_CACHEGEOMETRY, AT_L3_CACHESIZE and - AT_L3_CACHEGEOMETRY. Fix indentation when printing the other - fields. - (_dl_show_auxv): Give a special treatment to - AT_L1I_CACHEGEOMETRY, AT_L1D_CACHEGEOMETRY, AT_L2_CACHEGEOMETRY - and AT_L3_CACHEGEOMETRY. - * sysdeps/powerpc/dl-procinfo.h (cache_geometry): New function. - (_dl_procinfo): Fix indentation when printing AT_HWCAP and - AT_HWCAP2. Add support for AT_L1I_CACHEGEOMETRY, - AT_L1D_CACHEGEOMETRY, AT_L2_CACHEGEOMETRY and AT_L3_CACHEGEOMETRY. - -Signed-off-by: Tulio Magno Quites Machado Filho - -UPDATE: - -Backported to glibc 2.28 - -Signed-off-by: Jair Gonzalez ---- - ChangeLog | 15 ++++++++ - elf/dl-sysdep.c | 68 ++++++++++++++++++++--------------- - sysdeps/powerpc/dl-procinfo.h | 55 ++++++++++++++++++++++++++-- - 3 files changed, 107 insertions(+), 31 deletions(-) - -diff --git a/ChangeLog b/ChangeLog -index e1f1e8ed..305a772b 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,18 @@ -+2018-12-19 Tulio Magno Quites Machado Filho -+ -+ * elf/dl-sysdep.c (auxvars): Add AT_L1I_CACHESIZE, -+ AT_L1I_CACHEGEOMETRY, AT_L1D_CACHESIZE, AT_L1D_CACHEGEOMETRY, -+ AT_L2_CACHESIZE, AT_L2_CACHEGEOMETRY, AT_L3_CACHESIZE and -+ AT_L3_CACHEGEOMETRY. Fix indentation when printing the other -+ fields. -+ (_dl_show_auxv): Give a special treatment to -+ AT_L1I_CACHEGEOMETRY, AT_L1D_CACHEGEOMETRY, AT_L2_CACHEGEOMETRY -+ and AT_L3_CACHEGEOMETRY. -+ * sysdeps/powerpc/dl-procinfo.h (cache_geometry): New function. -+ (_dl_procinfo): Fix indentation when printing AT_HWCAP and -+ AT_HWCAP2. Add support for AT_L1I_CACHEGEOMETRY, -+ AT_L1D_CACHEGEOMETRY, AT_L2_CACHEGEOMETRY and AT_L3_CACHEGEOMETRY. -+ - 2018-08-20 Joseph Myers - - * elf/elf.c (NT_VMCOREDD): New macro. -diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c -index 998c5d52..93983251 100644 ---- a/elf/dl-sysdep.c -+++ b/elf/dl-sysdep.c -@@ -277,38 +277,46 @@ _dl_show_auxv (void) - { - static const struct - { -- const char label[17]; -+ const char label[22]; - enum { unknown = 0, dec, hex, str, ignore } form : 8; - } auxvars[] = - { -- [AT_EXECFD - 2] = { "EXECFD: ", dec }, -- [AT_EXECFN - 2] = { "EXECFN: ", str }, -- [AT_PHDR - 2] = { "PHDR: 0x", hex }, -- [AT_PHENT - 2] = { "PHENT: ", dec }, -- [AT_PHNUM - 2] = { "PHNUM: ", dec }, -- [AT_PAGESZ - 2] = { "PAGESZ: ", dec }, -- [AT_BASE - 2] = { "BASE: 0x", hex }, -- [AT_FLAGS - 2] = { "FLAGS: 0x", hex }, -- [AT_ENTRY - 2] = { "ENTRY: 0x", hex }, -- [AT_NOTELF - 2] = { "NOTELF: ", hex }, -- [AT_UID - 2] = { "UID: ", dec }, -- [AT_EUID - 2] = { "EUID: ", dec }, -- [AT_GID - 2] = { "GID: ", dec }, -- [AT_EGID - 2] = { "EGID: ", dec }, -- [AT_PLATFORM - 2] = { "PLATFORM: ", str }, -- [AT_HWCAP - 2] = { "HWCAP: ", hex }, -- [AT_CLKTCK - 2] = { "CLKTCK: ", dec }, -- [AT_FPUCW - 2] = { "FPUCW: ", hex }, -- [AT_DCACHEBSIZE - 2] = { "DCACHEBSIZE: 0x", hex }, -- [AT_ICACHEBSIZE - 2] = { "ICACHEBSIZE: 0x", hex }, -- [AT_UCACHEBSIZE - 2] = { "UCACHEBSIZE: 0x", hex }, -+ [AT_EXECFD - 2] = { "EXECFD: ", dec }, -+ [AT_EXECFN - 2] = { "EXECFN: ", str }, -+ [AT_PHDR - 2] = { "PHDR: 0x", hex }, -+ [AT_PHENT - 2] = { "PHENT: ", dec }, -+ [AT_PHNUM - 2] = { "PHNUM: ", dec }, -+ [AT_PAGESZ - 2] = { "PAGESZ: ", dec }, -+ [AT_BASE - 2] = { "BASE: 0x", hex }, -+ [AT_FLAGS - 2] = { "FLAGS: 0x", hex }, -+ [AT_ENTRY - 2] = { "ENTRY: 0x", hex }, -+ [AT_NOTELF - 2] = { "NOTELF: ", hex }, -+ [AT_UID - 2] = { "UID: ", dec }, -+ [AT_EUID - 2] = { "EUID: ", dec }, -+ [AT_GID - 2] = { "GID: ", dec }, -+ [AT_EGID - 2] = { "EGID: ", dec }, -+ [AT_PLATFORM - 2] = { "PLATFORM: ", str }, -+ [AT_HWCAP - 2] = { "HWCAP: ", hex }, -+ [AT_CLKTCK - 2] = { "CLKTCK: ", dec }, -+ [AT_FPUCW - 2] = { "FPUCW: ", hex }, -+ [AT_DCACHEBSIZE - 2] = { "DCACHEBSIZE: 0x", hex }, -+ [AT_ICACHEBSIZE - 2] = { "ICACHEBSIZE: 0x", hex }, -+ [AT_UCACHEBSIZE - 2] = { "UCACHEBSIZE: 0x", hex }, - [AT_IGNOREPPC - 2] = { "IGNOREPPC", ignore }, -- [AT_SECURE - 2] = { "SECURE: ", dec }, -- [AT_BASE_PLATFORM - 2] = { "BASE_PLATFORM:", str }, -- [AT_SYSINFO - 2] = { "SYSINFO: 0x", hex }, -- [AT_SYSINFO_EHDR - 2] = { "SYSINFO_EHDR: 0x", hex }, -- [AT_RANDOM - 2] = { "RANDOM: 0x", hex }, -- [AT_HWCAP2 - 2] = { "HWCAP2: 0x", hex }, -+ [AT_SECURE - 2] = { "SECURE: ", dec }, -+ [AT_BASE_PLATFORM - 2] = { "BASE_PLATFORM: ", str }, -+ [AT_SYSINFO - 2] = { "SYSINFO: 0x", hex }, -+ [AT_SYSINFO_EHDR - 2] = { "SYSINFO_EHDR: 0x", hex }, -+ [AT_RANDOM - 2] = { "RANDOM: 0x", hex }, -+ [AT_HWCAP2 - 2] = { "HWCAP2: 0x", hex }, -+ [AT_L1I_CACHESIZE - 2] = { "L1I_CACHESIZE: ", dec }, -+ [AT_L1I_CACHEGEOMETRY - 2] = { "L1I_CACHEGEOMETRY: 0x", hex }, -+ [AT_L1D_CACHESIZE - 2] = { "L1D_CACHESIZE: ", dec }, -+ [AT_L1D_CACHEGEOMETRY - 2] = { "L1D_CACHEGEOMETRY: 0x", hex }, -+ [AT_L2_CACHESIZE - 2] = { "L2_CACHESIZE: ", dec }, -+ [AT_L2_CACHEGEOMETRY - 2] = { "L2_CACHEGEOMETRY: 0x", hex }, -+ [AT_L3_CACHESIZE - 2] = { "L3_CACHESIZE: ", dec }, -+ [AT_L3_CACHEGEOMETRY - 2] = { "L3_CACHEGEOMETRY: 0x", hex }, - }; - unsigned int idx = (unsigned int) (av->a_type - 2); - -@@ -320,7 +328,9 @@ _dl_show_auxv (void) - assert (AT_NULL == 0); - assert (AT_IGNORE == 1); - -- if (av->a_type == AT_HWCAP || av->a_type == AT_HWCAP2) -+ if (av->a_type == AT_HWCAP || av->a_type == AT_HWCAP2 -+ || AT_L1I_CACHEGEOMETRY || AT_L1D_CACHEGEOMETRY -+ || AT_L2_CACHEGEOMETRY || AT_L3_CACHEGEOMETRY) - { - /* These are handled in a special way per platform. */ - if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0) -diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h -index 3593e966..8d8ffb69 100644 ---- a/sysdeps/powerpc/dl-procinfo.h -+++ b/sysdeps/powerpc/dl-procinfo.h -@@ -157,6 +157,37 @@ _dl_string_platform (const char *str) - } - - #if IS_IN (rtld) -+static inline void -+cache_geometry (const char * name, unsigned long int geometry) -+{ -+ unsigned long int assocty, line; -+ -+ _dl_printf ("%s", name); -+ -+ line = geometry & 0xffff; -+ assocty = (geometry >> 16) & 0xffff; -+ -+ if (line == 0) -+ _dl_printf ("Unknown line size, "); -+ else -+ _dl_printf ("%luB line size, ", line); -+ -+ switch (assocty) -+ { -+ case 0: -+ _dl_printf ("Unknown associativity"); -+ break; -+ case 1: -+ _dl_printf ("Directly mapped"); -+ break; -+ case 0xffff: -+ _dl_printf ("Fully associative"); -+ break; -+ default: -+ _dl_printf ("%lu-way set associative", assocty); -+ } -+} -+ - static inline int - __attribute__ ((unused)) - _dl_procinfo (unsigned int type, unsigned long int word) -@@ -164,7 +195,7 @@ _dl_procinfo (unsigned int type, unsigned long int word) - switch(type) - { - case AT_HWCAP: -- _dl_printf ("AT_HWCAP: "); -+ _dl_printf ("AT_HWCAP: "); - - for (int i = 0; i <= _DL_HWCAP_LAST; ++i) - if (word & (1 << i)) -@@ -174,7 +205,7 @@ _dl_procinfo (unsigned int type, unsigned long int word) - { - unsigned int offset = _DL_HWCAP_LAST + 1; - -- _dl_printf ("AT_HWCAP2: "); -+ _dl_printf ("AT_HWCAP2: "); - - /* We have to go through them all because the kernel added the - AT_HWCAP2 features starting with the high bits. */ -@@ -183,6 +214,26 @@ _dl_procinfo (unsigned int type, unsigned long int word) - _dl_printf (" %s", _dl_hwcap_string (offset + i)); - break; - } -+ case AT_L1I_CACHEGEOMETRY: -+ { -+ cache_geometry ("AT_L1I_CACHEGEOMETRY: ", word); -+ break; -+ } -+ case AT_L1D_CACHEGEOMETRY: -+ { -+ cache_geometry ("AT_L1D_CACHEGEOMETRY: ", word); -+ break; -+ } -+ case AT_L2_CACHEGEOMETRY: -+ { -+ cache_geometry ("AT_L2_CACHEGEOMETRY: ", word); -+ break; -+ } -+ case AT_L3_CACHEGEOMETRY: -+ { -+ cache_geometry ("AT_L3_CACHEGEOMETRY: ", word); -+ break; -+ } - default: - /* This should not happen. */ - return -1; --- -2.27.0 - diff --git a/SOURCES/0002-pack-up-patches.patch b/SOURCES/0002-pack-up-patches.patch new file mode 100644 index 0000000..ca37c8d --- /dev/null +++ b/SOURCES/0002-pack-up-patches.patch @@ -0,0 +1,131 @@ +From f42b57f2c3da86a0e3aa8e2f6f09994b8a0c7334 Mon Sep 17 00:00:00 2001 +From: Wangyang Guo +Date: Mon, 15 Nov 2021 05:28:29 +0000 +Subject: [PATCH] pack up patches + +--- + crypt/Makefile | 2 ++ + math/Makefile | 2 ++ + math/w_sqrt_compat.c | 1 + + nss/nss_files/files-XXX.c | 4 ++++ + sysdeps/ieee754/dbl-64/e_exp.c | 1 + + sysdeps/ieee754/dbl-64/e_exp2.c | 1 + + sysdeps/x86_64/fpu/Makefile | 7 +++++++ + timezone/tzselect.ksh | 2 +- + 8 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/crypt/Makefile b/crypt/Makefile +index 3811b6e2..34fd5306 100644 +--- a/crypt/Makefile ++++ b/crypt/Makefile +@@ -22,6 +22,8 @@ subdir := crypt + + include ../Makeconfig + ++CFLAGS-.o += -flto -ffat-lto-objects -fno-stack-protector ++ + headers := crypt.h + + extra-libs := libcrypt +diff --git a/math/Makefile b/math/Makefile +index df73d708..e1826330 100644 +--- a/math/Makefile ++++ b/math/Makefile +@@ -21,6 +21,8 @@ subdir := math + + include ../Makeconfig + ++CFLAGS-.o += -fno-stack-protector -falign-functions=32 ++ + # Installed header files. + headers := math.h bits/mathcalls.h bits/mathinline.h \ + fpu_control.h complex.h bits/cmathcalls.h fenv.h \ +diff --git a/math/w_sqrt_compat.c b/math/w_sqrt_compat.c +index e76a8079..889ab39a 100644 +--- a/math/w_sqrt_compat.c ++++ b/math/w_sqrt_compat.c +@@ -26,6 +26,7 @@ + #if LIBM_SVID_COMPAT + /* wrapper sqrt */ + double ++__attribute__((aligned(64))) + __sqrt (double x) + { + if (__builtin_expect (isless (x, 0.0), 0) && _LIB_VERSION != _IEEE_) +diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c +index 37a3ce27..056ec6cc 100644 +--- a/nss/nss_files/files-XXX.c ++++ b/nss/nss_files/files-XXX.c +@@ -40,6 +40,7 @@ + #define ENTNAME_r CONCAT(ENTNAME,_r) + + #define DATAFILE "/etc/" DATABASE ++#define ALTDATAFILE "/usr/share/defaults/etc/" DATABASE + + #ifdef NEED_H_ERRNO + # include +@@ -77,6 +78,9 @@ internal_setent (FILE **stream) + { + *stream = __nss_files_fopen (DATAFILE); + ++ if (*stream == NULL) ++ *stream = fopen(ALTDATAFILE, "rce"); ++ + if (*stream == NULL) + status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; + } +diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c +index ddd2bcb1..3c693d78 100644 +--- a/sysdeps/ieee754/dbl-64/e_exp.c ++++ b/sysdeps/ieee754/dbl-64/e_exp.c +@@ -49,6 +49,7 @@ + + double + SECTION ++__attribute__((aligned(64))) + __ieee754_exp (double x) + { + double bexp, t, eps, del, base, y, al, bet, res, rem, cor; +diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c +index c45bb447..a30d5a2e 100644 +--- a/sysdeps/ieee754/dbl-64/e_exp2.c ++++ b/sysdeps/ieee754/dbl-64/e_exp2.c +@@ -39,6 +39,7 @@ static const double TWO1023 = 8.988465674311579539e+307; + static const double TWOM1000 = 9.3326361850321887899e-302; + + double ++__attribute__((aligned(64))) + __ieee754_exp2 (double x) + { + static const double himark = (double) DBL_MAX_EXP; +diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile +index 2b7d69bb..bba4a1de 100644 +--- a/sysdeps/x86_64/fpu/Makefile ++++ b/sysdeps/x86_64/fpu/Makefile +@@ -237,3 +237,10 @@ CFLAGS-test-float-libmvec-sincosf-avx512.c = -DREQUIRE_AVX512F + CFLAGS-test-float-libmvec-sincosf-avx512-main.c = $(libmvec-sincos-cflags) $(float-vlen16-arch-ext-cflags) + endif + endif ++ ++ifeq ($(subdir),math) ++CFLAGS-branred.c = -mprefer-vector-width=128 -fno-tree-vectorize ++CFLAGS-s_sincos.c = -mprefer-vector-width=256 -fno-tree-vectorize ++CFLAGS-e_exp.c = -mprefer-vector-width=128 -fno-tree-vectorize ++CFLAGS-e_exp2.c = -mprefer-vector-width=128 -fno-tree-vectorize ++endif +diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh +index d2c3a6d1..5c69e579 100755 +--- a/timezone/tzselect.ksh ++++ b/timezone/tzselect.ksh +@@ -52,7 +52,7 @@ say() { + + coord= + location_limit=10 +-zonetabtype=zone1970 ++zonetabtype=zone + + usage="Usage: tzselect [--version] [--help] [-c COORD] [-n LIMIT] + Select a time zone interactively. +-- +2.27.0 + diff --git a/SOURCES/0003-Backport-of-Tests-for-minimal-signal-handler.patch b/SOURCES/0003-Backport-of-Tests-for-minimal-signal-handler.patch deleted file mode 100644 index 609d990..0000000 --- a/SOURCES/0003-Backport-of-Tests-for-minimal-signal-handler.patch +++ /dev/null @@ -1,748 +0,0 @@ -From fbbc9a4e347dabb2d1662744e6a2e83b569ea3a4 Mon Sep 17 00:00:00 2001 -From: Zack Weinberg -Date: Tue, 15 Jan 2019 14:58:15 -0500 -Subject: [PATCH] Tests for minimal signal handler functionality in MINSIGSTKSZ - space. - -There is general agreement that the very short list of things that ISO -C says you can do in an async signal handler should all work when the -handler is running on an alternate signal stack with only MINSIGSTKSZ -space. This patch adds tests to make sure those things do work. - -To facilitate this, there is a new set of test support routines for -setting up alternate signal stacks; see support/xsignal.h for the API. - - * support/xsignal.h (xalloc_sigstack, xfree_sigstack) - (xget_sigstack_location): New test support functions. - * support/xsigstack.c: New file, implementing them. - * support/tst-xsigstack.c: New test for them. - * support/Makefile: Update. - - * signal/tst-minsigstksz-1.c - * signal/tst-minsigstksz-2.c - * signal/tst-minsigstksz-3.c - * signal/tst-minsigstksz-3a.c - * signal/tst-minsigstksz-4.c: New tests. - * signal/Makefile: Run them. - -UPDATE: - -Backported to glibc 2.28 - -Signed-off-by: Jair Gonzalez ---- - ChangeLog | 15 +++++ - signal/Makefile | 2 + - signal/tst-minsigstksz-1.c | 131 ++++++++++++++++++++++++++++++++++++ - signal/tst-minsigstksz-2.c | 66 ++++++++++++++++++ - signal/tst-minsigstksz-3.c | 64 ++++++++++++++++++ - signal/tst-minsigstksz-3a.c | 69 +++++++++++++++++++ - signal/tst-minsigstksz-4.c | 65 ++++++++++++++++++ - support/Makefile | 2 + - support/tst-xsigstack.c | 64 ++++++++++++++++++ - support/xsignal.h | 17 +++++ - support/xsigstack.c | 107 +++++++++++++++++++++++++++++ - 11 files changed, 602 insertions(+) - create mode 100644 signal/tst-minsigstksz-1.c - create mode 100644 signal/tst-minsigstksz-2.c - create mode 100644 signal/tst-minsigstksz-3.c - create mode 100644 signal/tst-minsigstksz-3a.c - create mode 100644 signal/tst-minsigstksz-4.c - create mode 100644 support/tst-xsigstack.c - create mode 100644 support/xsigstack.c - -diff --git a/ChangeLog b/ChangeLog -index 305a772b..9e33b6cb 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,18 @@ -+2019-01-16 Zack Weinberg -+ -+ * support/xsignal.h (xalloc_sigstack, xfree_sigstack) -+ (xget_sigstack_location): New test support functions. -+ * support/xsigstack.c: New file, implementing them. -+ * support/tst-xsigstack.c: New test for them. -+ * support/Makefile: Update. -+ -+ * signal/tst-minsigstksz-1.c -+ * signal/tst-minsigstksz-2.c -+ * signal/tst-minsigstksz-3.c -+ * signal/tst-minsigstksz-3a.c -+ * signal/tst-minsigstksz-4.c: New tests. -+ * signal/Makefile: Run them. -+ - 2018-12-19 Tulio Magno Quites Machado Filho - - * elf/dl-sysdep.c (auxvars): Add AT_L1I_CACHESIZE, -diff --git a/signal/Makefile b/signal/Makefile -index aa63434f..d5a10d59 100644 ---- a/signal/Makefile -+++ b/signal/Makefile -@@ -47,6 +47,8 @@ routines := signal raise killpg \ - - tests := tst-signal tst-sigset tst-sigsimple tst-raise tst-sigset2 \ - tst-sigwait-eintr tst-sigaction \ -+ tst-minsigstksz-1 tst-minsigstksz-2 tst-minsigstksz-3 \ -+ tst-minsigstksz-3a tst-minsigstksz-4 \ - - include ../Rules - -diff --git a/signal/tst-minsigstksz-1.c b/signal/tst-minsigstksz-1.c -new file mode 100644 -index 00000000..00344d5f ---- /dev/null -+++ b/signal/tst-minsigstksz-1.c -@@ -0,0 +1,131 @@ -+/* Tests of signal delivery on an alternate stack (nonlethal). -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+/* C2011 7.4.1.1p5 specifies that only the following operations are -+ guaranteed to be well-defined inside an asynchronous signal handler: -+ * any operation on a lock-free atomic object -+ * assigning a value to an object declared as volatile sig_atomic_t -+ * calling abort, _Exit, quick_exit, or signal -+ * signal may only be called with its first argument equal to the -+ number of the signal that caused the handler to be called -+ -+ We use this list as a guideline for the set of operations that ought -+ also to be safe in a _synchronous_ signal delivered on an alternate -+ signal stack with only MINSIGSTKSZ bytes of space. -+ -+ This test program tests all of the above operations that do not, -+ one way or another, cause the program to be terminated. */ -+ -+/* We do not try to test atomic operations exhaustively, only a simple -+ atomic counter increment. This is only safe if atomic_[u]int is -+ unconditionally lock-free. */ -+#ifdef __STDC_NO_ATOMICS__ -+# define TEST_ATOMIC_OPS 0 -+#else -+# include -+# if ATOMIC_INT_LOCK_FREE != 2 -+# define TEST_ATOMIC_OPS 0 -+# else -+# define TEST_ATOMIC_OPS 1 -+# endif -+#endif -+ -+static volatile sig_atomic_t signal_flag = 0; -+static volatile sig_atomic_t signal_err = 0; -+static void -+handler_set_flag (int unused) -+{ -+ signal_flag = 1; -+} -+ -+static void -+handler_set_flag_once (int sig) -+{ -+ signal_flag = 1; -+ if (signal (sig, SIG_IGN) == SIG_ERR) -+ /* It is not safe to call FAIL_EXIT1 here. Set another flag instead. */ -+ signal_err = 1; -+} -+ -+#if TEST_ATOMIC_OPS -+static atomic_uint signal_count = 0; -+static void -+handler_count_up_1 (int unused) -+{ -+ atomic_fetch_add (&signal_count, 1); -+} -+#endif -+ -+int -+do_test (void) -+{ -+ void *sstk = xalloc_sigstack (0); -+ struct sigaction sa; -+ -+ /* Test 1: setting a volatile sig_atomic_t flag. */ -+ sa.sa_handler = handler_set_flag; -+ sa.sa_flags = SA_RESTART | SA_ONSTACK; -+ sigfillset (&sa.sa_mask); -+ if (sigaction (SIGUSR1, &sa, 0)) -+ FAIL_EXIT1 ("sigaction (SIGUSR1, handler_set_flag): %m\n"); -+ -+ TEST_VERIFY_EXIT (signal_flag == 0); -+ raise (SIGUSR1); -+ TEST_VERIFY_EXIT (signal_flag == 1); -+ signal_flag = 0; -+ raise (SIGUSR1); -+ TEST_VERIFY_EXIT (signal_flag == 1); -+ signal_flag = 0; -+ -+ /* Test 1: setting a volatile sig_atomic_t flag and then ignoring -+ further delivery of the signal. */ -+ sa.sa_handler = handler_set_flag_once; -+ if (sigaction (SIGUSR1, &sa, 0)) -+ FAIL_EXIT1 ("sigaction (SIGUSR1, handler_set_flag_once): %m\n"); -+ -+ raise (SIGUSR1); -+ TEST_VERIFY_EXIT (signal_flag == 1); -+ /* Note: if signal_err is 1, a system call failed, but we can't -+ report the error code because errno is indeterminate. */ -+ TEST_VERIFY_EXIT (signal_err == 0); -+ -+ signal_flag = 0; -+ raise (SIGUSR1); -+ TEST_VERIFY_EXIT (signal_flag == 0); -+ TEST_VERIFY_EXIT (signal_err == 0); -+ -+#if TEST_ATOMIC_OPS -+ sa.sa_handler = handler_count_up_1; -+ if (sigaction (SIGUSR1, &sa, 0)) -+ FAIL_EXIT1 ("sigaction (SIGUSR1, handler_count_up_1): %m\n"); -+ -+ raise (SIGUSR1); -+ TEST_VERIFY_EXIT (atomic_load (&signal_count) == 1); -+ raise (SIGUSR1); -+ TEST_VERIFY_EXIT (atomic_load (&signal_count) == 2); -+#endif -+ -+ xfree_sigstack (sstk); -+ return 0; -+} -+ -+#include -diff --git a/signal/tst-minsigstksz-2.c b/signal/tst-minsigstksz-2.c -new file mode 100644 -index 00000000..3368dde6 ---- /dev/null -+++ b/signal/tst-minsigstksz-2.c -@@ -0,0 +1,66 @@ -+/* Tests of signal delivery on an alternate stack (abort). -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+/* C2011 7.4.1.1p5 specifies that only the following operations are -+ guaranteed to be well-defined inside an asynchronous signal handler: -+ * any operation on a lock-free atomic object -+ * assigning a value to an object declared as volatile sig_atomic_t -+ * calling abort, _Exit, quick_exit, or signal -+ * signal may only be called with its first argument equal to the -+ number of the signal that caused the handler to be called -+ -+ We use this list as a guideline for the set of operations that ought -+ also to be safe in a _synchronous_ signal delivered on an alternate -+ signal stack with only MINSIGSTKSZ bytes of space. -+ -+ This test program tests calls to abort. Note that it does _not_ -+ install a handler for SIGABRT, because that signal would also be -+ delivered on the alternate stack and MINSIGSTKSZ does not provide -+ enough space for delivery of nested signals. */ -+ -+static void -+handler (int unused) -+{ -+ abort (); -+} -+ -+int -+do_test (void) -+{ -+ void *sstk = xalloc_sigstack (0); -+ struct sigaction sa; -+ -+ sa.sa_handler = handler; -+ sa.sa_flags = SA_RESTART | SA_ONSTACK; -+ sigfillset (&sa.sa_mask); -+ if (sigaction (SIGUSR1, &sa, 0)) -+ FAIL_RET ("sigaction (SIGUSR1, handler): %m\n"); -+ -+ raise (SIGUSR1); -+ -+ xfree_sigstack (sstk); -+ FAIL_RET ("test process was not terminated by abort in signal handler"); -+} -+ -+#define EXPECTED_SIGNAL SIGABRT -+#include -diff --git a/signal/tst-minsigstksz-3.c b/signal/tst-minsigstksz-3.c -new file mode 100644 -index 00000000..a8d9a636 ---- /dev/null -+++ b/signal/tst-minsigstksz-3.c -@@ -0,0 +1,64 @@ -+/* Tests of signal delivery on an alternate stack (_Exit). -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+/* C2011 7.4.1.1p5 specifies that only the following operations are -+ guaranteed to be well-defined inside an asynchronous signal handler: -+ * any operation on a lock-free atomic object -+ * assigning a value to an object declared as volatile sig_atomic_t -+ * calling abort, _Exit, quick_exit, or signal -+ * signal may only be called with its first argument equal to the -+ number of the signal that caused the handler to be called -+ -+ We use this list as a guideline for the set of operations that ought -+ also to be safe in a _synchronous_ signal delivered on an alternate -+ signal stack with only MINSIGSTKSZ bytes of space. -+ -+ This test program tests calls to _Exit. */ -+ -+#define EXPECTED_STATUS 3 -+ -+static void -+handler (int unused) -+{ -+ _Exit (EXPECTED_STATUS); -+} -+ -+int -+do_test (void) -+{ -+ void *sstk = xalloc_sigstack (0); -+ struct sigaction sa; -+ -+ sa.sa_handler = handler; -+ sa.sa_flags = SA_RESTART | SA_ONSTACK; -+ sigfillset (&sa.sa_mask); -+ if (sigaction (SIGUSR1, &sa, 0)) -+ FAIL_RET ("sigaction (SIGUSR1, handler): %m\n"); -+ -+ raise (SIGUSR1); -+ -+ xfree_sigstack (sstk); -+ FAIL_RET ("test process was not terminated by _Exit in signal handler"); -+} -+ -+#include -diff --git a/signal/tst-minsigstksz-3a.c b/signal/tst-minsigstksz-3a.c -new file mode 100644 -index 00000000..b58b8d01 ---- /dev/null -+++ b/signal/tst-minsigstksz-3a.c -@@ -0,0 +1,69 @@ -+/* Tests of signal delivery on an alternate stack (_exit). -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+/* C2011 7.4.1.1p5 specifies that only the following operations are -+ guaranteed to be well-defined inside an asynchronous signal handler: -+ * any operation on a lock-free atomic object -+ * assigning a value to an object declared as volatile sig_atomic_t -+ * calling abort, _Exit, quick_exit, or signal -+ * signal may only be called with its first argument equal to the -+ number of the signal that caused the handler to be called -+ -+ We use this list as a guideline for the set of operations that ought -+ also to be safe in a _synchronous_ signal delivered on an alternate -+ signal stack with only MINSIGSTKSZ bytes of space. -+ -+ This test program tests calls to _exit, which is the same function -+ as _Exit, but specified by POSIX rather than ISO C. For reasons -+ unknown to the author of this program, the C committee did not -+ think it could standardize _exit under that name; regardless, in a -+ POSIX-conformant environment, they should be completely -+ interchangeable. */ -+ -+#define EXPECTED_STATUS 3 -+ -+static void -+handler (int unused) -+{ -+ _exit (EXPECTED_STATUS); -+} -+ -+int -+do_test (void) -+{ -+ void *sstk = xalloc_sigstack (0); -+ struct sigaction sa; -+ -+ sa.sa_handler = handler; -+ sa.sa_flags = SA_RESTART | SA_ONSTACK; -+ sigfillset (&sa.sa_mask); -+ if (sigaction (SIGUSR1, &sa, 0)) -+ FAIL_RET ("sigaction (SIGUSR1, handler): %m\n"); -+ -+ raise (SIGUSR1); -+ -+ xfree_sigstack (sstk); -+ FAIL_RET ("test process was not terminated by _exit in signal handler"); -+} -+ -+#include -diff --git a/signal/tst-minsigstksz-4.c b/signal/tst-minsigstksz-4.c -new file mode 100644 -index 00000000..0dc63b4d ---- /dev/null -+++ b/signal/tst-minsigstksz-4.c -@@ -0,0 +1,65 @@ -+/* Tests of signal delivery on an alternate stack (quick_exit). -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+/* C2011 7.4.1.1p5 specifies that only the following operations are -+ guaranteed to be well-defined inside an asynchronous signal handler: -+ * any operation on a lock-free atomic object -+ * assigning a value to an object declared as volatile sig_atomic_t -+ * calling abort, _Exit, quick_exit, or signal -+ * signal may only be called with its first argument equal to the -+ number of the signal that caused the handler to be called -+ -+ We use this list as a guideline for the set of operations that ought -+ also to be safe in a _synchronous_ signal delivered on an alternate -+ signal stack with only MINSIGSTKSZ bytes of space. -+ -+ This test program tests calls to quick_exit. Note that this is only -+ safe when there are no at_quick_exit callbacks. */ -+ -+#define EXPECTED_STATUS 3 -+ -+static void -+handler (int unused) -+{ -+ quick_exit (EXPECTED_STATUS); -+} -+ -+int -+do_test (void) -+{ -+ void *sstk = xalloc_sigstack (0); -+ struct sigaction sa; -+ -+ sa.sa_handler = handler; -+ sa.sa_flags = SA_RESTART | SA_ONSTACK; -+ sigfillset (&sa.sa_mask); -+ if (sigaction (SIGUSR1, &sa, 0)) -+ FAIL_RET ("sigaction (SIGUSR1, handler): %m\n"); -+ -+ raise (SIGUSR1); -+ -+ xfree_sigstack (sstk); -+ FAIL_RET ("test process was not terminated by quick_exit in signal handler"); -+} -+ -+#include -diff --git a/support/Makefile b/support/Makefile -index dcf3c4ba..619b6d44 100644 ---- a/support/Makefile -+++ b/support/Makefile -@@ -157,6 +157,7 @@ libsupport-routines = \ - xsetsockopt \ - xsigaction \ - xsignal \ -+ xsigstack \ - xsocket \ - xposix_spawn \ - xposix_spawn_file_actions_addclose \ -@@ -231,6 +232,7 @@ tests = \ - tst-test_compare_blob \ - tst-test_compare_string \ - tst-xreadlink \ -+ tst-xsigstack \ - - ifeq ($(run-built-tests),yes) - tests-special = \ -diff --git a/support/tst-xsigstack.c b/support/tst-xsigstack.c -new file mode 100644 -index 00000000..42859c79 ---- /dev/null -+++ b/support/tst-xsigstack.c -@@ -0,0 +1,64 @@ -+/* Test of sigaltstack wrappers. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+static volatile uintptr_t handler_stackaddr; -+ -+static void -+handler (int unused) -+{ -+ int var; -+ handler_stackaddr = (uintptr_t) &var; -+} -+ -+int -+do_test (void) -+{ -+ void *sstk = xalloc_sigstack (0); -+ -+ unsigned char *sp; -+ size_t size; -+ xget_sigstack_location (sstk, &sp, &size); -+ printf ("signal stack installed: sp=%p size=%zu\n", sp, size); -+ -+ struct sigaction sa; -+ sa.sa_handler = handler; -+ sa.sa_flags = SA_RESTART | SA_ONSTACK; -+ sigfillset (&sa.sa_mask); -+ if (sigaction (SIGUSR1, &sa, 0)) -+ FAIL_RET ("sigaction (SIGUSR1, handler): %m\n"); -+ -+ raise (SIGUSR1); -+ -+ uintptr_t haddr = handler_stackaddr; -+ printf ("address of handler local variable: %p\n", (void *)haddr); -+ TEST_VERIFY ((uintptr_t)sp < haddr); -+ TEST_VERIFY (haddr < (uintptr_t)sp + size); -+ -+ xfree_sigstack (sstk); -+ return 0; -+} -+ -+#include -diff --git a/support/xsignal.h b/support/xsignal.h -index 9ab8d1bf..9d68558f 100644 ---- a/support/xsignal.h -+++ b/support/xsignal.h -@@ -37,6 +37,23 @@ void xsigaction (int sig, const struct sigaction *newact, - - void xpthread_sigmask (int how, const sigset_t *set, sigset_t *oldset); - -+/* Allocate and activate an alternate signal stack. This stack will -+ have SIZE + MINSIGSTKSZ bytes of space, rounded up to a whole -+ number of pages. There will be large (at least 1 MiB) inaccessible -+ guard bands on either side of it. The return value is a cookie -+ that can be passed to xfree_sigstack to deactivate and deallocate -+ the stack again. It is not necessary to call sigaltstack after -+ calling this function. Terminates the process on error. */ -+void *xalloc_sigstack (size_t size); -+ -+/* Deactivate and deallocate a signal stack created by xalloc_sigstack. */ -+void xfree_sigstack (void *stack); -+ -+/* Extract the actual address and size of the alternate signal stack from -+ the cookie returned by xalloc_sigstack. */ -+void xget_sigstack_location (const void *stack, unsigned char **addrp, -+ size_t *sizep); -+ - __END_DECLS - - #endif /* SUPPORT_SIGNAL_H */ -diff --git a/support/xsigstack.c b/support/xsigstack.c -new file mode 100644 -index 00000000..cebfa19a ---- /dev/null -+++ b/support/xsigstack.c -@@ -0,0 +1,107 @@ -+/* sigaltstack wrappers. -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include /* roundup, MAX */ -+ -+/* The "cookie" returned by xalloc_sigstack points to one of these -+ structures. */ -+struct sigstack_desc -+{ -+ void *alloc_base; /* Base address of the complete allocation. */ -+ size_t alloc_size; /* Size of the complete allocation. */ -+ stack_t alt_stack; /* The address and size of the stack itself. */ -+ stack_t old_stack; /* The previous signal stack. */ -+}; -+ -+void * -+xalloc_sigstack (size_t size) -+{ -+ size_t pagesize = sysconf (_SC_PAGESIZE); -+ if (pagesize == -1) -+ FAIL_EXIT1 ("sysconf (_SC_PAGESIZE): %m\n"); -+ -+ /* Always supply at least MINSIGSTKSZ space; passing 0 as size means -+ only that much space. No matter what the number is, round it up -+ to a whole number of pages. */ -+ size_t stacksize = roundup (size + MINSIGSTKSZ, pagesize); -+ -+ /* The guard bands need to be large enough to intercept offset -+ accesses from a stack address that might otherwise hit another -+ mapping. Make them at least twice as big as the stack itself, to -+ defend against an offset by the entire size of a large -+ stack-allocated array. The minimum is 1MiB, which is arbitrarily -+ chosen to be larger than any "typical" wild pointer offset. -+ Again, no matter what the number is, round it up to a whole -+ number of pages. */ -+ size_t guardsize = roundup (MAX (2 * stacksize, 1024 * 1024), pagesize); -+ -+ struct sigstack_desc *desc = xmalloc (sizeof (struct sigstack_desc)); -+ desc->alloc_size = guardsize + stacksize + guardsize; -+ /* Use MAP_NORESERVE so that RAM will not be wasted on the guard -+ bands; touch all the pages of the actual stack before returning, -+ so we know they are allocated. */ -+ desc->alloc_base = xmmap (0, -+ desc->alloc_size, -+ PROT_READ|PROT_WRITE, -+ MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE|MAP_STACK, -+ -1); -+ -+ xmprotect (desc->alloc_base, guardsize, PROT_NONE); -+ xmprotect (desc->alloc_base + guardsize + stacksize, guardsize, PROT_NONE); -+ memset (desc->alloc_base + guardsize, 0xA5, stacksize); -+ -+ desc->alt_stack.ss_sp = desc->alloc_base + guardsize; -+ desc->alt_stack.ss_flags = 0; -+ desc->alt_stack.ss_size = stacksize; -+ -+ if (sigaltstack (&desc->alt_stack, &desc->old_stack)) -+ FAIL_EXIT1 ("sigaltstack (new stack: sp=%p, size=%zu, flags=%u): %m\n", -+ desc->alt_stack.ss_sp, desc->alt_stack.ss_size, -+ desc->alt_stack.ss_flags); -+ -+ return desc; -+} -+ -+void -+xfree_sigstack (void *stack) -+{ -+ struct sigstack_desc *desc = stack; -+ -+ if (sigaltstack (&desc->old_stack, 0)) -+ FAIL_EXIT1 ("sigaltstack (restore old stack: sp=%p, size=%zu, flags=%u): " -+ "%m\n", desc->old_stack.ss_sp, desc->old_stack.ss_size, -+ desc->old_stack.ss_flags); -+ xmunmap (desc->alloc_base, desc->alloc_size); -+ free (desc); -+} -+ -+void -+xget_sigstack_location (const void *stack, unsigned char **addrp, size_t *sizep) -+{ -+ const struct sigstack_desc *desc = stack; -+ *addrp = desc->alt_stack.ss_sp; -+ *sizep = desc->alt_stack.ss_size; -+} --- -2.27.0 - diff --git a/SOURCES/0003-only-avoid-short-distance-rep-mobsb-on-icx.patch b/SOURCES/0003-only-avoid-short-distance-rep-mobsb-on-icx.patch new file mode 100644 index 0000000..1828e74 --- /dev/null +++ b/SOURCES/0003-only-avoid-short-distance-rep-mobsb-on-icx.patch @@ -0,0 +1,111 @@ +From 0058b10814afd8f1ea031b11f3c4ac226fa60d79 Mon Sep 17 00:00:00 2001 +From: Wangyang Guo +Date: Mon, 24 Jan 2022 02:59:56 +0000 +Subject: [PATCH] Only avoid short distance REP MOVSB on ICX + +--- + sysdeps/x86/cacheinfo.h | 9 +++++++++ + sysdeps/x86/cpu-features.c | 5 +++++ + .../include/cpu-features-preferred_feature_index_1.def | 1 + + sysdeps/x86/sysdep.h | 3 +++ + sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S | 5 +++++ + 5 files changed, 23 insertions(+) + +diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h +index 02556961..7af8575d 100644 +--- a/sysdeps/x86/cacheinfo.h ++++ b/sysdeps/x86/cacheinfo.h +@@ -45,6 +45,11 @@ long int __x86_rep_movsb_threshold attribute_hidden = 2048; + /* Threshold to use Enhanced REP STOSB. */ + long int __x86_rep_stosb_threshold attribute_hidden = 2048; + ++/* Non-zero to avoid short distance REP MOVSB. */ ++//int __x86_avoid_short_distance_rep_movsb attribute_hidden; ++/* String/memory function control. */ ++int __x86_string_control attribute_hidden; ++ + static void + get_common_cache_info (long int *shared_ptr, unsigned int *threads_ptr, + long int core) +@@ -421,6 +426,10 @@ init_cacheinfo (void) + else + __x86_rep_movsb_threshold = rep_movsb_threshold; + ++ if (CPU_FEATURES_ARCH_P (cpu_features, Avoid_Short_Distance_REP_MOVSB)) ++ __x86_string_control ++ |= X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB; ++ + # if HAVE_TUNABLES + __x86_rep_stosb_threshold = cpu_features->rep_stosb_threshold; + # endif +diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c +index 91042505..22b45c72 100644 +--- a/sysdeps/x86/cpu-features.c ++++ b/sysdeps/x86/cpu-features.c +@@ -526,6 +526,11 @@ init_cpu_features (struct cpu_features *cpu_features) + else + cpu_features->preferred[index_arch_Prefer_No_AVX512] + |= bit_arch_Prefer_No_AVX512; ++ ++ /* Avoid avoid short distance REP MOVSB on processor with FSRM. */ ++ if (CPU_FEATURES_CPU_P (cpu_features, FSRM)) ++ cpu_features->preferred[index_arch_Avoid_Short_Distance_REP_MOVSB] ++ |= bit_arch_Avoid_Short_Distance_REP_MOVSB; + } + /* This spells out "AuthenticAMD". */ + else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65) +diff --git a/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def b/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def +index 17a5cc42..e7277b33 100644 +--- a/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def ++++ b/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def +@@ -32,3 +32,4 @@ BIT (Prefer_ERMS) + BIT (Prefer_FSRM) + BIT (Prefer_No_AVX512) + BIT (MathVec_Prefer_No_AVX512) ++BIT (Avoid_Short_Distance_REP_MOVSB) +diff --git a/sysdeps/x86/sysdep.h b/sysdeps/x86/sysdep.h +index f41f4ebd..4ac93a95 100644 +--- a/sysdeps/x86/sysdep.h ++++ b/sysdeps/x86/sysdep.h +@@ -57,6 +57,9 @@ enum cf_protection_level + #define STATE_SAVE_MASK \ + ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7)) + ++/* Avoid short distance REP MOVSB. */ ++#define X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB (1 << 0) ++ + #ifdef __ASSEMBLER__ + + /* Syntactic details of assembler. */ +diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S +index 07299dc0..4aa65555 100644 +--- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S ++++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S +@@ -244,12 +244,16 @@ L(movsb): + /* Avoid slow backward REP MOVSB. */ + jb L(more_8x_vec_backward) + # if AVOID_SHORT_DISTANCE_REP_MOVSB ++ andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip) ++ jz 3f + movq %rdi, %rcx + subq %rsi, %rcx + jmp 2f + # endif + 1: + # if AVOID_SHORT_DISTANCE_REP_MOVSB ++ andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip) ++ jz 3f + movq %rsi, %rcx + subq %rdi, %rcx + 2: +@@ -257,6 +261,7 @@ L(movsb): + is N*4GB + [1..63] with N >= 0. */ + cmpl $63, %ecx + jbe L(more_2x_vec) /* Avoid "rep movsb" if ECX <= 63. */ ++3: + # endif + movq %rdx, %rcx + rep movsb +-- +2.27.0 + diff --git a/SOURCES/0004-Disable-lazy-binding-on-tests-for-minimal-signal-han.patch b/SOURCES/0004-Disable-lazy-binding-on-tests-for-minimal-signal-han.patch deleted file mode 100644 index cfed863..0000000 --- a/SOURCES/0004-Disable-lazy-binding-on-tests-for-minimal-signal-han.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 373f9cff2872cf76b9aee6b4fe7719e04dda122f Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Fri, 18 Jan 2019 08:56:51 -0800 -Subject: [PATCH 4/5] Disable lazy binding on tests for minimal signal handler - -Since MINSIGSTKSZ may not have sufficent stack space to allow lazy -binding, build tests for minimal signal handler with -Wl,-z,now to -disable lazy binding. - - * signal/Makefile (LDFLAGS-tst-minsigstksz-1): New. Set to - -Wl,-z,now. - (LDFLAGS-tst-minsigstksz-2): Likewise. - (LDFLAGS-tst-minsigstksz-3): Likewise. - (LDFLAGS-tst-minsigstksz-3a): Likewise. - (LDFLAGS-tst-minsigstksz-4): Likewise. - -Reviewed-by: Carlos O'Donell - -UPDATE: - -Backported to glibc 2.28 - -Signed-off-by: Jair Gonzalez ---- - ChangeLog | 9 +++++++++ - signal/Makefile | 8 ++++++++ - 2 files changed, 17 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 9e33b6cb..ccd5ff21 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,12 @@ -+2019-01-18 H.J. Lu -+ -+ * signal/Makefile (LDFLAGS-tst-minsigstksz-1): New. Set to -+ -Wl,-z,now. -+ (LDFLAGS-tst-minsigstksz-2): Likewise. -+ (LDFLAGS-tst-minsigstksz-3): Likewise. -+ (LDFLAGS-tst-minsigstksz-3a): Likewise. -+ (LDFLAGS-tst-minsigstksz-4): Likewise. -+ - 2019-01-16 Zack Weinberg - - * support/xsignal.h (xalloc_sigstack, xfree_sigstack) -diff --git a/signal/Makefile b/signal/Makefile -index d5a10d59..7767bb28 100644 ---- a/signal/Makefile -+++ b/signal/Makefile -@@ -59,3 +59,11 @@ CFLAGS-sigwait.c += -fexceptions -fasynchronous-unwind-tables - CFLAGS-sigwaitinfo.c += -fexceptions -fasynchronous-unwind-tables - - CFLAGS-sigreturn.c += $(no-stack-protector) -+ -+# We don't want to test the lazy resolution stack usage, just the -+# execution of the handler and the functions. -+LDFLAGS-tst-minsigstksz-1 = -Wl,-z,now -+LDFLAGS-tst-minsigstksz-2 = -Wl,-z,now -+LDFLAGS-tst-minsigstksz-3 = -Wl,-z,now -+LDFLAGS-tst-minsigstksz-3a = -Wl,-z,now -+LDFLAGS-tst-minsigstksz-4 = -Wl,-z,now --- -2.27.0 - diff --git a/SOURCES/0005-sysconf-Add-_SC_MINSIGSTKSZ-_SC_SIGSTKSZ-BZ-20305.patch b/SOURCES/0005-sysconf-Add-_SC_MINSIGSTKSZ-_SC_SIGSTKSZ-BZ-20305.patch deleted file mode 100644 index 0127da4..0000000 --- a/SOURCES/0005-sysconf-Add-_SC_MINSIGSTKSZ-_SC_SIGSTKSZ-BZ-20305.patch +++ /dev/null @@ -1,774 +0,0 @@ -From 232e45c1720857fbf1948c4aeba39a3c8cc52335 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Mon, 1 Feb 2021 11:00:38 -0800 -Subject: [PATCH 5/5] sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] - -Add _SC_MINSIGSTKSZ for the minimum signal stack size derived from -AT_MINSIGSTKSZ, which is the minimum number of bytes of free stack -space required in order to gurantee successful, non-nested handling -of a single signal whose handler is an empty function, and _SC_SIGSTKSZ -which is the suggested minimum number of bytes of stack space required -for a signal stack. - -If AT_MINSIGSTKSZ isn't available, sysconf (_SC_MINSIGSTKSZ) returns -MINSIGSTKSZ. On Linux/x86 with XSAVE, the signal frame used by kernel -is composed of the following areas and laid out as: - - ------------------------------ - | alignment padding | - ------------------------------ - | xsave buffer | - ------------------------------ - | fsave header (32-bit only) | - ------------------------------ - | siginfo + ucontext | - ------------------------------ - -Compute AT_MINSIGSTKSZ value as size of xsave buffer + size of fsave -header (32-bit only) + size of siginfo and ucontext + alignment padding. - -If _SC_SIGSTKSZ_SOURCE or _GNU_SOURCE are defined, MINSIGSTKSZ and SIGSTKSZ -are redefined as - -/* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ). */ - # undef SIGSTKSZ - # define SIGSTKSZ sysconf (_SC_SIGSTKSZ) - -/* Minimum stack size for a signal handler: SIGSTKSZ. */ - # undef MINSIGSTKSZ - # define MINSIGSTKSZ SIGSTKSZ - -Compilation will fail if the source assumes constant MINSIGSTKSZ or -SIGSTKSZ. - -The reason for not simply increasing the kernel's MINSIGSTKSZ #define -(apart from the fact that it is rarely used, due to glibc's shadowing -definitions) was that userspace binaries will have baked in the old -value of the constant and may be making assumptions about it. - -For example, the type (char [MINSIGSTKSZ]) changes if this #define -changes. This could be a problem if an newly built library tries to -memcpy() or dump such an object defined by and old binary. -Bounds-checking and the stack sizes passed to things like sigaltstack() -and makecontext() could similarly go wrong. - -UPDATE: - -Backported to glibc 2.28 - -Signed-off-by: Jair Gonzalez ---- - NEWS | 5 ++ - bits/confname.h | 8 +- - bits/sigstksz.h | 21 +++++ - elf/dl-support.c | 5 ++ - elf/dl-sysdep.c | 9 ++ - include/bits/sigstack.h | 5 ++ - include/bits/sigstksz.h | 7 ++ - include/features.h | 11 +++ - manual/conf.texi | 21 +++++ - manual/creature.texi | 6 ++ - posix/sysconf.c | 3 + - signal/Makefile | 5 +- - signal/signal.h | 1 + - signal/tst-minsigstksz-5.c | 84 +++++++++++++++++++ - sysdeps/generic/ldsodefs.h | 3 + - sysdeps/unix/sysv/linux/bits/sigstksz.h | 33 ++++++++ - .../unix/sysv/linux/ia64/sysconf-sigstksz.h | 27 ++++++ - sysdeps/unix/sysv/linux/sysconf-sigstksz.h | 38 +++++++++ - sysdeps/unix/sysv/linux/sysconf.c | 9 ++ - .../unix/sysv/linux/x86/dl-minsigstacksize.h | 83 ++++++++++++++++++ - .../sysv/linux/x86/include/bits/sigstack.h | 5 ++ - sysdeps/x86/dl-minsigstacksize.h | 27 ++++++ - 22 files changed, 413 insertions(+), 3 deletions(-) - create mode 100644 bits/sigstksz.h - create mode 100644 include/bits/sigstack.h - create mode 100644 include/bits/sigstksz.h - create mode 100644 signal/tst-minsigstksz-5.c - create mode 100644 sysdeps/unix/sysv/linux/bits/sigstksz.h - create mode 100644 sysdeps/unix/sysv/linux/ia64/sysconf-sigstksz.h - create mode 100644 sysdeps/unix/sysv/linux/sysconf-sigstksz.h - create mode 100644 sysdeps/unix/sysv/linux/x86/dl-minsigstacksize.h - create mode 100644 sysdeps/unix/sysv/linux/x86/include/bits/sigstack.h - create mode 100644 sysdeps/x86/dl-minsigstacksize.h - -diff --git a/NEWS b/NEWS -index 154ab22d..e0e95cb8 100644 ---- a/NEWS -+++ b/NEWS -@@ -9,6 +9,11 @@ Version 2.28 - - Major new features: - -+* Add _SC_MINSIGSTKSZ and _SC_SIGSTKSZ. When _SC_SIGSTKSZ_SOURCE or -+ _GNU_SOURCE are defined, MINSIGSTKSZ and SIGSTKSZ are no longer -+ constant on Linux. MINSIGSTKSZ is redefined to sysconf(_SC_MINSIGSTKSZ) -+ and SIGSTKSZ is redefined to sysconf (_SC_SIGSTKSZ). -+ - * The localization data for ISO 14651 is updated to match the 2016 - Edition 4 release of the standard, this matches data provided by - Unicode 9.0.0. This update introduces significant improvements to the -diff --git a/bits/confname.h b/bits/confname.h -index 59d31721..36279222 100644 ---- a/bits/confname.h -+++ b/bits/confname.h -@@ -525,8 +525,14 @@ enum - - _SC_THREAD_ROBUST_PRIO_INHERIT, - #define _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_INHERIT -- _SC_THREAD_ROBUST_PRIO_PROTECT -+ _SC_THREAD_ROBUST_PRIO_PROTECT, - #define _SC_THREAD_ROBUST_PRIO_PROTECT _SC_THREAD_ROBUST_PRIO_PROTECT -+ -+ _SC_MINSIGSTKSZ, -+#define _SC_MINSIGSTKSZ _SC_MINSIGSTKSZ -+ -+ _SC_SIGSTKSZ -+#define _SC_SIGSTKSZ _SC_SIGSTKSZ - }; - - /* Values for the NAME argument to `confstr'. */ -diff --git a/bits/sigstksz.h b/bits/sigstksz.h -new file mode 100644 -index 00000000..5535d873 ---- /dev/null -+++ b/bits/sigstksz.h -@@ -0,0 +1,21 @@ -+/* Definition of MINSIGSTKSZ. Generic version. -+ Copyright (C) 2020 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef _SIGNAL_H -+# error "Never include directly; use instead." -+#endif -diff --git a/elf/dl-support.c b/elf/dl-support.c -index 34be8e5b..056945d7 100644 ---- a/elf/dl-support.c -+++ b/elf/dl-support.c -@@ -131,6 +131,8 @@ void (*_dl_init_static_tls) (struct link_map *) = &_dl_nothread_init_static_tls; - - size_t _dl_pagesize = EXEC_PAGESIZE; - -+size_t _dl_minsigstacksize = CONSTANT_MINSIGSTKSZ; -+ - int _dl_inhibit_cache; - - unsigned int _dl_osversion; -@@ -287,6 +289,9 @@ _dl_aux_init (ElfW(auxv_t) *av) - case AT_RANDOM: - _dl_random = (void *) av->a_un.a_val; - break; -+ case AT_MINSIGSTKSZ: -+ _dl_minsigstacksize = av->a_un.a_val; -+ break; - # ifdef DL_PLATFORM_AUXV - DL_PLATFORM_AUXV - # endif -diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c -index 93983251..4bcd75b4 100644 ---- a/elf/dl-sysdep.c -+++ b/elf/dl-sysdep.c -@@ -116,6 +116,11 @@ _dl_sysdep_start (void **start_argptr, - user_entry = (ElfW(Addr)) ENTRY_POINT; - GLRO(dl_platform) = NULL; /* Default to nothing known about the platform. */ - -+ /* NB: Default to a constant CONSTANT_MINSIGSTKSZ. */ -+ _Static_assert (__builtin_constant_p (CONSTANT_MINSIGSTKSZ), -+ "CONSTANT_MINSIGSTKSZ is constant"); -+ GLRO(dl_minsigstacksize) = CONSTANT_MINSIGSTKSZ; -+ - for (av = GLRO(dl_auxv); av->a_type != AT_NULL; set_seen (av++)) - switch (av->a_type) - { -@@ -180,6 +185,9 @@ _dl_sysdep_start (void **start_argptr, - case AT_RANDOM: - _dl_random = (void *) av->a_un.a_val; - break; -+ case AT_MINSIGSTKSZ: -+ GLRO(dl_minsigstacksize) = av->a_un.a_val; -+ break; - #ifdef DL_PLATFORM_AUXV - DL_PLATFORM_AUXV - #endif -@@ -317,6 +325,7 @@ _dl_show_auxv (void) - [AT_L2_CACHEGEOMETRY - 2] = { "L2_CACHEGEOMETRY: 0x", hex }, - [AT_L3_CACHESIZE - 2] = { "L3_CACHESIZE: ", dec }, - [AT_L3_CACHEGEOMETRY - 2] = { "L3_CACHEGEOMETRY: 0x", hex }, -+ [AT_MINSIGSTKSZ - 2] = { "MINSIGSTKSZ ", dec }, - }; - unsigned int idx = (unsigned int) (av->a_type - 2); - -diff --git a/include/bits/sigstack.h b/include/bits/sigstack.h -new file mode 100644 -index 00000000..eea939f5 ---- /dev/null -+++ b/include/bits/sigstack.h -@@ -0,0 +1,5 @@ -+#include_next -+ -+#if !defined _ISOMAC && !defined CONSTANT_MINSIGSTKSZ -+# define CONSTANT_MINSIGSTKSZ MINSIGSTKSZ -+#endif -diff --git a/include/bits/sigstksz.h b/include/bits/sigstksz.h -new file mode 100644 -index 00000000..2ca891e9 ---- /dev/null -+++ b/include/bits/sigstksz.h -@@ -0,0 +1,7 @@ -+/* NB: Don't define MINSIGSTKSZ nor SIGSTKSZ to sysconf (SC_SIGSTKSZ) for -+ glibc build. IS_IN can only be used when _ISOMAC isn't defined. */ -+#ifdef _ISOMAC -+# include_next -+#elif IS_IN (libsupport) -+# include_next -+#endif -diff --git a/include/features.h b/include/features.h -index 5bed0a49..fdc3d11d 100644 ---- a/include/features.h -+++ b/include/features.h -@@ -47,6 +47,8 @@ - _LARGEFILE64_SOURCE Additional functionality from LFS for large files. - _FILE_OFFSET_BITS=N Select default filesystem interface. - _ATFILE_SOURCE Additional *at interfaces. -+ _SC_SIGSTKSZ_SOURCE Select correct (but non compile-time constant) -+ MINSIGSTKSZ and SIGSTKSZ. - _GNU_SOURCE All of the above, plus GNU extensions. - _DEFAULT_SOURCE The default set of features (taking precedence over - __STRICT_ANSI__). -@@ -93,6 +95,8 @@ - __USE_FILE_OFFSET64 Define 64bit interface as default. - __USE_MISC Define things from 4.3BSD or System V Unix. - __USE_ATFILE Define *at interfaces and AT_* constants for them. -+ __USE_SC_SIGSTKSZ Define correct (but non compile-time constant) -+ MINSIGSTKSZ and SIGSTKSZ. - __USE_GNU Define GNU extensions. - __USE_FORTIFY_LEVEL Additional security measures used, according to level. - -@@ -136,6 +140,7 @@ - #undef __USE_FILE_OFFSET64 - #undef __USE_MISC - #undef __USE_ATFILE -+#undef __USE_SC_SIGSTKSZ - #undef __USE_GNU - #undef __USE_FORTIFY_LEVEL - #undef __KERNEL_STRICT_NAMES -@@ -208,6 +213,8 @@ - # define _DEFAULT_SOURCE 1 - # undef _ATFILE_SOURCE - # define _ATFILE_SOURCE 1 -+# undef _SC_SIGSTKSZ_SOURCE -+# define _SC_SIGSTKSZ_SOURCE 1 - #endif - - /* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, -@@ -372,6 +379,10 @@ - # define __USE_ATFILE 1 - #endif - -+#ifdef _SC_SIGSTKSZ_SOURCE -+# define __USE_SC_SIGSTKSZ 1 -+#endif -+ - #ifdef _GNU_SOURCE - # define __USE_GNU 1 - #endif -diff --git a/manual/conf.texi b/manual/conf.texi -index dbd1d302..7321f401 100644 ---- a/manual/conf.texi -+++ b/manual/conf.texi -@@ -911,6 +911,27 @@ Inquire about the parameter corresponding to @code{NL_SETMAX}. - @item _SC_NL_TEXTMAX - @standards{X/Open, unistd.h} - Inquire about the parameter corresponding to @code{NL_TEXTMAX}. -+ -+@item _SC_MINSIGSTKSZ -+@standards{GNU, unistd.h} -+Inquire about the minimum number of bytes of free stack space required -+in order to guarantee successful, non-nested handling of a single signal -+whose handler is an empty function. -+ -+@item _SC_SIGSTKSZ -+@standards{GNU, unistd.h} -+Inquire about the suggested minimum number of bytes of stack space -+required for a signal stack. -+ -+This is not guaranteed to be enough for any specific purpose other than -+the invocation of a single, non-nested, empty handler, but nonetheless -+should be enough for basic scenarios involving simple signal handlers -+and very low levels of signal nesting (say, 2 or 3 levels at the very -+most). -+ -+This value is provided for developer convenience and to ease migration -+from the legacy @code{SIGSTKSZ} constant. Programs requiring stronger -+guarantees should avoid using it if at all possible. - @end vtable - - @node Examples of Sysconf ---- a/manual/creature.texi 2022-04-14 11:40:12.081653162 +0300 -+++ b/manual/creature.texi 2022-04-14 11:41:54.376167038 +0300 -@@ -251,6 +251,12 @@ - checks that may have an additional performance overhead. - @end defvr - -+@defvr Macro _SC_SIGSTKSZ_SOURCE -+@standards{GNU, (none)} -+If this macro is defined, correct (but non compile-time constant) -+MINSIGSTKSZ and SIGSTKSZ are defined. -+@end defvr -+ - @defvr Macro _REENTRANT - @defvrx Macro _THREAD_SAFE - @standards{Obsolete, (none)} -diff --git a/posix/sysconf.c b/posix/sysconf.c -index 09ebd95a..48c925f5 100644 ---- a/posix/sysconf.c -+++ b/posix/sysconf.c -@@ -266,6 +266,9 @@ __sysconf (int name) - case _SC_XOPEN_REALTIME: - case _SC_XOPEN_REALTIME_THREADS: - -+ case _SC_MINSIGSTKSZ: -+ case _SC_SIGSTKSZ: -+ - break; - } - -diff --git a/signal/Makefile b/signal/Makefile -index 7767bb28..cd85b8b6 100644 ---- a/signal/Makefile -+++ b/signal/Makefile -@@ -31,7 +31,8 @@ headers := signal.h sys/signal.h \ - bits/types/sigevent_t.h bits/types/siginfo_t.h \ - bits/types/sigset_t.h bits/types/sigval_t.h \ - bits/types/stack_t.h bits/types/struct_sigstack.h \ -- bits/types/__sigval_t.h -+ bits/types/__sigval_t.h \ -+ bits/sigstksz.h - - routines := signal raise killpg \ - sigaction sigprocmask kill \ -@@ -48,7 +49,7 @@ routines := signal raise killpg \ - tests := tst-signal tst-sigset tst-sigsimple tst-raise tst-sigset2 \ - tst-sigwait-eintr tst-sigaction \ - tst-minsigstksz-1 tst-minsigstksz-2 tst-minsigstksz-3 \ -- tst-minsigstksz-3a tst-minsigstksz-4 \ -+ tst-minsigstksz-3a tst-minsigstksz-4 tst-minsigstksz-5 - - include ../Rules - -diff --git a/signal/signal.h b/signal/signal.h -index 87dc82a9..8ebfc6e6 100644 ---- a/signal/signal.h -+++ b/signal/signal.h -@@ -314,6 +314,7 @@ extern int sigreturn (struct sigcontext *__scp) __THROW; - extern int siginterrupt (int __sig, int __interrupt) __THROW; - - # include -+# include - # include - - /* Alternate signal handler stack interface. -diff --git a/signal/tst-minsigstksz-5.c b/signal/tst-minsigstksz-5.c -new file mode 100644 -index 00000000..d657d2f4 ---- /dev/null -+++ b/signal/tst-minsigstksz-5.c -@@ -0,0 +1,84 @@ -+/* Test of signal delivery on an alternate stack with MINSIGSTKSZ size. -+ Copyright (C) 2020 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static volatile sig_atomic_t handler_run; -+ -+static void -+handler (int signo) -+{ -+ /* Clear a bit of on-stack memory. */ -+ volatile char buffer[256]; -+ for (size_t i = 0; i < sizeof (buffer); ++i) -+ buffer[i] = 0; -+ handler_run = 1; -+} -+ -+int -+do_test (void) -+{ -+ size_t stack_buffer_size = 64 * 1024 * 1024; -+ void *stack_buffer = xmalloc (stack_buffer_size); -+ void *stack_end = stack_buffer + stack_buffer_size; -+ memset (stack_buffer, 0xCC, stack_buffer_size); -+ -+ void *stack_bottom = stack_buffer + (stack_buffer_size + MINSIGSTKSZ) / 2; -+ void *stack_top = stack_bottom + MINSIGSTKSZ; -+ stack_t stack = -+ { -+ .ss_sp = stack_bottom, -+ .ss_size = MINSIGSTKSZ, -+ }; -+ if (sigaltstack (&stack, NULL) < 0) -+ FAIL_RET ("sigaltstack: %m\n"); -+ -+ struct sigaction act = -+ { -+ .sa_handler = handler, -+ .sa_flags = SA_ONSTACK, -+ }; -+ if (sigaction (SIGUSR1, &act, NULL) < 0) -+ FAIL_RET ("sigaction: %m\n"); -+ -+ if (kill (getpid (), SIGUSR1) < 0) -+ FAIL_RET ("kill: %m\n"); -+ -+ if (handler_run != 1) -+ FAIL_RET ("handler did not run\n"); -+ -+ for (void *p = stack_buffer; p < stack_bottom; ++p) -+ if (*(unsigned char *) p != 0xCC) -+ FAIL_RET ("changed byte %ld bytes below configured stack\n", -+ (long) (stack_bottom - p)); -+ for (void *p = stack_top; p < stack_end; ++p) -+ if (*(unsigned char *) p != 0xCC) -+ FAIL_RET ("changed byte %ld bytes above configured stack\n", -+ (long) (p - stack_top)); -+ -+ free (stack_buffer); -+ -+ return 0; -+} -+ -+#include -diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h -index 6cbbaa80..a15bf2e5 100644 ---- a/sysdeps/generic/ldsodefs.h -+++ b/sysdeps/generic/ldsodefs.h -@@ -527,6 +527,9 @@ struct rtld_global_ro - /* Cached value of `getpagesize ()'. */ - EXTERN size_t _dl_pagesize; - -+ /* Cached value of `sysconf (_SC_MINSIGSTKSZ)'. */ -+ EXTERN size_t _dl_minsigstacksize; -+ - /* Do we read from ld.so.cache? */ - EXTERN int _dl_inhibit_cache; - -diff --git a/sysdeps/unix/sysv/linux/bits/sigstksz.h b/sysdeps/unix/sysv/linux/bits/sigstksz.h -new file mode 100644 -index 00000000..926508f2 ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/bits/sigstksz.h -@@ -0,0 +1,33 @@ -+/* Definition of MINSIGSTKSZ and SIGSTKSZ. Linux version. -+ Copyright (C) 2020 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef _SIGNAL_H -+# error "Never include directly; use instead." -+#endif -+ -+#if defined __USE_SC_SIGSTKSZ && __USE_SC_SIGSTKSZ -+# include -+ -+/* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ). */ -+# undef SIGSTKSZ -+# define SIGSTKSZ sysconf (_SC_SIGSTKSZ) -+ -+/* Minimum stack size for a signal handler: SIGSTKSZ. */ -+# undef MINSIGSTKSZ -+# define MINSIGSTKSZ SIGSTKSZ -+#endif -diff --git a/sysdeps/unix/sysv/linux/ia64/sysconf-sigstksz.h b/sysdeps/unix/sysv/linux/ia64/sysconf-sigstksz.h -new file mode 100644 -index 00000000..7e5ceba1 ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/ia64/sysconf-sigstksz.h -@@ -0,0 +1,27 @@ -+/* sysconf_sigstksz (). Linux/ia64 version. -+ Copyright (C) 2020 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* Return sysconf (_SC_SIGSTKSZ). */ -+ -+static long int -+sysconf_sigstksz (void) -+{ -+ _Static_assert (__builtin_constant_p (SIGSTKSZ), -+ "SIGSTKSZ is constant"); -+ return SIGSTKSZ; -+} -diff --git a/sysdeps/unix/sysv/linux/sysconf-sigstksz.h b/sysdeps/unix/sysv/linux/sysconf-sigstksz.h -new file mode 100644 -index 00000000..64d450b2 ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/sysconf-sigstksz.h -@@ -0,0 +1,38 @@ -+/* sysconf_sigstksz (). Linux version. -+ Copyright (C) 2020 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* Return sysconf (_SC_SIGSTKSZ). */ -+ -+static long int -+sysconf_sigstksz (void) -+{ -+ long int minsigstacksize = GLRO(dl_minsigstacksize); -+ assert (minsigstacksize != 0); -+ _Static_assert (__builtin_constant_p (MINSIGSTKSZ), -+ "MINSIGSTKSZ is constant"); -+ if (minsigstacksize < MINSIGSTKSZ) -+ minsigstacksize = MINSIGSTKSZ; -+ /* MAX (MINSIGSTKSZ, sysconf (_SC_MINSIGSTKSZ)) * 4. */ -+ long int sigstacksize = minsigstacksize * 4; -+ /* Return MAX (SIGSTKSZ, sigstacksize). */ -+ _Static_assert (__builtin_constant_p (SIGSTKSZ), -+ "SIGSTKSZ is constant"); -+ if (sigstacksize < SIGSTKSZ) -+ sigstacksize = SIGSTKSZ; -+ return sigstacksize; -+} -diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c -index 6fab1601..4aa9b171 100644 ---- a/sysdeps/unix/sysv/linux/sysconf.c -+++ b/sysdeps/unix/sysv/linux/sysconf.c -@@ -16,6 +16,7 @@ - License along with the GNU C Library; if not, see - . */ - -+#include - #include - #include - #include -@@ -26,6 +27,7 @@ - #include - #include - #include -+#include - - /* Legacy value of ARG_MAX. The macro is now not defined since the - actual value varies based on the stack size. */ -@@ -75,6 +77,13 @@ __sysconf (int name) - } - break; - -+ case _SC_MINSIGSTKSZ: -+ assert (GLRO(dl_minsigstacksize) != 0); -+ return GLRO(dl_minsigstacksize); -+ -+ case _SC_SIGSTKSZ: -+ return sysconf_sigstksz (); -+ - default: - break; - } -diff --git a/sysdeps/unix/sysv/linux/x86/dl-minsigstacksize.h b/sysdeps/unix/sysv/linux/x86/dl-minsigstacksize.h -new file mode 100644 -index 00000000..6088bbc9 ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/x86/dl-minsigstacksize.h -@@ -0,0 +1,83 @@ -+/* Emulate AT_MINSIGSTKSZ. Linux/x86 version. -+ Copyright (C) 2020 Free Software Foundation, Inc. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* Emulate AT_MINSIGSTKSZ with XSAVE. */ -+ -+static inline void -+dl_check_minsigstacksize (const struct cpu_features *cpu_features) -+{ -+ /* Return if AT_MINSIGSTKSZ is provide by kernel. */ -+ if (GLRO(dl_minsigstacksize) != 0) -+ return; -+ -+ if (cpu_features->basic.max_cpuid >= 0xd -+ && CPU_FEATURES_CPU_P (cpu_features, OSXSAVE)) -+ { -+ /* Emulate AT_MINSIGSTKSZ. In Linux kernel, the signal frame data -+ with XSAVE is composed of the following areas and laid out as: -+ ------------------------------ -+ | alignment padding | -+ ------------------------------ -+ | xsave buffer | -+ ------------------------------ -+ | fsave header (32-bit only) | -+ ------------------------------ -+ | siginfo + ucontext | -+ ------------------------------ -+ */ -+ -+ unsigned int sigframe_size; -+ -+#ifdef __x86_64__ -+ /* NB: sizeof(struct rt_sigframe) + 8-byte return address in Linux -+ kernel. */ -+ sigframe_size = 440 + 8; -+#else -+ /* NB: sizeof(struct sigframe_ia32) + sizeof(struct fregs_state)) + -+ 4-byte return address + 3 * 4-byte arguments in Linux kernel. */ -+ sigframe_size = 736 + 112 + 4 + 3 * 4; -+#endif -+ -+ /* Add 15 bytes to align the stack to 16 bytes. */ -+ sigframe_size += 15; -+ -+ /* Make the space before xsave buffer multiple of 16 bytes. */ -+ sigframe_size = ALIGN_UP (sigframe_size, 16); -+ -+ /* Add (64 - 16)-byte padding to align xsave buffer at 64 bytes. */ -+ sigframe_size += 64 - 16; -+ -+ unsigned int eax, ebx, ecx, edx; -+ __cpuid_count (0xd, 0, eax, ebx, ecx, edx); -+ -+ /* Add the size of xsave buffer. */ -+ sigframe_size += ebx; -+ -+ /* Add the size of FP_XSTATE_MAGIC2. */ -+#define FP_XSTATE_MAGIC2 0x46505845U -+ sigframe_size += sizeof (FP_XSTATE_MAGIC2); -+ -+ GLRO(dl_minsigstacksize) = sigframe_size; -+ } -+ else -+ { -+ /* NB: Default to a constant MINSIGSTKSZ. */ -+ _Static_assert (__builtin_constant_p (MINSIGSTKSZ), -+ "MINSIGSTKSZ is constant"); -+ GLRO(dl_minsigstacksize) = MINSIGSTKSZ; -+ } -+} -diff --git a/sysdeps/unix/sysv/linux/x86/include/bits/sigstack.h b/sysdeps/unix/sysv/linux/x86/include/bits/sigstack.h -new file mode 100644 -index 00000000..208754c4 ---- /dev/null -+++ b/sysdeps/unix/sysv/linux/x86/include/bits/sigstack.h -@@ -0,0 +1,5 @@ -+#include_next -+ -+#ifndef _ISOMAC -+# define CONSTANT_MINSIGSTKSZ 0 -+#endif -diff --git a/sysdeps/x86/dl-minsigstacksize.h b/sysdeps/x86/dl-minsigstacksize.h -new file mode 100644 -index 00000000..959871c9 ---- /dev/null -+++ b/sysdeps/x86/dl-minsigstacksize.h -@@ -0,0 +1,27 @@ -+/* Emulate AT_MINSIGSTKSZ. Generic x86 version. -+ Copyright (C) 2020 Free Software Foundation, Inc. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* Emulate AT_MINSIGSTKSZ with XSAVE. */ -+ -+static inline void -+dl_check_minsigstacksize (const struct cpu_features *cpu_features) -+{ -+ /* NB: Default to a constant MINSIGSTKSZ. */ -+ _Static_assert (__builtin_constant_p (MINSIGSTKSZ), -+ "MINSIGSTKSZ is constant"); -+ GLRO(dl_minsigstacksize) = MINSIGSTKSZ; -+} --- -2.27.0 - diff --git a/SOURCES/0006-void-short-distance-rep-movsb.patch b/SOURCES/0006-void-short-distance-rep-movsb.patch deleted file mode 100644 index 9964e15..0000000 --- a/SOURCES/0006-void-short-distance-rep-movsb.patch +++ /dev/null @@ -1,53 +0,0 @@ -From ff7e299914a2dfa1c3fd7abd267535f7586ac413 Mon Sep 17 00:00:00 2001 -From: Wangyang Guo -Date: Mon, 15 Nov 2021 06:12:16 +0000 -Subject: [PATCH 1/2] Avoid short distance rep movsb - ---- - .../multiarch/memmove-vec-unaligned-erms.S | 22 +++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S -index c952576c..07299dc0 100644 ---- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S -+++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S -@@ -56,6 +56,14 @@ - # endif - #endif - -+/* Avoid short distance rep movsb only with non-SSE vector. */ -+#ifndef AVOID_SHORT_DISTANCE_REP_MOVSB -+# define AVOID_SHORT_DISTANCE_REP_MOVSB 1 -+#else -+# define AVOID_SHORT_DISTANCE_REP_MOVSB 0 -+#endif -+ -+ - #ifndef PREFETCH - # define PREFETCH(addr) prefetcht0 addr - #endif -@@ -235,7 +243,21 @@ L(movsb): - cmpq %r9, %rdi - /* Avoid slow backward REP MOVSB. */ - jb L(more_8x_vec_backward) -+# if AVOID_SHORT_DISTANCE_REP_MOVSB -+ movq %rdi, %rcx -+ subq %rsi, %rcx -+ jmp 2f -+# endif - 1: -+# if AVOID_SHORT_DISTANCE_REP_MOVSB -+ movq %rsi, %rcx -+ subq %rdi, %rcx -+2: -+/* Avoid "rep movsb" if RCX, the distance between source and destination, -+ is N*4GB + [1..63] with N >= 0. */ -+ cmpl $63, %ecx -+ jbe L(more_2x_vec) /* Avoid "rep movsb" if ECX <= 63. */ -+# endif - movq %rdx, %rcx - rep movsb - L(nop): --- -2.27.0 - diff --git a/SOURCES/0007-pack-up-patches.patch b/SOURCES/0007-pack-up-patches.patch deleted file mode 100644 index ca37c8d..0000000 --- a/SOURCES/0007-pack-up-patches.patch +++ /dev/null @@ -1,131 +0,0 @@ -From f42b57f2c3da86a0e3aa8e2f6f09994b8a0c7334 Mon Sep 17 00:00:00 2001 -From: Wangyang Guo -Date: Mon, 15 Nov 2021 05:28:29 +0000 -Subject: [PATCH] pack up patches - ---- - crypt/Makefile | 2 ++ - math/Makefile | 2 ++ - math/w_sqrt_compat.c | 1 + - nss/nss_files/files-XXX.c | 4 ++++ - sysdeps/ieee754/dbl-64/e_exp.c | 1 + - sysdeps/ieee754/dbl-64/e_exp2.c | 1 + - sysdeps/x86_64/fpu/Makefile | 7 +++++++ - timezone/tzselect.ksh | 2 +- - 8 files changed, 19 insertions(+), 1 deletion(-) - -diff --git a/crypt/Makefile b/crypt/Makefile -index 3811b6e2..34fd5306 100644 ---- a/crypt/Makefile -+++ b/crypt/Makefile -@@ -22,6 +22,8 @@ subdir := crypt - - include ../Makeconfig - -+CFLAGS-.o += -flto -ffat-lto-objects -fno-stack-protector -+ - headers := crypt.h - - extra-libs := libcrypt -diff --git a/math/Makefile b/math/Makefile -index df73d708..e1826330 100644 ---- a/math/Makefile -+++ b/math/Makefile -@@ -21,6 +21,8 @@ subdir := math - - include ../Makeconfig - -+CFLAGS-.o += -fno-stack-protector -falign-functions=32 -+ - # Installed header files. - headers := math.h bits/mathcalls.h bits/mathinline.h \ - fpu_control.h complex.h bits/cmathcalls.h fenv.h \ -diff --git a/math/w_sqrt_compat.c b/math/w_sqrt_compat.c -index e76a8079..889ab39a 100644 ---- a/math/w_sqrt_compat.c -+++ b/math/w_sqrt_compat.c -@@ -26,6 +26,7 @@ - #if LIBM_SVID_COMPAT - /* wrapper sqrt */ - double -+__attribute__((aligned(64))) - __sqrt (double x) - { - if (__builtin_expect (isless (x, 0.0), 0) && _LIB_VERSION != _IEEE_) -diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c -index 37a3ce27..056ec6cc 100644 ---- a/nss/nss_files/files-XXX.c -+++ b/nss/nss_files/files-XXX.c -@@ -40,6 +40,7 @@ - #define ENTNAME_r CONCAT(ENTNAME,_r) - - #define DATAFILE "/etc/" DATABASE -+#define ALTDATAFILE "/usr/share/defaults/etc/" DATABASE - - #ifdef NEED_H_ERRNO - # include -@@ -77,6 +78,9 @@ internal_setent (FILE **stream) - { - *stream = __nss_files_fopen (DATAFILE); - -+ if (*stream == NULL) -+ *stream = fopen(ALTDATAFILE, "rce"); -+ - if (*stream == NULL) - status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; - } -diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c -index ddd2bcb1..3c693d78 100644 ---- a/sysdeps/ieee754/dbl-64/e_exp.c -+++ b/sysdeps/ieee754/dbl-64/e_exp.c -@@ -49,6 +49,7 @@ - - double - SECTION -+__attribute__((aligned(64))) - __ieee754_exp (double x) - { - double bexp, t, eps, del, base, y, al, bet, res, rem, cor; -diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c -index c45bb447..a30d5a2e 100644 ---- a/sysdeps/ieee754/dbl-64/e_exp2.c -+++ b/sysdeps/ieee754/dbl-64/e_exp2.c -@@ -39,6 +39,7 @@ static const double TWO1023 = 8.988465674311579539e+307; - static const double TWOM1000 = 9.3326361850321887899e-302; - - double -+__attribute__((aligned(64))) - __ieee754_exp2 (double x) - { - static const double himark = (double) DBL_MAX_EXP; -diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile -index 2b7d69bb..bba4a1de 100644 ---- a/sysdeps/x86_64/fpu/Makefile -+++ b/sysdeps/x86_64/fpu/Makefile -@@ -237,3 +237,10 @@ CFLAGS-test-float-libmvec-sincosf-avx512.c = -DREQUIRE_AVX512F - CFLAGS-test-float-libmvec-sincosf-avx512-main.c = $(libmvec-sincos-cflags) $(float-vlen16-arch-ext-cflags) - endif - endif -+ -+ifeq ($(subdir),math) -+CFLAGS-branred.c = -mprefer-vector-width=128 -fno-tree-vectorize -+CFLAGS-s_sincos.c = -mprefer-vector-width=256 -fno-tree-vectorize -+CFLAGS-e_exp.c = -mprefer-vector-width=128 -fno-tree-vectorize -+CFLAGS-e_exp2.c = -mprefer-vector-width=128 -fno-tree-vectorize -+endif -diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh -index d2c3a6d1..5c69e579 100755 ---- a/timezone/tzselect.ksh -+++ b/timezone/tzselect.ksh -@@ -52,7 +52,7 @@ say() { - - coord= - location_limit=10 --zonetabtype=zone1970 -+zonetabtype=zone - - usage="Usage: tzselect [--version] [--help] [-c COORD] [-n LIMIT] - Select a time zone interactively. --- -2.27.0 - diff --git a/SOURCES/0008-only-avoid-short-distance-rep-mobsb-on-icx.patch b/SOURCES/0008-only-avoid-short-distance-rep-mobsb-on-icx.patch deleted file mode 100644 index 1828e74..0000000 --- a/SOURCES/0008-only-avoid-short-distance-rep-mobsb-on-icx.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 0058b10814afd8f1ea031b11f3c4ac226fa60d79 Mon Sep 17 00:00:00 2001 -From: Wangyang Guo -Date: Mon, 24 Jan 2022 02:59:56 +0000 -Subject: [PATCH] Only avoid short distance REP MOVSB on ICX - ---- - sysdeps/x86/cacheinfo.h | 9 +++++++++ - sysdeps/x86/cpu-features.c | 5 +++++ - .../include/cpu-features-preferred_feature_index_1.def | 1 + - sysdeps/x86/sysdep.h | 3 +++ - sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S | 5 +++++ - 5 files changed, 23 insertions(+) - -diff --git a/sysdeps/x86/cacheinfo.h b/sysdeps/x86/cacheinfo.h -index 02556961..7af8575d 100644 ---- a/sysdeps/x86/cacheinfo.h -+++ b/sysdeps/x86/cacheinfo.h -@@ -45,6 +45,11 @@ long int __x86_rep_movsb_threshold attribute_hidden = 2048; - /* Threshold to use Enhanced REP STOSB. */ - long int __x86_rep_stosb_threshold attribute_hidden = 2048; - -+/* Non-zero to avoid short distance REP MOVSB. */ -+//int __x86_avoid_short_distance_rep_movsb attribute_hidden; -+/* String/memory function control. */ -+int __x86_string_control attribute_hidden; -+ - static void - get_common_cache_info (long int *shared_ptr, unsigned int *threads_ptr, - long int core) -@@ -421,6 +426,10 @@ init_cacheinfo (void) - else - __x86_rep_movsb_threshold = rep_movsb_threshold; - -+ if (CPU_FEATURES_ARCH_P (cpu_features, Avoid_Short_Distance_REP_MOVSB)) -+ __x86_string_control -+ |= X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB; -+ - # if HAVE_TUNABLES - __x86_rep_stosb_threshold = cpu_features->rep_stosb_threshold; - # endif -diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c -index 91042505..22b45c72 100644 ---- a/sysdeps/x86/cpu-features.c -+++ b/sysdeps/x86/cpu-features.c -@@ -526,6 +526,11 @@ init_cpu_features (struct cpu_features *cpu_features) - else - cpu_features->preferred[index_arch_Prefer_No_AVX512] - |= bit_arch_Prefer_No_AVX512; -+ -+ /* Avoid avoid short distance REP MOVSB on processor with FSRM. */ -+ if (CPU_FEATURES_CPU_P (cpu_features, FSRM)) -+ cpu_features->preferred[index_arch_Avoid_Short_Distance_REP_MOVSB] -+ |= bit_arch_Avoid_Short_Distance_REP_MOVSB; - } - /* This spells out "AuthenticAMD". */ - else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65) -diff --git a/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def b/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def -index 17a5cc42..e7277b33 100644 ---- a/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def -+++ b/sysdeps/x86/include/cpu-features-preferred_feature_index_1.def -@@ -32,3 +32,4 @@ BIT (Prefer_ERMS) - BIT (Prefer_FSRM) - BIT (Prefer_No_AVX512) - BIT (MathVec_Prefer_No_AVX512) -+BIT (Avoid_Short_Distance_REP_MOVSB) -diff --git a/sysdeps/x86/sysdep.h b/sysdeps/x86/sysdep.h -index f41f4ebd..4ac93a95 100644 ---- a/sysdeps/x86/sysdep.h -+++ b/sysdeps/x86/sysdep.h -@@ -57,6 +57,9 @@ enum cf_protection_level - #define STATE_SAVE_MASK \ - ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7)) - -+/* Avoid short distance REP MOVSB. */ -+#define X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB (1 << 0) -+ - #ifdef __ASSEMBLER__ - - /* Syntactic details of assembler. */ -diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S -index 07299dc0..4aa65555 100644 ---- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S -+++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S -@@ -244,12 +244,16 @@ L(movsb): - /* Avoid slow backward REP MOVSB. */ - jb L(more_8x_vec_backward) - # if AVOID_SHORT_DISTANCE_REP_MOVSB -+ andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip) -+ jz 3f - movq %rdi, %rcx - subq %rsi, %rcx - jmp 2f - # endif - 1: - # if AVOID_SHORT_DISTANCE_REP_MOVSB -+ andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip) -+ jz 3f - movq %rsi, %rcx - subq %rdi, %rcx - 2: -@@ -257,6 +261,7 @@ L(movsb): - is N*4GB + [1..63] with N >= 0. */ - cmpl $63, %ecx - jbe L(more_2x_vec) /* Avoid "rep movsb" if ECX <= 63. */ -+3: - # endif - movq %rdx, %rcx - rep movsb --- -2.27.0 - diff --git a/SPECS/glibc.spec b/SPECS/glibc.spec index bef8a91..2c37db1 100644 --- a/SPECS/glibc.spec +++ b/SPECS/glibc.spec @@ -895,14 +895,9 @@ Patch700: glibc-rh2065588-13.patch Patch701: glibc-rh2072329.patch # Intel Optimizations -Patch1001: 0001-Backport-of-Add-NT_VMCOREDD-AT_MINSIGSTKSZ-from-Linu.patch -Patch1002: 0002-Backport-of-Print-cache-size-and-geometry-auxv-types.patch -Patch1003: 0003-Backport-of-Tests-for-minimal-signal-handler.patch -Patch1004: 0004-Disable-lazy-binding-on-tests-for-minimal-signal-han.patch -Patch1005: 0005-sysconf-Add-_SC_MINSIGSTKSZ-_SC_SIGSTKSZ-BZ-20305.patch -Patch1006: 0006-void-short-distance-rep-movsb.patch -Patch1007: 0007-pack-up-patches.patch -Patch1008: 0008-only-avoid-short-distance-rep-mobsb-on-icx.patch +Patch1001: 0001-void-short-distance-rep-movsb.patch +Patch1002: 0002-pack-up-patches.patch +Patch1003: 0003-only-avoid-short-distance-rep-mobsb-on-icx.patch ############################################################################## # Continued list of core "glibc" package information: