]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
3 years agoForward-port google-nsl-stub
Paul Pluzhnikov [Fri, 28 Feb 2014 14:44:46 +0000 (06:44 -0800)] 
Forward-port google-nsl-stub

3 years agoFix memory leak in TLS allocation
James Y Knight [Wed, 21 Oct 2020 20:38:14 +0000 (13:38 -0700)] 
Fix memory leak in TLS allocation

3 years agoAdd a test of TLS support that will fail if leaky
Stan Shebs [Wed, 21 Oct 2020 20:19:47 +0000 (13:19 -0700)] 
Add a test of TLS support that will fail if leaky

3 years agoLet time and gettimeofday use vdso by removing old clang workaround
Stan Shebs [Tue, 6 Oct 2020 20:08:18 +0000 (13:08 -0700)] 
Let time and gettimeofday use vdso by removing old clang workaround

3 years agoUse crt*.o files from llvm compiler-rt when building with clang
Stan Shebs [Tue, 9 Jun 2020 17:09:34 +0000 (10:09 -0700)] 
Use crt*.o files from llvm compiler-rt when building with clang

3 years agoDo not use ppc-specific long double pack/unpack when compiling with clang
Stan Shebs [Tue, 9 Jun 2020 17:05:56 +0000 (10:05 -0700)] 
Do not use ppc-specific long double pack/unpack when compiling with clang

3 years agoRemove old workaround in power7 logb functions, clang no longer crashes on the inline...
Stan Shebs [Thu, 6 Feb 2020 19:58:01 +0000 (11:58 -0800)] 
Remove old workaround in power7 logb functions, clang no longer crashes on the inline assembly

3 years agoAdditional fixes for llvm-as
Josh Kunz [Fri, 24 Jan 2020 01:37:14 +0000 (17:37 -0800)] 
Additional fixes for llvm-as

Unlike GCC, llvm always uses an integrated assembler, which attempts to
recognized all `asm` statements written in the C code. glibc uses some
syntactically invalid asm statements to emit constants into assembly that
are later extracted with a sed or AWK script.

This change fixes two such invalid `asm` statements by wrapping the
output in a `.ascii` directive.. This does not break the sed/AWK (the same
special sequence is output) but it makes the statement syntactically valid.

See cf8e3f8757 for a previous fix for the same issue.

3 years agoAdd workaround for infinite looping in ppc vsyscall for sched_getcpu.
Stan Shebs [Fri, 24 Jan 2020 16:17:38 +0000 (08:17 -0800)] 
Add workaround for infinite looping in ppc vsyscall for sched_getcpu.

3 years agoAdd -Wno-incomplete-setjmp-declaration to prevent clang from unhelpfully complaining...
Stan Shebs [Fri, 24 Jan 2020 16:16:04 +0000 (08:16 -0800)] 
Add -Wno-incomplete-setjmp-declaration to prevent clang from unhelpfully complaining about __sigsetjmp, both in library build and testsuite runs.

3 years agoUpdate passwd.borg handling to use passwd.borg.real
Stan Shebs [Fri, 20 Dec 2019 21:58:35 +0000 (13:58 -0800)] 
Update passwd.borg handling to use passwd.borg.real

3 years agoAdd a case to async-signal-safe TLS to set static TLS instead of waiting for a dlopen...
Stan Shebs [Fri, 8 Nov 2019 21:41:17 +0000 (13:41 -0800)] 
Add a case to async-signal-safe TLS to set static TLS instead of waiting for a dlopen that may not actually be happening.

3 years agoAdd an LD_DEBUG=tls option to help debug thread-local storage handling in ld.so
Stan Shebs [Fri, 8 Nov 2019 20:40:53 +0000 (12:40 -0800)] 
Add an LD_DEBUG=tls option to help debug thread-local storage handling in ld.so

3 years agoRemove an unneeded local refactor in _dl_update_slotinfo
Stan Shebs [Wed, 30 Oct 2019 20:32:13 +0000 (13:32 -0700)] 
Remove an unneeded local refactor in _dl_update_slotinfo

3 years agoFix year 2039 bug for localtime with 64-bit time_t (bug 22639).
Joseph Myers [Fri, 18 May 2018 11:57:15 +0000 (11:57 +0000)] 
Fix year 2039 bug for localtime with 64-bit time_t (bug 22639).

Bug 22639 reports localtime failing to handle time offset transitions
correctly in 2039 and later on platforms with 64-bit time_t.

The problem is the use of SECSPERDAY (constant 86400) in calculations
such as

    t = ((year - 1970) * 365
 + /* Compute the number of leapdays between 1970 and YEAR
      (exclusive).  There is a leapday every 4th year ...  */
 + ((year - 1) / 4 - 1970 / 4)
 /* ... except every 100th year ... */
 - ((year - 1) / 100 - 1970 / 100)
 /* ... but still every 400th year.  */
 + ((year - 1) / 400 - 1970 / 400)) * SECSPERDAY;

where t is of type time_t and year is of type int.  Before my commit
92bd70fb85bce57ac47ba5d8af008736832c955a (an update from tzcode,
included in 2.26 and later releases), SECSPERDAY was obtained from a
file imported from tzcode, where the value included a cast to
int_fast32_t.  On 64-bit platforms, glibc defines int_fast32_t to be
long int, so 64-bit, but my patch resulted in it changing to int.
(The bug would probably have existed even before my patch for x32,
which has 64-bit time_t but 32-bit int_fast32_t, but I haven't
verified that.)

