Commit Graph

23965 Commits

Author SHA1 Message Date
Mike Karels
f1d5183124 arm64 lib32: change clang to allow -m32 on arm64
The FreeBSD driver support for clang tested explicitly for 32-bit
Intel, MIPS, or PowerPC targets where /usr/lib32/libcrt1.o was
present to decide whether -m32 should use /usr/lib32.  At jrtc27's
suggestion, simply test for a 32-bit platform rather than adding
arm to the list.  Upstreamed as
3450272fc2
Bump the freebsd version to force a bootstrap build.  This is one
step in adding support for -m32 on arm64.

Reviewed by:	jrtc27, brooks, dim
Differential Revision:	https://reviews.freebsd.org/D40943
2023-07-25 18:58:51 -05:00
Warner Losh
f9ffa1ef25 libcam: Migrate to modern uintXX_t from u_intXX_t
As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t.

MFC After:	3 days
Sponsored by:	Netflix
2023-07-24 21:35:10 -06:00
Andrew Turner
29629d9e76 arm: Rename pte-v6.h to pte.h
There is no need for this to be versioned after the removal of armv4/v5

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41139
2023-07-24 17:58:15 +01:00
Andrew Turner
835927fd8e arm: Remove swi.h
It has been unneeded since moving to the Arm EABI

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41136
2023-07-24 17:58:14 +01:00
Martin Matuska
e64fe029e9 libarchive: merge from vendor branch
Libarchive 3.7.0

Important changes (relevant to FreeBSD):
  #1814 Do not account for NULL terminator when comparing with "TRAILER!!!"
  #1818 Add ability to produce multi-frame zstd archives
  #1840 year 2038 fix for pax archives on platforms with 64-bit time_t
  #1860 Make single bit bitfields unsigned to avoid clang 16 warning
  #1869 Fix FreeBSD builds with WARNS=6
  #1873 bsdunzip ported to libarchive from FreeBSD
  #1894 read support for zstd compression in 7zip archives
  #1918 ARM64 filter support in 7zip archives

MFC after:	2 weeks
PR:		272567 (exp-run)
2023-07-24 07:42:43 +02:00
Xin LI
9df529b8a1 login_getclassbyname(3): use calloc. 2023-07-23 11:18:24 -07:00
Dmitry Chagin
241a55b461 libc/csu: Do not compile the finalizer() for PIC build
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D41148
2023-07-22 11:56:06 +03:00
Kyle Evans
b744861818 libc: locale: flesh out an incomplete comment
Extrapolate from the context what the intention for the rest of the
comment probably was -- that the C/POSIX (and now C.UTF-8) locales may
avoid an allocation and reuse a global table.

Reviewed by:	bapt
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D41087
2023-07-20 23:27:24 -05:00
John Baldwin
e5c4737955 amd64 crt1: Explicitly use a PLT entry for main in the PIC case.
This ensures GNU as generates a R_X86_64_PLT32 relocation instead of
R_X86_64_32.

Reviewed by:	kib
Fixes:		c969310c99 csu: Implement _start using as to satisfy unwinders on x86_64
Differential Revision:	https://reviews.freebsd.org/D41101
2023-07-19 11:53:33 -07:00
R. Christian McDonald
4b426cf3a4 libbe: recursively promote deep BE datasets
beadm will recursively promote deep BE datasets. In order to match the
beadm behavior, we need to recursively iterate over child filesystems
and promote them along the way.

This patch further refines the work from D40903, completing the fix for
promotion.

Reviewed by:	kevans, rew
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40972
2023-07-17 14:08:32 -05:00
Steve Kargl
be4c7f2735 libm: correctly test for for NaN and Infinity in sinpi(), cospi(), and tanpi()
The current versions of lib/msun/src/s_cospi.c, s_sinpi.c and s_tanpi.c
all exhibit the same defect. After checking for various numeric ranges,
they check to see whether the input argument is a NaN or an Infinity.
However, the code uses a value of 0x7f80000 instead of the correct value
of 0x7ff00000.

If you review s_cospif.c, s_sinpif.c, and s_tanpif.c, you will see that
the equivalent statements in these functions are accurate and have
appropriate source comments.

The impact of these defects is to flag some valid input values as
invalid and raise a pole error (divide by zero).

Reported by:	Paul Green <Paul.Green@stratus.com>
PR:	272539
MFC after:	1 week
2023-07-17 08:23:27 +03:00
Robert Clausecker
4da7282a18 lib/libc/string/bcmp.c: fix integer overflow bug
bcmp() returned the number of remaining bytes when the main loop exits.
In case of a match, this is zero, else a positive integer.  On systems
where SIZE_MAX > INT_MAX, the implicit conversion from size_t to int in
the return value may cause the number of remaining bytes to overflow,
becoming zero and falsely indicating a successful comparison.

