Commit graph

9994 commits

Author SHA1 Message Date
Brooks Davis 6e6cd03c91 libc/quad: narrow list of symbols exposed on i386
These symbols aren't present on i386 so don't try to expose them.

Given the structure of quad/Makefile.inc, it might make more sense to
have per-arch symbol maps here, but this is sufficent to build with
WITHOUT_UNDEFINED_VERSION on i386.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44243
2024-03-07 20:12:22 +00:00
Brooks Davis 8c8882ce96 libc/iconv: don't export nonexistant symbols
It's unclear to me that any of these symbols ever existed.  The ones
I've spot checked are only mentioned in the initial Citrus iconv import
(commit ad30f8e79b) and this code hasn't changed much over time.

Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D44183
2024-03-07 20:12:22 +00:00
Brooks Davis 8c94ed9927 bsearch_b: fix compilation with gcc
Reported by:	rscheff
Differential Revision:	https://reviews.freebsd.org/D44256
2024-03-06 19:46:12 +00:00
Konstantin Belousov 2ce23b1f76 libc posix_spawn(): explain why rtld can be used after fork
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-03-06 09:25:14 +02:00
Konstantin Belousov ebaf907114 posix_spawn.c: fix typo in comment
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-03-06 09:25:02 +02:00
Brooks Davis 7e8e73fed5 libc: actually build bsearch_b
Fixes:		46cdc14062 Add support for some block functions ...

Reviewed by:	theraven
Differential Revision:	https://reviews.freebsd.org/D44189
2024-03-05 01:01:56 +00:00
Brooks Davis ec911a4f10 libc/locale: don't expose nonexistant __collate_load_error
The private symbol __collate_load_error was removed in 2015 in commit
2a6abeebef.  While it had previously been accidently removed in 2011
(commit 3c87aa1d3dc1a) and restored in 2012 (commit bb4317bf3c) I
think it's time to write it off after four major releases without it.

Fixes:		2a6abeebef The collate functions within libc have...

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D44182
2024-03-05 01:00:50 +00:00
Konstantin Belousov a725a7a24d posix_spawn(3): document POSIX_SPAWN_DISABLE_ASLR_NP
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-03-04 03:00:39 +02:00
Konstantin Belousov 822042fdfc posix_spawn(3): add POSIX_SPAWN_DISABLE_ASLR_NP
similar to Apple _POSIX_SPAWN_DISABLE_ASLR

Reviewed by:	emaste, kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44195
2024-03-04 03:00:38 +02:00
Konstantin Belousov 80ac36c3a2 posix_spawnattr_setflags(3): validate argument
Reviewed by:	emaste, kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44195
2024-03-04 03:00:38 +02:00
Brooks Davis 304cdac738 lib{c,sys}: expose _getlogin consistently
Historically we exposed _getlogin as a private symbol on a per-arch basis
(except on aarch64 and riscv) for no obvious reason.  We now need to
expose it for libc's use so remove the special case from
makesyscalls.lua and expose it in the generated syscalls.map.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44116
2024-02-29 19:46:33 +00:00
Brooks Davis 882d9f4507 lib{c,sys}: expose cap_sandboxed from libc/gen
It's a thin wrapper on cap_getmode() implemented in libc, not a system
call so the symbol should have been exposed by libc/gen/Symbol.map
alongside the implementation.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44110
2024-02-28 23:39:55 +00:00
Konstantin Belousov 32fdcff870 libc/sys: add errno test
Despite looking trivial, it requires proper split of exports from libsys
and libc, proper filtering work in rtld, and operational libsys.

Reviewed by:	emaste, imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44075
2024-02-25 22:35:17 +02:00
Konstantin Belousov 7d233b2220 libsys: fix sleep(3)/usleep(3) cancel behavior
Move functions back to libc/gen sources; they are only versioned from
libc and not libsys.
Access libsys interposing slots using __libsys_interposing_slot()
instead of direct __libsys_interposing array dereference, which cannot
work from libc.

Reported by:	glebius
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D44042
2024-02-23 19:39:44 +02:00
Konstantin Belousov fe920a4f2f libsys: move errno to libsys
Before, the 'errno' itself was defined in libc and was referenced by
libsys, causing undesired dependency.

Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D43985
2024-02-21 02:26:11 +02:00
Konstantin Belousov 8271d9b99a libsys: remove usage of pthread_once and _once_stub
that existed in auxv.c, use simple bool gate instead. This leaves a
small window if two threads try to call _elf_aux_info(3) simultaneously.
The situation is safe because auxv parsing is really idempotent. The
parsed data is the same, and we store atomic types (int/long/ptr) so
double-init does not matter.

Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D43985
2024-02-21 02:26:11 +02:00
Brooks Davis eb90239d08 lib{c,thr}: add DT_RUNPATH for gcc -m32
To allow gcc -m32 to work, link libc and libthr with --rpath-/usr/lib32.
When called with -m32, gcc is currently unable to communicate to
the bfd linker that it should look in /usr/lib32 to resolve needed (as
opposed to explicitly linked) libraries so we need to provide a hint.

