aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-01-13inet: Add common IPv6 packet header macrosDan Luedtke1-0/+11
Adds commonly used IPv6 packet header macros similar to what is available on NetBSD and FreeBSD in sys/netinet/ip6.h and Android in libc/include/netinet/ip6.h Usage example IPV6_VERSION_MASK and IPV6_VERSION: if ((ip6->ip6_vfc & IPV6_VERSION_MASK) == IPV6_VERSION) return true; Usage example IPV6_FLOWINFO_MASK: ip6->ip6_flow = (flow & IPV6_FLOWINFO_MASK); The relevant standard is RFC2460 (Internet Protocol, Version 6 Specification). It defines the Internet Protocol version (IPV6_VERSION) and reduced the size of the flow label field from 24 to 20 bits (IPV6_FLOWLABEL_MASK). The traffic class and flow label fields together make up the flow information (IPV6_FLOWINFO_MASK). Tested on x86_64 GNU/Linux Signed-off-by: Dan Luedtke <danrl@google.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-13stdio-common: Suppress Clang warnings on scanf13.c with fortify enableAdhemerval Zanella1-0/+5
clang-19 shows: scanf13.c:28:40: error: 'sscanf' may overflow; destination buffer in argument 4 has size 8, but the corresponding specifier may require size 11 [-Werror,-Wfortify-source] 28 | "A%ms%10ms%4m[bcd]%4mcB", &sp1, &sp2, &sp3, &sp4) != 4) | ^ scanf13.c:94:34: error: 'sscanf' may overflow; destination buffer in argument 3 has size 8, but the corresponding specifier may require size 2049 [-Werror,-Wfortify-source] 94 | if (sscanf (buf, "%2048ms%mc", &sp3, &sp4) != 2) | ^ scanf13.c:110:61: error: 'sscanf' may overflow; destination buffer in argument 4 has size 8, but the corresponding specifier may require size 1501 [-Werror,-Wfortify-source] 110 | if (sscanf (buf, "%4mc%1500m[dr/]%548m[abc/d]%3mc", &sp1, &sp2, &sp3, &sp4) | ^ scanf13.c:110:67: error: 'sscanf' may overflow; destination buffer in argument 5 has size 8, but the corresponding specifier may require size 549 [-Werror,-Wfortify-source] 110 | if (sscanf (buf, "%4mc%1500m[dr/]%548m[abc/d]%3mc", &sp1, &sp2, &sp3, &sp4) clang does have some support to handle 'm' prefix for -Wformat; but it lacks support for -Wfortify to understand that it is up to libc to allocate the memory, and uses the pointer size instead to calculate validity.
2025-01-13elf: Suppress unused function clang for __ifunc_resolverAdhemerval Zanella2-0/+8
The __ifunc_resolver macro expands to: extern __typeof (__redirect_name) name __attribute__ ((ifunc ("iname_ifunc"))); static __typeof (__redirect_name) *name_ifunc (void) { [...] }; And although NAME_IFUNC is and alias for NAME, clang-18 still emits an 'unused function 'name_ifunc' [-Werror,-Wunused-function]' warning.
2025-01-13gmon: Disable tst-profile-static with clangAdhemerval Zanella1-1/+2
clang does not support -profile: clang: error: unknown argument '-profile'; did you mean '-fprofile'?
2025-01-13aarch64: Use 64-bit variable to access the special registersAdhemerval Zanella5-15/+30
clang issues: error: value size does not match register size specified by the constraint and modifier [-Werror,-Wasm-operand-widths] while tryng to use 32 bit variables with 'mrs' to get/set the fpsr, dczid_el0, and ctr.
2025-01-12hurd: Set _POSIX_MONOTONIC_CLOCK to 200809LSamuel Thibault1-1/+1
Now that CLOCK_MONOTONIC is supported.
2025-01-12hurd: Add CLOCK_MONOTONIC to clock_nanosleepSamuel Thibault1-5/+5
2025-01-12hurd: Add CLOCK_MONOTONIC support to lllSamuel Thibault1-5/+5
2025-01-12mach: Add CLOCK_MONOTONIC case in clock_gettime()Zhaoming Luo4-0/+59
The Mach RPC host_get_uptime64() is implemented. It returns the elapsed time value since bootup. See https://git.savannah.gnu.org/cgit/hurd/gnumach.git/commit/?id=fc494bfe3fb6363e1077dc035eb119970d84a9d1 In this patch, the RPC is used to implement the monotonic clock for mach. * config.h.in: Add HAVE_HOST_GET_UPTIME64 config entry * sysdeps/mach/clock_gettime.c: Add CLOCK_MONOTONIC case * sysdeps/mach/configure: Check the existence of host_get_uptime64 RPC * sysdeps/mach/configure.ac: Check the existence of host_get_uptime64 RPC Message-ID: <20250106043907.1046-1-zhmingluo@163.com>
2025-01-12hurd: Mark more memory-hungry tests as unsupportedSamuel Thibault1-0/+1
until RLIMIT_AS support gets commited in gnumach.
2025-01-12socket/tst-cmsghdr: Fix alignment of cmsghdrSamuel Thibault1-2/+2
The computation was correct on Linux only by luck because the cmsghdr size is already aligned there.
2025-01-12elf: make tst-tls_tp_offset compare &thread_var to THREAD_SELFSamuel Thibault1-1/+1
rather than pthread_self (), which in htl is not a pointer into dtv, but an index.
2025-01-12hurd: Mark more memory-hungry tests as unsupportedSamuel Thibault1-0/+5
until RLIMIT_AS support gets commited in gnumach.
2025-01-12hurd: Mark tst-tls-allocation-failure-static-patched as supportedSamuel Thibault1-3/+0
The failure was not due to RLIMIT_AS but unsupported intentional early abort.
2025-01-12hurd: Cope with signals sent to ourself earlySamuel Thibault1-0/+10
Typically when aborting during initialization, before signals are set up.
2025-01-12x86-64: Cast __rseq_offset to long long int [BZ #32543]H.J. Lu1-6/+6
commit 494d65129ed5ae1154b75cc189bbdde5e9ecf1df Author: Michael Jeanson <mjeanson@efficios.com> Date: Thu Aug 1 10:35:34 2024 -0400 nptl: Introduce <rseq-access.h> for RSEQ_* accessors added things like asm volatile ("movl %%fs:%P1(%q2),%0" \ : "=r" (__value) \ : "i" (offsetof (struct rseq_area, member)), \ "r" (__rseq_offset)); \ But this doesn't work for x32 when __rseq_offset is negative since the address is computed as FS + 32-bit to 64-bit zero extension of __rseq_offset + offsetof (struct rseq_area, member) Cast __rseq_offset to long long int "r" ((long long int) __rseq_offset)); \ to sign-extend 32-bit __rseq_offset to 64-bit. This is a no-op for x86-64 since x86-64 __rseq_offset is 64-bit. This fixes BZ #32543. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-11hurd: Mark more memory-hungry tests as unsupportedSamuel Thibault1-0/+22
until RLIMIT_AS support gets commited in gnumach.
2025-01-10Linux: Update internal copy of '<sys/rseq.h>'Michael Jeanson1-0/+11
Sync the internal copy of '<sys/rseq.h>' with the latest Linux kernel 'include/uapi/linux/rseq.h'. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-10nptl: Remove the rseq area from 'struct pthread'Michael Jeanson1-19/+3
The rseq extensible ABI implementation moved the rseq area to the 'extra TLS' block, remove the unused 'rseq_area' member of 'struct pthread'. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-10nptl: Move the rseq area to the 'extra TLS' blockMichael Jeanson12-58/+206
Move the rseq area to the newly added 'extra TLS' block, this is the last step in adding support for the rseq extended ABI. The size of the rseq area is now dynamic and depends on the rseq features reported by the kernel through the elf auxiliary vector. This will allow applications to use rseq features past the 32 bytes of the original rseq ABI as they become available in future kernels. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-10nptl: Introduce <rseq-access.h> for RSEQ_* accessorsMichael Jeanson4-0/+239
In preparation to move the rseq area to the 'extra TLS' block, we need accessors based on the thread pointer and the rseq offset. The ONCE variant of the accessors ensures single-copy atomicity for loads and stores which is required for all fields once the registration is active. A separate header is required to allow including <atomic.h> which results in an include loop when added to <tcb-access.h>. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-10nptl: add rtld_hidden_proto to __rseq_size and __rseq_offsetMichael Jeanson2-15/+28
This allows accessing the internal aliases of __rseq_size and __rseq_offset from ld.so without ifdefs and avoids dynamic symbol binding at run time for both variables. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-10Add Linux 'extra TLS'Michael Jeanson1-0/+71
Add the Linux implementation of 'extra TLS' which will allocate space for the rseq area at the end of the TLS blocks in allocation order. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-10Add generic 'extra TLS'Michael Jeanson3-9/+191
Add the logic to append an 'extra TLS' block in the TLS block allocator with a generic stub implementation. The duplicated code in 'csu/libc-tls.c' and 'elf/dl-tls.c' is to handle both statically linked applications and the ELF dynamic loader. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-10nptl: Add rseq auxvalsMichael Jeanson5-9/+49
Get the rseq feature size and alignment requirement from the auxiliary vector for use inside the dynamic loader. Use '__rseq_size' directly to store the feature size. If the main thread registration fails or is disabled by tunable, reset the value to 0. This will be used in the TLS block allocator to compute the size and alignment of the rseq area block for the extended ABI support. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-10Add missing include guards to <dl-tls.h>Florian Weimer5-0/+20
Some architecture-specific variants lack header inclusion guards. Add them for consistency with the generic version.
2025-01-10malloc: obscure calloc use in tst-callocSam James1-4/+8
Similar to a9944a52c967ce76a5894c30d0274b824df43c7a and f9493a15ea9cfb63a815c00c23142369ec09d8ce, we need to hide calloc use from the compiler to accommodate GCC's r15-6566-g804e9d55d9e54c change. First, include tst-malloc-aux.h, but then use `volatile` variables for size. The test passes without the tst-malloc-aux.h change but IMO we want it there for consistency and to avoid future problems (possibly silent). Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-01-10configure: Clear libc_cv_cc_wimplicit_fallthrough if not supportedH.J. Lu2-2/+2
Clear libc_cv_cc_wimplicit_fallthrough if -Wimplicit-fallthrough isn't supported. Tested with GCC 6.4.1 on x86-64. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
2025-01-09elf: Always define TLS_TP_OFFSETFlorian Weimer6-0/+70
This will be needed to compute __rseq_offset outside of the TLS relocation machinery. Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
2025-01-09x86: Add missing #include <features.h> to <thread_pointer.h>Florian Weimer1-0/+2
It is required for __GNUC_PREREQ. Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
2025-01-09Move <thread_pointer.h> to kernel-independent sysdeps directoriesFlorian Weimer11-0/+0
Hurd is expected to use the same thread ABI as Linux. Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
2025-01-09math: Fix acosf when building with gcc <= 11Adhemerval Zanella7-15/+7
GCC <= 11 wrongly assumes the rounding is to nearest and performs a constant folding where it should evaluate since the result is not exact [1]. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57245
2025-01-09tests: Verify inheritance of cpu affinitySiddhesh Poyarekar5-0/+296
Add a couple of tests to verify that CPU affinity set using sched_setaffinity and pthread_setaffinity_np are inherited by a child process and child thread. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-09s390x: Regenerated ULPsStefan Liebler1-0/+2
ULPs update needed if build with gcc 11.5 or 10.5.
2025-01-09i686: Regenerate multiarch ulpsH.J. Lu1-3/+3
Regenerate i686 multiarch ulps on Intel Core i7-1195G7 compiled with -O2 -march=i686 using GCC 14.2.1. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-01-08Revert "configure: default to --prefix=/usr on GNU/Linux"DJ Delorie2-7/+2
This reverts commit 81439a116cf48583127ddf1f09809440aa40969a.
2025-01-08riscv: Update nofpu libm test ulpsDarius Rad1-4/+40
Fixes math test failures. Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-08elf: Minimize library dependencies of tst-nolink-libc.cFlorian Weimer1-2/+4
On 32-bit Arm, -fasynchronous-unwind-tables creates a reference to the symbol __aeabi_unwind_cpp_pr0. Compile the tests without this flag even if it is passed as part of CC, to avoid linker failures.
2025-01-07include/string.h: Also redirect calls if not inlined in libpthreadSamuel Thibault1-1/+1
htl's pt-alloc.c calls __mempcpy, which is #defined to __builtin_mempcpy, but which does not happen to get inlined (the size is dynamic), and then gcc emits a reference to mempcpy, thus violating symbol exposition standard. We thus also have to redirect such references to __mempcpy too.
2025-01-07or1k: Update fpu libm-test-ulpsStafford Horne1-6/+165
2025-01-07math: update powerpc ulps (this time LE)Andreas K. Hüttel1-8/+8
Linux bogsucker 6.1.55-gentoo-dist-hardened #1 SMP Sun Oct 1 18:03:02 UTC 2023 ppc64le POWER9 (architected), altivec supported CHRP IBM pSeries (emulated by qemu) GNU/Linux Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-07elf: Second ld.so relocation only if libc.so has been loadedFlorian Weimer5-34/+81
Commit 8f8dd904c4a2207699bb666f30acceb5209c8d3f (“elf: rtld_multiple_ref is always true”) removed some code that happened to enable compatibility with programs that do not link against libc.so. Such programs cannot call dlopen or any dynamic linker functions (except __tls_get_addr), so this is not really useful. Still ld.so should not crash with a null-pointer dereference or undefined symbol reference in these cases. In the main relocation loop, call _dl_relocate_object unconditionally because it already checks if the object has been relocated. If libc.so was loaded, self-relocate ld.so against it and call __rtld_mutex_init and __rtld_malloc_init_real to activate the full implementations. Those are available only if libc.so is there, so skip these initialization steps if libc.so is absent. Without libc.so, the global scope can be completely empty. This can cause ld.so self-relocation to fail because if it uses symbol-based relocations, which is why the second ld.so self-relocation is not performed if libc.so is missing. The previous concern regarding GOT updates through self-relocation no longer applies because function pointers are updated explicitly through __rtld_mutex_init and __rtld_malloc_init_real, and not through relocation. However, the second ld.so self-relocation is still delayed, in case there are other symbols being used. Fixes commit 8f8dd904c4a2207699bb666f30acceb5209c8d3f (“elf: rtld_multiple_ref is always true”). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-07Revert "x86_64: Remove unused padding from tcbhead_t"Florian Weimer1-0/+12
This reverts commit 30d3fd7f4f4bc8f767d73ad4e4b005c1bd234310. The padding is required by Chromium's MaybeUpdateGlibcTidCache in sandbox/linux/services/namespace_sandbox.cc. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-07Revert "nptl: More useful padding in struct pthread"Florian Weimer1-25/+31
This reverts commit 7c22dcda27743658b6b8ea479283b384ad56bd5a. The padding is required by Chromium's MaybeUpdateGlibcTidCache in sandbox/linux/services/namespace_sandbox.cc. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-01-07tst-xdirent: Fix allocating dirent for readdir_r callSamuel Thibault1-4/+8
As documented in the glibc manual, “Some systems don’t define the d_name element sufficiently long”, and it provides an example of using a union to properly allocate the storage under the dirent.
2025-01-07hurd: Accept null arguments for utimensat pathnameSamuel Thibault1-5/+11
This follows Linux' behavior, making it a replacement for the futimens interface.
2025-01-07mach: Make clock_nanosleep also check tv_secSamuel Thibault1-0/+1
2025-01-07htl: Fix making pthread_join check timeout valueSamuel Thibault1-1/+7
2025-01-06i386: Update libm-test-ulpsAdhemerval Zanella1-29/+29
gcc version 14.2.1 targeting '-m32 -march=i586'.
2025-01-06nptl: Add <thread_pointer.h> for C-SKYMichael Jeanson1-0/+30
This will be required by the rseq extensible ABI implementation on all Linux architectures exposing the '__rseq_size' and '__rseq_offset' symbols to set the initial value of the 'cpu_id' field which can be used by applications to test if rseq is available and registered. As long as the symbols are exposed it is valid for an application to perform this test even if rseq is not yet implemented in libc for this architecture. Compile tested with build-many-glibcs.py but I don't have access to any hardware to run the tests. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>