Fix the bug by always returning 0 on equality, 1 otherwise.

PR:		272474
Approved by:	emaste
Reviewed by:	imp
MFC After:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41011
2023-07-16 20:36:17 +03:00
Konstantin Belousov
ad056b5d35 libthr: trigger library initialization on rwlock calls
Reviewed by:	tijl
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-07-16 15:34:34 +03:00
Konstantin Belousov
80c5588495 libthr: some style in thr_rwlock.c
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-07-16 15:34:23 +03:00
Robert Clausecker
3f5788e0ed lib/libc/string/ffs*.c: work around gcc warning
Gcc warns of infinite recursion if we use __builtin_ffs*() to
implement ffs*().  This is because gcc uses ffs() to implement
these on some platforms.  Sidestep the warning by using
__builtin_ctz*() for these.

Sponsored by:	FreeBSD Foundation
Reported by:	jlduran@gmail.com, jhb
Fixes:		ee8b0c43 (D40730)
Reviewed by:	jhb, mhorne
Approved by:	jhb
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D40966
2023-07-14 22:26:43 +02:00
Jessica Clarke
3a46fe2261 getlocalbase: Make default path actually configurable
We include paths.h in getlocalbase.c, which defines _PATH_LOCALBASE.
This will override a definition on the command line, meaning it is
impossible to override like how the manpage says you can, and it means
the code to provide a fallback default is dead as the macro is always
defined.

Instead, introduce a new LOCALBASE_PATH macro like LOCALBASE_CTL_LEN
that can be set on the command line and will default to the system's
existing _PATH_LOCALBASE to avoid duplicating the default here.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D40975
2023-07-11 21:49:22 +01:00
Jessica Clarke
bfc47586ac getlocalbase.3: Fix AUTHORS formatting
MFC after:	1 week
2023-07-11 18:50:32 +01:00
Jessica Clarke
f8cabe5550 libutil: Delete trailing whitespace 2023-07-11 18:45:23 +01:00
Dmitry Chagin
d744a37a3a csu: Implement _start using as to satisfy unwinders on i386
The right unwinding stop indicator should be CFI-undefined PC.
https://dwarfstd.org/doc/Dwarf3.pdf - page 118:
If a Return Address register is defined in the virtual unwind table,
and its rule is undefined (for example, by DW_CFA_undefined), then
there is no return address and no call address, and the virtual
unwind of stack activations is complete.

The hack localizing _start1 symbol removed.

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D40624
2023-07-11 15:12:01 +03:00
Dmitry Chagin
d7e2580a14 csu: Add the prologue and epilogue to the _init and _fini on i386
Normally, modern unwinders uses Dwarf information to unwind stack,
however in case when the code is not annotated by Dwarf instructions,
unwinders fallbacks to a frame-pointer based algorithm.

That is allows libunwind to unwind stack from global constructors and
destructors. Also it makes gdb happy as it printed nonexistent frame
before.

Reviewed by:		kib, imp
Differential Revision:	https://reviews.freebsd.org/D40948
2023-07-11 15:11:22 +03:00
Kyle Evans
5d0826017f libbe: promote activated BEs all the way
This matches the beadm behavior; generally, we need to keep promoting
until the BE is no longer a clone from a snapshot.  This fixes scenarios
where the dataset associated with a BE's origin is itself a clone,
activating the BE previously would promote it to a clone of the origin's
origin.

We could keep using be_get_dataset_props here, except for two
annoyances:

1.) I couldn't find a clean way to just clear an nvlist rather than
    having to re-alloc it, and I didn't want to just remove the one prop
    we're inspecting out of it.

2.) That's a lot of overhead when all we want to do is fetch the origin
    anyways.

Note that this is not a complete fix, but it does fix the majority of
cases; deep BE subordinates are still notably broken, pending a patch
from Christian.

Reported by:	R. Christian McDonald <rcm@rcm.sh>
Reviewed by:	rew
Differential Revision:	https://reviews.freebsd.org/D40903
2023-07-11 00:44:13 -05:00
Mitchell Horne
398fb4a592 pmclog(3): Drop .Ud
This API is stable and should not be advertised as "currently under
development".

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-07-10 14:30:03 -03:00
Jessica Clarke
3864bd4fd2 lib: Migrate from COMPAT_32BIT to generic COMPAT_LIBCOMPAT
In the process, delete a COMPAT_SOFTFP remnant that was missed in
previous sweeps.

See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40931
2023-07-09 18:49:53 +01:00
Jessica Clarke
45be5010ce libsysdecode: Migrate from COMPAT_32BIT to generic COMPAT_LIBCOMPAT
The use isn't any more generic, just the variable itself, which will
allow COMPAT_32BIT to be removed. The fact we even have to check
COMPAT_LIBCOMPAT here in order to pass the right flags to CPP points at
our libcompat infrastructure not suitably modifying the CPP variable
(which we barely use for world; this and bsd.symver.mk are the two
uses, and the latter could benefit from the right flags too), but this
change doesn't attempt to fix that.