See also: https://sourceware.org/bugzilla/show_bug.cgi?id=31395

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D43910
2024-02-19 22:44:08 +00:00
Brooks Davis 99ea675731 lib{c,sys}: move auxargs more firmly into libsys
Continue to filter the public interface (elf_aux_info()), but entierly
relocate the private interfaces (_elf_aux_info(),
__init_elf_aux_vector(), and __elf_aux_vector) to libsys.

This ensures that rtld updates the correct (only) copy of
__elf_aux_vector.  After 968a18975a
updates were confused and __getosreldate was failing, causing
the system to fall back to compat compat12 syscalls in some cases.

Return to explicitly linking libc to libsys and link libthr with libc
and libsys (in that order).

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D43910
2024-02-19 22:44:08 +00:00
Maxim Konovalov 1250c96479 fclose.3: remove a confusing sentence
PR:		277037
Reviewed by:	oshogbo
2024-02-16 18:50:12 +00:00
Dag-Erling Smørgrav 46c599340f Update tzcode to 2024a.
MFC after:	3 weeks
Sponsored by:	Klara, Inc.
2024-02-13 21:31:41 +01:00
Assume-Zhan eb8ba6fb74
rpc: Fix typo in comment
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/995
2024-02-13 14:20:45 +08:00
Konstantin Belousov 8dfc788b84 aio_read2/aio_write2: add AIO_OP2_VECTORED
Suggested by:	Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com>
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43448
2024-02-11 03:54:11 +02:00
Konstantin Belousov 06cb1c3f95 libc: add aio_read2() and aio_write2() functions
as wrappers around lio_listio(LIO_READ/WRITE | LIO_FOFFSET, &iocb, 1);

Suggested and reviewed by:	jhb
Discussed with:	asomers
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differrential revision:	https://reviews.freebsd.org/D43448
2024-02-11 03:54:00 +02:00
Brooks Davis cc697d22c4 libsys: move some missed manpages
Fixes:	29d079c964 - libsys: move __libsys_interposer consumers
2024-02-08 19:50:32 +00:00
Brooks Davis 49076f376a libc: don't directly link libsys
It is sufficent to add it as a filter.

Reported by:	kib
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D43781
2024-02-07 19:50:47 +00:00
Brooks Davis 57ddfad884 lib/libc: version auxiliary libsys.so
We need to use libsys.so.7 so that we can work without /usr and because
we're bound a specific ABI.

Reported by:	jtrc27, kib
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D43772
2024-02-07 00:47:04 +00:00
Brooks Davis 8d2e8f7205 libc: make syscall stubs empty for shared lib
They are always replaced by libsys so just make them empty.  In
https://reviews.freebsd.org/D14609 x86 variants call abort2, but that
requires per-arch assembly and should be of low value in the steady
state.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:57 +00:00
Brooks Davis 0d4f7723bc libc: link libsys as a auxiliary filter library
At runtime, when rtld loads libc it will also load libsys.  For each
symbol that is present in both, the libsys one will override the libc
one.  It continues to be the case that program need only link against
libc (usually implicitly).  The linkage to libsys is automatic.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Brooks Davis 10f1b536ad libc: move __getosreldate to libsys
Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Brooks Davis f70c5a0925 libc: move getpagesize(s) to libsys
Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Brooks Davis 4c33415e4c libc: elf auxiliary vector handling to libsys
This is part of the interface to the kernel and some syscall wrappers
depend on it so move it there.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Brooks Davis 81245a77f0 libc: compile _once in libsys
auxv support requires _once(), but we don't want the libsys version
stomping on the libc version should they diverge in the future.  We
could rename it entierly, but for now just hook it in via Makefile.sys.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Brooks Davis 1e2502bfca libc: move MD sys related symbols to libsys
This is a mix genuine MD interfaces and compat symbols like _getlogin.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Brooks Davis cdecda8da3 libc: move rfork_thread(3) to libsys
rfork_thread(3) is assembly that makes syscalls directly and uses
cerror so it belongs in libsys.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Brooks Davis 31a46e2cc8 libc: Move per-arch sys/Makefile.inc to libsys
libc/<arch>/sys/Makefile.inc -> libsys/<arch>/Makefile.sys.

