Commit Graph

10946 Commits

Author SHA1 Message Date
nia d06dd93f7d Remove more bogus tests for 64-bit i386 and SuperH.
These are always false.
2020-06-05 11:16:15 +00:00
nia 35c066bcd5 getaddrinfo.3: order of the struct members is wrong, correct it 2020-06-04 11:28:00 +00:00
kamil 5d0165c29d timespec_get(3) was developed by myself
Remove FreeBSD from the authorship as it was just a pullup of small
documentation changes.
2020-06-02 19:30:29 +00:00
nia d5d305cc98 Don't suggest removing arc4random with a libc bump.
It's established enough in non-legacy code that this is a terrible idea.
Even if we add getentropy it's not a comparable API (not a userspace RNG
capable of streaming large numbers of bytes, doesn't have _uniform, etc).

"Feel free to remove that line!" - riastradh
2020-06-02 13:56:30 +00:00
joerg b90f380e16 Don't overalign _RuneStatePriv, it must share the alignment of mbstate_t
it aliased with. Assert that the alignment actually used reflects the
alignment required by existing implementation and for newly build
modules assert that it is at most the guaranteed alignment.
2020-06-02 01:30:31 +00:00
rin 3a564f248f Add m68k assembler version of __muldi3().
This is intended for 68060:
  - GCC does not emit __muldi3() for 68020-40, that have 32 * 32 --> 64 mulul
  - mulsl (and moveml), used in this code, are not implemented for 68010

In comparison with that from compiler_rt, this version saves:
  - 12% of processing time
  - 12 bytes of stack
  - 50 bytes of code size
Also, slightly faster, memory saving, and smaller than libgcc version.

By examining with evcnt(9), __muldi3() is invoked more than 1000 times per
sec by kernel, which should justify to introduce assembler version of this
function.
2020-05-31 11:43:37 +00:00
christos 14c787bcf7 Bring in 2020a 2020-05-25 14:52:48 +00:00
riastradh 59ccc04e14 Teach libc's compat ldexp stub to raise fp exceptions.
This ldexp stub will shadow the ldexp weak alias for scalbn in libm,
which is unfortunate but hard to fix properly without chasing the
mythical libc bump beast.  With the change here, we should raise all
the same exceptions that libm's scalbn does -- overflow, underflow,
inexact-result, and (for signalling NaN only) invalid-operation.
This in turn should correct the missing overflow/underflow exceptions
of our portable C fma, and perhaps other routines.

XXX pullup
2020-05-21 05:56:31 +00:00
christos d18bf24229 bump for ACLS 2020-05-16 18:59:23 +00:00
christos 9aa2a9c323 Add ACL support for FFS. From FreeBSD. 2020-05-16 18:31:45 +00:00
thorpej 74b029050e Avoid pulling in "namespace.h" here, as it can have unintended
effects on consumers of this header.
2020-05-16 16:16:59 +00:00
joerg 7cbd7912a7 Bump libc minor version for malloc lock change 2020-05-15 14:57:33 +00:00
joerg 8409cf4a20 Hook up proper fork lock handling for malloc:
- lock all relevant mutexes just before fork
- unlock all mutexes just after fork in the parent
- full reinit non-spinlocks in the child
This is not using the normal pthread_atfork interface to ensure order of
operation, malloc is used as implementation detail too often.
2020-05-15 14:37:21 +00:00
wiz 3528b8e86e Use more markup. 2020-05-14 13:40:49 +00:00
kamil 48b46ced17 Introduce new ptrace(2) operations: PT_SET_SIGPASS and PT_GET_SIGPASS
They deliver the logic of bypassing selected signals directly to the
debuggee, without informing the debugger.

This can be used to implement the QPassSignals GDB/LLDB protocol.

This call can be useful to avoid signal races in ATF ptrace tests.
2020-05-14 13:32:15 +00:00
kamil ba111eb8df Remove mentions of CLONE_PID and CLONE_STOPPED
CLONE_PID was removed in Linux 2.5.15 and recycled for
CLONE_PIDFD since Linux 5.2.

