Commit graph

24435 commits

Author SHA1 Message Date
Brooks Davis ef5fddd344 libsys: make __libsys_interposing static
Access __libsys_interposing with __libc_interposing_slot() in all
cases to support a move of these wrappers back to libc.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44239
2024-03-13 17:31:48 +00:00
Brooks Davis f7dbbbd176 libsys: don't expose sigwait wrapper
Long ago (e129c18a83) __sys_sigwait was wrapped to prevent sigwait()
from returning with EINTR.  Through a series of changes this wrapper
become __libc_sigwait which was internal to libc and used solely in the
interposing table.  To support a move of sigwait back to libc, move this
wrapper into libsys and rename it with an __libsys_ prefix.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44238
2024-03-13 17:04:07 +00:00
Brooks Davis a3a4bea49c libc: remove remnants of __fcntl_compat
Reviewed by:	kib
Fixes:		60b2e2d3ee libc: stop exposing __fcntl_compat
Differential Revision:	https://reviews.freebsd.org/D44326
2024-03-13 16:52:49 +00:00
Brooks Davis 8f86c10821 libthr: restore _pthread_cond_timedwait
The function was renamed to _thr_cond_timedwait in commit 0ab1bfc7b2
and for some reason did not get the same __weak_reference treatment as
other _pthread_cond symbols.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44244
2024-03-12 21:03:14 +00:00
Warner Losh 7a0a6b276c libc: Move tzset.3 to stdtime
This really belongs in stddime, since it documents interfaces
implemented in stdtime.

Suggested by:	brooks
Sponsored by:	Netflix
2024-03-11 22:19:31 -06:00
Warner Losh a34940a975 timezone: Move to the XSI/POSIX definition for timezone.
The old timezone(3) function has long since been obsolete and has a
fatally flawed interface. Retain this function for compatibility
purposes, but shift to providing the offset from UTC in the timezone
variable, whether or not the timezone observes summer time in the
'daylight' variable. Document the tzname variable that's already been
set. Also make _tztab() static. It's not used in libc (or anywhere in
the tree) and it's not exported as a public dynamic symbol.

Sponsored by:		Netflix
Reviewed by:		brooks, kib
Differential Revision:	https://reviews.freebsd.org/D44281
2024-03-11 22:19:31 -06:00
Brooks Davis 32c7350beb libc/i386: don't attempt to export alloca
The assembly implementation was removed in 2006 (commit 3c03c7095e).

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44242
2024-03-07 20:14:55 +00:00
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 83392afeeb libsys: don't expose __init_elf_aux_vector
__init_elf_aux_vector is now complied statically so don't try to export
it from the dynamic library.

Fixes:	8271d9b99a libsys: remove usage of pthread_once and _once_stub

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44237
2024-03-07 01:02:25 +00:00
Brooks Davis cc4ffc9786 libsys: don't try to expose yield
The undocumented yield system call has never been implemented via libc
or libsys (except accidentally for <15 minutes in 1998 between commits
abd529ceba and 0db2fac06a).  Avoid trying to export it now to avoid
failures when linking with --no-undefined-version.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44236
2024-03-07 01:01:36 +00:00
Brooks Davis 39a15d7470 syscall(2): make i386 less of an outlier
Unlike other architectures, i386 only defined syscall() and not
_syscall() or __sys_syscall().  The syscall() function then invoked the
desired system call directly rather than invoking syscall(2).  Keep the
latter as it's marginally more efficent, but also create the
conventional _syscall() and __sys_syscall() stubs.

This avoids the need to special case syscall(2) in the symbol list
generation in libsys.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44235
2024-03-07 00:59:07 +00:00
Brooks Davis 7b3836c281 libsys/aarch: Remove pointless MD syscall(2)
This file is functionally identical to the stub generated by
Makefile.sys once the MD version is removed.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44234
2024-03-07 00:59:01 +00:00
Brooks Davis 0ee0ae2373 libsys/arm: Remove pointless MD syscall(2)
This file is functionally identical to the stub generated by
Makefile.sys once the MD version is removed.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44233
2024-03-07 00:58:55 +00:00
Brooks Davis e6ffc7669a libsys/riscv: Remove pointless MD syscall(2)
This file is functionally identical to the stub generated by
Makefile.sys once the MD version is removed.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44232
2024-03-07 00:58:44 +00:00
Brooks Davis 269593dc4a libsys/aarch64: end syscall stubs with newlines
Technically speaking, POSIX text files must end with a newline.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44231
2024-03-07 00:58:29 +00:00
Brooks Davis 023fa553bf liblzma: don't export lzma_lz_decoder_uncompressed
It was removed in the 5.4.0 import.

