1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-21 07:15:49 +00:00
Commit Graph

24934 Commits

Author SHA1 Message Date
Ed Maste
95b71a659a libc: Note that getentropy is nearly POSIX 2024
Our implementation currently diverges from POSIX 2024 in a couple of
ways, as now noted in the BUGS section.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47589
2024-11-20 14:30:34 -05:00
Ed Maste
5cc53d7965 memcmp.3: Clarify return value
The return value is not required to be the difference between the
differing bytes, only less than zero, zero, or greater than zero.

Reviewed by:	fuz
Event:		Kitchener-Waterloo Hackathon 202406
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47683
2024-11-20 12:15:11 -05:00
Ed Maste
62dab3d016 getentropy: Remove fallback code
We don't in general support running newer libc on an older kernel, but
have occasionally added support for specific functionality on a case-by-
case basis.  When we do this it is usually done as an aid for developers
to get across a change that introduced new functionality, as for 64-bit
inodes and the introduction of the getrandom syscall.

The getrandom syscall was added in commit e9ac27430c ("Implement
getrandom(2) and getentropy(3)") in 2018, and exists in all supported
FreeBSD versions.  The ECAPMODE special case applied to a few months
worth of kernel versions also in 2018 -- fixed as of commit ed1fa01ac4
("Regen after r337998.").

The backwards-compatibility support is no longer needed, so remove it.

Relnotes:	Yes
Reviewed by:	brooks, cem, delphij
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47636
2024-11-19 21:29:46 -05:00
Graham Percival
10343013a4 manuals: Fix some .Bl -tag lists
Signed-off-by:	Graham Percival <gperciva@tarsnap.com>
Reviewed by:	mhorne, Alexander Ziaee <concussious.bugzilla@runbox.com>
MFC after:	3 days
Sponsored by:	Tarsnap Backup Inc.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1528
2024-11-18 13:30:40 -04:00
Ed Maste
4ef07eb080 getentropy: Add Git hashes corresponding to SVN references
getentropy has a comment about a special case to support kernels between
SVN revisions r331280 and r337999.  Add the corresponding Git hashes so
there's a usable reference after Subversion infrastructure disappears.

Sponsored by:	The FreeBSD Foundation
2024-11-16 10:22:46 -05:00
Ed Maste
566c039d1e fork: Document _Fork (and fork) as POSIX 2024
Also remove some information from HISTORY that is no longer needed (and
could be confusing), now that _Fork is part of a standard.

Reported by:	kib
Reviewed by:	imp, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47588
2024-11-15 23:05:40 -05:00
Ed Maste
dfa0ac74c2 libc: indicate existing functions that are POSIX 2024
Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47581
2024-11-14 21:32:20 -05:00
Robert Clausecker
8983acc8de lib/libc/string: apply SSP hardening and tests to memset_explicit
Reviewed by:	emaste, kevans
Differential Revision:	https://reviews.freebsd.org/D47286
2024-11-14 23:10:00 +01:00
Robert Clausecker
007871c356 lib/libc/string: add memset_explicit() for compliance with C23
Patterned after explicit_bzero, visible from C23 onwards.

Reviewed by:	emaste, kevans
Differential Revision:	https://reviews.freebsd.org/D47286
2024-11-14 23:10:00 +01:00
Graham Percival
bc919e81e0 man: Misc syntax fixes
- loader.efi.8: use proper way of printing a backslash.
- usr.bin/gzip/gzip.1: contained a non-breaking space (in utf-8, 0xC2A0).
- lib/libpmc/pmc.*.3: remove two duplicate .Xr lines

Signed-off-by:	Graham Percival <gperciva@tarsnap.com>
Reviewed by:	mhorne, Alexander Ziaee <concussious.bugzilla@runbox.com>
MFC after:	3 days
Sponsored by:	Tarsnap Backup Inc.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1523
2024-11-14 16:59:22 -04:00
Konstantin Belousov
209fd89a28 _dl_iterate_phdr_locked(): fix libc and libdl
Add prototype.  Export from libdl.

Fixes:	1426fd6cff
Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D47563
2024-11-14 06:14:05 +02:00
Kyle Evans
3cc3d71efe libc: fix the stubs for pthread_{suspend,resume}_all_np
Noticed just a little too late, stub_null returns a `void *` but these
prototypes have no return value.  As far as I know, all of our archs
will throw the return value in a caller-saved register and it'll simply
be ignored, but it's probably worth being more accurate.

Fixes:	83aafcdc88 ("libc, libthr: coordinate stubs for [...]")
2024-11-13 21:08:02 -06:00
Kyle Evans
83aafcdc88 libc, libthr: coordinate stubs for pthread_{suspend,resume}_all_np
If libthr isn't linked into the process, then we don't have any pthreads
to worry about and our stubs can just return success -- there are none
to suspend/resume.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D47350
2024-11-13 20:48:05 -06:00
Kyle Evans
1426fd6cff rtld: implement _dl_iterate_phdr_locked
Some sanitizers need to be able to use dl_iterate_phdr() after stopping
the rest of the process, but it's very hard to do so reliably as a
non-participant in the main logic of the program.

Introduce _dl_iterate_phdr_locked to bypass the locking that's normally
required for dl_iterate_phdr() and slap some scary warning on it.  It
will remain undocumented and probably shouldn't be used for anything
else.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D47558
2024-11-13 19:33:59 -06:00
Kyle Evans
4b202f4faf libthr: allow very early atfork registration
LSan wants to be able to register atfork handlers at __lsan_init time,
which can happen either at the first intercepted function call or in a
.preinit_array function.  Both of these end up being very early in rtld
and executed with the bind lock held, which ends up causing problems
when we go to _libpthread_init().

Instead of requiring libpthread to be initialized, just insert the new
atfork handler straight into the list if it's not ready yet.  The
critical section and locking should not be necessary if we're really
executing this early, as there won't be any threads to contend with.

Reviewed by:	kib (earlier version), markj
Differential Revision:	https://reviews.freebsd.org/D47349
2024-11-13 19:33:44 -06:00
Kyle Evans
7e6ac503ff libthr: add some tests for pthread_atfork() handling
Test that it generally functions, and also that registering multiple
times calls each handler in the order that it's documented to call them
in.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D47348
2024-11-13 19:33:37 -06:00
Ed Maste
36887e0494 sched_getcpu: Add man page
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47556
2024-11-13 19:32:04 -05:00
Ed Maste
3750ccefb8 Retire MK_PROFILE infrastructure
It was disabled by default in fe52b7f60e.  We planned to (but did not)
remove the option before FreeBSD 14.  Remove it now, for FreeBSD 15.

Relnotes:	Yes
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31558
2024-11-12 12:11:51 -05:00
Dimitry Andric
d686ce931c Merge llvm-project release/19.x llvmorg-19.1.3-0-gab51eccf88f5
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/19.x llvmorg-19.1.3-0-gab51eccf88f5,
a.k.a. 19.1.3 release.

PR:		280562
MFC after:	1 month
2024-11-08 17:45:31 +01:00
Konstantin Belousov
e434c56fcd rtld_get_var.3: fix typo
Noted by:	Christos Longros @github
MFC after:	3 days
2024-11-07 20:48:28 +02:00
Konstantin Belousov
3820f78459 Document rtld_get_var(3)
Reviewed by:	Alexander Ziaee
Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47351
2024-11-07 07:15:30 +02:00
Konstantin Belousov
c56df6ce71 rtld: add rtld_{get,set}_var
Reviewed by:	brooks (previous version)
Discussed with:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47351
2024-11-07 07:15:23 +02:00
Mark Johnston
99127fd103 libvmmapi: Use the vmmctl device file to create and destroy VMs
This deprecates the vm_create() and vm_open() interfaces and introduces
vm_openf(), which takes flags controlling its behaviour.  In particular,
it will optionally create a VM first, and it can optionally reinitialize
an existing VM.  This enables some simplification of existing consumers.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D47030
2024-11-05 01:40:41 +00:00
Graham Percival
c7c3ef8949 manuals: Remove trailing spaces
This does not change the rendered ascii at all.

Signed-off-by:	Graham Percival <gperciva@tarsnap.com>
Reviewed by:	mhorne, Alexander Ziaee <concussious.bugzilla@runbox.com>
MFC after:	3 days
Sponsored by:	Tarsnap Backup Inc.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1473
2024-11-04 11:26:14 -04:00
Konstantin Belousov
3b65da5b65 libc: remove some XXX for russian translations of errnos
The alternative, more concise, translations for signal names, are left
intact under XXX in comments.

Noted by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-11-03 18:59:16 +02:00
Konstantin Belousov
e2864e7189 libc: mechanically convert ru_RU msg catalog from KOI8-R to UTF-8
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47414
2024-11-03 18:59:15 +02:00
Konstantin Belousov
1176390d2d catopen(3): align returned errors with IEEE Std 1003.1™-2024
- Invalid/non-existent/unable to use message catalog file should result in
  ENOENT, and not in EFTYPE.
- Added detection of several cases of wrong file format due to length [*].
- Update man page.

* Based on the original patch from PR.

PR:	172805
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47413
2024-11-03 18:59:15 +02:00
Mark Johnston
bfd03046d1 unix: Add support for atomically setting the socket mode
With this patch, it is possible to call fchmod() on a unix socket prior
to binding it to the filesystem namespace, so that the mode is set
atomically.  Without this, one has to call chmod() after bind(), leaving
a window where threads can connect to the socket with the default mode.
After bind(), fchmod() reverts to failing with EINVAL.

This interface is copied from Linux.

The behaviour of fstat() is unmodified, i.e., it continues to return the
mode as set by soo_stat().

PR:		282393
Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D47361
2024-11-03 16:46:53 +00:00
John Baldwin
06b2ed7a3a nvmf_tcp: Correct padding calculation
PDU data alignment (PDA) isn't necessarily a power of 2, just a
multiple of 4, so use roundup() instead of roundup2() to compute the
PDU data offset (PDO).

Sponsored by:	Chelsio Communications
2024-11-02 09:54:29 -04:00
John Baldwin
7b8dd078ea libnvmf: Correctly set the controller and host PDA fields
The caller supplied PDU data alignment (PDA) field from
nvmf_association_params is the caller's restriction on data alignment
(so affects received PDUs), and the PDA value received from the other
end is the remote end's restriction (so affects transmitted PDUs).

I had these backwards so that if the remote end advertised a PDA it
was used as the receive PDA instead of the transmit PDA.

Sponsored by:	Chelsio Communications
2024-11-02 09:54:20 -04:00
Dag-Erling Smørgrav
79679a18ea fts: Simplify fts_alloc() and use calloc().
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D47382
2024-11-01 16:53:11 +01:00
Brooks Davis
59a8b439ac libsys: remove yield special case
Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1503
2024-11-01 15:45:04 +00:00
Ruslan Bukin
7ab1a32cd4 bhyve/riscv: Initial import.
Add machine-dependent parts for bhyve hypervisor to support
virtualization on RISC-V ISA.

No objection:	markj
Sponsored by: UK Research and Innovation
Differential Revision: https://reviews.freebsd.org/D45512
2024-10-31 20:24:12 +00:00
Mark Johnston
a5d1cf5e36 rpc: Fix the definition of xdr_void()
xdr_void() should have type xdrproc_t, make it so.

PR:		280514
Reviewed by:	brooks, dim
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D47340
2024-10-30 19:27:18 +00:00
Mark Johnston
218f80226b libarchive tests: Re-enable a broken test
It passes and so appears to have been silently fixed at some point.

PR:		240683
MFC after:	1 week
2024-10-29 15:11:28 +00:00
Graham Percival
b74aaa1a21 manuals: Fix dates
These were reported by `mandoc -T lint ...` as warnings.

Signed-off-by:	Graham Percival <gperciva@tarsnap.com>
Reviewed by:	mhorne
MFC after:	3 days
Sponsored by:	Tarsnap Backup Inc.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1475
2024-10-28 12:26:03 -03:00
Wolfram Schneider
95b17d3b1c mktemp(3): bring the documentation up to date with best practice
Using short temp filenames as /tmp/temp.XXXX (4 or 6 X) was probably ok
20 years ago, but not anymore. Best practice is to use 10 X. Given that our
users often copy & paste examples from our manual pages we need to
update the documentation.

PR: 261437
2024-10-27 16:41:01 +00:00
Robert Clausecker
7ed159c6cc contrib/mandoc: add -isoC-2024 and -svid1 to mdoc(7)
C23 (ISO/IEC 9899:2024) is not out yet, but will be shortly.
SVID1 is needed for the history section of memccpy(3).

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D47284
2024-10-26 20:11:02 +02:00
Robert Clausecker
87c2aab0a0 lib/libcrypt: reinstate CFLAGS+=-I${SRCTOP}/sys/crypto/sha2
This is apparently needed for the cross-build from Linux to succeed.

Fixes:		cb5e41b160
2024-10-26 20:11:02 +02:00
Mark Johnston
f44029e322 linker: Make linker.h more self-contained
struct kld_file_stat embeds a reference to MAXPATHLEN, defined in
param.h.

PR:		280432
MFC after:	2 weeks
2024-10-26 14:05:56 +00:00
Ka Ho Ng
72e15f76a1 libkldelf: add see_local parameter to elf_lookup_symbol
This gives the function the ability to return only global symbols.

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D47206
2024-10-25 16:20:16 +00:00
Dimitry Andric
bc9e19dce0 Fix buildworld with gcc 12 after llvm-19 import
Unfortunately gcc 12's is not yet capable of compiling all of libc++
19's C++23 code, which results in errors similar to:

  /usr/src/freebsd/src/contrib/llvm-project/libcxx/include/__algorithm/ranges_contains.h:41:3: error: 'static constexpr bool std::__1::ranges::__contains::__fn::operator()(_Iter, _Sent, const _Type&, _Proj)' must be a non-static member function
     41 |   operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) {
        |   ^~~~~~~~
  /usr/src/freebsd/src/contrib/llvm-project/libcxx/include/__algorithm/ranges_contains.h:48:3: error: 'static constexpr bool std::__1::ranges::__contains::__fn::operator()(_Range&&, const _Type&, _Proj)' must be a non-static member function
     48 |   operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) {
        |   ^~~~~~~~

Until we can get rid of gcc 12, work around this by making it compile
libc++ in C++20 mode instead.

NOTE: The resulting libc++ library will not be C++23 compatible! Please
try to avoid shipping it, and use gcc 13 instead, if you must use gcc.

PR:		280562
MFC after:	3 days
2024-10-25 18:08:32 +02:00
Robert Clausecker
cb5e41b160 lib/libcrypt: unbundle hash functions
libcrypt bundles the various hash functions it needs,
duplicating code that is also found in libmd.
Unbundle the hash functions and apply the same hack used
for libncursesw so static consumers link -lmd in addition
to -lcrypt.

Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D47062
2024-10-25 16:02:38 +02:00
Robert Clausecker
a2c0d2026f lib/libcrypt: use explicit_bzero() to clear sensitive buffers
Prevent a potentially sufficiently smart compiler from optimising
away our attempts to clear sensitive buffers.

A related change was discussed and rejected in D16059, but I don't
believe the reasoning there applies: the code clearly documents its
intent that the `memset` calls clear sensitive buffers so they don't
hang around.  `explicit_bzero` is the appropriate function for this
purpose.  A potential performance disadvantage seems less important:
the functions in crypt are specifically designed to be slow, so a
few extra calls to guarantee that sensitive buffers are cleared does
not significantly affect runtime.

See also:	D16059
Reviewed by:	delphij, kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47037
2024-10-25 16:02:38 +02:00
Xin LI
3df1abdfd9 Revise qsort(3 reflect POSIX.1-2024 update.
Reviewed by:	emaste, trasz
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D47262
2024-10-25 00:31:50 -07:00
Dimitry Andric
1c83996bed Adjust LLVM_ENABLE_ABI_BREAKING_CHECKS depending on NDEBUG
When assertions are disabled, the upstream build system disables
LLVM_ENABLE_ABI_BREAKING_CHECKS by default. Though the upstream build
system allows it to be force-enabled, it looks like that is not a
well-tested build-time configuration.

Therefore, always disable LLVM_ENABLE_ABI_BREAKING_CHECKS when
assertions are disabled, which will also save some more runtime cost
when people use WITHOUT_LLVM_ASSERTIONS.

PR:		280562
MFC after:	1 month
2024-10-24 11:53:19 +02:00
Li-Wen Hsu
dab59af3bc
Canonicalize the name of the FreeBSD Foundation
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2024-10-24 05:03:07 +08:00
SHENG-YI HONG
514f4e89ac
ncurses: Fix codegen for key names and codes
Adding back arguments, which were missed during the import of ncurses version
6.5, to the code gen awk script.

This is modified from lib_keyname.c and keys.list targets in
contrib/ncurses/ncurses/Makefile.in of
21817992b3

PR:		280697
Reported by:	np
Reviewed by:	bapt
Tested by:	scf
Fixes:		21817992b3 ncurses: vendor import version 6.5
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D47153
2024-10-24 04:39:36 +08:00
Dimitry Andric
5deeebd8c6 Merge llvm-project release/19.x llvmorg-19.1.2-0-g7ba7d8e2f7b6
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/19.x llvmorg-19.1.2-0-g7ba7d8e2f7b6,
a.k.a. 19.1.2 release.

PR:		280562
MFC after:	1 month
2024-10-23 20:27:38 +02:00
Dimitry Andric
6e516c87b6 Merge llvm-project release/19.x llvmorg-19.1.1-0-gd401987fe349
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/19.x llvmorg-19.1.1-0-gd401987fe349,
a.k.a. 19.1.1 release.

PR:		280562
MFC after:	1 month
2024-10-23 20:27:28 +02:00