<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/glibc.git/sysdeps, branch azanella/aarch64-split-stack</title>
<subtitle>sourceware.org: git/glibc.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/'/>
<entry>
<title>aarch64: Add split-stack TCB field</title>
<updated>2018-01-17T11:26:35+00:00</updated>
<author>
<name>Adhemerval Zanella</name>
<email>adhemerval.zanella@linaro.org</email>
</author>
<published>2017-01-24T11:27:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/commit/?id=97dabd564b91e6d0bfacf9af8d34103347047f23'/>
<id>97dabd564b91e6d0bfacf9af8d34103347047f23</id>
<content type='text'>
This patch adds split-stack support pointer guard on glibc for aarch64.
Different from other architectures (powerpc, s390) where the memory is
placed on TCB, aarch64 one is placed before thread pointer initial
position.  It has an advantage over extending TCB because for aarch64
TLS variable placement take in consideration tcbhead_t size and by
changing its value would require to also update the static linker
(and it would also add incompatibility with glibc and older linkers).

For aarch64 tcb direct access is fastest for thread local variable on
all mode and related TLS access.  It requires just a direct load with
displacement of -8 (since thread pointer points to tcbhead_t).

It also adds a loader symbol (__tcb_private_ss) to signal the existence
of the split stack guard area.

Checked on aarch64-linux-gnu.

	* sysdeps/aarch64/Makefile [$(subdir) = elf] (sysdeps-dl-routines):
	Add tcb-version.
	* sysdeps/aarch64/Versions [ld] (GLIBC_2.26): Add
	__libc_tcb_private_ss.
	* sysdeps/aarch64/nptl/tls.h (tcbprehead_t): New struct.
	(TLS_PRE_TCB_SIZE): Take tcbprehead_t in consideration.
	(TLS_DEFINE_INIT_TP): Likewise.
	(THREAD_SELF): Likewise.
	(DB_THREAD_SELF): Likewise.
	* sysdeps/aarch64/tcb-version.c: New file.
	* sysdeps/unix/sysv/linux/aarch64/ld.abilist (GLIBC_2.26): Add.
	(__libc_tcb_private_ss): Likewise.
	* sysdeps/aarch64/nptl/tcb-offsets.sym (PTHREAD_SIZEOF): Rename to
	PTHREAD_PRE_TCB_SIZE.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds split-stack support pointer guard on glibc for aarch64.
Different from other architectures (powerpc, s390) where the memory is
placed on TCB, aarch64 one is placed before thread pointer initial
position.  It has an advantage over extending TCB because for aarch64
TLS variable placement take in consideration tcbhead_t size and by
changing its value would require to also update the static linker
(and it would also add incompatibility with glibc and older linkers).

For aarch64 tcb direct access is fastest for thread local variable on
all mode and related TLS access.  It requires just a direct load with
displacement of -8 (since thread pointer points to tcbhead_t).

It also adds a loader symbol (__tcb_private_ss) to signal the existence
of the split stack guard area.

Checked on aarch64-linux-gnu.

	* sysdeps/aarch64/Makefile [$(subdir) = elf] (sysdeps-dl-routines):
	Add tcb-version.
	* sysdeps/aarch64/Versions [ld] (GLIBC_2.26): Add
	__libc_tcb_private_ss.
	* sysdeps/aarch64/nptl/tls.h (tcbprehead_t): New struct.
	(TLS_PRE_TCB_SIZE): Take tcbprehead_t in consideration.
	(TLS_DEFINE_INIT_TP): Likewise.
	(THREAD_SELF): Likewise.
	(DB_THREAD_SELF): Likewise.
	* sysdeps/aarch64/tcb-version.c: New file.
	* sysdeps/unix/sysv/linux/aarch64/ld.abilist (GLIBC_2.26): Add.
	(__libc_tcb_private_ss): Likewise.
	* sysdeps/aarch64/nptl/tcb-offsets.sym (PTHREAD_SIZEOF): Rename to
	PTHREAD_PRE_TCB_SIZE.
