Jovan Dmitrovic [Wed, 3 Sep 2025 13:53:37 +0000 (13:53 +0000)]
mips: Remove strcmp.S
Testing strcmp on MIPS hardware shows that strcmp.S performs worse
than the combination of using the generic strcmp.c implementation
alongside -funroll-loops.
Suggested-by: Joseph Myers <josmyers@redhat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
It now calls __libc_assert, which contains similar logic. The assert
call only requires memory allocation for the message translation, so
test-assert2.c is adapted to handle it.
It also removes the fxprintf from assert/assert_perror; although it
is not 100% backwards-compatible (write message only if there is a
file descriptor associated with the stderr). It now writes bytes
directly without going through the wide stream state.
nptl: Fix MADV_GUARD_INSTALL logic for thread without guard page (BZ 33356)
The main issue is that setup_stack_prot fails to account for cases where
the cached thread stack lacks a guard page, which can cause madvise to
fail. Update the logic to also handle whether MADV_GUARD_INSTALL is
supported when resizing the guard page.
Checked on x86_64-linux-gnu with 6.8.0 and 6.15 kernels.
x86: Use "%v" to emit VEX encoded instructions for AVX targets
Legacy encodings of SSE instructions incur AVX-SSE domain transition
penalties on some Intel microarchitectures (e.g. Haswell, Broadwell).
Using the VEX forms avoids these penatlies and keeps all instructions
in the VEX decode domain. Use "%v" sequence to emit the "v" prefix
for opcodes when compiling with -mavx.
GCC now accept plain variable names as valid lvalues for "m"
constraints, automatically spilling locals to memory if necessary.
The long-standing "*&" pattern was originally used as a defensive
workaround for older compiler versions that rejected operands
such as:
asm ("incl %0" : "+m"(x));
with errors like "memory input is not directly addressable".
Modern compilers (GCC >= 9) reliably generate correct code
without the workaround, and the resulting assembly is identical.
Diego Nieto Cid [Fri, 15 Aug 2025 01:57:30 +0000 (02:57 +0100)]
hurd: implement RLIMIT_AS against Mach RPCs
Check for VM limit RPCs
* config.h.in: add #undef for HAVE_MACH_VM_GET_SIZE_LIMIT and
HAVE_MACH_VM_SET_SIZE_LIMIT.
* sysdeps/mach/configure.ac: use mach_RPC_CHECK to check for
vm_set_size_limit and vm_get_size_limit RPCs in gnumach.defs.
* sysdeps/mach/configure: regenerate file.
Use vm_get_size_limit to initialize RLIMIT_AS
* hurd/hurdrlimit.c(init_rlimit): use vm_get_size_limit to initialize
RLIMIT_AS entry of the _hurd_rlimits array.
Notify the kernel of the new VM size limits
* sysdeps/mach/hurd/setrlimit.c: use the vm_set_size_limit RPC,
if available, to notify the kernel of the new limits. Retry RPC
calls if they were interrupted by a signal.
Message-ID: <03fb90a795b354a366ee73f56f73e6ad22a86cda.1755220108.git.dnietoc@gmail.com>
Samuel Thibault [Sun, 21 Sep 2025 21:45:40 +0000 (23:45 +0200)]
hurd: catch SIGSEGV on returning from signal handler
On stack overflow typically, we may not actually have room on the stack to
trampoline back from the signal handler. We have to detect this before
locking the ss, otherwise the signal thread will be stuck on taking the
ss lock while trying to post SIGSEGV.
Remove support for obsolete dumped heaps. Dumping heaps was discontinued
8 years ago, however loading a dumped heap is still supported. This blocks
changes and improvements of the malloc data structures - hence it is time
to remove this. Ancient binaries that still call malloc_set_state will now
get the -1 error code. Update tst-mallocstate.c to just check for this.
The realpath call may trigger OOM termination of the test process
under difficult-to-predict circumstances. (It depends on available
RAM and swap.) Therefore, instruct the test driver to ignore
an OOM process termination during the realpath call.
support: Add support_accept_oom to heuristically support OOM errors
Some tests may trigger the kernel OOM handler under conditions
which are difficult to predict (depending on available RAM and
swap space). If we can determine specific regions which might
do this and this does not contradict the test object, the
functions support_accept_oom (true) and support_accept_oom (false)
can be called at the start and end, and the test driver will
ignore SIGKILL signals.
The "unused" variable could be use unitialized, which is an issue if ldd
is ran with "-u". Fix that by defining the variable to an empty value,
just like it is already done for the bind_now, warn and verbose
variables.
Reported-by: Johan Palmqvist <johan.palmqvist@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
which warns ‘-pg’ without ‘-mfentry’, when glibc is configured with
--disable-default-pie, GCC 16 fails to compile .op files and gmon tests
with error:
cc1: error: ‘-pg’ without ‘-mfentry’ may be unreliable with shrink wrapping [-Werror]
Compile .op files and gmon tests with -mfentry if it is supported by
CC/TEST_CC and glibc is configured with --disable-default-pie. This
fixes BZ #33376.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Joseph Myers <josmyers@redhat.com>
i386: Use __seg_gs qualifier to cast access to TCB in THREAD_GSCOPE_RESET_FLAG()
Use the __seg_gs named address space qualifier to cast access to the
gscope_flag in the TCB as a %gs: prefixed address. This enables the
use of the "m" operand constraint, which informs the compiler about
memory access in the inline assembly.
x86_64: Use __seg_fs qualifier to cast access to TCB in THREAD_GSCOPE_RESET_FLAG()
Use the __seg_fs named address space qualifier to cast access to the
gscope_flag in the TCB as a %fs: prefixed address. This enables the
use of the "m" operand constraint, which informs the compiler about
memory access in the inline assembly.
Joseph Myers [Wed, 3 Sep 2025 16:30:11 +0000 (16:30 +0000)]
Fix RISC-V soft-float _FPU_SETCW for GCC 16 set-but-not-used warnings
The soft-float RISC-V definition of _FPU_SETCW results in a
-Werror=unused-but-set-variable= build failure with GCC mainline (in
math/setfpucw.c) because it does not use the dummy cw variable.
Change it to (void) (cw) as on other architectures to avoid this build
failure.
Tested with build-many-glibcs.py (compilers) for
riscv64-linux-gnu-rv64imac-lp64, which previously failed. Reviewed-by: Sam James <sam@gentoo.org>
nss: Group merge does not react to ERANGE during merge (bug 33361)
The break statement in CHECK_MERGE is expected to exit the surrounding
while loop, not the do-while loop with in the macro. Remove the
do-while loop from the macro. It is not needed to turn the macro
expansion into a single statement due to the way CHECK_MERGE is used
(and the statement expression would cover this anyway).
caiyinyu [Fri, 3 Jan 2025 07:23:46 +0000 (15:23 +0800)]
LoongArch: Use the generic shmlab.h.
The shmlba.h file related to the LoongArch architecture was introduced
in commit 3eed5f3a1ee to address the mismatch in the SHMLBA definition
between glibc and the kernel. See [1]. The SHMLBA definition was later
updated in commit d23b77953f5a. See [2]. Now, we adopt the definition
from the common layer.
LoongArch: Fix inconsistency in SHMLBA macro values between glibc and kernel
The LoongArch glibc was using the value of the SHMLBA macro from common code,
which is __getpagesize() (16k), but this was inconsistent with the value of
the SHMLBA macro in the kernel, which is SZ_64K (64k). This caused several
shmat-related tests in LTP (Linux Test Project) to fail. This commit fixes
the issue by ensuring that the glibc's SHMLBA macro value matches the value
used in the kernel like other architectures.
LoongArch has hardware page coloring for L1 Cache, so we don't have
cache aliases. But SFB (Store Fill Buffer) still has aliases. So we
define SHMLBA to SZ_64K previously. But there are losts of applications
use PAGE_SIZE rather than SHMLBA to mmap() file pages and shared pages.
Of course we can fix them one by one, but not easy.
On the other hand, we can simply disable SFB for 4KB page size to fix
cache alias (there will be performance decrease, but acceptable), and
in future we will fix SFB in hardware. So we can safely define SHMLBA to
PAGE_SIZE (use the generic shmparam.h) to make life easier.
alpha: Fix missing inexact-flag raising for lround/lrint
The l*[rint|round]f implements uses alpha 'cvtst/s', 'addt/suc',
adn 'cvttq/svd' which are not not fully IEEE compliant w.r.t
inexact-flag raising.. Use the software fallback implementation
instead.
Checked on alpha-linux-gnu.
Tested-by: Michael Cree <mcree@orcon.net.nz> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
To avoid linknamespace issues on old standards. It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation. Reviewed-by: DJ Delorie <dj@redhat.com>
To avoid linknamespace issues on old standards. It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation. Reviewed-by: DJ Delorie <dj@redhat.com>
To avoid linknamespace issues on old standards. It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation. Reviewed-by: DJ Delorie <dj@redhat.com>
To avoid linknamespace issues on old standards. It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation. Reviewed-by: DJ Delorie <dj@redhat.com>
To avoid linknamespace issues on old standards. It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation. Reviewed-by: DJ Delorie <dj@redhat.com>
To avoid linknamespace issues on old standards. It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation. Reviewed-by: DJ Delorie <dj@redhat.com>
To avoid linknamespace issues on old standards. It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation. Reviewed-by: DJ Delorie <dj@redhat.com>
Mike FABIAN [Mon, 18 Aug 2025 07:24:06 +0000 (09:24 +0200)]
Update to Unicode 17.0.0 [BZ #33289]
Unicode 17.0.0 Support: Character encoding, character type info, and
transliteration tables are all updated to Unicode 17.0.0, using
the generator scripts contributed by Mike FABIAN (Red Hat).
Changes in CHARMAP and WIDTH:
Total added characters in newly generated CHARMAP: 4803
Total removed characters in newly generated WIDTH: 0
Total changed characters in newly generated WIDTH: 0
Total added characters in newly generated WIDTH: 4512
Some combining characters and other non-spacing marks have been added
with WIDTH 0. Lots of characters have been added with WIDTH 2, most of
them are CJK Ideographs plus a few Tangut characters and 7 emoji.
Changes in ctype:
alpha: Added 4672 characters in new ctype which were not in old ctype
combining: Added 42 characters in new ctype which were not in old ctype
combining_level3: Added 8 characters in new ctype which were not in old ctype
graph: Added 4803 characters in new ctype which were not in old ctype
lower: Missing: ʕ 0x295 LATIN LETTER PHARYNGEAL VOICED FRICATIVE
lower: Added 27 characters in new ctype which were not in old ctype
print: Added 4803 characters in new ctype which were not in old ctype
punct: Added 131 characters in new ctype which were not in old ctype
tolower: Added 28 characters in new ctype which were not in old ctype
totitle: Added 28 characters in new ctype which were not in old ctype
toupper: Added 28 characters in new ctype which were not in old ctype
upper: Added 28 characters in new ctype which were not in old ctype
Nothing suspicious in the additions.
About the character removed from lower:
ʕ 0x295 LATIN LETTER PHARYNGEAL VOICED FRICATIVE
In UnicodeData.txt it changed from 'Ll' (Letter Lowercase) to 'Lo' (Letter Other):
-0295;LATIN LETTER PHARYNGEAL VOICED FRICATIVE;Ll;0;L;;;;;N;LATIN LETTER REVERSED GLOTTAL STOP;;;;
+0295;LATIN LETTER PHARYNGEAL VOICED FRICATIVE;Lo;0;L;;;;;N;LATIN LETTER REVERSED GLOTTAL STOP;;;;
Requires Neon (aka. Advanced SIMD). Looks up 16 characters at a time,
for a 2-3x perfomance improvement, and a ~30% speedup on the strtok &
strsep benchtests, as tested on Cortex A-{53,72}.
Remove all unused atomics. Replace uses of catomic_increment and
catomic_decrement with atomic_fetch_add_relaxed which maps to a standard
compiler builtin. Relaxed memory ordering is correct for simple counters
since they only need atomicity.
Remove obsolete catomic_* locking primitives which don't map
to standard compiler builtins.
There are still a couple of places in the tree that uses them
(malloc/arena.c and malloc/malloc.c).
x86 didn't define __arch_c_compare_and_exchange_bool_* primitives
so fallback code used __arch_c_compare_and_exchange_val_* primitives
instead. This resulted in unoptimal code for
catomic_compare_and_exchange_bool_acq where superfluous
CMP was emitted after CMPXCHG, e.g. in arena_get2:
OTOH, catomic_decrement does not fallback to atomic_fetch_add (, -1)
builtin but to the cmpxchg loop, so the generated code in arena_get2
regresses a bit, from using LOCK DECQ insn:
Depending on the target processor, the compiler may emit either
'LOCK ADD/SUB $1, m' or 'INC/DEC $1, m' instruction, due to partial
flag register stall issue.
atomic: Use builtin atomics with USE_ATOMIC_COMPILER_BUILTINS
Use builtin atomics for atomic_compare_and_exchange_* and
atomic_exchange_and_add if USE_ATOMIC_COMPILER_BUILTINS is enabled.
This allows removing target atomic-machine.h headers.
H.J. Lu [Tue, 9 Sep 2025 02:49:24 +0000 (19:49 -0700)]
x86: Include <bits/stdlib-bsearch.h> in dl-cacheinfo.h
On x86-64, when glibc is configured with --enable-stack-protector=all
and compiled with -Os, ld.so crashes very early:
(gdb) r --direct
Starting program: /export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/string/test-memswap --direct
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f41b0a in bsearch (__key=__key@entry=0x7fffffffda28,
__base=__base@entry=0x7ffff7fca140 <intel_02_known>,
__nmemb=__nmemb@entry=68, __size=__size@entry=8,
__compar=__compar@entry=0x7ffff7f3b691 <intel_02_known_compare>)
at ../bits/stdlib-bsearch.h:22
22 {
(gdb) disass
Dump of assembler code for function bsearch:
0x00007ffff7f41af0 <+0>: push %r15
0x00007ffff7f41af2 <+2>: mov %rcx,%r15
0x00007ffff7f41af5 <+5>: push %r14
0x00007ffff7f41af7 <+7>: push %r13
0x00007ffff7f41af9 <+9>: mov %rsi,%r13
0x00007ffff7f41afc <+12>: push %r12
0x00007ffff7f41afe <+14>: mov %rdi,%r12
0x00007ffff7f41b01 <+17>: push %rbp
0x00007ffff7f41b02 <+18>: mov %rdx,%rbp
0x00007ffff7f41b05 <+21>: push %rbx
0x00007ffff7f41b06 <+22>: sub $0x18,%rsp
=> 0x00007ffff7f41b0a <+26>: mov %fs:0x28,%r14
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We can't use stack protector at this point.
0x00007ffff7f41b13 <+35>: mov %r14,0x8(%rsp)
0x00007ffff7f41b18 <+40>: mov %r8,%r14
0x00007ffff7f41b1b <+43>: test %rbp,%rbp
0x00007ffff7f41b1e <+46>: je 0x7ffff7f41b48 <bsearch+88>
0x00007ffff7f41b20 <+48>: mov %rbp,%rbx
0x00007ffff7f41b23 <+51>: mov %r12,%rdi
0x00007ffff7f41b26 <+54>: shr $1,%rbx
0x00007ffff7f41b29 <+57>: imul %r15,%rbx
0x00007ffff7f41b2d <+61>: add %r13,%rbx
0x00007ffff7f41b30 <+64>: mov %rbx,%rsi
(gdb) bt
#0 0x00007ffff7f41b0a in bsearch (__key=__key@entry=0x7fffffffda28,
__base=__base@entry=0x7ffff7fca140 <intel_02_known>,
__nmemb=__nmemb@entry=68, __size=__size@entry=8,
__compar=__compar@entry=0x7ffff7f3b691 <intel_02_known_compare>)
at ../bits/stdlib-bsearch.h:22
#1 0x00007ffff7f3c1be in intel_check_word (name=188, value=1979933440,
has_level_2=has_level_2@entry=0x7fffffffda7f,
no_level_2_or_3=no_level_2_or_3@entry=0x7fffffffda7e,
cpu_features=<optimized out>) at ../sysdeps/x86/dl-cacheinfo.h:217
#2 0x00007ffff7f3c29f in handle_intel (name=name@entry=188,
cpu_features=<optimized out>) at ../sysdeps/x86/dl-cacheinfo.h:279
#3 0x00007ffff7f3ccf9 in dl_init_cacheinfo (cpu_features=<optimized out>)
at ../sysdeps/x86/dl-cacheinfo.h:852
#4 init_cpu_features (cpu_features=<optimized out>)
at ../sysdeps/x86/cpu-features.c:1153
#5 0x00007ffff7f3d6f9 in __libc_start_main_impl (main=0x7ffff7f396dc <main>,
argc=2, argv=0x7fffffffdbe8, init=<optimized out>, fini=<optimized out>,
rtld_fini=0x0, stack_end=0x7fffffffdbd8) at ../csu/libc-start.c:269
#6 0x00007ffff7f39901 in _start () at ../sysdeps/x86_64/start.S:115
(gdb)
The problem is that since __USE_EXTERN_INLINES isn't defined with -Os,
the inline bsearch in <bits/stdlib-bsearch.h> isn't available and the
external bsearch is compiled with stack protector. Include
<bits/stdlib-bsearch.h> in dl-cacheinfo.h fixed BZ #33374.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
The test failures were not detected in routine test suite runs because
normally we create the test file in /tmp, where a tmpfs is usually
mounted, and tmpfs does not support this flag. But it can be reproduced
with TMPDIR set to some directory in an ext4 file system.
I have not checked with all versions for all ABIs, but I saw failures
with gcc-14 on arm, alpha, hppa, i686, sparc, sh4, and microblaze. Reviewed-by: Collin Funk <collin.funk1@gmail.com>
libio: Define AT_RENAME_* with the same tokens as Linux
Linux uses different expressions for the RENAME_* and AT_RENAME_*
constants. Mirror that in <stdio.h>, so that the macro redefinitions
do not result in preprocessor warnings.
Convert tests to use 'xfmemopen' rather than open-coding error checks
with 'fmemopen' or plain missing them, where 'fmemopen' itself is not
the scope of testing. Leave 'fmemopen' tests alone.
support: Implement 'xfmemopen' for seamless 'fmemopen' use
Add 'xfmemopen' wrapper for seamless 'fmemopen' use in tests, following
'xfopen', 'xfclose', etc., and providing a standardized error reporting
facility.
x86_64: Unconditionally run test elf/check-dt-x86-64-plt
The intention of GLIBC_ABI_DT_X86_64_PLT is simply to mark the existence
of the fix in f8587a61892cbafd98ce599131bf4f103466f084
("x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT").
Testing for GLIBC_ABI_DT_X86_64_PLT does not depend on the linker
supporting -z mark-plt. Therefore remove this dependency on linker
support and test unconditionally.
Joseph Myers [Wed, 3 Sep 2025 16:04:49 +0000 (16:04 +0000)]
Fix sysdeps/mips/dl-machine-reject-phdr.h build with GCC 16
Building for MIPS has been broken with GCC mainline since mid-July,
probably GCC commit 0eac9cfee8cb0b21de866a04d5d59685ab35208f "c, c++:
Extend -Wunused-but-set-* warnings [PR44677]", because the variable
perfect_match in elf_machine_reject_phdr_p is set unconditionally, but
only used if _MIPS_SIM == _ABIO32. Mark it with __attribute__ ((unused)),
which seems cleaner in such a conditionally-used case than making all
other logic relating to this variable conditional.
Tested with build-many-glibcs.py (compilers build, which previously
failed) for mips64-linux-gnu.
Xi Ruoyao [Fri, 29 Aug 2025 03:39:35 +0000 (11:39 +0800)]
nptl: Drop IS_IN (libpthread) around hidden_proto (__pthread_rwlock_unlock)
Now libpthread is a dummy library and it no longer contains
__pthread_rwlock_unlock at all, thus IS_IN (libpthread) does not make
sense here.
It seems an left over from commit eb29dcde31e7 ("nptl: Move rwlock
functions with forwarders into libc") and it caused libc.so to export an
unversioned __pthread_rwlock_unlock on Linux ports introduced after the
2.34 release (loongarch and or1k) but the symbol is not ever supposed to
be exported on those new ports. Only since the commit 3b2b88cceeb7
("elf: early conversion of elf p_flags to mprotect flags") the header
dependency change happened to pull in libc-lockP.h which sets
hidden_proto (__pthread_rwlock_unlock) correctly, the symbol is no
longer exported, breaking the ABI on those ports.
Remove this #if as a clean up and to prevent such a mess from happening
again.
Signed-off-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Florian Weimer <fweimer@redhat.com>
DJ Delorie [Thu, 7 Aug 2025 21:07:53 +0000 (17:07 -0400)]
login: fix ut_line comparison logic
ut_line[] is not a string, it's a fixed-width character field,
and may not be NUL terminated. Thus, the use of strcmp is incorrect.
strncmp is more appropriate as it stops at the field size.
Note that differences beyond the field size do not count here,
as (1) this test doesn't do that, and (2) such differences are
traditionally ignored (i.e. logins that are silently truncated to
8 characters, etc)
While this is "only a test", we should still demonstrate the
correct way of doing things. Also, using strncmp avoids a
"not a string" warning from gcc if you use -O1 or lower,
where it can't deduce that overflow won't happen.
Reviewed-by: Sam James <sam@gentoo.org> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Uros Bizjak [Fri, 29 Aug 2025 07:05:23 +0000 (09:05 +0200)]
x86: Use flag output operands for inline asm in atomic-machine.h
Use the flag output constraints feature available in gcc 6+
("=@cc<cond>") instead of explicitly setting a boolean variable
with SETcc instruction. This approach decouples the instruction
that sets the flags from the code that consumes them, allowing
the compiler to create better code when working with flags users.
Instead of e.g.:
lock add %esi,(%rdi)
sets %sil
test %sil,%sil
jne <...>
Uros Bizjak [Mon, 25 Aug 2025 07:50:37 +0000 (09:50 +0200)]
x32: Fix, optimize and cleanup RSEQ_* accessors
Add missing "memory" clobber to accessors. The "memory" clobber
tells the compiler that the assembly code performs memory reads
or writes to items other than those listed in the input and output
operands (for example, accessing the memory pointed to by one of
the input parameters).
Use MOVZBL instead of MOVB when reading 1-byte memory location
into a register. MOVB to a register actually inserts into the LSB
of the word-sized register, making the result dependent on
the previous register value. MOVZBL avoids this issue.
Change %P asm operand modifiers to %c. The ‘c’ modifier is a
generic asm operand modifier that requires a constant operand and
prints the constant expression without punctuation.
Replace %b asm operand modifiers with explicit casts. Explicit
casts inform the compiler which part of the register value is used,
allowing it to perform additional optimizations (e.g. narrowing the
preceding operation).
Remove %q asm operand modifiers. Since the value is already cast
to 'long long int', the compiler will emit a 64-bit register name
in the assembly without needing %q.
No functional changes intended.
Tested-by: H.J. Lu <hjl.tools@gmail.com> Co-Authored-By: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Carlos O'Donell <carlos@redhat.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Henrik Lindström [Sat, 10 May 2025 09:02:05 +0000 (11:02 +0200)]
x86/configure: Improve portability of isa level check
wc -l pads the output with leading spaces on some systems, e.g. FreeBSD.
This results in the check `test "$count" = 1` failing. Use -eq for integer
comparison instead.
Signed-off-by: Henrik Lindström <henrik@lxm.se> Reviewed-by: Arjun Shankar <arjun@redhat.com>
elf: early conversion of elf p_flags to mprotect flags
This patch replaces _dl_stack_flags global variable by
_dl_stack_prot_flags.
The advantage is that any convertion from p_flags to final used mprotect
flags occurs at loading of p_flags. It avoids repeated spurious
convertions of _dl_stack_flags, for example in allocate_thread_stack.
This modification was suggested in:
https://sourceware.org/pipermail/libc-alpha/2025-March/165537.html
Wilco Dijkstra [Wed, 27 Aug 2025 13:04:18 +0000 (13:04 +0000)]
malloc: Support hugepages in mremap_chunk
Add mremap_chunk support for mmap()ed chunks using hugepages by accounting for
their alignment, to prevent the mremap call failing in most cases where the
size passed is not a hugepage size multiple. It also improves robustness for
reallocating hugepages since mremap is much less likely to fail, so running
out of memory when reallocating a larger size and having to copy the old
contents after mremap fails is also less likely.
To track whether an mmap()ed chunk uses hugepages, have a flag in the lowest
bit of the mchunk_prev_size field which is set after a call to sysmalloc_mmap,
and accessed later in mremap_chunk. Create macros for getting and setting this
bit, and for mapping the bit off when accessing the field for mmap()ed chunks.
Since the alignment cannot be lower than 8 bytes, this flag cannot affect the
alignment data.
Add malloc/tst-tcfree4-malloc-check to the tests-exclude-malloc-check list as
malloc-check prevents the tcache from being used to store chunks. This test
caused failures due to a bug in mem2chunk_check to be fixed in a later patch.
Wilco Dijkstra [Fri, 8 Aug 2025 14:11:13 +0000 (14:11 +0000)]
malloc: Change mmap chunk layout
Change the mmap chunk layout to be identical to a normal chunk. This makes it
safe for tcache to hold mmap chunks and simplifies size calculations in
memsize and musable. Add mmap_base() and mmap_size() macros to simplify code.
Reviewed-by: Cupertino Miranda <cupertino.miranda@oracle.com>
Collin Funk [Fri, 15 Aug 2025 01:13:07 +0000 (18:13 -0700)]
manual: Refer to libc-alpha instead of a dead mailing list.
* manual/message.texi (Advanced gettext functions): Refer to
libc-alpha@sourceware.org instead of bug-glibc-manual@gnu.org which no
longer exists.
* NEWS: Likewise.