aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-01-03mach: Drop some unnecessary vm_param.h includesSergey Bugaev2-2/+0
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2024-01-03hurd: Declare _hurd_intr_rpc_msg* with protected visibilitySergey Bugaev1-3/+3
These symbols are internal and never exported; make sure the compiler realizes that when compiling hurdsig.c and does not try to emit GOT reads. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2024-01-03hurd: Add some missing includesSergey Bugaev3-1/+3
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2024-01-03localedata: fy_DE: make this "Western Frisian" to agree with the language ↵Mike FABIAN1-29/+35
code "fy" Resolves: BZ # 14522
2024-01-03localedata: fy_DE, fy_NL: convert to UTF-8Mike FABIAN2-3/+3
2024-01-03localedata: ast_ES: convert to UTF-8Mike FABIAN1-9/+9
2024-01-03localedata: ast_ES: Remove wrong copyright textMike FABIAN1-3/+1
Resolves: BZ # 27601
2024-01-03localedata: de_{AT,BE,CH,IT,LU}: convert to UTF-8Mike FABIAN5-24/+24
2024-01-03localedata: lv_LV, it_IT, it_CH: convert to UTF-8Mike FABIAN3-33/+33
2024-01-03localedata: it_IT, lv_LV: currency symbol should follow the amountMike FABIAN2-6/+6
Resolves: BZ # 28558
2024-01-03Implement C23 <stdbit.h>Joseph Myers133-15/+7011
C23 adds a header <stdbit.h> with various functions and type-generic macros for bit-manipulation of unsigned integers (plus macro defines related to endianness). Implement this header for glibc. The functions have both inline definitions in the header (referenced by macros defined in the header) and copies with external linkage in the library (which are implemented in terms of those macros to avoid duplication). They are documented in the glibc manual. Tests, as well as verifying results for various inputs (of both the macros and the out-of-line functions), verify the types of those results (which showed up a bug in an earlier version with the type-generic macro stdc_has_single_bit wrongly returning a promoted type), that the macros can be used at top level in a source file (so don't use ({})), that they evaluate their arguments exactly once, and that the macros for the type-specific functions have the expected implicit conversions to the relevant argument type. Jakub previously referred to -Wconversion warnings in type-generic macros, so I've included a test with -Wconversion (but the only warnings I saw and fixed from that test were actually in inline functions in the <stdbit.h> header - not anything coming from use of the type-generic macros themselves). This implementation of the type-generic macros does not handle unsigned __int128, or unsigned _BitInt types with a width other than that of a standard integer type (and C23 doesn't require the header to handle such types either). Support for those types, using the new type-generic built-in functions Jakub's added for GCC 14, can reasonably be added in a followup (along of course with associated tests). This implementation doesn't do anything special to handle C++, or have any tests of functionality in C++ beyond the existing tests that all headers can be compiled in C++ code; it's not clear exactly what form this header should take in C++, but probably not one using macros. DIS ballot comment AT-107 asks for the word "count" to be added to the names of the stdc_leading_zeros, stdc_leading_ones, stdc_trailing_zeros and stdc_trailing_ones functions and macros. I don't think it's likely to be accepted (accepting any technical comments would mean having an FDIS ballot), but if it is accepted at the WG14 meeting (22-26 January in Strasbourg, starting with DIS ballot comment handling) then there would still be time to update glibc for the renaming before the 2.39 release. The new functions and header are placed in the stdlib/ directory in glibc, rather than creating a new toplevel stdbit/ or putting them in string/ alongside ffs. Tested for x86_64 and x86.
2024-01-03localedata: ms_MY should not use 12-hour formatMike FABIAN1-7/+8
Resolves: BZ # 29504
2024-01-02localedata: es_ES: convert to UTF-8Mike FABIAN1-9/+9
2024-01-02localedata: es_ES: Add am_pm stringsMike FABIAN1-1/+1
Resolves: BZ # 24013 Use <U202F> instead of a plain space because CLDR also uses that.
2024-01-02aarch64: Add longjmp test for SMESzabolcs Nagy2-0/+283
Includes test for setcontext too. The test directly checks after longjmp if ZA got disabled and the ZA contents got saved following the lazy saving scheme. It does not use ACLE code to verify that gcc can interoperate with glibc. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-02aarch64: Add setcontext support for SMESzabolcs Nagy1-0/+19
For the ZA lazy saving scheme to work, setcontext has to call __libc_arm_za_disable. Also fixes swapcontext which uses setcontext internally. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-02aarch64: Add longjmp support for SMESzabolcs Nagy1-0/+22
For the ZA lazy saving scheme to work, longjmp has to call __libc_arm_za_disable. In ld.so we assume ZA is not used so longjmp does not need special support there. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-02aarch64: Add SME runtime supportSzabolcs Nagy3-3/+129
The runtime support routines for the call ABI of the Scalable Matrix Extension (SME) are mostly in libgcc. Since libc.so cannot depend on libgcc_s.so have an implementation of __arm_za_disable in libc for libc internal use in longjmp and similar APIs. __libc_arm_za_disable follows the same PCS rules as __arm_za_disable, but it's a hidden symbol so it does not need variant PCS marking. Using __libc_fatal instead of abort because it can print a message and works in ld.so too. But for now we don't need SME routines in ld.so. To check the SME HWCAP in asm, we need the _dl_hwcap2 member offset in _rtld_global_ro in the shared libc.so, while in libc.a the _dl_hwcap2 object is accessed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-02localedata: convert uz_UZ and uz_UZ@cyrillic to UTF-8Mike FABIAN2-56/+56
2024-01-02localedata: uz_UZ and uz_UZ@cyrillic: Fix decimal point and thousands separatorMike FABIAN2-4/+4
Resolves: BZ # 31204
2024-01-02libio: Check remaining buffer size in _IO_wdo_write (bug 31183)Florian Weimer1-1/+1
The multibyte character needs to fit into the remaining buffer space, not the already-written buffer space. Without the fix, we were never moving the write pointer from the start of the buffer, always using the single-character fallback buffer. Fixes commit 04b76b5aa8b2d1d19066e42dd1 ("Don't error out writing a multibyte character to an unbuffered stream (bug 17522)").
2024-01-02getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163)Andreas Schwab1-1/+8
When __resolv_context_get returns NULL due to out of memory, translate it to a return value of EAI_MEMORY.
2024-01-01string: Add additional output in test-strchr failureNoah Goldstein1-5/+12
Seeing occasional failures in `__strchrnul_evex512` that are not consistently reproducible. Hopefully by adding this the next failure will provide enough information to debug. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2024-01-01Add a setjmp/longjmp test between user contextsH.J. Lu2-0/+139
Verify that setjmp and longjmp work correctly between user contexts. Arrange stacks for uctx_func1 and uctx_func2 so that ____longjmp_chk works when setjmp and longjmp are called from different user contexts. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2024-01-01x86/cet: Add -fcf-protection=none before -fcf-protection=branchH.J. Lu1-4/+4
When shadow stack is enabled, some CET tests failed when compiled with GCC 14: FAIL: elf/tst-cet-legacy-4 FAIL: elf/tst-cet-legacy-5a FAIL: elf/tst-cet-legacy-6a which are caused by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113039 These tests use -fcf-protection -fcf-protection=branch and assume that -fcf-protection=branch will override -fcf-protection. But this GCC 14 commit: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=1c6231c05bdcca changed the -fcf-protection behavior such that -fcf-protection -fcf-protection=branch is treated the same as -fcf-protection Use -fcf-protection -fcf-protection=none -fcf-protection=branch as the workaround. This fixes BZ #31187. Tested with GCC 13 and GCC 14 on Intel Tiger Lake. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2024-01-01Regenerate libc.potAndreas K. Hüttel1-159/+173
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2024-01-01Omit regex.c pragmas no longer neededPaul Eggert1-4/+0
* posix/regex.c: [!_LIBC && __GNUC_PREREQ (4, 3)]: Omit GCC pragmas no longer needed when this file is used as part of Gnulib. -Wold-style-definition no longer needs to be ignored because the regex code no longer uses old style definitions. -Wtype-limits no longer needs to be ignored because Gnulib already arranges for it to be ignored in the C compiler flags. This patch is taken from Gnulib.
2024-01-01Update copyright dates not handled by scripts/update-copyrightsPaul Eggert21-21/+21
I've updated copyright dates in glibc for 2024. This is the patch for the changes not generated by scripts/update-copyrights and subsequent build / regeneration of generated files.
2024-01-01Update copyright in generated files by running "make"Paul Eggert2-2/+2
2024-01-01Update copyright dates with scripts/update-copyrightsPaul Eggert12589-12621/+12621
2024-01-01x86/cet: Run some CET tests with shadow stackH.J. Lu4-0/+17
When CET is disabled by default, run some CET tests with shadow stack enabled using $ export GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
2024-01-01x86/cet: Don't set CET active by defaultH.J. Lu2-2/+15
Not all CET enabled applications and libraries have been properly tested in CET enabled environments. Some CET enabled applications or libraries will crash or misbehave when CET is enabled. Don't set CET active by default so that all applications and libraries will run normally regardless of whether CET is active or not. Shadow stack can be enabled by $ export GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK at run-time if shadow stack can be enabled by kernel. NB: This commit can be reverted if it is OK to enable CET by default for all applications and libraries.
2024-01-01x86/cet: Check feature_1 in TCB for active IBT and SHSTKH.J. Lu3-1/+35
Initially, IBT and SHSTK are marked as active when CPU supports them and CET are enabled in glibc. They can be disabled early by tunables before relocation. Since after relocation, GLRO(dl_x86_cpu_features) becomes read-only, we can't update GLRO(dl_x86_cpu_features) to mark IBT and SHSTK as inactive. Instead, check the feature_1 field in TCB to decide if IBT and SHST are active.
2024-01-01x86/cet: Enable shadow stack during startupH.J. Lu10-146/+175
Previously, CET was enabled by kernel before passing control to user space and the startup code must disable CET if applications or shared libraries aren't CET enabled. Since the current kernel only supports shadow stack and won't enable shadow stack before passing control to user space, we need to enable shadow stack during startup if the application and all shared library are shadow stack enabled. There is no need to disable shadow stack at startup. Shadow stack can only be enabled in a function which will never return. Otherwise, shadow stack will underflow at the function return. 1. GL(dl_x86_feature_1) is set to the CET features which are supported by the processor and are not disabled by the tunable. Only non-zero features in GL(dl_x86_feature_1) should be enabled. After enabling shadow stack with ARCH_SHSTK_ENABLE, ARCH_SHSTK_STATUS is used to check if shadow stack is really enabled. 2. Use ARCH_SHSTK_ENABLE in RTLD_START in dynamic executable. It is safe since RTLD_START never returns. 3. Call arch_prctl (ARCH_SHSTK_ENABLE) from ARCH_SETUP_TLS in static executable. Since the start function using ARCH_SETUP_TLS never returns, it is safe to enable shadow stack in ARCH_SETUP_TLS.
2024-01-01elf: Always provide _dl_get_dl_main_map in libc.aH.J. Lu2-6/+3
Always provide _dl_get_dl_main_map in libc.a. It will be used by x86 to process PT_GNU_PROPERTY segment.
2024-01-01x86/cet: Sync with Linux kernel 6.6 shadow stack interfaceH.J. Lu15-133/+173
Sync with Linux kernel 6.6 shadow stack interface. Since only x86-64 is supported, i386 shadow stack codes are unchanged and CET shouldn't be enabled for i386. 1. When the shadow stack base in TCB is unset, the default shadow stack is in use. Use the current shadow stack pointer as the marker for the default shadow stack. It is used to identify if the current shadow stack is the same as the target shadow stack when switching ucontexts. If yes, INCSSP will be used to unwind shadow stack. Otherwise, shadow stack restore token will be used. 2. Allocate shadow stack with the map_shadow_stack syscall. Since there is no function to explicitly release ucontext, there is no place to release shadow stack allocated by map_shadow_stack in ucontext functions. Such shadow stacks will be leaked. 3. Rename arch_prctl CET commands to ARCH_SHSTK_XXX. 4. Rewrite the CET control functions with the current kernel shadow stack interface. Since CET is no longer enabled by kernel, a separate patch will enable shadow stack during startup.
2023-12-30RISC-V: Add support for dl_runtime_profile (BZ #31151)Aurelien Jarno4-1/+225
Code is mostly inspired from the LoongArch one, which has a similar ABI, with minor changes to support riscv32 and register differences. This fixes elf/tst-sprof-basic. This also fixes elf/tst-audit1, elf/tst-audit2 and elf/tst-audit8 with recent binutils snapshots when --enable-bind-now is used. Resolves: BZ #31151 Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-12-29debug: Add fortify wprintf testsAdhemerval Zanella2-0/+106
Similar to other printf-like ones. It requires to be in a different process so we can change the orientation of stdout. Checked on aarch64, armhf, x86_64, and i686.
2023-12-29debug: Add fortify syslog testsAdhemerval Zanella2-0/+133
It requires to be in a container tests to avoid logging bogus information on the system. The syslog also requires to be checked in a different process because the internal printf call will abort with the internal syslog lock taken (which makes subsequent syslog calls deadlock). Checked on aarch64, armhf, x86_64, and i686. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-12-29debug: Add fortify dprintf testsAdhemerval Zanella1-0/+22
Similar to other printf-like ones. Checked on aarch64, armhf, x86_64, and i686. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-12-29debug: Increase tst-fortify checks for compiler without __va_arg_pack supportAdhemerval Zanella1-5/+1
The fortify wrappers for varargs functions already add fallbacks to builtins calls if __va_arg_pack is not supported. Checked on aarch64, armhf, x86_64, and i686. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-12-29debug: Adapt fortify tests to libsupportAdhemerval Zanella6-40/+39
Checked on aarch64, armhf, x86_64, and i686. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-12-26localedata: yo_NT: remove redundant commentsMike FABIAN1-8/+0
See: https://sourceware.org/pipermail/libc-alpha/2023-December/153538.html
2023-12-26localedata: convert en_AU, en_NZ, mi_NZ, niu_NZ to UTF-8Mike FABIAN4-22/+22
2023-12-26localedata: First day of the week in AU is Monday, LC_TIME in en_NZ is ↵Mike FABIAN2-34/+2
identical to LC_TIME in en_AU then Resolves: BZ # 24877
2023-12-25localedata: convert yo_NG to UTF-8, check that language name in Yoruba ↵Mike FABIAN1-44/+44
agrees with CLDR Related: BZ # 24878
2023-12-22x86-64: Fix the tcb field load for x32 [BZ #31185]H.J. Lu1-2/+2
_dl_tlsdesc_undefweak and _dl_tlsdesc_dynamic access the thread pointer via the tcb field in TCB: _dl_tlsdesc_undefweak: _CET_ENDBR movq 8(%rax), %rax subq %fs:0, %rax ret _dl_tlsdesc_dynamic: ... subq %fs:0, %rax movq -8(%rsp), %rdi ret Since the tcb field in TCB is a pointer, %fs:0 is a 32-bit location, not 64-bit. It should use "sub %fs:0, %RAX_LP" instead. Since _dl_tlsdesc_undefweak returns ptrdiff_t and _dl_make_tlsdesc_dynamic returns void *, RAX_LP is appropriate here for x32 and x86-64. This fixes BZ #31185.
2023-12-22x86-64: Fix the dtv field load for x32 [BZ #31184]H.J. Lu1-1/+1
On x32, I got FAIL: elf/tst-tlsgap $ gdb elf/tst-tlsgap ... open tst-tlsgap-mod1.so Thread 2 "tst-tlsgap" received signal SIGSEGV, Segmentation fault. [Switching to LWP 2268754] _dl_tlsdesc_dynamic () at ../sysdeps/x86_64/dl-tlsdesc.S:108 108 movq (%rsi), %rax (gdb) p/x $rsi $4 = 0xf7dbf9005655fb18 (gdb) This is caused by _dl_tlsdesc_dynamic: _CET_ENDBR /* Preserve call-clobbered registers that we modify. We need two scratch regs anyway. */ movq %rsi, -16(%rsp) movq %fs:DTV_OFFSET, %rsi Since the dtv field in TCB is a pointer, %fs:DTV_OFFSET is a 32-bit location, not 64-bit. Load the dtv field to RSI_LP instead of rsi. This fixes BZ #31184.
2023-12-20nss: Remove unused allocation from get_nscd_addresses in getaddrinfoFlorian Weimer1-1/+0
No bug because this is not visible if glibc is built with optimization. Otherwise this would be a critical resource leak. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-12-20x86/cet: Don't disable CET if not single threadedH.J. Lu1-2/+9
In permissive mode, don't disable IBT nor SHSTK when dlopening a legacy shared library if not single threaded since IBT and SHSTK may be still enabled in other threads. Other threads with IBT or SHSTK enabled will crash when calling functions in the legacy shared library. Instead, an error will be issued.