forked from pool/glibc
Accepting request 556908 from Base:System
- tst-tlsopt-powerpc.patch: fix tst-tlsopt-powerpc (bcn#1070419) - powerpc-hwcap-bits.patch: Update HWCAP for powerpc (bnc#1070420) - malloc-tcache-check-overflow.patch: Fix integer overflow in malloc when tcache is enabled (CVE-2017-17426, bnc#1071479, BZ #22375) (forwarded request 556907 from Andreas_Schwab) OBS-URL: https://build.opensuse.org/request/show/556908 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=217
This commit is contained in:
commit
b4304afbe2
5
_multibuild
Normal file
5
_multibuild
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<multibuild>
|
||||||
|
<package>i686</package>
|
||||||
|
<package>utils</package>
|
||||||
|
<package>testsuite</package>
|
||||||
|
</multibuild>
|
File diff suppressed because it is too large
Load Diff
1408
glibc-testsuite.spec
1408
glibc-testsuite.spec
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
|||||||
%define flavor testsuite
|
|
||||||
|
|
||||||
Name: glibc-testsuite
|
|
||||||
Summary: Testsuite results from the GNU C Library
|
|
||||||
License: LGPL-2.1+
|
|
||||||
Group: Development/Libraries/C and C++
|
|
8096
glibc-utils.changes
8096
glibc-utils.changes
File diff suppressed because it is too large
Load Diff
1408
glibc-utils.spec
1408
glibc-utils.spec
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
|||||||
%define flavor utils
|
|
||||||
|
|
||||||
Name: glibc-utils
|
|
||||||
Summary: Development utilities from the GNU C Library
|
|
||||||
License: LGPL-2.1+
|
|
||||||
Group: Development/Libraries/C and C++
|
|
@ -1,3 +1,27 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Dec 13 15:04:54 UTC 2017 - schwab@suse.de
|
||||||
|
|
||||||
|
- tst-tlsopt-powerpc.patch: fix tst-tlsopt-powerpc (bcn#1070419)
|
||||||
|
- powerpc-hwcap-bits.patch: Update HWCAP for powerpc (bnc#1070420)
|
||||||
|
- malloc-tcache-check-overflow.patch: Fix integer overflow in malloc when
|
||||||
|
tcache is enabled (CVE-2017-17426, bnc#1071479, BZ #22375)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Dec 12 10:37:21 UTC 2017 - schwab@suse.de
|
||||||
|
|
||||||
|
- Add _multibuild
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Nov 27 11:11:07 UTC 2017 - schwab@suse.de
|
||||||
|
|
||||||
|
- glob64-s390.patch: no compat glob64 on s390
|
||||||
|
- noversion.tar.bz2: remove unused source
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Oct 26 15:25:07 UTC 2017 - schwab@suse.de
|
||||||
|
|
||||||
|
- x86-64-dl-platform.patch: Don't set GLRO(dl_platform) to NULL (BZ #22299)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Oct 26 08:40:52 UTC 2017 - schwab@suse.de
|
Thu Oct 26 08:40:52 UTC 2017 - schwab@suse.de
|
||||||
|
|
||||||
|
82
glibc.spec
82
glibc.spec
@ -22,35 +22,35 @@
|
|||||||
|
|
||||||
%define crypt_bf_version 1.3
|
%define crypt_bf_version 1.3
|
||||||
%define build_snapshot 0
|
%define build_snapshot 0
|
||||||
|
%bcond_with ringdisabled
|
||||||
|
|
||||||
# INCLUDE glibc$flavor.spec.in
|
%define flavor @BUILD_FLAVOR@%{nil}
|
||||||
%ifarch i686
|
|
||||||
%define flavor i686
|
|
||||||
%else
|
|
||||||
%define flavor %nil
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Name: glibc
|
|
||||||
Summary: Standard Shared Libraries (from the GNU C Library)
|
|
||||||
License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+
|
|
||||||
Group: System/Libraries
|
|
||||||
# END INCLUDE glibc$flavor.spec.in
|
|
||||||
|
|
||||||
%bcond_with all
|
%bcond_with all
|
||||||
%define build_main 1
|
%define build_main 1
|
||||||
%define build_utils %{with all}
|
%define build_utils %{with all}
|
||||||
%define build_testsuite %{with all}
|
%define build_testsuite %{with all}
|
||||||
%if "%flavor" == "utils"
|
%if "%flavor" == "utils"
|
||||||
|
%if %{with ringdisabled}
|
||||||
|
ExclusiveArch: do_not_build
|
||||||
|
%endif
|
||||||
%define build_main 0
|
%define build_main 0
|
||||||
%define build_utils 1
|
%define build_utils 1
|
||||||
%define build_testsuite 0
|
%define build_testsuite 0
|
||||||
%endif
|
%endif
|
||||||
%if "%flavor" == "testsuite"
|
%if "%flavor" == "testsuite"
|
||||||
|
%if %{with ringdisabled}
|
||||||
|
ExclusiveArch: do_not_build
|
||||||
|
%endif
|
||||||
%define build_main 0
|
%define build_main 0
|
||||||
%define build_utils 0
|
%define build_utils 0
|
||||||
%define build_testsuite 1
|
%define build_testsuite 1
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
Name: glibc
|
||||||
|
Summary: Standard Shared Libraries (from the GNU C Library)
|
||||||
|
License: LGPL-2.1+ AND SUSE-LGPL-2.1+-with-GCC-exception AND GPL-2.0+
|
||||||
|
Group: System/Libraries
|
||||||
BuildRequires: audit-devel
|
BuildRequires: audit-devel
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: libcap-devel
|
BuildRequires: libcap-devel
|
||||||
@ -153,7 +153,6 @@ Source1: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz.sig
|
|||||||
Source: glibc-%{version}.tar.xz
|
Source: glibc-%{version}.tar.xz
|
||||||
%endif
|
%endif
|
||||||
Source2: http://savannah.gnu.org/project/memberlist-gpgkeys.php?group=libc&download=1#/glibc.keyring
|
Source2: http://savannah.gnu.org/project/memberlist-gpgkeys.php?group=libc&download=1#/glibc.keyring
|
||||||
Source3: noversion.tar.bz2
|
|
||||||
Source4: manpages.tar.bz2
|
Source4: manpages.tar.bz2
|
||||||
Source5: nsswitch.conf
|
Source5: nsswitch.conf
|
||||||
Source7: bindresvport.blacklist
|
Source7: bindresvport.blacklist
|
||||||
@ -317,6 +316,16 @@ Patch1019: glob-tilde-overflow.patch
|
|||||||
Patch1020: dl-runtime-resolve-xsave.patch
|
Patch1020: dl-runtime-resolve-xsave.patch
|
||||||
# PATCH-FIX-UPSTREAM posix: Fix improper assert in Linux posix_spawn (BZ #22273)
|
# PATCH-FIX-UPSTREAM posix: Fix improper assert in Linux posix_spawn (BZ #22273)
|
||||||
Patch1021: spawni-assert.patch
|
Patch1021: spawni-assert.patch
|
||||||
|
# PATCH-FIX-UPSTREAM x86-64: Don't set GLRO(dl_platform) to NULL (BZ #22299)
|
||||||
|
Patch1022: x86-64-dl-platform.patch
|
||||||
|
# PATCH-FIX-UPSTREAM no compat glob64 on s390
|
||||||
|
Patch1023: glob64-s390.patch
|
||||||
|
# PATCH-FIX-UPSTREAM tst-tlsopt-powerpc as a shared lib
|
||||||
|
Patch1024: tst-tlsopt-powerpc.patch
|
||||||
|
# PATCH-FIX-UPSTREAM Update HWCAP for powerpc
|
||||||
|
Patch1025: powerpc-hwcap-bits.patch
|
||||||
|
# PATCH-FIX-UPSTREAM Fix integer overflow in malloc when tcache is enabled (CVE-2017-17426, BZ #22375)
|
||||||
|
Patch1026: malloc-tcache-check-overflow.patch
|
||||||
|
|
||||||
###
|
###
|
||||||
# Patches awaiting upstream approval
|
# Patches awaiting upstream approval
|
||||||
@ -339,23 +348,33 @@ Patch2006: iconv-reset-input-buffer.patch
|
|||||||
Patch3000: manpages.patch
|
Patch3000: manpages.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
%if %build_main
|
|
||||||
The GNU C Library provides the most important standard libraries used
|
The GNU C Library provides the most important standard libraries used
|
||||||
by nearly all programs: the standard C library, the standard math
|
by nearly all programs: the standard C library, the standard math
|
||||||
library, and the POSIX thread library. A system is not functional
|
library, and the POSIX thread library. A system is not functional
|
||||||
without these libraries.
|
without these libraries.
|
||||||
%endif
|
|
||||||
%if %build_utils
|
%package utils
|
||||||
|
Summary: Development utilities from the GNU C Library
|
||||||
|
License: LGPL-2.1+
|
||||||
|
Group: Development/Languages/C and C++
|
||||||
|
Requires: glibc = %{version}
|
||||||
|
|
||||||
|
%description utils
|
||||||
The glibc-utils package contains mtrace, a memory leak tracer and
|
The glibc-utils package contains mtrace, a memory leak tracer and
|
||||||
xtrace, a function call tracer which can be helpful during program
|
xtrace, a function call tracer which can be helpful during program
|
||||||
debugging.
|
debugging.
|
||||||
|
|
||||||
If you are unsure if you need this, do not install this package.
|
If you are unsure if you need this, do not install this package.
|
||||||
%endif
|
|
||||||
%if %build_testsuite
|
|
||||||
This package contains the testsuite results from the GNU C Library.
|
|
||||||
%endif
|
|
||||||
|
|
||||||
|
%package testsuite
|
||||||
|
Summary: Testsuite results from the GNU C Library
|
||||||
|
License: LGPL-2.1+
|
||||||
|
Group: Development/Languages/C and C++
|
||||||
|
|
||||||
|
%description testsuite
|
||||||
|
This package contains the testsuite results from the GNU C Library.
|
||||||
|
|
||||||
|
%if %{build_main}
|
||||||
%package info
|
%package info
|
||||||
Summary: Info Files for the GNU C Library
|
Summary: Info Files for the GNU C Library
|
||||||
License: GFDL-1.1
|
License: GFDL-1.1
|
||||||
@ -382,7 +401,7 @@ partially out of date.
|
|||||||
|
|
||||||
%package i18ndata
|
%package i18ndata
|
||||||
Summary: Database Sources for 'locale'
|
Summary: Database Sources for 'locale'
|
||||||
License: GPL-2.0+ and MIT
|
License: GPL-2.0+ AND MIT
|
||||||
Group: System/Libraries
|
Group: System/Libraries
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
@ -394,7 +413,7 @@ created.
|
|||||||
|
|
||||||
%package locale
|
%package locale
|
||||||
Summary: Locale Data for Localized Programs
|
Summary: Locale Data for Localized Programs
|
||||||
License: GPL-2.0+ and MIT and LGPL-2.1+
|
License: GPL-2.0+ AND MIT AND LGPL-2.1+
|
||||||
Group: System/Libraries
|
Group: System/Libraries
|
||||||
Requires(post): /bin/cat
|
Requires(post): /bin/cat
|
||||||
Requires: glibc = %{version}
|
Requires: glibc = %{version}
|
||||||
@ -425,7 +444,7 @@ performance with NIS, NIS+, and LDAP.
|
|||||||
|
|
||||||
%package profile
|
%package profile
|
||||||
Summary: Libc Profiling and Debugging Versions
|
Summary: Libc Profiling and Debugging Versions
|
||||||
License: LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+
|
License: LGPL-2.1+ AND SUSE-LGPL-2.1+-with-GCC-exception AND GPL-2.0+
|
||||||
Group: Development/Libraries/C and C++
|
Group: Development/Libraries/C and C++
|
||||||
Requires: glibc = %{version}
|
Requires: glibc = %{version}
|
||||||
# bug437293
|
# bug437293
|
||||||
@ -442,7 +461,7 @@ necessary for profiling and debugging.
|
|||||||
|
|
||||||
%package devel
|
%package devel
|
||||||
Summary: Include Files and Libraries Mandatory for Development
|
Summary: Include Files and Libraries Mandatory for Development
|
||||||
License: BSD-3-Clause and LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+
|
License: BSD-3-Clause AND LGPL-2.1+ AND SUSE-LGPL-2.1+-with-GCC-exception AND GPL-2.0+
|
||||||
Group: Development/Libraries/C and C++
|
Group: Development/Libraries/C and C++
|
||||||
Obsoletes: epoll = 1.0
|
Obsoletes: epoll = 1.0
|
||||||
Provides: epoll < 1.0
|
Provides: epoll < 1.0
|
||||||
@ -462,7 +481,7 @@ library.
|
|||||||
|
|
||||||
%package devel-static
|
%package devel-static
|
||||||
Summary: C library static libraries for -static linking
|
Summary: C library static libraries for -static linking
|
||||||
License: BSD-3-Clause and LGPL-2.1+ and SUSE-LGPL-2.1+-with-GCC-exception and GPL-2.0+
|
License: BSD-3-Clause AND LGPL-2.1+ AND SUSE-LGPL-2.1+-with-GCC-exception AND GPL-2.0+
|
||||||
Group: Development/Libraries/C and C++
|
Group: Development/Libraries/C and C++
|
||||||
Requires: %{name}-devel = %{version}
|
Requires: %{name}-devel = %{version}
|
||||||
# Provide Fedora name for package to make packaging easier
|
# Provide Fedora name for package to make packaging easier
|
||||||
@ -486,9 +505,10 @@ The glibc-extra package contains some extra binaries for glibc that
|
|||||||
are not essential but recommend to use.
|
are not essential but recommend to use.
|
||||||
|
|
||||||
makedb: A program to create a database for nss
|
makedb: A program to create a database for nss
|
||||||
|
%endif # main
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -n glibc-%{version} -q -a 3 -a 4
|
%setup -n glibc-%{version} -q -a 4
|
||||||
# Owl crypt_blowfish
|
# Owl crypt_blowfish
|
||||||
tar -xzf %SOURCE50
|
tar -xzf %SOURCE50
|
||||||
pushd crypt_blowfish-%{crypt_bf_version}
|
pushd crypt_blowfish-%{crypt_bf_version}
|
||||||
@ -549,6 +569,11 @@ rm nscd/s-stamp
|
|||||||
%patch1019 -p1
|
%patch1019 -p1
|
||||||
%patch1020 -p1
|
%patch1020 -p1
|
||||||
%patch1021 -p1
|
%patch1021 -p1
|
||||||
|
%patch1022 -p1
|
||||||
|
%patch1023 -p1
|
||||||
|
%patch1024 -p1
|
||||||
|
%patch1025 -p1
|
||||||
|
%patch1026 -p1
|
||||||
|
|
||||||
%patch2000 -p1
|
%patch2000 -p1
|
||||||
%patch2001 -p1
|
%patch2001 -p1
|
||||||
@ -1089,6 +1114,8 @@ rm -rf %{buildroot}/sbin %{buildroot}%{_includedir}
|
|||||||
|
|
||||||
%endif # !main
|
%endif # !main
|
||||||
|
|
||||||
|
%if %{build_main}
|
||||||
|
|
||||||
%post -p %{_sbindir}/glibc_post_upgrade
|
%post -p %{_sbindir}/glibc_post_upgrade
|
||||||
%postun -p /sbin/ldconfig
|
%postun -p /sbin/ldconfig
|
||||||
|
|
||||||
@ -1128,7 +1155,6 @@ exit 0
|
|||||||
%service_del_postun nscd.service
|
%service_del_postun nscd.service
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
%if %{build_main}
|
|
||||||
%files
|
%files
|
||||||
# glibc
|
# glibc
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
@ -1396,7 +1422,7 @@ exit 0
|
|||||||
%endif # main
|
%endif # main
|
||||||
|
|
||||||
%if %{build_utils}
|
%if %{build_utils}
|
||||||
%files
|
%files utils
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
/%{_lib}/libmemusage.so
|
/%{_lib}/libmemusage.so
|
||||||
/%{_lib}/libpcprofile.so
|
/%{_lib}/libpcprofile.so
|
||||||
|
6
glob64-s390.patch
Normal file
6
glob64-s390.patch
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Index: glibc-2.26/sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ glibc-2.26/sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+/* No compat glob64 on s390. */
|
21
malloc-tcache-check-overflow.patch
Normal file
21
malloc-tcache-check-overflow.patch
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
2017-11-30 Arjun Shankar <arjun@redhat.com>
|
||||||
|
|
||||||
|
[BZ #22375]
|
||||||
|
CVE-2017-17426
|
||||||
|
* malloc/malloc.c (__libc_malloc): Use checked_request2size
|
||||||
|
instead of request2size.
|
||||||
|
|
||||||
|
Index: glibc-2.26/malloc/malloc.c
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.26.orig/malloc/malloc.c
|
||||||
|
+++ glibc-2.26/malloc/malloc.c
|
||||||
|
@@ -3052,7 +3052,8 @@ __libc_malloc (size_t bytes)
|
||||||
|
return (*hook)(bytes, RETURN_ADDRESS (0));
|
||||||
|
#if USE_TCACHE
|
||||||
|
/* int_free also calls request2size, be careful to not pad twice. */
|
||||||
|
- size_t tbytes = request2size (bytes);
|
||||||
|
+ size_t tbytes;
|
||||||
|
+ checked_request2size (bytes, tbytes);
|
||||||
|
size_t tc_idx = csize2tidx (tbytes);
|
||||||
|
|
||||||
|
MAYBE_INIT_TCACHE ();
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:6c47b7dccf2d318f2e2144322e6a931c46a7507f0e77a64fed3623860e10c5ab
|
|
||||||
size 1833
|
|
15
powerpc-hwcap-bits.patch
Normal file
15
powerpc-hwcap-bits.patch
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
2017-11-17 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
|
||||||
|
|
||||||
|
* sysdeps/powerpc/bits/hwcap.h (PPC_FEATURE2_HTM_NO_SUSPEND): New
|
||||||
|
macro.
|
||||||
|
|
||||||
|
Index: glibc-2.26/sysdeps/powerpc/bits/hwcap.h
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.26.orig/sysdeps/powerpc/bits/hwcap.h
|
||||||
|
+++ glibc-2.26/sysdeps/powerpc/bits/hwcap.h
|
||||||
|
@@ -72,3 +72,5 @@
|
||||||
|
128-bit */
|
||||||
|
#define PPC_FEATURE2_DARN 0x00200000 /* darn instruction. */
|
||||||
|
#define PPC_FEATURE2_SCV 0x00100000 /* scv syscall. */
|
||||||
|
+#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 /* TM without suspended
|
||||||
|
+ state. */
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
for flavor in utils testsuite; do
|
|
||||||
sed -e "/^# INCLUDE /r glibc-$flavor.spec.in" \
|
|
||||||
-e "/^# INCLUDE /,/^# END INCLUDE /d" \
|
|
||||||
glibc.spec > glibc-$flavor.spec
|
|
||||||
cp glibc.changes glibc-$flavor.changes
|
|
||||||
done
|
|
||||||
osc service lr format_spec_file
|
|
171
tst-tlsopt-powerpc.patch
Normal file
171
tst-tlsopt-powerpc.patch
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
2017-08-03 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* sysdeps/powerpc/mod-tlsopt-powerpc.c: Extract from
|
||||||
|
tst-tlsopt-powerpc.c with function name change and no test harness.
|
||||||
|
* sysdeps/powerpc/tst-tlsopt-powerpc.c: Remove body of test.
|
||||||
|
Call tls_get_addr_opt_test.
|
||||||
|
* sysdeps/powerpc/Makefile (LDFLAGS-tst-tlsopt-powerpc): Don't define.
|
||||||
|
(modules-names): Add mod-tlsopt-powerpc.
|
||||||
|
(mod-tlsopt-powerpc.so-no-z-defs): Define.
|
||||||
|
(tst-tlsopt-powerpc): Depend on .so.
|
||||||
|
* sysdeps/powerpc/powerpc64/tls-macros.h (__TLS_GET_ADDR): Don't
|
||||||
|
define. Expand use in TLS_GD and TLS_LD.
|
||||||
|
|
||||||
|
Index: glibc-2.26/sysdeps/powerpc/Makefile
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.26.orig/sysdeps/powerpc/Makefile
|
||||||
|
+++ glibc-2.26/sysdeps/powerpc/Makefile
|
||||||
|
@@ -8,9 +8,11 @@ sysdep-dl-routines += dl-machine hwcapin
|
||||||
|
sysdep_routines += dl-machine hwcapinfo
|
||||||
|
# extra shared linker files to link only into dl-allobjs.so
|
||||||
|
sysdep-rtld-routines += dl-machine hwcapinfo
|
||||||
|
-# Don't optimize GD tls sequence to LE.
|
||||||
|
-LDFLAGS-tst-tlsopt-powerpc += -Wl,--no-tls-optimize
|
||||||
|
+
|
||||||
|
+modules-names += mod-tlsopt-powerpc
|
||||||
|
+mod-tlsopt-powerpc.so-no-z-defs = yes
|
||||||
|
tests += tst-tlsopt-powerpc
|
||||||
|
+$(objpfx)tst-tlsopt-powerpc: $(objpfx)mod-tlsopt-powerpc.so
|
||||||
|
|
||||||
|
ifneq (no,$(multi-arch))
|
||||||
|
tests-static += tst-tlsifunc-static
|
||||||
|
Index: glibc-2.26/sysdeps/powerpc/mod-tlsopt-powerpc.c
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ glibc-2.26/sysdeps/powerpc/mod-tlsopt-powerpc.c
|
||||||
|
@@ -0,0 +1,49 @@
|
||||||
|
+/* shared library to test for __tls_get_addr optimization. */
|
||||||
|
+#include <stdio.h>
|
||||||
|
+
|
||||||
|
+#include "../../elf/tls-macros.h"
|
||||||
|
+#include "dl-tls.h"
|
||||||
|
+
|
||||||
|
+/* common 'int' variable in TLS. */
|
||||||
|
+COMMON_INT_DEF(foo);
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+tls_get_addr_opt_test (void)
|
||||||
|
+{
|
||||||
|
+ int result = 0;
|
||||||
|
+
|
||||||
|
+ /* Get variable using general dynamic model. */
|
||||||
|
+ int *ap = TLS_GD (foo);
|
||||||
|
+ if (*ap != 0)
|
||||||
|
+ {
|
||||||
|
+ printf ("foo = %d\n", *ap);
|
||||||
|
+ result = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ tls_index *tls_arg;
|
||||||
|
+#ifdef __powerpc64__
|
||||||
|
+ register unsigned long thread_pointer __asm__ ("r13");
|
||||||
|
+ asm ("addi %0,2,foo@got@tlsgd" : "=r" (tls_arg));
|
||||||
|
+#else
|
||||||
|
+ register unsigned long thread_pointer __asm__ ("r2");
|
||||||
|
+ asm ("bcl 20,31,1f\n1:\t"
|
||||||
|
+ "mflr %0\n\t"
|
||||||
|
+ "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"
|
||||||
|
+ "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"
|
||||||
|
+ "addi %0,%0,foo@got@tlsgd" : "=b" (tls_arg));
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ if (tls_arg->ti_module != 0)
|
||||||
|
+ {
|
||||||
|
+ printf ("tls_index not optimized, binutils too old?\n");
|
||||||
|
+ result = 1;
|
||||||
|
+ }
|
||||||
|
+ else if (tls_arg->ti_offset + thread_pointer != (unsigned long) ap)
|
||||||
|
+ {
|
||||||
|
+ printf ("tls_index->ti_offset wrong value\n");
|
||||||
|
+ result = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return result;
|
||||||
|
+}
|
||||||
|
Index: glibc-2.26/sysdeps/powerpc/powerpc64/tls-macros.h
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.26.orig/sysdeps/powerpc/powerpc64/tls-macros.h
|
||||||
|
+++ glibc-2.26/sysdeps/powerpc/powerpc64/tls-macros.h
|
||||||
|
@@ -18,13 +18,11 @@
|
||||||
|
__result; \
|
||||||
|
})
|
||||||
|
|
||||||
|
-#define __TLS_GET_ADDR "__tls_get_addr"
|
||||||
|
-
|
||||||
|
/* PowerPC64 Local Dynamic TLS access. */
|
||||||
|
#define TLS_LD(x) \
|
||||||
|
({ int * __result; \
|
||||||
|
asm ("addi 3,2," #x "@got@tlsld\n\t" \
|
||||||
|
- "bl " __TLS_GET_ADDR "\n\t" \
|
||||||
|
+ "bl __tls_get_addr\n\t" \
|
||||||
|
"nop \n\t" \
|
||||||
|
"addis %0,3," #x "@dtprel@ha\n\t" \
|
||||||
|
"addi %0,%0," #x "@dtprel@l" \
|
||||||
|
@@ -36,7 +34,7 @@
|
||||||
|
#define TLS_GD(x) \
|
||||||
|
({ register int *__result __asm__ ("r3"); \
|
||||||
|
asm ("addi 3,2," #x "@got@tlsgd\n\t" \
|
||||||
|
- "bl " __TLS_GET_ADDR "\n\t" \
|
||||||
|
+ "bl __tls_get_addr\n\t" \
|
||||||
|
"nop " \
|
||||||
|
: "=r" (__result) : \
|
||||||
|
: __TLS_CALL_CLOBBERS); \
|
||||||
|
Index: glibc-2.26/sysdeps/powerpc/tst-tlsopt-powerpc.c
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.26.orig/sysdeps/powerpc/tst-tlsopt-powerpc.c
|
||||||
|
+++ glibc-2.26/sysdeps/powerpc/tst-tlsopt-powerpc.c
|
||||||
|
@@ -1,51 +1,11 @@
|
||||||
|
/* glibc test for __tls_get_addr optimization. */
|
||||||
|
-#include <stdio.h>
|
||||||
|
-
|
||||||
|
-#include "../../elf/tls-macros.h"
|
||||||
|
-#include "dl-tls.h"
|
||||||
|
-
|
||||||
|
-/* common 'int' variable in TLS. */
|
||||||
|
-COMMON_INT_DEF(foo);
|
||||||
|
-
|
||||||
|
|
||||||
|
static int
|
||||||
|
do_test (void)
|
||||||
|
{
|
||||||
|
- int result = 0;
|
||||||
|
-
|
||||||
|
- /* Get variable using general dynamic model. */
|
||||||
|
- int *ap = TLS_GD (foo);
|
||||||
|
- if (*ap != 0)
|
||||||
|
- {
|
||||||
|
- printf ("foo = %d\n", *ap);
|
||||||
|
- result = 1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- tls_index *tls_arg;
|
||||||
|
-#ifdef __powerpc64__
|
||||||
|
- register unsigned long thread_pointer __asm__ ("r13");
|
||||||
|
- asm ("addi %0,2,foo@got@tlsgd" : "=r" (tls_arg));
|
||||||
|
-#else
|
||||||
|
- register unsigned long thread_pointer __asm__ ("r2");
|
||||||
|
- asm ("bcl 20,31,1f\n1:\t"
|
||||||
|
- "mflr %0\n\t"
|
||||||
|
- "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"
|
||||||
|
- "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"
|
||||||
|
- "addi %0,%0,foo@got@tlsgd" : "=b" (tls_arg));
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
- if (tls_arg->ti_module != 0)
|
||||||
|
- {
|
||||||
|
- printf ("tls_index not optimized, binutils too old?\n");
|
||||||
|
- result = 1;
|
||||||
|
- }
|
||||||
|
- else if (tls_arg->ti_offset + thread_pointer != (unsigned long) ap)
|
||||||
|
- {
|
||||||
|
- printf ("tls_index->ti_offset wrong value\n");
|
||||||
|
- result = 1;
|
||||||
|
- }
|
||||||
|
+ extern int tls_get_addr_opt_test (void);
|
||||||
|
|
||||||
|
- return result;
|
||||||
|
+ return tls_get_addr_opt_test ();
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <support/test-driver.c>
|
196
x86-64-dl-platform.patch
Normal file
196
x86-64-dl-platform.patch
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
2017-10-26 Valery Reznic <valery_reznic@yahoo.com>
|
||||||
|
H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
[BZ #22299]
|
||||||
|
* sysdeps/x86/cpu-features.c (init_cpu_features): Don't set
|
||||||
|
GLRO(dl_platform) to NULL.
|
||||||
|
* sysdeps/x86_64/Makefile (tests): Add tst-platform-1.
|
||||||
|
(modules-names): Add tst-platformmod-1 and
|
||||||
|
x86_64/tst-platformmod-2.
|
||||||
|
(CFLAGS-tst-platform-1.c): New.
|
||||||
|
(CFLAGS-tst-platformmod-1.c): Likewise.
|
||||||
|
(CFLAGS-tst-platformmod-2.c): Likewise.
|
||||||
|
(LDFLAGS-tst-platformmod-2.so): Likewise.
|
||||||
|
($(objpfx)tst-platform-1): Likewise.
|
||||||
|
($(objpfx)tst-platform-1.out): Likewise.
|
||||||
|
(tst-platform-1-ENV): Likewise.
|
||||||
|
($(objpfx)x86_64/tst-platformmod-2.os): Likewise.
|
||||||
|
* sysdeps/x86_64/tst-platform-1.c: New file.
|
||||||
|
* sysdeps/x86_64/tst-platformmod-1.c: Likewise.
|
||||||
|
* sysdeps/x86_64/tst-platformmod-2.c: Likewise.
|
||||||
|
|
||||||
|
Index: glibc-2.26/sysdeps/x86/cpu-features.c
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.26.orig/sysdeps/x86/cpu-features.c
|
||||||
|
+++ glibc-2.26/sysdeps/x86/cpu-features.c
|
||||||
|
@@ -389,7 +389,6 @@ no_cpuid:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Reuse dl_platform, dl_hwcap and dl_hwcap_mask for x86. */
|
||||||
|
- GLRO(dl_platform) = NULL;
|
||||||
|
#if !HAVE_TUNABLES && defined SHARED
|
||||||
|
/* The glibc.tune.hwcap_mask tunable is initialized already, so no need to do
|
||||||
|
this. */
|
||||||
|
@@ -400,13 +399,15 @@ no_cpuid:
|
||||||
|
GLRO(dl_hwcap) = HWCAP_X86_64;
|
||||||
|
if (cpu_features->kind == arch_kind_intel)
|
||||||
|
{
|
||||||
|
+ const char *platform = NULL;
|
||||||
|
+
|
||||||
|
if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)
|
||||||
|
&& CPU_FEATURES_CPU_P (cpu_features, AVX512CD))
|
||||||
|
{
|
||||||
|
if (CPU_FEATURES_CPU_P (cpu_features, AVX512ER))
|
||||||
|
{
|
||||||
|
if (CPU_FEATURES_CPU_P (cpu_features, AVX512PF))
|
||||||
|
- GLRO(dl_platform) = "xeon_phi";
|
||||||
|
+ platform = "xeon_phi";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@@ -417,7 +418,7 @@ no_cpuid:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (GLRO(dl_platform) == NULL
|
||||||
|
+ if (platform == NULL
|
||||||
|
&& CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable)
|
||||||
|
&& CPU_FEATURES_ARCH_P (cpu_features, FMA_Usable)
|
||||||
|
&& CPU_FEATURES_CPU_P (cpu_features, BMI1)
|
||||||
|
@@ -425,7 +426,10 @@ no_cpuid:
|
||||||
|
&& CPU_FEATURES_CPU_P (cpu_features, LZCNT)
|
||||||
|
&& CPU_FEATURES_CPU_P (cpu_features, MOVBE)
|
||||||
|
&& CPU_FEATURES_CPU_P (cpu_features, POPCNT))
|
||||||
|
- GLRO(dl_platform) = "haswell";
|
||||||
|
+ platform = "haswell";
|
||||||
|
+
|
||||||
|
+ if (platform != NULL)
|
||||||
|
+ GLRO(dl_platform) = platform;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
GLRO(dl_hwcap) = 0;
|
||||||
|
Index: glibc-2.26/sysdeps/x86_64/Makefile
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.26.orig/sysdeps/x86_64/Makefile
|
||||||
|
+++ glibc-2.26/sysdeps/x86_64/Makefile
|
||||||
|
@@ -62,6 +62,21 @@ endif
|
||||||
|
|
||||||
|
$(objpfx)tst-x86_64-1: $(objpfx)x86_64/tst-x86_64mod-1.so
|
||||||
|
|
||||||
|
+ifneq (no,$(have-tunables))
|
||||||
|
+tests += tst-platform-1
|
||||||
|
+modules-names += tst-platformmod-1 x86_64/tst-platformmod-2
|
||||||
|
+CFLAGS-tst-platform-1.c = -mno-avx
|
||||||
|
+CFLAGS-tst-platformmod-1.c = -mno-avx
|
||||||
|
+CFLAGS-tst-platformmod-2.c = -mno-avx
|
||||||
|
+LDFLAGS-tst-platformmod-2.so = -Wl,-soname,tst-platformmod-2.so
|
||||||
|
+$(objpfx)tst-platform-1: $(objpfx)tst-platformmod-1.so
|
||||||
|
+$(objpfx)tst-platform-1.out: $(objpfx)x86_64/tst-platformmod-2.so
|
||||||
|
+# Turn off AVX512F_Usable and AVX2_Usable so that GLRO(dl_platform) is
|
||||||
|
+# always set to x86_64.
|
||||||
|
+tst-platform-1-ENV = LD_PRELOAD=$(objpfx)\$$PLATFORM/tst-platformmod-2.so \
|
||||||
|
+ GLIBC_TUNABLES=glibc.tune.hwcaps=-AVX512F_Usable,-AVX2_Usable
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 \
|
||||||
|
tst-audit10 tst-sse tst-avx tst-avx512
|
||||||
|
test-extras += tst-audit4-aux tst-audit10-aux \
|
||||||
|
@@ -143,3 +158,8 @@ do-tests-clean common-mostlyclean: tst-x
|
||||||
|
.PHONY: tst-x86_64-1-clean
|
||||||
|
tst-x86_64-1-clean:
|
||||||
|
-rm -rf $(objpfx)x86_64
|
||||||
|
+
|
||||||
|
+$(objpfx)x86_64/tst-platformmod-2.os: $(objpfx)tst-platformmod-2.os
|
||||||
|
+ $(make-target-directory)
|
||||||
|
+ rm -f $@
|
||||||
|
+ ln $< $@
|
||||||
|
Index: glibc-2.26/sysdeps/x86_64/tst-platform-1.c
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ glibc-2.26/sysdeps/x86_64/tst-platform-1.c
|
||||||
|
@@ -0,0 +1,29 @@
|
||||||
|
+/* Test PRELOAD with $PLATFORM.
|
||||||
|
+ Copyright (C) 2017 Free Software Foundation, Inc.
|
||||||
|
+ This file is part of the GNU C Library.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
+ modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ License as published by the Free Software Foundation; either
|
||||||
|
+ version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ License along with the GNU C Library; if not, see
|
||||||
|
+ <http://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+
|
||||||
|
+extern int preload (void);
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+do_test (void)
|
||||||
|
+{
|
||||||
|
+ return preload () == 0x1234 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#include <support/test-driver.c>
|
||||||
|
Index: glibc-2.26/sysdeps/x86_64/tst-platformmod-1.c
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ glibc-2.26/sysdeps/x86_64/tst-platformmod-1.c
|
||||||
|
@@ -0,0 +1,23 @@
|
||||||
|
+/* Test PRELOAD with $PLATFORM.
|
||||||
|
+ Copyright (C) 2017 Free Software Foundation, Inc.
|
||||||
|
+ This file is part of the GNU C Library.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
+ modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ License as published by the Free Software Foundation; either
|
||||||
|
+ version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ License along with the GNU C Library; if not, see
|
||||||
|
+ <http://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+preload (void)
|
||||||
|
+{
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
Index: glibc-2.26/sysdeps/x86_64/tst-platformmod-2.c
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ glibc-2.26/sysdeps/x86_64/tst-platformmod-2.c
|
||||||
|
@@ -0,0 +1,23 @@
|
||||||
|
+/* Test PRELOAD with $PLATFORM.
|
||||||
|
+ Copyright (C) 2017 Free Software Foundation, Inc.
|
||||||
|
+ This file is part of the GNU C Library.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
+ modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ License as published by the Free Software Foundation; either
|
||||||
|
+ version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ License along with the GNU C Library; if not, see
|
||||||
|
+ <http://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+preload (void)
|
||||||
|
+{
|
||||||
|
+ return 0x1234;
|
||||||
|
+}
|
Loading…
x
Reference in New Issue
Block a user