CLONE_STOPPED was removed in Linux 2.6.38 and recycled
for CLONE_NEWCGROUP since Linux 4.6.
2020-05-12 11:39:08 +00:00
kre 872f7801f3 Do as the manual says, and use _PATH_DEFPATH if PATH is not present in
the environment rather than simply turning into posix_spawn() in that case.

Also, we cannot use strtok() to parse PATH, the semantics don't fit the API.
Borrow the guts of execvp for the PATH search.

We still simply check for a file with 'x' permission, and assume that one
will do, whatever it is, which isn't really correct, but ...
2020-05-11 14:54:34 +00:00
maya b47e7497df Don't add getentropy.c to the build (remove symbol from libc)
Still being discussed in tech-userlevel. If we wait any longer someone
is going to try the excuse that the discussion is entirely pointless, since
removing symbols is too hard.
2020-05-10 19:36:49 +00:00
skrll 62da6573ee Rename curbrk to __curbrk, and make it and __minbrk hidden 2020-05-10 14:34:31 +00:00
skrll ef7a9d8de1 Don't futz with tpidr_el0 in {set,long}jmp as it breaks TLS as seen in
qemu
2020-05-10 14:05:59 +00:00
skrll fe2a0db7f4 No need to .import __cerror as SYS.h does it 2020-05-09 08:25:33 +00:00
wiz 94cffb35ae Fix macro usage. Fix typo. New sentence, new line. 2020-05-07 12:55:06 +00:00
nia 5e1fba1a1e Add getentropy() to libc - a simple wrapper to access the kernel CSPRNG.
Posted to tech-userlevel@ a week ago and reviewed by riastradh@.

GETENTROPY(3)		   Library Functions Manual		 GETENTROPY(3)

NAME
     getentropy - fill a buffer with high quality random data

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <unistd.h>

     int
     getentropy(void *buf, size_t buflen);

DESCRIPTION
     The getentropy() function fills a buffer with high quality random data,
     suitable for seeding cryptographically secure psuedorandom number
     generators.

     getentropy() is only intended for seeding random number generators and is
     not intended for use by regular code which simply needs secure random
     data.  For this purpose, please use arc4random(3).

     The maximum value for buflen is 256 bytes.

IMPLEMENTATION NOTES
     getentropy() reads from the sysctl(7) variable kern.arandom.

RETURN VALUES
     The getentropy() function returns 0 on success, and -1 if an error
     occurred.

ERRORS
     getentropy() will succeed unless:

     [EFAULT]		The buf argument points to an invalid memory address.

     [EIO]		Too many bytes were requested.

SEE ALSO
     arc4random(3), rnd(4)

STANDARDS
     The getentropy() function is non-standard.

HISTORY
     The getentropy() function first appeared in OpenBSD 5.6, then in
     FreeBSD 12.0, and NetBSD 10.
2020-05-06 16:17:36 +00:00
skrll fd7fe8589e Mark __cerror as hidden to avoid using the PLT. This is required for new
binutils where the PLT stubs now use %t1 (%r22) which is used to pass
the errno to __cerror.
2020-05-05 20:43:47 +00:00
skrll af937be388 Add a space before any non-nullified instruction. NFCI. 2020-05-05 20:39:18 +00:00
skrll 2af01421ec Add a space before any non-nullified instruction. NFCI. 2020-05-05 06:20:55 +00:00
skrll cfd190c74d Use the delay slot 2020-05-05 06:11:06 +00:00
skrll bd82c7dc44 Remove unnecesary #define/#undef _LOCORE 2020-05-05 06:06:16 +00:00
skrll 22b0819af2 Remove unnecesary #define/#undef _LOCORE 2020-05-04 06:42:11 +00:00
skrll 7f91a39bb5 Even more trailing whitespace 2020-05-03 15:29:22 +00:00
skrll 94eade6946 More trailing whitespace 2020-05-03 15:27:06 +00:00
skrll 4210e62106 Trailing whitespace 2020-05-03 08:36:09 +00:00
mrg e6631f7240 turn off TLS for mips on old jemalloc. it doesn't work. 2020-05-03 07:32:54 +00:00
pgoyette 8d1dd42752 Document ENOSYS return from MODCTL_EXIST.
Remove EMLINK since it is no longer returned.
2020-04-26 18:56:49 +00:00
thorpej 276ef22378 Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
2020-04-26 18:53:31 +00:00
joerg 18796b949c Explicitly use -fcommon for globals shared between libc and CSU. 2020-04-22 23:32:25 +00:00
thorpej c6ca5287d3 Remove man page for the never-exposed _lwp_gettid(2) call. 2020-04-22 21:27:06 +00:00
rin 27f1060c62 Restrict usage of m68k assembler versions of {,u}divsi3 and {,u}divsi3 to
kernel and bootloader for 68010.