This patch fixes the problem by including a cast to time_t in the
definition of SECSPERDAY.  (64-bit time support for 32-bit systems
should move such code that isn't a public interface to using the
internal 64-bit version of time_t throughout.)

Tested for x86_64 and x86.

[BZ #22639]
* time/tzset.c (SECSPERDAY): Cast to time_t.
* time/tst-y2039.c: New file.
* time/Makefile (tests): Add tst-y2039.

3 years agoReduce __MAX_ALLOCA_CUTOFF to 8192
Stan Shebs [Tue, 8 Oct 2019 21:30:43 +0000 (14:30 -0700)] 
Reduce __MAX_ALLOCA_CUTOFF to 8192

3 years agoMake multi-arch ifunc support work with clang
Stan Shebs [Tue, 8 Oct 2019 20:00:12 +0000 (13:00 -0700)] 
Make multi-arch ifunc support work with clang

3 years agoRevert clang workaround for _begin that is no longer needed
Stan Shebs [Tue, 8 Oct 2019 14:07:18 +0000 (07:07 -0700)] 
Revert clang workaround for _begin that is no longer needed

3 years agoRedesign the fastload support for additional performance
Ambrose Feinstein [Wed, 11 Sep 2019 21:53:28 +0000 (14:53 -0700)] 
Redesign the fastload support for additional performance

3 years agoAdd comments explaining the diff from cf8e3f8757
Josh Kunz [Mon, 12 Aug 2019 20:28:09 +0000 (13:28 -0700)] 
Add comments explaining the diff from cf8e3f8757

These comments should make it easier to see the (small) diff introduced
in cf8e3f8757. Without these comments, the diff may get list on a future
upstream merge.

3 years agoMake gen-XX-const scripts work with llvm-as
Josh Kunz [Wed, 7 Aug 2019 18:40:50 +0000 (11:40 -0700)] 
Make gen-XX-const scripts work with llvm-as

The gen-as-const and gen-py-const scripts are used to generate integer constant
definitions from a list of constant C-expressions. This is achieved by
generating a C program with inline `asm` statements, that depend on
these constant expressions. During compilation, the constant expressions
are evaluated, and included in the inline asm. The build process
generates only the assembly, and then used `sed` to extract the values
from the assembly text.

This is clever. It allows the build process to extract the value of C
statements built under the target architecture. The implementation is a
bit fragile, but it is not immediately obvious to me how it could be
improved.

This change slightly modifies `gen-as-const` and `gen-py-const` to emit
valid assembly directives instead of invalid directives that were
previously emitted. Since the values are extracted via string parsing,
this has no effect on the values extracted. This is needed because the
LLVM assembler validates all statements before emitting them, whereas it
appears GCC will literally emit any `asm` directives without validation
or recognition.

3 years agoFix sense of a test in the static-linking version of ppc get_clockfreq
Stan Shebs [Fri, 17 May 2019 19:25:19 +0000 (12:25 -0700)] 
Fix sense of a test in the static-linking version of ppc get_clockfreq

3 years agoMakes it compile for AArch64
Shu-Chun Weng [Fri, 19 Apr 2019 21:50:50 +0000 (14:50 -0700)] 
Makes it compile for AArch64

De-nesting fix in 83c02e85 changed function signature but AArch64 was untested.

3 years agoMakes AArch64 assembly acceptable to clang
Shu-Chun Weng [Fri, 19 Apr 2019 21:47:59 +0000 (14:47 -0700)] 
Makes AArch64 assembly acceptable to clang

According to ARMv8 architecture reference manual section C7.2.188, SIMD MOV (to
general) instruction format is

  MOV <Xd>, <Vn>.D[<index>]

gas appears to accept "<Vn>.2D[<index>]" as well, but clang's assembler does
not. C.f. https://community.arm.com/developer/ip-products/processors/f/cortex-a-forum/5214/aarch64-assembly-syntax-for-armclang

3 years agoInclude STATIC_PIE_BOOTSTRAP with !NESTING in powerpc64/dl-machine.h
Siva Chandra Reddy [Tue, 9 Apr 2019 18:57:19 +0000 (11:57 -0700)] 
Include STATIC_PIE_BOOTSTRAP with !NESTING in powerpc64/dl-machine.h

3 years agoActuall use LLVM_OBJCOPY if available.
Siva Chandra Reddy [Mon, 8 Apr 2019 20:54:25 +0000 (13:54 -0700)] 
Actuall use LLVM_OBJCOPY if available.

3 years agoUse llvm-objcopy, if available, to remove the .llvm_addrsig sections.
Siva Chandra Reddy [Fri, 5 Apr 2019 14:46:36 +0000 (07:46 -0700)] 
Use llvm-objcopy, if available, to remove the .llvm_addrsig sections.

3 years agoEnable relaxed relocations when building certain object files for x86_64.
Siva Chandra Reddy [Tue, 2 Apr 2019 17:18:01 +0000 (10:18 -0700)] 
Enable relaxed relocations when building certain object files for x86_64.

3 years agoUn-nest an include in dl-reloc-static-pie.c.
Siva Chandra Reddy [Mon, 1 Apr 2019 18:26:29 +0000 (11:26 -0700)] 
Un-nest an include in dl-reloc-static-pie.c.

A corresponding adjustment in sysdeps/x86_64/dl-machine.h has also been
made.

3 years agoDisable -mfloat128 for clang, lets power9 insns into power8 executables
Stan Shebs [Mon, 25 Mar 2019 22:21:27 +0000 (15:21 -0700)] 
Disable -mfloat128 for clang, lets power9 insns into power8 executables

3 years agoAlso work around clang bctrl issue in get_clockfreq.c
Stan Shebs [Mon, 25 Mar 2019 21:03:24 +0000 (14:03 -0700)] 
Also work around clang bctrl issue in get_clockfreq.c

3 years ago[BZ #19239] Don't include sys/sysmacros.h from sys/types.h.
Zack Weinberg [Wed, 7 Feb 2018 20:45:58 +0000 (15:45 -0500)] 
[BZ #19239] Don't include sys/sysmacros.h from sys/types.h.

This completes the deprecation and removal of this inclusion, which
was begun in the 2.25 release.

* posix/sys/types.h: Don't include sys/sysmacros.h.
* misc/sys/sysmacros.h: Remove the conditional deprecation
warnings for the macros defined by this header.

3 years agoRemove .llvm_addrsig sections from crt.o files
Stan Shebs [Wed, 27 Feb 2019 22:03:33 +0000 (14:03 -0800)] 
Remove .llvm_addrsig sections from crt.o files

3 years agoForward-port cl/42676407 to disable link-time warning about mktemp, tempnam and tmpnam.
Brooks Moses [Fri, 13 Jun 2014 04:59:51 +0000 (21:59 -0700)] 
Forward-port cl/42676407 to disable link-time warning about mktemp, tempnam and tmpnam.

3 years agoChanges to compile glibc-2.27 on PPC (Power8) with clang.
Raman Tenneti [Fri, 27 Aug 2021 23:36:05 +0000 (16:36 -0700)] 
Changes to compile glibc-2.27 on PPC (Power8) with clang.

+ Use DOT_MACHINE macro instead of ".machine" instruction.
+ Use __isinf and __isinff instead of builtin versions.
+ In s_logb, s_logbf and s_logbl functions, used float versions to
  calculate "ret = x & 0x7f800000;" expression.

3 years agoAdd a note about passwd.borg.base organization
Stan Shebs [Wed, 5 Dec 2018 19:10:03 +0000 (11:10 -0800)] 
Add a note about passwd.borg.base organization

3 years agoFix mistaken order of arguments to open_path
Stan Shebs [Wed, 5 Dec 2018 17:47:39 +0000 (09:47 -0800)] 
Fix mistaken order of arguments to open_path

3 years agoUpdate build notes
Stan Shebs [Thu, 15 Nov 2018 19:59:49 +0000 (11:59 -0800)] 
Update build notes

3 years agoUndid the dl_enable_fastload environment variable changes.
Raman Tenneti [Fri, 17 Aug 2018 18:31:35 +0000 (11:31 -0700)] 
Undid the dl_enable_fastload environment variable changes.

3 years agoAdd "fastload" support.
Paul Pluzhnikov [Wed, 5 Mar 2014 03:07:05 +0000 (19:07 -0800)] 
Add "fastload" support.

3 years agoWork around lack of mfppr in clang
Stan Shebs [Thu, 27 Sep 2018 18:14:32 +0000 (11:14 -0700)] 
Work around lack of mfppr in clang

3 years agoWork around mtfsb0 syntax limitation with clang
Stan Shebs [Wed, 26 Sep 2018 21:44:39 +0000 (14:44 -0700)] 
Work around mtfsb0 syntax limitation with clang

3 years agoAvoid passing gcc-specific options to clang
Stan Shebs [Wed, 26 Sep 2018 21:31:55 +0000 (14:31 -0700)] 
Avoid passing gcc-specific options to clang

3 years agoMake asm-based constraints be gcc-only
Stan Shebs [Wed, 26 Sep 2018 21:16:30 +0000 (14:16 -0700)] 
Make asm-based constraints be gcc-only

3 years agoMake xxland syntax gcc-only
Stan Shebs [Wed, 26 Sep 2018 21:14:49 +0000 (14:14 -0700)] 
Make xxland syntax gcc-only

3 years agoAdd a first approximation of float definitions for ppc clang
Stan Shebs [Wed, 26 Sep 2018 21:04:13 +0000 (14:04 -0700)] 
Add a first approximation of float definitions for ppc clang

3 years agoMake powerpc .machine directives be gcc-only
Stan Shebs [Fri, 27 Aug 2021 23:42:33 +0000 (16:42 -0700)] 
Make powerpc .machine directives be gcc-only

3 years agoMake mutex hints gcc-only, improve a type in __arch_compare_and_exchange_bool_32_acq
Stan Shebs [Wed, 26 Sep 2018 20:50:57 +0000 (13:50 -0700)] 
Make mutex hints gcc-only, improve a type in __arch_compare_and_exchange_bool_32_acq

3 years agoMake power6 directives be gcc-only
Stan Shebs [Wed, 26 Sep 2018 20:47:46 +0000 (13:47 -0700)] 
Make power6 directives be gcc-only

3 years agoAdd power9 flag to go with -mfloat128
Stan Shebs [Wed, 26 Sep 2018 20:43:57 +0000 (13:43 -0700)] 
Add power9 flag to go with -mfloat128

3 years agoDisable more attempts to pass -mlong-double-128 to clang
Stan Shebs [Wed, 26 Sep 2018 20:36:42 +0000 (13:36 -0700)] 
Disable more attempts to pass -mlong-double-128 to clang

3 years agoDisable attempts to pass -mlong-double-128 to clang
Stan Shebs [Wed, 26 Sep 2018 20:13:31 +0000 (13:13 -0700)] 
Disable attempts to pass -mlong-double-128 to clang

3 years agoAdd workaround for clang link failure in elf/tst-unique4
Stan Shebs [Wed, 26 Sep 2018 15:06:14 +0000 (08:06 -0700)] 
Add workaround for clang link failure in elf/tst-unique4

3 years agoAdd workaround for infinite looping in ppc vsyscalls
Stan Shebs [Tue, 25 Sep 2018 17:52:37 +0000 (10:52 -0700)] 
Add workaround for infinite looping in ppc vsyscalls

3 years agoWork around clang crash by skipping apparently-unneeded asm
Stan Shebs [Tue, 25 Sep 2018 15:04:10 +0000 (08:04 -0700)] 
Work around clang crash by skipping apparently-unneeded asm

3 years agoWork around clang problem with ifuncs and vdso
Stan Shebs [Tue, 25 Sep 2018 14:58:13 +0000 (07:58 -0700)] 
Work around clang problem with ifuncs and vdso

3 years agoWork around a ppc clang inlining bug
Stan Shebs [Tue, 25 Sep 2018 14:48:20 +0000 (07:48 -0700)] 
Work around a ppc clang inlining bug

3 years agoAdd workaround for segfaults in __longjmp when compiled with ppc clang
Stan Shebs [Tue, 25 Sep 2018 14:20:18 +0000 (07:20 -0700)] 
Add workaround for segfaults in __longjmp when compiled with ppc clang

3 years agoAdd clang version of find_cxx_header
Stan Shebs [Mon, 24 Sep 2018 22:31:31 +0000 (15:31 -0700)] 
Add clang version of find_cxx_header

3 years agoChange de-nesting fix to use added argument instead of globals
Stan Shebs [Fri, 14 Sep 2018 17:21:15 +0000 (10:21 -0700)] 
Change de-nesting fix to use added argument instead of globals

3 years agoFix regressions in async-safe TLS, add run-time control for debugging, add more comments
Stan Shebs [Fri, 3 Aug 2018 18:24:51 +0000 (11:24 -0700)] 
Fix regressions in async-safe TLS, add run-time control for debugging, add more comments

3 years agoFix TLS problems not handled by cherrypick
Stan Shebs [Tue, 10 Jul 2018 19:05:15 +0000 (12:05 -0700)] 
Fix TLS problems not handled by cherrypick

3 years agoRevert upstream removal of async-safe TLS patches.
Brooks Moses [Mon, 24 Feb 2014 19:04:49 +0000 (11:04 -0800)] 
Revert upstream removal of async-safe TLS patches.

3 years agoMake pointer in tst-realloc volatile also
Stan Shebs [Fri, 8 Jun 2018 20:47:29 +0000 (13:47 -0700)] 
Make pointer in tst-realloc volatile also

3 years agoAdd a GRTE-specific readme.
Stan Shebs [Wed, 6 Jun 2018 18:42:14 +0000 (11:42 -0700)] 
Add a GRTE-specific readme.

3 years agoWork around a make 3.81 segfault with clang
Stan Shebs [Fri, 1 Jun 2018 21:57:50 +0000 (14:57 -0700)] 
Work around a make 3.81 segfault with clang

3 years agoNEWS: Move security-lated changes before bug list
Florian Weimer [Thu, 24 May 2018 13:50:29 +0000 (15:50 +0200)] 
NEWS: Move security-lated changes before bug list

This matches the practice for previous releases.

3 years agoAdd references to CVE-2018-11236, CVE-2017-18269
Florian Weimer [Thu, 24 May 2018 12:41:57 +0000 (14:41 +0200)] 
Add references to CVE-2018-11236, CVE-2017-18269

3 years agoAdd a test case for [BZ #23196]
H.J. Lu [Wed, 23 May 2018 10:59:56 +0000 (03:59 -0700)] 
Add a test case for [BZ #23196]

[BZ #23196]
* string/test-memcpy.c (do_test1): New function.
(test_main): Call it.

(cherry picked from commit ed983107bbc62245b06b99f02e69acf36a0baa3e)

3 years agoDon't write beyond destination in __mempcpy_avx512_no_vzeroupper (bug 23196)
Andreas Schwab [Thu, 24 May 2018 12:39:18 +0000 (14:39 +0200)] 
Don't write beyond destination in __mempcpy_avx512_no_vzeroupper (bug 23196)

When compiled as mempcpy, the return value is the end of the destination
buffer, thus it cannot be used to refer to the start of it.

(cherry picked from commit 9aaaab7c6e4176e61c59b0a63c6ba906d875dc0e)

3 years agosunrpc: Remove stray exports without --enable-obsolete-rpc [BZ #23166]
Florian Weimer [Tue, 15 May 2018 06:21:11 +0000 (08:21 +0200)] 
sunrpc: Remove stray exports without --enable-obsolete-rpc [BZ #23166]

This is needed to avoid a warning when linking against libtirpc:

/lib64/libc.so.6: warning: common of `rpc_createerr@@TIRPC_0.3.0' overridden by definition
/usr/lib64/libtirpc.so: warning: defined here

This ld warning is not enabled by default; -Wl,--warn-common enables it.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 89aacb513eb77549a29df2638913a0f8178cf3f5)

3 years agogd_GB: Fix typo in abbreviated "May" (bug 23152).
Rafal Luzynski [Wed, 9 May 2018 01:06:32 +0000 (03:06 +0200)] 
gd_GB: Fix typo in abbreviated "May" (bug 23152).

[BZ #23152]
* localedata/locales/gd_GB (abmon): Fix typo in May:
"Mhàrt" -> "Cèit".  Adjust the comment according to the change.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit bb066cb806dfe55511cf2fb59bf013751152608f)

3 years agoNEWS: add entries for bugs 17343, 20419, 22644, 22786, 22884, 22947, 23005, 23037...
Dmitry V. Levin [Thu, 10 May 2018 10:56:25 +0000 (10:56 +0000)] 
NEWS: add entries for bugs 17343, 20419, 22644, 22786, 22884, 22947, 23005, 23037, 23069, 23137

3 years agoFix path length overflow in realpath [BZ #22786]
Paul Pluzhnikov [Wed, 9 May 2018 01:12:41 +0000 (18:12 -0700)] 
Fix path length overflow in realpath [BZ #22786]

Integer addition overflow may cause stack buffer overflow
when realpath() input length is close to SSIZE_MAX.

2018-05-09  Paul Pluzhnikov  <ppluzhnikov@google.com>

[BZ #22786]
* stdlib/canonicalize.c (__realpath): Fix overflow in path length
computation.
* stdlib/Makefile (test-bz22786): New test.
* stdlib/test-bz22786.c: New test.

(cherry picked from commit 5460617d1567657621107d895ee2dd83bc1f88f2)

3 years agoFix stack overflow with huge PT_NOTE segment [BZ #20419]
Paul Pluzhnikov [Sun, 6 May 2018 01:08:27 +0000 (18:08 -0700)] 
Fix stack overflow with huge PT_NOTE segment [BZ #20419]

A PT_NOTE in a binary could be arbitratily large, so using alloca
for it may cause stack overflow.  If the note is larger than
__MAX_ALLOCA_CUTOFF, use dynamically allocated memory to read it in.

2018-05-05  Paul Pluzhnikov  <ppluzhnikov@google.com>

[BZ #20419]
* elf/dl-load.c (open_verify): Fix stack overflow.
* elf/Makefile (tst-big-note): New test.
* elf/tst-big-note-lib.S: New.
* elf/tst-big-note.c: New.

(cherry picked from commit 0065aaaaae51cd60210ec3a7e13dddd8e01ffe2c)

3 years agoFix blocking pthread_join. [BZ #23137]
Stefan Liebler [Fri, 4 May 2018 08:00:59 +0000 (10:00 +0200)] 
Fix blocking pthread_join. [BZ #23137]

On s390 (31bit) if glibc is build with -Os, pthread_join sometimes
blocks indefinitely. This is e.g. observable with
testcase intl/tst-gettext6.

pthread_join is calling lll_wait_tid(tid), which performs the futex-wait
syscall in a loop as long as tid != 0 (thread is alive).

On s390 (and build with -Os), tid is loaded from memory before
comparing against zero and then the tid is loaded a second time
in order to pass it to the futex-wait-syscall.
If the thread exits in between, then the futex-wait-syscall is
called with the value zero and it waits until a futex-wake occurs.
As the thread is already exited, there won't be a futex-wake.

In lll_wait_tid, the tid is stored to the local variable __tid,
which is then used as argument for the futex-wait-syscall.
But unfortunately the compiler is allowed to reload the value
from memory.

With this patch, the tid is loaded with atomic_load_acquire.
Then the compiler is not allowed to reload the value for __tid from memory.

ChangeLog:

[BZ #23137]
* sysdeps/nptl/lowlevellock.h (lll_wait_tid):
Use atomic_load_acquire to load __tid.

(cherry picked from commit 1660901840dfc9fde6c5720a32f901af6f08f00a)

3 years agoAdd PTRACE_SECCOMP_GET_METADATA from Linux 4.16 to sys/ptrace.h.
Joseph Myers [Tue, 24 Apr 2018 12:11:35 +0000 (12:11 +0000)] 
Add PTRACE_SECCOMP_GET_METADATA from Linux 4.16 to sys/ptrace.h.

This patch adds the PTRACE_SECCOMP_GET_METADATA constant from Linux
4.16 to all relevant sys/ptrace.h files.  A type struct
__ptrace_seccomp_metadata, analogous to other such types, is also
added.

Tested for x86_64, and with build-many-glibcs.py.

* sysdeps/unix/sysv/linux/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): New enum value and macro.
* sysdeps/unix/sysv/linux/bits/ptrace-shared.h
(struct __ptrace_seccomp_metadata): New type.
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/arm/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/s390/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/tile/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.
* sysdeps/unix/sysv/linux/x86/sys/ptrace.h
(PTRACE_SECCOMP_GET_METADATA): Likewise.

(cherry picked from commit 9320ca88a197d3620d3553ccc2d9402d981d7e23)

3 years agoresolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]
Florian Weimer [Mon, 9 Apr 2018 08:08:07 +0000 (10:08 +0200)] 
resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]

(cherry picked from commit 583a27d525ae189bdfaa6784021b92a9a1dae12e)

3 years agomanual: Various fixes to the mbstouwcs example, and mbrtowc update
Florian Weimer [Thu, 5 Apr 2018 10:52:19 +0000 (12:52 +0200)] 
manual: Various fixes to the mbstouwcs example, and mbrtowc update

The example did not work because the null byte was not converted, and
mbrtowc was called with a zero-length input string.  This results in a
(size_t) -2 return value, so the function always returns NULL.

The size computation for the heap allocation of the result was
incorrect because it did not deal with integer overflow.

Error checking was missing, and the allocated memory was not freed on
error paths.  All error returns now set errno.  (Note that there is an
assumption that free does not clobber errno.)

The slightly unportable comparision against (size_t) -2 to catch both
(size_t) -1 and (size_t) -2 return values is gone as well.

A null wide character needs to be stored in the result explicitly, to
terminate it.

The description in the manual is updated to deal with these finer
points.  The (size_t) -2 behavior (consuming the input bytes) matches
what is specified in ISO C11.

(cherry picked from commit cf138b0c83b3210990b29772e2af5982fb0e3c26)
(cherry picked from commit 690c3475f1417c99cb0fc69f35d77560c24c1d69)

3 years agomanual: Move mbstouwcs to an example C file
Florian Weimer [Thu, 5 Apr 2018 10:50:58 +0000 (12:50 +0200)] 
manual: Move mbstouwcs to an example C file

(cherry picked from commit 0f339252697e6dcfc9e00be6cd8272d4260b90d2)

3 years agoUpdate RWF_SUPPORTED for Linux kernel 4.16 [BZ #22947]
H.J. Lu [Tue, 3 Apr 2018 19:19:20 +0000 (12:19 -0700)] 
Update RWF_SUPPORTED for Linux kernel 4.16 [BZ #22947]

Add RWF_APPEND to RWF_SUPPORTED to support Linux kernel 4.16.

[BZ #22947]
* bits/uio-ext.h (RWF_APPEND): New.
* sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_APPEND): Likewise.
* manual/llio.texi: Document RWF_APPEND.
* misc/tst-preadvwritev2-common.c (RWF_APPEND): New.
(RWF_SUPPORTED): Add RWF_APPEND.

(cherry picked from commit f2652643d7234c08205b75f527191c2e2b35251f)

3 years agogetlogin_r: return early when linux sentinel value is set
Jesse Hathaway [Tue, 27 Mar 2018 21:17:59 +0000 (21:17 +0000)] 
getlogin_r: return early when linux sentinel value is set

When there is no login uid Linux sets /proc/self/loginid to the sentinel
value of, (uid_t) -1. If this is set we can return early and avoid
needlessly looking up the sentinel value in any configured nss
databases.

Checked on aarch64-linux-gnu.

* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid): Return
early when linux sentinel value is set.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit cc8a1620eb97ccddd337d157263c13c57b39ab71)

3 years agoFix crash in resolver on memory allocation failure (bug 23005)
Andreas Schwab [Tue, 27 Mar 2018 10:16:11 +0000 (12:16 +0200)] 
Fix crash in resolver on memory allocation failure (bug 23005)

(cherry picked from commit f178e59fa5eefbbd37fde040ae8334aa5c857ee1)

3 years agoFix signed integer overflow in random_r (bug 17343).
Joseph Myers [Tue, 20 Mar 2018 18:25:24 +0000 (18:25 +0000)] 
Fix signed integer overflow in random_r (bug 17343).

Bug 17343 reports that stdlib/random_r.c has code with undefined
behavior because of signed integer overflow on int32_t.  This patch
changes the code so that the possibly overflowing computations use
unsigned arithmetic instead.

Note that the bug report refers to "Most code" in that file.  The
places changed in this patch are the only ones I found where I think
such overflow can occur.

Tested for x86_64 and x86.

[BZ #17343]
* stdlib/random_r.c (__random_r): Use unsigned arithmetic for
possibly overflowing computations.

(cherry picked from commit 8a07b0c43c46a480da070efd53a2720195e2256f)

3 years agoAdd tst-sigaction.c to test BZ #23069
Aurelien Jarno [Thu, 26 Apr 2018 20:21:13 +0000 (22:21 +0200)] 
Add tst-sigaction.c to test BZ #23069

This simple test uses sigaction to define a signal handler. It then
uses sigaction again to fetch the information about the same signal
handler, and check that they are consistent. This is enough to detect
mismatches between struct kernel_sigaction and the kernel version of
struct sigaction, like in BZ #23069.

Changelog:
       * signal/tst-sigaction.c: New file to test BZ #23069.
       * signal/Makefile (tests): Fix indentation. Add tst-sigaction.

(cherry picked from commit 7a6f74787132aca8e3809cae8d9e7bc7bfd55ce1)

3 years agoRISC-V: fix struct kernel_sigaction to match the kernel version [BZ #23069]
Aurelien Jarno [Sat, 28 Apr 2018 11:13:43 +0000 (13:13 +0200)] 
RISC-V: fix struct kernel_sigaction to match the kernel version [BZ #23069]

The RISC-V kernel doesn't define SA_RESTORER, hence the kernel version
of struct sigaction doesn't have the sa_restorer field. The default
kernel_sigaction.h therefore can't be used.

This patch adds a RISC-V specific version of kernel_sigaction.h to fix
the issue. This fixes for example the libnih testsuite.

Note that this patch is not needed in master as the bug has been fixed
by commit b4a5d26d8835 ("linux: Consolidate sigaction implementation").

3 years agoLinux i386: tst-bz21269 triggers SIGBUS on some kernels
Florian Weimer [Thu, 29 Mar 2018 09:42:24 +0000 (11:42 +0200)] 
Linux i386: tst-bz21269 triggers SIGBUS on some kernels

In addition to SIGSEGV and SIGILL, SIGBUS is also a possible signal
generated by the kernel.

(cherry picked from commit 4d76d3e59d31aa690f148fc0c95cc0c581aed3e8)

3 years agoFix i386 memmove issue (bug 22644).
Andrew Senkevich [Fri, 23 Mar 2018 15:19:45 +0000 (16:19 +0100)] 
Fix i386 memmove issue (bug 22644).

[BZ #22644]
* sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Fixed
branch conditions.
* string/test-memmove.c (do_test2): New testcase.

(cherry picked from commit cd66c0e584c6d692bc8347b5e72723d02b8a8ada)

3 years agoUpdate ChangeLog for BZ 22884 - riscv fmax/fmin
DJ Delorie [Fri, 23 Feb 2018 21:08:08 +0000 (16:08 -0500)] 
Update ChangeLog for BZ 22884 - riscv fmax/fmin

(cherry picked from commit 7e04eb2932d3126c721ee2bc0d664a5bbea2f41f)

3 years agoRISC-V: fmax/fmin: Handle signalling NaNs correctly.
Andrew Waterman [Thu, 22 Feb 2018 19:31:54 +0000 (14:31 -0500)] 
RISC-V: fmax/fmin: Handle signalling NaNs correctly.

RISC-V's fmax(sNAN,4) returns 4 but glibc expects it to return qNAN.

* sysdeps/riscv/rvd/s_fmax.c (__fmax): Handle sNaNs correctly.
* sysdeps/riscv/rvd/s_fmin.c (__fmin): Likewise.
* sysdeps/riscv/rvf/s_fmaxf.c (__fmaxf): Likewise.
* sysdeps/riscv/rvf/s_fminf.c (__fminf): Likewise.

(cherry picked from commit fdcc625376505eacb1125a6aeba57501407a30ec)

3 years agoRISC-V: Do not initialize $gp in TLS macros.
DJ Delorie [Thu, 22 Feb 2018 19:28:47 +0000 (14:28 -0500)] 
RISC-V: Do not initialize $gp in TLS macros.

RISC-V TLS doesn't require GP to be initialized, and doing so breaks
TLS in a shared object.

(cherry picked from commit 8090720a87e42fddc31396f6126112d4b8014d8e)

3 years agoNEWS: Add entries for bugs: 22848, 22932, 22937, 22963.
Rafal Luzynski [Thu, 15 Mar 2018 02:29:07 +0000 (03:29 +0100)] 
NEWS: Add entries for bugs: 22848, 22932, 22937, 22963.

Alternative (nominative/genitive) month names have been added to the
Catalan and Czech locale data and the abbreviated alternative names to
Catalan and Greek.

(cherry picked from commit c553cd6f7e939ae4ef62b52b3c55fbe76dddecee)

3 years agocs_CZ locale: Add alternative month names (bug 22963).
Rafal Luzynski [Mon, 17 Oct 2016 20:06:11 +0000 (22:06 +0200)] 
cs_CZ locale: Add alternative month names (bug 22963).

Add alternative month names, primary month names are genitive now.

[BZ #22963]
* localedata/locales/cs_CZ (mon): Rename to...
(alt_mon): This.
(mon): Import from CLDR (genitive case).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 807fee29d2c967e24e3fe05e2182ba53e96e9178)

3 years agoGreek (el_CY, el_GR) locales: Introduce ab_alt_mon (bug 22937).
Rafal Luzynski [Wed, 7 Mar 2018 23:45:04 +0000 (00:45 +0100)] 
Greek (el_CY, el_GR) locales: Introduce ab_alt_mon (bug 22937).

As spotted by GNOME translation team, Greek language has the actually
visible difference between the abbreviated nominative and the abbreviated
genitive case for some month names.  Examples:

and more month names with similar differences.

Original discussion: https://bugzilla.gnome.org/show_bug.cgi?id=793645#c21

[BZ #22937]
* localedata/locales/el_CY (abmon): Rename to...
(ab_alt_mon): This.
(abmon): Import from CLDR (abbreviated genitive case).
* localedata/locales/el_GR (abmon): Rename to...
(ab_alt_mon): This.
(abmon): Import from CLDR (abbreviated genitive case).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit e7155a28ef61f240da156e1cea410b61afca14ad)

7 years agolt_LT locale: Update abbreviated month names (bug 22932).
Rafal Luzynski [Wed, 7 Mar 2018 23:38:18 +0000 (00:38 +0100)] 
lt_LT locale: Update abbreviated month names (bug 22932).

A GNOME translator asked to use the same abbreviated month names
as provided by CLDR.  This sounds reasonable.  See the discussion:
https://bugzilla.gnome.org/show_bug.cgi?id=793645#c27

[BZ #22932]
* localedata/locales/lt_LT (abmon): Synchronize with CLDR.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 71d7b121686f6d91cd5a630dcfb72197b5d8284a)

7 years agoca_ES locale: Update LC_TIME (bug 22848).
Robert Buj [Tue, 6 Mar 2018 21:51:29 +0000 (22:51 +0100)] 
ca_ES locale: Update LC_TIME (bug 22848).

Add/fix alternative month names, long & short formats, am_pm,
abday settings, and improve indentation for Catalan.

[BZ #22848]
* localedata/locales/ca_ES (abmon): Rename to...
(ab_alt_mon): This, then synchronize with CLDR (nominative case).
(mon): Rename to...
(alt_mon): This.
(abmon): Import from CLDR (genitive case, month names preceded by
"de" or "d'").
(mon): Likewise.
(abday): Synchronize with CLDR.
(d_t_fmt): Likewise.
(d_fmt): Likewise.
(am_pm): Likewise.

(LC_TIME): Improve indentation.
(LC_TELEPHONE): Likewise.
(LC_NAME): Likewise.
(LC_ADDRESS): Likewise.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit a00bffe8b531693d3b26c1e87afe4b9eac84474c)

7 years agoUpdate translations from the Translation Project
Dmitry V. Levin [Mon, 12 Mar 2018 13:24:46 +0000 (13:24 +0000)] 
Update translations from the Translation Project

* po/pt_BR.po: Update translations.

(cherry picked from commit 778f1974863d63e858b6d0105e41d6f0c30732d3)

7 years agoi386: Fix i386 sigaction sa_restorer initialization (BZ#21269)
Adhemerval Zanella [Fri, 17 Nov 2017 18:04:29 +0000 (16:04 -0200)] 
i386: Fix i386 sigaction sa_restorer initialization (BZ#21269)

This patch fixes the i386 sa_restorer field initialization for sigaction
syscall for kernel with vDSO.  As described in bug report, i386 Linux
(and compat on x86_64) interprets SA_RESTORER clear with nonzero
sa_restorer as a request for stack switching if the SS segment is 'funny'.
This means that anything that tries to mix glibc's signal handling with
segmentation (for instance through modify_ldt syscall) is randomly broken
depending on what values lands in sa_restorer.

The testcase added  is based on Linux test tools/testing/selftests/x86/ldt_gdt.c,
more specifically in do_multicpu_tests function.  The main changes are:

  - C11 atomics instead of plain access.

  - Remove x86_64 support which simplifies the syscall handling and fallbacks.

  - Replicate only the test required to trigger the issue.

Checked on i686-linux-gnu.

[BZ #21269]
* sysdeps/unix/sysv/linux/i386/Makefile (tests): Add tst-bz21269.
* sysdeps/unix/sysv/linux/i386/sigaction.c (SET_SA_RESTORER): Clear
sa_restorer for vDSO case.
* sysdeps/unix/sysv/linux/i386/tst-bz21269.c: New file.

(cherry picked from commit 68448be208ee06e76665918b37b0a57e3e00c8b4)

7 years agoFix multiple definitions of __nss_*_database (bug 22918)
Andreas Schwab [Fri, 2 Mar 2018 22:07:14 +0000 (23:07 +0100)] 
Fix multiple definitions of __nss_*_database (bug 22918)

(cherry picked from commit eaf6753f8aac33a36deb98c1031d1bad7b593d2d)

7 years ago[BZ #22342] Fix netgroup cache keys.
DJ Delorie [Fri, 2 Mar 2018 04:20:45 +0000 (23:20 -0500)] 
[BZ #22342] Fix netgroup cache keys.

Unlike other nscd caches, the netgroup cache contains two types of
records - those for "iterate through a netgroup" (i.e. setnetgrent())
and those for "is this user in this netgroup" (i.e. innetgr()),
i.e. full and partial records.  The timeout code assumes these records
have the same key for the group name, so that the collection of records
that is "this netgroup" can be expired as a unit.

However, the keys are not the same, as the in-netgroup key is generated
by nscd rather than being passed to it from elsewhere, and is generated
without the trailing NUL.  All other keys have the trailing NUL, and as
noted in the linked BZ, debug statements confirm that two keys for the
same netgroup are added to the cache with two different lengths.

The result of this is that as records in the cache expire, the purge
code only cleans out one of the two types of entries, resulting in
stale, possibly incorrect, and possibly inconsistent cache data.

The patch simply includes the existing NUL in the computation for the
key length ('key' points to the char after the NUL, and 'group' to the
first char of the group, so 'key-group' includes the first char to the
NUL, inclusive).

[BZ #22342]
* nscd/netgroupcache.c (addinnetgrX): Include trailing NUL in
key value.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 1c81d55fc4b07b51adf68558ba74ce975153e580)