summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads
AgeCommit message (Collapse)Author
2023-01-22Fix for CVE-2022-29503.linted
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>
2022-07-20linuxthread/arm: Unlock ldrex/strex varsion of testandset for __ARM_ARCH >= 7Vladimir Murzin
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>
2022-07-20linuxthreads/arm: fix ldrex/strex loop when built with O0Vladimir Murzin
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>
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>
2018-04-22linuxthreads: implement pthread_condattr_{s,g}etclock()Waldemar Brodkorb
More applications are using pthread_condattr_setclock()/ pthread_condattr_getclock() in their code. Port these two functions from NPTL over to be more compatible.
2018-01-03fdpic: fix ld.so crashingWaldemar Brodkorb
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.
2017-11-19linuxthreads: add dummy for pthread_atforkWaldemar Brodkorb
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.
2017-11-02convert accept4() to use cancel.h macrosWaldemar Brodkorb
2017-06-11remove outdated manpages and README's for ld.so/linuxthreadsWaldemar Brodkorb
2017-04-16or1k: silence gcc warningsWaldemar Brodkorb
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2017-03-20remove RPC implementationWaldemar Brodkorb
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.
2017-01-22nds32: add NPTL/TLS, *context function, libm changes and code cleanupVincent Ren-Wei Chen
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>
2016-11-30NONTLS_INIT_TP is never defined, remove dead codeWaldemar Brodkorb
2016-11-27remove UCLIBC_HAS_LFSWaldemar Brodkorb
2016-11-17libpthread: remove pthread_atfork for noMMU targetRomain Naour
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>
2016-10-24linuxthreads: add back signal.hWaldemar Brodkorb
Somehow this got removed with f1d7505e40654a185843bdc8f1cf1fd00ab55c04. Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-09-26use a single libc and deduplicate threading codeWaldemar Brodkorb
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
2016-09-26linuxthreads: use tkill syscall for raiseWaldemar Brodkorb
Seems better and more stable.
2016-09-19linuxthreads: Fix up pthread.h for XPG7.Leonid Lisovskiy
[ glibc commit d3c7e68655 ] Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
2016-08-16linuxthreads: install libpthread_nonshared.aWaldemar Brodkorb
This is useful to build native gcc on targets supporting Linuxthreads instead of NPTL.
2016-06-30nds32: add support for new architectureWaldemar Brodkorb
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>
2016-06-23libs: install backward compatibility symlinksAlexey Brodkin
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>
2016-05-31linuxthreads.old: Fix segfault when pthread_mutex_unlock() called against ↵Leonid Lisovskiy
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>
2016-05-28linuxthreads: Fix warnings in pthread_tryjoin_np(), pthread_timedjoin_np()Leonid Lisovskiy
Accidentally, commit 43ef9c6b3 wasn't taken into account. Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
2016-05-24microblaze: fix linuxthreads supportWaldemar Brodkorb
Got the working code from https://github.com/jdkoftinoff/mb-linux-msli/, otherwise SIGILL while using linuxthreads.
2016-05-18remove linuxthreads.new, rename linuxthreads.oldWaldemar Brodkorb
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
2016-04-15replace FSF addresses with URLsNikola Forró
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>
2015-12-05remove __UCLIBC_ASM_GLOBAL_DIRECTIVE__Waldemar Brodkorb
.globl can be used for every architecture so remove the define. Sync with GNU C library.
2015-10-09add new architecture support for or1kWaldemar Brodkorb
Information about Openrisc: http://opencores.org/or1k/Main_Page Integrated from: https://github.com/openrisc/uClibc-or1k
2015-04-12remove more of the link_warningsWaldemar Brodkorb
Only the stub warnings left for now.
2015-03-29merge uClibc git masterWaldemar Brodkorb
2015-03-13unistd.h: put getppid under XOPEN2K8Bernhard Reutner-Fischer
Add __LEAF to all __THROW, introduce non-leaf __THROWNL Adjust affected spots accordingly. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-14Revert "resolve merge"Waldemar Brodkorb
This reverts commit 6b6ede3d15f04fe825cfa9f697507457e3640344.
2015-02-14resolve mergeWaldemar Brodkorb
2014-10-03linuxthreads: fix compile error for non-MMUWaldemar Brodkorb
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.
2014-10-03m68k: fix linuxthreads compile for coldfireWaldemar Brodkorb
The tas instruction is not available for most coldfire CPU's. Use bset instead in this case as already used in linuxthreads.old.
2014-09-20linuxthreads: remove unused s390 codeWaldemar Brodkorb
Cleanup linuxthreads by removing unused s390 code. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2014-09-16buildsys: fix IS_IN_lib*Bernhard Reutner-Fischer
define NOT_IN_libc / IS_IN_libxxx appropriately to fix pthread_once Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-04sparc: remove sparc64/sparcv9 codeWaldemar Brodkorb
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>
2013-03-13LT{,.old}: include stddef.h for size_tVineet Gupta
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>
2013-03-07libpthread: Remove useless .cvsignore filesMarkos Chandras
Signed-off-by: Markos Chandras <hwoarang@gentoo.org> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-20not-cancel.h: Use openat if arch does not have the open syscallMarkos Chandras
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-11-18drop support for pre ISO-C compilersMike Frysinger
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>
2012-11-18Replace FSF snail mail address with URLsMike Frysinger
This matches a similar change made to glibc. No functional changes here. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-06-15remove arm specific sysdep.h from linuxthreads newPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15internals.h: mark __pthread_message hiddenPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15linuxthreads: guard *tsd* related stuff correctlyPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15linuxthreads: style updatePeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15linuxthreads: use __UCLIBC_HAS_TLS__ consistentlyPeter S. Mazinger
replace USE_TLS, HAVE___THREAD and USE___THREAD with __UCLIBC_HAS_TLS__ Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>