Age | Commit message (Collapse) | Author |
|
Commit 95e38b37 ("add support for systems without legacy setrlimit/getrlimit
syscalls") has added use of the prlimit64 syscall in getrlimit and setrlimit
functions. This change causes memory corruption on getrlimit call for 32-bit
CPUs like ARC, as ARC doesn't have ugetrlimit syscall and uses prlimit64.
Also, setrlimit has been broken by prlimit64 call on 32-bit CPUs like, i386,
ARM, ARC.
For the prlimit64 syscall the kernel expects an rlimit struct with 64-bit fields,
but on 32-bit CPUs without _FILE_OFFSET_BITS=64 the struct rlimit has 32-bit
fields.
Add safe implementations of getrlimit, setrlimit, prlimit for 32-bit CPUs with a
local struct rlimit64 variable for use in the prlimit64 syscall.
For 64-bit CPUs and configurations with _FILE_OFFSET_BITS=64 use
getrlimit, setrlimit, prlimit as aliases to getrlimit64, setrlimit64 and
prlimit64. Add a new function prlimit64.
Tested on aarch64, arm, i386, arc.
Fixes: 95e38b37 ("add support for systems without legacy setrlimit/getrlimit syscalls")
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
|
|
|
|
Signed-off-by: Evgeniy Manachkin <sfstudio@wi-cat.ru>
|
|
|
|
New ARCv3 ISA includes both 64-bit and 32-bit CPU family.
This patch adds support for 32-bit ARCv3 HS5x processors.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
Add missing ARCv2 check in MATCH_MACHINE macro.
Update comment for EM_ARCV2 define.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
|
|
See the C11 standard 7.2 §3
The definition is copied from glibc.
Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
|
|
This borrows getloadavg.c from musl.
getloadavg pops up often. Recently llvm and rust are dependent on it.
glibc and musl have it and no-one actually checks if it's available in your libc.
It's just become way easier to add it in uclibc-ng rather than patch everything else.
Signed-off-by: Lance Fredrickson <lancethepants@gmail.com>
|
|
|
|
|
|
- use the provided __res_state() method instead of direct access
to struct __res_state pointer &_res/*__resp
- change the __UCLIBC_HAS_TLS__ protected __res_state() implementation
to the one where the comment 'When threaded, _res may be a per-thread
variable.' indicates this should be used with threads/TLS enabled
Fixes the following segfaults with buildroot raspberrypi3_64_defconfig
(uclibc, -Os, Note: runs fine using the raspberrypi3_defconfig):
$ /usr/sbin/ntpd -n -d
1970-01-01T00:01:49 ntpd[249]: INIT: ntpd ntpsec-1.2.0 2021-11-03T20:39:50Z: Starting
1970-01-01T00:01:49 ntpd[249]: INIT: Command line: /usr/sbin/ntpd -n -d
1970-01-01T00:01:49 ntpd[249]: INIT: precision = 7.240 usec (-17)
1970-01-01T00:01:49 ntpd[249]: INIT: successfully locked into RAM
1970-01-01T00:01:49 ntpd[249]: CONFIG: readconfig: parsing file: /etc/ntp.conf
1970-01-01T00:01:49 ntpd[249]: CONFIG: restrict nopeer ignored
1970-01-01T00:01:49 ntpd[249]: INIT: Using SO_TIMESTAMPNS
1970-01-01T00:01:49 ntpd[249]: IO: Listen and drop on 0 v6wildcard [::]:123
1970-01-01T00:01:49 ntpd[249]: IO: Listen and drop on 1 v4wildcard 0.0.0.0:123
1970-01-01T00:01:49 ntpd[249]: IO: Listen normally on 2 lo 127.0.0.1:123
1970-01-01T00:01:49 ntpd[249]: IO: Listen normally on 3 eth0 172.16.0.30:123
1970-01-01T00:01:49 ntpd[249]: IO: Listen normally on 4 lo [::1]:123
1970-01-01T00:01:49 ntpd[249]: IO: Listen normally on 5 eth0 [fe80::ba27:ebff:fea6:340%2]:123
1970-01-01T00:01:49 ntpd[249]: IO: Listening on routing socket on fd #22 for interface updates
1970-01-01T00:01:50 ntpd[249]: SYNC: Found 10 servers, suggest minsane at least 3
1970-01-01T00:01:50 ntpd[249]: INIT: MRU 10922 entries, 13 hash bits, 65536 bytes
1970-01-01T00:01:50 ntpd[249]: statistics directory /var/NTP/ does not exist or is unwriteable, error No such file or directory
1970-01-01T00:01:51 ntpd[249]: DNS: dns_probe: 0.pool.ntp.org, cast_flags:8, flags:101
Segmentation fault (core dumped)
$ ./host/bin/aarch64-buildroot-linux-uclibc-gdb ./build/ntpsec-1_2_0/build/main/ntpd/ntpd core
Core was generated by `/usr/sbin/ntpd -n -d'.
Program terminated with signal SIGSEGV, Segmentation fault.
(gdb) where
#0 0x0000007f8ff1f150 in res_sync_func () at libc/inet/resolv.c:3356
#1 0x0000007f8ff1c468 in __open_nameservers () at libc/inet/resolv.c:949
#2 0x0000007f8ff1b498 in __dns_lookup (name=0x55943c67f0 "0.pool.ntp.org",
type=1, outpacket=0x7f8fe91c48, a=0x7f8fe91c08) at libc/inet/resolv.c:1134
#3 0x0000007f8ff1d744 in __GI_gethostbyname_r (
name=0x55943c67f0 "0.pool.ntp.org", result_buf=0x7f8fe92628,
buf=0x7f8fe91d90 "", buflen=992, result=0x7f8fe92670,
h_errnop=0x7f8fe92668) at libc/inet/resolv.c:1966
#4 0x0000007f8ff1d9a0 in __GI_gethostbyname2_r (
name=0x55943c67f0 "0.pool.ntp.org", family=2, result_buf=0x7f8fe92628,
buf=0x7f8fe91d70 "0.pool.ntp.org", buflen=1024, result=0x7f8fe92670,
h_errnop=0x7f8fe92668) at libc/inet/resolv.c:2065
#5 0x0000007f8ff16924 in gaih_inet (name=0x55943c67f0 "0.pool.ntp.org",
service=0x7f8fe92828, req=0x7f8fe92890, pai=0x7f8fe92838)
at libc/inet/getaddrinfo.c:596
#6 0x0000007f8ff17624 in __GI_getaddrinfo (
name=0x55943c67f0 "0.pool.ntp.org",
service=0x5582eb8acd "\377H\213D$\bL\211\367H\213\260\270",
hints=0x7f8fe92890, pai=0x5582ee1bf8) at libc/inet/getaddrinfo.c:957
#7 0x0000005582ea60f4 in _start ()
(gdb) p _res
$1 = {options = 0, nsaddr_list = {{sin_family = 0, sin_port = 0, sin_addr = {
s_addr = 0}, sin_zero = "\000\000\000\000\000\000\000"}, {
sin_family = 0, sin_port = 0, sin_addr = {s_addr = 0},
sin_zero = "\000\000\000\000\000\000\000"}, {sin_family = 0,
sin_port = 0, sin_addr = {s_addr = 0},
sin_zero = "\000\000\000\000\000\000\000"}}, dnsrch = {0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0}, nscount = 0 '\000', ndots = 0 '\000',
retrans = 0 '\000', retry = 0 '\000', defdname = '\000' <repeats 255 times>,
nsort = 0 '\000', pfcode = 0, id = 0, res_h_errno = 0, sort_list = {{addr = {
s_addr = 0}, mask = 0}, {addr = {s_addr = 0}, mask = 0}, {addr = {
s_addr = 0}, mask = 0}, {addr = {s_addr = 0}, mask = 0}, {addr = {
s_addr = 0}, mask = 0}, {addr = {s_addr = 0}, mask = 0}, {addr = {
s_addr = 0}, mask = 0}, {addr = {s_addr = 0}, mask = 0}, {addr = {
s_addr = 0}, mask = 0}, {addr = {s_addr = 0}, mask = 0}}, _u = {
_ext = {nsaddrs = {0x0, 0x0, 0x0}, nscount = 0 '\000', nstimes = {0, 0,
0}, nssocks = {0, 0, 0}, nscount6 = 0, nsinit = 0}}}
(gdb) p &_res
$2 = (struct __res_state *) 0x7f8ff8fd98 <_res>
(gdb) p rp
$3 = (struct __res_state *) 0x7fffffffff
And the following uclibc code at libc/inet/resolv.c:3356:
3345 static void res_sync_func(void)
3346 {
3347 struct __res_state *rp = &(_res);
3348 int n;
3349
3350 /* If we didn't get malloc failure earlier... */
3351 if (__nameserver != (void*) &__local_nameserver) {
3352 /* TODO:
3353 * if (__nameservers < rp->nscount) - try to grow __nameserver[]?
3354 */
3355 #ifdef __UCLIBC_HAS_IPV6__
3356 if (__nameservers > rp->_u._ext.nscount)
3357 __nameservers = rp->_u._ext.nscount;
3358 n = __nameservers;
The special thing about ntpsec is the DNS lookup in an extra thread
and/or the call to res_init(), see ntpsec-1_2_0/ntpd/ntp_dns.c:
69 msyslog(LOG_INFO, "DNS: dns_probe: %s, cast_flags:%x, flags:%x%s",
70 hostname, pp->cast_flags, pp->cfg.flags, busy);
71 if (NULL != active) /* normally redundant */
72 return false;
73
74 active = pp;
75
76 sigfillset(&block_mask);
77 pthread_sigmask(SIG_BLOCK, &block_mask, &saved_sig_mask);
78 rc = pthread_create(&worker, NULL, dns_lookup, pp);
and
165 static void* dns_lookup(void* arg)
166 {
167 struct peer *pp = (struct peer *) arg;
168 struct addrinfo hints;
169
170 #ifdef HAVE_SECCOMP_H
171 setup_SIGSYS_trap(); /* enable trap for this thread */
172 #endif
173
174 #ifdef HAVE_RES_INIT
175 /* Reload DNS servers from /etc/resolv.conf in case DHCP has updated it.
176 * We only need to do this occasionally, but it's not expensive
177 * and simpler to do it every time than it is to figure out when
178 * to do it.
179 * This res_init() covers NTS too.
180 */
181 res_init();
182 #endif
183
184 if (pp->cfg.flags & FLAG_NTS) {
185 #ifndef DISABLE_NTS
186 nts_probe(pp);
187 #endif
188 } else {
189 ZERO(hints);
190 hints.ai_protocol = IPPROTO_UDP;
191 hints.ai_socktype = SOCK_DGRAM;
192 hints.ai_family = AF(&pp->srcadr);
193 gai_rc = getaddrinfo(pp->hostname, NTP_PORTA, &hints, &answer);
194 }
$ /usr/lib/uclibc-ng-test/test/inet/tst-res
Segmentation fault (core dumped)
$ ./host/bin/aarch64-buildroot-linux-uclibc-gdb ./build/uclibc-ng-test-0844445e7358eb10e716155b55b0fb23e88d644a/test/inet/tst-res core
Core was generated by `/usr/lib/uclibc-ng-test/test/inet/tst-res'.
Program terminated with signal SIGSEGV, Segmentation fault.
(gdb) where
#0 __GI___res_init () at libc/inet/resolv.c:3514
#1 0x0000005591e507e4 in main (argc=<optimized out>, argv=<optimized out>)
at tst-res.c:20
First reported here:
https://lore.kernel.org/buildroot/20211028230131.5f50d6e7@gmx.net/
https://www.mail-archive.com/devel@uclibc-ng.org/msg01085.html
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
|
|
With new compiler (gcc >= 9 ?) building uClibc-ng now gives this sort of warnings:
./include/libc-symbols.h:426:25: warning: '__EI_localeconv' specifies less restrictive attribute than its target 'localeconv': 'nothrow' [-Wmissing-attributes]
426 | extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local))))
| ^~~~~
./include/libc-symbols.h:429:29: note: in expansion of macro '__hidden_ver1'
429 | # define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
| ^~~~~~~~~~~~~
./include/libc-symbols.h:497:32: note: in expansion of macro 'hidden_def'
497 | # define libc_hidden_def(name) hidden_def (name)
| ^~~~~~~~~~
libc/misc/locale/locale.c:306:1: note: in expansion of macro 'libc_hidden_def'
306 | libc_hidden_def(localeconv)
| ^~~~~~~~~~~~~~~
In file included from libc/misc/locale/localeconv.c:8:
libc/misc/locale/locale.c:261:15: note: '__EI_localeconv' target declared here
261 | struct lconv *localeconv(void)
| ^~~~~~~~~~
The fix is mostly being backported/adapted from glibc.
|
|
The trigger for this resync was ADDR_NO_RANDOMIZE, which was not
defined in uClibc-ng, but is used for example by the uftrace project.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
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 strdup() function is present in POSIX 2008.09.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
|
|
This commit adds support for Kalray VLIW family (kvx)
Kalray kv3 core is embedded in Kalray Coolidge SoC. This core which is the
third of the KV family has the following features:
32/64 bits execution mode
6-issue VLIW architecture
64 x 64bits general purpose registers
SIMD instructions
little-endian
In order to build a usable toolchain, build scripts are provided at the
following address: https://github.com/kalray/build-scripts.
Kalray uses FOSS which is available at https://github.com/kalray
This includes Linux kernel, uClibc-ng, gcc, binutils, etc.
Signed-off-by: Clément Léger <cleger@kalray.eu>
Signed-off-by: Guillaume Thouvenin <gthouvenin@kalray.eu>
Signed-off-by: Laurent Thevenoux <lthevenoux@kalray.eu>
Signed-off-by: Marc Poulhies <mpoulhies@kalray.eu>
Signed-off-by: Marius Gligor <mgligor@kalray.eu>
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
Signed-off-by: akater <nuclearspace@gmail.com>
|
|
|
|
copied from musl 1.2.1.
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
|
Import musl C sockatmark implementation into uClibc-ng.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Acked-by: Yann Sionneau <ysionneau@kalray.eu>
|
|
|
|
Recent is*_l fix broke uclibc build because removed __isctype_l
definition was used in libc/misc/ctype/ctype.c. Restore it.
Fixes: d1a3ca7ca566 ("include/ctype.h: drop is*_l macro definitions")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
ctype locale-specific macro definitions are broken because they result
in dereference of pointer to structure of incomplete type.
Drop these macros since they are optional and let applications use
functions with the same names.
This change fixes parted-3.3 build with uClibc-ng:
http://autobuild.buildroot.net/results/b7ba1210d5aa184b133f0171da621d2b0083ec39/build-end.log
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
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>
|
|
|
|
|
|
preadv/pwritev don't provide separate version for 64-bit wide off_t,
and default to 32-bit wide off_t, which results in a mismatch between
declaration and definition for user programs built with
-D_FILE_OFFSET_BITS=64.
Make offset argument of both functions __off64_t.
This fixes test misc/tst-preadvwritev on xtensa.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
|
Support EM_CSKY 252 elf format.
Changelog:
Increase EM_NUM to 253
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Signed-off-by: Mao Han <han_mao@c-sky.com>
|
|
Add FDPIC dynamic relocations support, similar to what other FDPIC
targets do.
Lazy binding is implemented in a folllow-up patch.
Disable the SEND* macros because they involve relocations to
access constant strings that are unsupported by the existing
arm version.
Define DL_START, START, ARCH_NEEDS_BOOTSTRAP_RELOCS,
DL_CHECK_LIB_TYPE similarly to what other FDPIC targets do.
Define raise() because _dl_find_hash references __aeabi_uidivmod,
which uses __aeabi_idiv0 which in turn references raise.
* include/elf.h (R_ARM_FUNCDESC): Define.
(R_ARM_FUNCDESC_VALUE): Define.
* ldso/include/dl-string.h (SEND_STDERR, SEND_ADDRESS_STDERR)
(SEND_NUMBER_STDERR): Define empty for __FDPIC__.
* ldso/ldso/arm/dl-inlines.h: New file.
* ldso/ldso/arm/dl-startup.h (PERFORM_BOOTSTRAP_RELOC): Fix type
of load_addr. Fix handling of R_ARM_RELATIVE, add support for
R_ARM_FUNCDESC_VALUE.
(DL_START, START): Define for __FDPIC__.
(raise): Define.
* ldso/ldso/arm/dl-sysdep.h (ARCH_NEEDS_BOOTSTRAP_RELOCS): Define.
(DL_CHECK_LIB_TYPE): Define.
(elf_machine_type_class): Take into account FDPIC related
relocations.
(elf_machine_load_address): Support __FDPIC__.
(elf_machine_relative): Likewise.
* ldso/ldso/arm/elfinterp.c (_dl_linux_resolver): Dummy support
for __FDPIC__, implemented in a later patch.
(_dl_do_reloc): Fix reloc_adr computation for __FDPIC__, fix
handling of local symbols. Fix handling of R_ARM_RELATIVE, add
support for R_ARM_FUNCDESC_VALUE, R_ARM_FUNCDESC.
* ldso/ldso/arm/resolve.S: Make _dl_linux_resolve hidden.
* ldso/ldso/fdpic/dl-inlines.h (htab_delete): Declare.
* libc/sysdeps/linux/arm/bits/elf-fdpic.h: New file, similar to bfin's.
* libc/sysdeps/linux/arm/crtreloc.c: Likewise.
* libc/sysdeps/linux/arm/find_exidx.c (__dl_addr_in_loadaddr) Define.
(find_exidx_callback): Support __FDPIC__.
Signed-off-by: Mickaël Guêné <mickael.guene@st.com>
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
|
|
Like for other FDPIC targets, add defined(__FDPIC__) where needed.
* include/link.h: Include bits/elf-fdpic.h if __FDPIC__ is defined.
(link_map): Use elf32_fdpic_loadaddr if __FDPIC__ is defined.
(dl_phdr_info): Likewise.
* ldso/include/dl-elf.h (__dl_parse_dynamic_info): Support
__FDPIC__.
* ldso/include/dl-hash.h (elf_resolve): Add funcdesc_ht field if
__FDPIC__ is defined.
* ldso/ldso/dl-hash.c (_dl_find_hash): Support __FDPIC__.
* libc/misc/elf/dl-iterate-phdr.c (dl_iterate_phdr): Support __FDPIC__.
Signed-off-by: Mickaël Guêné <mickael.guene@st.com>
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
|
|
|
|
|
|
|
|
Reported-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
|
|
Under Fedora 27 there is a problem with the existing ld check.
Binutils ld segfaults. Add a glibc compat macro to complete
the build on Fedora.
Signed-off-by: Sven Anders <anders@anduras.de>
|
|
|
|
|
|
OpenBSD arc4random is using chacha20 cipher algorithm for
a long time. This copy is still based on deprecated rc4
cipher algorithm. We could either update the arc4random.c
or drop it. Drop it. Users should better use libbsd when
using arc4random interface. Musl/glibc does not have arc4random
either.
|
|
Add NT_GNU_BUILD_ID and other defines to allow applications
using it to successfully compile. (f.e. firefox)
|
|
Port over NPTL/TLS support from GNU C Library.
In the first step only the slower syscall is used for TLS
access. The uClibc-ng testsuite shows 79 errors, so their
is room for bugfixes and improvements.
|
|
Follow the steps to build c-sky uclibc linux system:
1. git clone https://github.com/c-sky/buildroot.git
2. cd buildroot
3. make qemu_csky_ck810_uclibc_defconfig
4. make
Follow the buildroot/board/qemu/csky/readme.txt to run.
This buildroot toolchain is pre-build, But you can rebuild
the c-sky uclibc-ng alone and install it to the buildroot
sysroot manually.
We'll try our best to improve the uclibc-ng continuously.
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
|
|
|
|
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>
|
|
|
|
The recvmmsg and sendmmsg is very important for UDP stream application.
If we only use recvmsg for UDP stream, it will only copy one mtu size
of data in a syscall. And recvmmsg copy as many as you want in a syscall.
So recvmmsg is more efficient,and some applications will depends on the
recvmmsg and sendmmsg, eg: UDP media stream player.
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
|
|
|
|
|
|
|
|
Fix compile of latest iproute2 package.
Reported-By: Baruch Siach <baruch@tkos.co.il>
|