See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	emaste, imp, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40930
2023-07-09 18:49:43 +01:00
Jessica Clarke
d7be70f0ff libiconv_modules: Migrate from COMPAT_32BIT to generic COMPAT_libcompat
See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40929
2023-07-09 18:49:35 +01:00
Jessica Clarke
daf2519ea2 geom: Migrate from COMPAT_32BIT to generic COMPAT_libcompat
See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	imp, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40927
2023-07-09 18:49:28 +01:00
Jessica Clarke
0fbb77c3ef libc: Build all i386 sources for amd64 lib32
Having the symbols exported by libc differ between i386 and amd64 lib32
is questionable. Since these files build just fine today, stop guarding
them with !defined(COMPAT_32BIT). Whether or not they work at run time
is a different matter, but an i386 jail would be similarly affected if
not, so that's not a problem with lib32.

Reviewed by:	kib, jhb, imp
Differential Revision:	https://reviews.freebsd.org/D40937
2023-07-09 18:46:03 +01:00
Jessica Clarke
6adfb8155e lib: Enable libcbor and libfido2 for COMPAT_32BIT
We no longer have COMPAT_32BIT hacks for libusb, instead supporting the
normal 32-bit ioctls for freebsd32 processes, so we can enable these for
the lib32 build.

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40920
2023-07-09 18:45:56 +01:00
Jessica Clarke
3d96c005dd libsysdecode: Drop dead __amd64__ && COMPAT_32BIT code
Under COMPAT_32BIT we are compiling 32-bit code and so __amd64__ is not
defined, __i386__ is, and we use the real i386 headers.

Reviewed by:	brooks, jhb, imp
Differential Revision:	https://reviews.freebsd.org/D40916
2023-07-09 18:45:23 +01:00
Jens Schweikhardt
7a949a0f1c Correct grammo. 2023-07-08 14:25:44 +02:00
Greg Becker
b370ef156a libthr: Patch to reduce latency to acquire+release a pthread mutex.
The acquisition and release of an uncontended default/normal pthread
mutex on FreeBSD is suprisingly slow, e.g., pthread wrlocks and binary
semaphores both exhibit roughly 33% lower latency, while default/normal
mutexes on Linux exhibit roughly 67% lower latency than FreeBSD. This is
likely explained by the fact that AFAICT in the best case to acquire an
uncontended mutex on Linux one need touch only 1 page and read+modify
only 1 cacheline, whereas on FreeBSD we need to touch at least 4 pages,
read 6 cachelines, and modify at least 4 cachelines.

This patch does not address the pthread mutex architecture. Instead,
it improves performance by adding the __always_inline attribute to
mutex_lock_common() and mutex_unlock_common() to encourage constant
folding and propagation, thereby lowering the latency to acquire and
release a mutex due to a shorter code path with fewer compares, jumps,
and mispredicts.

With this patch on a stock build I see a reduction in latency of roughly
7% for default/normal mutexes, and 17% for robust mutexes. When built
without PTHREADS_ASSERTIONS enabled I see a reduction in latency of
roughly 15% and 26%, respectively. Suprisingly, I see similar reductions
in latency for heavily contended mutexes.

By default, this patch increases the size of libthr.so.3 by 2448 bytes,
but when built without PTHREAD_ASSERTIONS enabled it only increases by
448 bytes.

Reviewed by:	jhb (previous version), kib
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40912
2023-07-08 09:00:12 +03:00
Cy Schubert
bfa51318de pam_krb5: Add missing patch
Include a portion of the patch that was missed in 813847e49e.

Reported by:	markj
Fixes:		813847e49e
MFC after:	1 day
2023-07-07 20:09:18 -07:00
Graham Perrin
3541d90836 gpart(8): slices are out of context for GPT
Correct the GPT example. Creation of a partition leaves free the rest
of the device (not the slice).

Approved-by:  imp
Fixes:        ae1b731b5d Rewrite the GPT and MBR examples.  For GPT, ensure that the boot partition is large enough for gptzfsboot, which has doubled in size since 10.
MFC after:    1 week
Pull-request: https://github.com/freebsd/freebsd-src/pull/795
2023-07-07 23:05:46 +01:00
Dmitry Chagin
bae6bb0698 csu: Implement _start using as to satisfy unwinders on aarch64
The right unwinding stop indicator should be CFI-undefined PC.
https://dwarfstd.org/doc/Dwarf3.pdf - page 118:
If a Return Address register is defined in the virtual unwind table,
and its rule is undefined (for example, by DW_CFA_undefined), then
there is no return address and no call address, and the virtual
unwind of stack activations is complete.