Require that libsys/<arch>/Makefile.sys exist.  At least for current
archtiectures, it's not possible for an architecture to not have and MD
syscall bits.

powerpcspe/Makefile.sys's structure means it had to be modified when moved
so rename detection won't work, but it has trivial contents so the
history is unimportant.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:55 +00:00
Brooks Davis 19149b03b1 libc: remove .PATH refs to libc/<arch>/sys
There are no longer any source files here so remove references.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:55 +00:00
Brooks Davis 4bc66c0f9f libc: remove remaining x86 sys bits to libsys
Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:55 +00:00
Brooks Davis 0d6cc87b18 libc: libc/<arch>/sys/__vdso_gettc -> libsys/<arch>/
Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:55 +00:00
Brooks Davis 84dd0c080b libc: libc/gen/sched_getcpu_gen.c -> libsys/
It is a trivial system call wrapper.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:55 +00:00
Brooks Davis 29d079c964 libsys: move __libsys_interposer consumers
These system call wrappers call interposed system calls in fairly
trivial ways.  Move them over to libsys so all __libsys_interposer
consumers end up in libsys.

Also move recvmmsg and sendmmsg as they are documented with recv and
send.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:55 +00:00
Brooks Davis 8f529310bd libc: libc/sys/Makefile.inc -> libsys/Makefile.sys
Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:55 +00:00
Brooks Davis 8269e7673c libsys: relocate implementations and manpages
Remove core system call implementations and documentation to lib/libsys
and lib/libsys/<arch> from lib/libc/sys and lib/libc/<arch>/<sys>.
Update paths to allow libc to find them in their new home.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:55 +00:00
Brooks Davis 228d8c9efe libc: split libc and syscall interposing (2/2)
Move the __libc_interposing implementation to libc/gen so it doesn't end
up in libsys.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:55 +00:00
Brooks Davis 9cbd96582c libc: split libc and syscall interposing (1/2)
System calls or their wrappers are now interposed by
__libsys_interposing with purely libc entries remaining in
__libc_interposing.

Use __libsys_interposing_slot in libthr to update __libsys_interposing,
but also make __libc_interposing_slot fall back to
__libsys_interposing_slot so an out of date libc has a chance of working
during updates.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:55 +00:00
Minsoo Choo 6bd60e15b1 libc: Specify parameter types for function pointer
Reviewed by:	dab
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43726
2024-02-03 20:08:59 -05:00
Jose Luis Duran 05ad376bfc libc: Fix typo (triple M)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/963
2024-02-02 18:35:00 -07:00
Lexi Winter 5590bacaaf sctp: update manpages
Add missing documentation for sctp_sendv(3) and sctp_recvv(3).

Add a note that sctp_send(3), sctp_sendx(3) and sctp_recvmsg(3) are
deprecated by RFC 6458.

Add a STANDARDS section to all functions specified in RFC 6458 to
indicate their standards conformance.

MFC after:	2 weeks
Reviewed by: imp, bcr, kp, tuexen
Pull Request: https://github.com/freebsd/freebsd-src/pull/965
2024-02-02 18:35:00 -07:00
Corinna Vinschen 619f455b8f regex: fix freeing g->charjump in low memory condition
computejumps() moves g->charjump to a position relativ to the value of
CHAR_MIN.  As such, g->charjump doesn't necessarily point to the address
actually allocated.  While regfree() takes that into account, the low
memory handling in regcomp_internal() doesn't.  Fix that by free'ing
the actually allocated address, as in regfree().

MFC After: 2 weeks
Reviewed by: imp,jrtc27
Pull Request: https://github.com/freebsd/freebsd-src/pull/692
2024-02-02 11:51:54 -07:00
Brooks Davis 0e867a4911 aarch/SYS.h: implement _SYSCALL_BODY() macro
Add _SYSCALL_BODY() macro which invokes the syscall via _SYCALL() and
calls cerror as required.  Use to implement PSEUDO() and RSYSCALL().

Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43058
2024-02-02 17:08:55 +00:00
Konstantin Belousov a570fe4d0d open(2): describe *at behavior for dirfd opened without O_SEARCH
and move the BUGS paragraph about dirfd permissions into STANDARDS
section, noting that we provide POSIX-mandated implementation.

Reviewed by:	emaste, kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D43652
2024-01-29 23:38:48 +02:00