Reviewed by:	delphij
Differential Revision:	https://reviews.freebsd.org/D44247
2024-03-07 00:54: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 f8bbbce458 libthr: remove explicit sys/cdefs.h includes
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-03-06 09:25:13 +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
Kyle Evans bd23e71f91 libsysdecode: add a decoder for pollfd events
We'll use this in another change to read pollfd arrays coming from a
successful poll(2) operation.

Reviewed by:	bapt, jhb
Differential Revision:	https://reviews.freebsd.org/D44159
2024-03-04 23:44:09 -06: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
Warner Losh beadbca67b read(2): Add write cross reference
Add a write cross reference in the SEE ALSO section.

Sponsored by:		Netflix
2024-03-01 20:36:39 -07:00
Christopher Davidson 0d161f7b60 read.2: Use .Fn markup instead of .Xr for read/write calls
Udpate both write / read references from .Xr to .Fn to eliminate
self-reference cross reference.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1128
2024-03-01 20:34:10 -07:00
Emmanuel Vadot 56ec98a04d pam_xdg: Close the dir after removal
CID:	1534878
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-03-01 14:56:12 +01: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 6d3f4dcda2 libsys: make PSEUDO take a bare syscall name
Rather than having PSEUDO be a list of object files when all consumers
want syscall names or source files, make it a list of bare syscall
names like INTERPOSED (which is built on PSEUDO).

Improve document of variables developers can set.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44108
2024-02-29 19:19:01 +00:00
Brooks Davis f102db5028 libsys: consolidate PSEUDO definitions
Consolidate in preparation for further cleanup.

Also relocate the sole NOASM entry.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44107
2024-02-29 19:19:01 +00:00
Brooks Davis e52a9177d9 libsys: reduce makefile declaration duplication
Every PSEUDO entry (_foo.o) has a corresponding NOASM entry (foo.o) to
suppress its addition to ASM.  Check PSEUDO instead when adding entries
to ASM.  No functional change.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44106
2024-02-29 19:19:01 +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
Kristof Provost 706d465dae pf: convert kill/clear state to use netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44090
2024-02-28 23:26:18 +01:00
Emmanuel Vadot 5acbe6d1fb pam_xdg: Reset rv to 0
Otherwise on success it ontain the return value of asprintf.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Fixes:		2d2950c889 ("pam_xdg: Check asprintf return value")
2024-02-27 08:06:02 +01:00
Emmanuel Vadot 2d2950c889 pam_xdg: Check asprintf return value
Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Fixes:          6e69612d5d ("pam: Add pam_xdg module")
2024-02-27 07:42:47 +01:00
Emmanuel Vadot 84329908c5 pam_xdg: Remove leftover debug printf
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Fixes:		6e69612d5d ("pam: Add pam_xdg module")
2024-02-27 07:42:47 +01:00
Emmanuel Vadot 6b9e6f12e5 pam: Always use pam_xdg for session and xdm
This ensure that the XDG_RUNTIME_DIR is always created and the environment
variable is present which is a must for any wayland user (at least).
The only "cost" of it is a directory is created and unused.

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D44012
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-02-26 18:35:22 +01:00
Emmanuel Vadot 6e69612d5d pam: Add pam_xdg module
This is a module to setup the XDG directories and environment variables.
For now the only usage is to have a XDG_RUNTIME_DIR environment setup at
user login.
All other environment variable have a default fallback so no need to export
them in this module.
The directory is created according to the XDG Base directory specification.

The default base directory is /var/run/xdg/<username> but can be configured
using the runtime_dir=<dir> module option.

According to the spec the directory *must* not survive a reboot so adding
var_run_enable="YES" to rc.conf is highly recommanded.

Reviewed by:	des, pauamma (manpages)
Differential Revision:	https://reviews.freebsd.org/D44011
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-02-26 18:34:52 +01:00
Xin LI 8db56defa7 MFV: xz 5.6.0.
MFC after:	2 weeks
2024-02-25 15:46:22 -08: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
Brooks Davis c5698afcd5 libsys: remove duplicate, commented out code 2024-02-23 22:25:35 +00: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 baa7d0741b libsys: link symbolic
so that libc/libthr do not preempt libsys symbols, esp. errno-related.

