Leonhard Holz [Tue, 12 May 2015 17:22:14 +0000 (22:52 +0530)]
Add strcoll benchmark
Leonhard Holz [Tue, 12 May 2015 15:02:50 +0000 (20:32 +0530)]
Split locale generation snippet into a separate file
This patch prepares for the strcoll benchmark by moving the makefile
code for generating the locale files into a standalone snippet that
can be used elsewhere.
Ondřej Bílka [Tue, 18 Mar 2014 10:01:38 +0000 (11:01 +0100)]
Use strspn/strcspn/strpbrk ifunc in internal calls.
To make a strtok faster and improve performance in general we need to do one
additional change.
A comment:
/* It doesn't make sense to send libc-internal strcspn calls through a PLT.
The speedup we get from using SSE4.2 instruction is likely eaten away
by the indirect call in the PLT. */
Does not make sense at all because nobody bothered to check it. Gap
between these implementations is quite big, when haystack is empty a
sse2 is around 40 cycles slower because it needs to populate a lookup
table and difference only increases with size. That is much bigger than
plt slowdown which is few cycles.
Even benchtest show a gap which also may be reverse by branch
misprediction but my internal benchmark shown.
simple_strspn stupid_strspn __strspn_sse42 __strspn_sse2
Length 0, alignment 0, acc len 6: 18.6562 35.2344 17.0469 61.6719
Length 6, alignment 0, acc len 6: 59.5469 72.5781 16.4219 73.625
This patch also handles strpbrk which is implemented by including a
x86_64/multiarch/strcspn.S file.
* sysdeps/x86_64/multiarch/strspn.S: Remove plt indirection.
* sysdeps/x86_64/multiarch/strcspn.S: Likewise.
Roland McGrath [Tue, 12 May 2015 17:54:47 +0000 (10:54 -0700)]
NaCl: Provide non-default values for uname.
Joseph Myers [Tue, 12 May 2015 17:09:49 +0000 (17:09 +0000)]
Fix linknamespace test handling of architecture-specific st_other.
For mips16, some of the linknamespace tests were failing because
[MIPS16] annotations in readelf output were wrongly interpreted as
falling in the symbol index field, meaning symbol index values were
wrongly interpreted as symbol names and such names as 1 and 2 then
resulted in namespace test failures.
This patch fixes this by removing the annotations for such
architecture-specific st_other bits before splitting the readelf
output into fields. Tested for x86_64 and mips16.
* conform/linknamespace.pl (list_syms): Remove \[.*?\] before
splitting into fields.
Leonhard Holz [Tue, 12 May 2015 09:37:52 +0000 (11:37 +0200)]
Improve strcoll with strdiff.
This patch improves strcoll hot case by finding first byte that
mismatches. That is in likely case enough to determine comparison
result.
Joseph Myers [Mon, 11 May 2015 22:58:10 +0000 (22:58 +0000)]
Fix mips16 __fpu_control static linking (bug 18397).
Programs are supposed to be able to define the __fpu_control variable,
overriding the library's version to cause the floating-point control
word to be set to the chosen value at startup.
This is broken for mips16 for static linking because the library's
__fpu_control variable is in the same object file as the helper
functions used by fpu_control.h for mips16, so test-fpucw-ieee-static
fails to link with multiple definitions of __fpu_control.
This patch fixes this by putting the helpers in a separate file rather
than overriding fpu_control.c. Tested for mips16 that this fixes the
link failure and the ABI tests still pass.
[BZ #18397]
* sysdeps/mips/mips32/fpu/fpu_control.c: Move to ....
* sysdeps/mips/mips32/fpu/fpucw-helpers.c: ... here. Include
<fpu_control.h> instead of <math/fpu_control.c>.
* sysdeps/mips/mips32/fpu/Makefile: New file.
Andreas Schwab [Wed, 25 Mar 2015 15:35:46 +0000 (16:35 +0100)]
Separate internal state between getXXent and getXXbyYY NSS calls (bug 18007)
Stefan Liebler [Mon, 11 May 2015 07:15:36 +0000 (09:15 +0200)]
Adjust tst-strfmon1 after da_DK locale change.
This patch adjusts the expected currency symbol kr to kr. after commit
"Update currency_symbol in da_DK"
(
92566b4922934676da1643bf496dc982791d54d0) which changed it.
* tst-strfmon1.c (tests): Update expected currency symbol.
Roland McGrath [Fri, 8 May 2015 20:06:41 +0000 (13:06 -0700)]
NaCl: Implement gethostname.
Joseph Myers [Fri, 8 May 2015 17:55:11 +0000 (17:55 +0000)]
Add more tests of csqrt, lgamma, log10, sinh.
This patch adds more randomly-generated tests of various libm
functions that are observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of csqrt, lgamma, log10
and sinh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Carlos O'Donell [Fri, 8 May 2015 15:20:32 +0000 (11:20 -0400)]
Bug 18125: Call exit after last linked context.
There appears to be a discrepancy among the implementations
of setcontext with regards to the function called once the last
linked-to context has finished executing via setcontext.
The POSIX standard says:
~~~
If the uc_link member of the ucontext_t structure pointed to by
the ucp argument is equal to 0, then this context is the main
context, and the thread will exit when this context returns.
~~~
It says "exit" not "exit immediately" nor "exit without running
functions registered with atexit or on_exit."
Therefore the AArch64, ARM, hppa and NIOS II implementations are
wrong and no test detects it.
It is questionable if this should even be fixed or just documented
that the above 4 targets are wrong. The functions are deprecated
and nobody should be using them, but at the same time it silly to
have cross-target differences that make it hard to port old
applications from say x86_64 to AArch64.
Therefore I will ix the 4 arches, and checkin a regression
test to prevent it from changing again.
https://sourceware.org/ml/libc-alpha/2015-03/msg00720.html
Siddhesh Poyarekar [Thu, 7 May 2015 06:28:40 +0000 (11:58 +0530)]
Update NEWS
Christian Schmidt [Thu, 7 May 2015 06:26:56 +0000 (11:56 +0530)]
Update currency_symbol in da_DK
Roland McGrath [Wed, 6 May 2015 20:32:18 +0000 (13:32 -0700)]
BZ#18383: Add test case for large alignment in TLS blocks.
Roland McGrath [Wed, 6 May 2015 19:55:58 +0000 (12:55 -0700)]
NaCl: Fix elf_loader file name in nacl-test-wrapper.sh
Joseph Myers [Wed, 6 May 2015 17:30:18 +0000 (17:30 +0000)]
Add more tests of acosh, atanh, cos, csqrt, erfc, sin, sincos.
This patch adds more randomly-generated tests of various libm
functions that are observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of acosh, atanh, cos,
csqrt, erfc, sin and sincos.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Wilco Dijkstra [Wed, 6 May 2015 13:00:15 +0000 (13:00 +0000)]
2015-05-06 Szabolcs Nagy <szabolcs.nagy@arm.com>
* sysdeps/aarch64/libm-test-ulps: Update.
Joseph Myers [Tue, 5 May 2015 22:59:41 +0000 (22:59 +0000)]
Add further tests of libm functions.
This patch adds more randomly-generated tests of various libm
functions that are observed to increase ulps on x86_64. (This process
must eventually converge, when my random test generation stops finding
inputs that increase the listed ulps, except maybe for any cases
uncovered where the errors exceed the maximum allowed 9ulp error and
so indicate actual libm bugs needing fixing.)
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of acosh, atanh, clog,
clog10, csqrt, erfc, exp2, expm1, log10, log2 and sinh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Daniel Marjamäki [Tue, 5 May 2015 15:24:38 +0000 (17:24 +0200)]
Add __nonnull attribute to wcscpy and wcsncpy [BZ#18265]
Florian Weimer [Fri, 24 Apr 2015 11:50:18 +0000 (13:50 +0200)]
__ASSUME_FALLOCATE is always true on 32-bit architectures
This means we can clean up the generic code a bit. The 64-bit
variant still needs to support !__ASSUME_FALLOCATE for alpha.
Florian Weimer [Fri, 24 Apr 2015 11:26:09 +0000 (13:26 +0200)]
i386: Remove fallocate, fallocate64, posix_fallocate, posix_fallocate64
With 6-argument system call support, the generic Linux implementations of
these system calls work, and there is no need for i386-specific versions.
Joseph Myers [Sat, 2 May 2015 21:06:33 +0000 (21:06 +0000)]
Add more tests of libm functions.
This patch adds more randomly-generated tests of various libm
functions that are observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of atan, clog, clog10,
cos, csqrt, erf, erfc, exp2, lgamma, log1p, sin, sincos, tanh and
tgamma.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Fri, 1 May 2015 23:15:07 +0000 (23:15 +0000)]
Add more tests of tgamma.
This patch adds some randomly-generated tests of tgamma that are
observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of tgamma.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Fri, 1 May 2015 23:06:44 +0000 (23:06 +0000)]
Add more tests of tanh.
This patch adds some randomly-generated tests of tanh that are
observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of tanh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Fri, 1 May 2015 22:54:39 +0000 (22:54 +0000)]
Add more tests of tan.
This patch adds some randomly-generated tests of tan that are observed
to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of tan.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Fri, 1 May 2015 22:41:00 +0000 (22:41 +0000)]
Add more tests of cos, sin, sincos.
This patch adds some randomly-generated tests of cos, sin and sincos
that are observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of cos, sin and sincos.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Fri, 1 May 2015 22:31:24 +0000 (22:31 +0000)]
Add another test of pow.
This patch adds a randomly-generated test of pow that is observed to
increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add another test of pow.
* math/auto-libm-test-out: Regenerated.
* sysdeps/x86_64/fpu/libm-test-ulps: Update.
Joseph Myers [Fri, 1 May 2015 22:17:19 +0000 (22:17 +0000)]
Add more tests of lgamma.
This patch adds some randomly-generated tests of lgamma that are
observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of lgamma.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Fri, 1 May 2015 21:08:37 +0000 (21:08 +0000)]
Add more tests of log, log10, log1p, log2.
This patch adds some randomly-generated tests of log, log10, log1p and
log2 that are observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of log, log10, log2 and
log1p.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Mark Wielaard [Fri, 1 May 2015 14:21:55 +0000 (16:21 +0200)]
elf.h: Add section compression constants and structures.
Add SHF_COMPRESSED section flag, Elf32_Chdr and Elf64_Chdr structs and
ELFCOMPRESS constants to elf/elf.h.
Joseph Myers [Fri, 1 May 2015 20:33:04 +0000 (20:33 +0000)]
Add more tests of exp, exp10, exp2, expm1.
This patch adds some randomly-generated tests of exp, exp10, exp2 and
expm1 that are observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of exp, exp10, exp2 and
expm1.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Fri, 1 May 2015 17:49:44 +0000 (17:49 +0000)]
Add more tests of erf, erfc.
This patch adds some randomly-generated tests of erf and erfc that are
observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of erf and erfc.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Szabolcs Nagy [Fri, 1 May 2015 12:58:55 +0000 (13:58 +0100)]
[AArch64] Fix the big endian loader name.
Joseph Myers [Thu, 30 Apr 2015 22:51:29 +0000 (22:51 +0000)]
Add more tests of csqrt.
This patch adds some randomly-generated tests of csqrt that are
observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of csqrt.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Thu, 30 Apr 2015 22:32:08 +0000 (22:32 +0000)]
Add further tests of cosh and sinh.
This patch adds some further randomly-generated tests of cosh and sinh
that are observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of cosh and sinh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Thu, 30 Apr 2015 16:25:46 +0000 (16:25 +0000)]
Remove MIPS version of waitid.c.
Since glibc is no longer built with -Winline, a special MIPS version
of waitid.c to disable -Winline is no longer needed, and this patch
removes it. Tested that glibc does indeed build with the patch
applied.
* sysdeps/unix/sysv/linux/mips/mips32/waitid.c: Remove file.
Roland McGrath [Wed, 29 Apr 2015 22:34:34 +0000 (15:34 -0700)]
NaCl: Change clock_t to long int.
Roland McGrath [Wed, 29 Apr 2015 21:43:41 +0000 (14:43 -0700)]
NaCl: Fix symbol names for euidaccess.
Roland McGrath [Wed, 29 Apr 2015 20:34:32 +0000 (13:34 -0700)]
NaCl: Make __suseconds_t be long int rather than int32_t.
Florian Weimer [Wed, 29 Apr 2015 13:33:41 +0000 (15:33 +0200)]
Florian Weimer [Wed, 29 Apr 2015 12:41:25 +0000 (14:41 +0200)]
CVE-2014-8121: Do not close NSS files database during iteration [BZ #18007]
Robin Hack discovered Samba would enter an infinite loop processing
certain quota-related requests. We eventually tracked this down to a
glibc issue.
Running a (simplified) test case under strace shows that /etc/passwd
is continuously opened and closed:
…
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
lseek(3, 0, SEEK_CUR) = 0
read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 2717
lseek(3, 2717, SEEK_SET) = 2717
close(3) = 0
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
lseek(3, 0, SEEK_CUR) = 0
lseek(3, 0, SEEK_SET) = 0
read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 2717
lseek(3, 2717, SEEK_SET) = 2717
close(3) = 0
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
lseek(3, 0, SEEK_CUR) = 0
…
The lookup function implementation in
nss/nss_files/files-XXX.c:DB_LOOKUP has code to prevent that. It is
supposed skip closing the input file if it was already open.
/* Reset file pointer to beginning or open file. */ \
status = internal_setent (keep_stream); \
\
if (status == NSS_STATUS_SUCCESS) \
{ \
/* Tell getent function that we have repositioned the file pointer. */ \
last_use = getby; \
\
while ((status = internal_getent (result, buffer, buflen, errnop \
H_ERRNO_ARG EXTRA_ARGS_VALUE)) \
== NSS_STATUS_SUCCESS) \
{ break_if_match } \
\
if (! keep_stream) \
internal_endent (); \
} \
keep_stream is initialized from the stayopen flag in internal_setent.
internal_setent is called from the set*ent implementation as:
status = internal_setent (stayopen);
However, for non-host database, this flag is always 0, per the
STAYOPEN magic in nss/getXXent_r.c.
Thus, the fix is this:
- status = internal_setent (stayopen);
+ status = internal_setent (1);
This is not a behavioral change even for the hosts database (where the
application can specify the stayopen flag) because with a call to
sethostent(0), the file handle is still not closed in the
implementation of gethostent.
Joseph Myers [Tue, 28 Apr 2015 17:27:02 +0000 (17:27 +0000)]
Fix ldbl-128 roundl for exponents in [31, 47] (bug 18346).
The implementation of roundl for ldbl-128 involves undefined behavior
for arguments with exponents from 31 to 47 inclusive, from the shift:
u_int64_t i = -1ULL >> (j0 - 48);
For example, on mips64, this means roundl (0xffffffffffff.8p0L)
wrongly returns its argument, which is not an integer. A condition
checking for exponents < 31 should actually be checking for exponents
< 48, and this patch makes it do so. (That condition is for whether
the bit representing 0.5 is in the high 64-bit half of the
floating-point number. The value 31 might have arisen from an
incorrect conversion of the ldbl-96 version to handle ldbl-128.)
This was originally reported as a GCC libquadmath bug
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65757>.
Tested for mips64; also tested for x86_64 and x86 to make sure the new
tests pass there.
[BZ #18346]
* sysdeps/ieee754/ldbl-128/s_roundl.c (__roundl): Handle all
exponents less than 48 as cases where high part of mantissa needs
examining to determine whether argument is integral.
* math/libm-test.inc (round_test_data): Add more tests.
Mark Wielaard [Tue, 28 Apr 2015 11:56:15 +0000 (13:56 +0200)]
elf.h SHF_EXCLUDE signed int 31 bit shift triggers undefined behaviour.
Any use of SHF_EXCLUDE in code that tries to check it against sh_flags
will trigger undefined behaviour because it is defined as a 31 bit shift
against an signed integer. Fix by explicitly using an unsigned int.
David S. Miller [Mon, 27 Apr 2015 21:53:13 +0000 (14:53 -0700)]
Update sparc localplt.data
* sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data: Remove
__tls_get_addr.
* sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data: Likewise.
H.J. Lu [Mon, 27 Apr 2015 16:57:51 +0000 (09:57 -0700)]
Check tzspec_len == 0 in __tzfile_read
[BZ#18333]
* time/tzset.c (__tzfile_read): Check tzspec_len == 0.
Florian Weimer [Mon, 27 Apr 2015 13:41:03 +0000 (15:41 +0200)]
test-skeleton: Support temporary files without memory leaks [BZ#18333]
add_temp_file now makes a copy which is freed by delete_temp_files.
Callers to create_temp_file can now free the returned file name to
avoid the memory leak. These changes do not affect the leak behavior
of existing code.
Also address a NULL pointer derefence in tzset after a memoru allocation
failure, found during testing.
Florian Weimer [Fri, 24 Apr 2015 11:18:48 +0000 (13:18 +0200)]
posix_fallocate, posix_fallocate64 stub: Do not set errno
These functions return an error code.
Roland McGrath [Fri, 24 Apr 2015 17:51:49 +0000 (10:51 -0700)]
ARM: Define PI_STATIC_AND_HIDDEN.
Florian Weimer [Fri, 24 Apr 2015 15:34:47 +0000 (17:34 +0200)]
Make time zone file parser more robust [BZ #17715]
Florian Weimer [Fri, 24 Apr 2015 09:10:24 +0000 (11:10 +0200)]
Do not build with -Winline
-Winline causes architecture- and optimization-dependent build failures
due to -Werror. -Winline warns about inlining decisions based on
branch hints, in effect preventing the use of inline functions in
header files (because they might be called on unlikely branches, leading
to a decision not to inline).
The option was apparently added to the glibc build at a time when GCC
did not support the always_inline attribute. With current GCC versions,
inlining failure for functions declared always_inline will receive a
warning under -Wattributes, which is enabled by default, so -Winline
appears unnecessary.
Stefan Liebler [Fri, 24 Apr 2015 11:36:23 +0000 (13:36 +0200)]
S/390: Regenerate ULPs
Stefan Liebler [Fri, 24 Apr 2015 11:34:17 +0000 (13:34 +0200)]
S/390: Get cache information via sysconf
This patch adds support to query cache information on s390
via sysconf() function - e.g. with _SC_LEVEL1_ICACHE_SIZE.
The attributes size, linesize and assoc can be queried
for cache level 1 - 4 via "extract cpu attribute" instruction,
which was first available with z10.
* NEWS: Mention sysconf() cache information support for s390.
* sysdeps/unix/sysv/linux/s390/sysconf.c: New File.
Wilco Dijkstra [Wed, 22 Apr 2015 12:07:56 +0000 (12:07 +0000)]
Use __copysign rather than copysign.
Arjun Shankar [Tue, 21 Apr 2015 12:06:31 +0000 (14:06 +0200)]
CVE-2015-1781: resolv/nss_dns/dns-host.c buffer overflow [BZ#18287]
Adhemerval Zanella [Mon, 13 Apr 2015 19:38:16 +0000 (16:38 -0300)]
libc-vdso.h place consolidation
This patch moves the libc-vdso.h internal header from bits folder to
default architecture one and also corrects the remaning includes in
the files.
Paul Eggert [Sun, 19 Apr 2015 08:06:33 +0000 (01:06 -0700)]
Better fix for setenv (..., NULL, ...)
* stdlib/setenv.c (__add_to_environ):
Dump core quickly if setenv (..., NULL, ...) is called.
This time, do it the right way, and pacify GCC with a pragma.
Roland McGrath [Fri, 17 Apr 2015 21:29:40 +0000 (14:29 -0700)]
Avoid confusing compiler with dynamically impossible statically invalid dereference in _dl_close_worker.
Roland McGrath [Fri, 17 Apr 2015 19:11:58 +0000 (12:11 -0700)]
Fuller check for invalid NSID in _dl_open.
David S. Miller [Fri, 17 Apr 2015 02:40:31 +0000 (19:40 -0700)]
Sparc memchr/memcmp/strncmp fixes from Il'ya Malakhov.
[BZ #17825]
* sysdeps/sparc/sparc64/memchr.S: Fix signedness handling of length.
* sysdeps/sparc/sparc64/memcmp.S: Likewise.
* sysdeps/sparc/sparc64/strncmp.S: Likewise.
Roland McGrath [Fri, 17 Apr 2015 16:02:19 +0000 (09:02 -0700)]
Add arm-nacl port.
David S. Miller [Thu, 16 Apr 2015 20:05:41 +0000 (13:05 -0700)]
Convert sparc over to lowlevellock-futex.h
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Make use of
lowlevellock-futex.h
Chris Metcalf [Thu, 16 Apr 2015 13:40:21 +0000 (09:40 -0400)]
tile: Enable PI_STATIC_AND_HIDDEN
This does make ld.so very slightly larger (0.3%) and doesn't seem to
actually improve performance; in fact, my limited testing suggested a
slight (0.1%) performance decrease (running fork/exec of a no-op program
in a loop), but I didn't do enough testing to establish statistical
significance.
However, Roland agrees that it makes sense to switch tile to using
this path, since it's the more standard way.
Adhemerval Zanella [Wed, 25 Feb 2015 19:22:10 +0000 (16:22 -0300)]
powerpc: Fix __wcschr static build
This patch fix the static build for strftime, which uses __wcschr.
Current powerpc32 implementation defines the __wcschr be an alias to
__wcschr_ppc32 and current implementation misses the correct alias for
static build.
It also changes the default wcschr.c logic so a IFUNC implementation
should just define WCSCHR and undefine the required alias/internal
definitions.
David S. Miller [Wed, 15 Apr 2015 16:42:54 +0000 (09:42 -0700)]
Rebuilt fresh sparc ULPS to get rid of removed tests.
* sysdeps/sparc/fpu/libm-test-ulps: Regenerate from scratch.
Stefan Liebler [Mon, 13 Apr 2015 19:23:10 +0000 (21:23 +0200)]
Use correct signedness in wcsncmp
[BZ #18206]
* wcsmbs/wcsncmp.c (wcsncmp): Compare as wchar_t, not wint_t.
Use signed comparision instead of substraction to avoid
overflow bug.
* localedata/tests-mbwc/tst_wcsncmp.c (tst_wcsncmp):
Take the sign of ret.
* localedata/tests-mbwc/dat_wcsncmp.c (tst_wcsncmp_loc):
Do not expect precise return values. Only the sign matters.
* wcsmbs/Makefile (strop-tests): Add wcsncmp.
* wcsmbs/test-wcsncmp.c: New File.
* string/test-strncmp.c: Add wcsncmp support.
Stefan Liebler [Mon, 13 Apr 2015 19:16:56 +0000 (21:16 +0200)]
Set errno for log1p on pole/domain error.
According to bug 6792, errno is not set to ERANGE/EDOM
by calling log1p/log1pf/log1pl with x = -1 or x < -1.
This patch adds a wrapper which sets errno in those cases
and returns the value of the existing __log1p function.
The log1p is now an alias to the wrapper function
instead of __log1p.
The files in sysdeps are reflecting these changes.
The ia64 implementation sets errno by itself,
thus the wrapper-file is empty.
The libm-test is adjusted for log1p-tests to check errno.
[BZ #6792]
* math/w_log1p.c: New file.
* math/w_log1pf.c: Likewise.
* math/w_log1pl.c: Likewise.
* math/Makefile (libm-calls): Add w_log1p.
* math/s_log1pl.c (log1pl): Remove weak_alias.
* sysdeps/i386/fpu/s_log1p.S (log1p): Likewise.
* sysdeps/i386/fpu/s_log1pf.S (log1pf): Likewise.
* sysdeps/i386/fpu/s_log1pl.S (log1pl): Likewise.
* sysdeps/x86_64/fpu/s_log1pl.S (log1pl): Likewise.
* sysdeps/ieee754/dbl-64/s_log1p.c (log1p): Likewise.
[NO_LONG_DOUBLE] (log1pl): Likewise.
* sysdeps/ieee754/flt-32/s_log1pf.c (log1pf): Likewise.
* sysdeps/ieee754/ldbl-128/s_log1pl.c (log1pl): Likewise.
* sysdeps/ieee754/ldbl-64-128/s_log1pl.c
(log1p): Remove long_double_symbol.
* sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (log1pl): Likewise.
* sysdeps/ieee754/ldbl-64-128/w_log1pl.c: New file.
* sysdeps/ieee754/ldbl-128ibm/w_log1pl.c: Likewise.
* sysdeps/m68k/m680x0/fpu/s_log1p.c: Define empty weak_alias to
remove weak_alias for corresponding log1p function.
* sysdeps/m68k/m680x0/fpu/s_log1pf.c: Likewise.
* sysdeps/m68k/m680x0/fpu/s_log1pl.c: Likewise.
* sysdeps/ia64/fpu/w_log1p.c: New file.
* sysdeps/ia64/fpu/w_log1pf.c: Likewise.
* sysdeps/ia64/fpu/w_log1pl.c: Likewise.
* math/libm-test.inc (log1p_test_data): Add errno expectations.
Stefan Liebler [Fri, 10 Apr 2015 22:42:00 +0000 (15:42 -0700)]
Update tst_mbrlen/tst_mbrtowc for mblen change
commit
9781a370023952383028e07399fd196a889bb2be changed the expected
results for mbrlen in case of passing n=0 to -2. The initialization of
tst_mbrlen_loc and tst_mbrtowc should be updated accordingly.
* tests-mbwc/dat_mbrlen.c (tst_mbrlen_loc): Change expected
result to -2 in case of n == 0.
* tests-mbwc/tst_mbrtowc.c (tst_mbrtowc): Check result against
-2 instead of 0.
Joseph Myers [Fri, 10 Apr 2015 20:45:30 +0000 (20:45 +0000)]
Fix strtof decimal rounding close to half least subnormal (bug 18247).
Bug 18247 is an off-by-one error in strtof's determination of a
decimal exponent such that any value with that decimal exponent is at
most half the least subnormal and so the appropriate underflowing
value for the rounding mode can be determined with no
multiple-precision computations. (Whether the value is in fact safe
despite the off-by-one depends on the floating-point format in
question. It's wrong for float and for m68k ldbl-96 but not for other
supported formats.) This patch corrects the computation of the
exponent in question to be safe in general, adding a comment
explaining the new computation.
Tested for x86_64.
[BZ #18247]
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Decrease minimum
decimal exponent by 1.
* stdlib/tst-strtod-round-data: Add more tests.
* stdlib/tst-strtod-round.c (tests): Regenerated.
Joseph Myers [Thu, 9 Apr 2015 22:14:00 +0000 (22:14 +0000)]
Add more tests of clog and clog10.
This patch adds some randomly-generated tests of clog and clog10 that
are observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of clog and clog10.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Roland McGrath [Thu, 9 Apr 2015 21:42:29 +0000 (14:42 -0700)]
Omit libc-modules.h for all .v.i files.
Roland McGrath [Thu, 9 Apr 2015 20:55:11 +0000 (13:55 -0700)]
Let non-add-on preconfigure scripts set libc_config_ok.
Roland McGrath [Thu, 9 Apr 2015 18:15:17 +0000 (11:15 -0700)]
Make test-skeleton.c grok TEST_DIRECT magic environment variable.
Florian Weimer [Thu, 9 Apr 2015 15:12:42 +0000 (17:12 +0200)]
scratch_buffer: Suppress truncation warning on 32-bit
David S. Miller [Thu, 9 Apr 2015 03:34:49 +0000 (20:34 -0700)]
Update SPARC ulps.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
Joseph Myers [Wed, 8 Apr 2015 21:13:35 +0000 (21:13 +0000)]
Add more tests of atanh.
This patch adds some randomly-generated tests of atanh that are
observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of atanh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Wed, 8 Apr 2015 21:00:03 +0000 (21:00 +0000)]
Add more tests of atan.
This patch adds some randomly-generated tests of atan that are
observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of atan.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Florian Weimer [Wed, 8 Apr 2015 18:58:58 +0000 (20:58 +0200)]
nscd_getgr_r: Use struct scratch_buffer instead of extend_alloca
The lack of alloca accounting means that the old code could run out of
stack space if multiple retries are needed.
Florian Weimer [Wed, 8 Apr 2015 18:56:35 +0000 (20:56 +0200)]
getnameinfo: Use struct scratch_buffer instead of extend_alloca
This patch adjusts the internal function nrl_domainname, too.
Florian Weimer [Wed, 8 Apr 2015 18:55:02 +0000 (20:55 +0200)]
_nss_compat_initgroups_dyn: Use struct scratch_buffer instead of extend_alloca
Florian Weimer [Wed, 8 Apr 2015 18:51:34 +0000 (20:51 +0200)]
grp: Rewrite to use struct scratch_buffer instead of extend_alloca
grp/compat-initgroups.c is included from nscd/initgrcache.c, which is
why the #include directive has to be added there as well.
Florian Weimer [Wed, 8 Apr 2015 17:11:21 +0000 (19:11 +0200)]
pldd: Use struct scratch_buffer instead of extend_alloca
Joseph Myers [Wed, 8 Apr 2015 17:56:15 +0000 (17:56 +0000)]
Add more tests of cbrt.
This patch adds some randomly-generated tests of cbrt that are
observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of cbrt.
* math/auto-libm-test-out: Regenerated.
* sysdeps/x86_64/fpu/libm-test-ulps: Update.
Joseph Myers [Wed, 8 Apr 2015 17:46:07 +0000 (17:46 +0000)]
Add more tests of cabs.
This patch adds some randomly-generated tests of cabs that are
observed to increase ulps on x86_64.
Tested for x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add more tests of cabs.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Wed, 8 Apr 2015 17:32:17 +0000 (17:32 +0000)]
Fix dbl-64 atan2 in non-default rounding modes (bug 18210, bug 18211).
The dbl-64 implementation of atan2 does computations that expect to
run in round-to-nearest mode, and in other modes the errors can
accumulate to more than the maximum accepted 9ulp. This patch makes
it use FE_TONEAREST internally, similar to other functions with such
issues. Tests that previously produced large errors are added for
atan2 and the closely related carg, clog and clog10 functions.
Tested for x86_64 and x86 and ulps updated accordingly.
[BZ #18210]
[BZ #18211]
* sysdeps/ieee754/dbl-64/e_atan2.c: Include <fenv.h>.
(__ieee754_atan2): Set FE_TONEAREST mode for internal
computations.
* math/auto-libm-test-in: Add more tests of atan2, carg, clog and
clog10.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Wed, 8 Apr 2015 17:14:12 +0000 (17:14 +0000)]
Fix dbl-64 atan in non-default rounding modes (bug 18197).
The dbl-64 implementation of atan does computations that expect to run
in round-to-nearest mode, and in other modes the errors can accumulate
to more than the maximum accepted 9ulp. This patch makes it use
FE_TONEAREST internally, similar to other functions with such issues.
Tested for x86_64 and x86; no ulps updates needed.
[BZ #18197]
* sysdeps/ieee754/dbl-64/s_atan.c: Include <fenv.h>.
(atan): Set FE_TONEAREST mode for internal computations.
* math/auto-libm-test-in: Add more tests of atan.
* math/auto-libm-test-out: Regenerated.
James Cowgill [Tue, 7 Apr 2015 17:23:54 +0000 (17:23 +0000)]
[BZ #17930] MIPS: Define SHM_NORESERVE.
[BZ #17930]
* sysdeps/unix/sysv/linux/mips/bits/shm.h (SHM_NORESERVE): Define.
Florian Weimer [Tue, 7 Apr 2015 15:46:58 +0000 (17:46 +0200)]
scratch_buffer_grow_preserve: Add missing #include <string.h>
Florian Weimer [Tue, 7 Apr 2015 09:03:43 +0000 (11:03 +0200)]
Add struct scratch_buffer and its internal helper functions
These will be used from NSS modules, so they have to be exported.
Richard Henderson [Mon, 6 Apr 2015 17:43:59 +0000 (10:43 -0700)]
math/test-fenvinline: Cast fe_exc to unsigned int before printing
On Alpha and IA-64, fexcept_t is unsigned long. But all the values
fit within an int, so the cast is ok for printing. All other hosts
use unsigned int or unsigned short already.
Richard Henderson [Mon, 6 Apr 2015 17:38:16 +0000 (10:38 -0700)]
alpha: Update libm-test-ulps
Regenerated from scratch.
Richard Henderson [Mon, 6 Apr 2015 17:36:44 +0000 (10:36 -0700)]
alpha: Unconditionally include dl-sysdep.h in sysdep.h
Fixes a -Wundef error wrt RTLD_PRIVATE_ERRNO.
Ondřej Bílka [Fri, 3 Apr 2015 13:46:29 +0000 (15:46 +0200)]
Handle mblen return code when n is zero.
Florian Weimer [Thu, 2 Apr 2015 08:07:04 +0000 (10:07 +0200)]
Define libc_max_align_t for internal use
Andreas Schwab [Tue, 30 Sep 2014 10:41:11 +0000 (12:41 +0200)]
aarch64: Increase MINSIGSTKSZ and SIGSTKSZ (bug 16850)
Mel Gorman [Thu, 2 Apr 2015 06:44:14 +0000 (12:14 +0530)]
malloc: Consistently apply trim_threshold to all heaps [BZ #17195]
Trimming heaps is a balance between saving memory and the system overhead
required to update page tables and discard allocated pages. The malloc
option M_TRIM_THRESHOLD is a tunable that users are meant to use to decide
where this balance point is but it is only applied to the main arena.
For scalability reasons, glibc malloc has per-thread heaps but these are
shrunk with madvise() if there is one page free at the top of the heap.
In some circumstances this can lead to high system overhead if a thread
has a control flow like
while (data_to_process) {
buf = malloc(large_size);
do_stuff();
free(buf);
}
For a large size, the free() will call madvise (pagetable teardown, page
free and TLB flush) every time followed immediately by a malloc (fault,
kernel page alloc, zeroing and charge accounting). The kernel overhead
can dominate such a workload.
This patch allows the user to tune when madvise gets called by applying
the trim threshold to the per-thread heaps and using similar logic to the
main arena when deciding whether to shrink. Alternatively if the dynamic
brk/mmap threshold gets adjusted then the new values will be obeyed by
the per-thread heaps.
Bug 17195 was a test case motivated by a problem encountered in scientific
applications written in python that performance badly due to high page fault
overhead. The basic operation of such a program was posted by Julian Taylor
https://sourceware.org/ml/libc-alpha/2015-02/msg00373.html
With this patch applied, the overhead is eliminated. All numbers in this
report are in seconds and were recorded by running Julian's program 30
times.
pyarray
glibc madvise
2.21 v2
System min 1.81 ( 0.00%) 0.00 (100.00%)
System mean 1.93 ( 0.00%) 0.02 ( 99.20%)
System stddev 0.06 ( 0.00%) 0.01 ( 88.99%)
System max 2.06 ( 0.00%) 0.03 ( 98.54%)
Elapsed min 3.26 ( 0.00%) 2.37 ( 27.30%)
Elapsed mean 3.39 ( 0.00%) 2.41 ( 28.84%)
Elapsed stddev 0.14 ( 0.00%) 0.02 ( 82.73%)
Elapsed max 4.05 ( 0.00%) 2.47 ( 39.01%)
glibc madvise
2.21 v2
User 141.86 142.28
System 57.94 0.60
Elapsed 102.02 72.66
Note that almost a minutes worth of system time is eliminted and the
program completes 28% faster on average.
To illustrate the problem without python this is a basic test-case for
the worst case scenario where every free is a madvise followed by a an alloc
/* gcc bench-free.c -lpthread -o bench-free */
static int num = 1024;
void __attribute__((noinline,noclone)) dostuff (void *p)
{
}
void *worker (void *data)
{
int i;
for (i = num; i--;)
{
void *m = malloc (48*4096);
dostuff (m);
free (m);
}
return NULL;
}
int main()
{
int i;
pthread_t t;
void *ret;
if (pthread_create (&t, NULL, worker, NULL))
exit (2);
if (pthread_join (t, &ret))
exit (3);
return 0;
}
Before the patch, this resulted in 1024 calls to madvise. With the patch applied,
madvise is called twice because the default trim threshold is high enough to avoid
this.
This a more complex case where there is a mix of frees. It's simply a different worker
function for the test case above
void *worker (void *data)
{
int i;
int j = 0;
void *free_index[num];
for (i = num; i--;)
{
void *m = malloc ((i % 58) *4096);
dostuff (m);
if (i % 2 == 0) {
free (m);
} else {
free_index[j++] = m;
}
}
for (; j >= 0; j--)
{
free(free_index[j]);
}
return NULL;
}
glibc 2.21 calls malloc 90305 times but with the patch applied, it's
called 13438. Increasing the trim threshold will decrease the number of
times it's called with the option of eliminating the overhead.
ebizzy is meant to generate a workload resembling common web application
server workloads. It is threaded with a large working set that at its core
has an allocation, do_stuff, free loop that also hits this case. The primary
metric of the benchmark is records processed per second. This is running on
my desktop which is a single socket machine with an I7-4770 and 8 cores.
Each thread count was run for 30 seconds. It was only run once as the
performance difference is so high that the variation is insignificant.
glibc 2.21 patch
threads 1 10230 44114
threads 2 19153 84925
threads 4 34295 134569
threads 8 51007 183387
Note that the saving happens to be a concidence as the size allocated
by ebizzy was less than the default threshold. If a different number of
chunks were specified then it may also be necessary to tune the threshold
to compensate
This is roughly quadrupling the performance of this benchmark. The difference in
system CPU usage illustrates why.
ebizzy running 1 thread with glibc 2.21
10230 records/s 306904
real 30.00 s
user 7.47 s
sys 22.49 s
22.49 seconds was spent in the kernel for a workload runinng 30 seconds. With the
patch applied
ebizzy running 1 thread with patch applied
44126 records/s 1323792
real 30.00 s
user 29.97 s
sys 0.00 s
system CPU usage was zero with the patch applied. strace shows that glibc
running this workload calls madvise approximately 9000 times a second. With
the patch applied madvise was called twice during the workload (or 0.06
times per second).
2015-02-10 Mel Gorman <mgorman@suse.de>
[BZ #17195]
* malloc/arena.c (free): Apply trim threshold to per-thread heaps
as well as the main arena.
H.J. Lu [Tue, 31 Mar 2015 20:17:51 +0000 (13:17 -0700)]
Limit threads sharing L2 cache to 2 for SLM/KNL
Silvermont and Knights Landing have a modular system design with two cores
sharing an L2 cache. If more than 2 cores are detected to shared L2 cache,
it should be adjusted for Silvermont and Knights Landing.
[BZ #18185]
* sysdeps/x86_64/cacheinfo.c (init_cacheinfo): Limit threads
sharing L2 cache to 2 for Silvermont/Knights Landing.
H.J. Lu [Tue, 31 Mar 2015 12:20:55 +0000 (05:20 -0700)]
Add a testcase for copy reloc against protected data
Linkers in some versions of binutils 2.25 and 2.26 don't support protected
data symbol with error messsage like:
/usr/bin/ld: copy reloc against protected `bar' is invalid
/usr/bin/ld: failed to set dynamic section sizes: Bad value
We check if linker supports copy reloc against protected data symbol to
avoid running the test if linker is broken.
[BZ #17711]
* config.make.in (have-protected-data): New.
* configure.ac: Check linker support for protected data symbol.
* configure: Regenerated.
* elf/Makefile (modules-names): Add tst-protected1moda and
tst-protected1modb if $(have-protected-data) is yes.
(tests): Add tst-protected1a and tst-protected1b if
$(have-protected-data) is yes.
($(objpfx)tst-protected1a): New.
($(objpfx)tst-protected1b): Likewise.
(tst-protected1modb.so-no-z-defs): Likewise.
* elf/tst-protected1a.c: New file.
* elf/tst-protected1b.c: Likewise.
* elf/tst-protected1mod.h: Likewise.
* elf/tst-protected1moda.c: Likewise.
* elf/tst-protected1modb.c: Likewise.
H.J. Lu [Tue, 31 Mar 2015 12:15:43 +0000 (05:15 -0700)]
Add ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA to x86
With copy relocation, address of protected data defined in the shared
library may be external. When there is a relocation against the
protected data symbol within the shared library, we need to check if we
should skip the definition in the executable copied from the protected
data. This patch adds ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA and defines
it for x86. If ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA isn't 0, do_lookup_x
will skip the data definition in the executable from copy reloc.
[BZ #17711]
* elf/dl-lookup.c (do_lookup_x): When UNDEF_MAP is NULL, which
indicates it is called from do_lookup_x on relocation against
protected data, skip the data definion in the executable from
copy reloc.
(_dl_lookup_symbol_x): Pass ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA,
instead of ELF_RTYPE_CLASS_PLT, to do_lookup_x for
EXTERN_PROTECTED_DATA relocation against STT_OBJECT symbol.
* sysdeps/generic/ldsodefs.h * (ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA):
New. Defined to 4 if DL_EXTERN_PROTECTED_DATA is defined,
otherwise to 0.
* sysdeps/i386/dl-lookupcfg.h (DL_EXTERN_PROTECTED_DATA): New.
* sysdeps/i386/dl-machine.h (elf_machine_type_class): Set class
to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for R_386_GLOB_DAT.
* sysdeps/x86_64/dl-lookupcfg.h (DL_EXTERN_PROTECTED_DATA): New.
* sysdeps/x86_64/dl-machine.h (elf_machine_type_class): Set class
to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for R_X86_64_GLOB_DAT.
Martin Galvan [Sat, 28 Mar 2015 04:41:35 +0000 (01:41 -0300)]
NPTL: Remove duplicate definition of PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
The PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP macro was defined twice with the
same values in pthread.h; this removes the second definition.