]> sourceware.org Git - glibc.git/log
glibc.git
5 years agoelf: Implement --preload option for the dynamic linker
David Newall [Mon, 4 Feb 2019 12:35:11 +0000 (13:35 +0100)]
elf: Implement --preload option for the dynamic linker

5 years agotestrun.sh: Exit in case of incorrect argument
Matthew Malcomson [Mon, 4 Feb 2019 12:06:15 +0000 (13:06 +0100)]
testrun.sh: Exit in case of incorrect argument

5 years agotime: Avoid alignment gaps in __tzfile_read
Florian Weimer [Mon, 4 Feb 2019 09:01:29 +0000 (10:01 +0100)]
time: Avoid alignment gaps in __tzfile_read

By ordering the suballocations by decreasing alignment, alignment
gaps can be avoided.

Also use __glibc_unlikely for reading the transitions and type
indexes.  In the 8-byte case, two reads are now needed because the
transitions and type indexes are no longer adjacent.  The separate
call to __fread_unlocked does not matter from a performance point of
view because __tzfile_read is only invoked rarely.

5 years agotime: Use struct alloc_buffer in __tzfile_read
Florian Weimer [Sun, 3 Feb 2019 21:13:51 +0000 (22:13 +0100)]
time: Use struct alloc_buffer in __tzfile_read

The computation of tzspec_len is moved in front of the total_size
computation, so that the allocation size computation and the
suballocations are next to each other.  Also add an assert that
tzspec_len is positive when it is actually used later.

5 years agotestsuite: stdlib/isomac.c: add missing include
Aurelien Jarno [Tue, 8 Jan 2019 20:10:28 +0000 (21:10 +0100)]
testsuite: stdlib/isomac.c: add missing include

When running the testsuite, building stdlib/isomac.c outputs the
following warning:

  gcc -O   -D_GNU_SOURCE -DIS_IN_build -include /home/aurel32/glibc-build/config.h isomac.c -o /home/aurel32/glibc-build/stdlib/isomac
  isomac.c: In function ‘get_null_defines’:
  isomac.c:260:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
     close (fd);
     ^~~~~
     pclose

Fix that by adding the <unistd.h> include.

Changelog:
* stdlib/isomac.c: Include <unistd.h>.

5 years agotime: Use int, not long int, for internal GMT offsets
Florian Weimer [Sun, 3 Feb 2019 08:55:41 +0000 (09:55 +0100)]
time: Use int, not long int, for internal GMT offsets

The GMT offset can be outside the range of a 16-bit int type, which
is presumably the reason why long int was used in struct tm.  We
cannot change struct tm, but we can change the internal type for
the offset.