The issue is, if libsys is linked with DT_BIND_NOW flag, and then loaded
as filter, rtld tries to relocate its PLT symbols immediately, not as
filter.  There, during symbol lookup, rtld finds filtering symbols in
libc, and since libc is in loading filters mode, the resolution stops
there.  The end result is that libsys links to libc.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D44027
2024-02-23 19:39:42 +02:00
Konstantin Belousov 2f4cbf459d libsys auxv.c: add fences needed to ensure that flag works
Noted by:	jrtc27
Sponsored by:	The FreeBSD Foundation
2024-02-21 16:18:10 +02:00
Warner Losh 1edb7116f4 bearssl: Make shared library link
Creating a lua shared library module linking against libbearssl.so won't
load w/o these functions.

Sponsored by:		Netflix
Reviewed by:		sjg
Differential Revision:	https://reviews.freebsd.org/D43982
2024-02-20 20:31:41 -07:00
Konstantin Belousov 3668e1fa0a libsys: disable ssp
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 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
Konstantin Belousov af9758deff libsys: internalize memcpy, memset, and strlcpy
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
Xin LI 4543ef5166 MFV: expat 2.6.0.
MFC after:	3 days
2024-02-17 14:04:14 -08:00
Xin LI 345cf360f8 Vendor import of expat 2.6.0 2024-02-17 13:54:42 -08:00
Dimitry Andric 73ff7384e0 Optionally create full debuginfo for llvm-related executables
Commit de6feefdb7 limited the amount of debuginfo generated for clang
and other llvm-related executables. This was done to save disk space and
memory during building, but it makes debugging any of these executables
much harder.

Add a new src.conf(5) setting, WITH_LLVM_FULL_DEBUGINFO, to generate
full debuginfo instead. This is off by default, but could for example be
enabled for release builds or snapshots, so llvm executables are easier
to debug.

Reviewed by:	emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43839
2024-02-17 00:15:32 +01:00
Maxim Konovalov 1250c96479 fclose.3: remove a confusing sentence
PR:		277037
Reviewed by:	oshogbo
2024-02-16 18:50:12 +00:00
Warner Losh f7781d030c flua: Add hash module
Add lua bindings to hashing functions. sha256 is available. sha256.new
craetes a new object. sha256.update updates the digest. sha256.digest
returns the digest as a binary string and resets the
context. sha256.hexdigest returns the digest as a string of hex digits
and then resets the cotnext.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D43872
2024-02-15 20:59:23 -07:00
Ed Maste 3733d82c4d libcasper: fix cap_rights_init usage
Capability rights passed to cap_rights_* are not simple bitmaks and
cannot be ORed together in general (although it will work for certain
subsets of rights).

PR:		277057
Fixes:		faaf43b2a7 ("fileargs: add tests")
Sponsored by:	The FreeBSD Foundation
2024-02-14 22:33:24 -05:00
Cy Schubert b76ef9a7cb unbound: Vendor import 1.19.1
Release notes at
    https://www.nlnetlabs.nl/news/2024/Feb/13/unbound-1.19.1-released/

