about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
...
* hurd: Remove the ecx kludgeSergey Bugaev2023-03-023-48/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "We don't need it any more" The INTR_MSG_TRAP macro in intr-msg.h used to play little trick with the stack pointer: it would temporarily save the "real" stack pointer into ecx, while setting esp to point to just before the message buffer, and then invoke the mach_msg trap. This way, INTR_MSG_TRAP reused the on-stack arguments laid out for the containing call of _hurd_intr_rpc_mach_msg (), passing them to the mach_msg trap directly. This, however, required special support in hurdsig.c and trampoline.c, since they now had to recognize when a thread is inside the piece of code where esp doesn't point to the real tip of the stack, and handle this situation specially. Commit 1d20f33ff4fb634310f27493b7b87d0b20f4a0b0 has removed the actual temporary change of esp by actually re-pushing mach_msg arguments onto the stack, and popping them back at end. It did not, however, deal with the rest of "the ecx kludge" code in other files, resulting in potential crashes if a signal arrives in the middle of pushing arguments onto the stack. Fix that by removing "the ecx kludge". Instead, when we want a thread to skip the RPC, but cannot make just make it jump to after the trap since it's not done adjusting the stack yet, set the SYSRETURN register to MACH_SEND_INTERRUPTED (as we do anyway), and rely on the thread itself for detecting this case and skipping the RPC. This simplifies things somewhat and paves the way for a future x86_64 port of this code. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230301162355.426887-1-bugaevc@gmail.com>
* Add AArch64 HWCAP2 values from Linux 6.2 to bits/hwcap.hJoseph Myers2023-02-281-0/+3
| | | | | | | Linux 6.2 adds three new AArch64 HWCAP2 values; add them to glibc's AArch64 bits/hwcap.h. Tested with build-many-glibcs.py for aarch64-linux-gnu.
* crypt: Remove invalid end of page test badsalttestAdhemerval Zanella2023-02-281-43/+9
| | | | | | | | | | | | | The input argument passes an invalid string without a NUL terminator on crypt settings inputs, which might lead to invalid OOB on strncmp. Implementations only assume there is a NUL terminator if the string is shorter than the specified size, so strings don't need to always be NUL terminated (stratcliff.c has tests for this). Also adapt the code to use libsupport. Checked on arm-linux-gnuabihf.
* S390: Fix _FPU_SETCW/GETCW when compiling with Clang [BZ #30130]Andreas Arnez2023-02-281-2/+2
| | | | | | | | The _FPU_SETCW and _FPU_GETCW macros are defined with inline assemblies. They use the sfpc and efpc instructions, respectively. But both contain a spurious second operand that leads to a compile error with Clang. Removing this operand works both with gcc/gas (since binutils 2.18) as well as with clang/llvm.
* s390x: Regenerate ULPs.Stefan Liebler2023-02-281-0/+1
| | | | | | | | | Needed due to recent commits: - "added pair of inputs for hypotf in binary32" commit ID cf7ffdd8a5f6da55397e10b3860062944312824c - "update auto-libm-test-out-hypot" commit ID 3efbf11fdf15ed991d2c41743921c524a867e145
* Add Arm HWCAP values from Linux 6.2 to bits/hwcap.hJoseph Myers2023-02-283-6/+13
| | | | | | | | Linux 6.2 adds six new Arm HWCAP values and two new HWCAP2 values; add them to glibc's Arm bits/hwcap.h, with corresponding dl-procinfo.c and dl-procinfo.h updates. Tested with build-many-glibcs.py for arm-linux-gnueabi.
* htl: Add pthreadtypes-arch.h for x86_64Sergey Bugaev2023-02-271-0/+36
| | | | | Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230221211932.296459-5-bugaevc@gmail.com>
* hurd: Implement TLS for x86_64Sergey Bugaev2023-02-272-1/+228
| | | | | Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230221211932.296459-4-bugaevc@gmail.com>
* htl: Make pthread_mutex_t pointer-alignedSergey Bugaev2023-02-271-5/+8
| | | | | | | | This is for future-proofing. On i386, it is 4-byte aligned anyway, but on x86_64, we want it 8-byte aligned, not 4-byte aligned. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230214173722.428140-4-bugaevc@gmail.com>
* x86_64: Update libm test ulpsH.J. Lu2023-02-271-0/+1
| | | | | | | | | | | | Update libm test ulps for commit 3efbf11fdf15ed991d2c41743921c524a867e145 Author: Paul Zimmermann <Paul.Zimmermann@inria.fr> Date: Tue Feb 14 11:24:59 2023 +0100 update auto-libm-test-out-hypot Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* localedata: de_DE should not use FräuleinFlorian Weimer2023-02-271-1/+1
| | | | This honorific has fallen out of use quite some time ago.
* LoongArch: Add math-barriers.hXi Ruoyao2023-02-271-0/+28
| | | | | | | | This patch implements the LoongArch specific math barriers in order to omit the store and load from stack if possible. Signed-off-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* cdefs.h: fix "__clang_major" typoPaul Eggert2023-02-271-1/+1
| | | | | * misc/sys/cdefs.h: Fix misspelling of "__clang_major__". Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* hppa: Drop old parisc-specific MADV_* constantsJohn David Anglin2023-02-252-29/+6
| | | | | | | | | | | | | | | | | | | The Linux kernel upstream commit 71bdea6f798b ("parisc: Align parisc MADV_XXX constants with all other architectures") dropped the parisc-specific MADV_* values in favour of the same constants as other architectures. In the same commit a wrapper was added which translates the old values to the standard MADV_* values to avoid breakage of existing programs. This upstream patch has been downported to all stable kernel trees as well. This patch now drops the parisc specific constants from glibc to allow newly compliled programs to use the standard MADV_* constants. v2: Added NEWS section, based on feedback from Florian Weimer Signed-off-by: Helge Deller <deller@gmx.de>
* hurd: Generalize init-first.c to support x86_64Sergey Bugaev2023-02-241-0/+6
| | | | | Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230223151436.49180-2-bugaevc@gmail.com>
* hurd: Simplify init-first.c furtherSergey Bugaev2023-02-244-140/+68
| | | | | | | | This drops all of the return address rewriting kludges. The only remaining hack is the jump out of a call stack while adjusting the stack pointer. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
* hurd: Mark some audit tests as unsupportedSamuel Thibault2023-02-241-0/+10
| | | | They hang the testsuite.
* htl: Mark select loop test as unsupportedSamuel Thibault2023-02-241-0/+6
| | | | It overflows pflocal and doesn't manage to terminate.
* hurd: Mark RLIMIT_AS tests as unsupportedSamuel Thibault2023-02-241-0/+11
| | | | Otherwise they put the system on its knees.
* aarch64: update libm test ulpsSzabolcs Nagy2023-02-241-0/+1
|
* powerpc:Regenerate ulps for hypotMahesh Bodapati2023-02-231-0/+4
| | | | | For new inputs added in commit 3efbf11fdf15ed991d2c41743921c524a867e145, regenerate the ulps of hypot from 0(default) to 1
* Update syscall lists for Linux 6.2Joseph Myers2023-02-231-2/+2
| | | | | | | Linux 6.2 has no new syscalls. Update the version number in syscall-names.list to reflect that it is still current for 6.2. Tested with build-many-glibcs.py.
* tunables.texi: Change \code{1} to @code{1}H.J. Lu2023-02-231-1/+1
| | | | | | Update 317f1c0a8a x86-64: Add glibc.cpu.prefer_map_32bit_exec [BZ #28656]
* x86-64: Add glibc.cpu.prefer_map_32bit_exec [BZ #28656]H.J. Lu2023-02-229-9/+205
| | | | | | | | | | | | | | | | | | | Crossing 2GB boundaries with indirect calls and jumps can use more branch prediction resources on Intel Golden Cove CPU (see the "Misprediction for Branches >2GB" section in Intel 64 and IA-32 Architectures Optimization Reference Manual.) There is visible performance improvement on workloads with many PLT calls when executable and shared libraries are mmapped below 2GB. Add the Prefer_MAP_32BIT_EXEC bit so that mmap will try to map executable or denywrite pages in shared libraries with MAP_32BIT first. NB: Prefer_MAP_32BIT_EXEC reduces bits available for address space layout randomization (ASLR), which is always disabled for SUID programs and can only be enabled by the tunable, glibc.cpu.prefer_map_32bit_exec, or the environment variable, LD_PREFER_MAP_32BIT_EXEC. This works only between shared libraries or between shared libraries and executables with addresses below 2GB. PIEs are usually loaded at a random address above 4GB by the kernel.
* gmon: fix memory corruption issues [BZ# 30101]Simon Kissane2023-02-223-8/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | V2 of this patch fixes an issue in V1, where the state was changed to ON not OFF at end of _mcleanup. I hadn't noticed that (counterintuitively) ON=0 and OFF=3, hence zeroing the buffer turned it back on. So set the state to OFF after the memset. 1. Prevent double free, and reads from unallocated memory, when _mcleanup is (incorrectly) called two or more times in a row, without an intervening call to __monstartup; with this patch, the second and subsequent calls effectively become no-ops instead. While setting tos=NULL is minimal fix, safest action is to zero the whole gmonparam buffer. 2. Prevent memory leak when __monstartup is (incorrectly) called two or more times in a row, without an intervening call to _mcleanup; with this patch, the second and subsequent calls effectively become no-ops instead. 3. After _mcleanup, treat __moncontrol(1) as __moncontrol(0) instead. With zeroing of gmonparam buffer in _mcleanup, this stops the state incorrectly being changed to GMON_PROF_ON despite profiling actually being off. If we'd just done the minimal fix to _mcleanup of setting tos=NULL, there is risk of far worse memory corruption: kcount would point to deallocated memory, and the __profil syscall would make the kernel write profiling data into that memory, which could have since been reallocated to something unrelated. 4. Ensure __moncontrol(0) still turns off profiling even in error state. Otherwise, if mcount overflows and sets state to GMON_PROF_ERROR, when _mcleanup calls __moncontrol(0), the __profil syscall to disable profiling will not be invoked. _mcleanup will free the buffer, but the kernel will still be writing profiling data into it, potentially corrupted arbitrary memory. Also adds a test case for (1). Issues (2)-(4) are not feasible to test. Signed-off-by: Simon Kissane <skissane@gmail.com> Reviewed-by: DJ Delorie <dj@redhat.com>
* gmon: improve mcount overflow handling [BZ# 27576]Simon Kissane2023-02-228-7/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When mcount overflows, no gmon.out file is generated, but no message is printed to the user, leaving the user with no idea why, and thinking maybe there is some bug - which is how BZ 27576 ended up being logged. Print a message to stderr in this case so the user knows what is going on. As a comment in sys/gmon.h acknowledges, the hardcoded MAXARCS value is too small for some large applications, including the test case in that BZ. Rather than increase it, add tunables to enable MINARCS and MAXARCS to be overridden at runtime (glibc.gmon.minarcs and glibc.gmon.maxarcs). So if a user gets the mcount overflow error, they can try increasing maxarcs (they might need to increase minarcs too if the heuristic is wrong in their case.) Note setting minarcs/maxarcs too large can cause monstartup to fail with an out of memory error. If you set them large enough, it can cause an integer overflow in calculating the buffer size. I haven't done anything to defend against that - it would not generally be a security vulnerability, since these tunables will be ignored in suid/sgid programs (due to the SXID_ERASE default), and if you can set GLIBC_TUNABLES in the environment of a process, you can take it over anyway (LD_PRELOAD, LD_LIBRARY_PATH, etc). I thought about modifying the code of monstartup to defend against integer overflows, but doing so is complicated, and I realise the existing code is susceptible to them even prior to this change (e.g. try passing a pathologically large highpc argument to monstartup), so I decided just to leave that possibility in-place. Add a test case which demonstrates mcount overflow and the tunables. Document the new tunables in the manual. Signed-off-by: Simon Kissane <skissane@gmail.com> Reviewed-by: DJ Delorie <dj@redhat.com>
* gmon: Fix allocated buffer overflow (bug 29444)Леонид Юрьев (Leonid Yuriev)2023-02-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `__monstartup()` allocates a buffer used to store all the data accumulated by the monitor. The size of this buffer depends on the size of the internal structures used and the address range for which the monitor is activated, as well as on the maximum density of call instructions and/or callable functions that could be potentially on a segment of executable code. In particular a hash table of arcs is placed at the end of this buffer. The size of this hash table is calculated in bytes as p->fromssize = p->textsize / HASHFRACTION; but actually should be p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms)); This results in writing beyond the end of the allocated buffer when an added arc corresponds to a call near from the end of the monitored address range, since `_mcount()` check the incoming caller address for monitored range but not the intermediate result hash-like index that uses to write into the table. It should be noted that when the results are output to `gmon.out`, the table is read to the last element calculated from the allocated size in bytes, so the arcs stored outside the buffer boundary did not fall into `gprof` for analysis. Thus this "feature" help me to found this bug during working with https://sourceware.org/bugzilla/show_bug.cgi?id=29438 Just in case, I will explicitly note that the problem breaks the `make test t=gmon/tst-gmon-dso` added for Bug 29438. There, the arc of the `f3()` call disappears from the output, since in the DSO case, the call to `f3` is located close to the end of the monitored range. Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru> Another minor error seems a related typo in the calculation of `kcountsize`, but since kcounts are smaller than froms, this is actually to align the p->froms data. Co-authored-by: DJ Delorie <dj@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* malloc: remove redundant check of unsorted bin corruptionAyush Mittal2023-02-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * malloc/malloc.c (_int_malloc): remove redundant check of unsorted bin corruption With commit "b90ddd08f6dd688e651df9ee89ca3a69ff88cd0c" (malloc: Additional checks for unsorted bin integrity), same check of (bck->fd != victim) is added before checking of unsorted chunk corruption, which was added in "bdc3009b8ff0effdbbfb05eb6b10966753cbf9b8" (Added check before removing from unsorted list). .. 3773 if (__glibc_unlikely (bck->fd != victim) 3774 || __glibc_unlikely (victim->fd != unsorted_chunks (av))) 3775 malloc_printerr ("malloc(): unsorted double linked list corrupted"); .. .. 3815 /* remove from unsorted list */ 3816 if (__glibc_unlikely (bck->fd != victim)) 3817 malloc_printerr ("malloc(): corrupted unsorted chunks 3"); 3818 unsorted_chunks (av)->bk = bck; .. So this extra check can be removed. Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Ayush Mittal <ayush.m@samsung.com> Reviewed-by: DJ Delorie <dj@redhat.com>
* Use Linux 6.2 in build-many-glibcs.pyJoseph Myers2023-02-221-1/+1
| | | | | | | This patch makes build-many-glibcs.py use Linux 6.2. Tested with build-many-glibcs.py (host-libraries, compilers and glibcs builds).
* Ignore MAP_VARIABLE in tst-mman-consts.pyJoseph Myers2023-02-221-2/+5
| | | | | | | | | | | Linux 6.2 removed the hppa compatibility MAP_VARIABLE define. That means that, whether or not we remove it in glibc, it needs to be ignored in tst-mman-consts.py (since this macro comparison infrastructure expects that new kernel header versions only add new macros, not remove old ones). Tested with build-many-glibcs.py for hppa-linux-gnu (Linux 6.2 headers).
* AArch64: Fix HP_TIMING_DIFF computation [BZ# 29329]Jun Tang2023-02-221-1/+1
| | | | | | | | Fix the computation to allow for cntfrq_el0 being larger than 1GHz. Assume cntfrq_el0 is a multiple of 1MHz to increase the maximum interval (1024 seconds at 1GHz). Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
* s390: Fix build for -march=z13Adhemerval Zanella2023-02-202-0/+2
| | | | | | | | It fixes the build after 7ea510127e2067e and 22999b2f0fb62. Checked with build for s390x-linux-gnu with -march=z13. Reviewed-by: Arjun Shankar <arjun@redhat.com>
* arm: Support gcc older than 10 for find_zero_allAdhemerval Zanella2023-02-201-0/+6
| | | | | | | | __builtin_arm_uqsub8 is only available on gcc newer or equal than 10. Checked on arm-linux-gnueabihf built with gcc 9. Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* Linux: Remove generic ImpliesAdhemerval Zanella2023-02-209-24/+0
| | | | | | | | | The default Linux implementation already handled the Linux generic ABIs interface used on newer architectures, so there is no need to Imply the generic any longer. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* Linux: Remove unused generic MakefileAdhemerval Zanella2023-02-201-3/+0
| | | | | | | Both are already defined on default linux Makefile. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* Linux: Assume and consolidate getpeername wire-up syscallAdhemerval Zanella2023-02-2010-28/+6
| | | | | | | | | And disable if kernel does not support it. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* Linux: Assume and consolidate getsockname wire-up syscallAdhemerval Zanella2023-02-2010-13/+11
| | | | | | | | | And disable if kernel does not support it. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* Linux: Move wordsize-32 Version to defaultAdhemerval Zanella2023-02-2012-38/+3
| | | | | | | | | | | | | | | | | And remove redundant entries on other architectures Version. The version for fallocate64 was supposed to be 2.10, but it was then added to 32-bit platforms in 2.11 because it mistakenly wasn't exported for them in 2.10 (see the commit message for 1f3615a1c97a030bca59f728f998947f852679b9). The linux/generic did not exist before 2.15, i.e. when the tile ports were added (and microblaze did not exist before 2.18), which explains those differences but also illustrates that "2.11 for 32-bit, 2.10 for 64-bit" should be sufficient since versions older than the minimum for the architecture are automatically adjusted. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* __glob64_time64: Fix typo for stub_warning call (BZ #30146)Samuel Thibault2023-02-201-1/+1
| | | | The exported symbol is actually __glob64_time64, not glob64_time64.
* elf: Restore ldconfig libc6 implicit soname logic [BZ #30125]Joan Bruguera2023-02-207-23/+67
| | | | | | | | | | | | | | | | | | | | | | While cleaning up old libc version support, the deprecated libc4 code was accidentally kept in `implicit_soname`, instead of the libc6 code. This causes additional symlinks to be created by `ldconfig` for libraries without a soname, e.g. a library `libsomething.123.456.789` without a soname will create a `libsomething.123` -> `libsomething.123.456.789` symlink. As the libc6 version of the `implicit_soname` code is a trivial `xstrdup`, just inline it and remove `implicit_soname` altogether. Some further simplification looks possible (e.g. the call to `create_links` looks like a no-op if `soname == NULL`, other than the verbose printfs), but logic is kept as-is for now. Fixes: BZ #30125 Fixes: 8ee878592c4a ("Assume only FLAG_ELF_LIBC6 suport") Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* stdlib: Undo post review change to 16adc58e73f3 [BZ #27749]Vitaly Buka2023-02-203-2/+81
| | | | | | | | | | Post review removal of "goto restart" from https://sourceware.org/pipermail/libc-alpha/2021-April/125470.html introduced a bug when some atexit handers skipped. Signed-off-by: Vitaly Buka <vitalybuka@google.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Define PC, SP and SYSRETURN for hurd x86_64Flavio Cruz2023-02-201-3/+9
| | | | | | Moved thread_state.h to x86 directory since we only need to customize those 3 definitions. Message-Id: <Y+x4xrsDMkAomncO@jupiter.tail36e24.ts.net>
* mach: Use PAGE_SIZESergey Bugaev2023-02-201-1/+5
| | | | | | | | | | | | | | The PAGE_SIZE from the Mach headers statically defines the machine's page size. There's no need to query it dynamically; furthermore, the implementation of the vm_statistics () RPC unconditionally fills in pagesize = PAGE_SIZE; Not doing the extra RPC shaves off 2 RPCs from the start-up of every process! Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230218203717.373211-7-bugaevc@gmail.com>
* hurd: Simplify init-first.c a bitSergey Bugaev2023-02-201-16/+7
| | | | | | | | And make it a bit more 64-bit ready. This is in preparation to moving this file into x86/ Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230218203717.373211-6-bugaevc@gmail.com>
* hurd: Make timer_t pointer-sizedSergey Bugaev2023-02-201-1/+1
| | | | | | | | This ensures that a timer_t value can be cast to struct timer_node * and back. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230218203717.373211-5-bugaevc@gmail.com>
* hurd: Fix xattr function return typeSergey Bugaev2023-02-205-5/+5
| | | | | | | They all return int, not size_t. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230218203717.373211-4-bugaevc@gmail.com>
* hurd: Use proper integer typesSergey Bugaev2023-02-206-10/+14
| | | | | | | | Fix a few more cases of build errors caused by mismatched types. This is a continuation of f4315054b46d5e58b44a709a51943fb73f846afb. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230218203717.373211-3-bugaevc@gmail.com>
* hurd: Move thread state manipulation into _hurd_tls_new ()Sergey Bugaev2023-02-202-21/+22
| | | | | | | This is going to be done differently on x86_64. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230218203717.373211-2-bugaevc@gmail.com>
* glob64_time64: Fix typo for stub_warning call (BZ #30146)Samuel Thibault2023-02-191-1/+1
| | | | | We were erroneously reporting a stub warning for glob64 instead of glob64_time64.
* Use uintptr_t instead of performing pointer subtraction with a null pointerQihao Chencao2023-02-1712-36/+35
| | | | | | Signed-off-by: Qihao Chencao <twose@qq.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>