Reviewed by:
Differential Revision:	https://reviews.freebsd.org/D40623
2023-07-07 19:56:02 +03:00
Dmitry Chagin
43e29d03f4 csu: Add the prologue and epilogue to the _init and _fini on aarch64
Normally, modern unwinders uses Dwarf information to unwind stack,
however in case when the code is not annotated by Dwarf instructions,
unwinders fallbacks to a frame-pointer based algorithm.

That is allows libunwind to unwind stack from global constructors and
destructors. Also it makes gdb happy as it printed nonexistent frame
before.

Reviewed by:
Differential Revision:	https://reviews.freebsd.org/D40842
2023-07-07 19:54:53 +03:00
Greg Becker
642cd51102 libthr: Add src.conf variable WITHOUT_PTHREADS_ASSERTIONS
This patch fixes a bug which prevents building libthr without
_PTHREADS_INVARIANTS defined. The default remains to build libthr
with -D_PTHREADS_INVARIANTS. However, with this patch, if one builds
libthr with WITHOUT_PTHREADS_ASSERTIONS=true then the latency to
acquire+release a default pthread mutex is reduced by roughly 5%, and a
robust mutex by roughly 18% (as measured by a simple synthetic test on a
Xeon E5-2697a based machine).

Reviewed by:	jhb, kib, mjg
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40900
2023-07-07 04:45:09 +03:00
Kyle Evans
2f700ca965 libbe: bail out early if the zfs kmod isn't loaded
As noted in the comment, we already know the rest of libbe_init() will
fail because there's no pool imported.  Avoid the side effect by
checking beforehand and bailing out early.

With this, freebsd-update(8) should no longer trigger a load of the zfs
kmod just because it runs `bectl check`.

Reviewed by:	jwmaag_gmail.com, rew
Differential Revision:	https://reviews.freebsd.org/D36188
2023-07-06 19:41:14 -05:00
Dmitry Chagin
acfd261524 libc: Improve setjmp comments
Reviewed by:		imp, kib
Differential Revision:	https://reviews.freebsd.org/D40879
2023-07-06 20:21:54 +03:00
Simon J. Gerraty
9c3478cb22 libsecureboot: do not accept certificate we cannot decode
Although we care more about the CN of a certificate than its status
(for purpose of reporting), we should skip if we have errors decoding.

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
2023-07-05 12:37:14 -07:00
Robert Clausecker
ee8b0c436d lib/libc/string: replace ffs/fls implementations with clang builtins
Most architectures we support (except for riscv64) have instructions
to compute these functions very quickly.  Replace old code with the
ffs and clz builtin functions, allowing clang to generate good code
for all architectures.

As a consequence, toss out arm and i386 ffs() implementations.

Sponsored by:	FreeBSD Foundation
Approved by:	mhorne
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D40730
2023-07-03 22:18:27 +02:00
Robert Clausecker
49390697b9 lib/libc/tests/string: add unit tests for ffs, ffsl, ffsll, fls, flsl, and flsll
Also supply CFLAGS+=-fno-builtin to ensure our unit tests
actually test libc functions and not clang's builtins.

Sponsored by:	FreeBSD Foundation
Approved by:	kevans
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D40729
2023-07-03 22:18:27 +02:00
Eugene Grosbein
5aee3e14d4 syslog.3: document ident[N] format
When libc switched to generation of logs as per RFC 5424,
that change broke application ability to insert specific process id
using ident[N] format, the feature existed for decades.
Some processes rely on it (including logger and syslogd).

Later the regression was fixed but the feature remained undocumented.
This change documents it.

MFC after:	1 week
2023-07-03 19:46:40 +07:00
Dmitry Chagin
f049c92ad6 csu: Add the prologue and epilogue to the _init and _fini on x86_64
Normally, modern unwinders uses Dwarf information to unwind stack,
however in case when the code is not annotated by Dwarf instructions,
unwinders fallbacks to a frame-pointer based algorithm.

That is allows libunwind to unwind stack from global constructors and
destructors. Also it makes gdb happy as it printed nonexistent frame
before.

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D40795
2023-07-01 10:52:10 +03:00
Simon J. Gerraty
56f3f2d249 libsecureboot: avoid set but not used errors
Reviewed by:	stevek
2023-06-29 23:52:17 -07:00
Dmitry Chagin
c969310c99 csu: Implement _start using as to satisfy unwinders on x86_64
The right unwinding stop indicator should be CFI-undefined PC.
https://dwarfstd.org/doc/Dwarf3.pdf - page 118:
If a Return Address register is defined in the virtual unwind table,
and its rule is undefined (for example, by DW_CFA_undefined), then
there is no return address and no call address, and the virtual
unwind of stack activations is complete.

