Age | Commit message (Collapse) | Author |
|
Modified config files and crt1.S to support static pie elf generation.
Signed-off-by: linted <linted@users.noreply.github.com>
|
|
default
This patch fixes segfault of all user space processes (including init, which caused a panic) on recent buildroot powerpc32 builds.
The issue has been reported by Romain Naour in this thread: https://mailman.uclibc-ng.org/pipermail/devel/2021-May/002068.html
Recent buildroot toolchain enables secure PLT in powerpc gcc.
The latter will then supply -msecure-plt to gas invocations by default.
Recent buildroot also enables PIE by defaults.
For the secure PLT to work in PIC, the r30 register needs to point to the GOT.
Old "bss plt" was just a one-instruction-wide PLT slot, pointed-to by a R_PPC_JMP_SLOT relocation, which was written on-the-fly to contain a branch instruction to the correct address. It therefore had to stay writable.
New secure PLT only contains read-only code which loads the branch address from the writable GOT.
Note: secure PLT without PIC does not need r30 to be set. Because offset between plt stub code and got is known at link-time. In this case the PLT entry looks like:
1009b3e0 <__uClibc_main@plt>:
1009b3e0: 3d 60 10 0e lis r11,4110
1009b3e4: 81 6b 03 74 lwz r11,884(r11)
1009b3e8: 7d 69 03 a6 mtctr r11
1009b3ec: 4e 80 04 20 bctr
Whereas secure PLT with PIC - offset between plt and got is unknown at link-time - looks like this:
000af800 <00000000.plt_pic32.__uClibc_main>:
af800: 81 7e 03 80 lwz r11,896(r30)
af804: 7d 69 03 a6 mtctr r11
af808: 4e 80 04 20 bctr
af80c: 60 00 00 00 nop
Signed-off-by: Yann Sionneau <yann@sionneau.net>
|
|
Since Linux 3.11, O_TMPFILE allows to create unnamed files that can be
linked later on. It is internally defined as (O_TMPFILE | O_DIRECTORY)
to make it fail on old kernels.
Copying definitions from glibc for O_TMPFILE is not enough to support
O_TMPFILE; The open() wrapper also need to pass the mode when the flag
contains O_TMPFILE, otherwise, it will pass mode 000 which will succeed
but yield unexpected results.
openat() is curiously not affected since it passes the mode
unconditionally..
Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
|
|
The F_DUPFD_CLOEXEC flag was added in POSIX 2008.09.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
|
|
Rename various spare fields in structs to include a namespace
This should avoid accidental clashes with uses of the __unused symbol
in upstream projects. eg currently it causes a compile error in dhcpcd 8.x
due to their re-use of the __unused symbol as a macro
This follows the style of glibc which does something equivalent
|
|
Similar to glibc commit
https://sourceware.org/git/?p=glibc.git;a=commit;h=6bbfc5c09fc5b5e3d4a0cddbbd4e2e457767dae7
we need to handle Linux kernel change, which removed stat64 family from default syscall set.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Waldemar Brodkorb <wbrodkorb@conet.de>
|
|
The return type of syscall() is long so __syscall_error, which is jumped
to by syscall handlers to stash an error number into errno, must return
long too otherwhise it returs 4294967295L instead of -1L. For example,
syscall for x86_64 is defined in libc/sysdeps/linux/x86_64/syscall.S as
syscall:
movq %rdi, %rax /* Syscall number -> rax. */
movq %rsi, %rdi /* shift arg1 - arg5. */
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %r10
movq %r9, %r8
movq 8(%rsp),%r9 /* arg6 is on the stack. */
syscall /* Do the system call. */
cmpq $-4095, %rax /* Check %rax for error. */
jae __syscall_error /* Branch forward if it failed. */
ret /* Return to caller. */
In libc/sysdeps/linux/x86_64/__syscall_error.c, __syscall_error is
defined as
int __syscall_error(void) attribute_hidden;
int __syscall_error(void)
{
register int err_no __asm__ ("%rcx");
__asm__ ("mov %rax, %rcx\n\t"
"neg %rcx");
__set_errno(err_no);
return -1;
}
So __syscall_error returns -1 as a 32-bit int in a 64-bit register, %rax
(0x00000000ffffffff, whose decimal value is decimal 4294967295) and a
test like this always returns false:
if (syscall(number, ...) == -1)
foo();
Fix the error by making __syscall_error return a long, like syscall().
The problem can be circumvented by the caller by coercing the returned
value to int before comparing it to -1:
if ((int) syscall(number, ...) == -1)
foo();
The same problem probably occurs on other 64-bit systems but so far only
x86_64 was tested, so this change must be considered experimental.
Signed-off-by: Carlos Santos <unixmania@gmail.com>
|
|
This patch fixes the incorrect guard by __USE_MISC of struct winsize and
struct termio in powerpc termios header. Current states leads to build
failures if the program defines _XOPEN_SOURCE, but not _DEFAULT_SOURCE
or either _BSD_SOURCE or _SVID_SOURCE. Without any definition,
__USE_MISC will not be defined and neither the struct definitions.
This patch copies the default Linux ioctl-types.h by adjusting only the
character control field (c_cc) size in struct termio.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[Vadim: adopted for uclibc ]
|
|
Sync with GNU C library and consolidate duplicate non
architecture specific defines.
MAP_UNINITIALIZED is only defined to 0x4000000 and used by
the Linux kernel when CONFIG_MMAP_ALLOW_UNINITIALIZED is enabled.
CONFIG_MMAP_ALLOW_UNINITIALIZED is only available for nommu.
See Documentation/nommu-mmap.txt.
|
|
According to standards SVID and SYSV.
Modified lgamma calling in case when 'signgam' variable should not be used.
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
|
|
Remove enum __ptrace_flags along with the only constant it contains,
PTRACE_SEIZE_DEVEL, from Linux's sys/ptrace.h files.
Following GNU C library commit:
60e2846e2633a990bdf474004a373bde54c0bc5f
|
|
|
|
|
|
Sync with GNU C library. Found while trying to compile
linux-rdma to uClibc-ng.
Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
|
|
Follow GNU C Library from c579f48edba88380635ab98cb612030e3ed8691e
and remove the PID caching. These simplifies the architecture specific
assembly code.
The run of the test suite found no regressions, it even solves
some of the test failures for x86/x86_64/sparc.
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Acked-by: Matthew Fortune <Matthew.Fortune@imgtec.com>
Acked-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
|
|
Add a similar fix as in 8dd85e041bdccf630c90e12ea044f55d28da9396.
Reported-By: Steven Seeger <steven.seeger@frontier.com>
|
|
Fixes compilation of uClibc-ng when UCLIBC_HAS_LONG_DOUBLE_MATH is
used.
|
|
Remove powerpc64 bits as we only support powerpc32.
|
|
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
As this is only implemented for a few architecture and not well
tested, just remove it.
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
Remove ppc64 bits and bytes, as we don't support ppc64 and
it makes the code more readable without the dead code.
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
Only alpha, hppa and sparc need non-default value.
|
|
.globl can be used for every architecture so remove the define.
Sync with GNU C library.
|
|
It's even no longer required for non-ported ppc64
architecture. Sync with GNU C library.
This simplify the macros in include/libc-symbols.h.
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Update sys/ptrace.h to latest glibc release for a lot of missing
definitions.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.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>
|
|
* 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>
|
|
The pread64/write64 syscalls have the 64bit register align issue for
all arches. Use this new define so we can merge the powerc/xtensa
versions back into the common code.
SuperH is funky and also allows us to do this.
We should be able to merge the mips version too, but that'll require
someone to take a closer look as the current stuff doesn't look quite
right.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
The reason truncate64 takes 4 args on some arches is that their ABI
requires 64bit values to be aligned on register pair boundaries.
Since this alignment affects more than just truncate64, rename the
define to properly document its purpose. This also allows us to
expand it to the other impacted syscalls (which will be done in a
follow up commit).
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
The name was changed to include a trailing 'D' when it went into the
kernel.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.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>
|
|
Linux 3.4 added __kernel_long_t and __kernel_ulong_t and various
exported header files were updated to use these new types. Add the
definitions for __kernel_long_t and __kernel_ulong_t to the relevant
kernel_types.h headers.
This change was automated with the following scriptlet
git grep --name-only 'typedef.*__kernel_old_dev_t' \
| xargs sed -i '/typedef.*__kernel_old_dev_t/ a\
typedef long\t\t__kernel_long_t;\
typedef unsigned long\t__kernel_ulong_t;'
Whitespace in arm, avr32, hppa, sparc was then manually fixed up.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
--
Here's a cleaned up patch which should get the whitespace right. I'm a
bit iffy about the sparc changes they make sense to me but it's not a
platform I have access to.
I can break this up per arch or per maintainer if requested.
libc/sysdeps/linux/alpha/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/arm/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/avr32/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/bfin/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/c6x/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/cris/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/e1/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/h8300/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/hppa/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/i386/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/ia64/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/m68k/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/microblaze/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/mips/bits/kernel_types.h | 4 ++++
libc/sysdeps/linux/nios2/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/powerpc/bits/kernel_types.h | 4 ++++
libc/sysdeps/linux/sh/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/sh64/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/sparc/bits/kernel_types.h | 4 ++++
libc/sysdeps/linux/v850/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/x86_64/bits/kernel_types.h | 2 ++
libc/sysdeps/linux/xtensa/bits/kernel_types.h | 2 ++
22 files changed, 50 insertions(+)
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
c6x does not need own version at all
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
__vfork is hidden.
__GI_vfork is strong (not weak as it was).
vfork is weak.
e1 can use the generic version.
Note: libc_hidden_def(x) has different meaning in .c and .S files.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Remove all versions, that can be covered by the common one.
Drop incorrectly implemented fallback support, if __NR_fadvise64_64 is not available.
To support 64 bit ppc, move ppc support into common.
Cleanup including headers.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
avoid the possibility to use the wrong bits/local_lim.h
uClibc_local_lim.h fix it be correct for LT
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
|
Make sure we use the new jmpbuf-*.h headers
While there, adapt the offset on microblaze and the _JMPBUF_UNWINDS macro on bfin,
it seems, these were changed in the meantime.
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>
|
|
Linux has provided these functions since the 2.1.x era, so no need to
keep these around. We'd rather find out when things are missing (and
fix that) than fall back to the unsafe hacks.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Some arches got this fix, but many did not. So copy the ifdef logic to
the ones that missed it to fix behavior in linux-2.6+.
URL: https://bugs.busybox.net/show_bug.cgi?id=5258
Reported-by: David Laight <david.laight@aculab.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
Future branch extends stubs with ret_enosys_stub.
Resolve conflicts, and use superset of future and current master.
Adjust posix_fadvise* accordingly.
Upon future merge, pick this master version as the final state.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|