| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
The call is technically in a loop, and under certain circumstances
(which are quite difficult to reproduce in a test case), alloca
can be invoked repeatedly during a single call to clntudp_call.
As a result, the available stack space can be exhausted (even
though individual alloca sizes are bounded implicitly by what
can fit into a UDP packet, as a side effect of the earlier
successful send operation).
|
|
|
|
|
|
| |
Instead, we store the data we need from the return value of
readdir in an object of the new type struct readdir_result.
This type is independent of the layout of struct dirent.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
https://sourceware.org/glibc/wiki/Proposals/GroupMerging
== Justification ==
It is common today for users to rely on centrally-managed user stores for
handling their user accounts. However, much software existing today does
not have an innate understanding of such accounts. Instead, they commonly
rely on membership in known groups for managing access-control (for
example the "wheel" group on Fedora and RHEL systems or the "adm" group
on Debian-derived systems). In the present incarnation of nsswitch, the
only way to have such groups managed by a remote user store such as
FreeIPA or Active Directory would be to manually remove the groups from
/etc/group on the clients so that nsswitch would then move past nss_files
and into the SSSD, nss-ldap or other remote user database.
== Solution ==
With this patch, a new action is introduced for nsswitch:
NSS_ACTION_MERGE. To take advantage of it, one will add [SUCCESS=merge]
between two database entries in the nsswitch.conf file. When a group is
located in the first of the two group entries, processing will continue
on to the next one. If the group is also found in the next entry (and the
group name and GID are an exact match), the member list of the second
entry will be added to the group object to be returned.
== Implementation ==
After each DL_LOOKUP_FN() returns, the next action is checked. If the
function returned NSS_STATUS_SUCCESS and the next action is
NSS_ACTION_MERGE, a copy of the result buffer is saved for the next pass
through the loop. If on this next pass through the loop the database
returns another instance of a group matching both the group name and GID,
the member list is added to the previous list and it is returned as a
single object. If the following database does not contain the same group,
then the original is copied back into the destination buffer.
This patch implements merge functionality only for the group database.
For other databases, there is a default implementation that will return
the EINVAL errno if a merge is requested. The merge functionality can be
implemented for other databases at a later time if such is needed. Each
database must provide a unique implementation of the deep-copy and merge
functions.
If [SUCCESS=merge] is present in nsswitch.conf for a glibc version that
does not support it, glibc will process results up until that operation,
at which time it will return results if it has found them or else will
simply return an error. In practical terms, this ends up behaving like
the remainder of the nsswitch.conf line does not exist.
== Iterators ==
This feature does not modify the iterator functionality from its current
behavior. If getgrnam() or getgrgid() is called, glibc will iterate
through all entries in the `group` line in nsswitch.conf and display the
list of members without attempting to merge them. This is consistent with
the behavior of nss_files where if two separate lines are specified for
the same group in /etc/groups, getgrnam()/getgrgid() will display both.
Clients are already expected to handle this gracefully.
== No Premature Optimizations ==
The following is a list of places that might be eligible for
optimization, but were not overengineered for this initial contribution:
* Any situation where a merge may occur will result in one malloc() of
the same size as the input buffer.
* Any situation where a merge does occur will result in a second
malloc() to hold the list of pointers to member name strings.
* The list of members is simply concatenated together and is not tested
for uniqueness (which is identical to the behavior for nss_files,
which will simply return identical values if they both exist on the
line in the file. This could potentially be optimized to reduce space
usage in the buffer, but it is both complex and computationally
expensive to do so.
== Testing ==
I performed testing by running the getent utility against my newly-built
glibc and configuring /etc/nsswitch.conf with the following entry:
group: group: files [SUCCESS=merge] sss
In /etc/group I included the line:
wheel:x:10:sgallagh
I then configured my local SSSD using the id_provider=local to respond
with:
wheel:*:10:localuser,localuser2
I then ran `getent group wheel` against the newly-built glibc in
multiple situations and received the expected output as described
above:
* When SSSD was running.
* When SSSD was configured in nsswitch.conf but the daemon was not
running.
* When SSSD was configured in nsswitch.conf but nss_sss.so.2 was not
installed on the system.
* When the order of 'sss' and 'files' was reversed.
* All of the above with the [SUCCESS=merge] removed (to ensure no
regressions).
* All of the above with `getent group 10`.
* All of the above with `getent group` with and without
`enumerate=true` set in SSSD.
* All of the above with and without nscd enabled on the system.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
When converting a struct hostent response to struct gaih_addrtuple, the
gethosts macro (which is called from gaih_inet) used alloca, without
malloc fallback for large responses. This commit changes this code to
use calloc unconditionally.
This commit also consolidated a second hostent-to-gaih_addrtuple
conversion loop (in gaih_inet) to use the new conversion function.
|
|
|
|
|
|
|
| |
The overloading approach in the W* macros was incompatible with
integer expressions of a type different from int. Applications
using union wait and these macros will have to migrate to the
POSIX-specified int status type.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In <https://sourceware.org/ml/libc-alpha/2016-01/msg00885.html> I
proposed a minimum Linux kernel version of 3.2 for glibc 2.24, since
Linux 2.6.32 has reached EOL.
In the discussion in February, some concerns were expressed about
compatibility with OpenVZ containers. It's not clear that these are
real issues, given OpenVZ backporting kernel features and faking the
kernel version for guest software, as discussed in
<https://sourceware.org/ml/libc-alpha/2016-02/msg00278.html>. It's
also not clear that supporting running GNU/Linux distributions from
late 2016 (at the earliest) on a kernel series from 2009 is a sensible
expectation. However, as an interim step, this patch increases the
requirement everywhere except x86 / x86_64 (since the controversy was
only about those architectures); the special caveats and settings can
easily be removed later when we're ready to increase the requirements
on x86 / x86_64 (and if someone would like to raise the issue on LWN
as suggested in the previous discussion, that would be welcome). 3.2
kernel headers are required everywhere by this patch.
(x32 already requires 3.4 or later, so is unaffected by this patch.)
As usual for such a change, this patch only changes the configure
scripts and associated documentation. The intent is to follow up with
removal of dead __LINUX_KERNEL_VERSION conditionals. Each __ASSUME_*
or other macro that becomes dead can then be removed independently.
Tested for x86_64 and x86.
* sysdeps/unix/sysv/linux/configure.ac (LIBC_LINUX_VERSION):
Define to 3.2.0.
(arch_minimum_kernel): Likewise.
* sysdeps/unix/sysv/linux/configure: Regenerated.
* sysdeps/unix/sysv/linux/i386/configure.ac (arch_minimum_kernel):
Define to 2.6.32.
* sysdeps/unix/sysv/linux/i386/configure: Regenerated.
* sysdeps/unix/sysv/linux/x86_64/64/configure.ac
(arch_minimum_kernel): Define to 2.6.32.
* sysdeps/unix/sysv/linux/x86_64/64/configure: Regenerated.
* README: Document Linux 3.2 requirement.
* manual/install.texi (Linux): Document Linux 3.2 headers
requirement.
* INSTALL: Regenerated.
|
| |
|
|
|
|
|
|
|
|
|
| |
From the bug:
Netherlands Antilles was dissolved, and "AN" is not a part of ISO 3166
anymore. According to setlocale(3), "territory is an ISO 3166 country
code". We now have pap_AW and pap_CW.
Reported-by: Chris Leonard <cjlhomeaddress@gmail.com>
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* A stack-based buffer overflow was found in libresolv when invoked from
libnss_dns, allowing specially crafted DNS responses to seize control
of execution flow in the DNS client. The buffer overflow occurs in
the functions send_dg (send datagram) and send_vc (send TCP) for the
NSS module libnss_dns.so.2 when calling getaddrinfo with AF_UNSPEC
family. The use of AF_UNSPEC triggers the low-level resolver code to
send out two parallel queries for A and AAAA. A mismanagement of the
buffers used for those queries could result in the response of a query
writing beyond the alloca allocated buffer created by
_nss_dns_gethostbyname4_r. Buffer management is simplified to remove
the overflow. Thanks to the Google Security Team and Red Hat for
reporting the security impact of this issue, and Robert Holiday of
Ciena for reporting the related bug 18665. (CVE-2015-7547)
See also:
https://sourceware.org/ml/libc-alpha/2016-02/msg00416.html
https://sourceware.org/ml/libc-alpha/2016-02/msg00418.html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've updated copyright dates in glibc for 2016. This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.
* NEWS: Update copyright dates.
* catgets/gencat.c (print_version): Likewise.
* csu/version.c (banner): Likewise.
* debug/catchsegv.sh: Likewise.
* debug/pcprofiledump.c (print_version): Likewise.
* debug/xtrace.sh (do_version): Likewise.
* elf/ldconfig.c (print_version): Likewise.
* elf/ldd.bash.in: Likewise.
* elf/pldd.c (print_version): Likewise.
* elf/sotruss.sh: Likewise.
* elf/sprof.c (print_version): Likewise.
* iconv/iconv_prog.c (print_version): Likewise.
* iconv/iconvconfig.c (print_version): Likewise.
* locale/programs/locale.c (print_version): Likewise.
* locale/programs/localedef.c (print_version): Likewise.
* login/programs/pt_chown.c (print_version): Likewise.
* malloc/memusage.sh (do_version): Likewise.
* malloc/memusagestat.c (print_version): Likewise.
* malloc/mtrace.pl: Likewise.
* manual/libc.texinfo: Likewise.
* nptl/version.c (banner): Likewise.
* nscd/nscd.c (print_version): Likewise.
* nss/getent.c (print_version): Likewise.
* nss/makedb.c (print_version): Likewise.
* posix/getconf.c (main): Likewise.
* scripts/test-installation.pl: Likewise.
* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
|
| |
|
|
|
|
|
| |
This amends commit 34a9094f49241ebb72084c536cf468fd51ebe3ec
that erroneously mentions number 11869 instead of 11884.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Various Linux kernel syscalls have become obsolete over time.
Specifically, the following are obsolete in all kernel versions
supported by glibc, are not present for architectures more recently
added to the kernel, and as such, the wrapper functions for them
should be compat symbols, not in static libc and not available for new
links with shared libc.
* bdflush: in Linux 2.6, does nothing if present.
* create_module get_kernel_syms query_module: Linux 2.4 module
interface, syscalls not present in Linux 2.6.
* uselib: part of the mechanism for loading a.out shared libraries,
irrelevant with ELF.
This patch adds support for syscalls.list to list syscall aliases of
the form NAME@VERSION:OBSOLETED, with SHLIB_COMPAT conditionals being
generated for such aliases. Those five syscalls are then made into
compat symbols (obsoleted in glibc 2.23, so future ports won't have
these symbols at all), with the header <sys/kdaemon.h> declaring
bdflush being removed. When we move to 3.2 as minimum kernel version,
the same can be done for nfsservctl (removed in Linux 3.1) as well.
Tested for x86_64 and x86 (testsuite, as well as checking that the
symbols in question indeed become compat symbols, that they are indeed
omitted from static libc, and that the generated SHLIB_COMPAT
conditionals look right).
[BZ #18472]
* sysdeps/unix/Makefile ($(objpfx)stub-syscalls.c): Handle entries
for the form NAME@VERSION:OBSOLETED and generate SHLIB_COMPAT
conditionals for them.
* sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Likewise.
* sysdeps/unix/sysv/linux/sys/kdaemon.h: Remove file.
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Remove
sys/kdaemon.h.
* sysdeps/unix/sysv/linux/syscalls.list (bdflush): Make into
compat-only syscall, obsoleted in glibc 2.23.
(create_module): Likewise.
(get_kernel_syms): Likewise.
(query_module): Likewise.
(uselib): Likewise.
* manual/sysinfo.texi (System Parameters): Do not mention bdflush.
|
|
|
|
|
|
| |
Update __STDC_ISO_10646__ to 201505L for Unicode 8.0.0.
Update character encoding, ctype, and transliteration tables.
New scripts autogenerate transliteration tables.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The nan, nanf and nanl functions handle payload strings by doing e.g.:
if (tagp[0] != '\0')
{
char buf[6 + strlen (tagp)];
sprintf (buf, "NAN(%s)", tagp);
return strtod (buf, NULL);
}
This is an unbounded stack allocation based on the length of the
argument. Furthermore, if the argument starts with an n-char-sequence
followed by ')', that n-char-sequence is wrongly treated as
significant for determining the payload of the resulting NaN, when ISO
C says the call should be equivalent to strtod ("NAN", NULL), without
being affected by that initial n-char-sequence. This patch fixes both
those problems by using the __strtod_nan etc. functions recently
factored out of strtod etc. for that purpose, with those functions
being exported from libc at version GLIBC_PRIVATE.
Tested for x86_64, x86, mips64 and powerpc.
[BZ #16961]
[BZ #16962]
* math/s_nan.c (__nan): Use __strtod_nan instead of constructing a
string on the stack for strtod.
* math/s_nanf.c (__nanf): Use __strtof_nan instead of constructing
a string on the stack for strtof.
* math/s_nanl.c (__nanl): Use __strtold_nan instead of
constructing a string on the stack for strtold.
* stdlib/Versions (libc): Add __strtof_nan, __strtod_nan and
__strtold_nan to GLIBC_PRIVATE.
* math/test-nan-overflow.c: New file.
* math/test-nan-payload.c: Likewise.
* math/Makefile (tests): Add test-nan-overflow and
test-nan-payload.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With current kernel versions, the check does not reliably detect that
unavailable CPUs are requested, for these reasons:
(1) The kernel will silently ignore non-allowed CPUs, that is, CPUs
which are physically present but disallowed for the thread
based on system configuration.
(2) Similarly, CPU bits which lack an online CPU (possible CPUs)
are ignored.
(3) The existing probing code assumes that the CPU mask size is a
power of two and at least 1024. Neither has it to be a power
of two, nor is the minimum possible value 1024, so the value
determined is often too large. This means that the CPU set
size check in glibc accepts CPU bits beyond the actual hard
system limit.
(4) Future kernel versions may not even have a fixed CPU set size.
After the removal of the probing code, the kernel still returns
EINVAL if no CPU in the requested set remains which can run the
thread after the affinity change.
Applications which care about the exact affinity mask will have
to query it using sched_getaffinity after setting it. Due to the
effects described above, this commit does not change this.
The new tests supersede tst-getcpu, which is removed. This
addresses bug 19164 because the new tests allocate CPU sets
dynamically.
* nptl/check-cpuset.h: Remove.
* nptl/pthread_attr_setaffinity.c (__pthread_attr_setaffinity_new):
Remove CPU set size check.
* nptl/pthread_setattr_default_np.c (pthread_setattr_default_np):
Likewise.
* sysdeps/unix/sysv/linux/check-cpuset.h: Remove.
* sysdeps/unix/sysv/linux/pthread_setaffinity.c
(__kernel_cpumask_size, __determine_cpumask_size): Remove.
(__pthread_setaffinity_new): Remove CPU set size check.
* sysdeps/unix/sysv/linux/sched_setaffinity.c
(__kernel_cpumask_size): Remove.
(__sched_setaffinity_new): Remove CPU set size check.
* manual/threads.texi (Default Thread Attributes): Remove stale
reference to check_cpuset_attr, determine_cpumask_size in comment.
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == posix] (tests):
Remove tst-getcpu. Add tst-affinity, tst-affinity-pid.
[$(subdir) == nptl] (tests): Add tst-thread-affinity-pthread,
tst-thread-affinity-pthread2, tst-thread-affinity-sched.
* sysdeps/unix/sysv/linux/tst-affinity.c: New file.
* sysdeps/unix/sysv/linux/tst-affinity-pid.c: New file.
* sysdeps/unix/sysv/linux/tst-skeleton-affinity.c: New skeleton test file.
* sysdeps/unix/sysv/linux/tst-thread-affinity-sched.c: New file.
* sysdeps/unix/sysv/linux/tst-thread-affinity-pthread.c: New file.
* sysdeps/unix/sysv/linux/tst-thread-affinity-pthread2.c: New file.
* sysdeps/unix/sysv/linux/tst-thread-skeleton-affinity.c: New
skeleton test file.
* sysdeps/unix/sysv/linux/tst-getcpu.c: Remove. Superseded by
tst-affinity-pid.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lgamma (and likewise lgammaf, lgammal) function wrongly sets the
signgam variable even when building for strict ISO C conformance
(-std=c99 / -std=c11), although the user may define such a variable
and it's only in the implementation namespace for POSIX with XSI
extensions enabled.
Following discussions starting at
<https://sourceware.org/ml/libc-alpha/2013-04/msg00767.html> and
<https://sourceware.org/ml/libc-alpha/2015-10/msg00844.html>, it seems
that the safest approach for fixing this particular issue is for
signgam to become a weak alias for a newly exported symbol __signgam,
with the library functions only setting __signgam, at which point
static linker magic will preserve the alias for newly linked binaries
that refer to the library's signgam rather than defining their own,
while breaking the alias for programs that define their own signgam,
with new symbol versions for lgamma functions and with compat symbols
for existing binaries that set both signgam and __signgam.
This patch implements that approach for the fix. signgam is made into
a weak alias. The four symbols __signgam, lgamma, lgammaf, lgammal
get new symbol versions at version GLIBC_2.23, with the existing
versions of lgamma, lgammaf and lgammal becoming compat symbols.
When the compat versions are built, gamma, gammaf and gammal are
aliases for the compat versions (i.e. always set signgam); this is OK
as they are not ISO C functions, and avoids adding new symbol versions
for them unnecessarily. When the compat versions are not built
(i.e. for static linking and for future glibc ports), gamma, gammaf
and gammal are aliases for the new versions that set __signgam. The
ldbl-opt versions are updated accordingly.
The lgamma wrappers are adjusted so that the same source files,
included from different files with different definitions of
USE_AS_COMPAT, can build either the new versions or the compat
versions. Similar changes are made to the ia64 versions (untested).
Tests are added that the lgamma functions do not interfere with a user
variable called signgam for ISO C, with various choices for the size
of that variable, whether it is initialized, and for static and
dynamic linking. The conformtest whitelist entry is removed as well.
Tested for x86_64, x86, mips64 and powerpc, including looking at
objdump --dynamic-syms output to make sure the expected sets of
symbols were aliases. Also spot-tested that a binary built with old
glibc works properly (i.e. gets signgam set) when run with new glibc.
[BZ #15421]
* sysdeps/ieee754/s_signgam.c (signgam): Rename to __signgam,
initialize with 0 and define as weak alias of __signgam.
* include/math.h [!_ISOMAC] (__signgam): Declare.
* math/Makefile (libm-calls): Add w_lgamma_compat.
(tests): Add test-signgam-uchar, test-signgam-uchar-init,
test-signgam-uint, test-signgam-uint-init, test-signgam-ullong and
test-signgam-ullong-init.
(tests-static): Add test-signgam-uchar-static,
test-signgam-uchar-init-static, test-signgam-uint-static,
test-signgam-uint-init-static, test-signgam-ullong-static and
test-signgam-ullong-init-static.
(CFLAGS-test-signgam-uchar.c): New variable.
(CFLAGS-test-signgam-uchar-init.c): Likewise.
(CFLAGS-test-signgam-uchar-static.c): Likewise.
(CFLAGS-test-signgam-uchar-init-static.c): Likewise.
(CFLAGS-test-signgam-uint.c): Likewise.
(CFLAGS-test-signgam-uint-init.c): Likewise.
(CFLAGS-test-signgam-uint-static.c): Likewise.
(CFLAGS-test-signgam-uint-init-static.c): Likewise.
(CFLAGS-test-signgam-ullong.c): Likewise.
(CFLAGS-test-signgam-ullong-init.c): Likewise.
(CFLAGS-test-signgam-ullong-static.c): Likewise.
(CFLAGS-test-signgam-ullong-init-static.c): Likewise.
* math/Versions (libm): Add GLIBC_2.23.
* math/lgamma-compat.h: New file.
* math/test-signgam-main.c: Likewise.
* math/test-signgam-uchar-init-static.c: Likewise.
* math/test-signgam-uchar-init.c: Likewise.
* math/test-signgam-uchar-static.c: Likewise.
* math/test-signgam-uchar.c: Likewise.
* math/test-signgam-uint-init-static.c: Likewise.
* math/test-signgam-uint-init.c: Likewise.
* math/test-signgam-uint-static.c: Likewise.
* math/test-signgam-uint.c: Likewise.
* math/test-signgam-ullong-init-static.c: Likewise.
* math/test-signgam-ullong-init.c: Likewise.
* math/test-signgam-ullong-static.c: Likewise.
* math/test-signgam-ullong.c: Likewise.
* math/w_lgamma.c: Rename to w_lgamma_main.c and replace by
wrapper of w_lgamma_main.c.
* math/w_lgamma_compat.c: New file.
* math/w_lgamma_compatf.c: Likewise.
* math/w_lgamma_compatl.c: Likewise.
* math/w_lgamma_main.c: New file. Based on w_lgamma.c. Include
<lgamma-compat.h>. Condition contents on [BUILD_LGAMMA]. Support
defining compatibility symbols.
(__lgamma): Change to LGFUNC (__lgamma). Use CALL_LGAMMA.
* math/w_lgammaf.c: Rename to w_lgammaf_main.c and replace by
wrapper of w_lgammaf_main.c.
* math/w_lgammaf_main.c: New file. Based on w_lgammaf.c. Include
<lgamma-compat.h>. Condition contents on [BUILD_LGAMMA]. Support
defining compatibility symbols.
(__lgammaf): Change to LGFUNC (__lgammaf). Use CALL_LGAMMA.
* math/w_lgammal.c: Rename to w_lgammal_main.c and replace by
wrapper of w_lgammal_main.c.
* math/w_lgammal_main.c: New file. Based on w_lgammal.c. Include
<lgamma-compat.h>. Condition contents on [BUILD_LGAMMA]. Support
defining compatibility symbols.
(__lgammal): Change to LGFUNC (__lgammal). Use CALL_LGAMMA.
* sysdeps/ia64/fpu/lgamma-compat.h: New file.
* sysdeps/ia64/fpu/w_lgamma.c: Move to ....
* sysdeps/ia64/fpu/w_lgamma_main.c: ...here. Include
<lgamma-compat.h>.
(__ieee754_lgamma): Change to LGFUNC (lgamma). Use CALL_LGAMMA.
(__ieee754_gamma): Define as alias.
* sysdeps/ia64/fpu/w_lgammaf.c: Move to ....
* sysdeps/ia64/fpu/w_lgammaf_main.c: ...here. Include
<lgamma-compat.h>.
(__ieee754_lgammaf): Change to LGFUNC (lgammaf). Use CALL_LGAMMA.
(__ieee754_gammaf): Define as alias.
* sysdeps/ia64/fpu/w_lgammal.c: Move to ....
* sysdeps/ia64/fpu/w_lgammal_main.c: ...here. Include
<lgamma-compat.h>.
(__ieee754_lgammal): Change to LGFUNC (lgammal). Use CALL_LGAMMA.
(__ieee754_gammal): Define as alias.
* sysdeps/ieee754/ldbl-opt/w_lgamma.c: Move to ....
* sysdeps/ieee754/ldbl-opt/w_lgamma_compat.c: ...here. Include
<math/w_lgamma_compat.c>.
[LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (__lgammal_dbl_compat):
Define as alias of __lgamma_compat and use in defining lgammal.
* sysdeps/ieee754/ldbl-opt/w_lgammal.c: Move to ....
* sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c: ...here. Include
<math/lgamma-compat.h> and <math/w_lgamma_compatl.c>.
(USE_AS_COMPAT): New macro.
(LGAMMA_OLD_VER): Undefine and redefine.
(lgammal): Do not define here.
(gammal): Only define here if [GAMMA_ALIAS].
* conform/linknamespace.pl (@whitelist): Remove signgam.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The recvmsg system calls for netlink sockets have been particularly
prone to picking up unrelated data after a file descriptor race
(where the descriptor is closed and reopened concurrently in a
multi-threaded process, as the result of a file descriptor
management issue elsewhere). This commit adds additional error
checking and aborts the process if a datagram of unexpected length
(without the netlink header) is received, or an error code which
cannot happen due to the way the netlink socket is used.
[BZ #12926]
Terminate process on invalid netlink response.
* sysdeps/unix/sysv/linux/netlinkaccess.h
(__netlink_assert_response): Declare.
* sysdeps/unix/sysv/linux/netlink_assert_response.c: New file.
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == inet]
(sysdep_routines): Add netlink_assert_response.
* sysdeps/unix/sysv/linux/check_native.c (__check_native): Call
__netlink_assert_response.
* sysdeps/unix/sysv/linux/check_pf.c (make_request): Likewise.
* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Likewise.
* sysdeps/unix/sysv/linux/Versions (GLIBC_PRIVATE): Add
__netlink_assert_response.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fts didn't have large-file support yet and fts.h had an #error preventing
usage when _FILE_OFFSET_BITS was set. This required nasty workarounds for
programs using fts with LFS. This patch implements LFS support for fts by
adding FTS64 and FTENT64 variants plus fts64 functions. Which are simple
aliases for 64bit off_t arches.
Also includes a simple testcase for some of the fts functions with or
without LFS enabled.
[BZ #11460]
* io/Makefile (routines): Add fts64.
(tests): Add tst-fts and tst-fts-lfs.
(CFLAGS-fts64.c): New.
* io/Versions (GLIBC_2.23): New.
* io/fts.c: Replace FTS with FTSOBJ, FTSENT with FTSENTRY. Use
function defines FTS_OPEN, FTS_CLOSE, FTS_READ, FTS_SET and
FTS_CHILDREN. Define FTSOBJ, FTSENTRY, FTS_OPEN, FTS_CLOSE,
FTS_READ, FTS_SET, FTS_CHILDREN, INO_T, STAT and LSTAT if necessary.
* io/fts.h (FTS64): New if _USE_LARGEFILE64.
(FTSENT64): Likewise.
(fts64_children): Likewise.
(fts64_close): Likewise.
(fts64_open): Likewise.
(fts64_read): Likewise.
(fts64_set): Likewise.
* io/fts64.c: New file.
* io/tst-fts.c: New test.
* io/tst-fts-lfs.c: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.23): Add
GLIBC_2.23, fts64_children, fts64_close, fts64_open, fts64_read and
fts64_set.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* sysdeps/wordsize-64/fts.c: New file.
* sysdeps/wordsize-64/fts64.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/fts.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/fts64.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/fts.c: likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/fts64.c: likewise.
|
|
|
|
|
|
|
|
|
|
| |
This patch adds a script to list fixed bugs for the NEWS file, as
proposed in
<https://sourceware.org/ml/libc-alpha/2015-10/msg01043.html>, with the
bugs listed in the format proposed in
<https://sourceware.org/ml/libc-alpha/2015-11/msg00088.html>.
* scripts/list-fixed-bugs.py: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For the -ffinite-math-only versions of various x86_64 and x86 log*
functions, a zero result from log* (1) is returned with incorrect sign
in round-downward mode. This patch fixes this in a similar way to the
previous fixes for the non-*_finite versions of the functions.
Tested for x86_64 and x86 (including an i586 build), together with a
patch that will be applied separately to enable the main libm-test.inc
tests for the finite-math-only functions.
[BZ #19213]
* sysdeps/i386/fpu/e_log.S (__log_finite): Ensure +0 is always
returned for argument 1.
* sysdeps/i386/fpu/e_logf.S (__logf_finite): Likewise.
* sysdeps/i386/fpu/e_logl.S (__logl_finite): Likewise.
* sysdeps/i386/i686/fpu/e_logl.S (__logl_finite): Likewise.
* sysdeps/x86_64/fpu/e_log10l.S (__log10l_finite): Likewise.
* sysdeps/x86_64/fpu/e_log2l.S (__log2l_finite): Likewise.
* sysdeps/x86_64/fpu/e_logl.S (__logl_finite): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lgamma inline functions in bits/math-finite.h do not set signgam
if __USE_ISOC99, even when other feature test macros mean a standard
such as XSI POSIX is selected for which it should be set. (This is
essentially the opposite issue to bug 15421, the out-of-line versions
setting signgam even when they shouldn't.)
This patch fixes those functions to use __USE_MISC || __USE_XOPEN as
the condition for when to set signgam, since it's the condition for
when math.h declares signgam. The legacy gamma* names are only
declared at all if __USE_MISC || __USE_XOPEN, so they just set signgam
unconditionally.
Tests for certain standards or not using _GNU_SOURCE cannot use
test-skeleton.c (this is a known issue noted on the wiki todo list).
Thus, the new tests that signgam remains not set in ISO C modes do not
use test-skeleton.c. They also define _ISOMAC to avoid running into
declarations in the internal include/ headers that only work in
_GNU_SOURCE mode.
Tested for x86_64 and x86.
[BZ #19211]
* math/bits/math-finite.h (lgamma): Set signgam if [__USE_MISC ||
__USE_XOPEN], not if [!__USE_ISOC99].
(lgammaf): Likewise.
(lgammal): Likewise.
(gamma): Set signgam unconditionally, not if [!__USE_ISOC99].
(gammaf): Likewise.
(gammal): Likewise.
* math/test-signgam-finite-c11.c: New file.
* math/test-signgam-finite-c99.c: Likewise.
* math/test-signgam-finite.c: Likewise.
* math/Makefile (tests): Add test-signgam-finite,
test-signgam-finite-c99 and test-signgam-finite-c11.
(CFLAGS-test-signgam-finite.c): New variable.
(CFLAGS-test-signgam-finite-c99.c): Likewise.
(CFLAGS-test-signgam-finite-c11.c): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
features.h is not clean with -Wundef (for the installed header, of
course this only appears with -Wsystem-headers). In ISO C standards
modes, you get a series of warnings / errors relating to
_POSIX_C_SOURCE and _XOPEN_SOURCE not being defined when tested in
standards mode and uses #undef _GNU_SOURCE to avoid the default
_GNU_SOURCE from libc-symbols.h. This patch changes the relevant #if
conditionals to avoid these warnings / errors.
Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).
[BZ #19212]
* include/features.h [(_XOPEN_SOURCE - 0) >= 500]: Change
conditional to [defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >=
500].
[_POSIX_C_SOURCE >= 1]: Change conditional to [defined
_POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1].
[(_POSIX_C_SOURCE - 0) >= 199309L]: Change conditional to [defined
_POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L].
[(_POSIX_C_SOURCE - 0) >= 199506L]: Change conditional to [defined
_POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L].
[(_POSIX_C_SOURCE - 0) >= 200112L]: Change conditional to [defined
_POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L].
[(_POSIX_C_SOURCE - 0) >= 200809L]: Change conditional to [defined
_POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bits/math-finite.h maps ldexp functions to corresponding scalbn
functions. This is (a) a namespace bug for C90, which has ldexp but
not scalbn, and (b) in any case useless, since the ldexp and scalbn
functions have identical semantics (for floating-point types with
radix 2), and since the fix for bug 6803 are actually aliases
(presumably the mapping was based around the old bug of scalbn not
setting errno). This patch removes the bogus redirections.
Tested for x86_64 and x86.
[BZ #19209]
* math/bits/math-finite.h (ldexp): Remove declaration.
(ldexpf): Likewise.
(ldexpl): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bits/math-finite.h declares -ffinite-math-only variants of various
functions under conditions not matching those under which the normal
versions are declared.
* math.h only ever includes bits/mathcalls.h to declare float and long
double functions if __USE_ISOC99, but bits/math-finite.h declares
some float functions regardless (long double ones are conditioned on
__MATH_DECLARE_LDOUBLE). (For C90 functions this isn't a
conformance bug because C90 reserves the float and long double
names, but is still contrary to good glibc practice. For some other
functions in older XSI standards it *is* a conformance bug.)
* Some functions are defined as inlines using lgamma_r functions under
conditions where those lgamma_r functions are not themselves
declared.
* hypot is declared under __USE_XOPEN || __USE_ISOC99 in
bits/mathcalls.h, __USE_ISOC99 only in bits/math-finite.h.
* float and long double versions of Bessel functions should be limited
to __USE_MISC (as in bug 18977).
* gamma should not be declared for __USE_XOPEN2K (as in bug 18967).
* remainder should be restricted to __USE_XOPEN_EXTENDED ||
__USE_ISOC99, not unconditional.
* scalb should not be declared for __USE_XOPEN2K8, and scalbf and
scalbl are non-POSIX (as in bug 18967).
This patch fixes all these issues (it doesn't seem worth splitting
them into separate patches or bugs). I put __USE_ISOC99 conditionals,
where needed, around both float and long double declarations, even
though formally redundant around the long double declarations because
__MATH_DECLARE_LDOUBLE isn't defined without __USE_ISOC99; it seemed
clearer that way. The missing declarations of lgamma_r functions are
dealt with by directly using declarations of __lgamma*_r_finite, in
the implementation namespace, rather than having the inlines rely on
asm redirection of lgamma*_r.
After this patch, there are some apparently redundant nested
__USE_ISOC99 conditionals in lgamma / gamma definitions. These
actually reflect a separate bug (the correct condition for the lgamma
inline functions to set signgam is __USE_MISC || __USE_XOPEN, the
condition under which signgam is declared, rather than disabling
setting it if __USE_ISOC99, which includes XSI POSIX versions for
which signgam *should* be set). They'll be fixed as part of a fix for
that bug, which will also add tests for these inlines. I've put a
note about more general conform/ test coverage for -ffinite-math-only
on
<https://sourceware.org/glibc/wiki/Development_Todo/Master#conformtest_improvements>,
alongside other options for which this is also relevant (some of which
have also had such bugs in the past relating to mismatched
conditionals).
I also intend to enable the main libm-test.inc tests for the
math-finite.h functions, but some other bugs in __*_finite need fixing
first.
[BZ #19205]
* math/bits/math-finite.h (acosf): Condition declaration on
[__USE_ISOC99].
(acosl): Likewise.
(acoshf): Likewise.
(acoshl): Likewise.
(asinf): Likewise.
(asinl): Likewise.
(atan2f): Likewise.
(atan2l): Likewise.
(atanhf): Likewise.
(atanhl): Likewise.
(coshf): Likewise.
(coshl): Likewise.
(expf): Likewise.
(expl): Likewise.
(fmodf): Likewise.
(fmodl): Likewise.
(hypot): Change condition to [__USE_XOPEN || __USE_ISOC99].
(j0f): Change condition to [__USE_MISC && __USE_ISOC99].
(j0l): Likewise.
(y0f): Likewise.
(y0l): Likewise.
(j1f): Likewise.
(j1l): Likewise.
(y1f): Likewise.
(y1l): Likewise.
(jnf): Likewise.
(jnl): Likewise.
(ynf): Likewise.
(ynl): Likewise.
(lgammaf_r): Condition declaration on [__USE_ISOC99].
(lgammal_r): Likewise.
(__lgamma_r_finite): New declaration.
(__lgammaf_r_finite): Likewise.
(__lgammal_r_finite): Likewise.
(lgamma): Use __lgamma_r_finite.
(lgammaf): Condition definition on [__USE_ISOC99]. Use
__lgammaf_r_finite.
(lgammal): Condition definition on [__USE_ISOC99]. Use
__lgammal_r_finite.
(gamma): Do not define for [!__USE_MISC && __USE_XOPEN2K]. Use
__lgamma_r_finite.
(gammaf): Condition definition on [__USE_ISOC99]. Use
__lgammaf_r_finite.
(gammal): Condition definition on [__USE_ISOC99]. Use
__lgammal_r_finite.
(logf): Condition declaration on [__USE_ISOC99].
(logl): Likewise.
(log10f): Likewise.
(log10l): Likewise.
(ldexpf): Likewise.
(ldexpl): Likewise.
(powf): Likewise.
(powl): Likewise.
(remainder): Condition declaration on [__USE_XOPEN_EXTENDED ||
__USE_ISOC99].
(remainderf): Condition declaration on [__USE_ISOC99].
(remainderl): Likewise.
(scalb): Do not declare for [!__USE_MISC && __USE_XOPEN2K8].
(scalbf): Change condition to [__USE_MISC && __USE_ISOC99].
(scalbl): Likewise.
(sinhf): Condition declaration on [__USE_ISOC99].
(sinhl): Likewise.
(sqrtf): Likewise.
(sqrtl): Likewise.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For some large arguments, the dbl-64 implementation of remainder gives
zero results with the wrong sign, resulting from a subtraction that is
mathematically correct but does not guarantee that a zero result has
the sign of the first argument to remainder. This patch adds an
appropriate check for this case, similar to other implementations of
remainder in the case of equality, and adds tests of remainder on
inputs already used to test remquo.
Tested for x86_64 and x86.
[BZ #19201]
* sysdeps/ieee754/dbl-64/e_remainder.c (__ieee754_remainder):
Check for zero remainder in case of large exponents and ensure
correct sign of result in that case.
* math/libm-test.inc (remainder_test_data): Add more tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
nextafter and nexttoward fail to set errno on overflow and underflow.
This patch makes them do so in cases that should include all the cases
where such errno setting is required by glibc's goals for when to set
errno (but not all cases of underflow where the result is nonzero and
so glibc's goals do not require errno setting).
Tested for x86_64, x86, mips64 and powerpc.
[BZ #6799]
* math/s_nextafter.c: Include <errno.h>.
(__nextafter): Set errno on overflow and underflow.
* math/s_nexttowardf.c: Include <errno.h>.
(__nexttowardf): Set errno on overflow and underflow.
* sysdeps/i386/fpu/s_nextafterl.c: Include <errno.h>.
(__nextafterl): Set errno on overflow and underflow.
* sysdeps/i386/fpu/s_nexttoward.c: Include <errno.h>.
(__nexttoward): Set errno on overflow and underflow.
* sysdeps/i386/fpu/s_nexttowardf.c: Include <errno.h>.
(__nexttowardf): Set errno on overflow and underflow.
* sysdeps/ieee754/flt-32/s_nextafterf.c: Include <errno.h>.
(__nextafterf): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128/s_nextafterl.c: Include <errno.h>.
(__nextafterl): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128/s_nexttoward.c: Include <errno.h>.
(__nexttoward): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include <errno.h>.
(__nexttowardf): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c: Include <errno.h>.
(__nextafterl): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c: Include <errno.h>.
(__nexttoward): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: Include <errno.h>.
(__nexttowardf): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-96/s_nexttoward.c: Include <errno.h>.
(__nexttoward): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-96/s_nexttowardf.c: Include <errno.h>.
(__nexttowardf): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c: Include <errno.h>.
(__nldbl_nexttowardf): Set errno on overflow and underflow.
* sysdeps/m68k/m680x0/fpu/s_nextafterl.c: Include <errno.h>.
(__nextafterl): Set errno on overflow and underflow.
* math/libm-test.inc (nextafter_test_data): Do not allow errno
setting to be missing on overflow. Add more tests.
(nexttoward_test_data): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ldbl-128 version of log1pl raises a spurious "invalid" exception
for a -qNaN argument. This patch fixes this by making the initial
check for infinities and NaNs handle arguments of both signs in such a
way that NaNs result in a NaN being returned (quietly if the input NaN
was quiet) while +Inf results in +Inf being returned and -Inf results
in a qNaN being returned with "invalid" exception raised.
Tested for mips64.
[BZ #19189]
* sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Make check for
non-finite argument handle arguments with negative sign.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The libm drem functions just call the corresponding __remainder
functions. This patch removes the unnecessary wrappers by making them
into weak aliases at the ELF level.
Tested for x86_64, x86, mips64 and powerpc.
[BZ #16171]
* math/w_remainder.c (drem): Define as weak alias of __remainder.
[NO_LONG_DOUBLE] (dreml): Define as weak alias of __remainder.
* math/w_remainderf.c (dremf): Define as weak alias of
__remainderf.
* math/w_remainderl.c (dreml): Define as weak alias of
__remainderl.
* sysdeps/ia64/fpu/e_remainder.S (drem): Define as weak alias of
__remainder.
* sysdeps/ia64/fpu/e_remainderf.S (dremf): Define as weak alias of
__remainderf.
* sysdeps/ia64/fpu/e_remainderl.S (dreml): Define as weak alias of
__remainderl.
* sysdeps/ieee754/ldbl-opt/nldbl-remainder.c (dreml): Define as
weak alias of remainderl.
* sysdeps/ieee754/ldbl-opt/w_remainder.c
[LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (__drem): Define as strong
alias of __remainder.
[LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (dreml): Use compat_symbol.
* sysdeps/ieee754/ldbl-opt/w_remainderl.c (__dreml): Define as
strong alias of __remainderl.
(dreml): Use long_double_symbol.
* math/Makefile (libm-calls): Remove w_drem.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Remove drem.
(CFLAGS-nldbl-drem.c): Remove variable.
(CFLAGS-nldbl-remainder.c): Add -fno-builtin-dreml.
* math/w_drem.c: Remove file.
* math/w_dremf.c: Likewise.
* math/w_dreml.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-drem.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_drem.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_dreml.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fenv_t should include architecture-specific floating-point modes and
status flags. i386 and x86_64 fesetenv limit which bits they use from
the x87 status and control words, when using saved state, and limit
which parts of the state they set to fixed values, when using
FE_DFL_ENV / FE_NOMASK_ENV. The following should be included but are
excluded in at least some cases: status and masking for the "denormal
operand" exception (which isn't part of FE_ALL_EXCEPT); precision
control (explicitly mentioned in Annex F as something that counts as
part of the floating-point environment); MXCSR FZ and DAZ bits (for
FE_DFL_ENV and FE_NOMASK_ENV). This patch arranges for this extra
state to be handled by fesetenv (and thereby by feupdateenv, which
calls fesetenv).
(Note that glibc functions using floating point are not generally
expected to work correctly with non-default values of this state,
especially precision control, but it is still logically part of the
floating-point environment and should be handled as such by fesetenv.
Changes to the state relating to subnormals ought generally to work
with libm functions when the arguments aren't subnormal and neither
are the expected results; that's a consequence of functions avoiding
spurious internal underflows.)
A question arising from this is whether FE_NOMASK_ENV should or should
not mask the "denormal operand" exception. I decided it should mask
that exception. This is the status quo - previously that exception
could only be unmasked by direct manipulation of control registers
(possibly via <fpu_control.h>). In addition, it means that use of
FE_NOMASK_ENV leaves a floating-point environment the same as could be
obtained by fesetenv (FE_DFL_ENV); feenableexcept (FE_ALL_EXCEPT);,
rather than an environment in which an exception is unmasked that
could only be masked again by using fesetenv with FE_DFL_ENV (or a
previously saved environment) - this exception not being usable with
other <fenv.h> functions because it's outside FE_ALL_EXCEPT.
Tested for x86_64 and x86.
[BZ #16068]
* sysdeps/i386/fpu/fesetenv.c: Include <fpu_control.h>.
(FE_ALL_EXCEPT_X86): New macro.
(__fesetenv): Use FE_ALL_EXCEPT_X86 in most places instead of
FE_ALL_EXCEPT. Ensure precision control is included in
floating-point state. Ensure that FE_DFL_ENV and FE_NOMASK_ENV
handle "denormal operand exception" and clear FZ and DAZ bits.
* sysdeps/x86_64/fpu/fesetenv.c: Include <fpu_control.h>.
(FE_ALL_EXCEPT_X86): New macro.
(__fesetenv): Use FE_ALL_EXCEPT_X86 in most places instead of
FE_ALL_EXCEPT. Ensure precision control is included in
floating-point state. Ensure that FE_DFL_ENV and FE_NOMASK_ENV
handle "denormal operand exception" and clear FZ and DAZ bits.
* sysdeps/x86/fpu/test-fenv-sse-2.c: New file.
* sysdeps/x86/fpu/test-fenv-x87.c: Likewise.
* sysdeps/x86/fpu/Makefile [$(subdir) = math] (tests): Add
test-fenv-x87 and test-fenv-sse-2.
[$(subdir) = math] (CFLAGS-test-fenv-sse-2.c): New variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[BZ# 19048]
* malloc/malloc.c (struct malloc_state): Update comment. Add
attached_threads member.
(main_arena): Initialize attached_threads.
* malloc/arena.c (list_lock): Update comment.
(ptmalloc_lock_all, ptmalloc_unlock_all): Likewise.
(ptmalloc_unlock_all2): Reinitialize arena reference counts.
(deattach_arena): New function.
(_int_new_arena): Initialize arena reference count and deattach
replaced arena.
(get_free_list, reused_arena): Update reference count and deattach
replaced arena.
(arena_thread_freeres): Update arena reference count and only put
unreferenced arenas on the free list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The i386 and x86_64 versions of fesetenv, when called with FE_DFL_ENV
or FE_NOMASK_ENV as argument, do not clear SSE exceptions raised in
MXCSR. These arguments should, like other fenv_t values, represent
the whole of the floating-point state, so such exceptions should be
cleared; this patch adds the required clearing. (Discovered while
working on bug 16068.)
Tested for x86_64 and x86.
[BZ #19181]
* sysdeps/i386/fpu/fesetenv.c (__fesetenv): Clear already-raised
SSE exceptions when argument is FE_DFL_ENV or FE_NOMASK_ENV.
* sysdeps/x86_64/fpu/fesetenv.c (__fesetenv): Likewise.
* math/test-fenv-clear-main.c: New file.
* math/test-fenv-clear.c: Likewise.
* math/Makefile (tests): Add test-fenv-clear.
* sysdeps/x86/fpu/test-fenv-clear-sse.c: New file.
* sysdeps/x86/fpu/Makefile [$(subdir) = math] (tests): Add
test-fenv-clear-sse.
[$(subdir) = math] (CFLAGS-test-fenv-clear-sse.c): New variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MIPS16 atomics used __sync_* with GCC before 4.7, which as noted in
bug 17404 is missing the required barrier semantics for
atomic_exchange_rel. This patch removes the code in question as dead
now GCC before 4.7 is no longer supported for building glibc.
Sanity tested with builds for MIPS.
[BZ #17404]
* sysdeps/mips/atomic-machine.h
[__GNUC_PREREQ (4, 8) || (__mips16 && __GNUC_PREREQ (4, 7))]:
Change conditional to [__GNUC_PREREQ (4, 8) || __mips16].
[__mips16 && !__GNUC_PREREQ (4, 7)]: Remove conditional code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The skip_lock_out_of_tbegin_retries adaptive parameter was
not being used correctly, nor as described. This prevents
a fallback for all users of the lock if a transient abort
occurs within the accepted number of retries.
[BZ #19174]
* sysdeps/powerpc/nptl/elide.h (__elide_lock): Fix usage of
.skip_lock_out_of_tbegin_retries.
* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
(__lll_lock_elision): Likewise, and respect a value of
try_tbegin <= 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements a requirement of GCC 4.7 or later to build
glibc.
This was discussed in the thread starting at
<https://sourceware.org/ml/libc-alpha/2015-08/msg00851.html>.
Concerns were expressed by Mike and David. At
<https://sourceware.org/ml/libc-alpha/2015-10/msg00453.html> I have
provided a 14-patch series showing in outline the cleanups facilitated
by this version requirement, as requested by Mike (this patch is the
first in that series, with the addition of a NEWS entry). Given the
absence of further concerns or alternative proposals for criteria for
updates to this version requirement as requested in
<https://sourceware.org/ml/libc-alpha/2015-10/msg00065.html>, I am
interpreting this as "absence of sustained opposition" under Carlos's
definition at <https://sourceware.org/glibc/wiki/Consensus> and
proposing this patch for inclusion in glibc. I'd like to remind
people testing with 4.6 that if they move to testing with GCC 5 then
it will probably be about four years before they need to update the
compiler they use to test glibc again.
Although on the principles of time-based updates I think a move to
requiring binutils 2.23 would be reasonable, I'm not currently aware
of any cleanups that would facilitate so am not proposing that at this
time (but would expect to propose a move to requiring binutils 2.24 in
a year's time, as that brings features such as AVX512 support that
should allow some conditionals to be cleaned up). If someone thinks a
move to requiring 2.23 would help clean things up for their
architecture, please speak up. (And in general, I suspect there are
lots of architecture-specific configure tests that could be removed on
the basis of current GCC and binutils version requirements, given how
I've found architecture-independent tests obsolete on the basis of
version requirements going back 20 years.)
Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).
* configure.ac (libc_cv_compiler_ok): Require GCC 4.7 or later.
* configure: Regenerated.
* manual/install.texi (Tools for Compilation): Document
requirement for GCC 4.7 or later.
* INSTALL: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
j1 and jn can underflow for small arguments, but fail to set errno
when underflowing to 0. This patch fixes them to set errno in that
case.
Tested for x86_64, x86, mips64 and powerpc.
[BZ #18611]
* sysdeps/ieee754/dbl-64/e_j1.c (__ieee754_j1): Set errno and
avoid excess range and precision on underflow.
* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Likewise.
* sysdeps/ieee754/flt-32/e_j1f.c (__ieee754_j1f): Likewise.
* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Likewise.
* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): Set errno on
underflow.
* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-96/e_j1l.c (__ieee754_j1l): Likewise.
* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise.
* math/auto-libm-test-in: Do not allow missing errno setting for
tests of j1 and jn.
* math/auto-libm-test-out: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The implementations of nearbyint functions using x87 floating point
(i386 all versions, x86_64 long double only) use the fclex
instruction, which clears any exceptions that were raised before the
function was called. These functions must not clear exceptions that
were raised before they were called.
This patch fixes these functions to save and restore the whole
floating-point environment (fnstenv / fldenv) as the way of avoiding
raising "inexact" (recall that there isn't an x87 instruction for
loading just the status word, so the whole environment has to be saved
and loaded instead - the code already saved and loaded the control
word, which is now obtained from the saved environment after this
patch, to disable traps on "inexact"). In the case of the long double
functions, any "invalid" exception from frndint (applied to a
signaling NaN) needs merging into the saved state; this issue doesn't
apply to the float and double functions because that exception would
have been raised when the argument is loaded, before the environment
is saved.
[BZ #15491]
* sysdeps/i386/fpu/s_nearbyint.S (__nearbyint): Save and restore
floating-point environment instead of clearing all exceptions.
* sysdeps/i386/fpu/s_nearbyintf.S (__nearbyintf): Likewise.
* sysdeps/i386/fpu/s_nearbyintl.S (__nearbyintl): Likewise,
merging in "invalid" exceptions from frndint.
* sysdeps/x86_64/fpu/s_nearbyintl.S (__nearbyintl): Likewise.
* math/test-nearbyint-except.c: New file.
* math/Makefile (tests): Add test-nearbyint-except.
|
|
|
|
|
|
|
|
|
|
|
| |
Wilco fixed this tilegx bug in commit fe8c2b33aed0 ("Since we
now inline isinf, isnan and isfinite in math.h, replace uses
of __isinf_ns(l/f) with isinf, and remove the unused inlines
__isinf_ns(l/f), __isnan(f) and __finite(f).")
I verified that reverting math/s_cprojf.c back to using the
sysdeps/ieee754/flt-32/math_private.h version of __isinf_nsf()
instead of isinf() brings back the bug on tilegx.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
My recent addition of more tests for j0 showed up that the ldbl-128
implementation of j0l produces spurious underflow exceptions for
arguments close to 0 (when the result is very close to 1). This patch
fixes this by just returning the argument in that case.
Tested for mips64 (where it fixes the recently-added tests that were
previously failing).
[BZ #19156]
* sysdeps/ieee754/ldbl-128/e_j0l.c (__ieee754_j0l): Return 1 for
arguments very close to 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous code used to evaluate the preprocessor token is_lock_free to
a variable before starting a transaction. This behavior can cause an
error if another thread got the lock (without using a transaction)
between the evaluation of the token and the beginning of the transaction.
This bug can be triggered with the following order of events:
1. The lock accessed by is_lock_free is free.
2. Thread T1 evaluates is_lock_free and stores into register R1 that the
lock is free.
3. Thread T2 acquires the same lock used in is_lock_free.
4. T1 begins the transaction, creating a memory barrier where is_lock_free
is false, but R1 is true.
5. T1 reads R1 and doesn't abort the transaction.
6. T1 calls ELIDE_UNLOCK, which reads false from is_lock_free and decides
to unlock a lock acquired by T2, leading to undefined behavior.
This patch delays the evaluation of is_lock_free to inside a transaction
by moving this part of the code to the macro ELIDE_LOCK.
[BZ #18743]
* sysdeps/powerpc/nptl/elide.h (__elide_lock): Move most of this
code to...
(ELIDE_LOCK): ...here.
(__get_new_count): New function with part of the code from
__elide_lock that updates the value of adapt_count after a
transaction abort.
(__elided_trylock): Moved this code to...
(ELIDE_TRYLOCK): ...here.
|
|
|
|
| |
Reported-by: Joseph Myers <joseph@codesourcery.com>
|
|
|
|
| |
This adjusts the documentation to the existing implementation.
|
|
|
|
| |
Lithuania switched currency to the Euro on 1st Jan 2015.
|