This requires the crt code be built with unwind tables, for that remove
-fno-asynchronous-unwind-tables to enable unwind tables generation.

PR:			241562, 246322, 246537
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D40780
2023-06-29 19:34:39 +03:00
Dag-Erling Smørgrav
c09909ed88 libstdbuf: Add proper SEE ALSO section.
Sponsored by:	Klara, Inc.
Reviewed by:	bcr
Differential Revision:	https://reviews.freebsd.org/D40800
2023-06-29 16:23:45 +00:00
Yuri Pankov
24ec316c13 Correctly spell illumos (all lowercase) in man pages
From illumos FAQ:

    "illumos (pronounced i-llu-MOS and written in lowercase)"
2023-06-29 13:14:45 +02:00
Piotr Kubaj
fd774e065c gdtoa: fix endianness issue on powerpc64le
The current code assumes running on big-endian, which causes issues with
e.g. strtod() as reported on https://github.com/ocaml/ocaml/pull/10837#issuecomment-1605346422
This is probably a leftover from when powerpc64le was introduced.

Approved by:	jhibbits (on IRC)
2023-06-29 01:45:50 +02:00
Ed Maste
ab2f6ae8d1 login.conf: document how to specify env var values with commas
As of f32db40650 quotes may be used to specify login class
capabilities that include commas.  This is true in general but is
particularly relevant for setenv, a comma-separated list of environment
variables and values, so mention it there.

PR:		236204
Sponsored by:	The FreeBSD Foundation
2023-06-28 15:02:14 -04:00
John Baldwin
235c8f6631 ncurses: Silence -Wunused-but-set-variable for various files.
Presumably these will be fixed upstream eventually.

Differential Revision:	https://reviews.freebsd.org/D40664
2023-06-27 10:19:32 -07:00
John Baldwin
ccfd87fe2a libefivar: Use a void cast in unimplemented stubs.
This "consumes" an otherwise unused argument.

Differential Revision:	https://reviews.freebsd.org/D40650
2023-06-27 10:19:31 -07:00
Greg Becker
a6c0d801ca libpthread: allocate rwlocks and spinlocks in dedicated cachelines
Reduces severe performance degradation due to false-sharing. Note that this
does not account for hardware which can perform adjacent cacheline prefetch.

[mjg: massaged the commit message and the patch to use aligned_alloc
instead of malloc]

PR:	272238
MFC after:	1 week
2023-06-27 11:56:44 +00:00
Konstantin Belousov
42ceab3ea1 libc.a: implement _rtld_addr_phdr()
to make __cxa_thread_call_dtors() operational for statically linked
binaries.

Noted by:	andrew
Reviewed by:	emaste, dim
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40748
2023-06-25 21:27:25 +03:00
Mitchell Horne
ba84e87055 pmc: clean up remaining Pentium man page references
These have been removed.

Fixes:	d78896e46f ("pmc(3): remove Pentium-related man pages...")
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-06-24 16:30:00 -03:00
Enji Cooper
bc1027a778 libfetch: remove all old OpenSSL support
This change removes pre-OpenSSL 1.1 supporting code and removes/adjusted
preprocessor conditionals which were tautilogically true as FreeBSD main
has shipped with OpenSSL 1.1+ for some time.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40711
2023-06-24 01:45:02 -07:00
Pierre Pronchery
e23d45187b libarchive: Avoid a build failure with OpenSSL 3.0
This is a minimal workaround; a proper fix will come via a future update
from upstream.

Sponsored by:	The FreeBSD Foundation
2023-06-23 18:53:36 -04:00
Dimitry Andric
e048f78b21 Merge llvm-project release/16.x llvmorg-16.0.6-0-g7cbf1a259152
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.6-0-g7cbf1a259152 (aka 16.0.6 release).

PR:		271047
MFC after:	1 month
2023-06-22 20:22:59 +02:00
Dimitry Andric
2efbaac7a0 Merge llvm-project release/16.x llvmorg-16.0.5-0-g185b81e034ba
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.5-0-g185b81e034ba (aka 16.0.5 release).

PR:		271047
MFC after:	1 month
2023-06-22 20:22:50 +02:00
Dimitry Andric
a324c34037 Merge llvm-project release/16.x llvmorg-16.0.4-0-gae42196bc493
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.4-0-gae42196bc493 (aka 16.0.4 release).

PR:		271047
MFC after:	1 month
2023-06-22 20:22:43 +02:00
Dimitry Andric
cbe9438cfe Merge llvm-project release/16.x llvmorg-16.0.3-0-gda3cd333bea5
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.3-0-gda3cd333bea5 (aka 16.0.3 release).