</pre>
</div>
</content>
</entry>
<entry>
<title>Use LIBGCC_S_SO in x86_64 backtrace.</title>
<updated>2018-01-16T20:53:03+00:00</updated>
<author>
<name>Joseph Myers</name>
<email>joseph@codesourcery.com</email>
</author>
<published>2018-01-16T20:53:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/commit/?id=4942c4ea48099b4ba9dfecf7cfbc452ae74811b5'/>
<id>4942c4ea48099b4ba9dfecf7cfbc452ae74811b5</id>
<content type='text'>
The x86_64 backtrace implementation is used as a generic
implementation (unwinding via unwind info and _Unwind_Backtrace) by
various other architectures.  This patch makes it more generic by
making it use LIBGCC_S_SO from gnu/lib-names.h instead of hardcoding
the libgcc_s.so.1 name, so that it can also be used on hppa which uses
libgcc_s.so.4.

Tested for x86_64.

	* sysdeps/x86_64/backtrace.c: Include &lt;gnu/lib-names.h&gt;.
	(init): Use LIBGCC_S_SO not hardcoded "libgcc_s.so.1".
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The x86_64 backtrace implementation is used as a generic
implementation (unwinding via unwind info and _Unwind_Backtrace) by
various other architectures.  This patch makes it more generic by
making it use LIBGCC_S_SO from gnu/lib-names.h instead of hardcoding
the libgcc_s.so.1 name, so that it can also be used on hppa which uses
libgcc_s.so.4.

Tested for x86_64.

	* sysdeps/x86_64/backtrace.c: Include &lt;gnu/lib-names.h&gt;.
	(init): Use LIBGCC_S_SO not hardcoded "libgcc_s.so.1".
</pre>
</div>
</content>
</entry>
<entry>
<title>aarch64: Update bits/hwcap.h for Linux 4.15.</title>
<updated>2018-01-16T18:51:13+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>szabolcs.nagy@arm.com</email>
</author>
<published>2018-01-11T17:08:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/commit/?id=953c49cc3bb1041090281042148197ad3537c551'/>
<id>953c49cc3bb1041090281042148197ad3537c551</id>
<content type='text'>
Define new HWCAP bits and add their name to dl-procinfo.c following
the linux definitions. Synchronizing with v4.15-rc8 version of linux,
these are not expected to change before the 4.15 release.

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_SHA3): Define.
	(HWCAP_SM3, HWCAP_SM4, HWCAP_ASIMDDP, HWCAP_SHA512, HWCAP_SVE): Define.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
	(_dl_aarch64_cap_flags): Update.
	(_DL_HWCAP_COUNT): Update.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Define new HWCAP bits and add their name to dl-procinfo.c following
the linux definitions. Synchronizing with v4.15-rc8 version of linux,
these are not expected to change before the 4.15 release.

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_SHA3): Define.
	(HWCAP_SM3, HWCAP_SM4, HWCAP_ASIMDDP, HWCAP_SHA512, HWCAP_SVE): Define.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
	(_dl_aarch64_cap_flags): Update.
	(_DL_HWCAP_COUNT): Update.
</pre>
</div>
</content>
</entry>
<entry>
<title>aarch64: make HWCAP updates less error prone</title>
<updated>2018-01-16T18:50:34+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>szabolcs.nagy@arm.com</email>
</author>
<published>2018-01-11T17:21:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/commit/?id=afce1991f6f61514172696ec3edf93331cb0e04f'/>
<id>afce1991f6f61514172696ec3edf93331cb0e04f</id>
<content type='text'>
Remove unused _DL_HWCAP_LAST definition and move _DL_HWCAP_COUNT
where it is needed (dl-procinfo.h always includes dl-procinfo.c).

	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
	(_DL_HWCAP_LAST): Remove.
	(_DL_HWCAP_COUNT): Move to ...
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
	(_DL_HWCAP_COUNT): ... here.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove unused _DL_HWCAP_LAST definition and move _DL_HWCAP_COUNT
