Commit Graph

24378 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
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