PR:		271047
MFC after:	1 month
2023-06-22 20:22:35 +02:00
Dimitry Andric
9e7101a856 Merge llvm-project release/16.x llvmorg-16.0.2-0-g18ddebe1a1a9
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.2-0-g18ddebe1a1a9 (aka 16.0.2 release).

PR:		271047
MFC after:	1 month
2023-06-22 20:22:28 +02:00
Dimitry Andric
1ac55f4cb0 Merge llvm-project release/16.x llvmorg-16.0.1-0-gcd89023f7979
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16.0.1-0-gcd89023f7979 (aka 16.0.1 release).

PR:		271047
MFC after:	1 month
2023-06-22 20:22:20 +02:00
Dimitry Andric
bdd1243df5 Merge llvm-project main llvmorg-16-init-18548-gb0daacf58f41
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-16-init-18548-gb0daacf58f41.

PR:		271047
MFC after:	1 month
2023-06-22 20:20:56 +02:00
Shawn Webb
1723e7f33a cap_net.3: fix typo
Signed-off-by:	Shawn Webb <shawn.webb@hardenedbsd.org>
2023-06-21 11:26:34 -04:00
Cy Schubert
813847e49e pam_krb5: Fix spoofing vulnerability
An adversary on the network can log in via ssh as any user by spoofing
the KDC. When the machine has a keytab installed the keytab is used to
verify the service ticket. However, without a keytab there is no way
for pam_krb5 to verify the KDC's response and get a TGT with the
password.

If both the password _and_ the KDC are controlled by an adversary, the
adversary can provide a password that the adversary's spoofed KDC will
return a valid tgt for.  Currently, without a keytab, pam_krb5 is
vulnerable to this attack.

Reported by:	Taylor R Campbell <riastradh@netbsd.org> via emaste@
Reviewed by:	so
Approved by:	so
Security:	FreeBSD-SA-23:04.pam_krb5
Security:	CVE-2023-3326
2023-06-20 22:19:47 -07:00
John Baldwin
8144db85fe libpmc: Define a PMCLOG_SKIP32 helper macro to skip over a 32-bit field.
This replaces a set but unused noop variable with a more explicit
macro.

Reviewed by:	jkoshy, mhorne
Differential Revision:	https://reviews.freebsd.org/D40651
2023-06-20 12:31:43 -07:00
John Baldwin
5edeed4360 libgssapi: Remove a set but unused variable.
Reported by:	clang -Wunused-but-set-variable
2023-06-20 09:29:00 -07:00
John Baldwin
035dd78d30 libvgl: Remove set but unused andmask variable from VGLMouseInit.
Reported by:	GCC
2023-06-20 09:28:59 -07:00
John Baldwin
e6ef68530b libkvm: Remove set but unused variable from ppc64mmu_hpt_init.
Reported by:	GCC
2023-06-20 09:28:59 -07:00
John Baldwin
2e2a1c8ecf libgssapi: Remove set but unused variable.
Reported by:	GCC
2023-06-20 09:28:59 -07:00
Gordon Bergling
8f79b07564 nameser: Fix a typo in a source code comment
-s /unknwon/unknown/

MFC after:	3 days
2023-06-19 13:49:23 +02:00
Kyle Evans
0e96337b11 acl_is_trivial_np(3): minor fixes
- Correct the document title
- This function has an _np suffix
- acl_strip_np has a manpage, xref it
- RETURN VALUES should describe acl_is_trivial_np, not acl_get_tag_type

Sponsored by:	Klara, Inc.
2023-06-19 00:47:04 -05:00
Gordon Bergling
85604f7008 xdr(3): Fix a typo in a source code comment
- s/curren/current/

MFC after: 3 days
2023-06-17 10:49:40 +02:00
Mitchell Horne
3977781b98 pmc: clarify and strengthen statements about API/ABI
- Make it clear that applications are not only encouraged to use the
  pmc(3) library, but use of the hwpmc(4) interface directly is a
  use-case we do not support
- Move the COMPATIBILITY section above PROGRAMMING API in hwpmc(4)
- Drop statements about the driver and library being "under development"

Reviewed by:	jkoshy, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40543
2023-06-16 13:44:54 -03:00
Xin LI
6cc4a1c320 Fix build with gcc12. 2023-06-13 20:24:07 -07:00
Dag-Erling Smørgrav
246aec9a3c nss_tacplus: Support setting the login class.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	thj
Differential Revision:	https://reviews.freebsd.org/D40376
2023-06-13 16:08:32 +00:00
Dag-Erling Smørgrav
21850106fd libtacplus: Allow additional AV pairs to be configured.
* Replace hand-rolled input tokenizer with openpam_readlinev() which supports line continuations and has better quoting and escaping.
* Simplify string handling by merging struct clnt_str and struct srvr_str into just struct tac_str.
* Each server entry in the configuration file can now have up to 255 AV pairs which will be appended to the ones returned by the server in response to a successful authorization request.

