Commit graph

9400 commits

Author SHA1 Message Date
Andrew Turner
c71bfb1013 Revert "Switch to Arm Optimized Routines for mem* & str*"
The Arm Optimized Routines don't exist in 13. I missed this as my
builds succeeded, likely due to stale depends files.

This reverts commit bfd10d146b.
2021-12-14 12:34:09 +00:00
Andrew Turner
bfd10d146b Switch to Arm Optimized Routines for mem* & str*
These are the updated version of the older Cortex Strings Library we
previously used. The Arm Optimized Routines also support CPU features
that are currently in development on FreeBSD, e.g. Branch Target
Identification (BTI). Rather than add BTI support to the old code it's
easier to just use the maintained version.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32774

(cherry picked from commit 2e8ff4d1d5)
2021-12-14 10:58:01 +00:00
Mark Johnston
a5659943e3 libc: Add pdfork to the list of interposed system calls
Otherwise the asm stub is used and libthr interposition does not work.

Reviewed by:	kib
Fixes:		21f749da82 ("libthr: wrap pdfork(2), same as fork(2).")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit cbdec8db18)
2021-12-13 08:26:58 -05:00
Konstantin Belousov
ba6f5ed72e fcntl(2): be more precise about third arg type
(cherry picked from commit 97722455cc)
2021-12-13 02:58:22 +02:00
Konstantin Belousov
9258e9e3a8 fcntl(2): add F_KINFO operation
(cherry picked from commit 794d3e8e63)
2021-12-13 02:58:22 +02:00
Ed Maste
bf4a70bb40 libc: Use musl's optimized strchr and strchrnul
Parentheses added to HASZERO macro to avoid a GCC warning, and formatted
with clang-format as we have adopted these and don't consider them
'contrib' code.

Obtained from:	musl (snapshot at commit 4d0a82170a25)
Reviewed by:	kib (libc integration), mjg (both earlier)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17630

(cherry picked from commit 7f72497ef7)
2021-12-12 17:32:33 -05:00
Mike Karels
1ab4b70db5 res_init: remove unused inet_makeaddr with IN_LOOPBACKNET
Remove code that is ifdefed out on USELOOPBACK, which uses historical
class.  No functional change intended.

(cherry picked from commit 0bf7f99b2a)
2021-12-10 10:26:14 -06:00
Mike Karels
d98a0edb26 man pages: deprecate Internet Class A/B/C
Mark functions inet_netof(), inet_lnaof(), and inet_makeaddr() as
deprecated, as they assume Class A/B/C.  inet_makeaddr() mostly works
when networks are a multiple of 8 bits, but warn for anything other
than historical classes.  Reduce other mentions of network classes.

(cherry picked from commit 12bd931d8c)
2021-12-10 10:25:45 -06:00
Michael Tuexen
4bf3c8ea0d libc sctp: improve conformance of sctp_getpaddrs()
When there is no association, don't return -1 and indicate ENOENT,
but return 0 instead. This is specified in RFC 6458.

PR:		260117
MFC after:	1 week

(cherry picked from commit 83a103ec42)
2021-12-10 11:39:15 +01:00
Michael Tuexen
6a5487e34b libc sctp: fix sctp_getladdrs() when reporting no addresses
Section 9.5 of RFC 6458 (SCTP Socket API) requires that
sctp_getladdrs() returns 0 in case the socket is unbound. This
is the cause of reporting 0 addresses. So don't indicate an
error, just report this case as required.

PR:		260117
MFC after:	1 week

(cherry picked from commit 071966e874)
2021-12-10 11:38:31 +01:00
Michael Tuexen
4749d55fb3 libc sctp: improve error reporting of sctp_getladdrs()
Do not hide errno from getsockopt() called internally.

MFC after:	1 week

(cherry picked from commit 6e9309bd3b)
2021-12-10 11:26:31 +01:00
Michael Tuexen
30e6da1149 libc sctp: fix sctp_getladdrs() for 64-bit BE platforms
When calling getsockopt() with SCTP_GET_LOCAL_ADDR_SIZE, use a
pointer to a 32-bit variable, since this is what the kernel
expects.
While there, do some cleanups.

MFC after:	1 week

