Commit graph

291493 commits

Author SHA1 Message Date
Jose Luis Duran
67dd41cdb1
nanobsd: Fix parallel make
The NANO_NCPU (number of CPUs) value gets ignored by the build script
when setting the NANO_PMAKE (parallel make) value.

Fix it by setting the NANO_PMAKE later in the process.

PR:		277269
Reviewed by:	imp, emaste
Approved by:	emaste (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D47476

(cherry picked from commit 3c5d19a40d)
2024-12-16 15:11:31 +00:00
Jose Luis Duran
3e93a090b5
nanobsd: Add missing options to usage()
-B suppress installs (both kernel and world)
-I build disk image from existing build/install
-W suppress installworld

PR:		277269
Reviewed by:	imp, emaste
Approved by:	emaste (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D47475

(cherry picked from commit 999f288a0e)
2024-12-16 15:11:22 +00:00
Dag-Erling Smørgrav
efefeefd43 uniq: Correctly document the -D option.
The -D option takes an optional argument; modify the usage message
and the manual page's synopsis to correctly reflect this.  Also
update the tests to exercise -D with and without an argument.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D47999

(cherry picked from commit b93791f5e7)

uniq: Fix off-by-one bug in -cD case.

When printing only duplicated lines, the first line of each set is not
printed until we encounter the second.  When that happens, we need to
increment the repetition count between printing the first and the
second line, so that if we are also printing counts, we don't print the
same (pre-increment) count twice.

MFC after:	1 week
PR:		275764
Reported by:	Yu-Sheng Ma <s110062131@m110.nthu.edu.tw>
Submitted by:	Daniel Tameling <tamelingdaniel@gmail.com> (original patch)
Sponsored by:	Klara, Inc.
Reviewed by:	tamelingdaniel_gmail.com, asomers, emaste
Differential Revision:	https://reviews.freebsd.org/D48000

(cherry picked from commit c3f8900e69)
2024-12-16 10:38:06 +00:00
Dag-Erling Smørgrav
259dcedc4a strptime: Fix day-of-week calculation.
The day-of-week calculation used the raw year value without adjusting
for TM_YEAR_BASE, so it was off by one for 300 years out of every 400;
it just happened to be correct for 1901 through 2000.  It also used a
loop where a simple addition would have sufficed.

While here, simplify our version of Gauss's algorithm, and document
that we assume the Gregorian calendar.

MFC after:	1 week
PR:		282916
Reviewed by:	imp, allanjude, philip
Differential Revision:	https://reviews.freebsd.org/D47977

(cherry picked from commit 4285e024ba)
2024-12-16 10:37:08 +00:00
Ed Maste
453f6aa428 Cirrus-CI: Switch default job to llvm19-amd64
Clang/LLVM19 matches the default in-tree toolchain.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 5e310866c3)
2024-12-15 19:39:08 -05:00
Ed Maste
6d1d5577ce Makefile.inc1: Require DISTDIR be set for make distributeworld
distributeworld is the target used to stage world for building dist sets
for release targets, and is not really intended for end-user use.  If
DISTDIR is not set we would attempt to write to the root directory.
Error out in this case, serving as an assertion that an internal target
is not being used incorrectly.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48030

(cherry picked from commit f6575ed0de)
2024-12-15 19:39:08 -05:00
Pat Maddox
d6b36d1c83 newvers: Set explicit git revision length
The --short flag is configurable. Setting an explicit length supports
reproducible builds.

Signed-off-by: Pat Maddox <pat@patmaddox.com>
Reviewed by: emaste, imp
Differential Revision: https://github.com/freebsd/freebsd-src/pull/1547

(cherry picked from commit a1097094c4)
2024-12-15 19:39:08 -05:00
Zhenlei Huang
005b6caf26 netinet: Use NULL for VNET_SYSINIT's last arg, which is a pointer type
MFC after:	3 days

(cherry picked from commit ac51711cab)
2024-12-15 10:20:54 +08:00
Zhenlei Huang
3c3a622a75 inpcb: Use NULL for VNET_SYSINIT's last arg, which is a pointer type
MFC after:	3 days

(cherry picked from commit ec6e7677a0)
2024-12-15 10:20:53 +08:00
Zhenlei Huang
8293bd6285 rtsock: Use NULL for VNET_SYS[UN]INIT's last arg, which is a pointer type
MFC after:	3 days

(cherry picked from commit adc573c8e2)
2024-12-15 10:20:53 +08:00
Zhenlei Huang
bca3a925b0 routing: Use NULL for VNET_SYS[UN]INIT's last arg, which is a pointer type
MFC after:	3 days

(cherry picked from commit 12b2d68bed)
2024-12-15 10:20:53 +08:00
Zhenlei Huang
23c1619970 cuse: Use NULL for SYSUNINIT's last arg, which is a pointer type
MFC after:	3 days

(cherry picked from commit 6854a14889)
2024-12-15 10:20:53 +08:00
Zhenlei Huang
3021a0bcb0 init_main: Fix logging of the SYSINIT process
The current subsystem, aka `sip->subsystem`, should be logged, rather
than the last one.

Reviewed by:	mhorne
Fixes:	5a8fceb3bd boottrace: trace annotations for startup and shutdown
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47903

(cherry picked from commit 5997b19331)
2024-12-15 10:20:53 +08:00
Zhenlei Huang
9c6454fe70 init_main: Use TUNABLE_INT_FETCH to initialize verbose_sysinit
It is too late to initialize verbose_sysinit via TUNABLE_INT, as
TUNABLE_INT runs at the order of SI_SUB_TUNABLES, thus any subsystems
those have order prior or equal to SI_SUB_TUNABLES are not logged.

Reviewed by:	kevans
Fixes:	c7962400c9 Add debug.verbose_sysinit tunable for VERBOSE_SYSINIT
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47907

(cherry picked from commit a7cfcb2645)
2024-12-15 10:20:52 +08:00
Ed Maste
8f944cba50 Cirrus-CI: Add manual LLVM 19 jobs
The base system compiler is now Clang/LLVM 19.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 944f45b809)
2024-12-14 13:07:21 -05:00
Kristof Provost
ac92792bbd pfctl: clear statistic for specified addresses
The ioctl DIOCRCLRASTATS provides the functionality of clearing stats
not only for the whole table for for addresses stored in that table. The
functionality was missing from pfctl, though. Add it now.