where it is needed (dl-procinfo.h always includes dl-procinfo.c).

	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
	(_DL_HWCAP_LAST): Remove.
	(_DL_HWCAP_COUNT): Move to ...
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
	(_DL_HWCAP_COUNT): ... here.
</pre>
</div>
</content>
</entry>
<entry>
<title>powerpc: Fix llround spurious inexact on 32-bit POWER4 [BZ #22697]</title>
<updated>2018-01-12T22:39:42+00:00</updated>
<author>
<name>Tulio Magno Quites Machado Filho</name>
<email>tuliom@linux.vnet.ibm.com</email>
</author>
<published>2018-01-12T22:39:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/commit/?id=af1e6be4ba60067907ea9e19e0cd6897d194e9cf'/>
<id>af1e6be4ba60067907ea9e19e0cd6897d194e9cf</id>
<content type='text'>
This issue is similar to BZ #19235, where spurious exceptions are
created from adding 0.5 then converting to an integer.
The solution is based on Joseph's fix for BZ #19235.

	[BZ #22697]
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S (__llround):
	Do not add 0.5 to integer or out-of-range arguments.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This issue is similar to BZ #19235, where spurious exceptions are
created from adding 0.5 then converting to an integer.
The solution is based on Joseph's fix for BZ #19235.

	[BZ #22697]
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S (__llround):
	Do not add 0.5 to integer or out-of-range arguments.
</pre>
</div>
</content>
</entry>
<entry>
<title>aarch64: fix static pie enabled libc when main is in a shared library</title>
<updated>2018-01-12T18:10:03+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>szabolcs.nagy@arm.com</email>
</author>
<published>2017-12-19T18:43:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/commit/?id=3d1d79283e6de4f7c434cb67fb53a4fd28359669'/>
<id>3d1d79283e6de4f7c434cb67fb53a4fd28359669</id>
<content type='text'>
In the static pie enabled libc, crt1.o uses the same position independent
code as rcrt1.o and crt1.o is used instead of Scrt1.o when -no-pie
executables are linked.  When main is not defined in the executable, but
in a shared library crt1.o is currently broken, it assumes main is local.
(glibc has a test for this but i missed it in my previous testing.)

To make both rcrt1.o and crt1.o happy with the same code, a wrapper is
introduced around main: with this crt1.o works with extern main symbol
while rcrt1.o does not depend on GOT relocations. (The change only
affects static pie enabled libc. Further simplification of start.S is
possible in the future by using the same approach for Scrt1.o too.)

	* aarch64/start.S (_start): Use __wrap_main.
	(__wrap_main): New local symbol.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the static pie enabled libc, crt1.o uses the same position independent
code as rcrt1.o and crt1.o is used instead of Scrt1.o when -no-pie
executables are linked.  When main is not defined in the executable, but
in a shared library crt1.o is currently broken, it assumes main is local.
(glibc has a test for this but i missed it in my previous testing.)

To make both rcrt1.o and crt1.o happy with the same code, a wrapper is
introduced around main: with this crt1.o works with extern main symbol
while rcrt1.o does not depend on GOT relocations. (The change only
affects static pie enabled libc. Further simplification of start.S is
possible in the future by using the same approach for Scrt1.o too.)

	* aarch64/start.S (_start): Use __wrap_main.
	(__wrap_main): New local symbol.
</pre>
</div>
</content>
</entry>
<entry>
<title>linux: make getcwd(3) fail if it cannot obtain an absolute path [BZ #22679]</title>
<updated>2018-01-12T14:49:49+00:00</updated>
<author>
<name>Dmitry V. Levin</name>
<email>ldv@altlinux.org</email>
</author>
<published>2018-01-07T02:03:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/commit/?id=52a713fdd0a30e1bd79818e2e3c4ab44ddca1a94'/>
<id>52a713fdd0a30e1bd79818e2e3c4ab44ddca1a94</id>
<content type='text'>
Currently getcwd(3) can succeed without returning an absolute path
because the underlying getcwd syscall, starting with linux commit
v2.6.36-rc1~96^2~2, may succeed without returning an absolute path.

This is a conformance issue because "The getcwd() function shall
place an absolute pathname of the current working directory
in the array pointed to by buf, and return buf".

This is also a security issue because a non-absolute path returned
by getcwd(3) causes a buffer underflow in realpath(3).

Fix this by checking the path returned by getcwd syscall and falling
back to generic_getcwd if the path is not absolute, effectively making
getcwd(3) fail with ENOENT.  The error code is chosen for consistency
with the case when the current directory is unlinked.

[BZ #22679]
CVE-2018-1000001
* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Fall back to
generic_getcwd if the path returned by getcwd syscall is not absolute.
* io/tst-getcwd-abspath.c: New test.
* io/Makefile (tests): Add tst-getcwd-abspath.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently getcwd(3) can succeed without returning an absolute path
because the underlying getcwd syscall, starting with linux commit
v2.6.36-rc1~96^2~2, may succeed without returning an absolute path.

This is a conformance issue because "The getcwd() function shall
place an absolute pathname of the current working directory
in the array pointed to by buf, and return buf".

This is also a security issue because a non-absolute path returned
by getcwd(3) causes a buffer underflow in realpath(3).

Fix this by checking the path returned by getcwd syscall and falling
back to generic_getcwd if the path is not absolute, effectively making
getcwd(3) fail with ENOENT.  The error code is chosen for consistency
with the case when the current directory is unlinked.

[BZ #22679]
CVE-2018-1000001
* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Fall back to
generic_getcwd if the path returned by getcwd syscall is not absolute.
* io/tst-getcwd-abspath.c: New test.
* io/Makefile (tests): Add tst-getcwd-abspath.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix s390 linknamespace fallout of bug 22702 patch.</title>
<updated>2018-01-12T00:12:57+00:00</updated>
<author>
<name>Joseph Myers</name>
<email>joseph@codesourcery.com</email>
</author>
<published>2018-01-12T00:12:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/commit/?id=c8924f1ff22cb78abc9bb950c3b23d8483ac7bba'/>
<id>c8924f1ff22cb78abc9bb950c3b23d8483ac7bba</id>
<content type='text'>
My fix for bug 22702 introduced linknamespace test failures on
s390x-linux-gnu and s390-linux-gnu because it made remainder call
__feholdexcept, and the s390 __feholdexcept calls fegetenv, and
remainder is in Unix98 and XPG4.2 but fegetenv isn't.  This patch
makes __feholdexcept call __fegetenv instead to avoid that namespace
issue.

Tested (compilation) with build-many-glibcs.py for s390x-linux-gnu,
where it resolves the test failures.

	* sysdeps/s390/fpu/feholdexcpt.c (__feholdexcept): Call __fegetenv
	instead of fegetenv.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
My fix for bug 22702 introduced linknamespace test failures on
s390x-linux-gnu and s390-linux-gnu because it made remainder call
__feholdexcept, and the s390 __feholdexcept calls fegetenv, and
remainder is in Unix98 and XPG4.2 but fegetenv isn't.  This patch
makes __feholdexcept call __fegetenv instead to avoid that namespace
issue.

Tested (compilation) with build-many-glibcs.py for s390x-linux-gnu,
where it resolves the test failures.

	* sysdeps/s390/fpu/feholdexcpt.c (__feholdexcept): Call __fegetenv
	instead of fegetenv.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make default libc_feholdsetround_noex_ctx use __feholdexcept (bug 22702).</title>
<updated>2018-01-11T18:18:46+00:00</updated>
<author>
<name>Joseph Myers</name>
<email>joseph@codesourcery.com</email>
</author>
<published>2018-01-11T18:18:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/commit/?id=da09e6fa2f8194fbdd82281195145aec195144dc'/>
<id>da09e6fa2f8194fbdd82281195145aec195144dc</id>
<content type='text'>
For soft-float powerpc, the math/test-nearbyint-except-2 test fails
because nearbyintl traps when traps on "inexact" are enabled on entry
(and an "inexact" exception is generated internally, though cleared
for the final return).

The problem is the default implementation of
libc_feholdsetround_noex_ctx, which does not disable exception traps.
There is some ambiguity about whether the *noex* interfaces are
required to do so or only permitted to do so.  But given that we
support fe* interfaces to enable and disable traps (on architectures
with that functionality), functions that must not raise an exception
(must not leave the flag set on exit if not set on entry) should also
not trap on it when traps on that exception are enabled.  So it is
appropriate to define these interfaces to have the feholdexcept effect
of disabling exception traps; this patch updates the default
implementation and comments accordingly.

At least some architecture versions already disable traps; there are
few uses of the *noex* interfaces at all, and while it's possible
there are bugs on any architecture versions failing to disable traps
that appear in the exp2 and remainder implementations, there are
currently no tests, other than this one for nearbyintl (where only the
ldbl-128ibm implementation uses SET_RESTORE_ROUND_NOEX), that would
fail as a result of such a bug.  (Hard-float powerpc does disable
traps here, hence the nearbyintl failure not appearing there.)

Tested for powerpc (soft-float).  This brings that configuration to
clean math/ test results, provided you build with GCC 8 to get the fix
for GCC bug 64811.

	[BZ #22702]
	* sysdeps/generic/math_private.h (libc_feresetround_noex): Update
	comment to say exceptions are discarded.
	(libc_feholdsetround_noex_ctx): Use __feholdexcept instead of
	__fegetenv.
	(SET_RESTORE_ROUND_NOEX): Update comment to say non-stop mode must
	be enabled.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For soft-float powerpc, the math/test-nearbyint-except-2 test fails
because nearbyintl traps when traps on "inexact" are enabled on entry
(and an "inexact" exception is generated internally, though cleared
for the final return).

The problem is the default implementation of
libc_feholdsetround_noex_ctx, which does not disable exception traps.
There is some ambiguity about whether the *noex* interfaces are
required to do so or only permitted to do so.  But given that we
support fe* interfaces to enable and disable traps (on architectures
with that functionality), functions that must not raise an exception
(must not leave the flag set on exit if not set on entry) should also
not trap on it when traps on that exception are enabled.  So it is
appropriate to define these interfaces to have the feholdexcept effect
of disabling exception traps; this patch updates the default
implementation and comments accordingly.

At least some architecture versions already disable traps; there are
few uses of the *noex* interfaces at all, and while it's possible
there are bugs on any architecture versions failing to disable traps
that appear in the exp2 and remainder implementations, there are
currently no tests, other than this one for nearbyintl (where only the
ldbl-128ibm implementation uses SET_RESTORE_ROUND_NOEX), that would
fail as a result of such a bug.  (Hard-float powerpc does disable
traps here, hence the nearbyintl failure not appearing there.)

Tested for powerpc (soft-float).  This brings that configuration to
clean math/ test results, provided you build with GCC 8 to get the fix
for GCC bug 64811.

	[BZ #22702]
	* sysdeps/generic/math_private.h (libc_feresetround_noex): Update
	comment to say exceptions are discarded.
	(libc_feholdsetround_noex_ctx): Use __feholdexcept instead of
	__fegetenv.
	(SET_RESTORE_ROUND_NOEX): Update comment to say non-stop mode must
	be enabled.
</pre>
</div>
</content>
</entry>
<entry>
<title>csu: Update __libgcc_s_init comment</title>
<updated>2018-01-11T12:13:28+00:00</updated>
<author>
<name>Florian Weimer</name>
<email>fweimer@redhat.com</email>
</author>
<published>2018-01-11T12:13:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glibc.git/commit/?id=08c6e95234c60a5c2f37532d1111acf084f39345'/>
<id>08c6e95234c60a5c2f37532d1111acf084f39345</id>
<content type='text'>
Reviewed-by: Carlos O'Donell &lt;carlos@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed-by: Carlos O'Donell &lt;carlos@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
