Age | Commit message (Collapse) | Author |
|
WHY: errno in uClibc is not thread safe
HOW: __errno_location and it's sibling __h_errno_location need to be called
via PLT - even from within libc. That way when linked with pthread,
intra-uClibc callers will also use the thread safe version.
This is achieved by removing the GI alias for these functions,
ensuring that they get called normally (via PLT)
Verified with ARC LT.old and ARM cubieboard2 buildroot (LT.old)
NPTL is unaffected by this bug.
------------ History behind this patch ---------------------
This is a long standing bug (https://bugs.busybox.net/show_bug.cgi?id=2089)
Others have tried to fix it in past (alteast Peter Korsgaard's patch in 2010),
but somehow failed to be merged (or were backed out afterwards).
http://lists.uclibc.org/pipermail/uclibc/2010-July/044176.html
One of the causes could be side effect of atleast one more bug related to
pthreads and static link which has now been fixed.
http://lists.uclibc.org/pipermail/uclibc/2013-October/047958.html
I have solved this w/o looking at other pacthes but would like to give
credit to Peter and others for confirming that it makes sense.
Cc: Christian Ruppert <christian.ruppert@abilis.com>
CC: Francois Bedard <Francois.Bedard@synopsys.com>
Cc: Joern Rennecke <joern.rennecke@embecosm.com>
Cc: Jeremy Bennett <jeremy.bennett@embecosm.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: buildroot@busybox.net
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
This patch fixes the rest of the set-but-not-used warnings in the MIPS
code by using attribute_unused and also fixes some conversion warnings
by changing __arch_compare_and_exchange_xxx_[8|16]_int. Assigning __cmp
(int type) to __prev (pointer type) generates a warning. Assigning zero
to each separately avoids this warning without having to add a cast.
Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
This addition allows building uClibc with -mtext-section-literals
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Anton reported:
------------------->8---------------------
Package iperf cannot be built in Buildroot due to following error:
/home/akolesov/env/autobuild/tmp/host/usr/bin/arc-buildroot-linux-uclibc-g++
-Wall -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-pipe -Os --static -o iperf -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -pipe -Os -pthread -DHAVE_CONFIG_H Client.o
Extractor.o Launch.o List.o Listener.o Locale.o PerfSocket.o ReportCSV.o
ReportDefault.o Reporter.o Server.o Settings.o SocketAddr.o gnu_getopt.o
gnu_getopt_long.o main.o service.o sockets.o stdio.o tcp_window_size.o
../compat/libcompat.a
/home/akolesov/env/autobuild/tmp/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/libc.a(vfork.os):
In function `vfork':
(.text+0x0): multiple definition of `vfork'
/home/akolesov/env/autobuild/tmp/host/usr/arc-buildroot-linux-uclibc/sysroot/usr/lib/libpthread.a(ptfork.os):ptfork.c:(.text+0xc0):
first defined here
collect2: error: ld returned 1 exit status
------------------->8---------------------
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <Anton.Kolesov@synopsys.com>
Cc: Francois Bedard <Francois.Bedard@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Uclibc is not building for MIPS N64 because pread is trying to use the
pread/pwrite system calls instead of pread64/pwrite64. This patch fixes
the problem and was tested with LFS enabled and disabled.
Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
The INLINE_SYSCALL, INTERNAL_SYSCALL*, and internal_syscall* macros
are defined for MIPS in both libc/sysdeps/linux/mips/sysdep.h and
libc/sysdeps/linux/mips/bits/syscalls.h. The macros are the same
in both cases except that syscalls.h defines internal_syscalls[567]
the same for N32 and N64 ABIs and has a different definition for O32.
I believe that is correct. The sysdep.h header uses the O32 versions
for N32 and has different definitions for N64. I think that is wrong
and that N32 and N64 should share the same definition (modulo the
type 'long' vs. 'long long' for the arguments. This setup (from
sysdep.h) now agrees with what glibc has.
I am not positive about which header (sysdep.h vs syscalls.h) is
really the right one to have these definitions in but using sysdep.h
seems to work for all my builds.
Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
The special sync_file_range handling is only needed for the O32 ABI
(regardless of whether it is on mips32 or mips64). The N32 (and N64)
ABI's should both use the standard code. This routine was using the
special code for the N32 ABI because that ABI has a word size of 32 bits
and that is wrong. This patch fixes it by checking the ABI used instead
of checking the word size.
Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
cderrno is dead code, comment it out.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
When booting a Linux system with qemu-system-mips64 the execution
of $(pwd) in the ash shell triggers a segmentation fault. Ash uses
setjmp/longjmp for exception handling.
After looking at the glibc implementation,
I found some differences, with this patch tries to resolve.
Now the system boots up fine and no segmentation faults occur.
The global pointer should be restored and the types for the
register values should be wide enough.
See:
http://www.cygwin.com/ml/libc-alpha/2003-03/msg00363.html
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
This patch uses 'attribute_unused' to clean up a number of warnings
messages that are generated when doing a MIPS build. All of the
changes are in MIPS specific files and there are no code changes
other then adding the unused attribute where needed.
Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
The MIPS build is failing when UCLIBC_HAS_LFS is set to "n"
because posix_fadvise64.c is included in the build when it
should not be.
Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
As reported by Kristof Provost.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
The clone based version was introduced by commit
58570fc8e1fd601f15be5758ab95013d56771804
vfork: Use clone if arch does not have the vfork syscall
but the code was made unreachable by the previous commit
0a043c30ee71245dfe7c9d82d654312c5e1f6127
vfork: make all archs consistent
that adds a guard which require either __NR_vfork or __NR_fork
to be set.
Neither will be set on an arch that would need to use the
clone based version.
The double declaration of vfork was also introduced by
the merge of the two above mentioned patches.
The missing ; was present in the original patch.
CC: Markos Chandras <markos.chandras@imgtec.com>
CC: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
CC: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
fork() is broken for MIPS64 N64 ABI. You can check it with a simple
C program statically linked with qemu-mips64 user emulation.
Internally fork() is using the clone system call (at least with NPTL)
with 5 arguments. See ./libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c.
The calling conventions for MIPS N32 and N64 allow to use up to 8 registers
for that. See http://en.wikipedia.org/wiki/Calling_convention#MIPS
This is correctly implemented in libc/sysdeps/linux/mips/bits/syscalls.h,
but not in libc/sysdeps/linux/mips/sysdep.h. fork.c uses the later one.
It seems that fork() works fine for MIPS64 N32 with just using the stack like
with the O32 case. There is a user of INLINE_SYSCALL with 7 arguments in
libc/sysdeps/linux/common/sync_file_range.c for MIPS64 N32, so I decided to
only use the macros for the MIPS64 N64 case. With this patch my uClibc based
Linux system boots up fine in qemu-system-mips64.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Fixes gen_lowlevelrobustlock on thumb2
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
crt1.S -> include sysdep.h -> include sysnum.h
In multistage gcc build, Buildroot happens to build crt1.S before
sysnum.h is generated. So break the above include chain and opencode the
ENTRY/END macros.
Reported-by: Anton Kolesov <akolesov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Adds support for architecture independent actions.
Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Commit ee84b8b400 (linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT)
removed posix_fadvise implementation for xtensa, since xtensa does not
define __NR_fadvise64. Reuse the ARM support code to restore xtensa support.
This commit is based Mike Frysinger's suggested patch.
Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Make __SIGEV_PAD_SIZE to take __WORDSIZE into account for alpha, mips
and ia64 arches.
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Add "__pid_t _tid" member which is used for some packages, like rt-test
for instance, which fails with an error like this one:
src/cyclictest/cyclictest.c:638:9: error: 'union <anonymous>' has no
member named '_tid'
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
In a multi-threaded application where res_init() was called either
directly or implicitly, getaddrinfo() and others failed to add the
DNS search domain to hostnames.
This problem made it not possible to look up a hostname without its
domain appended.
The problem is caused by res_sync_func() overwriting the configuration
read by __open_nameservers() immediately after it is read.
The suggested solutin is to disable res_sync_func() while reading name
server configuration in res_init().
Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
* Add a common ret_ERRVAL definition
* Remove ret_ERRVAL from architectures using the common 'ret'
* Add 'undef' to architectures that need a different return instruction
* Add '#include <common/sysdep.h>' to cris and ia64 that were missing it
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
For this port, I would like to give due credit to:
- Folks from Codito technologies (Sameer, Amit, Kanika, Ramana,...)
who did the very first port
- ARC UK from 2007-2009 (Joern, Irfan, Khurram, Phil...
- Late Brendan Kehoe (may he RIP)
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Joern Rennecke <joern.rennecke@embecosm.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
res_init() was not atomic, which could give undesired behaviour. Now
res_init() is completely locked under one lock and the locking is
removed from __res_vinit().
Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Commit aab4df0fb51660300559f5f29290709db2f7bfee says that the line with
after res_init() function. Commit
7f74de5d4d6d10baafab4b37bb3d472f5c5f0e8c moves the res_init()
function below the line with #undef _res.
This commit moves res_init() back above #undef _res.
Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
The argument names used in the prctl wrapper collide with the internal
variable names in syscall wrapper macros on some architecture. This
currently breaks xtensa. grep for '\b_a[0-9]' indicates that metag and
microblaze might also be affected.
Prefix argument names with '_prctl' to avoid collision.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Reset CSRC-y to prevent pollution from libc/misc/glob/Makefile.in, and fix the
following error messages when UCLIBC_HAS_OBSTACK is disabled:
nm: 'libc/misc/gnu/glob-susv3.os': No such file
nm: 'libc/misc/gnu/glob64-susv3.os': No such file
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
arm call to posix_fadvise simply calls posix_fadvise64
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Add __kernel_long_t and __kernel_ulong_t types for Meta. The rest of
the architectures have been fixed in:
6a76edddaa62ff06f178143b582167734cb55c18
"libc/sysdeps: add __kernel_long and __kernel_ulong"
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
A simple statically linked hello world program was segfaulting for ARC
in linuxthreads.old configuration (although the root casue applies
cross-arch for NPTL as well as linuxthreads.old as described)
The crash was due to branch to NULL in _stdio_init
0001026c <_stdio_init>:
1026c: push_s blink
1026e: st.a r13,[sp,-8]
10272: bl.d 0 --> supposed call to __errno_location
The call was NOT getting patched to libc internal only alias
__GI___errno_location, because it was weak while it's exported cousin,
__errno_location was strong/normal.
arc-linux-uclibc-nm libc/misc/internals/__errno_location.os
00000000 W __GI___errno_location
00000000 T __errno_location
This is exactly opposite to what is expected.
Quoting Peter S. Mazinger, commit 87936cd013041 "errno and *_init cleanup"
| The rule adopted:
| for enabled threads we make in libc the __GI_x() variants strong, x() weak
| and (should) provide another strong x() in libpthread.
| If threads are disabled, even the __GI_x() variants are weak.
With the fix, we see the right settings as below
00000000 T __GI___errno_location
00000000 W __errno_location
Note that problem won't show up in a static busybox build as it references
errno and that seems to elide the issue.
I can confirm the same/more issues with latest ARM buildroot builds w/o
my fix.
(1). linuxthreads.old (broken just like ARC)
arm-linux-nm uclibc-snapshot/libc/misc/internals/__errno_location.os
00000000 W __GI___errno_location
00000000 T __errno_location
But presumably the issue there is NOT catestrophic because ARM linker is
likely smarter and patches a NOP instead of NULL branch.
00008388 <_stdio_init>:
8388: e92d4038 push {r3, r4, r5, lr}
838c: e320f000 nop {0}
(2) NPTL build (exported version is not weak)
00000000 T __GI___errno_location
00000000 T __errno_location
This causes a static link with libpthread and test program
referencing errno to fail to link.
#include <errno.h>
int main(void)
{
printf("%d\n", errno);
}
arm-linux-gcc -static -pthread -o tst tst.o
arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(__errno_location.os):
In function `__errno_location': __errno_location.c:(.text+0x0):
multiple definition of `__errno_location'
arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libpthread.a
(errno_location.os):errno_location.c:(.text+0x0): first defined here
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
atomic_decrement_if_positive() returns the old value of &mem, not the
(sometimes undefined) value of __tmp.
Fixes the uClibc nptl/tst-sem3 test.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Chris Zankel <chris@zankel.net>
|
|
Current code breaks libgcc unwind.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Chris Zankel <chris@zankel.net>
|
|
Before the patch, the query itself was sent via UDP
(the query contained correct protocol ID).
The fix is taken from glibc.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
isfdtype(int fd, int fdtype) check whether a file descriptor fd is
of type fdtype, where the types are defined in stat(2). It is
supported in glibc and BSD, and used by utilities such as acpid.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Previous patch only fixed the build. This patch fixes the behavior at
run-time as well.
It fixes "Value too large for defined data type" messages caused by
fstat syscall wrapper returning -EOVERFLOW.
Signed-off-by: Mischa Jonker <Mischa.Jonker@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
res_mkquery() takes out __resolv_lock to copy _res.options to function local
_res_options on line 4204, but later unsafely accesses _res.options without a
lock, instead of its local copy _res_options, on line 4221. Looks like a
period / underscore typo.
Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
On other architectures exit status of 0x007f is not possible,
they don't have signal 127.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Sync up with the changes from C6X entering the kernel.
Signed-off-by: Luis Machado <lgustavo@codesourcery.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Commit a83ea57a50 introduces code for falling back on sendfile64
when the sendfile syscall is not available. However, as written,
that code leads to sendfile64 being globally hidden in situations
where __NR_sendfile and __USE_LARGEFILE64 are defined. In this case,
the flow executes strong_alias_untyped(sendfile,sendfile64) in
libc/sysdeps/linux/common/sendfile.c and libc_hidden_proto(sendfile64)
in include/sys/sendfile.h, but nowhere does it do libc_hidden_def(sendfile64).
This patch adds the needed libc_hidden_def(sendfile64).
This breaks, for example, xfsprogs on x86_64. Reported by mardok4
in IRC.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Since version 2.5 glibc allows prev to be a NULL pointer in insque, whereas
uClibc segfaults in this case. This fixes the issue and makes insque
initialize q_forw and q_back with NULLs if prev == NULL.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
uclibc is compiled with elf/dwarf and secondly HAVE_CPP_ASM_DEBUGINFO
is not defined so we generate bogus .stab sections needlessly
Some of post processing tools get confused when they see both
dwarf and stab sections
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
Prompted by lkml discussion of a MIPS bug where sending
signal 128 was found to be able to crash the machine :/
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
975bca165c3e10e74c05c0384fd58f45a7025a3c avoided relocations to
_obstack_newchunk used by obstack_vprintf but missed to enable the
corresponding public symbol which is used by the obstack macros.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
This adds a straight forward implementation for obstack_printf and
obstack_vprintf on uClibc's already existing obstack_grow and
vasprintf. It does not attempt to port over glibc's implementation
in terms of _IO_* structs and functions.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
As in timerfd.h, eventfd.h needs arch-specific definition files.
alpha, mips and sparc needs separate file, all the other arch
will use common definition.
This problem is already fixed in glibc.
Also sanitize and provide bits for hppa.
Make sure not to install the new bits/eventfd unless eventfd support is
enabled.
Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|