PR:		282877
Obtained from:	OpenBSD, kirill <kirill@openbsd.org>, e496dff3a7
MFC after:	3 weeks

(cherry picked from commit 6463b6b591)
2024-12-14 11:03:27 +01:00
Brooks Davis
9bc9cf4a2a style(9): deprecate blank lines without local vars
Previously (208be1617c) such lines were made optional and several
of us had the impression that they were more completely deprecated.
Do that now.

Requiring a blank line at the top of a function if there are no local
declerations dates to the original style.9 commit (b030a30523) and was
present in the first version of admin/style/style from mckusick@ in 1991.
It's certainly consistant to have a blank line after a null-set of
variables, but today it's unique to BSD source code and an occational
point of friction to new developers.

Document the historic practice and encourage removal in the context of
other changes, but not sweeping removal commits for their own sake.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D47887

(cherry picked from commit ebfb117e2e)
(cherry picked from commit 028dae5d3e)
2024-12-13 21:37:40 +00:00
Warner Losh
1ad44b7f0e style: Allow C++ comments
Attempt to craft the more-or-less conesnsus view on C++ BCPL-style
comments.  Allowing them seemed to have wide support. Consistent use was
highly desired. What constituted consistent use, however, didn't have
good consensus especially with multi-line comments. Craft something
that's a little vague to allow what appears to be a range in common
practices elsewhere and no good way to drive this do absolute agreement.

We should revisit this point in 6-12 months after we get some experience
with it.

Sponsored by:		Netflix
Discussed with:		many in the code reivew, see discussion there
Differential Revision:	https://reviews.freebsd.org/D35960

(cherry picked from commit 0a59a6b02f)
2024-12-13 21:35:28 +00:00
Warner Losh
ecfe308542 style(9): Add comments about branch prediction
This is a partial merge of:

cdefs.h: Add back comment about branch prediction

Add back, with editing, the comments about branch prediction, when to
use it, etc. Offer stronger opinions about this in style(9). Add in the
convention for FreeBSD that we do only the entire expression in the if
expression. Advise use only when it makes things measurably faster.

Requested by:		jhb
Sponsored by:		Netflix
Reviewed by:		brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D45837

(cherry picked from commit fd31c0946e)
2024-12-13 21:34:08 +00:00
Warner Losh
76ec0faf1c style(9): Delete __FBSDID straggler
We no longer need advice on __FBSDID, so delete it.

Sponsored by:		Netflix

(cherry picked from commit a1cfe4c764)
2024-12-13 21:31:15 +00:00
Warner Losh
2317a68524 style(9): Note larger divergence than implied
Times have changed, and we've diverged somewhat from the original style
guide, while still keeping much of the flavor and flair of its spirit as
the C language has evolved over the last 30 years since 4.4 was
released.