Security:	CVE-2023-50387, CVE-2023-50868
MFC after:	3 days
2024-02-13 21:05:50 -08: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
Ting-Hsuan Huang 2a3a8eb9fa
libusb(3): Fix link in comment
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1042
2024-02-13 16:55:54 +08:00
Cheng-Yuan Wu 38b7eebc4a
libbsdstat: Fix typo in bsdstat.h
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1040
2024-02-13 16:53:35 +08:00
Cheng-Yuan Wu f446c9482c
libbe(3): Fix typo and grammar
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1039
2024-02-13 16:52:35 +08:00
Cheng-Hsun Lin 1d479bf6b4
gjournal(8): standardize capitalization for consistency
Event:		Advanced UNIX Programming Course (Fall'23) at NTHU
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1017
2024-02-13 16:09:35 +08: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
Simon J. Gerraty f616d61ab6 libsecureboot do not report expected unverified files
By default only report unverified files at severity VE_WANT
and above.  This inlcudes *.conf but not *.hints, *.cookie
or *.tgz which get VE_TRY as their severity.

If Verbose is set to 0, then VerifyFlags should default to 0 too.
Thus the combination of

	module_verbose=0
	VE_VEBOSE=0

is sufficient to make the loader almost totally silent.

When verify_prep has to find_manifest and it is verified ok
return VE_NOT_CHECKED to verify_file so that it can skip
repeating verify_fd

Also add better debugging output for is_verified and add_verify_status.

vectx handle compressed modules

When verifying a compressed module (.ko.gz or .ko.bz2)
stat() reports the size as -1 (unknown).
vectx_lseek needs to spot this during closing - and just read until
EOF is hit.

Note: because of the way libsa's open() works, verify_prep will see
the path to be verified as module.ko not module.ko.bz2 etc.  This is
actually ok, because we need a separate module.ko.bz2 entry so that
the package can be verified, and the hash for module.ko is of the
uncompressed file which is what vectx will see.

Re-work local.trust.mk so site.trust.mk need only set
VE_SIGN_URL_LIST (if using the mentioned signing server)

interp.c: restrict interactive input

Apply the same restrictions to interactive input as for
unverified conf and hints files.

Use version.veriexec when LOADER_VERIEXEC is yes

Reviewed by:	kevans
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D43810
2024-02-12 14:35:01 -08:00
Christos Margiolis 53c768e683 mixer(3): Do not hardcode "/dev/mixer"
We have BASEPATH defined.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D43812
2024-02-12 13:00:05 +02:00
Dimitry Andric d9c0e2e166 Revert "Build clang and other llvm executables as PIE"
This reverts commit 470f9f13de.

I need more time to figure out how to make this work correctly with
incremental builds, which it currently miserably fails on.
2024-02-12 10:27:00 +01:00
Dimitry Andric 470f9f13de Build clang and other llvm executables as PIE
There is no reason anymore to not build these as PIE. Unfortunately
bsd.lib.mk does not allow for building _only_ PIE static libraries, so
lib/clang/Makefile.inc needs a kludge to work around that issue.

MFC after:	1 week
2024-02-11 19:01:56 +01:00
Konstantin Belousov a52cb4c480 Document aio_read2/aio_write2
Reviewed by:	jhb
Discussed with:	asomers
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43448
2024-02-11 03:54:16 +02: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
Konstantin Belousov e4b7bbd6ab lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset
and use the current file offset instead.

Requested by:	Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com>
Reviewed by:	jhb
Discussed with:	asomers
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43448
2024-02-11 03:53:50 +02:00
Konstantin Belousov 3e9515846f read.2: Describe debug.iosize_max_clamp
same as it is done for write.2.

PR:	276937
Reported by:	bugs.freebsd.org@masklinn.net
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-02-10 11:43:29 +02:00
Brooks Davis 1995ea1ea2 libsys: add guards to MD manpages
This avoids duplicate installations which fail packaging tests.

Reported by:	emaste
2024-02-09 17:22:13 +00:00
Brooks Davis d5677b0b8b libsys: actually install manpages
In initial hacking I'd bluntly disabled manpage installation in libsys,
then later disabled them for libc, but forgot to fix the former leading
to no syscall manapages.

PR:		276887
Reported by:	Martin Birgmeier <d8zNeCFG@aon.at>
2024-02-08 19:53:29 +00: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 49d684369c libthr: filter rather than link with libsys
The allows gcc + GNU ld to link programs with -m32 -pthread without
erroring out due to _umtx_op_err being undefined (unless -lsys is added
to the link command.

We now always link _umtx_op_err into libthr (not just when it's static)
and filter it with libsys so we call that implementation.  The dynamic
implementations (at least the assembly ones) should likely become stubs
as a further refinement.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D43783
2024-02-07 19:50:47 +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 11f9745c5b libsys: fix powerpcspe build
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D43771
2024-02-07 00:47:03 +00:00
Piotr Pawel Stefaniak 12bae251fb libcompat: silence -Wdeprecated-non-prototype
by removing unnecessary re-declarations and converting K&R-style
function definitions.

Differential Revision:	https://reviews.freebsd.org/D43723
Reviewed by:	imp, emaste
2024-02-06 20:32:46 +01: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 f217772244 SYS.h: make _SYSCALL_BODY overridable
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 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 ef9871c620 libthr: move _umtx_op_err() to libsys
Declare in sys/umtx.h and implement in libsys.  Explicitly link libthr
with libsys.

When building libthr static include _umtx_op_err so we don't break static
linkage with -lpthread.

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 e9d961055a libsys: plumb in to build
libsys provides the FreeBSD kernel interface (auxargs, system calls,
vdso).  It can be linked directly for programs using a non-standard
libc and will later be linked as a filter library to libc providing
the actual system call implementation.

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 86deddfacb libsys: generate private symbol map
We now export all _ and __sys_ prefixed syscalls stubs from libc and
libsys so that libsys can replace them.

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