(cherry picked from commit dabd8bf914)
2021-12-10 11:25:21 +01:00
Konstantin Belousov
bc663f746e Document posix_spawn_file_actions_addclosefrom_np(3)
(cherry picked from commit 78963d796d)
2021-12-07 02:25:55 +02:00
Konstantin Belousov
54cdfdf12a posix_spawn: add closefrom non-portable action
(cherry picked from commit a18ddf7757)
2021-12-07 02:25:55 +02:00
Konstantin Belousov
ef39284e94 Document posix_spawn_file_actions_addchdir_np(3)
(cherry picked from commit bd44dce5b3)
2021-12-07 02:25:55 +02:00
Konstantin Belousov
c7b624979a posix_spawn: add chdir-related non-portable actions
(cherry picked from commit 25cda42a49)
2021-12-07 02:25:53 +02:00
Konstantin Belousov
4529cb3db2 posix_spawn(3), posix_spawn_file_actions_addopen(3): use .Fo/.Fc
(cherry picked from commit 8ed1e4a5c1)
2021-12-07 02:25:01 +02:00
Konstantin Belousov
94f97c0424 posix_spawn: style, use return ()
(cherry picked from commit b239cc204a)
2021-12-07 02:25:01 +02:00
Konstantin Belousov
198932fd77 posix_spawn.c: format fae_action anon enum more stylish
(cherry picked from commit adbaf1b443)
2021-12-07 02:25:01 +02:00
Konstantin Belousov
f457e04994 citrus_prop.c: do not ignore sign
(cherry picked from commit 181751a8b6)
2021-12-06 02:23:45 +02:00
Konstantin Belousov
c20c7a3122 libc/tests/stdlib/dynthr_mod/dynthr_mod.c: mark dummy as used
(cherry picked from commit a64a3b7988)
2021-12-06 02:23:45 +02:00
Konstantin Belousov
f19aa58ee6 libc/stdio/vfwscanf.c::convert_wstring(): wcp0 is write-only
(cherry picked from commit c8a4a49d58)
2021-12-06 02:23:45 +02:00
Konstantin Belousov
f894975dda libc/x86/__vdso_gettc.c::tsc_selector_idx(): cpu_id is calculated but not used
(cherry picked from commit 4b6f4db341)
2021-12-06 02:23:45 +02:00
Konstantin Belousov
f4669d7064 acl_delete_entry(): remove write-only variable
(cherry picked from commit 959c7ab51e)
2021-12-06 02:23:45 +02:00
Konstantin Belousov
065166c76a setproctitle_internal(): remove kbuf local, it is write-only
(cherry picked from commit 412fd7a34c)
2021-12-06 02:23:45 +02:00
Konstantin Belousov
5298739f2d libc/rpc/getrpcent.c: Mark write-only variables as unused
(cherry picked from commit 16b238b740)
2021-12-06 02:23:44 +02:00
Konstantin Belousov
9cb9ecafac libc/net/nscachedcli.c: remove write-only variables
(cherry picked from commit 0e00befcaf)
2021-12-06 02:23:44 +02:00
Konstantin Belousov
9e8f0f6934 libc/net/getservent.c: Mark write-only variables as unused
(cherry picked from commit 346eaa41f8)
2021-12-06 02:23:44 +02:00
Konstantin Belousov
75f8750524 libc/net/getprotoent.c: Mark write-only variables as unused
(cherry picked from commit f6d403743c)
2021-12-06 02:23:44 +02:00
Konstantin Belousov
4914a141fb libc/net/getnetnamadr.c: Mark write-only variables as unused
(cherry picked from commit 1c4f305d21)
2021-12-06 02:23:44 +02:00
Konstantin Belousov
20e0f16d35 libc/net/gethostnamadr.c: mark write-only variables as __unused
(cherry picked from commit 024547c9bd)
2021-12-06 02:23:44 +02:00
Konstantin Belousov
0c80653b16 libc/gen/getpwent.c: plug warnings about write-only variables
(cherry picked from commit 701473ef94)
2021-12-06 02:23:44 +02:00
Konstantin Belousov
81baf3493b libc/gen/getgrent.c: plug warnings about write-only variables
(cherry picked from commit 075fa5a9a8)
2021-12-06 02:23:44 +02:00
Felix Johnson
c834258459 uuid(3): Document return values
PR:		204449
Reported by:	Michael Cress <michael.cress@cress.us>

(cherry picked from commit f6842865d3)
2021-11-21 19:43:31 -05:00
Konstantin Belousov
9de9a33050 fexecve(2): allow O_PATH file descriptors opened without O_EXEC
(cherry picked from commit be10c0a910)
2021-11-06 04:12:33 +02:00
Konstantin Belousov
c802b970a5 procctl: actually require debug privileges over target
(cherry picked from commit f5bb6e5a6d)
2021-10-26 05:26:27 +03:00
Konstantin Belousov
2e69ba48b9 procctl(2): add consistent shortcut P_ID:0 as curproc
(cherry picked from commit f833ab9dd1)
2021-10-26 05:26:26 +03:00
Mark Johnston
589daa05be Revert "libc/locale: Fix races between localeconv(3) and setlocale(3)"
This reverts commit f89204d6b9.