Sponsored by:		Netflix

(cherry picked from commit a26b96a930)
2024-12-13 21:30:43 +00:00
Minsoo Choo
8664202799 style(9): Remove $FreeBSD$ recommendation.
Now that stable/12 is now EOL, there's no reason to do this. They've
been proactively removed from the tree.

Reviewed by:	imp, lwhsu
Differential Revision:	https://reviews.freebsd.org/D43641

(cherry picked from commit bea67504c6)
2024-12-13 21:30:25 +00:00
Brooks Davis
960665e47f style(9): Remove ancient SCCS tags.
This is a partial, manual merge of 97759ccc as not merging it here
causes every docdate bump to conflict.
2024-12-13 21:27:04 +00:00
Zhihao Yuan
c71b427bfa nvi: Replace Clang-only __builtin_is_aligned with C code (#124)
We should use alignof in the future.

Obtained from: 25c4d7db4e

(cherry picked from commit 06a98fefd3)
2024-12-13 21:05:24 +00:00
Brooks Davis
3e9f61464e nvi: use memmove to realign buffers
Replace a rather convoluted realignment algorithm with memmove().  In
addition to being hard to understand, the code would read beyond the end
of the input buffer in certain conditions (found on CheriBSD).

Sponsored by:	DARPA
Pull Request:	https://github.com/lichray/nvi2/pull/122

(cherry picked from commit 56ef9c872b)
2024-12-13 21:05:19 +00:00
Jessica Clarke
f69b6410a6 depend-cleanup.sh: Extend clean_dep to support a custom regex
This will avoid having to duplicate the loop every time the default
regex isn't good enough, and will be used by upcoming commits.

(cherry picked from commit cc30f4ae67)
2024-12-13 20:58:38 +00:00
Dmitry Salychev
795e9c9b55
dpaa2: Fix kernel built with ACPI_DEBUG
PR:			282800
Reported by:		phk
Tested by:		bz
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D47666

(cherry picked from commit c2dd2be344)
2024-12-13 21:05:53 +01:00
Maxim Konovalov
7620bade4c login.conf.5: remove a stray quote
PR:	282858
(cherry picked from commit d6917af2b9)
2024-12-13 19:13:53 +00:00
Konstantin Belousov
c924f61769 vmcb.h: fix typo in the comment, try two
(cherry picked from commit e02029e6f4)
2024-12-13 09:07:51 +02:00
Konstantin Belousov
2699315134 vmcb.h: fix typo in the comment
(cherry picked from commit 36b39281a6)
2024-12-13 09:07:51 +02:00
Mark Johnston
fe0506ce89 cd9660: Remove some unneeded definitions
- cd_ino_t can be dropped since ino_t is now 64 bits wide.
- ISOFSMNT_ROOT is unused (and defined only for the kernel).

No functional change intended.

Reviewed by:	olce, imp, kib, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47880

(cherry picked from commit 96e69c8e31)
2024-12-13 01:39:21 +00:00
Mark Johnston
54974e731f cd9660: Make sure that struct ifid fits in generic filehandle structure
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.

This patch packs the structure and checks via a __Static_assert().

Reported by:	Kevin Miller <mas@0x194.net>
Reviewed by:	olce, imp, kib, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47879

(cherry picked from commit 205659c43d)
2024-12-13 01:34:17 +00:00
Mark Johnston
fea53bf43f savecore: Add a livedump regression test
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D47715

(cherry picked from commit 73465bb47b)
2024-12-13 01:34:14 +00:00
Mark Johnston
8e3c0a69fe livedump: Silence KASAN and KMSAN when livedumping
The livedumper triggers reports from both of these sanitizers since it
necessarily accesses uninitialized or freed memory.  Add a flag to
silence reports from both sanitizers.

Reviewed by:	mhorne, khng
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D47714

(cherry picked from commit 37cef00192)
2024-12-13 01:34:14 +00:00
Mark Johnston
2bd47ff645 dtrace: Add some more annotations for KMSAN
- Don't allow FBT and kinst to instrument the KMSAN runtime.
- When fetching data from the traced thread's stack, mark it as
  initialized.  It may well be uninitialized, but as dtrace permits
  arbitrary inspection of kernel memory, it isn't very useful to raise
  KMSAN reports.
- Mark data copied in from userspace as initialized, as we do for
  copyin() etc. using interceptors.

MFC after:	2 weeks

(cherry picked from commit fdeb273d49)
2024-12-13 01:34:14 +00:00
Martin Matuska
397a3893db depend-cleanup.sh: fix dependency changes from latest OpenZFS import
Backports fd3d3240b, 0980d0a03, 7a7741af18 (partial), 73c7cb57a
2024-12-12 18:29:09 +01:00
Baptiste Daroussin
35a6770dde sh(1): -l is only valid in cli option not as set -l
(cherry picked from commit 0df81552d7)
2024-12-12 17:03:34 +01:00
Baptiste Daroussin
c062d3ec60 nuageinit: implement ssh_keys support
MFC After:	1 week
Sponsored by:	OVHCloud

(cherry picked from commit 41fe9d5300)
2024-12-12 16:52:25 +01:00
Baptiste Daroussin
07d147a7fc sh(1): add -l option
-l is required by LSB for login shell, all other shells: bash, zsh,
oksh, mksh, ... implements it.

with -l sh will act as a login shell and read the profile.

MFC After: 	1 week
Obtained From:	dash (3b7c8442bfe7c2fd0a6b0415df6ddf66a399fd55)
Reviewed by:	kib, lme
Differential Revision:	https://reviews.freebsd.org/D47681

(cherry picked from commit 65f5dd42f1)
2024-12-12 16:51:17 +01:00
Martin Matuska
2ec8b69480 zfs: merge openzfs/zfs@e269af1b3 (zfs-2.2-release) into stable/14
OpenZFS release 2.2.7

Notable upstream pull request merges:
 #15457 022bf8637 Increase L2ARC write rate and headroom
 #15527 1ba5b2ef8 freebsd: remove __FBSDID macro use
 #15792 9e7af55e8 Add custom debug printing for your asserts
 #15793 a1ea40af8 libzfs: use zfs_strerror() in place of strerror()
 #16181 -multiple zdb/ztest: improve and harmonise crash output
 #16208 e5e4957a5 Allow block cloning to be interrupted by a signal
 #16210 ba4e582a6 FreeBSD: Add const qualifier to members of struct
                  opensolaris_utsname
 #16225 a6198f34b Simplify issig()
 #16335 25ec9a903 zdb: fix BRT dump
 #16364 cf80a803d zvol: ensure device minors are properly cleaned up
 #16404 384b53be8 FreeBSD: Add missing memory reclamation accounting
 #16492 -multiple Split "shared" userspace & kernel code into separate files
 #16496 f1694496a zfs_file: rename zfs_file_fallocate to zfs_file_deallocate
 #16511 bc0d89bfc Fix an uninitialized data access
 #16529 2dc8529d9 Fix handling of DNS names with '-' in them for sharenfs
 #16539 30ea44296 zfs_log: add flex array fields to log record structs
 #16546 098789216 Evicting too many bytes from MFU metadata
 #16551 54278533a Reduce and handle EAGAIN errors on AIO label reads
 #16554 84ad1d536 FreeBSD: restore zfs_znode_update_vfs()
 #16565 21c40e6d9 FreeBSD: Sync taskq_cancel_id() returns with Linux
 #16567 48482bb2f Properly release key in spa_keystore_dsl_key_hold_dd()
 #16584 e8f4592a1 Avoid computing strlen() inside loops
 #16605 acc8a3186 ARC: Cache arc_c value during arc_evict()
 #16650 fc60e0c6e freebsd: Use compiler.h from FreeBSD's base's linuxkpi
 #16667 b32b35cea zdb: show bp in uberblock dump
 #16684 1f5e1b919 Pack dmu_buf_impl_t by 16 bytes
 #16688 73b3e8ace Fix gcc uninitialized warning in FreeBSD zio_crypt.c
 #16690 727506c94 On the first vdev open ignore impossible ashift hints
 #16692 d83cd5307 zdb: add extra -T flag to show histograms of BRT refcounts
 #16693 82ab837a0 Fix gcc unused value warning in FreeBSD simd.h
 #16740 2bba6e3c5 BRT: Don't call brt_pending_remove() on holes/embedded
 #16801 299da6ace Fix race in libzfs_run_process_impl

Obtained from:	OpenZFS
OpenZFS commit: e269af1b3c
OpenZFS tag:	zfs-2.2.7
2024-12-12 13:22:56 +01:00
Warner Losh
a0e2fa50e7 linux.h: don't redefine lower_32_bits if already defined
systrace.c fails to build if we're using a common compiler.h for both
openzfs and linuxkpi. The issue is easy enough to fix: don't redefined
lower_32_bits if it's already defined in linux.h, since it's the least
'standardized'. This will allow systrace.c to build using an equivalent
macro.

MFC After: 3 days
Sponsored by: Netflix

(cherry picked from commit 481d5a4891)
2024-12-12 13:21:36 +01:00
Dimitry Andric
4db4ed3680 Merge llvm-project release/19.x llvmorg-19.1.5-0-gab4b5a2db582
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/19.x llvmorg-19.1.5-0-gab4b5a2db582,
a.k.a. 19.1.5 release.

PR:		280562
MFC after:	3 days

(cherry picked from commit 71ac745d76)
2024-12-11 09:16:53 +01:00
Jose Luis Duran
9aac1584c8 pw: tests: add a test for -M with a pre-existing home directory
Previous versions of pw(8) wouldn't chmod the home directory if it
already existed prior to user creation, rendering adduser(8) -M
ineffective in some cases.  Add a test to cover that situation.

PR:		280099
Reviewed by:	kevans

(cherry picked from commit f7cf62cf72)
2024-12-10 17:05:51 -06:00
Kyle Evans
b50d2127d9 pw: set the user's home directory mode if it existed
The adduser(8) prompt allows one to set the mode of a new home
directory, but pw(8) doesn't honor the -M mode if the home directory
already exists at creation time.  It doesn't seem to make sense to
ignore the mode (which may lead to a security issue on the system being
configured) when we'll happily chown an existing directory, so fix the
inconsistency.

PR:		280099
Reviewed by:	des, jlduran (previous version)

(cherry picked from commit 6a7238fd7c)
2024-12-10 17:05:51 -06:00
Kyle Evans
7ea2874ead daemon: stop rebuilding the kqueue every restart of the child
We populate the kqueue with all of four kevents: three signal handlers and
one for read of the child pipe.  Every time we start the child, we rebuild
this kqueue from scratch for the child and tear it down before we exit and
check if we need to restart the child.  As a consequence, we effectively
drop any of the signals we're interested in between restarts.

Push the kqueue out into the daemon state to avoid losing any signal events
in the process, and reimplement the restart timer in terms of kqueue timers.
The pipe read event will be automatically deleted upon last close, which
leaves us with only the signal events that really get retained between
restarts of the child.

PR:		277959
Reviewed by:	des, markj

(cherry picked from commit bc1dfc316a)
2024-12-10 17:05:46 -06:00
Kyle Evans
e310a825c9 daemon: tests: add a test for missed SIGTERM
This is somewhaht hard to test reliably, but we'll give it a shot.  Startup
a sleep(1) daemon with a hefty restart delay.  In refactoring of daemon(8),
we inadvertently started dropping SIGTERMs that came in while we were
waiting to restart the child, so we employ the strategy:

 - Pop the child sleep(1) first
 - Wait for sleep(1) to exit (pid file truncated)
 - Pop the daemon(8) with a SIGTERM
 - Wait for daemon(8) to exit

The pidfile is specifically truncated outside of the event loop so that we
don't have a kqueue to catch it in the current model.

PR:		277959
Reviewed by:	des, markj

(cherry picked from commit 9ab59e900c)
2024-12-10 17:00:03 -06:00
Kyle Evans
aee7949421 daemon: truncate the pidfile when we're waiting to restart child
We need to be able to test some more restart behavior that depends on
knowing specifically where we're at (inside the event loop or outside of
the event loop).  Truncate the pidfile until the process is restarted to
give the test a clean marker rather than having to add arbitrary delays
and hoping for the best.

