Age | Commit message (Collapse) | Author |
|
Setting signal handler in the kernel and then updating sighandler[sig]
results in a crash if a signal which handler is being changed from
SIG_DFL to a non-default was pending. Improve the race a little and
update the sighandler[sig] before the sigaction syscall. It doesn't
eliminate the race entirely, but fixes this particular failing case.
E.g. this fixes the 100% reproducible segfault in the busybox hush shell
built with FEATURE_EDITING_WINCH on ssh client's terminal window resize,
but in that case there's one more even bigger issue: busybox calls
sigaction with both old and new signal pointers pointing to the same
structure instance, as a result act->sa_handler after the sigaction
syscall is not what the user requested, but the previous handler.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
Changed linux thread's stack allocation mmap to use new MAP_FIXED_NOREPLACE flag on kernels >4.17.
For older kernels, a check is added to see if requested address matches the address received.
If the addresses don't match, an error is returned and thread creation is aborted.
Signed-off-by: linted <linted@users.noreply.github.com>
|
|
Thomas has repored failure building ARM 32-bit systems for ARMv8 cores
CC libpthread/linuxthreads/mutex.os
/tmp/ccn8SFKU.s: Assembler messages:
/tmp/ccn8SFKU.s:162: Error: swp{b} use is obsoleted for ARMv8 and later
/tmp/ccn8SFKU.s:186: Error: swp{b} use is obsoleted for ARMv8 and later
/tmp/ccn8SFKU.s:203: Error: swp{b} use is obsoleted for ARMv8 and later
/tmp/ccn8SFKU.s:224: Error: swp{b} use is obsoleted for ARMv8 and later
make[1]: *** [Makerules:369: libpthread/linuxthreads/mutex.os] Error 1
This is due to libpthread/linuxthreads/sysdeps/arm/pt-machine.h which
uses the swp instruction that is not allowed on ARMv8.
All __ARM_ARCH >= 7 support ldrex/strex instructions, so unlock
testandset() varaint for them.
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
|
|
O0 build result in the following codegen
00000000 <ldrex>:
0: b480 push {r7}
2: b085 sub sp, #20
4: af00 add r7, sp, #0
6: 6078 str r0, [r7, #4]
8: 687b ldr r3, [r7, #4]
a: e853 3f00 ldrex r3, [r3]
e: 60fb str r3, [r7, #12]
10: 68fb ldr r3, [r7, #12]
12: 4618 mov r0, r3
14: 3714 adds r7, #20
16: 46bd mov sp, r7
18: f85d 7b04 ldr.w r7, [sp], #4
1c: 4770 bx lr
0000001e <strex>:
1e: b480 push {r7}
20: b085 sub sp, #20
22: af00 add r7, sp, #0
24: 6078 str r0, [r7, #4]
26: 6039 str r1, [r7, #0]
28: 687b ldr r3, [r7, #4]
2a: 683a ldr r2, [r7, #0]
2c: e842 3300 strex r3, r3, [r2]
30: 60fb str r3, [r7, #12]
32: 68fb ldr r3, [r7, #12]
34: 4618 mov r0, r3
36: 3714 adds r7, #20
38: 46bd mov sp, r7
3a: f85d 7b04 ldr.w r7, [sp], #4
3e: 4770 bx lr
00000040 <testandset>:
40: b590 push {r4, r7, lr}
42: b083 sub sp, #12
44: af00 add r7, sp, #0
46: 6078 str r0, [r7, #4]
48: 6878 ldr r0, [r7, #4]
4a: f7ff fffe bl 0 <ldrex>
4e: 4603 mov r3, r0
50: 461c mov r4, r3
52: 6879 ldr r1, [r7, #4]
54: 2001 movs r0, #1
56: f7ff fffe bl 1e <strex>
5a: 4603 mov r3, r0
5c: 2b00 cmp r3, #0
5e: d1f3 bne.n 48 <testandset+0x8>
60: 4623 mov r3, r4
62: 4618 mov r0, r3
64: 370c adds r7, #12
66: 46bd mov sp, r7
68: bd90 pop {r4, r7, pc}
ARM ARM suggests that LoadExcl/StoreExcl loops are guaranteed to make
forward progress only if, for any LoadExcl/StoreExcl loop within a
single thread of execution, the software meets all of the following
conditions:
1 Between the Load-Exclusive and the Store-Exclusive, there are no
explicit memory accesses, preloads, direct or indirect System
register writes, address translation instructions, cache or TLB
maintenance instructions, exception generating instructions,
exception returns, or indirect branches.
...
Obviously condition is not met for O0 builds.
O2 build (which is highly likely the most common setting) able to do
the right thing resulting in
00000000 <ldrex>:
0: e850 0f00 ldrex r0, [r0]
4: 4770 bx lr
6: bf00 nop
00000008 <strex>:
8: e841 0000 strex r0, r0, [r1]
c: 4770 bx lr
e: bf00 nop
00000010 <testandset>:
10: 2101 movs r1, #1
12: 4603 mov r3, r0
14: e853 0f00 ldrex r0, [r3]
18: e843 1200 strex r2, r1, [r3]
1c: 2a00 cmp r2, #0
1e: d1f9 bne.n 14 <testandset+0x4>
20: 4770 bx lr
22: bf00 nop
Rather than depending on level of optimisation implement whole
ldrex/strex loop in inline assembly.
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
|
|
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>
|
|
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>
|
|
More applications are using pthread_condattr_setclock()/
pthread_condattr_getclock() in their code. Port these two
functions from NPTL over to be more compatible.
|
|
Newer binutils is creating a section INIT_ARRAY from any .init_array
and .ctors in the code. When ld.so runs initialization functions for
loaded objects with _dl_run_init_array() it crashes on Bfin FDPIC
system. It is trying to execute the function in pthread.c, which is
no longer useful with the combined C library approach.
Gcc -Wl,-M debugging output was very useful to find the reason for
the INIT_ARRAY section.
|
|
For noMMU targets we need a pthread_atfork dummy, otherwise
libraries like libressl using pthread_atfork, but not fork()
for itself, can not be used. But software like curl with
ssl support linking against libressl still work fine on noMMU
targets.
|
|
|
|
|
|
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
|
|
The included RPC implementation is ipv4 only.
Other C library projects have either deprecated the internal
RPC implementation (GNU C Library) or never implemented such
functionality (musl C Library). The latest rpcbind release (0.2.4)
checks for libtirpc and does not allow to be build with uClibc-ng
RPC without patching. The common use case for RPC nowadays is to
use rpcbind together with nfs-utils to provide NFS server or client
support to a system.
The included RPC implementation does create issues with duplicate
symbol failures when statically compiling with RPC enabled.
|
|
This commit includes following features.
1. Support NPTL/TLS
2. Add libm function which is used to handle FP rounding and excpetions
(ex: fclrexcpt,fedisblxcpti,feenablxcpt... )
3. Add *context function for operating user context
(ex: setcontext,getcontext,makecontext... )
4. Change the return flow from signal handler
5. Cleanup of old code
The testsuite only has 2 errors, tst-cpuclock1 and tst-cputimer1,
which are related to timing accuracy. (math and locale tests are disabled)
Signed-off-by: Vincent Ren-Wei Chen <vincentc@andestech.com>
|
|
|
|
|
|
There is not possible to use use fork() on noMMU target, so exporting
pthread_atfork() for such target is useless.
A program using pthread_atfork() will likely fail at runtime due to the
error code returned by this function.
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
|
Somehow this got removed with f1d7505e40654a185843bdc8f1cf1fd00ab55c04.
Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
Similar to musl libc a single libc has many benefits and solves
some open issues with uClibc-ng.
- no pthread_mutex_* weak symbols exported anymore
- applications no longer failing to link when either
-lrt or -lpthread are missing for dynamic and static linking mode
- smaller C library
- slightly better runtime performance
|
|
Seems better and more stable.
|
|
[ glibc commit d3c7e68655 ]
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
|
|
This is useful to build native gcc on targets supporting
Linuxthreads instead of NPTL.
|
|
Add support for Andes Technology NDS32 architecture.
See here http://www.andestech.com/en/index/index.htm for more
informaton. Verification of the port from an older uClibc
port was done on a sponsored AG101p board.
The testsuite only has 5 errors, three are related to
an existing bug in dlclose() with LT.old, also happening
on cris32 and m68k.
Failures to fallocate/posix_fallocate are unresolved.
Thanks to Andes Technology sponsoring the hardware and
being very helpful while doing the uClibc-ng porting.
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
|
|
Simplify the switch from uClibc to uClibc-ng.
Apps already built against uClibc-0.9.x.y require .so.0
libs to present on target which in case of current uClibc-ng is
not the case and those apps could not be run.
This change creates symlinks from .so.1 to .so.0 for
most of other libs in the same way as it was done by
23e96d89b6ab "ldso: install backward compatibility symlink by default"
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Waldemar Brodkorb <wbx@uclibc-ng.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <akolesov@synopsys.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>
|
|
Accidentally, commit 43ef9c6b3 wasn't taken into account.
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.
|
|
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
|
|
License notices in most of the source files refer to an outdated
FSF address. Replace it with URL, like in the rest of the source
files.Signed-off-by: Nikola Forró <nforro@redhat.com>
|
|
.globl can be used for every architecture so remove the define.
Sync with GNU C library.
|
|
Information about Openrisc:
http://opencores.org/or1k/Main_Page
Integrated from:
https://github.com/openrisc/uClibc-or1k
|
|
Only the stub warnings left for now.
|
|
|
|
Add __LEAF to all __THROW, introduce non-leaf __THROWNL
Adjust affected spots accordingly.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
This reverts commit 6b6ede3d15f04fe825cfa9f697507457e3640344.
|
|
|
|
Otherwise you get following linking error, because
of missing functions in libc.a:
undefined reference to `__libc_enable_asynccancel'
Fix by Thorsten Glaser while hacking session.
|
|
The tas instruction is not available for most coldfire CPU's.
Use bset instead in this case as already used in linuxthreads.old.
|
|
Cleanup linuxthreads by removing unused s390 code.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
|
|
define NOT_IN_libc / IS_IN_libxxx appropriately
to fix pthread_once
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
The sparc64/sparcv9 code is incomplete. Furthermore there is
no real embedded hardware for sparc64 available, so better remove
it until someone comes up with a complete port.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
A user application built with -D_POSIX_C_SOURCE=200112L and
#include signal.h, yields following compilation error:
------------------->8-----------------------------
arc-linux-uclibc-gcc -D_POSIX_C_SOURCE=200112L hello.c
In file included from
/opt/INSTALL/lib/gcc/arc-linux-uclibc/4.4.7/../../../../arc-linux-uclibc/sys-include/signal.h:429,
from hello.c:1:
/opt/INSTALL/lib/gcc/arc-linux-uclibc/4.4.7/../../../../arc-linux-uclibc/sys-include/bits/pthreadtypes.h:48:
error: expected specifier-qualifier-list before 'size_t'
------------------->8-----------------------------
The fix is to make sure size_t is explicitly provided to pthreadtype.h
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Markos Chandras <hwoarang@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
This drops __signed, __volatile, and __const. Only the latter was
used in the code base, and for uClibc, not consistently. Much of
the code used plain "const" which meant "__const" was useless.
Really, the point of this is to stay in sync with what glibc did.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
This matches a similar change made to glibc.
No functional changes here.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|