summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-03-27bump version for 1.0.38 releasev1.0.38Waldemar Brodkorb
2021-02-19fcntl.h: Make F_DUPFD_CLOEXEC if _USE_XOPEN2K8Paul Cercueil
The F_DUPFD_CLOEXEC flag was added in POSIX 2008.09. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2021-02-19string.h: Make strdup() available if _USE_XOPEN2K8Paul Cercueil
The strdup() function is present in POSIX 2008.09. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2021-02-08riscv64: sync ldso relocations with or1k, fixes 5 testsuite errorsWaldemar Brodkorb
2021-01-28use renameat2 syscall, when renameat isn't availableWaldemar Brodkorb
2021-01-27fix umount2 compilation for alpha on Linux 5.xWaldemar Brodkorb
2021-01-27sh: Add 64-bit time types from kernelGeoffrey Le Gourriérec
Building uclibc 1.0.37 for SuperH architecture with linux-headers 5.10.7 fails at libpthread level due to missing time-related data structures, usually defined by the kernel. Define those missing data structures in SuperH-specific kernel_types.h. Context: building for sh4eb-r2d[1] and sh4-r2d[1] boards emulations for QEMU using the buildroot image generation tool. Regarding the issue, a patch[3] was already issued in the kernel some time ago, which aimed to solve precisely this problem. After coming up with a quick and dirty patch for buildroot modifying Linux headers[4], some discussion was sparked on the subject with Linux folks[5]. Some analyzing later, conclusion was that: 1) Previously mentioned patch[4] was fixing the symptom, not the ill 2) SuperH-specific code in uclibc could be patched instead, to solve the problem for other use cases (e.g. building just a toolchain) [1] https://git.buildroot.net/buildroot/tree/configs/qemu_sh4eb_r2d_defconfig?h=2020.02.9 [2] https://git.buildroot.net/buildroot/tree/configs/qemu_sh4_r2d_defconfig?h=2020.02.9 [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc94cf2092c7c1267fa2deb8388d624f50eba808 [4] https://git.buildroot.net/buildroot/commit/?id=742f37de8d0e3797698411dfc6a63bd7e98aafe2 [5] https://patchwork.kernel.org/project/linux-sh/patch/20210123165652.10884-1-geoffrey.legourrierec@gmail.com/ Signed-off-by: Geoffrey Le Gourriérec <geoffrey.legourrierec@gmail.com>
2021-01-08extra/locale: fix gen_wc8bit diagnostic outputMax Filippov
Diagnostic for missing UTF locale is printed to stdout instead of stderr, fix that. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2020-12-24bump to 1.0.37v1.0.37Waldemar Brodkorb
2020-12-24GNU hash style support disable for MIPSWaldemar Brodkorb
2020-12-23stdlib: fix potential UB and integer overflow with huge allocations using ↵Yann Sionneau
malloc-simple allocator Two things are fixed by this commit: 1/ It is wrong to allocate an object of size > PTRDIFF_MAX. It is explained in this thread: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303 2/ There was a possible integer overflow in both malloc() and memalign() implementations of stdlib/malloc-simple. The malloc() integer overflow issue is fixed by the side effect of fixing the PTRDIFF_MAX issue. The memalign() one is fixed by adding a comparison. Signed-off-by: Yann Sionneau <yann@sionneau.net>
2020-11-23libcrypt: add missing errno.h headerYann Sionneau
Fixes: libcrypt/crypt.c:29:15: error: 'EINVAL' undeclared (first use in this function) __set_errno(EINVAL); ^~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-11-13libcrypt: set_errno to something validWaldemar Brodkorb
2020-10-19hasmntopt: better option matchingYann Sionneau
Previous implementation was respecting the man page description of what the function should do. Also the function does not seem to be defined by POSIX. But... to be really useful the function needs to handle option matching and not just substring matching. This is copy pasted from glibc. This fixes issue reported by https://github.com/wbx-github/uclibc-ng/issues/8 that can happen for instance there: https://github.com/frida/glib/blob/master/gio/gunixmounts.c#L622 Signed-off-by: Yann Sionneau <yann@sionneau.net>
2020-10-02bump version to 1.0.36v1.0.36Waldemar Brodkorb
2020-10-02kvx: add support for kvx arch to uClibc-ngYann Sionneau
This commit adds support for Kalray VLIW family (kvx) Kalray kv3 core is embedded in Kalray Coolidge SoC. This core which is the third of the KV family has the following features: 32/64 bits execution mode 6-issue VLIW architecture 64 x 64bits general purpose registers SIMD instructions little-endian In order to build a usable toolchain, build scripts are provided at the following address: https://github.com/kalray/build-scripts. Kalray uses FOSS which is available at https://github.com/kalray This includes Linux kernel, uClibc-ng, gcc, binutils, etc. Signed-off-by: Clément Léger <cleger@kalray.eu> Signed-off-by: Guillaume Thouvenin <gthouvenin@kalray.eu> Signed-off-by: Laurent Thevenoux <lthevenoux@kalray.eu> Signed-off-by: Marc Poulhies <mpoulhies@kalray.eu> Signed-off-by: Marius Gligor <mgligor@kalray.eu> Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix warning due to unused label in NPTLYann Sionneau
Fixes this: In file included from libpthread/nptl/pthread_create.c:48:0: libpthread/nptl/allocatestack.c: In function 'allocate_stack': libpthread/nptl/allocatestack.c:602:6: warning: label 'mprot_error' defined but not used [-Wunused-label] mprot_error: ^~~~~~~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix warning due to relaxed function declaration prototypeYann Sionneau
Fixes this: libintl/libintl.c:81:13: warning: function declaration isn't a prototype [-Wstrict-prototypes] const char *_nl_expand_alias () { return NULL; } ^~~~~~~~~~~~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix warning due to unused variable in strlenYann Sionneau
Fixes this: libc/string/generic/strlen.c: In function 'strlen': libc/string/generic/strlen.c:31:31: warning: variable 'magic_bits' set but not used [-Wunused-but-set-variable] unsigned long int longword, magic_bits, himagic, lomagic; ^~~~~~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix warning about macro redefinitionYann Sionneau
Fixes this: libc/misc/internals/tempname.c: In function 'brain_damaged_fillrand': libc/misc/internals/tempname.c:155:0: warning: "L" redefined #define L ((UINT32_MAX % NUM_LETTERS + 1) % NUM_LETTERS) In file included from ./libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.h:24:0, from ./include/bits/libc-lock.h:35, from ./include/bits/stdio-lock.h:22, from ./include/bits/uClibc_mutex.h:73, from ./include/bits/uClibc_stdio.h:83, from ./include/stdio.h:71, from libc/misc/internals/tempname.c:35: ./libc/sysdeps/linux/kvx/sysdep.h:40:0: note: this is the location of the previous definition # define L(name) $L##name Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix warning about missing const qualifierYann Sionneau
Fixes this: In file included from libc/misc/fnmatch/fnmatch.c:235:0: libc/misc/fnmatch/fnmatch_loop.c: In function 'internal_fnmatch': libc/misc/fnmatch/fnmatch_loop.c:207:21: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] CHAR *p_init = p; ^ libc/misc/fnmatch/fnmatch_loop.c:208:21: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] CHAR *n_init = n; Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-22Fix unused variable warning in dl-startup.cYann Sionneau
SEND_STDERR_DEBUG does nothing if __SUPPORT_LD_DEBUG_EARLY__ is not defined thus causing a warning. Fixes this: In file included from ldso/ldso/ldso.c:86:0: ldso/ldso/dl-startup.c: In function '_dl_start': ldso/ldso/dl-startup.c:313:13: warning: variable 'strtab' set but not used [-Wunused-but-set-variable] char *strtab; ^~~~~~ Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-21Support b64_ntop(), b64_pton() (bsd-compat)Waldemar Brodkorb
Signed-off-by: akater <nuclearspace@gmail.com>
2020-09-15Fix memory corruption due to struct stat fieldYann Sionneau
Kernel stat/stat64 structure and uClibc-ng ones were not in sync regarding the timespec fields. Kernel had them but uClibc did not expose it in some cases. Man page says that stat struct should have timespec fields if: * _POSIX_C_SOURCE is defined to 200809L or greater or * _XOPEN_SOURCE is defined to 700 or greater or * _BSD_SOURCE is defined or * _SVID_SOURCE is defined In the case of buildroot vim build, neither _BSD_SOURCE nor _SVID_SOURCE were defined. Only _POSIX_C_SOURCE and _XOPEN_SOURCE were defined. uClibc-ng header only checked for _BSD_SOURCE and _SVID_SOURCE via __USE_MISC. This patch adds a check to __USE_XOPEN2K8 which is defined if _POSIX_C_SOURCE >= 200809L or _XOPEN_SOURCE >= 700 This for instance fixes a crash at startup of vim (not the busybox one) on aarch64 and all other arch where in kernel STAT_HAVE_NSEC is set and where stat.h in uClibc-ng comes from libc/sysdeps/linux/common-generic/bits Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2020-09-13librt: avoid compilation errorDamien Le Moal
For NOMMU builds, LIBC_CANCEL_ASYNC and LIBC_CANCEL_RESET are not defined. Prevent these macros from being visible by the compiler in clock_nanosleep() by replacing "if (SINGLE_THREAD_P) {" with the pre-compiler directive "#if defined(SINGLE_THREAD_P)". Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2020-09-13utils/getconf: Fix compilation errorDamien Le Moal
In the main() function, all cases of the "switch (specs[i].num)" switch-case are all conditionally defined. Depending on the target environementi, none of them may endup being defined, resulting in the code block before the no-op default case to generate a "warning: statement will never be executed" compilation error. Avoid this by conditionally defining this code block with the macro DO_GETCONF_NAME which is itself defined if any of the switc cases is defined too. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
2020-09-09add MAX_HANDLE_SZWaldemar Brodkorb
2020-09-03fix static builds with gcc 10.xWaldemar Brodkorb
2020-09-02Revert "Fix static linking with GCC-10"Waldemar Brodkorb
This reverts commit 5b58a1ebd89a4f05778441814e81817c82193fa3. This breaks all static builds earlier to gcc 10 :( Bad testing on my side.
2020-08-28bump for release 1.0.35v1.0.35Waldemar Brodkorb
2020-08-25ldso: Fix pointer cast warningYann Sionneau
Fixes the following compilation warning for 64-bit arch with TLS support: CC ldso/libdl/libdl.oS ldso/libdl/libdl.c: In function 'do_dlsym': ldso/libdl/libdl.c:739:59: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] ret = _dl_tls_symaddr ((struct link_map *)sym_ref.tpnt, (Elf32_Addr)ret); ^
2020-08-19Add {name, open}_to_handle_at() implementationPetr Vorel
copied from musl 1.2.1. Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2020-08-17riscv64: add __riscv_flush_icacheWaldemar Brodkorb
Always use the systemcall as uClibc-ng has no vdso support. Tested with libffi and python in qemu-system-riscv64.
2020-08-15sys/random.h include stddef.hWaldemar Brodkorb
Reported-By: akater <nuclearspace@gmail.com>
2020-08-11Fix static linking with GCC-10Lance Fredrickson
Starting with GCC-10 multiple definitions of global variables by will be rejected. https://gcc.gnu.org/gcc-10/porting_to.html This fixes multiple definitions of _dl_pagesize and _dl_tls_static_size while attempting static linking. Of course this only occurs when compiling something that requires these symbols. First patch submission so hopefully all done correctly. thanks, Lance Fredrickson From e0686f7c03ce8e51ccffefeb6365e50311e6dd10 Mon Sep 17 00:00:00 2001 From: lancethepants <lancethepants@gmail.com> Date: Wed, 15 Jul 2020 13:09:26 -0600 Subject: [PATCH] Starting with GCC-10 multiple definitions of global variables by will be rejected. This fixes multiple definitions of _dl_pagesize and _dl_tls_static_size while attempting static linking.
2020-08-11xtensa: add exclusive access supportMax Filippov
Add XCHAL definitions for S32C1I and EXCLUSIVE options to xtensa-config.h, include it in places that implement atomic operations and add implementations with exclusive access option opcodes. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2020-08-11xtensa: relax memory constraint in atomic assemblyMax Filippov
Replace "a" constraints with "+m" to avoid forcing atomic variable address into a register and let the compiler use non-zero offset in load/store opcodes. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2020-07-02Rename __unused struct members to include a namespaceEd Wildgoose
Rename various spare fields in structs to include a namespace This should avoid accidental clashes with uses of the __unused symbol in upstream projects. eg currently it causes a compile error in dhcpcd 8.x due to their re-use of the __unused symbol as a macro This follows the style of glibc which does something equivalent
2020-06-19inet: add sockatmark implementationClement Leger
Import musl C sockatmark implementation into uClibc-ng. Signed-off-by: Clement Leger <cleger@kalray.eu> Acked-by: Yann Sionneau <ysionneau@kalray.eu>
2020-05-17mips: Do not include hi and lo in __SYSCALL_CLOBBERS for R6Romain Naour
From [1] "GCC 10 (PR 91233) won't silently allow registers that are not architecturally available to be present in the clobber list anymore, resulting in build failure for mips*r6 targets in form of: ... .../sysdep.h:146:2: error: the register ‘lo’ cannot be clobbered in ‘asm’ for the current target 146 | __asm__ volatile ( \ | ^~~~~~~ This is because base R6 ISA doesn't define hi and lo registers w/o DSP extension. This patch provides the alternative definitions of __SYSCALL_CLOBBERS for r6 targets that won't include those registers." [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=020b2a97bb15f807c0482f0faee2184ed05bcad8 Signed-off-by: Romain Naour <romain.naour@gmail.com> Cc: Waldemar Brodkorb <wbx@openadk.org>
2020-05-06prepare for release 1.0.34v1.0.34Waldemar Brodkorb
2020-04-27Rules.mak: Fix check_as for recent binutils versionsMarcel Patzlaff
As described in https://bugs.busybox.net/show_bug.cgi?id=12801 the check for '-Wa,--noexecstack' is not working since binutils 2.31.x. This fix adapts the approach already taken with check_ld and uses a temporary file. Further, check_gcc is also adapted to avoid future problems. Signed-off-by: Marcel Patzlaff <m.patzlaff@pilz.de>
2020-04-01statx: make include conditional, fixes non-csky arch buildroot buildsWaldemar Brodkorb
2020-04-01or1k: fix some TLS issuesYann Sionneau
Before this commit tst-tls-at-ctor test would segfault. After it passes. testsuite run before: https://pastebin.com/504JgQXa testsuite run after: https://pastebin.com/d2aNciVt Stafford Horne already fixed it in glibc: * https://github.com/openrisc/or1k-glibc/blob/bcd87396ebe78228645c0731b06c934dfd88855a/sysdeps/or1k/dl-machine.h#L298 * https://github.com/openrisc/or1k-glibc/blob/bcd87396ebe78228645c0731b06c934dfd88855a/sysdeps/or1k/dl-machine.h#L99
2020-04-01statx: make include conditional, fixes non-csky arch buildroot buildsWaldemar Brodkorb
2020-04-01Resolve bug when using unusual MALLOC_ALIGNMENTEyal Itkin
Safe-Linking alignment checks should be done on the user's buffer and not the mchunkptr. The new check adds support for cases in which: MALLOC_ALIGNMENT != 2*(sizeof(size_t)) The default case for both 32 bits and 64 bits was already supported, and this patch adds support for the described irregular case.
2020-02-19malloc: add missing header for some arch (alpha)Waldemar Brodkorb
2020-02-16bump to 1.0.33 for releasev1.0.33Waldemar Brodkorb
2020-02-16Add Safe-Linking to fastbinsEyal Itkin
Safe-Linking is a security mechanism that protects single-linked lists (such as the fastbins) from being tampered by attackers. The mechanism makes use of randomness from ASLR (mmap_base), and when combined with chunk alignment integrity checks, it protects the pointers from being hijacked by an attacker. While Safe-Unlinking protects double-linked lists (such as the small bins), there wasn't any similar protection for attacks against single-linked lists. This solution protects against 3 common attacks: * Partial pointer override: modifies the lower bytes (Little Endian) * Full pointer override: hijacks the pointer to an attacker's location * Unaligned chunks: pointing the list to an unaligned address The design assumes an attacker doesn't know where the heap is located, and uses the ASLR randomness to "sign" the single-linked pointers. We mark the pointer as P and the location in which it is stored as L, and the calculation will be: * PROTECT(P) := (L >> PAGE_SHIFT) XOR (P) * *L = PROTECT(P) This way, the random bits from the address L (which start at the bits in the PAGE_SHIFT position), will be merged with the LSB of the stored protected pointer. This protection layer prevents an attacker from modifying the pointer into a controlled value. An additional check that the chunks are MALLOC_ALIGNed adds an important layer: * Attackers can't point to illegal (unaligned) memory addresses * Attackers must guess correctly the alignment bits On standard 32 bit Linux machines, an attacker will directly fail 7 out of 8 times, and on 64 bit machines it will fail 15 out of 16 times. The proposed solution adds 3-4 asm instructions per malloc()/free() and therefore has only minor performance implications if it has any. A similar protection was added to Chromium's version of TCMalloc in 2013, and according to their documentation the performance overhead was less than 2%. Signed-off-by: Eyal Itkin <eyalit@checkpoint.com>
2020-02-10include/ctype.h: restore __isctype_l definitionMax Filippov
Recent is*_l fix broke uclibc build because removed __isctype_l definition was used in libc/misc/ctype/ctype.c. Restore it. Fixes: d1a3ca7ca566 ("include/ctype.h: drop is*_l macro definitions") Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>