Reviewed by:	des, markj

(cherry picked from commit aa8722cc18)
2024-12-10 16:59:58 -06:00
Kyle Evans
c4290f3466 kern: restore signal mask before ast() for pselect/ppoll
It's possible to take a signal after pselect/ppoll have set their return
value, but before we actually return to userland.  This results in
taking a signal without reflecting it in the return value, which weakens
the guarantees provided by these functions.

Switch both to restore the signal mask before we would deliver signals
on return to userland.  If a signal was received after the wait was
over, then we'll just have the signal queued up for the next time it
comes unblocked.  The modified signal mask is retained if we were
interrupted so that ast() actually handles the signal, at which point
the signal mask is restored.

des@ has a test case demonstrating the issue in D47738 which will
follow.

Reported by:	des
Reviewed by:	des (earlier version), kib
Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.

(cherry picked from commit ccb973da1f)
2024-12-10 14:02:52 -06:00
Konstantin Belousov
fff3323694 amdiommu: correctly initialize iommu.unit
(cherry picked from commit 53adc0b898)
2024-12-10 04:40:24 +02:00
Konstantin Belousov
b50851e8eb prison_proc_iterate(): make it work for prison0
PR:	283163

(cherry picked from commit 831531a82e)
2024-12-10 04:40:24 +02:00