Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
In later kernel versions, IPC_64 is no longer required in the *ctl
function, so it is defined as 0.
|
|
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.
|
|
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>
|
|
- 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>
|
|
Add missing header in commit 19fe75f0ab09c9661ff03738579171624fc35018
Reported-By: Ronald Wahl <ronald.wahl@legrand.com>
|
|
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>
|
|
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Signed-off-by: Thorsten Glaser <tg@debian.org>
|
|
|
|
|
|
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>
|
|
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>
|
|
The _dl_auxvt is also used on non shared builds to access the values of
the vector from getauxval. Putting the definitions in ldso.h leads to
issues because that header also implements fcntl.h functionality making
it incompatible with files that include that header directly.
Factor out the _dl_auxvt related declarations to a new header dl-auxvt.h
and include from ldso.h as well as include it directly from
__uClibc_main.c to make the definitions available.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Commit 227b7c825b6c79479f7222be03e83991b927da26 introduced a dependency
on _dl_auxvt but missed to include the header defining the symbol.
Include the ldso.h header that defines this and safeguard other parts of
that header that do not play nice if fcntl.h has already been included.
The latter is the case only for __uClibc_main.c.
Reviewed-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Previously the getauxval implementation was limited to the auxiliary
vector entries cached in _dl_auxvt. To also support entries outside of
that cached subset, store the start address of the auxiliary vector,
and if an uncached entry type is encountered search the entire auxiliary
vector.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
While for dynamic linking the _dl_auxvt array is provided in
dl-startup.c as part of the ldso, is was undefined for statically
linked binaries. This resulted in a corresponding linker error if
a statically linked program used getauxval.
To provide _dl_auxvt also for statically linked binaries, a definition
of _dl_auxvt is added to dl-support.c and initialized by _dl_aux_init().
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
In a .p2align directive, the maximum number of bytes to skip shall be at
most the intended alignment minus 1. Certain assemblers warn otherwise:
spn.S:97:14: warning: maximum bytes expression exceeds alignment
and has no effect
.p2align 3,,8
^
Change-Id: I5ad48f6f3c3036d8d33d3710ed8d5b5a35bf1fea
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
If gethostent_r fails, the h_errnop error code should be set.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Clang-19 defines NAN in <float.h>. Check if NAN is already defined to
prevent a compiler warning.
Change-Id: I29ebcb2a7a0c1eade46a73074a1701ea67869128
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
|
|
It is undefined behavior to compare two pointers belonging to different
objects. This includes the case where the addition overflows. Clang-20
seems to follow this rule more eagerly and optimizes away the old test.
Fix the test by performing the addition on uintptr_t values rather than
on on char pointers.
See also https://github.com/llvm/llvm-project/issues/121909.
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
This variable is used either if __UCLIBC_HAS_FLOATS__ is defined or if
__UCLIBC_HAS_GLIBC_DIGIT_GROUPING__ is defined. Instead of adding more
complicated #ifdef magic, just mark this variable as possibly unused to
satisfy the compiler.
Signed-off-by: marcus.haehnel@kernkonzept.com
|
|
|
|
Neither glibc nor musl use __GNU macro to hide getrandom.
While there sync with glibc and add GRND_INSECURE flag.
|
|
|
|
|
|
d0c8c185b439187b12644457bb2aa0326f25aaf7 was not complete, add
missing architectures.
|
|
|
|
While building software that sets _POSIX_C_SOURCE=200809L and uses
stat.st_mtim for ARM, it was noticed that st_mtim was not defined.
This seems to be because common/bits/stat.h was picked up, which does
not take __USE_XOPEN2K8 as a reason to enable st_mtim and related
fields. This appears to be an oversight, and porting the check from
common-generic/bits/stat.h to other architectures does indeed fix the
build issue.
This patch is based on commit 50bd6d06e ("Fix memory corruption due to
struct stat field").
Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
|
|
- Fallback to __NR_stat syscall in ld.so if we use 4.x kernel headers.
4.x kernel doesn't support 64-bit time so we can use old syscall
- Add preprocessor conditions to have fstat64 and fstatat64 in libc
with old kernel headers
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
|
|
ARMv8 has particular restrictions which coprocessor can be used and as
such these instructions, which were likely used for backwards
compatibility purposes, cannot be used on ARMv8. We solve this by
checking for ARMv8 and then using the corresponding mnemonics which were
placed in comments alongside the instructions causing issues.
Fixes the following errors:
.../setjmp.S:59:6: error: invalid operand for instruction
stc p11, cr8, [r12], #68
^
.../setjmp.S:62:6: error: invalid operand for instruction
mrc p10, 7, r2, cr1, cr0, 0
^
.../__longjmp.S:69:6: error: invalid operand for instruction
ldc p11, cr8, [r12], #68
^
.../__longjmp.S:73:6: error: invalid operand for instruction
mcr p10, 7, r1, cr1, cr0, 0
^
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
Add casts where necessary to convince clang that the promotion of float
to double is intentional.
Co-authored-by: Sven Linker <sven.linker@kernkonzept.com>
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
|
|
iconv_close() accepts iconv_t type (which is void *) and passes
it to free() which accepts void *. However, GCC 14 raises a
-Wint-conversion warning if it is not casted to void * because
GCC cannot unwind typedef of iconv_t.
Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
|
|
See here for details:
https://github.com/wbx-github/uclibc-ng/issues/15
|
|
This change implements Xtensa FDPIC ABI as specified in the first
version of the following document:
https://github.com/jcmvbkbc/xtensa-abi/blob/master/fdpic-xtensa.txt
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|