This allows nss_tacplus(8) to be used with servers which do not provide identity information beyond confirming the existence of the user.

This adds a dependency on libpam, however libtacplus is currently only used by pam_tacplus(8) (which is already always used with libpam) and the very recently added nss_tacplus(8) (which is extremely niche).  In the longer term it might be a good idea to split this out into a separate library.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	pauamma_gundo.com, markj
Differential Revision:	https://reviews.freebsd.org/D40285
Relnotes:	yes
2023-06-13 16:08:08 +00:00
Xin LI
08300d8494 expand_number: Tighten check of unit.
The current code silently ignores characters after the unit as long
the unit themselves were recognized. This commit makes expand_number(3)
to fail with EINVAL if buf did not terminate after the unit character.

Historically, the function accepts and ignores "B" as a SI unit, this
behavior is preserved and e.g. KB, MB are still accepted as aliases of
K and M, document this behavior in the manual page.

While I am there, also write a few test cases to validate the behavior.

Reviewed-by:	emaste
MFC-after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40482
2023-06-12 21:08:32 -07:00
David E. O'Brien
2a3493b93b Correct man page URI formatting.
Don't format URL's embedding a ',' where one doesn't exist; so that
one may copy-n-paste the displayed URL into a browser.
2023-06-09 20:49:51 -07:00
Brad Smith
2c01176a28 msun: Correct FreeBSD version in sincos() man page
The sincos() man page notes the function was added to msun in FreeBSD
9.0 which must have been an oversight in the review as it was commited
to 12.0 and then backported to the 11 branch.

So I have provided a diff to correct this to the first FreeBSD version
it did ship with which was 11.2.

Reviewed by:	dim, imp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D40308
2023-06-09 22:04:43 +02:00
Mark Johnston
1320520ba4 libvmmapi: Remove some unneeded includes
These are amd64-specific and so can't be used when targetting arm64, but
they don't appear to be needed.

No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-06-08 15:03:46 -04:00
Jessica Clarke
21f7397a61 libpmc: Handle PMCALLOCATE log with PMC code on PMU event system
On an arm64 system that reports as a Cortex A72 r0p3, running

  pmcstat -P CPU_CYCLES command

works, but

  pmcstat -P cpu-cycles command

does not. This is because the former uses the PMU event from the JSON
source, resulting in pl_event in the log event being a small index
(here, 5) into the generated events table, whilst the latter does not
match any of the JSON events and falls back on PMC's own tables, mapping
it to the PMC event 0x14111, i.e. PMC_EV_ARMV8_EVENT_11H. Then, when
libpmc gets the PMCALLOCATE event, it tries to use the event as an index
into the JSON-derived table, but doing so only makes sense for the
former, whilst for the latter it will go way out of bounds and either
read junk (which may trigger the != NULL assertion) or segfault. As far
as I can tell we don't have anything lying around to tell us which of
the two cases we're in, but we can exploit the fact that the first
0x1000 PMC event codes are reserved, and that none of our PMU events
tables reach that number of entries yet.

PR:		268857
Reviewed by:	mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D39592
2023-06-07 15:24:29 +01:00
Tom Hukins
409594ef34 gpart(8): Improve manual page syntax
Fix various warnings from `mandoc -Tlint lib/geom/part/gpart.8`.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/702
2023-06-01 20:43:04 -06:00
Tom Hukins
d275d2e3d3 gpart(8): Refer to a related manual page
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/702
2023-06-01 20:41:34 -06:00
Tom Hukins
3e1af044c9 cam(3): Add a manual page cross reference
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/702
2023-06-01 20:41:31 -06:00
Baptiste Daroussin
8093646b0b cpuset(3): Add unit tests
Differential Revision:	https://reviews.freebsd.org/D13046
2023-06-01 23:27:45 +02:00
Baptiste Daroussin
04eeb364d4 cpuset(3): Move cpuset's parselist function into libutil
In order to allow to add cpuset(2) functionality to more utilities than just
 cpuset(1) move the parselist code into libutil

While here, make the code a little more "library" friendly, by returning a range
of various errors so that the consumer can check for them and report appropriate
error message to the users

(One of the planed usage is the jail(8) utility)

Reviewed by:	jilles
Differential Revision:	https://reviews.freebsd.org/D12873
2023-06-01 23:16:01 +02:00
Mitchell Horne
be75e57854 libpmc: expand PMC_OP* defines
When performing the syscall, specify the full name of the desired
operation. This improves grep-ability.

No functional change.

Reviewed by:	jkoshy
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40334
2023-06-01 15:20:13 -03:00
Pierre Pronchery
aa4cf5647c libunbound: Request the OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future update may migrate to use the OpenSSL 3.0 APIs.