I didn't intend to push this commit yet, pending discussion on PR
258360.

PR:	258360
2021-10-19 21:13:12 -04:00
Mark Johnston
f89204d6b9 libc/locale: Fix races between localeconv(3) and setlocale(3)
Each locale embeds a lazily initialized lconv which is populated by
localeconv(3) and localeconv_l(3).  When setlocale(3) updates the global
locale, the lconv needs to be (lazily) reinitialized.  To signal this,
we set flag variables in the locale structure.  There are two problems:

- The flags are set before the locale is fully updated, so a concurrent
  localeconv() call can observe partially initialized locale data.
- No barriers ensure that localeconv() observes a fully initialized
  locale if a flag is set.

So, move the flag update appropriately, and use acq/rel barriers to
provide some synchronization.  Note that this is inadequate in the face
of multiple concurrent calls to setlocale(3), but this is not expected
to work regardless.

Thanks to Henry Hu <henry.hu.sh@gmail.com> for providing a test case
demonstrating the race.

PR:		258360
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7eb138a9e5)
2021-10-19 20:53:33 -04:00
Greg V
1625e2db22 O_PATH: allow vfs_extattr syscalls
(cherry picked from commit 98dae405de)
2021-10-16 16:01:47 +03:00
Jessica Clarke
d7b3f3c84e libc: Fix build on case-insensitive file systems
On case-insensitive file systems (most likely to be seen on macOS, where
it is the default), _Fork.o for the new POSIX _Fork function conflicts
with _fork.o for the PSEUDO file. This results in non-determinsitic
behaviour in terms of which ends up being present; if _Fork.o wins then
the build fails to link libc.so due to missing __sys_fork, and if
_fork.o wins then libc silently fails to include the implementation of
_Fork. A similar issue occurred in the past for C99's _Exit conflicting
with exit(2) and was fixed in cb1cb6a2a8, so this adds a fix based on
that.

As a longer-term solution it might be better to instead make the
generated files use a different prefix that's less likely to conflict
with other things (such as __sys_foo.o given they always contain that)
but that's a rather more invasive change.

Fixes:	49ad342cc1 ("Add _Fork()")
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31895

(cherry picked from commit 877175a17a)
2021-10-10 14:33:52 +01:00
Konstantin Belousov
156db35573 readlinkat(2): allow O_PATH fd
PR:	258856

(cherry picked from commit 5fb54d2fc8)
2021-10-10 12:22:58 +03:00
Konstantin Belousov
8c384596a8 Fix mistakes in link(2) and shm_open(2)
PR:	258957

(cherry picked from commit 8d3cd7767a)
2021-10-10 12:21:18 +03:00
Adam Fenn
2524e9bd82 libc: vDSO timekeeping: Add pvclock support
(cherry picked from commit a3d932dfef)
2021-10-10 12:21:17 +03:00
Kyle Evans
a663c839ff libc: ssp: sprinkle around some __dead2
This is consistent with, e.g., NetBSD's implementation, which declares
these as noreturn in ssp/ssp.h.

(cherry picked from commit 5487294d79)
2021-10-06 02:14:42 -05:00
Kyle Evans
b7e90b290a kqueue: document how timers with low/past timeouts are handled
(cherry picked from commit 4b5554cebb)
2021-10-06 02:04:00 -05:00
Konstantin Belousov
d4a478c270 procctl(2): Add PROC_WXMAP_CTL/STATUS
(cherry picked from commit 796a8e1ad1)
2021-09-24 03:26:59 +03:00
Edward Tomasz Napierala
e79a18dadf procctl(2): add PROC_NO_NEW_PRIVS_CTL, PROC_NO_NEW_PRIVS_STATUS
(cherry picked from commit db8d680ebe)
2021-09-24 03:26:59 +03:00
Mark Johnston
ad9f3a91d5 libc: Use the initial-exec TLS model
This permits more efficient accesses of thread-local variables, which
are heavily used at least by jemalloc and locale-aware code.  Note that
on amd64 and i386, jemalloc's thread-local variables already have their
TLS model overridden by defining JEMALLOC_TLS_MODEL.

For now the change is applied only to tested platforms, but should in
principle be enabled everywhere.

PR:		255840
Suggested by:	jrtc27
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9c97062b62)
2021-09-14 08:50:53 -04:00
Mark Johnston
603c9bb029 kqueue.2: Document the fact that EVFILT_READ can be used on kqueues
Reviewed by:	bcr, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f756c91168)
2021-09-14 08:50:31 -04:00