summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
18 hoursavoid crashes in statical linked binaries when dlopen()HEADmastertinyusbboard .matrixstorm
Even in current (1.0.55) releaes of uClibc-ng there will be 100% reproducible crashes of statically linked binaries (on all kind of platforms), when calling "dlopen(...)" with wrong or non-existing .so-files). #0 0x0000000000404b62 in _dl_load_shared_library () #1 0x0000000000404d49 in do_dlopen () #2 0x0000000000405286 in dlopen () This is caused by missing checks on "_dl_loaded_modules" in "ldso/ldso/dl-elf.c". When "_dl_loaded_modules" is NULL in static linked binaries, it becomes dereferenced and causes an segfault. This patch fixes the issue by adding an extra assignment-check for "_dl_loaded_modules". Signed-off-by: Stephan Baerwolf <stephan@matrixstorm.com>
4 daysNPTL: remove attribute_protected from functionWaldemar Brodkorb
This fixes a linking error with f.e. Kodi. Code behaves like glibc now.
2025-09-22nds32: add missing define for TLSWaldemar Brodkorb
2025-09-21fix verbose output with make 4.4.1Waldemar Brodkorb
2025-09-21libc: kvx: add {get,set,swap,make}context functionsJulian Vetter
Add the obsolescent SUSv3 family of user context manipulating functions for kvx. Signed-off-by: Julian Vetter <jvetter@kalrayinc.com>
2025-09-20Add glibc internal macros for 64 Bit architecturesWaldemar Brodkorb
To satisfy detection of LFS support add these glibc internal macros. Fixes f.e. libselinux compile. Reported-By: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-09-19bump version for 1.0.55 releasev1.0.55Waldemar Brodkorb
2025-09-17aarch64: respect r_addend for TLSDESC relocationsWaldemar Brodkorb
This fixes a long standing bug in the ldso code for aarch64. It fixes the newly problems occuring with python3, where python3 is segfaulting on startup.
2025-09-17aarch64: do not force tls-model in CPU_CFLAGS, this isn't requiredWaldemar Brodkorb
2025-08-16time64: fix *ctl functions in mips32ebyliu
2025-08-15remove uClibc specific gettext_printfWaldemar Brodkorb
Other C libraries like musl/glibc does not define it. Including stdio.h here breaks Grub2 compilation with gcc 14 and above. Thanks to Thomas Petazzoni for analyzing the Grub2 build error. Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-08-10Fix Sysvipc for ARM, AARCH64, RISCV64, KVX and m68kWaldemar Brodkorb
2025-08-10time64: fix *ctl functions in mips32eb/mips64yliu
2025-08-10time64: fixed msgctl/semctl/shmctl result errors for for MIPS32/RISCV32yliu
2025-08-10mips32: Define __IPC_64 according to kernel versionyliu
In later kernel versions, IPC_64 is no longer required in the *ctl function, so it is defined as 0.
2025-08-10mips32: Preventing FORCE_FRAME_POINTER from being optimized awayyliu
In functions that modify sp, debug and unwind information should be located by fp instead of sp, and the conversion is completed through FORCE_FRAME_POINTER. With gcc -Os, FORCE_FRAME_POINTER is optimized away, and the modified sp is still used, causing a segmentation fault in the recvfrom(). Adding a meaningless assembly instruction to use the return value of FORCE_FRAME_POINTER to prevent it from being deleted.
2025-08-07malloc-standard: Fix truncation problem in mallocMarius Melzer
This fixes a bug that can lead to the calculation of a wrong bin `idx`, which in turn leads to a too small chunk of memory being chosen for the number of bytes (`nb`) to be allocated. This leads to a fault (or possibly to memory being written in the wrong location) when using the offset `nb` on top of the chunk for a write operation. malloc() takes the number of bytes to allocate as size_t, but the calculation of the global bin index idx is done via malloc_largebin_index() which takes as parameter and calculates internally with unsigned int. This leads, for large allocations, to a truncation of the value and consequently to the idx being wrongly calculated. idx is an index into the bins which are sorted in ascending order of size range of its including chunks (e.g. 8-16, 16-32, 32-64,...). The malloc() algorithm depends on the idx being calculated such that we begin searching only at a bin whose chunks are always large enough to include the memory size to be allocated (nb). If the idx is too small (as can happen due to the described integer overflow), this code will lead to a write to a wrong address (remainder->bk resp. remainder->fd) (lines from malloc.c): 1086 size = chunksize(victim); 1087 1088 /* We know the first chunk in this bin is big enough to use. */ 1089 assert((unsigned long)(size) >= (unsigned long)(nb)); 1108 remainder = chunk_at_offset(victim, nb); 1111 remainder->bk = remainder->fd = unsorted_chunks(av); The chunk victim should normally be from a bin of a range where each chunk is at least of the size nb. Since it's not, its size may be smaller than nb. With assertions enabled the assertion in 1089 would fail. Without assertions we add nb as an offset to the chunk but since the size of the chunk is a lot smaller than nb, this will point to an address somewhere else. Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
2025-07-25bump version for 1.0.54 releasev1.0.54Waldemar Brodkorb
2025-07-25utimes: force to use 64-bit implementation if available and requested (part II)Peter Seiderer
- fix dependency for libc_hidden_def(utimes) statement, fixes (on ARM-64bit): ./include/libc-symbols.h:431:32: error: '__EI_utimes' aliased to undefined symbol '__GI_utimes' 431 | extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local)))) \ | ^~~~~ ./include/libc-symbols.h:435:41: note: in expansion of macro '__hidden_ver1' 435 | # define hidden_def(name) __hidden_ver1(__GI_##name, name, name); | ^~~~~~~~~~~~~ ./include/libc-symbols.h:503:32: note: in expansion of macro 'hidden_def' 503 | # define libc_hidden_def(name) hidden_def (name) | ^~~~~~~~~~ libc/sysdeps/linux/common/utimes.c:54:1: note: in expansion of macro 'libc_hidden_def' 54 | libc_hidden_def(utimes) | ^~~~~~~~~~~~~~~ - fix dependency for 64-bit implementation, fixes (on ARM-64bit): .../build/busybox-1.37.0/libbb/copy_file.c:433:(.text.copy_file+0x2b0): undefined reference to `utimes' Fixes: 48591e2a2 ("Provide fixups for riscv32.") Fixes: 5aee86ed3 ("utimes: force to use 64-bit implementation if available and requested") Signed-off-by: Peter Seiderer <ps.report@gmx.net>
2025-07-25fix getentropy()Waldemar Brodkorb
Add missing header in commit 19fe75f0ab09c9661ff03738579171624fc35018 Reported-By: Ronald Wahl <ronald.wahl@legrand.com>
2025-07-20bump version for 1.0.53 releasev1.0.53Waldemar Brodkorb
2025-07-19utimes: force to use 64-bit implementation if available and requestedPeter Seiderer
Fixes 64-/32-bit time_t regression on ARM32 (reported for buildroot, see [1] for details). [1] https://gitlab.com/buildroot.org/buildroot/-/issues/128 Fixes: 48591e2a2 ("Provide fixups for riscv32.") Signed-off-by: Peter Seiderer <ps.report@gmx.net>
2025-06-30inet/netdb: fix getnameinfo signatureMarcus Haehnel
According to POSIX the getnameinfo flags parameter is int and not unsigned. Adapt accordingly. Glibc has also fixed this in commit e4ecafe004b3d4270b3a9dace8f970047400ed38 in 2001. Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
2025-06-30openpty: Remove code that has been disabled for more than 20 yearsMarcus Haehnel
The use of ptsname_r instead of the custom pts_name seems to have proven in the field. Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
2025-06-30openpty/forkpty: use const for termios and winsize argumentsMarcus Haehnel
The termios and winsize arguments are const as per the POSIX standard, and also uclibc and musl define them as such. Adapt the uclibc-ng definitions and declarations accordingly to improve compatibility. Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
2025-06-11arc: add missing files for fenv supportWaldemar Brodkorb
2025-04-28csky: add fenv support from glibcWaldemar Brodkorb
2025-04-28sh: add fenv support from glibcWaldemar Brodkorb
2025-04-28arc: add support for fenv from glibcWaldemar Brodkorb
2025-04-27sparc: add fenv support from glibcWaldemar Brodkorb
2025-04-27or1k: add fenv support from glibcWaldemar Brodkorb
2025-04-27m68k: add fenv support from glibcWaldemar Brodkorb
2025-04-27fix build for coldfire with FPUWaldemar Brodkorb
2025-04-24riscv: add fenv support from glibcWaldemar Brodkorb
2025-04-23mips/mips64: add fenv support from glibcWaldemar Brodkorb
2025-04-11frv: fix compile issuesWaldemar Brodkorb
2025-04-11getentropy: guard syscall to getrandomWaldemar Brodkorb
2025-04-07add getentropy(), fix return value of getrandom()Thorsten Glaser
Signed-off-by: Thorsten Glaser <tg@debian.org>
2025-04-06bump version for 1.0.52 releasev1.0.52Waldemar Brodkorb
2025-04-05mount.h: fix MS_{} being seen as an identifier iso a variableThomas Devoogdt
In file included from /home/thomas/external/buildroot2/output/host/mips64-buildroot-linux-uclibc/sysroot/usr/include/linux/fs.h:19, from /home/thomas/external/buildroot2/output/host/mips64-buildroot-linux-uclibc/sysroot/usr/include/linux/btrfs.h:29, from libmount/src/btrfs.c:22: /home/thomas/external/buildroot2/output/host/mips64-buildroot-linux-uclibc/sysroot/usr/include/sys/mount.h:38:3: error: expected identifier before numeric constant 38 | MS_NOSUID = 2, /* Ignore suid and sgid bits. */ | ^~~~~~~~~ Fixes: - https://github.com/util-linux/util-linux/issues/3501 - https://lore.kernel.org/buildroot/CACXRmJioVq7PUwBkCPNj0k-47hrJ_vtgVYtzp+_84ZgimDe9CA@mail.gmail.com/ Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
2025-04-04include/stdlib.h: only expose reallocarray() prototype when implementation ↵Thomas Petazzoni
is available The reallocarray() primitive is only provided by the malloc-standard implementation: neither malloc nor malloc-simple provide it. This causes issues when building for example util-linux on noMMU platforms as: - noMMU platforms can't use malloc-standard, so either malloc or malloc-simple are used, which means reallocarray() is not implemented - util-linux detects the absence of reallocarray(), and provides its own implementation, but the prototype clashes with the prototype in uClibc's <stdlib.h> The combination of which causes the following build failure: In file included from lib/color-names.c:7: ./include/c.h:586:21: error: static declaration of ‘reallocarray’ follows non-static declaration 586 | static inline void *reallocarray(void *ptr, size_t nmemb, size_t size) | ^~~~~~~~~~~~ In file included from ./include/c.h:16: /home/thomas/projets/buildroot/output/host/arm-buildroot-uclinux-uclibcgnueabi/sysroot/usr/include/stdlib.h:898:14: note: previous declaration of ‘reallocarray’ with type ‘void *(void *, size_t, size_t)’ {aka ‘void *(void *, unsigned int, unsigned int)’} 898 | extern void *reallocarray (void *__ptr, size_t __m, size_t __n); | ^~~~~~~~~~~~ make[3]: *** [Makefile:12354: lib/libtcolors_la-color-names.lo] Error 1 To fix this, let's not expose the prototype of reallocarray() if we don't provide the implementation for it. Upstream: https://mailman.openadk.org/mailman3/hyperkitty/list/devel@uclibc-ng.org/thread/BX4ENNZYO23YQJQF5XITW7TETSJHEFK5/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2025-04-01arm: add fenv support from glibcWaldemar Brodkorb
2025-03-31aarch64: add fenv support from glibcWaldemar Brodkorb
2025-03-27Rename variable to fix compilation with GCC 15Jeffrey H. Johnson
Signed-off-by: Jeffrey H. Johnson <trnsz@pobox.com>
2025-03-22spawn.h: fix compiler warning about unused variableFrank Mehnert
Avoid the warning by marking the unused parameter appropriately. Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
2025-03-22stdint.h: don't define __INT64_C / __UINT64_C if already definedFrank Mehnert
Recent Clang versions (Starting from 20) have this macro built-in. The compiler does not warn about this normally because <stdint.h> is a system header. In special cases where stdint.h may be included as normal header it does warn however. Avoid re-defining if a definition already exists. Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
2025-03-22Use __ehdr_start as known zero link address symbolJan Klötzke
The _start symbol does not necessarily have to be on the first page of the application. But the __ehdr_start symbol is always at address zero for PIE binaries. Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
2025-03-22Use __ehdr_start to compute load addressJan Klötzke
So far, uclibc relied on the informal behaviour of GNU ld to put the link address of the _DYNAMIC symbol in the first GOT entry. This does not work with LLVM lld which does not follow this convention. Consequently, glibc has abandoned its usage in favour of using __ehdr_start as magic symbol to infer the load address [1]. Note that this implies that the link time address of __ehdr_start is *always* 0! So far, this seems to be the case on all platforms. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28203 Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
2025-03-22Do not rely on unrelocated GOT entriesJan Klötzke
The LLVM linker seems to be quite clever. When resolving relocations, accesses to the GOT are potentially replaced by PC relative addressing to the requested symbol. This breaks the old method of calculating the load address by using an unrelocated GOT entry value. Instead, rely on __ehdr_start having a link address of zero. Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
2025-03-12m68k: fix alignment in NPTL codeThorsten Glaser
Signed-off-by: Thorsten Glaser <tg@debian.org>