They requires a special calling convention to udivsi3, and cannot to be
mixed up in normal routines provided by libgcc or compiler_rt. Although,
there's no problem for using them in a controlled situation, i.e., kernel
and standalone programs.

Note that this does not affect at all m68k ports other than sun2, since
codes generated by gcc do not call these routines.

Assembler files are moved from common/lib/libc/arch/m68k/gen to
sys/lib/libkern/arch/m68k in order not to be compiled in libc.

Revert hack introduced to lib/libc/compiler_rt/Makefile.inc rev 1.37:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/compiler_rt/Makefile.inc#rev1.37

Proposed on port-sun2@ with no response...
(Again, this does not affect m68k ports other than sun2.)
http://mail-index.netbsd.org/port-sun2/2020/03/10/msg000102.html
2020-04-22 11:28:56 +00:00
rin 1d3b363c69 Use __mc68010__ to distinguish m68000 (sun2) from other m68k ports;
__mc68000__ is defined both for m68000 and m68k.
2020-04-22 08:48:12 +00:00
rin 45df14becf Fix previous for libhack, where _REENTRANT is not defined;
arenas_map_key is used only when NO_TLS && _REENTRANT.
2020-04-22 08:45:06 +00:00
joerg 880ddc3f7b Switch to using TLS in old jemalloc for everywhere but VAX and sun2. 2020-04-21 22:22:55 +00:00
joerg 25a494ecc4 Rename __atomic_fork to __locked_fork and give it &errno as argument.
rtld and libc use different storage, so the initial version would
incorrectly report the failure reason for fork().

There is still a small race condition inside ld.elf_so as it doesn't use
thread-safe errno internally, but that's a more contained internal
issue.
2020-04-19 01:06:15 +00:00
thorpej 77abcafc06 Rename "syscall" to "_syscall" and provide "syscall" as a weak alias. 2020-04-18 23:55:50 +00:00
joerg 11954c74b6 Introduce intermediate locking for fork, so that the dynamic linker is
in a consistent state. This most importantly avoids races between dlopen
and friends and fork, potentially resulting in dead locks in the child
when it itself tries to acquire locks.
2020-04-16 14:39:58 +00:00
christos fea87f652c fix tyop 2020-04-11 20:48:53 +00:00
christos 2d9fc2191e Via enh at google dot com in tech-userlevel. Fix handling of
EXT_FRAC{H,L}BITS (although we don't need to since we don't have them).
2020-04-11 20:28:28 +00:00
dholland 7ec84f335a Move the note about sys_errlist[] users to COMPATIBILITY, and strengthen it. 2020-04-04 21:29:54 +00:00
dholland 903a8c167f Add missing ERRORS section. 2020-04-04 21:26:44 +00:00
dholland 4aee32ddde Minor clarification. And a typo. Bump date. 2020-04-04 21:20:39 +00:00
thorpej 7f4d3fb1f5 Man page for _lwp_gettid(2).
(Not yet installed, pending adding the libc stub.)
2020-04-04 20:31:11 +00:00