aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-02-14powerpc: Consolidate Linux syscall definitionAdhemerval Zanella
The diferences between powerpc64{le} and powerpc32 Linux sysdep.h are: 1. On both vDSO and syscall macros the volatile registers r9, r10, r11, and r12 are used as input operands on powerpc32 and as clobber registers on powerpc64. However the outcome is essentially the same, it advertise the register might be clobbered by the kernel (although Linux won't leak register information to userland in such case). 2. The LOADARGS* macros uses a different size to check for invalid types. 3. The pointer mangling support guard pointer loading uses ABI specific instruction and register. This patch consolidates on only one sysdep by using the the powerpc64 version as default and add the adjustments required for powerpc32. Checked on powerpc64-linux-gnu, powerpc64le-linux-gnu, and powerpc-linux-gnu-power4.
2020-02-14i386: Enable CET support in ucontext functionsH.J. Lu
1. getcontext and swapcontext are updated to save the caller's shadow stack pointer and return address. 2. setcontext and swapcontext are updated to restore shadow stack and jump to new context directly. 3. makecontext is updated to allocate a new shadow stack and set the caller's return address to the helper code, L(exitcode). 4. Since we no longer save and restore EAX, ECX and EDX in getcontext, setcontext and swapcontext, we can use them as scratch register slots to enable CET in ucontext functions. Since makecontext allocates a new shadow stack when making a new context and kernel allocates a new shadow stack for clone/fork/vfork syscalls, we track the current shadow stack base. In setcontext and swapcontext, if the target shadow stack base is the same as the current shadow stack base, we unwind the shadow stack. Otherwise it is a stack switch and we look for a restore token. We enable shadow stack at run-time only if program and all used shared objects, including dlopened ones, are shadow stack enabled, which means that they must be compiled with GCC 8 or above and glibc 2.28 or above. We need to save and restore shadow stack only if shadow stack is enabled. When caller of getcontext, setcontext, swapcontext and makecontext is compiled with smaller ucontext_t, shadow stack won't be enabled at run-time. We check if shadow stack is enabled before accessing the extended field in ucontext_t. Tested on i386 CET/non-CET machines. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-02-14tst-clone3: Use __NR_futex_time64 if we don't have __NR_futexAlistair Francis
We can't include sysdep.h in the test case (it introduces lots of strange failures) so __NR_futex isn't redifined to __NR_futex_time64 by 64-bit time_t 32-bit archs (y2038 safe). To allow the test to pass let's just do the __NR_futex_time64 syscall if we don't have __NR_futex defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-14powerpc64: Add memory protection key support [BZ #23202]Florian Weimer
The 32-bit protection key behavior is somewhat unclear on 32-bit powerpc, so this change is restricted to the 64-bit variants. Flag translation is needed because of hardware differences between the POWER implementation (read and write flags) and the Intel implementation (write and read+write flags).
2020-02-14ldbl-128ibm-compat: Provide a scalb implementationTulio Magno Quites Machado Filho
Reuse the template in order to provide the redirect for scalbl to __scalbieee128, but avoid any extra aliasing as this is intended to support long double redirects only.
2020-02-14Add a generic scalb implementationTulio Magno Quites Machado Filho
This is a preparatory patch to enable building a _Float128 variant to ease reuse when building a _Float128 variant to alias this long double only symbol. Notably, stubs are added where missing to the native _Float128 sysdep dir to prevent building these newly templated variants created inside the build directories. Also noteworthy are the changes around LIBM_SVID_COMPAT. These changes are not intuitive. The templated version is only enabled when !LIBM_SVID_COMPAT, and the compat version is predicated entirely on LIBM_SVID_COMPAT. Thus, exactly one is stubbed out entirely when building. The nldbl scalb compat files are updated to account for this. Likewise, fixup the reuse of m68k's e_scalb{f,l}.c to include it's override of e_scalb.c. Otherwise, the search path finds the templated copy in the build directory. This could be futher simplified by providing an overridden template, but I lack the hardware to verify.
2020-02-14Adjust thresholds in Bessel function implementations (bug 14469).Joseph Myers
A recent discussion in bug 14469 notes that a threshold in float Bessel function implementations, used to determine when to use a simpler implementation approach, results in substantially inaccurate results. As I discussed in <https://sourceware.org/ml/libc-alpha/2013-03/msg00345.html>, a heuristic argument suggests 2^(S+P) as the right order of magnitude for a suitable threshold, where S is the number of significand bits in the floating-point type and P is the number of significant bits in the representation of the floating-point type, and the float and ldbl-96 implementations use thresholds that are too small. Some threshold does need using, there or elsewhere in the implementation, to avoid spurious underflow and overflow for large arguments. This patch sets the thresholds in the affected implementations to more heuristically justifiable values. Results will still be inaccurate close to zeroes of the functions (thus this patch does *not* fix any of the bugs for Bessel function inaccuracy); fixing that would require a different implementation approach, likely along the lines described in <http://www.cl.cam.ac.uk/~jrh13/papers/bessel.ps.gz>. So the justification for a change such as this would be statistical rather than based on particular tests that had excessive errors and no longer do so (no doubt such tests could be found, but would probably be too fragile to add to the testsuite, as liable to give large errors again from very small implementation changes or even from compiler changes). See <https://sourceware.org/ml/libc-alpha/2020-02/msg00638.html> for such statistics of the resulting improvements for float functions. Tested (glibc testsuite) for x86_64.
2020-02-14resolv: Fix ABA race in /etc/resolv.conf change detection [BZ #25420]Florian Weimer
__resolv_conf_get_current should only record the initial file change data if after verifying that file just read matches the original measurement. Fixes commit aef16cc8a4c670036d45590877 ("resolv: Automatically reload a changed /etc/resolv.conf file [BZ #984]"). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-14resolv: Enhance __resolv_conf_load to capture file change dataFlorian Weimer
The data is captured after reading the file. This allows callers to check the change data against an earlier measurement. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-14resolv: Fix file handle leak in __resolv_conf_load [BZ #25429]Florian Weimer
res_vinit_1 did not close the stream on errors, only on success. This change moves closing the stream to __resolv_conf_load, for both the success and error cases. Fixes commit 89f187a40fc0ad4e22838526bfe34d73f758b776 ("resolv: Use getline for configuration file reading in res_vinit_1") and commit 3f853f22c87f0b671c0366eb290919719fa56c0e ("resolv: Lift domain search list limits [BZ #19569] [BZ #21475]"), where memory allocation was introduced into res_vinit_1. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-14resolv: Use <file_change_detection.h> in __resolv_conf_get_currentFlorian Weimer
Only minor functional changes (i.e., regarding the handling of directories, which are now treated as empty files). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-13Add STATX_ATTR_VERITY from Linux 5.5 to bits/statx-generic.h.Joseph Myers
This patch adds the new STATX_ATTR_VERITY macro from Linux 5.5 to glibc's bits/statx-generic.h. (This only does anything if glibc is being used with old kernel headers.) Tested for x86_64.
2020-02-13Use gcc -finput-charset=ascii for check-installed-headers.Stefan Liebler
A non-ascii character in the installed headers leads now to: error: failure to convert ascii to UTF-8 Such a finding in s390 specific fenv.h leads to fails in GCC testsuite. See glibc commit 08aea89ef67c5780ae734073494df0a451bce20f. Adding this gcc option also to our tests was proposed by Florian Weimer. This change also found a hit in resource.h where now "microseconds" is used. I've adjusted all the resource.h files. I've used the following command to check for further hits in headers. LC_ALL=C find -name "*.h" -exec grep -PHn "[\x80-\xFF]" {} \; Tested on s390x and x86_64. Reviewed-by: Zack Weinberg <zackw@panix.com>
2020-02-13math/test-sinl-pseudo: Use stack protector only if availableFlorian Weimer
This fixes commit 9333498794cde1d5cca518bad ("Avoid ldbl-96 stack corruption from range reduction of pseudo-zero (bug 25487).").
2020-02-13alpha: Fix static gettimeofday symbolAdhemerval Zanella
By undef strong_alias on alpha implementation, the default_symbol_version macro becomes an empty macro on static build. It fixes the issue introduced at c953219420. Checked on alpha-linux-gnu with a 'make check run-built-tests=no'.
2020-02-13nss_nisplus: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer
Reviewed-by: DJ Delorie <dj@redhat.com>
2020-02-13nss_dns: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer
Reviewed-by: DJ Delorie <dj@redhat.com>
2020-02-13nss_files: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer
Reviewed-by: DJ Delorie <dj@redhat.com>
2020-02-13nss_db: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer
Reviewed-by: DJ Delorie <dj@redhat.com>
2020-02-13nss_compat: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer
Reviewed-by: DJ Delorie <dj@redhat.com>
2020-02-13nss_hesiod: Use NSS_DECLARE_MODULE_FUNCTIONSFlorian Weimer
Reviewed-by: DJ Delorie <dj@redhat.com>
2020-02-13nss: Add function types and NSS_DECLARE_MODULE_FUNCTIONS macro to <nss.h>Florian Weimer
This macro allows to add type safety to the implementation of NSS service modules. Reviewed-by: DJ Delorie <dj@redhat.com>
2020-02-13nss_compat: Do not use nss_* names for function pointersFlorian Weimer
A future commit will use these names for types of functions in NSS service modules. Reviewed-by: DJ Delorie <dj@redhat.com>
2020-02-12Avoid ldbl-96 stack corruption from range reduction of pseudo-zero (bug 25487).Joseph Myers
Bug 25487 reports stack corruption in ldbl-96 sinl on a pseudo-zero argument (an representation where all the significand bits, including the explicit high bit, are zero, but the exponent is not zero, which is not a valid representation for the long double type). Although this is not a valid long double representation, existing practice in this area (see bug 4586, originally marked invalid but subsequently fixed) is that we still seek to avoid invalid memory accesses as a result, in case of programs that treat arbitrary binary data as long double representations, although the invalid representations of the ldbl-96 format do not need to be consistently handled the same as any particular valid representation. This patch makes the range reduction detect pseudo-zero and unnormal representations that would otherwise go to __kernel_rem_pio2, and returns a NaN for them instead of continuing with the range reduction process. (Pseudo-zero and unnormal representations whose unbiased exponent is less than -1 have already been safely returned from the function before this point without going through the rest of range reduction.) Pseudo-zero representations would previously result in the value passed to __kernel_rem_pio2 being all-zero, which is definitely unsafe; unnormal representations would previously result in a value passed whose high bit is zero, which might well be unsafe since that is not a form of input expected by __kernel_rem_pio2. Tested for x86_64.
2020-02-12mips: Fix argument passing for inlined syscalls on Linux [BZ #25523]WANG Xuerui
According to [gcc documentation][1], temporary variables must be used for the desired content to not be call-clobbered. Fix the Linux inline syscall templates by adding temporary variables, much like what x86 did before (commit 381a0c26d73e0f074c962e0ab53b99a6c327066d). Tested with gcc 9.2.0, both cross-compiled and natively on Loongson 3A4000. [1]: https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html
2020-02-12mips: Use 'long int' and 'long long int' in linux syscall codeWANG Xuerui
Style fixes only, no functional change.
2020-02-12alpha: Use generic gettimeofday implementationAdhemerval Zanella
It makes alpha no longer reports information about a system-wide time zone and moves the version logic on the alpha implementation. Checked on a build and check-abi for alpha-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
2020-02-12sunrpc: Properly clean up if tst-udp-timeout failsMatheus Castanho
The macro TEST_VERIFY_EXIT is used several times on sunrpc/tst-udp-timeout to exit the test if a condition evaluates to false. The side effect is that the code to terminate the RPC server process is not executed when the program calls exit, so that sub-process stays alive. This commit registers a clean up function with atexit to kill the server process before exiting the main program. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-02-12elf: avoid stack allocation in dl_open_workerDavid Kilroy
As the sort was removed, there's no need to keep a separate map of links. Instead, when relocating objects iterate over l_initfini directly. This allows us to remove the loop copying l_initfini elements into map. We still need a loop to identify the first and last elements that need relocation. Tested by running the testsuite on x86_64.
2020-02-12elf: avoid redundant sort in dlopenDavid Kilroy
l_initfini is already sorted by dependency in _dl_map_object_deps(), so avoid sorting again in dl_open_worker(). Tested by running the testsuite on x86_64.
2020-02-12elf: Allow dlopen of filter object to work [BZ #16272]David Kilroy
There are two fixes that are needed to be able to dlopen filter objects. First _dl_map_object_deps cannot assume that map will be at the beginning of l_searchlist.r_list[], as filtees are inserted before map. Secondly dl_open_worker needs to ensure that filtees get relocated. In _dl_map_object_deps: * avoiding removing relocation dependencies of map by setting l_reserved to 0 and otherwise processing the rest of the search list. * ensure that map remains at the beginning of l_initfini - the list of things that need initialisation (and destruction). Do this by splitting the copy up. This may not be required, but matches the initialization order without dlopen. Modify dl_open_worker to relocate the objects in new->l_inifini. new->l_initfini is constructed in _dl_map_object_deps, and lists the objects that need initialization and destruction. Originally the list of objects in new->l_next are relocated. All of these objects should also be included in new->l_initfini (both lists are populated with dependencies in _dl_map_object_deps). We can't use new->l_prev to pick up filtees, as during a recursive dlopen from an interposed malloc call, l->prev can contain objects that are not ready for relocation. Add tests to verify that symbols resolve to the filtee implementation when auxiliary and filter objects are used, both as a normal link and when dlopen'd. Tested by running the testsuite on x86_64.
2020-02-12Update translationsSiddhesh Poyarekar
Pull in translation update from translation.org.
2020-02-12Rename RWF_WRITE_LIFE_NOT_SET to RWH_WRITE_LIFE_NOT_SET following Linux 5.5.Joseph Myers
Linux 5.5 renames RWF_WRITE_LIFE_NOT_SET to RWH_WRITE_LIFE_NOT_SET, with the old name kept as an alias. This patch makes the corresponding change in glibc. Tested for x86_64.
2020-02-12S390: Fix non-ascii character in fenv.h.Stefan Liebler
The comment "isn't" contained a non-ascii character which leads to an error if compiled with -finput-charset=ascii: error: failure to convert ascii to UTF-8 This is observable in GCC testsuite: FAIL: 17_intro/headers/c++1998/charset.cc (test for excess errors) FAIL: 17_intro/headers/c++2011/charset.cc (test for excess errors) FAIL: 17_intro/headers/c++2014/charset.cc (test for excess errors) FAIL: 17_intro/headers/c++2017/charset.cc (test for excess errors) FAIL: 17_intro/headers/c++2020/charset.cc (test for excess errors) Also rewrite the comment above. Reported-by: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
2020-02-12io: Add io/tst-lchmod covering lchmod and fchmodatFlorian Weimer
2020-02-12Linux: Emulate fchmodat with AT_SYMLINK_NOFOLLOW using O_PATH [BZ #14578]Florian Weimer
/proc/self/fd files are special and chmod on O_PATH descriptors in that directory operates on the symbolic link itself (like lchmod).
2020-02-12io: Implement lchmod using fchmodat [BZ #14578]Florian Weimer
2020-02-12Add internal <file_change_detection.h> header fileFlorian Weimer
The code started out with bits form resolv/resolv_conf.c, but it was enhanced to deal with directories and FIFOs in a more predictable manner. A test case is included as well. This will be used to implement the /etc/resolv.conf change detection. This currently lives in a header file only. Once there are multiple users, the implementations should be moved into C files.
2020-02-12elf.h: Add R_RISCV_IRELATIVEFangrui Song
The number has been officially assigned by https://github.com/riscv/riscv-elf-psabi-doc/pull/131 https://github.com/riscv/riscv-elf-psabi-doc/commit/d21ca40a7f56812a15e97450b7bc1599c0d35b82
2020-02-11Fix typo in the name for Wednesday in Kurdish [BZ #9809]Mike FABIAN
2020-02-11debug: Add missing locale dependencies of fortify testsFlorian Weimer
The missing dependencies result in failures like this if make check is invoked with sufficient parallelism for the debug subdirectory: FAIL: debug/tst-chk2 FAIL: debug/tst-chk3 FAIL: debug/tst-chk4 FAIL: debug/tst-chk5 FAIL: debug/tst-chk6 FAIL: debug/tst-lfschk1 FAIL: debug/tst-lfschk2 FAIL: debug/tst-lfschk3 FAIL: debug/tst-lfschk4 FAIL: debug/tst-lfschk5 FAIL: debug/tst-lfschk6
2020-02-10htl C11 threads: Avoid pthread_ symbols visibility in static librarySamuel Thibault
2020-02-11hurd: Add __pthread_spin_wait and use itSamuel Thibault
900778283ac3 ("htl: make pthread_spin_lock really spin") made pthread_spin_lock really spin and not block, but the current users of __pthread_spin_lock were assuming that it blocks, i.e. they use it as a lightweight mutex fitting in just one int. __pthread_spin_wait provides that support back.
2020-02-10ldbl-128ibm-compat: set PRINTF_CHK flag in {,v}sprintf_chkPaul E. Murphy
This should be unconditionally set to match the common implementation, and fixes multiple test failures related to sprintf. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-02-10Use --disable-gdbserver in build-many-glibcs.py.Joseph Myers
Now that binutils-gdb has gdbserver at top level, an extra --disable-gdbserver configure option is needed when configuring binutils from a git checkout to avoid it also building gdbserver unnecessarily (although fairly harmlessly). This patch updates the options used in build-many-glibcs.py accordingly (although this might end up not being needed depending on what happens regarding whether gdbserver gets built for host != target). Tested with a build-many-glibcs.py compilers build for aarch64-linux-gnu using binutils-gdb master.
2020-02-10Improve random memcpy benchmarkWilco Dijkstra
Improve the random memcpy benchmark. Double the number of copies and increase the memory sizes tested to 512KB. Add a more detailed distribution of memcpy alignment and sizes up to 4096 based on SPEC2017 traces. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2020-02-10nptl: update default pthread-offsets.hAndreas Schwab
Remove unused definitions, and correct __PTHREAD_RWLOCK_FLAGS_OFFSET for __WORDSIZE == 64.
2020-02-10nptl: add missing pthread-offsets.hAndreas Schwab
All architectures using their own definition of struct __pthread_rwlock_arch_t need to provide their own pthread-offsets.h.
2020-02-10htl: Avoid a local plt for pthread_selfSamuel Thibault
2020-02-10pthread: Move some join tests from nptl to sysdeps/pthreadSamuel Thibault
So they can be checked with htl too.