about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
...
* io: Remove xstat implementationsAdhemerval Zanella2020-12-2919-341/+45
| | | | | | | | With xstat wrapper functions removed (8ed005daf0), the stat functions are now properly exported, and version is done using symbols versioning instead of the extra _STAT_* argument. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* free: preserve errno [BZ#17924]Paul Eggert2020-12-294-4/+150
| | | | | | | | | | | In the next release of POSIX, free must preserve errno <https://www.austingroupbugs.net/view.php?id=385>. Modify __libc_free to save and restore errno, so that any internal munmap etc. syscalls do not disturb the caller's errno. Add a test malloc/tst-free-errno.c (almost all by Bruno Haible), and document that free preserves errno. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* hurd: Accept including hurd/version.hSamuel Thibault2020-12-291-1/+1
| | | | We need it to get the RPC API version.
* hurd: Add WSTOPPED/WCONTINUED/WEXITED/WNOWAIT support [BZ #23091]Samuel Thibault2020-12-283-17/+43
| | | | | | The new __proc_waitid RPC now expects WEXITED to be passed, allowing to properly implement waitid, and thus define the missing W* macros (according to FreeBSD values).
* support: Make support_process_state_wait wait lessSamuel Thibault2020-12-281-1/+1
| | | | | | | Tests such as posix/tst-waitid.c make heavy use of support_process_state_wait, and thus on non-Linux where it falls back to sleeping, a 2s sleep makes such test time out, while 1s remains fine enough.
* hurd: set sigaction for signal preemptors in arch-independent fileSamuel Thibault2020-12-263-22/+20
| | | | | | Instead of having the arch-specific trampoline setup code detect whether preemption happened or not, we'd rather pass it the sigaction. In the future, this may also allow to change sa_flags from post_signal().
* hurd: Fix spawni SPAWN_XFLAGS_TRY_SHELL with empty argvSamuel Thibault2020-12-261-1/+5
| | | | | When argv is empty, we need to add the original script to be run on the shell command line.
* hurd: Try shell in posix_spawn* only in compat modeSamuel Thibault2020-12-261-1/+1
| | | | Reported by Bruno Haible <bruno@clisp.org>
* Remove _ISOMAC check from <cpu-features.h>H.J. Lu2020-12-241-81/+75
| | | | | Remove _ISOMAC check from <cpu-features.h> since it isn't an installer header file.
* x86: Remove the duplicated CPU_FEATURE_CPU_PH.J. Lu2020-12-241-2/+0
| | | | | CPU_FEATURE_CPU_P is defined in sysdeps/x86/sys/platform/x86.h. Remove the duplicated CPU_FEATURE_CPU_P in sysdeps/x86/include/cpu-features.h.
* Partially revert 681900d29683722b1cb0a8e565a0585846ec5a61Siddhesh Poyarekar2020-12-242-12/+1
| | | | | | | | | Do not attempt to fix the significand top bit in long double input received in printf. The code should never reach here because isnan should now detect unnormals as NaN. This is already a NOP for glibc since it uses the gcc __builtin_isnan, which detects unnormals as NaN. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* x86 long double: Support pseudo numbers in isnanlSiddhesh Poyarekar2020-12-242-6/+7
| | | | | | | This syncs up isnanl behaviour with gcc. Also move the isnanl implementation to sysdeps/x86 and remove the sysdeps/x86_64 version. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* x86 long double: Support pseudo numbers in fpclassifylSiddhesh Poyarekar2020-12-242-2/+4
| | | | | | | | Also move sysdeps/i386/fpu/s_fpclassifyl.c to sysdeps/x86/fpu/s_fpclassifyl.c and remove sysdeps/x86_64/fpu/s_fpclassifyl.c Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* MTE: Do not pad size in realloc_checkSiddhesh Poyarekar2020-12-241-4/+5
| | | | | | | | | | The MTE patch to add malloc support incorrectly padded the size passed to _int_realloc by SIZE_SZ when it ought to have sent just the chunksize. Revert that bit of the change so that realloc works correctly with MALLOC_CHECK_ set. This also brings the realloc_check implementation back in sync with libc_realloc.
* tests-mcheck: New variable to run tests with MALLOC_CHECK_=3Siddhesh Poyarekar2020-12-242-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | This new variable allows various subsystems in glibc to run all or some of their tests with MALLOC_CHECK_=3. This patch adds infrastructure support for this variable as well as an implementation in malloc/Makefile to allow running some of the tests with MALLOC_CHECK_=3. At present some tests in malloc/ have been excluded from the mcheck tests either because they're specifically testing MALLOC_CHECK_ or they are failing in master even without the Memory Tagging patches that prompted this work. Some tests were reviewed and found to need specific error points that MALLOC_CHECK_ defeats by terminating early but a thorough review of all tests is needed to bring them into mcheck coverage. The following failures are seen in current master: FAIL: malloc/tst-malloc-fork-deadlock-mcheck FAIL: malloc/tst-malloc-stats-cancellation-mcheck FAIL: malloc/tst-malloc-thread-fail-mcheck FAIL: malloc/tst-realloc-mcheck FAIL: malloc/tst-reallocarray-mcheck All of these are due to the Memory Tagging patchset and will be fixed separately.
* elf: Account for glibc-hwcaps/ prefix in _dl_important_hwcapsFlorian Weimer2020-12-231-0/+1
|
* misc: Use __ferror_unlocked instead of ferrorSiddhesh Poyarekar2020-12-231-1/+1
| | | | | The ferror results in an unnecessary PLT reference. Use __ferror_unlocked instead , which gets inlined.
* s390x: Regenerate ulpsFlorian Weimer2020-12-221-10/+12
| | | | | For new inputs added in commit cad5ad81d2f7f58a7ad0d8afa8c1b710, as seen on a z13 system.
* powerpc: Regenerate ulpsFlorian Weimer2020-12-221-12/+13
| | | | | For new inputs added in commit cad5ad81d2f7f58a7ad0d8afa8c1b710, as seen on a POWER8 system.
* addmntent: Remove unbounded alloca usage from getmntent [BZ#27083]Siddhesh Poyarekar2020-12-223-74/+140
| | | | | | | | | The addmntent function replicates elements of struct mnt on stack using alloca, which is unsafe. Put characters directly into the stream, escaping them as they're being written out. Also add a test to check all escaped characters with addmntent and getmntent.
* <sys/platform/x86.h>: Add Intel LAM supportH.J. Lu2020-12-223-0/+7
| | | | | | | | Add Intel Linear Address Masking (LAM) support to <sys/platform/x86.h>. HAS_CPU_FEATURE (LAM) can be used to detect if LAM is enabled in CPU. LAM modifies the checking that is applied to 64-bit linear addresses, allowing software to use of the untranslated address bits for metadata.
* i386: Regenerate ulpsFlorian Weimer2020-12-212-10/+10
| | | | For new inputs added in commit cad5ad81d2f7f58a7ad0d8afa8c1b710.
* aarch64: update ulps.Szabolcs Nagy2020-12-211-10/+12
| | | | | For new test cases in commit cad5ad81d2f7f58a7ad0d8afa8c1b7101a0301fb
* aarch64: Add aarch64-specific files for memory tagging supportRichard Earnshaw2020-12-216-0/+235
| | | | | This final patch provides the architecture-specific implementation of the memory-tagging support hooks for aarch64.
* aarch64: Add sysv specific enabling code for memory taggingRichard Earnshaw2020-12-214-0/+34
| | | | | | | | | | | | | | | | | | | Add various defines and stubs for enabling MTE on AArch64 sysv-like systems such as Linux. The HWCAP feature bit is copied over in the same way as other feature bits. Similarly we add a new wrapper header for mman.h to define the PROT_MTE flag that can be used with mmap and related functions. We add a new field to struct cpu_features that can be used, for example, to check whether or not certain ifunc'd routines should be bound to MTE-safe versions. Finally, if we detect that MTE should be enabled (ie via the glibc tunable); we enable MTE during startup as required. Support in the Linux kernel was added in version 5.10. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* linux: Add compatibility definitions to sys/prctl.h for MTERichard Earnshaw2020-12-211-0/+18
| | | | | | | | | Older versions of the Linux kernel headers obviously lack support for memory tagging, but we still want to be able to build in support when using those (obviously it can't be enabled on such systems). The linux kernel extensions are made to the platform-independent header (linux/prctl.h), so this patch takes a similar approach.
* malloc: Basic support for memory tagging in the malloc() familyRichard Earnshaw2020-12-215-97/+437
| | | | | | | | | | | | | | | | | This patch adds the basic support for memory tagging. Various flavours are supported, particularly being able to turn on tagged memory at run-time: this allows the same code to be used on systems where memory tagging support is not present without neededing a separate build of glibc. Also, depending on whether the kernel supports it, the code will use mmap for the default arena if morecore does not, or cannot support tagged memory (on AArch64 it is not available). All the hooks use function pointers to allow this to work without needing ifuncs. Reviewed-by: DJ Delorie <dj@redhat.com>
* elf: Add a tunable to control use of tagged memoryRichard Earnshaw2020-12-212-0/+44
| | | | | | | | | | | Add a new glibc tunable: mem.tagging. This is a decimal constant in the range 0-255 but used as a bit-field. Bit 0 enables use of tagged memory in the malloc family of functions. Bit 1 enables precise faulting of tag failure on platforms where this can be controlled. Other bits are currently unused, but if set will cause memory tag checking for the current process to be enabled in the kernel.
* config: Allow memory tagging to be enabled when configuring glibcRichard Earnshaw2020-12-216-0/+69
| | | | | | | | This patch adds the configuration machinery to allow memory tagging to be enabled from the command line via the configure option --enable-memory-tagging. The current default is off, though in time we may change that once the API is more stable.
* alpha: Remove anonymous union in struct stat [BZ #27042]Matt Turner2020-12-213-63/+66
| | | | | | | | | | This is clever, but it confuses downstream detection in at least zstd and GNOME's glib. zstd has preprocessor tests for the 'st_mtime' macro, which is not provided by the path using the anonymous union; glib checks for the presence of 'st_mtimensec' in struct stat but then tries to access that field in struct statx (which might be a bug on its own). Checked with a build for alpha-linux-gnu.
* add inputs to auto-libm-test-in yielding larger errors (binary64, x86_64)Paul Zimmermann2020-12-2110-11/+581
|
* m68k: fix clobbering a5 in setjmp() [BZ #24202]Sergei Trofimovich2020-12-211-0/+1
| | | | | | | | setjmp() uses C code to store current registers into jmp_buf environment. -fstack-protector-all places canary into setjmp() prologue and clobbers 'a5' before it gets saved. The change inhibits stack canary injection to avoid clobber.
* iconv add iconv_close before the function returned with bad value.liqingqing2020-12-211-0/+1
| | | | add iconv_close before the function returned with bad value.
* iconv: use iconv_close after iconv_openliqingqing2020-12-211-0/+2
|
* Fix buffer overrun in EUC-KR conversion module (bz #24973)Andreas Schwab2020-12-214-9/+59
| | | | | | | The byte 0xfe as input to the EUC-KR conversion denotes a user-defined area and is not allowed. The from_euc_kr function used to skip two bytes when told to skip over the unknown designation, potentially running over the buffer end.
* hurd: Make trampoline fill siginfo ss_sp from sc_uespSamuel Thibault2020-12-211-1/+1
| | | | Mach actually rather fills the uesp field, not esp.
* Hurd: make sigstates hold a reference on thread portsRichard Braun2020-12-212-7/+29
| | | | | | | | | | | | | This change is required in order to correctly release per-thread resources. Directly reusing the threading library reference isn't possible since the sigstate is also used early in the main thread, before threading is initialized. * hurd/hurd/signal.h (_hurd_self_sigstate): Drop thread reference after calling _hurd_thread_sigstate. (_hurd_critical_section_lock): Likewise. * hurd/hurdsig.c (_hurd_thread_sigstate): Add a reference on the thread. (_hurd_sigstate_delete): Drop thread reference.
* profil-counter: Add missing SIGINFO caseSamuel Thibault2020-12-211-0/+10
| | | | | | When SA_SIGINFO is available, sysdeps/posix/s?profil.c use it, so we have to fix the __profil_counter function accordingly, using sigcontextinfo.h's sigcontext_get_pc.
* hurd: implement SA_SIGINFO signal handlers.Jeremie Koenig2020-12-2111-67/+209
| | | | | | | SA_SIGINFO is actually just another way of expressing what we were already passing over with struct sigcontext. This just introduces the SIGINFO interface and fixes the posix values when that interface is requested by the application.
* hurd: Fix ELF_MACHINE_USER_ADDRESS_MASK valueSamuel Thibault2020-12-201-1/+1
| | | | | x86 binaries are linked at 0x08000000, so we need to let them get mapped there.
* hurd: Note when the vm_map kernel bug was fixedSamuel Thibault2020-12-201-1/+1
| | | | | dl-sysdep has been wanting to use high bits in the vm_map mask for decades, but that was only implemented lately.
* hurd: Also turn KERN_INVALID_ADDRESS to EINVALSamuel Thibault2020-12-191-0/+1
| | | | | When e.g. mmap is passed an invalid address we would return KERN_INVALID_ADDRESS, while POSIX applications would expect EINVAL.
* ieee754: Remove unused __sin32 and __cos32Anssi Hannula2020-12-187-86/+0
| | | | | The __sin32 and __cos32 functions were only used in the now removed slow path of asin and acos.
* ieee754: Remove slow paths from asin and acosAnssi Hannula2020-12-181-61/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | asin and acos have slow paths for rounding the last bit that cause some calls to be 500-1500x slower than average calls. These slow paths are rare, a test of a trillion (1.000.000.000.000) random inputs between -1 and 1 showed 32870 slow calls for acos and 4473 for asin, with most occurrences between -1.0 .. -0.9 and 0.9 .. 1.0. The slow paths claim correct rounding and use __sin32() and __cos32() (which compare two result candidates and return the closest one) as the final step, with the second result candidate (res1) having a small offset applied from res. This suggests that res and res1 are intended to be 1 ULP apart (which makes sense for rounding), barring bugs, allowing us to pick either one and still remain within 1 ULP of the exact result. Remove the slow paths as the accuracy is better than 1 ULP even without them, which is enough for glibc. Also remove code comments claiming correctly rounded results. After slow path removal, checking the accuracy of 14.400.000.000 random asin() and acos() inputs showed only three incorrectly rounded (error > 0.5 ULP) results: - asin(-0x1.ee2b43286db75p-1) (0.500002 ULP, same as before) - asin(-0x1.f692ba202abcp-4) (0.500003 ULP, same as before) - asin(-0x1.9915e876fc062p-1) (0.50000000001 ULP, previously exact) The first two had the same error even before this commit, and they did not use the slow path at all. Checking 4934 known randomly found previously-slow-path asin inputs shows 25 calls with incorrectly rounded results, with a maximum error of 0.500000002 ULP (for 0x1.fcd5742999ab8p-1). The previous slow-path code rounded all these inputs correctly (error < 0.5 ULP). The observed average speed increase was 130x. Checking 36240 known randomly found previously-slow-path acos inputs shows 42 calls with incorrectly rounded results, with a maximum error of 0.500000008 ULP (for 0x1.f63845056f35ep-1). The previous "exact" slow-path code showed 34 calls with incorrectly rounded results, with the same maximum error of 0.500000008 ULP (for 0x1.f63845056f35ep-1). The observed average speed increase was 130x. The functions could likely be trimmed more while keeping acceptable accuracy, but this at least gets rid of the egregiously slow cases. Tested on x86_64.
* getenv: Move call to strlen to the branch it's used in.Lode Willems2020-12-181-1/+1
| | | | | | | | | The len variable is only used in the else branch. We don't need the call to strlen if the name is 0 or 1 characters long. 2019-10-02 Lode Willems <Lode.Willems@UGent.be> * tdlib/getenv.c: Move the call to strlen into the branch it's used.
* Update kernel version to 5.10 in tst-mman-consts.py.Joseph Myers2020-12-171-1/+1
| | | | | | | | This patch updates the kernel version in the test tst-mman-consts.py to 5.10. (There are no new MAP_* constants covered by this test in 5.10 that need any other header changes.) Tested with build-many-glibcs.py.
* s390x: Require GCC 7.1 or later to build glibc.Stefan Liebler2020-12-175-0/+59
| | | | | | | | | | | | | | | | | | | | | | | GCC 6.5 fails to correctly build ldconfig with recent ld.so.cache commits, e.g.: 785969a047ad2f23f758901c6816422573544453 elf: Implement a string table for ldconfig, with tail merging If glibc is build with gcc 6.5.0: __builtin_add_overflow is used in <glibc>/elf/stringtable.c:stringtable_finalize() which leads to ldconfig failing with "String table is too large". This is also recognizable in following tests: FAIL: elf/tst-glibc-hwcaps-cache FAIL: elf/tst-glibc-hwcaps-prepend-cache FAIL: elf/tst-ldconfig-X FAIL: elf/tst-ldconfig-bad-aux-cache FAIL: elf/tst-ldconfig-ld_so_conf-update FAIL: elf/tst-stringtable See gcc "Bug 98269 - gcc 6.5.0 __builtin_add_overflow() with small uint32_t values incorrectly detects overflow" (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269)
* malloc: Use __libc_initial to detect an inner libcFlorian Weimer2020-12-162-8/+7
| | | | | | | | | | | | | The secondary/non-primary/inner libc (loaded via dlmopen, LD_AUDIT, static dlopen) must not use sbrk to allocate member because that would interfere with allocations in the outer libc. On Linux, this does not matter because sbrk itself was changed to fail in secondary libcs. _dl_addr occasionally shows up in profiles, but had to be used before because __libc_multiple_libs was unreliable. So this change achieves a slight reduction in startup time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Replace __libc_multiple_libcs with __libc_initial flagFlorian Weimer2020-12-169-40/+53
| | | | | | | | | | | | | | Change sbrk to fail for !__libc_initial (in the generic implementation). As a result, sbrk is (relatively) safe to use for the __libc_initial case (from the main libc). It is therefore no longer necessary to avoid using it in that case (or updating the brk cache), and the __libc_initial flag does not need to be updated as part of dlmopen or static dlopen. As before, direct brk system calls on Linux may lead to memory corruption. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* {nptl,htl}/semaphoreP.h: clean upSamuel Thibault2020-12-162-4/+4
| | | | | This removes "Contributed by", and uses a C99 flexible array instead of char name[0];