5 years agolibio: Use stdin consistently for input functions [BZ #24153]
Florian Weimer [Sun, 3 Feb 2019 08:37:30 +0000 (09:37 +0100)]
libio: Use stdin consistently for input functions [BZ #24153]

The internal _IO_stdin_ variable is not updated when the application
assigns to stdin, which is a GNU extension.

5 years agomanual: Document lack of conformance of sched_* functions [BZ #14829]
Florian Weimer [Sat, 2 Feb 2019 13:13:33 +0000 (14:13 +0100)]
manual: Document lack of conformance of sched_* functions [BZ #14829]

On Linux, we define _POSIX_PRIORITY_SCHEDULING, but functions such
as sched_setparam and sched_setscheduler apply to individual threads,
not processes.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoRequire GCC 6.2 or later to build glibc.
Joseph Myers [Fri, 1 Feb 2019 16:27:44 +0000 (16:27 +0000)]
Require GCC 6.2 or later to build glibc.

As discussed during development for glibc 2.29, when we increased the
required minimum GCC version for building glibc to GCC 5, working
purely based on the times at which such requirements have been
increased in the past it would be appropriate for glibc 2.30 to
require GCC 6 (matching GCC 4.9 having been required for glibc 2.26).
Naming 6.2 specifically as the minimum version then means a separate
version requirement no longer needs to be specified for powerpc64le.

Thus, this patch increases the minimum to 6.2, removing the
documentation of the separate requirement for powerpc64le.  It does
not remove the powerpc64le configure test, or any __GNUC_PREREQ that
could be removed as not being in installed headers or files shared
with gnulib; I think such cleanups are best done separately.

Tested for x86_64.

* configure.ac (libc_cv_compiler_ok): Require GCC 6.2 or later.
* configure: Regenerated.
* manual/install.texi (Tools for Compilation): Update minimum GCC
version.
* INSTALL: Regenerated.

5 years agosupport: Correct error message for TEST_COMPARE_STRING
Florian Weimer [Fri, 1 Feb 2019 13:04:42 +0000 (14:04 +0100)]
support: Correct error message for TEST_COMPARE_STRING

It should say "string", not "blob".

5 years agosupport: Handle AF_LOCAL, AF_UNSPEC in support_format_address_family
Florian Weimer [Fri, 1 Feb 2019 13:04:02 +0000 (14:04 +0100)]
support: Handle AF_LOCAL, AF_UNSPEC in support_format_address_family

5 years agomanual: Update struct sockaddr_in, struct sockaddr_sin6 description
Florian Weimer [Fri, 1 Feb 2019 13:03:39 +0000 (14:03 +0100)]
manual: Update struct sockaddr_in, struct sockaddr_sin6 description

Clarify the byte order of the the struct fields and document
sin6_flowinfo and sin6_scope_id.

5 years agoCleanup clock_*time includes
Wilco Dijkstra [Fri, 1 Feb 2019 12:19:42 +0000 (12:19 +0000)]
Cleanup clock_*time includes

Clock_gettime, settime and getres implementations are unncessarily
complex due to using defines and C file inclusion.  Simplify the
code by replacing the redundant defines and removing the inclusion,
making it much easier to understand.  No functional changes.

* sysdeps/posix/clock_getres.c (__clock_getres): Cleanup.
* sysdeps/unix/clock_gettime.c (__clock_gettime): Cleanup.
* sysdeps/unix/clock_settime.c (__clock_settime): Cleanup.
* sysdeps/unix/sysv/linux/clock_getres.c (__clock_getres): Cleanup.
* sysdeps/unix/sysv/linux/clock_gettime.c (__clock_gettime): Cleanup.
* sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime): Cleanup.

5 years agoaarch64: Optimized memchr specific to AmpereComputing emag
Feng Xue [Thu, 9 Aug 2018 08:38:03 +0000 (04:38 -0400)]
aarch64: Optimized memchr specific to AmpereComputing emag

This version uses general register based memory instruction to load
data, because vector register based is slightly slower in emag.

Character-matching is performed on 16-byte (both size and alignment)
memory block in parallel each iteration.

    * sysdeps/aarch64/memchr.S (__memchr): Rename to MEMCHR.
    [!MEMCHR](MEMCHR): Set to __memchr.
    * sysdeps/aarch64/multiarch/Makefile (sysdep_routines):
    Add memchr_generic and memchr_nosimd.
    * sysdeps/aarch64/multiarch/ifunc-impl-list.c
    (__libc_ifunc_impl_list): Add memchr ifuncs.
    * sysdeps/aarch64/multiarch/memchr.c: New file.
    * sysdeps/aarch64/multiarch/memchr_generic.S: Likewise.
    * sysdeps/aarch64/multiarch/memchr_nosimd.S: Likewise.

5 years agoaarch64: Optimized memset specific to AmpereComputing emag
Feng Xue [Mon, 30 Jul 2018 06:21:42 +0000 (02:21 -0400)]
aarch64: Optimized memset specific to AmpereComputing emag

This version uses general register based memory store instead of
vector register based, for the former is faster than the latter
in emag.

The fact that DC ZVA size in emag is 64-byte, is used by IFUNC
dispatch to select this memset, so that cost of runtime-check on
DC ZVA size can be saved.

    * sysdeps/aarch64/multiarch/Makefile (sysdep_routines):
    Add memset_emag.
    * sysdeps/aarch64/multiarch/ifunc-impl-list.c
    (__libc_ifunc_impl_list): Add __memset_emag to memset ifunc.
    * sysdeps/aarch64/multiarch/memset.c (libc_ifunc):
    Add IS_EMAG check for ifunc dispatch.
    * sysdeps/aarch64/multiarch/memset_base64.S: New file.
    * sysdeps/aarch64/multiarch/memset_emag.S: New file.

5 years agoaarch64: Add AmpereComputing emag to tunable cpu list
Feng Xue [Wed, 1 Aug 2018 07:42:44 +0000 (03:42 -0400)]
aarch64: Add AmpereComputing emag to tunable cpu list

Emag is a 64-bit CPU core released by AmpereComputing.

Add its name to cpu list, and corresponding macro as utilities for
later IFUNC dispatch.

    * manual/tunables.texi (Tunable glibc.cpu.name): Add emag.
    * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list):
    Add emag.
    * sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_EMAG):
    New macro.

5 years agoposix/tst-spawn: Fix racy tests in spawned processes.
Stefan Liebler [Fri, 1 Feb 2019 10:03:35 +0000 (11:03 +0100)]
posix/tst-spawn: Fix racy tests in spawned processes.

From time to time I get fails in tst-spawn like:
tst-spawn.c:111: numeric comparison failure
   left: 0 (0x0); from: xlseek (fd2, 0, SEEK_CUR)
  right: 28 (0x1c); from: strlen (fd2string)
error: 1 test failures
tst-spawn.c:252: numeric comparison failure
   left: 1 (0x1); from: WEXITSTATUS (status)
  right: 0 (0x0); from: 0
error: 1 test failures

It turned out, that a child process is testing it's open file descriptors
with e.g. a sequence of testing the current position, setting the position
to zero and reading a specific amount of bytes.

Unfortunately starting with commit 2a69f853c03034c2e383e0f9c35b5402ce8b5473
the test is spawning a second child process which is sharing some of the
file descriptors.  If the test sequence as mentioned above is running in parallel
it leads to test failures.

As the second call of posix_spawn shall test a NULL pid argument,
this patch is just moving the waitpid of the first child
before the posix_spawn of the second child.

ChangeLog:

* posix/tst-spawn do_test(): Move waitpid before posix_spawn.

5 years agomake-syscalls.sh: fix comment referencing syscall-template
Vineet Gupta [Fri, 1 Feb 2019 03:45:10 +0000 (22:45 -0500)]
make-syscalls.sh: fix comment referencing syscall-template

5 years agonptl: Fix pthread_rwlock_try*lock stalls (Bug 23844)
Carlos O'Donell [Tue, 22 Jan 2019 03:50:12 +0000 (22:50 -0500)]
nptl: Fix pthread_rwlock_try*lock stalls (Bug 23844)

For a full analysis of both the pthread_rwlock_tryrdlock() stall
and the pthread_rwlock_trywrlock() stall see:
https://sourceware.org/bugzilla/show_bug.cgi?id=23844#c14

In the pthread_rwlock_trydlock() function we fail to inspect for
PTHREAD_RWLOCK_FUTEX_USED in __wrphase_futex and wake the waiting
readers.

In the pthread_rwlock_trywrlock() function we write 1 to
__wrphase_futex and loose the setting of the PTHREAD_RWLOCK_FUTEX_USED
bit, again failing to wake waiting readers during unlock.

The fix in the case of pthread_rwlock_trydlock() is to check for
PTHREAD_RWLOCK_FUTEX_USED and wake the readers.

The fix in the case of pthread_rwlock_trywrlock() is to only write
1 to __wrphase_futex if we installed the write phase, since all other
readers would be spinning waiting for this step.

We add two new tests, one exercises the stall for
pthread_rwlock_trywrlock() which is easy to exercise, and one exercises
the stall for pthread_rwlock_trydlock() which is harder to exercise.

The pthread_rwlock_trywrlock() test fails consistently without the fix,
and passes after. The pthread_rwlock_tryrdlock() test fails roughly
5-10% of the time without the fix, and passes all the time after.

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Torvald Riegel <triegel@redhat.com>
Signed-off-by: Rik Prohaska <prohaska7@gmail.com>
Co-authored-by: Torvald Riegel <triegel@redhat.com>
Co-authored-by: Rik Prohaska <prohaska7@gmail.com>
5 years agoUse MPFR 4.0.2 in build-many-glibcs.py.
Joseph Myers [Fri, 1 Feb 2019 00:11:37 +0000 (00:11 +0000)]
Use MPFR 4.0.2 in build-many-glibcs.py.

* scripts/build-many-glibcs.py (Context.checkout): Default MPFR
version to 4.0.2.

5 years agolibio: use stdout in puts and putchar, etc [BZ #24051].
Paul Pluzhnikov [Tue, 1 Jan 2019 03:14:28 +0000 (19:14 -0800)]
libio: use stdout in puts and putchar, etc [BZ #24051].

GLIBC explicitly allows one to assign a new FILE pointer to stdout and
other standard streams.  printf and wprintf were honouring assignment to
stdout and using the new value, but puts, putchar, and wide char variants
did not.

The stdout part is fixed here.  The stdin part will be fixed in a followup.

5 years agoregex: fix read overrun [BZ #24114]
Paul Eggert [Mon, 21 Jan 2019 19:08:13 +0000 (11:08 -0800)]
regex: fix read overrun [BZ #24114]

Problem found by AddressSanitizer, reported by Hongxu Chen in:
https://debbugs.gnu.org/34140
* posix/regexec.c (proceed_next_node):
Do not read past end of input buffer.

5 years agonss_files: Fix /etc/aliases null pointer dereference [BZ #24059]
Florian Weimer [Thu, 31 Jan 2019 17:49:58 +0000 (18:49 +0100)]
nss_files: Fix /etc/aliases null pointer dereference [BZ #24059]

If /etc/aliases ends with a continuation line (a line that starts
with whitespace) which does not have a trailing newline character,
the file parser would crash due to a null pointer dereference.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoOpen master for 2.30 development glibc-2.29.9000
Siddhesh Poyarekar [Thu, 31 Jan 2019 17:09:14 +0000 (22:39 +0530)]
Open master for 2.30 development

5 years agoTag 2.29 release glibc-2.29
Siddhesh Poyarekar [Thu, 31 Jan 2019 16:45:36 +0000 (22:15 +0530)]
Tag 2.29 release

* version.h (RELEASE): Set to "stable".
(VERSION): Set to "2.29".
* include/features.h (__GLIBC_MINOR__): Set to 2.29.

5 years agoPrepare for 2.29 release
Siddhesh Poyarekar [Thu, 31 Jan 2019 16:31:21 +0000 (22:01 +0530)]
Prepare for 2.29 release

* NEWS: Add the list of bugs fixed in 2.29.
* manual/contrib.texi: Update contributors list with some more
names.
  * manual/install.texi: Update latest versions of packages
  tested.
  * INSTALL: Regenerated.

5 years agoUpdate translations
Siddhesh Poyarekar [Fri, 25 Jan 2019 16:35:42 +0000 (22:05 +0530)]
Update translations

Update translations from translationproject.org for 2.28.9000.

5 years ago[elf] Revert 8e889c5da3 (BZ#24122)
Adhemerval Zanella [Fri, 25 Jan 2019 10:10:15 +0000 (08:10 -0200)]
[elf] Revert 8e889c5da3 (BZ#24122)

It triggers an invalid build issue on GCC8+ and does not covers all
corner cases.

5 years agohurd: Fix initial sigaltstack state
Samuel Thibault [Thu, 24 Jan 2019 19:15:01 +0000 (20:15 +0100)]
hurd: Fix initial sigaltstack state

Previous commit fixed
[BZ #24110]

5 years agoRISC-V: Update nofpu ULPs
Darius Rad [Thu, 24 Jan 2019 18:44:56 +0000 (13:44 -0500)]
RISC-V: Update nofpu ULPs

This patch fixes 36 math related test failures.

5 years agoalpha: Fix __remqu corrupting $f3 register
Uroš Bizjak [Thu, 24 Jan 2019 18:22:55 +0000 (10:22 -0800)]
alpha: Fix __remqu corrupting $f3 register

There was missing restore of $f3 before the return from the function
via the $y_is_neg path.  This caused the math/big testcase from Go-1.11
testsuite (that includes lots of corner cases that exercise remqu) FAIL.

[BZ #24130]
* sysdeps/alpha/remqu.S (__remqu): Add missing restore
of $f3 register on $y_is_neg path.

5 years agohurd: Fix initial sigaltstack state
Samuel Thibault [Thu, 24 Jan 2019 18:27:00 +0000 (19:27 +0100)]
hurd: Fix initial sigaltstack state

* hurd/hurdsig.c (_hurd_thread_sigstate): Set SS_DISABLE in
sigaltstack.ss_flags.

5 years agostrftime: Pass the additional flags from "%EY" to "%Ey" [BZ #24096]
TAMUKI Shoichi [Thu, 24 Jan 2019 14:04:12 +0000 (23:04 +0900)]
strftime: Pass the additional flags from "%EY" to "%Ey" [BZ #24096]

The full representation of the alternative calendar year (%EY)
typically includes an internal use of "%Ey".  As a GNU extension,
apply any flags on "%EY" (e.g. "%_EY", "%-EY") to the internal "%Ey",
allowing users of "%EY" to control how the year is padded.

Reviewed-by: Rafal Luzynski <digitalfreak@lingonborough.com>
Reviewed-by: Zack Weinberg <zackw@panix.com>
ChangeLog:

[BZ #24096]
* manual/time.texi (strftime): Document "%EC" and "%EY".
* time/Makefile (tests): Add tst-strftime2.
(LOCALES): Add ja_JP.UTF-8, lo_LA.UTF-8, and th_TH.UTF-8.
* time/strftime_l.c (__strftime_internal): Add argument yr_spec to
override padding for "%Ey".
If an optional flag ('_' or '-') is specified to "%EY", interpret the
"%Ey" in the subformat as if decorated with that flag.
* time/tst-strftime2.c: New file.

5 years agostrftime: Set the default width of "%Ey" to 2 [BZ #23758]
TAMUKI Shoichi [Thu, 24 Jan 2019 14:00:53 +0000 (23:00 +0900)]
strftime: Set the default width of "%Ey" to 2 [BZ #23758]

In Japanese locales, strftime's alternative year format (%Ey) produces
a year numbered within a time period called an _era_.  A new era
typically begins when a new emperor is enthroned.  The result of "%Ey"
is therefore usually a one- or two-digit number.

Many programs that display Japanese era dates assume that the era year
is two digits wide.  To improve how these programs display dates
during the first nine years of a new era, change "%Ey" to pad one-
digit numbers on the left with a zero.  This change applies to all
locales.  It is expected to be harmless for other locales that use the
alternative year format (e.g. lo_LA and th_TH, in which "%Ey" produces
the year of the Buddhist calendar) as those calendars' year numbers
are already more than two digits wide, and this is not expected to
change.

This change needs to be in place before 2019-05-01 CE, as a new era is
scheduled to begin on that date.

Reviewed-by: Zack Weinberg <zackw@panix.com>
Reviewed-by: Rafal Luzynski <digitalfreak@lingonborough.com>
ChangeLog:

[BZ #23758]
* manual/time.texi (strftime): Document "%Ey".
* time/strftime_l.c (__strftime_internal): Set the default width
padding with zero of "%Ey" to 2.

5 years agohurd: Fix libsupport xsigstack build
Adhemerval Zanella [Thu, 24 Jan 2019 11:36:25 +0000 (09:36 -0200)]
hurd: Fix libsupport xsigstack build

Hurd does not support MAP_NORESERVE and MAP_STACK.

Checked on i686-gnu build.

* support/xsigstack.c (MAP_NORESERVE, MAP_STACK): Define if they
are not defined.

5 years agoelf: Fix LD_AUDIT for modules with invalid version (BZ#24122)
Adhemerval Zanella [Wed, 23 Jan 2019 13:42:54 +0000 (11:42 -0200)]
elf: Fix LD_AUDIT for modules with invalid version (BZ#24122)

The error handling patch for invalid audit modules version access
invalid memory:

elf/rtld.c:

1454               unsigned int (*laversion) (unsigned int);
1455               unsigned int lav;
1456               if  (err_str == NULL
1457                    && (laversion = largs.result) != NULL
1458                    && (lav = laversion (LAV_CURRENT)) > 0
1459                    && lav <= LAV_CURRENT)
1460                 {
[...]
1526               else
1527                 {
1528                   /* We cannot use the DSO, it does not have the
1529                      appropriate interfaces or it expects something
1530                      more recent.  */
1531 #ifndef NDEBUG
1532                   Lmid_t ns = dlmargs.map->l_ns;
1533 #endif
1534                   _dl_close (dlmargs.map);
1535
1536                   /* Make sure the namespace has been cleared entirely.  */
1537                   assert (GL(dl_ns)[ns]._ns_loaded == NULL);
1538                   assert (GL(dl_ns)[ns]._ns_nloaded == 0);
1539
1540                   GL(dl_tls_max_dtv_idx) = tls_idx;
1541                   goto not_loaded;
1542                 }

1431           const char *err_str = NULL;
1432           bool malloced;
1433           (void) _dl_catch_error (&objname, &err_str, &malloced, dlmopen_doit,
1434                                   &dlmargs);
1435           if (__glibc_unlikely (err_str != NULL))
1436             {
1437             not_loaded:
1438               _dl_error_printf ("\
1439 ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
1440                                 name, err_str);
1441               if (malloced)
1442                 free ((char *) err_str);
1443             }

On failure the err_str will be NULL and _dl_debug_vdprintf does not handle
it properly:

elf/dl-misc.c:
200             case 's':
201               /* Get the string argument.  */
202               iov[niov].iov_base = va_arg (arg, char *);
203               iov[niov].iov_len = strlen (iov[niov].iov_base);
204               if (prec != -1)
205                 iov[niov].iov_len = MIN ((size_t) prec, iov[niov].iov_len);
206               ++niov;
207               break;

This patch fixes the issues and improves the error message.

Checked on x86_64-linux-gnu and i686-linux-gnu

[BZ #24122]
* elf/Makefile (tests): Add tst-audit13.
(modules-names): Add tst-audit13mod1.
(tst-audit13.out, LDFLAGS-tst-audit13mod1.so, tst-audit13-ENV): New
rule.
* elf/rtld.c (dl_main): Handle invalid audit module version.
* elf/tst-audit13.c: New file.
* elf/tst-audit13mod1.c: Likewise.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agohurd: Support AT_EMPTY_PATH
Samuel Thibault [Tue, 22 Jan 2019 22:38:36 +0000 (23:38 +0100)]
hurd: Support AT_EMPTY_PATH

* hurd/lookup-at.c (__file_name_lookup_at): When at_flags contains
AT_EMPTY_PATH, call __dir_lookup and __hurd_file_name_lookup_retry
directly instead of __hurd_file_name_lookup.

5 years agohurd: Check at_flags passed to faccessat
Samuel Thibault [Tue, 22 Jan 2019 21:47:10 +0000 (22:47 +0100)]
hurd: Check at_flags passed to faccessat

* sysdeps/mach/hurd/faccessat.c (__faccessat_common): Check for errors
returned by __hurd_at_flags.

5 years agoUse binutils 2.32 branch in build-many-glibcs.py.
Joseph Myers [Mon, 21 Jan 2019 22:51:18 +0000 (22:51 +0000)]
Use binutils 2.32 branch in build-many-glibcs.py.

* scripts/build-many-glibcs.py (Context.checkout): Default
binutils version to 2.32 branch.

5 years agoCVE-2016-10739: getaddrinfo: Fully parse IPv4 address strings [BZ #20018]
Florian Weimer [Mon, 21 Jan 2019 20:26:03 +0000 (21:26 +0100)]
CVE-2016-10739: getaddrinfo: Fully parse IPv4 address strings [BZ #20018]

The IPv4 address parser in the getaddrinfo function is changed so that
it does not ignore trailing whitespace and all characters after it.
For backwards compatibility, the getaddrinfo function still recognizes
legacy name syntax, such as 192.000.002.010 interpreted as 192.0.2.8
(octal).

This commit does not change the behavior of inet_addr and inet_aton.
gethostbyname already had additional sanity checks (but is switched
over to the new __inet_aton_exact function for completeness as well).

To avoid sending the problematic query names over DNS, commit
6ca53a2453598804a2559a548a08424fca96434a ("resolv: Do not send queries
for non-host-names in nss_dns [BZ #24112]") is needed.

5 years agox86-64 strnlen/wcsnlen: Properly handle the length parameter [BZ# 24097]
H.J. Lu [Mon, 21 Jan 2019 19:36:36 +0000 (11:36 -0800)]
x86-64 strnlen/wcsnlen: Properly handle the length parameter [BZ# 24097]

On x32, the size_t parameter may be passed in the lower 32 bits of a
64-bit register with the non-zero upper 32 bits.  The string/memory
functions written in assembly can only use the lower 32 bits of a
64-bit register as length or must clear the upper 32 bits before using
the full 64-bit register for length.

This pach fixes strnlen/wcsnlen for x32.  Tested on x86-64 and x32.  On
x86-64, libc.so is the same with and withou the fix.

[BZ# 24097]
CVE-2019-6488
* sysdeps/x86_64/multiarch/strlen-avx2.S: Use RSI_LP for length.
Clear the upper 32 bits of RSI register.
* sysdeps/x86_64/strlen.S: Use RSI_LP for length.
* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-strnlen
and tst-size_t-wcsnlen.
* sysdeps/x86_64/x32/tst-size_t-strnlen.c: New file.
* sysdeps/x86_64/x32/tst-size_t-wcsnlen.c: Likewise.

5 years agox86-64 strncpy: Properly handle the length parameter [BZ# 24097]
H.J. Lu [Mon, 21 Jan 2019 19:35:18 +0000 (11:35 -0800)]
x86-64 strncpy: Properly handle the length parameter [BZ# 24097]

On x32, the size_t parameter may be passed in the lower 32 bits of a
64-bit register with the non-zero upper 32 bits.  The string/memory
functions written in assembly can only use the lower 32 bits of a
64-bit register as length or must clear the upper 32 bits before using
the full 64-bit register for length.

This pach fixes strncpy for x32.  Tested on x86-64 and x32.  On x86-64,
libc.so is the same with and withou the fix.

[BZ# 24097]
CVE-2019-6488
* sysdeps/x86_64/multiarch/strcpy-avx2.S: Use RDX_LP for length.
* sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S: Likewise.
* sysdeps/x86_64/multiarch/strcpy-ssse3.S: Likewise.
* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-strncpy.
* sysdeps/x86_64/x32/tst-size_t-strncpy.c: New file.

5 years agox86-64 strncmp family: Properly handle the length parameter [BZ# 24097]
H.J. Lu [Mon, 21 Jan 2019 19:33:52 +0000 (11:33 -0800)]
x86-64 strncmp family: Properly handle the length parameter [BZ# 24097]

On x32, the size_t parameter may be passed in the lower 32 bits of a
64-bit register with the non-zero upper 32 bits.  The string/memory
functions written in assembly can only use the lower 32 bits of a
64-bit register as length or must clear the upper 32 bits before using
the full 64-bit register for length.

This pach fixes the strncmp family for x32.  Tested on x86-64 and x32.
On x86-64, libc.so is the same with and withou the fix.

[BZ# 24097]
CVE-2019-6488
* sysdeps/x86_64/multiarch/strcmp-avx2.S: Use RDX_LP for length.
* sysdeps/x86_64/multiarch/strcmp-sse42.S: Likewise.
* sysdeps/x86_64/strcmp.S: Likewise.
* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-strncasecmp,
tst-size_t-strncmp and tst-size_t-wcsncmp.
* sysdeps/x86_64/x32/tst-size_t-strncasecmp.c: New file.
* sysdeps/x86_64/x32/tst-size_t-strncmp.c: Likewise.
* sysdeps/x86_64/x32/tst-size_t-wcsncmp.c: Likewise.

5 years agox86-64 memset/wmemset: Properly handle the length parameter [BZ# 24097]
H.J. Lu [Mon, 21 Jan 2019 19:32:24 +0000 (11:32 -0800)]
x86-64 memset/wmemset: Properly handle the length parameter [BZ# 24097]

On x32, the size_t parameter may be passed in the lower 32 bits of a
64-bit register with the non-zero upper 32 bits.  The string/memory
functions written in assembly can only use the lower 32 bits of a
64-bit register as length or must clear the upper 32 bits before using
the full 64-bit register for length.

This pach fixes memset/wmemset for x32.  Tested on x86-64 and x32.  On
x86-64, libc.so is the same with and withou the fix.

[BZ# 24097]
CVE-2019-6488
* sysdeps/x86_64/multiarch/memset-avx512-no-vzeroupper.S: Use
RDX_LP for length.  Clear the upper 32 bits of RDX register.
* sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S: Likewise.
* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-wmemset.
* sysdeps/x86_64/x32/tst-size_t-memset.c: New file.
* sysdeps/x86_64/x32/tst-size_t-wmemset.c: Likewise.

5 years agox86-64 memrchr: Properly handle the length parameter [BZ# 24097]
H.J. Lu [Mon, 21 Jan 2019 19:29:58 +0000 (11:29 -0800)]
x86-64 memrchr: Properly handle the length parameter [BZ# 24097]

On x32, the size_t parameter may be passed in the lower 32 bits of a
64-bit register with the non-zero upper 32 bits.  The string/memory
functions written in assembly can only use the lower 32 bits of a
64-bit register as length or must clear the upper 32 bits before using
the full 64-bit register for length.

This pach fixes memrchr for x32.  Tested on x86-64 and x32.  On x86-64,
libc.so is the same with and withou the fix.

[BZ# 24097]
CVE-2019-6488
* sysdeps/x86_64/memrchr.S: Use RDX_LP for length.
* sysdeps/x86_64/multiarch/memrchr-avx2.S: Likewise.
* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-memrchr.
* sysdeps/x86_64/x32/tst-size_t-memrchr.c: New file.

5 years agox86-64 memcpy: Properly handle the length parameter [BZ# 24097]
H.J. Lu [Mon, 21 Jan 2019 19:27:25 +0000 (11:27 -0800)]
x86-64 memcpy: Properly handle the length parameter [BZ# 24097]

On x32, the size_t parameter may be passed in the lower 32 bits of a
64-bit register with the non-zero upper 32 bits.  The string/memory
functions written in assembly can only use the lower 32 bits of a
64-bit register as length or must clear the upper 32 bits before using
the full 64-bit register for length.

This pach fixes memcpy for x32.  Tested on x86-64 and x32.  On x86-64,
libc.so is the same with and withou the fix.

[BZ# 24097]
CVE-2019-6488
* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Use RDX_LP for
length.  Clear the upper 32 bits of RDX register.
* sysdeps/x86_64/multiarch/memcpy-ssse3.S: Likewise.
* sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S:
Likewise.
* sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:
Likewise.
* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-memcpy.
tst-size_t-wmemchr.
* sysdeps/x86_64/x32/tst-size_t-memcpy.c: New file.

5 years agox86-64 memcmp/wmemcmp: Properly handle the length parameter [BZ# 24097]
H.J. Lu [Mon, 21 Jan 2019 19:25:56 +0000 (11:25 -0800)]
x86-64 memcmp/wmemcmp: Properly handle the length parameter [BZ# 24097]

On x32, the size_t parameter may be passed in the lower 32 bits of a
64-bit register with the non-zero upper 32 bits.  The string/memory
functions written in assembly can only use the lower 32 bits of a
64-bit register as length or must clear the upper 32 bits before using
the full 64-bit register for length.

This pach fixes memcmp/wmemcmp for x32.  Tested on x86-64 and x32.  On
x86-64, libc.so is the same with and withou the fix.

[BZ# 24097]
CVE-2019-6488
* sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S: Use RDX_LP for
length.  Clear the upper 32 bits of RDX register.
* sysdeps/x86_64/multiarch/memcmp-sse4.S: Likewise.
* sysdeps/x86_64/multiarch/memcmp-ssse3.S: Likewise.
* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-memcmp and
tst-size_t-wmemcmp.
* sysdeps/x86_64/x32/tst-size_t-memcmp.c: New file.
* sysdeps/x86_64/x32/tst-size_t-wmemcmp.c: Likewise.

5 years agox86-64 memchr/wmemchr: Properly handle the length parameter [BZ# 24097]
H.J. Lu [Mon, 21 Jan 2019 19:23:59 +0000 (11:23 -0800)]
x86-64 memchr/wmemchr: Properly handle the length parameter [BZ# 24097]

On x32, the size_t parameter may be passed in the lower 32 bits of a
64-bit register with the non-zero upper 32 bits.  The string/memory
functions written in assembly can only use the lower 32 bits of a
64-bit register as length or must clear the upper 32 bits before using
the full 64-bit register for length.

This pach fixes memchr/wmemchr for x32.  Tested on x86-64 and x32.  On
x86-64, libc.so is the same with and withou the fix.

[BZ# 24097]
CVE-2019-6488
* sysdeps/x86_64/memchr.S: Use RDX_LP for length.  Clear the
upper 32 bits of RDX register.
* sysdeps/x86_64/multiarch/memchr-avx2.S: Likewise.
* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-memchr and
tst-size_t-wmemchr.
* sysdeps/x86_64/x32/test-size_t.h: New file.
* sysdeps/x86_64/x32/tst-size_t-memchr.c: Likewise.
* sysdeps/x86_64/x32/tst-size_t-wmemchr.c: Likewise.

5 years agoresolv: Do not send queries for non-host-names in nss_dns [BZ #24112]
Florian Weimer [Mon, 21 Jan 2019 08:26:41 +0000 (09:26 +0100)]
resolv: Do not send queries for non-host-names in nss_dns [BZ #24112]

Before this commit, nss_dns would send a query which did not contain a
host name as the query name (such as invalid\032name.example.com) and
then reject the answer in getanswer_r and gaih_getanswer_slice, using
a check based on res_hnok.  With this commit, no query is sent, and a
host-not-found error is returned to NSS without network interaction.

5 years agoresolv: Reformat inet_addr, inet_aton to GNU style
Florian Weimer [Mon, 21 Jan 2019 07:59:42 +0000 (08:59 +0100)]
resolv: Reformat inet_addr, inet_aton to GNU style

5 years agomalloc: Revert fastbins to old-style atomics
Florian Weimer [Fri, 18 Jan 2019 21:38:32 +0000 (22:38 +0100)]
malloc: Revert fastbins to old-style atomics

Commit 6923f6db1e688dedcf3a6556da76e0bf24a41872 ("malloc: Use current
(C11-style) atomics for fastbin access") caused a substantial
performance regression on POWER and Aarch64, and the old atomics,
while hard to prove correct, seem to work in practice.

5 years agoDisable lazy binding on tests for minimal signal handler
H.J. Lu [Fri, 18 Jan 2019 16:56:51 +0000 (08:56 -0800)]
Disable lazy binding on tests for minimal signal handler

Since MINSIGSTKSZ may not have sufficent stack space to allow lazy
binding, build tests for minimal signal handler with -Wl,-z,now to
disable lazy binding.

* signal/Makefile (LDFLAGS-tst-minsigstksz-1): New.  Set to
-Wl,-z,now.
(LDFLAGS-tst-minsigstksz-2): Likewise.
(LDFLAGS-tst-minsigstksz-3): Likewise.
(LDFLAGS-tst-minsigstksz-3a): Likewise.
(LDFLAGS-tst-minsigstksz-4): Likewise.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agomanual: Fix the wording to "alternative" rather than "alternate"
TAMUKI Shoichi [Thu, 17 Jan 2019 15:53:40 +0000 (00:53 +0900)]
manual: Fix the wording to "alternative" rather than "alternate"

ChangeLog:

* manual/time.texi (strftime): Fix the wording to "alternative" rather
than "alternate".

5 years agopowerpc: Fix tiny bug in strncmp.c
Paul Clarke [Tue, 15 Jan 2019 18:42:58 +0000 (12:42 -0600)]
powerpc: Fix tiny bug in strncmp.c

A single underscore was omitted in
sysdeps/powerpc/powerpc64/multiarch/strncmp.c, resulting in use of
power8 version of strncmp instead of power9 version, with significant
performance degradation.

* sysdeps/powerpc/powerpc64/multiarch/strncmp.c: Fix #ifdef.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
5 years agoTests for minimal signal handler functionality in MINSIGSTKSZ space.
Zack Weinberg [Tue, 15 Jan 2019 19:58:15 +0000 (14:58 -0500)]
Tests for minimal signal handler functionality in MINSIGSTKSZ space.

There is general agreement that the very short list of things that ISO
C says you can do in an async signal handler should all work when the
handler is running on an alternate signal stack with only MINSIGSTKSZ
space.  This patch adds tests to make sure those things do work.

To facilitate this, there is a new set of test support routines for
setting up alternate signal stacks; see support/xsignal.h for the API.

         * support/xsignal.h (xalloc_sigstack, xfree_sigstack)
         (xget_sigstack_location): New test support functions.
         * support/xsigstack.c: New file, implementing them.
         * support/tst-xsigstack.c: New test for them.
         * support/Makefile: Update.

         * signal/tst-minsigstksz-1.c
         * signal/tst-minsigstksz-2.c
         * signal/tst-minsigstksz-3.c
         * signal/tst-minsigstksz-3a.c
         * signal/tst-minsigstksz-4.c: New tests.
         * signal/Makefile: Run them.

5 years agoUpdate libc.pot
Siddhesh Poyarekar [Wed, 16 Jan 2019 10:22:23 +0000 (15:52 +0530)]
Update libc.pot

5 years agoAdd XFAIL_ROUNDING_IBM128_LIBGCC to more fma() tests
Tulio Magno Quites Machado Filho [Mon, 14 Jan 2019 19:54:44 +0000 (17:54 -0200)]
Add XFAIL_ROUNDING_IBM128_LIBGCC to more fma() tests

Ignore 112 errors in math/test-ldouble-fma and math/test-ildouble-fma
when IBM 128-bit long double used.
These errors are caused by spurious overflows from libgcc.

* math/libm-test-fma.inc (fma_test_data): Set
XFAIL_ROUNDING_IBM128_LIBGCC to more tests.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
5 years agopowerpc: fix tst-ucontext-ppc64-vscr test for POWER 5/6.
Rogerio Alves [Mon, 14 Jan 2019 13:53:50 +0000 (07:53 -0600)]
powerpc: fix tst-ucontext-ppc64-vscr test for POWER 5/6.

An error "impossible register constraint in 'asm'" was raised on POWER
5 and due to __vector __int128_t being used as operands without passing the
option -msvx to gcc.
This patch replaces "__vector __int128_t" with "__vector unsigned int"
which requires only -maltivec, available since POWER ISA 2.03, and which
is already passed to the compiler.

* sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c:
(do_test): Changed __vector __int128_t to __vector unsigned int.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
5 years agox86-64: Optimize strcat/strncat, strcpy/strncpy and stpcpy/stpncpy with AVX2
Leonardo Sandoval [Mon, 8 Oct 2018 13:59:50 +0000 (08:59 -0500)]
x86-64: Optimize strcat/strncat, strcpy/strncpy and stpcpy/stpncpy with AVX2

Optimize x86-64 strcat/strncat, strcpy/strncpy and stpcpy/stpncpy with AVX2.
It uses vector comparison as much as possible. In general, the larger the
source string, the greater performance gain observed, reaching speedups of
1.6x compared to SSE2 unaligned routines. Select AVX2 strcat/strncat,
strcpy/strncpy and stpcpy/stpncpy on AVX2 machines where vzeroupper is
preferred and AVX unaligned load is fast.

* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
strcat-avx2, strncat-avx2, strcpy-avx2, strncpy-avx2,
stpcpy-avx2 and stpncpy-avx2.
* sysdeps/x86_64/multiarch/ifunc-impl-list.c:
(__libc_ifunc_impl_list): Add tests for __strcat_avx2,
__strncat_avx2, __strcpy_avx2, __strncpy_avx2, __stpcpy_avx2
and __stpncpy_avx2.
* sysdeps/x86_64/multiarch/{ifunc-unaligned-ssse3.h =>
ifunc-strcpy.h}: rename header for a more generic name.
* sysdeps/x86_64/multiarch/ifunc-strcpy.h:
(IFUNC_SELECTOR): Return OPTIMIZE (avx2) on AVX 2 machines if
AVX unaligned load is fast and vzeroupper is preferred.
* sysdeps/x86_64/multiarch/stpcpy-avx2.S: New file
* sysdeps/x86_64/multiarch/stpncpy-avx2.S: Likewise
* sysdeps/x86_64/multiarch/strcat-avx2.S: Likewise
* sysdeps/x86_64/multiarch/strcpy-avx2.S: Likewise
* sysdeps/x86_64/multiarch/strncat-avx2.S: Likewise
* sysdeps/x86_64/multiarch/strncpy-avx2.S: Likewise

5 years agoFix a few typos in comments
Dmitry V. Levin [Sat, 12 Jan 2019 13:44:51 +0000 (13:44 +0000)]
Fix a few typos in comments

Apply the following spelling fixes:
$ git grep -F -l 'relevent' |
  xargs sed -i 's/relevent/relevant/g'
$ git grep -F -l 'checked fot' |
  xargs sed -i 's/checked fot/checked for/g'
$ git grep -F -l "could't" |
  xargs sed -i "s/could't/couldn't/g"
$ git grep -F -l 'wheter' | grep -Fv ChangeLog.old |
  xargs sed -i 's/wheter/whether/g'
$ git grep -F -l 'neccessary' | grep -Fv ChangeLog.old |
  xargs sed -i 's/neccessary/necessary/g'
$ git grep -F -l 'ouput' |
  xargs sed -i 's/ouput/output/g'
$ git grep -F -w -l 'iput' |
  xargs sed -i 's/iput/input/g'

This is inspired by a gnulib bug report at
https://lists.gnu.org/archive/html/bug-gnulib/2019-01/msg00081.html

* argp/argp-help.c: Fix typo in comment.
* misc/sys/cdefs.h: Likewise.
* posix/regexec.c (sift_states_iter_mb): Likewise.
* socket/sockatmark.c: Likewise.
* socket/sys/socket.h: Likewise.
* sysdeps/ia64/fpu/libm_sincos_large.S: Likewise.
* sysdeps/ia64/fpu/libm_sincosl.S: Likewise.
* sysdeps/ia64/fpu/s_cosl.S: Likewise.
* sysdeps/ieee754/dbl-64/k_rem_pio2.c: Likewise.
* sysdeps/unix/sockatmark.c: Likewise.
* time/strptime_l.c: Likewise.

5 years agostrftime: Consequently use the "L_" macro with character literals
TAMUKI Shoichi [Fri, 11 Jan 2019 04:46:40 +0000 (13:46 +0900)]
strftime: Consequently use the "L_" macro with character literals

ChangeLog:

* time/strftime_l.c (__strftime_internal): Use "L_" macros, also add a
missing space after the cast of "_NL_CURRENT".

5 years agopowerpc: Fix VSCR position in ucontext (bug 24088)
Rogerio Alves [Mon, 5 Nov 2018 16:18:38 +0000 (10:18 -0600)]
powerpc: Fix VSCR position in ucontext (bug 24088)

This patch fix VSCR position on ucontext. VSCR was read in the wrong
position on ucontext structure because it was ignoring the machine
endianess.

[BZ #24088]
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (vscr_t): Added
ifdef to fix read of VSCR.
* sysdeps/powerpc/powerpc64/Makefile [$subdir == stdlib]: Add
tst-ucontext-ppc64-vscr.c to test list.
* sysdeps/powerpc/powerpc64/tst-ucontext-ppc64-vscr.c: New test file.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
5 years agoresolv: IDNA tests: AAAA (28) is valid, no fallthrough to default
Andreas K. Hüttel [Thu, 10 Jan 2019 00:17:17 +0000 (01:17 +0100)]
resolv: IDNA tests: AAAA (28) is valid, no fallthrough to default

5 years agoRISC-V: Update LP64D libm-test-ulps.
Jim Wilson [Mon, 7 Jan 2019 00:37:39 +0000 (16:37 -0800)]
RISC-V: Update LP64D libm-test-ulps.

With this patch applied, I get 13 glibc testsuite failures using
TIMEOUTFACTOR=4 on a HiFive Unleashed running Fedora Core 29, using top of
tree binutils and gcc.  5 of those failures are due to a kernel bug.  Without
the patch, there are over a hundred failures.

This patch is incidentally similar to the powerpc-nofpu ulps update that
Joseph Myers added a few days ago.

* sysdeps/riscv/rv64/rvd/libm-test-ulps: Update.

5 years ago[AArch64] Add ifunc support for Ares
Wilco Dijkstra [Wed, 19 Dec 2018 18:28:24 +0000 (18:28 +0000)]
[AArch64] Add ifunc support for Ares

Add Ares to the midr_el0 list and support ifunc dispatch.  Since Ares
supports 2 128-bit loads/stores, use Neon registers for memcpy by
selecting __memcpy_falkor by default (we should rename this to
__memcpy_simd or similar).

* manual/tunables.texi (glibc.cpu.name): Add ares tunable.
* sysdeps/aarch64/multiarch/memcpy.c (__libc_memcpy): Use
__memcpy_falkor for ares.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_ARES):
Add new define.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list):
Add ares cpu.

5 years agosoft-fp: Properly check _FP_W_TYPE_SIZE [BZ #24066]
H.J. Lu [Mon, 7 Jan 2019 17:04:29 +0000 (09:04 -0800)]
soft-fp: Properly check _FP_W_TYPE_SIZE [BZ #24066]

quad.h have

 #if _FP_W_TYPE_SIZE < 64

union _FP_UNION_Q
{
  Use 4 _FP_W_TYPEs
}

 #else

union _FP_UNION_Q
{
  Use 2 _FP_W_TYPEs
}

 #endif

Replace

 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q

with

 #if _FP_W_TYPE_SIZE < 64

to check whether 4 or 2 _FP_W_TYPEs are used for IEEE quad precision.
Tested with build-many-glibcs.py.

[BZ #24066]
* soft-fp/extenddftf2.c: Use "_FP_W_TYPE_SIZE < 64" to check if
4_FP_W_TYPEs are used for IEEE quad precision.
* soft-fp/extendhftf2.c: Likewise.
* soft-fp/extendsftf2.c: Likewise.
* soft-fp/extendxftf2.c: Likewise.
* soft-fp/trunctfdf2.c: Likewise.
* soft-fp/trunctfhf2.c: Likewise.
* soft-fp/trunctfsf2.c: Likewise.
* soft-fp/trunctfxf2.c: Likewise.
* sysdeps/alpha/ots_cvttx.c: Likewise.
* sysdeps/alpha/ots_cvtxt.c: Likewise.
* sysdeps/ieee754/soft-fp/s_daddl.c: Likewise.
* sysdeps/ieee754/soft-fp/s_ddivl.c: Likewise.
* sysdeps/ieee754/soft-fp/s_dmull.c: Likewise.
* sysdeps/ieee754/soft-fp/s_dsubl.c: Likewise.
* sysdeps/ieee754/soft-fp/s_faddl.c: Likewise.
* sysdeps/ieee754/soft-fp/s_fdivl.c: Likewise.
* sysdeps/ieee754/soft-fp/s_fmull.c: Likewise.
* sysdeps/ieee754/soft-fp/s_fsubl.c: Likewise.
* sysdeps/sparc/sparc32/q_dtoq.c: Likewise.
* sysdeps/sparc/sparc32/q_qtod.c: Likewise.
* sysdeps/sparc/sparc32/q_qtos.c: Likewise.
* sysdeps/sparc/sparc32/q_stoq.c: Likewise.
* sysdeps/sparc/sparc64/qp_dtoq.c: Likewise.
* sysdeps/sparc/sparc64/qp_qtod.c: Likewise.
* sysdeps/sparc/sparc64/qp_qtos.c: Likewise.
* sysdeps/sparc/sparc64/qp_stoq.c: Likewise.

5 years agoOnly build libm with -fno-math-errno (bug 24024)
Aurelien Jarno [Thu, 3 Jan 2019 14:51:37 +0000 (15:51 +0100)]
Only build libm with -fno-math-errno (bug 24024)

Commit 1294b1892e ("Add support for sqrt asm redirects") added the
-fno-math-errno flag to build most of the glibc in order to enable GCC
to inline math functions. Due to GCC bug #88576, saving and restoring
errno around calls to malloc are optimized-out. In turn this causes
strerror to set errno to ENOMEM if it get passed an invalid error number
and if malloc sets errno to ENOMEM (which might happen even if it
succeeds). This is not allowed by POSIX.

This patch changes the build flags, building only libm with
-fno-math-errno and all the remaining code with -fno-math-errno. This
should be safe as libm doesn't contain any code saving and restoring
errno around malloc. This patch can probably be reverted once the GCC
bug is fixed and available in stable releases.

Tested on x86-64, no regression in the testsuite.

Changelog:
[BZ #24024]
* Makeconfig: Build libm with -fno-math-errno but build the remaining
code with -fmath-errno.
* string/Makefile [$(build-shared)] (tests): Add test-strerror-errno.
[$(build-shared)] (LDLIBS-test-strerror-errno): New variable.
* string/test-strerror-errno.c: New file.

5 years agoen_US: define date_fmt (bug 24046)
Aurelien Jarno [Sun, 30 Dec 2018 23:29:53 +0000 (00:29 +0100)]
en_US: define date_fmt (bug 24046)

The en_US locale use a 12h am/pm format in both d_fmt and d_t_fmt, which
is correct, but does not define date_fmt. This causes the default value
to be used, which is in 24h format.

This patch adds the date_fmt entry to the en_US locale with the same
value as d_t_fmt as the latter already includes the timezone.

Changelog
[BZ #24046]
* localedata/locales/en_US (date_fmt): Add, set to
"%a %d %b %Y %r %Z".

5 years agomanual: Use @code{errno} instead of @var{errno} [BZ #24063]
Florian Weimer [Mon, 7 Jan 2019 10:42:04 +0000 (11:42 +0100)]
manual: Use @code{errno} instead of @var{errno} [BZ #24063]

@var is intended for placeholders (such as function parameters).
Actual variables need to use @code because @var causes upper-case
output, resulting in a different C identifier.

5 years agoposix: Fix tst-spawn.c issue from commit 805334b26c
Adhemerval Zanella [Sat, 5 Jan 2019 13:58:47 +0000 (11:58 -0200)]
posix: Fix tst-spawn.c issue from commit 805334b26c

Checked on powerpc64le-linux-gnu.

* posix/tst-spawn.c (do_test): Extend spargv to new required size and
fix typo.

5 years agoChangeLog: Fix an obvious typo in the previous commit.
Rafal Luzynski [Fri, 4 Jan 2019 23:34:24 +0000 (00:34 +0100)]
ChangeLog: Fix an obvious typo in the previous commit.

5 years agosysdeps/ieee754: prevent maybe-uninitialized errors with -O [BZ #19444]
Martin Jansa [Fri, 4 Jan 2019 16:17:48 +0000 (16:17 +0000)]
sysdeps/ieee754: prevent maybe-uninitialized errors with -O [BZ #19444]

With -O included in CFLAGS it fails to build with:

../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl':
../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      b = invsqrtpi * temp / sqrtl (x);
          ~~~~~~~~~~^~~~~~
../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_ynl':
../sysdeps/ieee754/ldbl-96/e_jnl.c:375:16: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  b = invsqrtpi * temp / sqrtl (x);
      ~~~~~~~~~~^~~~~~
../sysdeps/ieee754/dbl-64/e_jn.c: In function '__ieee754_jn':
../sysdeps/ieee754/dbl-64/e_jn.c:113:20: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      b = invsqrtpi * temp / sqrt (x);
          ~~~~~~~~~~^~~~~~
../sysdeps/ieee754/dbl-64/e_jn.c: In function '__ieee754_yn':
../sysdeps/ieee754/dbl-64/e_jn.c:320:16: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  b = invsqrtpi * temp / sqrt (x);
      ~~~~~~~~~~^~~~~~

Build tested with Yocto for ARM, AARCH64, X86, X86_64, PPC, MIPS, MIPS64
with -O, -O1, -Os.
For AARCH64 it needs one more fix in locale for -Os:
https://sourceware.org/ml/libc-alpha/2018-09/msg00539.html

[BZ #19444]
* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Use
__builtin_unreachable for default case in switch.
(__ieee754_yn): Likewise.
* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise.
(__ieee754_ynl): Likewise.
* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
(__ieee754_ynl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
(__ieee754_ynl): Likewise.

5 years agoFix the manual for old texinfo
Szabolcs Nagy [Fri, 4 Jan 2019 11:06:04 +0000 (11:06 +0000)]
Fix the manual for old texinfo

Installing the manual fails with texinfo 4.13:

/S/manual/maint.texi:288: Unknown command `lbracechar'.
/S/manual/maint.texi:288: Misplaced {.
/S/manual/maint.texi:288: Misplaced }.
/S/manual/maint.texi:290: Unknown command `rbracechar'.
/S/manual/maint.texi:290: Misplaced {.
/S/manual/maint.texi:290: Misplaced }.
/S/manual/maint.texi:302: Unknown command `lbracechar'.
/S/manual/maint.texi:302: Misplaced {.
/S/manual/maint.texi:302: Misplaced }.
/S/manual/maint.texi:305: Unknown command `rbracechar'.
/S/manual/maint.texi:305: Misplaced {.
/S/manual/maint.texi:305: Misplaced }.
makeinfo: Removing output file `/B/manual/libc.info' due to errors; use --force to preserve.
make[2]: *** [Makefile:142: /B/manual/libc.info] Error 1

* manual/maint.texi: Use @{ and @}.

5 years agoLinux: Improve handling of resource limits in misc/tst-ttyname
Florian Weimer [Fri, 4 Jan 2019 11:12:17 +0000 (12:12 +0100)]
Linux: Improve handling of resource limits in misc/tst-ttyname

An attempt to re-create a different PTY under the same name can fail
if the PTY has a very high number.  Try to increase the file
descriptor limit in this case, and bail out if this still does not
allow the test to proceed.

5 years agonptl: Cleanup cancellation macros
Adhemerval Zanella [Thu, 10 May 2018 20:24:56 +0000 (17:24 -0300)]
nptl: Cleanup cancellation macros

This patch wraps all uses of *_{enable,disable}_asynccancel and
and *_CANCEL_{ASYNC,RESET} in either already provided macros
(lll_futex_timed_wait_cancel) or creates new ones if the
functionality is not provided (SYSCALL_CANCEL_NCS, lll_futex_wait_cancel,
and lll_futex_timed_wait_cancel).

Also for some generic implementations, the direct call of the macros
are removed since the underlying symbols are suppose to provide
cancellation support.

This is a priliminary patch intended to simplify the work required
for BZ#12683 fix.  It is a refactor change, no semantic changes are
expected.

Checked on x86_64-linux-gnu and i686-linux-gnu.

* nptl/pthread_join_common.c (__pthread_timedjoin_ex): Use
lll_wait_tid with timeout.
* nptl/sem_wait.c (__old_sem_wait): Use lll_futex_wait_cancel.
* sysdeps/nptl/aio_misc.h (AIO_MISC_WAIT): Use
futex_reltimed_wait_cancelable for cancelabla mode.
* sysdeps/nptl/gai_misc.h (GAI_MISC_WAIT): Likewise.
* sysdeps/posix/open64.c (__libc_open64): Do not call cancelation
macros.
* sysdeps/posix/sigwait.c (__sigwait): Likewise.
* sysdeps/posix/waitid.c (__sigwait): Likewise.
* sysdeps/unix/sysdep.h (__SYSCALL_CANCEL_CALL,
SYSCALL_CANCEL_NCS): New macro.
* sysdeps/nptl/lowlevellock.h (lll_wait_tid): Add timeout argument.
(lll_timedwait_tid): Remove macro.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h (lll_wait_tid):
Likewise.
(lll_timedwait_tid): Likewise.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_wait_tid):
Likewise.
(lll_timedwait_tid): Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_wait_tid):
Likewise.
(lll_timedwait_tid): Likewise.
* sysdeps/unix/sysv/linux/clock_nanosleep.c (__clock_nanosleep):
Use INTERNAL_SYSCALL_CANCEL.
* sysdeps/unix/sysv/linux/futex-internal.h
(futex_reltimed_wait_cancelable): Use LIBC_CANCEL_{ASYNC,RESET}
instead of __pthread_{enable,disable}_asynccancel.
* sysdeps/unix/sysv/linux/lowlevellock-futex.h
(lll_futex_wait_cancel): New macro.

5 years agoi386: Remove bogus THREAD_ATOMIC_* macros
Adhemerval Zanella [Wed, 9 May 2018 13:39:49 +0000 (10:39 -0300)]
i386: Remove bogus THREAD_ATOMIC_* macros

The x86 defines optimized THREAD_ATOMIC_* macros where reference always
the current thread instead of the one indicated by input 'descr' argument.
It work as long the input is the self thread pointer, however it generates
wrong code if the semantic is to set a bit atomicialy from another thread.

This is not an issue for current GLIBC usage, however the new cancellation
code expects that some synchronization code to atomically set bits from
different threads.

If some usage indeed proves to be a hotspot we can add an extra macro
with a more descriptive name (THREAD_ATOMIC_BIT_SET_SELF for instance)
where i386 might optimize it.

Checked on i686-linux-gnu.

* sysdeps/i686/nptl/tls.h (THREAD_ATOMIC_CMPXCHG_VAL,
THREAD_ATOMIC_AND, THREAD_ATOMIC_BIT_SET): Remove macros.

5 years agox86_64: Remove wrong THREAD_ATOMIC_* macros
Adhemerval Zanella [Wed, 9 May 2018 13:32:25 +0000 (10:32 -0300)]
x86_64: Remove wrong THREAD_ATOMIC_* macros

The x86 defines optimized THREAD_ATOMIC_* macros where reference always
the current thread instead of the one indicated by input 'descr' argument.
It work as long the input is the self thread pointer, however it generates
wrong code if the semantic is to set a bit atomicialy from another thread.

This is not an issue for current GLIBC usage, however the new cancellation
code expects that some synchronization code to atomically set bits from
different threads.

The generic code generates an additional load to reference to TLS segment,
for instance the code:

  THREAD_ATOMIC_BIT_SET (THREAD_SELF, cancelhandling, CANCELED_BIT);

Compiles to:

  lock;orl $4, %fs:776

Where with patch changes it now compiles to:

  mov %fs:16,%rax
  lock;orl $4, 776(%rax)

If some usage indeed proves to be a hotspot we can add an extra macro
with a more descriptive name (THREAD_ATOMIC_BIT_SET_SELF for instance)
where x86_64 might optimize it.

Checked on x86_64-linux-gnu.

* sysdeps/x86_64/nptl/tls.h (THREAD_ATOMIC_CMPXCHG_VAL,
THREAD_ATOMIC_AND, THREAD_ATOMIC_BIT_SET): Remove macros.

5 years agonptl: Fix testcases for new pthread cancellation mechanism
Adhemerval Zanella [Mon, 21 Sep 2015 22:55:58 +0000 (15:55 -0700)]
nptl: Fix testcases for new pthread cancellation mechanism

With upcoming fix for BZ#12683, pthread cancellation does not act for:

  1. If syscall is blocked but with some side effects already having
     taken place (e.g. a partial read or write).
  2. After the syscall has returned.

The main change is due the fact programs need to act in syscalls with
side-effects (for instance, to avoid leak of allocated resources or
handle partial read/write).

This patch changes the NPTL testcase that assumes the old behavior and
also changes the tst-backtrace{5,6} to ignore the cancellable wrappers.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
powerpc-linux-gnu, sparcv9-linux-gnu, and sparc64-linux-gnu.

* debug/tst-backtrace5.c (handle_signal): Avoid cancellable wrappers
in backtrace analysis.
* nptl/tst-cancel4.c (tf_write): Handle cancelled syscall with
side-effects.
(tf_send): Likewise.

5 years agonptl: Remove tst-cancel-wrappers test and related macros
Adhemerval Zanella [Tue, 8 May 2018 19:28:18 +0000 (16:28 -0300)]
nptl: Remove tst-cancel-wrappers test and related macros

With upcoming BZ#12683 fix, syscall cancellation is not more handled
by {libc,pthread,librt}_{enable,disable}_asynccancel symbols.  This renders
both LIBC_CANCEL_HANDLED and empty declaration and tst-cancel-wrappers.sh
unrequired.  This patch removes both the macro and the nptl test.

Checked on x86_64-linux-gnu.

* io/creat.c (LIBC_CANCEL_HANDLED): Remove macro.
* io/ppoll.c (LIBC_CANCEL_HANDLED): Likewise.
* misc/pselect.c (LIBC_CANCEL_HANDLED): Likewise.
* nptl/pthreadP.h (LIBC_CANCEL_HANDLED): Likewise.
* sysdeps/generic/sysdep-cancel.h (LIBC_CANCEL_HANDLED): Likewise.
* sysdeps/mach/hurd/sysdep-cancel.h (LIBC_CANCEL_HANDLED): Likewise.
* sysdeps/posix/pause.c (LIBC_CANCEL_HANDLED): Likewise.
* sysdeps/posix/sigpause.c (LIBC_CANCEL_HANDLED): Likewise.
* sysdeps/unix/sysv/linux/creat.c (LIBC_CANCEL_HANDLED): Likewise.
* sysdeps/unix/sysv/linux/creat64.c (LIBC_CANCEL_HANDLED): Likewise.
* sysdeps/unix/sysv/linux/sigwait.c (LIBC_CANCEL_HANDLED): Likewise.
* sysdeps/unix/sysv/linux/sigwaitinfo.c (LIBC_CANCEL_HANDLED):
Likewise.
* nptl/Makefile [$(run-built-tests) = yes] (tests-special): Remove
tst-cancel-wrappers.sh.
(generated): Remove tst-cancel-wrappers.out.
(tst-cancel-wrappers.out): Remove rule.
* nptl/tst-cancel-wrappers.sh: Remove file.

5 years agoAArch64: Update dl-procinfo.c with new HWCAP
Szabolcs Nagy [Wed, 2 Jan 2019 17:27:02 +0000 (17:27 +0000)]
AArch64: Update dl-procinfo.c with new HWCAP

bits/hwcap.h should be updated together with dl-procinfo.c.

* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h: Add comment.
* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c (_DL_HWCAP_COUNT):
Update.

5 years agoposix: Clear close-on-exec for posix_spawn adddup2 (BZ#23640)
Adhemerval Zanella [Wed, 19 Sep 2018 19:14:34 +0000 (12:14 -0700)]
posix: Clear close-on-exec for posix_spawn adddup2 (BZ#23640)

Austin Group issue #411 [1] proposes that posix_spawn file action
posix_spawn_file_actions_adddup2 resets the close-on-exec when
source and destination refer to same file descriptor.

It solves the issue on multi-thread applications which uses
close-on-exec as default, and want to hand-chose specifically
file descriptor to purposefully inherited into a child process.
Current approach to achieve this scenario is to use two adddup2 file
actions and a temporary file description which do not conflict with
any other, coupled with a close file action to avoid leaking the
temporary file descriptor.  This approach, besides being complex,
may fail with EMFILE/ENFILE file descriptor exaustion.

This can be more easily accomplished with an in-place removal of
FD_CLOEXEC.  Although the resulting adddup2 semantic is slight
different than dup2 (equal file descriptors should be handled as
no-op), the proposed possible solution are either more complex
(fcntl action which a limited set of operations) or results in
unrequired operations (dup3 which also returns EINVAL for same
file descriptor).

Checked on aarch64-linux-gnu.

[BZ #23640]
* posix/tst-spawn.c (do_prepare, handle_restart, do_test): Add
posix_spawn_file_actions_adddup2 test to check O_CLOCEXEC reset.
* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Add
close-on-exec reset for adddup2 file action.
* sysdeps/posix/spawni.c (__spawni_child): Likewise.

[1] http://austingroupbugs.net/view.php?id=411

5 years agoUse C99-compliant scanf under _GNU_SOURCE with modern compilers.
Zack Weinberg [Sat, 10 Feb 2018 16:58:35 +0000 (11:58 -0500)]
Use C99-compliant scanf under _GNU_SOURCE with modern compilers.

The only difference between noncompliant and C99-compliant scanf is
that the former accepts the archaic GNU extension '%as' (also %aS and
%a[...]) meaning to allocate space for the input string with malloc.
This extension conflicts with C99's use of %a as a format _type_
meaning to read a floating-point number; POSIX.1-2008 standardized
equivalent functionality using the modifier letter 'm' instead (%ms,
%mS, %m[...]).

The extension was already disabled in most conformance modes:
specifically, any mode that doesn't involve _GNU_SOURCE and _does_
involve either strict conformance to C99 or loose conformance to both
C99 and POSIX.1-2001 would get the C99-compliant scanf.  With
compilers new enough to use -std=gnu11 instead of -std=gnu89, or
equivalent, that includes the default mode.

With this patch, we now provide C99-compliant scanf in all
configurations except when _GNU_SOURCE is defined *and*
__STDC_VERSION__ or __cplusplus (whichever is relevant) indicates
C89/C++98.  This leaves the old scanf available under e.g. -std=c89
-D_GNU_SOURCE, but removes it from e.g. -std=gnu11 -D_GNU_SOURCE (it
was already not present under -std=gnu11 without -D_GNU_SOURCE) and
from -std=gnu89 without -D_GNU_SOURCE.

There needs to be an internal override so we can compile the
noncompliant scanf itself.  This is the same problem we had when we
removed 'gets' from _GNU_SOURCE and it's dealt with the same way:
there's a new __GLIBC_USE symbol, DEPRECATED_SCANF, which defaults to
off under the appropriate conditions for external code, but can be
overridden by individual files within stdio.

We also run into problems with PLT bypass for internal uses of sscanf,
because libc_hidden_proto uses __REDIRECT and so does the logic in
stdio.h for choosing which implementation of scanf to use; __REDIRECT
isn't transitive, so include/stdio.h needs to bridge the gap with a
macro.  As far as I can tell, sscanf is the only function in this
family that's internally called by unrelated code.

Finally, there are several tests in stdio-common that use the
extension.  bug21.c is a regression test for a crash; it still
exercises the relevant code when changed to use %ms instead of %as.
scanf14.c through scanf17.c are more complicated since they are
actually testing the subtleties of the extension - under what
circumstances is 'a' treated as a modifier letter, etc.  I changed all
of them to use %ms instead of %as as well, but duplicated scanf14.c
and scanf16.c as scanf14a.c and scanf16a.c.  These still use %as and
are compiled with -std=gnu89 to access the old extension.  A bunch of
diagnostic overrides and manual workarounds for the old stdio.h
behavior become unnecessary.  Yay!

* include/features.h (__GLIBC_USE_DEPRECATED_SCANF): New __GLIBC_USE
parameter.  Only use deprecated scanf when __USE_GNU is defined
and __STDC_VERSION__ is less than 199901L or __cplusplus is less
than 201103L, whichever is relevant for the language being compiled.

* libio/stdio.h, libio/bits/stdio-ldbl.h: Decide whether to redirect
scanf, fscanf, sscanf, vscanf, vfscanf, and vsscanf to their
__isoc99_ variants based only on __GLIBC_USE (DEPRECATED_SCANF).
* wcsmbs/wchar.h: wcsmbs/bits/wchar-ldbl.h: Likewise for
wscanf, fwscanf, swscanf, vwscanf, vfwscanf, and vswscanf.

* libio/iovsscanf.c
* libio/fwscanf.c
* libio/iovswscanf.c
* libio/swscanf.c
* libio/vscanf.c
* libio/vwscanf.c
* libio/wscanf.c
* stdio-common/fscanf.c
* stdio-common/scanf.c
* stdio-common/vfscanf.c
* stdio-common/vfwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-scanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c
* sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c:
Override __GLIBC_USE_DEPRECATED_SCANF to 1.

* stdio-common/sscanf.c: Likewise.  Remove ldbl_hidden_def for __sscanf.
* stdio-common/isoc99_sscanf.c: Add libc_hidden_def for __isoc99_sscanf.
* include/stdio.h: Provide libc_hidden_proto for __isoc99_sscanf,
not sscanf.
[!__GLIBC_USE (DEPRECATED_SCANF)]: Define sscanf as __isoc99_scanf
with a preprocessor macro.

* stdio-common/bug21.c, stdio-common/scanf14.c:
Use %ms instead of %as, %mS instead of %aS, %m[] instead of %a[];
remove DIAG_IGNORE_NEEDS_COMMENT for -Wformat.
* stdio-common/scanf16.c: Likewise.  Add __attribute__ ((format (scanf)))
to xscanf, xfscanf, xsscanf.

* stdio-common/scanf14a.c: New copy of scanf14.c which still uses
%as, %aS, %a[].  Remove DIAG_IGNORE_NEEDS_COMMENT for -Wformat.
* stdio-common/scanf16a.c: New copy of scanf16.c which still uses
%as, %aS, %a[].  Add __attribute__ ((format (scanf))) to xscanf,
xfscanf, xsscanf.
* stdio-common/scanf15.c, stdio-common/scanf17.c: No need to
override feature selection macros or provide definitions of u_char etc.
* stdio-common/Makefile (tests): Add scanf14a and scanf16a.
(CFLAGS-scanf15.c, CFLAGS-scanf17.c): Remove.
(CFLAGS-scanf14a.c, CFLAGS-scanf16a.c): New.  Compile these files
with -std=gnu89.

5 years agotermios: Consolidate termios.h
Adhemerval Zanella [Tue, 9 Oct 2018 21:57:53 +0000 (18:57 -0300)]
termios: Consolidate termios.h

This patch consolidates the Linux termios.h by removing the arch-specific
one.

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
bits/termios-misc.h.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Remove file.
* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/bits/termios-misc.h: New file.
* sysdeps/unix/sysv/linux/bits/termios.h: Include termios-misc.h.

5 years agotermios: Add powerpc termios-misc
Adhemerval Zanella [Tue, 9 Oct 2018 20:41:28 +0000 (17:41 -0300)]
termios: Add powerpc termios-misc

PowerPC termios.h header contains additional BSD terminal mode definitions
(sgttyb, tchars, ltchars, and associated TIOCPKT_* symbolic constants).
This patch moves all powerpc termios specific definition to its own header.

No semantic change is expected, checked on a build against a
powerpc64le-linux-gnu build.

* sysdeps/unix/sysv/linux/powerpc/bits/termios-misc.h: New file.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_MISC]
(struct sgtty, struct tchars, struct ltchars, TIOCPKT_DATA,
TIOCPKT_FLUSHREAD, TIOCPKT_FLUSHWRITE, TIOCPKT_STOP, TIOCPKT_START,
TIOCPKT_NOSTOP, TIOCPKT_DOSTOP, _VINTR, _VQUIT, _VERASE, _VKILL,
_VEOF, _VMIN, _VEOL, _VTIME, _VEOL2, _VSWTC): Move to
termios-misc.h.
* sysdeps/unix/sysv/linux/powerpc/Makefile [$subdir == misc]
(sysdep_headers): Add termios-misc.h.

5 years agotermios: Remove Linux _IOT_termios
Adhemerval Zanella [Tue, 9 Oct 2018 20:28:27 +0000 (17:28 -0300)]
termios: Remove Linux _IOT_termios

It is used only on hurd.

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

* sysdeps/unix/sysv/linux/bits/termios.h (_IOT_termios): Remove.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.

5 years agotermios: Consolidate tcflow symbolic constants
Adhemerval Zanella [Tue, 9 Oct 2018 18:54:16 +0000 (15:54 -0300)]
termios: Consolidate tcflow symbolic constants

This patch consolidates the termios symbolic constants for use with tcflow
in its own header.  The Linux generic implementation values match the
kernel UAPI and each architecture with deviate values have their own
implementation (currently only mips).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
termios-tcflow.h.
* sysdeps/unix/sysv/linux/bits/termios-tcflow.h: New file.
* sysdeps/unix/sysv/linux/mips/bits/termios-tcflow.h: Likewise.
* sysdeps/unix/sysv/linux/bits/termios.h (TCSANOW, TCSADRAIN,
TCSAFLUSH): Move to termios-tcflow.h.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.

5 years agotermios: Consolidate local mode definitions
Adhemerval Zanella [Tue, 9 Oct 2018 18:34:31 +0000 (15:34 -0300)]
termios: Consolidate local mode definitions

This patch consolidates the termios symbolic constants used for local
mode with c_lflag member on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha, mips, and powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
termios-c_lflag.h.
* sysdeps/unix/sysv/linux/bits/termios-c_lflag.h: New file.
* sysdeps/unix/sysv/linux/alpha/bits/termios-c_lflag.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios-c_lflag.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h: Likewise.
* sysdeps/unix/sysv/linux/bits/termios.h (ISIG, ISCANON, ECHO, ECHOE,
ECHOK, ECHONL, NOFLSH, TOSTOP, IEXTEN): Move to termios-c_lflag.h.
[__USE_MISC || (__USE_XOPEN && !__USE_XOPEN2K)] (XCASE): Likewise.
[__USE_MISC] (ECHOCTL, ECHOPRT, ECHOKE, FLUSHO, PENDIN, EXTPROC):
Likewise.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.

5 years agotermios: Consolidate control mode definitions
Adhemerval Zanella [Tue, 9 Oct 2018 18:03:30 +0000 (15:03 -0300)]
termios: Consolidate control mode definitions

This patch consolidates the termios symbolic constants used for output
mode with c_cflag memver on its own header.  The Linux generic
implementation values match the kernel UAPI and each architecture with
deviate values have their own implementation (in this case alpha and
powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
termios-c_cflag.h.
* sysdeps/unix/sysv/linux/bits/termios-c_cflag.h: New file.
* sysdeps/unix/sysv/linux/alpha/bits/termios-c_cflag.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cflag.h: Likewise.
* sysdeps/unix/sysv/linux/bits/termios.h (CSIZE, CS5, CS6, CS7, CS8,
CSTOPB, CREAD, PARENB, PARODD, HUPCL, CLOCAL): Move to
termios-c_cflag.h.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.

5 years agotermios: Consolidate Baud Rate Selection definitions (BZ#23783)
Adhemerval Zanella [Tue, 9 Oct 2018 17:35:03 +0000 (14:35 -0300)]
termios: Consolidate Baud Rate Selection definitions (BZ#23783)

This patch consolidates the termios symbolic constants used for baud rates
selection used along with speed_t on its own header.  The Linux generic
implementation values match the kernel UAPI and each architecture with
deviate values have their own implementation (in this case alpha and
powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

[BZ #23783]
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
termios-baud.h.
* sysdeps/unix/sysv/linux/bits/termios-baud.h: New file.
* sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios-baud.h: Likewise.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h (B57600, B115200,
B230400B460800B500000B576000B921600B1000000B1152000,
B1500000B2000000B2500000B3000000B3500000B4000000,
__MAX_BAUD): Move to termios-baud.h.
[__USE_MISC] (CBAUD, CBAUDEX): Likewise.
* sysdeps/unix/sysv/linux/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.

5 years agotermios: Consolidate Output Modes definitions
Adhemerval Zanella [Tue, 9 Oct 2018 14:56:06 +0000 (11:56 -0300)]
termios: Consolidate Output Modes definitions

This patch consolidates the termios symbolic constants used for ouput
modes with c_oflag member on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha, powerpc, and sparc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add
termios-c_oflag.h.
* sysdeps/unix/sysv/linux/bits/termios-c_oflag.h: New file.
* sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h: Likewise.
* sysdeps/unix/sysv/linux/bits/termios.h (OPOST, OLCUC, ONLCR, OCRNL,
ONOCR, ONLRET, OFILL, OFDEL, VTDLY, VT0, VT1):  Move to
termios-c_oflag.h.
[__USE_MISC || __USE_XOPEN] (NLDLY, NL0, NL1, CRDLY, CR0, CR1, CR2,
CR3, TABDLY, TAB0, TAB1, TAB2, TAB3, BSDLY, BS0, BS1, FFDLY, FF0,
FFR1): Likewise.
[USE_MISC] (XTABS): Likewise.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios.h Likewise.

5 years agotermios: Consolidate Input Modes definitions.
Adhemerval Zanella [Tue, 9 Oct 2018 14:02:40 +0000 (11:02 -0300)]
termios: Consolidate Input Modes definitions.

This patch consolidates the termios symbolic constants used for input
modes with c_iflag member on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha and powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

* sysdeps/unix/sysv/linux/Makefile (sysdeps_headers): Add
termios-c_iflag.h.
* sysdeps/unix/sysv/linux/bits/termios-c_iflag.h: New file.
* sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h: Likewise.
* sysdeps/unix/sysv/linux/bits/termios.h (IGNBRK, BRKINT, IGNPAR, PARMRK,
INPCK, ISTRIP, INLCR, IGNCR, ICRNL, IXON, IXOFF, IXANY, IUCLC, IMAXBEL,
IUTF8): Move to termios-c_iflag.h.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.

5 years agotermios: Consolidate termios c_cc symbolic constants
Adhemerval Zanella [Tue, 9 Oct 2018 13:26:14 +0000 (10:26 -0300)]
termios: Consolidate termios c_cc symbolic constants

This patch consolidates the termios symbolic constants used as subscript
for the array c_cc on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha, mips64, sparc64, and
powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

* sysdeps/unix/sysv/linux/Makefile (sysdeps_headers): Add
termios-cc.h.
* sysdeps/unix/sysv/linux/bits/termios-c_cc.h: Likewise.
* sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h: New file.
* sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h: Likewise.
* sysdeps/unix/sysv/linux/bits/termios.h (VINTR, VQUIT, VERASE,
VKILL, VEOF, VTIME, VMIN, VSWTC, VSTART, VSTOP, VSUSP, VEOL,
VREPRINT, VDISCARD, VWERASE, VLNEXT, VEOLF2): Move to termios-cc.h.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.

5 years agotermios: Consolidate struct termios
Adhemerval Zanella [Tue, 9 Oct 2018 13:00:14 +0000 (10:00 -0300)]
termios: Consolidate struct termios

This patch consolidates the struct termios definition on its own header
and adds arch-defined ones for ABIs that deviate from generic
implementation. They are:

  - alpha which has a slight different layout than generic one (c_cc
    field is defined prior c_line).

  - sparc and mips which do not have the c_ispeed/c_ospeed fields.

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

* sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h: New file.
* sysdeps/unix/sysv/linux/bits/termios-struct.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios-struct.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h: Likewise.
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
termios-struct.h.
* sysdeps/unix/sysv/linux/bits/termios.h (struct termios): Move to
termios-struct.h.
* sysdeps/unix/sysv/linux/alpha/bits/termios.h (struct termios):
Likewise.
* sysdeps/unix/sysv/linux/mips/bits/termios.h (struct termios):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h (struct termios):
Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios.h (struct termios):
Likewise.
* sysdeps/unix/sysv/linux/kernel_termios.h (_HAVE_C_ISPEED,
_HAVE_C_OSPEED): Define.
* sysdeps/unix/sysv/linux/mips/kernel_termios.h (_HAVE_C_ISPEED,
_HAVE_C_OSPEED): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel_termios.h (_HAVE_C_ISPEED,
_HAVE_C_OSPEED): Likewise.
* sysdeps/unix/sysv/linux/speed.c [_HAVE_STRUCT_TERMIOS_C_OSPEED]
(cfsetospeed): Check for define value instead of existence.
[_HAVE_STRUCT_TERMIOS_C_ISPEED] (cfsetispeed): Likewise.
* sysdeps/unix/sysv/linux/tcgetattr.c [_HAVE_STRUCT_TERMIOS_C_ISPEED
&& _HAVE_C_ISPEED] (__tcgetattr): Likewise.
* sysdeps/unix/sysv/linux/tcsetattr.c [_HAVE_STRUCT_TERMIOS_C_ISPEED
&& _HAVE_C_ISPEED] (__tcsetattr): Likewise.

5 years agotermios: Define TIOCSER_TEMT with __USE_MISC (BZ#17783)
Adhemerval Zanella [Mon, 8 Oct 2018 20:51:32 +0000 (17:51 -0300)]
termios: Define TIOCSER_TEMT with __USE_MISC (BZ#17783)

This patch defines TIOCSER_TEMT on all architectures using the __USE_MISC
guards similar to BZ#17782 fix.  Latest Linux UAPI defines TIOCSER_TEMT
with the same value for all architectures, so it is safe to use the value
as default for all ABIs.

Checked on x86_64linux-gnu and build against sparc64-linux-gnu and
powerpc64le-linux-gnu.

[BZ #17783]
* sysdeps/unix/sysv/linux/bits/termios.h [__USE_MISC] (TIOCSER_TEMT):
Define.
* sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_MISC]
(TIOCSER_TEMT): Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/termios.h [__USE_MISC]
(TEOCSER_TEMT): Likewise.

5 years agobs_BA: Fix a small typo in comment (bug 24011).
PanderMusubi [Tue, 1 Jan 2019 13:13:00 +0000 (14:13 +0100)]
bs_BA: Fix a small typo in comment (bug 24011).

[BZ #24011]
* localedata/locales/bs_BA (LC_TELEPHONE): Fix a typo in comment.

5 years agoUpdate powerpc-nofpu libm-test-ulps.
Joseph Myers [Wed, 2 Jan 2019 22:38:47 +0000 (22:38 +0000)]
Update powerpc-nofpu libm-test-ulps.

* sysdeps/powerpc/nofpu/libm-test-ulps: Update.

5 years agohurd: advertise *_setpshared as not supported
Samuel Thibault [Wed, 2 Jan 2019 21:21:34 +0000 (22:21 +0100)]
hurd: advertise *_setpshared as not supported

The functions themselves return 0, but initializing a mutex/etc with       .
pshared set to 1 will fail anyway                                          .

* sysdeps/htl/pt-barrierattr-setpshared.c
(pthread_barrierattr_setpshared): Add stub warning.
* sysdeps/htl/pt-condattr-setpshared.c
(pthread_condattr_setpshared): Likewise.
* sysdeps/htl/pt-mutexattr-setpshared.c
(pthread_mutexattr_setpshared): Likewise.
* sysdeps/htl/pt-rwlockattr-setpshared.c
(pthread_rwlockattr_setpshared): Likewise.
* sysdeps/mach/hurd/htl/pt-mutexattr-setpshared.c
(pthread_mutexattr_setpshared): Likewise.

5 years agoUpdate Linux kernel version in tst-mman-consts.py.
Joseph Myers [Wed, 2 Jan 2019 18:35:50 +0000 (18:35 +0000)]
Update Linux kernel version in tst-mman-consts.py.

This patch updates the Linux kernel version in tst-mman-consts.py to
4.20 (meaning that's the version for which glibc is expected to have
the same constants as the kernel, up to the exceptions listed in the
test).  (Once we have more such tests sharing common infrastructure, I
expect the kernel version will be something set in the infrastructure
shared by all such tests, rather than something needing updating
separately for each test for each new kernel version.)

Tested with build-many-glibcs.py.

* sysdeps/unix/sysv/linux/tst-mman-consts.py (main): Expect
constants to match with Linux 4.20.

5 years agoUpdate MIPS libm-test-ulps.
Joseph Myers [Wed, 2 Jan 2019 17:25:33 +0000 (17:25 +0000)]
Update MIPS libm-test-ulps.

* sysdeps/mips/mips32/libm-test-ulps: Update.
* sysdeps/mips/mips64/libm-test-ulps: Likewise.

5 years agoARM: fix kernel assisted atomics with GCC 8 (bug 24034)
Aurelien Jarno [Wed, 2 Jan 2019 17:21:18 +0000 (18:21 +0100)]
ARM: fix kernel assisted atomics with GCC 8 (bug 24034)

The pre-ARMv7 CPUs are missing atomic compare and exchange and/or
barrier instructions. Therefore those are implemented using kernel
assistance, calling a kernel function at a specific address, and passing
the arguments in the r0 to r4 registers. This is done by specifying
registers for local variables. The a_ptr variable is placed in the r2
register and declared with __typeof (mem). According to the GCC
documentation on local register variables, if mem is a constant pointer,
the compiler may substitute the variable with its initializer in asm
statements, which may cause the corresponding operand to appear in a
different register.

This happens in __libc_start_main with the pointer to the thread counter
for static binaries (but not the shared ones):

  # ifdef SHARED
        unsigned int *ptr = __libc_pthread_functions.ptr_nthreads;
  #  ifdef PTR_DEMANGLE
        PTR_DEMANGLE (ptr);
  #  endif
  # else
        extern unsigned int __nptl_nthreads __attribute ((weak));
        unsigned int *const ptr = &__nptl_nthreads;
  # endif

This causes static binaries using threads to crash when the GNU libc is
built with GCC 8 and most notably tst-cancel21-static.

To fix that, use the same trick than for the volatile qualifier,
defining a_ptr as a union.

Changelog:
[BZ #24034]
* sysdeps/unix/sysv/linux/arm/atomic-machine.h
(__arm_assisted_compare_and_exchange_val_32_acq): Use uint32_t rather
than __typeof (...) for the a_ptr variable.

This page took 0.098933 seconds and 5 git commands to generate.