Age | Commit message (Collapse) | Author |
|
It can happen under certain cases that the DSO had refcount 0,
but was already loaded. (NODELETE flag is set, or it is pulled
in via both NEEDED dependency and explicit dlopen()).
Add extra reference count for NODELETE objects, this will
ensure that the reference count never drops below one.
It is improved version of
http://lists.busybox.net/pipermail/uclibc/2013-June/047826.html
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
Previously, DL_OPENED flag was set in libdl only and never used.
Set it centralized in _dl_load_elf_shared_library() & use it in
both ld.so and libdl.
Additionally, rename it to DL_OPENED2 for clarity.
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
This patch is to address a proposal by Waldemar in this thread:
http://mailman.uclibc-ng.org/pipermail/devel/2016-June/001006.html
tst-ethers-line and tst-ethers require /etc/ethers to exist,
otherwise user should create it manually.
Add this info to warning message.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
|
|
When trying to resolve a hostname by getaddrinfo() using some specific
settings, it will always return -EAI_NONAME (Name or service not known).
To reproduce this behavior, you need to request an IPv6 address with the
additional AF_V4MAPPED flag set from an non IPv6 capable hostname. If
you choose a IPv4/IPv6 capable hostname like google.com, everything
works fine.
This patch is more or less a port [1][2] from the glibc and their behavior
for the AF_V4MAPPED flag. To test the bug you can use the following snippet.
---- 8< ----
int ret;
struct addrinfo* result;
struct addrinfo hints;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET6;
hints.ai_flags = AI_V4MAPPED;
ret = getaddrinfo("test.com", NULL, &hints, &result);
printf("getaddrinfo(): %i", ret);
---- 8< ----
[1] https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/posix/getaddrinfo.c;h=925c3c5c71596c02f7e58a0ffcdcaae44eb065c1
[2] https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/posix/getaddrinfo.c;h=28977c2c1acb789660ad47e0d88e42486059c916
Signed-off-by: Alexander Wenzel <alexander.wenzel@qsc.de>
|
|
The 'BLT' instruction checks for *signed* values. So if a3, length
parameter of memset, is negative, then value added to the PC will be
large.
memset(buf, 0xaa, 0xffff0000) triggers the bug.
GDB session without the patch:
"""
$ gdb ./main-buggy-memset.elf -q
Reading symbols from ./main-buggy-memset.elf...done.
(gdb) x/i memset
0x8770 <memset>: mov r3, r0
(gdb) r
Starting program: /root/memset/main-buggy-memset.elf
Program received signal SIGSEGV, Segmentation fault.
0x00048808 in ?? ()
"""
The $pc is outside of the memset function because:
"""
(gdb) x/i $pc
=> 0x87e4 <memset+116>: add pc, pc, r2, lsl #2
(gdb) info reg $r2
r2 0x10007 65543
"""
GDB session with the bug fixed (patch applied):
"""
$ gdb ./main-fixed-memset.elf -q
Reading symbols from ./main-fixed-memset.elf...done.
(gdb) x/i memset
0x8770 <memset>: mov r3, r0
(gdb) r
Starting program: /root/memset/main-fixed-memset.elf
Program received signal SIGSEGV, Segmentation fault.
memset () at libc/string/arm/memset.S:92
92 libc/string/arm/memset.S: No such file or directory.
(gdb) x/i $pc
=> 0x87b0 <memset+64>: stmia r3!, {r1, r12}
(gdb) info reg $r3
r3 0x15000 86016
(gdb) info proc mappings
process 5822
Mapped address spaces:
Start Addr End Addr Size Offset objfile
0x8000 0xb000 0x3000 0x0
/root/memset/main-fixed-memset.elf
0x12000 0x15000 0x3000 0x2000
/root/memset/main-fixed-memset.elf
0xb6fff000 0xb7000000 0x1000 0x0 [sigpage]
0xbefdf000 0xbf000000 0x21000 0x0
0xffff0000 0xffff1000 0x1000 0x0 [vectors]
(gdb) info reg $sp
sp 0x14d78 0x14d78
"""
GDB crashes inside the memset function, on the store instruction. This
time the crash is (as expected) because of a memory access imediately
after the memory region that contains the stack -- the buffer that's
being memset'd is allocated on the stack.
Signed-off-by: Lucian Cojocar <lucian.cojocar@vu.nl>
|
|
Select required features. Fix intendation.
Reported-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
|
|
|
|
Testregex returned 0 even when some sub-tests
inside the testregex failed. Now it returns error
count.
Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
|
|
mmap offset must be a multiple of the page size. It was hardcoded
to 4K, so mmap2 test failed on non-4K page size architectures.
Now we get page size using sysconf(_SC_PAGE_SIZE).
Build and run tests done on nsim arc hs38.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
|
|
Do it by following the trail of the existing commented code, which
implemented it by calling get_phys_pages() and get_avphys_pages().
This patch implements these two functions, which are also glibc
extensions.
Some program/libraries (e.g. libuv) assumes that sysconf(_SC_PHYS_PAGES)
works on linux and never check for -1, thus they report an insane amount
of memory.
Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
|
|
|
|
|
|
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
When a 'hard' error occurs, fwrite reports that all data was written or
buffered even if that is not the case. It should report how much data
was actually written and buffered.
Signed-off-by: Jan Vangorp <jan.vangorp_ext@softathome.com>
|
|
The man page for fopencookie prescribes that custom write functions
should return 0 on error (and should definitely not return a negative
value) [1].
However, the uClibc implementation expects a negative return value in
case of an error (libc/stdio/_WRITE.c). If the write function returns 0
on error, we drop into an infinite loop if the error persists.
This patch wraps the user supplied write function such that a 0 return
value is converted to -1. errno is first set to EAGAIN such that if the
custom write function does not set errno in case of error, this is
treated as a "soft" error.
Custom write functions that cater towards uClibc and _do_ return a
negative value are not affected.
If no custom write function is supplied, set errno to EINVAL such that
this condition is treated as a "hard" error. Previously the behaviour
depended on whether the last error before the write happened to be a "hard"
or a "soft" error.
[1] http://git.kernel.org/cgit/docs/man-pages/man-pages.git/tree/man3/fopencookie.3?id=6c0d0ef0c7a9c4bcf805c6f9e9bc1ef1c3865ea0#n164
Signed-off-by: Jan Vangorp <jan.vangorp_ext@softathome.com>
|
|
Simplify and use generic lowlevellock.
Tested-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
Simplify and use generic lowlevellock.
Tested-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
Simplify and use generic lowlevellock.
Tested-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
Rename mmap2 test as this is a ARM specific test, only
execute on ARM systems. Add more new tests from glibc.
|
|
Nobody should use gcc 3.3 nowadays.
|
|
These files are not used, no regression found while
running the testsuite.
|
|
Fix some gcc warnings while compiling the testsuite.
|
|
See here:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=900056024b75eae8b550d7fee1dec9e71f28344e
Fixes testsuite runs on newer kernels.
|
|
Remove ppc64 bits and bytes, as we don't support ppc64 and
it makes the code more readable without the dead code.
|
|
|
|
lowlevellock.c for arm differs from the generic lowlevellock.c only in
insignificant ways, so can be removed. Follow glibc commit 6d96f5e4c0
Solves __lll_timedlock_wait busy-wait issues described at
http://sourceware.org/bugzilla/show_bug.cgi?id=15119
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
unlocked NORMAL mutex.
Althought, it is undefined behavior, there is no reason for segfault.
Program received signal SIGSEGV, Segmentation fault.
__pthread_unlock (lock=lock@entry=0x804b03c <lock+16>)
at libpthread/linuxthreads.old/spinlock.c:231
231 (&lock->__status, oldstatus, (long)(thr->p_nextlock) & ~1L))
It occurs only on platforms which has HAS_COMPARE_AND_SWAP defined.
Restore glibc commit fbaf6e72d6 "spinlock.c (__pthread_unlock): Don't crash if
called for an untaken mutex." behavior, broken later by commit 4ad1d0cfbf.
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
Currently, targets dependancy list don't include Makefile.in,
this leads to incomplete rebuild after target's compiler/linker
flags was changed.
Use "$(wildcard)" function due to Makefile.in could be absent
in subdirectory.
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
Sync pthread_spin_lock/pthread_spin_trylock with GNU libc as it avoids
any usage of deprecated SWP instruction. This allows to build uClibc-ng
for ARMv8 Cortex-A53 CPU in 32 Bit mode.
|
|
|
|
There exist some problem with the new memcpy/memset functions
imported from GNU libc/newlib. If you have any problem
with the new MIPS optimized assembly try to disable
prefetching support.
Thanks to Rene Nielsen and Matthew Fortune analyzing the
problem so far.
|
|
Both $(CC_FLAG_ASNEEDED) and $(CC_FLAG_NO_ASNEEDED) never become "y",
must check for non-empty strings.
To keep make 3.80 compatibility "$(if" used only.
Fixes: 7da4d1e7 "buildsys: do not use $(and)".
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
Even though by default for ARC uClibc gets compiled with
disabled long-calls user may provide UCLIBC_EXTRA_CFLAGS
with "-mlong-calls". With this option uClibc will be
successfully compiled but later it will fail in runtime
because dynamic loader cannot deal with relocations
at least very early on its start.
In particular it will be seen as call to non-relocated
symbol _dl_parse_dynamic_info() which ends-up as a segfault
like this:
------------------------>8--------------------
potentially unexpected fatal signal 11.
Path: /bin/test
CPU: 0 PID: 63 Comm: test Not tainted 4.5.2 #7
task: 9f13f180 ti: 9f166000 task.ti: 9f166000
[ECR ]: 0x00040000 => Insn could not be fetched
[EFA ]: 0x0000283c
[BLINK ]: 0x2000407c
[ERET ]: 0x283c
@No matching VMA found
[STAT32]: 0x8008009e : IE U
BTA: 0x0000283c SP: 0x5fef5ccc FP: 0x00000000
LPS: 0x20004080 LPE: 0x20004064 LPC: 0x00000000
r00: 0x20006684 r01: 0x5fef5db0 r02: 0x00000000
r03: 0x20000000 r04: 0x80808080 r05: 0x2f2f2f2f
r06: 0x41464d00 r07: 0x00000080 r08: 0x000000dd
r09: 0x00000000 r10: 0x00000073 r11: 0x80808080
r12: 0x2000407c r13: 0x20000000 r14: 0x5fef5e74
r15: 0x000ceb3c r16: 0x5fef5e7c r17: 0x5fef5d44
r18: 0x000ceb0c r19: 0xffffffff r20: 0x000ceb1c
r21: 0x00000000 r22: 0x00000000 r23: 0x000d08a5
r24: 0x00000000 r25: 0x80808080
Segmentation fault
------------------------>8--------------------
Solution to this issue is simple we make sure dynamic
loader never gets compiled with "-mlong-calls" by forcing
"-mno-long-calls" on it.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <akolesov@synopsys.com>
Cc: linux-snps-arc@lists.infradead.org
|
|
This reverts commit fad6c6021feb6c2dd4a3bd5de1113994d4a9b04e.
A fix was applied with a90c9ac641ba4f692f5eec209b82097d93e9b813
|
|
Accidentally, commit 43ef9c6b3 wasn't taken into account.
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
With new binutils supporting DT_RELACOUNT, ldso was crashing as it was
parsing relocs incorrectly.
Apparently that code ran for first time and was never tested.
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
|
|
Commit 9c4fce55a (nptl: remove sigaction, sigprocmask, and sigfillset from
libpthread) removed pt-sigaction.c from the build to fix static build.
However, since the libc sigaction is weak when HAS_THREADS is enabled, static
build is not be affected. Tested for xtensa, x86, MIPS32 targets.
Fixes nptl/tst-signal7.
Moreover, commit 9193a76bb from the 0.9.33 branch has the right version.
Ref.: http://patchwork.ozlabs.org/patch/286084/
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
|
|
Got the working code from https://github.com/jdkoftinoff/mb-linux-msli/,
otherwise SIGILL while using linuxthreads.
|
|
Sync mostly with GNU libc implementation of setjmp/longjmp.
Just generate PIC compatible code, so no difference for static
builds are made. Add sysdep.h with some handy assembly macros
used inside setjmp.S/__longjmp.S.
This unbreaks dynamic linker support, first test suite run
only shows 10 errors, which doesn't look so bad.
|
|
|
|
Linuxthreads.new isn't really useful with the existence
of NPTL/TLS for well supported architectures. There is no
reason to use LT.new for ARM/MIPS or other architectures
supporting NPTL/TLS. It is not available for noMMU architectures
like Blackfin or FR-V. To simplify the live of the few uClibc-ng
developers, LT.new is removed and LT.old is renamed to LT.
LINUXTHREADS_OLD -> UCLIBC_HAS_LINUXTHREADS
|
|
copy file from linuxthreads to be able to compile gdbserver.
|
|
|
|
|
|
Triggers a bug in MIPS code under certain circumstances, which
are unclear at the moment.
|
|
Ported over from glibc mostly without changes.
Lightly tested with mongrel2 in qemu-system-sparc.
|
|
|
|
|