PR:		271615
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2023-05-31 10:05:07 -04:00
Jessica Clarke
94426d21bf pmc: Rework PROCEXEC event to support PIEs
Currently the PROCEXEC event only reports a single address, entryaddr,
which is the entry point of the interpreter in the typical dynamic case,
and used solely to calculate the base address of the interpreter. For
PDEs this is fine, since the base address is known from the program
headers, but for PIEs the base address varies at run time based on where
the kernel chooses to load it, and so pmcstat has no way of knowing the
real address ranges for the executable. This was less of an issue in the
past since PIEs were rare, but now they're on by default on 64-bit
architectures it's more of a problem.

To solve this, pass through what was picked for et_dyn_addr by the
kernel, and use that as the offset for the executable's start address
just as is done for everything in the kernel. Since we're changing this
interface, sanitise the way we determine the interpreter's base address
by passing it through directly rather than indirectly via the entry
point and having to subtract off whatever the ELF header's e_entry is
(and anything that wants the entry point in future can still add that
back on as needed; this merely changes the interface to directly provide
the underlying variables involved).

This will be followed up by a bump to the pmc major version.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D39595
2023-05-31 00:20:36 +01:00
Jessica Clarke
53d0b9e438 pmc: Provide full path to modules from kernel linker
This unifies the user object and kernel module paths in libpmcstat,
allows modules loaded from non-standard locations (e.g. from a user's
home directory when testing) to be found and, since buffer is what all
the warnings here use (they were never updated when buffer_modules were
added to pick based on where the file was found) has the side-effect of
ensuring the messages are correct.

This includes obsoleting the now-superfluous -k option in pmcstat.

This change breaks the hwpmc ABI and will be followed by a bump to the
pmc major version.

Reviewed by:	jhb, jkoshy, mhorne
Differential Revision:	https://reviews.freebsd.org/D40048
2023-05-31 00:15:34 +01:00
Jessica Clarke
8e63e787ab pmc: Initialise and check the pm_flags field for CONFIGURELOG
Whilst the former is not breaking, the latter is, and so this will be
followed by a bump to the pmc major version. This will allow the flags
to actually be usable in future, as otherwise we cannot distinguish
uninitialised stack junk from a deliberately-initialised value.

Reviewed by:	jhb, mhorne
Differential Revision:	https://reviews.freebsd.org/D40049
2023-05-31 00:15:24 +01:00
Kajetan Staszkiewicz
c45d6b0ec0 pfctl: Add missing state parameters in DIOCGETSTATESV2
Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Different Revision:	https://reviews.freebsd.org/D40259
2023-05-30 14:28:57 +02:00
Konstantin Belousov
1fc174cba6 open(2): fix typo
__aLC_aclcheck_fd -> acl_aclcheck_fd

Reported by:	Peter Eriksson  <pen@lysator.liu.se>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-05-30 12:18:25 +03:00
Konstantin Belousov
7a292504ba __acl_get_fd(2), __acl_aclcheck_fd(2): enable for O_PATH filedescriptors
PR:	271704
Reported by:	Peter Eriksson  <pen@lysator.liu.se>
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40318
2023-05-30 08:53:56 +03:00
Joseph Mingrone
67c802c948
libpcap: Update PACKAGE_VERSION definition to 1.10.4
Reviewed by:    kp
Fixes:          6f9cba8f8b (libpcap: Update to 1.10.3)
Fixes:          dd744a896b (libpcap: Update to 1.10.4)
Sponsored by:   The FreeBSD Foundation
2023-05-29 15:41:01 -03:00
Kyle Evans
e15da6b10a libc: locale: fix collation file size validation
At a minimum, we need enough for the colllation format version string +
locale definition version string and a full collate_info definition,
rather than just the first two and a pointer.

Sponsored by:	Klara, Inc.
2023-05-28 12:54:24 -05:00
Joseph Mingrone
270d20ce91
libpcap: Update PACKAGE_STRING to 1.10.4
Reviewed by:	emaste
Fixes:		6f9cba8f8b (libpcap: Update to 1.10.3)
Fixes:		dd744a896b (libpcap: Update to 1.10.4)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40295
2023-05-27 12:38:38 -03:00
Dmitry Chagin
bd35e83bcf libsysdecode: Decode linux_clone syscall flags
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D40150
MFC after:		1 week
2023-05-26 19:32:20 +03:00
Pierre Pronchery
5a7500dab9 libarchive: Request the OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future update should migrate to use the OpenSSL 3.0 APIs.

PR:		271615
Reviewed by:	emaste
Event:		Kitchener-Waterloo Hackathon 202305
Sponsored by:	The FreeBSD Foundation
2023-05-25 15:08:05 -04:00