Commit Graph

283876 Commits

Author SHA1 Message Date
Dimitry Andric
3006f6df02 Update -ftrivial-auto-var-init flags for clang >= 16
As of clang 16, the -ftrivial-auto-var-init=zero option no longer needs
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
to enable the option. Only add it for older clang versions.

PR:		271047
Reviewed by:	emaste
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D40208
2023-05-23 19:44:45 +02:00
Simon J. Gerraty
75e02c458a libsecureboot ensure correct BUILD_UTC
If using stat(1) on BUILD_UTC_FILE we should use -L incase
it is a symlink.

If we have new enough bmake though we can just use ${BUILD_UTC_FILE:mtime}
2023-05-23 09:02:00 -07:00
Dag-Erling Smørgrav
5063211781 ctags: Error out if writing to stdout failed.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	cracauer, allanjude
Differential Revision:	https://reviews.freebsd.org/D40200
2023-05-23 17:31:28 +02:00
Christos Margiolis
7900879eec rc.resume: remove obsolete comment
Reviewed by:	markj
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D40235
2023-05-23 18:26:56 +03:00
Christos Margiolis
ff624eb636 kinst: use dtrace_dis_get_byte() instead of own copy
No functional change intended.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39872
2023-05-23 18:12:18 +03:00
Johannes Totz
2cf8ef5910 rc.suspend: execute rc-scripts with suspend keyword
For symmetry with rc.resume, give rc.suspend the ability to execute
rc-scripts. Use the suspend keyword for that.

Use-case is for setting a wake-up time, e.g. via efiwake.

Reviewed by:	christos
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D39965
2023-05-23 18:11:31 +03:00
Christos Margiolis
98ab9802af dtrace: rename rp to frame in dtrace_getreg()
Reviewed by:	mhorne, markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40231
2023-05-23 17:44:47 +03:00
Christos Margiolis
ed35c7cf77 dtrace.1: fix mandoc -Tlint
Reviewed by:	markj
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D40230
2023-05-23 17:29:19 +03:00
Mark Johnston
30038a8b4e md: Get rid of the pbuf zone
The zone is used solely to provide KVA for mapping BIOs so that we can
pass mapped buffers to VOP_READ and VOP_WRITE.  Currently we preallocate
nswbuf/10 bufs for this purpose during boot.

The intent was to limit KVA usage on 32-bit systems, but the
preallocation means that we in fact consumed more KVA than needed unless
one has more than nswbuf/10 (typically 25) vnode-backed MD devices
in existence, which I would argue is the uncommon case.

Meanwhile, all I/O to an MD is handled by a dedicated thread, so we can
instead simply preallocate the KVA region at MD device creation time.

Event:		BSDCan 2023
Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D40215
2023-05-23 10:27:10 -04:00
Christos Margiolis
21a16d55cc dtrace: add register bindings for arm64
Reviewed by:	mhorne, markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39956
2023-05-23 17:19:25 +03:00
Christos Margiolis
db05f9fbfb dtrace: implement dtrace_instr_size() for arm64
Reviewed by:	markj
Approved by;	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39955
2023-05-23 17:19:15 +03:00
Christos Margiolis
27ff920e6a dtrace: remove ifdef around dtrace_instr_size()
Architectures that are not included in the #ifdef won't be able to
compile libdtrace. This was tested on an ARM64 build. If the ifdef is
removed, libdtrace can be compiled with no problems, otherwise it fails
at libdtrace.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39948
2023-05-23 17:19:04 +03:00
Christos Margiolis
1e136a9cbd dtrace(1): add -d flag to dump D script post-dt_sugar
By specifying the -d flag, libdtrace will dump the D script after it has
applied syntactical sugar transformations (e.g if/else). This is useful
for both understanding what dt_sugar does, as well as debugging it.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38732
2023-05-23 17:18:39 +03:00
Kristof Provost
81877287a9 if_ovpn: ensure we never re-use sequence numbers
if_ovpn already notified userpsace when there was a risk of sequence
number re-use, but it trusted userspace to actually rotate the key.

Convert the internal sequence number counter to 64 bits so we can detect
overflows and then refuse to send packets.

Event:		BSDCan 2023
Reviewed by:	Leon Dang <ldang@netgate.com>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40187
2023-05-23 16:11:26 +02:00
Kristof Provost
c4a32455d9 pf: remove the use of caddr_t
Replace caddr_t with void *, or more accurate types.

Suggested by:	glebius
Reviewed by:	zlei
Differential Revision:	https://reviews.freebsd.org/D40186
2023-05-23 16:11:13 +02:00
Christos Margiolis
ecca318085 kinst: replace KINST_TRAMP_INIT
The current implementation of KINST_TRAMP_INIT is working only on amd64,
where the breakpoint instruction is one byte long, which might not be
the case for other architectures (e.g in RISC-V it's either 2 or 4
bytes). This patch introduces two machine-dependent constants,
KINST_TRAMP_FILL_PATTERN and KINST_TRAMP_FILL_SIZE, which hold the fill
instruction and the size of that instruction in bytes respectively.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39504
2023-05-23 16:58:36 +03:00
Mitchell Horne
940e6d36de riscv: Print less CPU info
Change the reporting strategy to more closely follow what arm64
implements:
 - Always print the one-line CPU summary when a core comes online
 - Only print the additional fields (e.g. ISA) when they differ from the
   CPU before it

In the common case of identical CPUs this results in informative but
non-repetitive output. For example, in QEMU:

  CPU 0  : Vendor=Unspecified Core=Unknown (Hart 0)
    marchid=0x80032, mimpid=0x80032
    MMU: 0x7<Sv39,Sv48,Sv57>
    ISA: 0x112d<Atomic,Compressed,Double,Float,Mult/Div>
  real memory  = 8589934592 (8192 MB)
  avail memory = 8332300288 (7946 MB)
  FreeBSD/SMP: Multiprocessor System Detected: 6 CPUs
  CPU 1  : Vendor=Unspecified Core=Unknown (Hart 1)
  CPU 2  : Vendor=Unspecified Core=Unknown (Hart 2)
  CPU 3  : Vendor=Unspecified Core=Unknown (Hart 3)

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40024
2023-05-23 10:19:46 -03:00
Mitchell Horne
7245ffd10e riscv: MMU detection
Detect and report the supported MMU for each CPU. Export the
capabilities to the rest of the kernel and use it in pmap_bootstrap() to
check for Sv48 support.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39814
2023-05-23 10:19:26 -03:00
Mitchell Horne
78a3420c20 riscv: Print ISA extensions
Report the CPU's single-letter ISA extensions in printcpuinfo().

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39813
2023-05-23 10:19:26 -03:00
Mitchell Horne
b37dc09033 riscv: Rework CPU identification (second part)
Modify when and how we perform parsing and reporting. Most notably,
everything now executes on CPU 0.

The de-facto standard way to enumerate CPU features (ISA extensions) on
RISC-V is by parsing each CPU's ISA string. We currently obtain this
information from the device tree, and in the future will be able to pull
it from ACPI tables.

Eliminate the SYSINIT from identcpu.c. We still need to walk the /cpus
list in the device tree, but now do this one CPU at a time, as a step in
the identify_cpu() procedure. This is slightly less error prone, and
allows us to parse ISA features for CPU 0 much earlier.

Make use of the SMP hooks cpu_mp_start() and cpu_mp_announce() to
identify and print secondary CPU info, respectively. This causes
secondary processor identification to be printed much earlier in boot;
everything is done by SI_SUB_CPU, SI_ORDER_THIRD. Adjust some other
printf() calls so that we get enough useful info to debug under
bootverbose.

Reviewed by:	markj (slightly earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39811
2023-05-23 10:06:29 -03:00
Mitchell Horne
b0d45b023e riscv: Call identify_cpu() earlier for CPU 0
It is advantageous to have knowledge of ISA features as early as
possible. For example, the presence of newer virtual memory extensions
may be useful to pmap_bootstrap().

To achieve this, split out the printf() parts of identify_cpu() into a
separate function, printcpuinfo(). This latter function will be called
later in boot after the console has been initialized.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39810
2023-05-23 10:00:25 -03:00
Mitchell Horne
88b4d124ef riscv: Rework CPU identification (first part)
Make better use of the RISC-V identification CSRs: mvendorid, marchid,
and mimpid. This code was written before these registers were
well-specified, or even available to the kernel. It currently fails to
recognize any CPU or platform.

Per the privileged specification, mvendorid contains the JEDEC vendor ID,
or zero.

The marchid register denotes the CPU microarchitecture. This is either
one of the globally allocated open-source implementation IDs, or the
field has a custom encoding. Therefore, for known vendors (SiFive) we
can also maintain a list of known marchid values. If we can not give a
name to the CPU but marchid is non-zero, then just print its value in
the report.

The mimpid (implementation ID) could be used in the future to more
uniquely identify the micro-architecture, but it really remains to be
seen how it gets used. For now we just print its value.

Thank you to Danjel Qyteza <danq1222@gmail.com> who submitted an early
version of this change to me, although it has been almost entirely
rewritten.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39809
2023-05-23 10:00:25 -03:00
Christos Margiolis
6265da14c9 libdtrace: get rid of illumos ifdefs in dt_module_update(), fix dm_file and dm_modid
Because dt_module_update() is highly OS-specific, the ifdefs make it
hard to read and follow what is going on. Also handle dm_modid, and
remove handling of the ".filename" section, since we can easily fetch
the filename from the module's pathname (k_stat->pathname).

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39177
2023-05-23 15:54:58 +03:00
Mike Karels
1082307434 pwd.1: replace /home with /sys in example
The default location for home directories is moving from /usr/home
to /home, and the /home symlink will no longer exist.  Switch to
another example that is in base, /sys.

Reviewed by:	fernape
Differential Revision:	<https://reviews.freebsd.org/D40204
2023-05-23 07:21:50 -05:00
Mike Karels
9a6a948128 hier.7: update /home
The default for home directories is changing from /usr/home to
/home; update the corresponding entries.  Also move /home into
alphabetical order.

Reviewed by:	mhorne, manpages(bcr)
Differential Revision:	https://reviews.freebsd.org/D40203
2023-05-23 07:21:12 -05:00
Mike Karels
d3c32c80a1 release/tools/vmimage.subr: switch zfs dataset from /usr/home to /home
Change the vmimage script for zfs to create /home as a dataset
rather than /usr/home, ala change to bsdinstall's zfs script.

Reviewed by:	markj
Differential Revision:	<https://reviews.freebsd.org/D40111
2023-05-23 07:18:58 -05:00
Mike Karels
3bb92304b4 bsdinstall on zfs: create dataset for /home rather than /usr/home
Now that pw (hence adduser and the initial install) use /home for
user home directories rather than /usr/home, create a dataset for
/home rather than /usr/home.  Update the man page to match.

Reviewed by:	rgrimes, markj
Differential Revision:	https://reviews.freebsd.org/D40086
2023-05-23 07:18:27 -05:00
Mike Karels
bbb2d2ce42 pw: do not move /home/$user to /usr/home
When adding a user, pw will create the path to the home directory
if needed.  However, if creating a path with just one component,
i.e.  that appears to be in the root directory, pw would create the
directory in /usr, and create a symlink from the root directory.
Most commonly, this meant that the default of /home/$user would turn
into /usr/home/$user.  This was added in a self-described kludge 26
years ago.  It made (some) sense when root was generally a small
partition, with most of the space in /usr.  However, the default is
now one large partition.  /home really doesn't belong under /usr,
and anyone who wants to use /usr/home can specify it explicitly.
Remove the kludge to move /home under /usr and create the symlink,
and just use the specified path.  Note that this operation was
done only on the first invocation for a path, and this happened most
commonly when adding a user during the install.

Modify the test that checked for the creation of the symlink to
verify that the symlink is *not* made, but rather a directory.
Add a test that intermediate directories are still created.

Reviewed by:	rgrimes, bapt
Differential Revision:	https://reviews.freebsd.org/D40085
2023-05-23 07:17:42 -05:00
Martin Matuska
c0a83fe074 zfs: merge openzfs/zfs@ad0a55461
Notable upstream pull request merges:
  #12355 Teach zpool scrub to scrub only blocks in error log
  #14811 Refine special_small_blocks property validation
  #14854 zil: Some micro-optimizations
  #14855 zil: Free lwb_buf after write completion
  #14860 Fixes for issues identified by recent Coverity defect reports
  #14861 Probe vdevs before marking removed
  #14873 Add the ability to uninitialize a zpool
  #14875 Hold db_mtx when updating db_state

Obtained from:	OpenZFS
OpenZFS commit:	ad0a554614
2023-05-23 11:51:52 +02:00
Xin LI
634a770a5e /etc/rc.d/motd: Update to accommodate changes in uname(1) and newvers.sh
The recent changes to the uname(1) command removed trailing spaces for
better POSIX conformance, but it broke the regular expression used by
the motd script which expected it.  This commit addresses this by removing
the requirement, as it is no longer present.

Additionally, a recent change in newvers.sh introduced a new format for
uname -v, which omited the build number and build dates to improve
reproducible build support.  This commit adds support for this new format.

Reported-by:	Jamie Landeg-Jones <jamie@catflap.org>
Reviewed-by:	imp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40225
2023-05-22 22:05:35 -07:00
Rose
5a9c724847 Correct size parameter to strncmp
The wrong value passed to strncmp meant that only enable and disable were being
accepted. This change corrects the logic so enabled and disabled are also
accepted.

Pull Request: https://github.com/freebsd/freebsd-src/pull/739
MFC after: 1 week
Reviewed by: delphij, ngie
2023-05-22 18:16:29 -07:00
Christos Margiolis
cef2565587 dtrace: export dtrace_dis_get_byte()
kinst uses this function as well, but because it is not exported, it
implements its own copy of it. The patch also exposes the function to
userland, so programs that need to use dtrace_disx86() can use this
function instead of rolling their own copies.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39871
2023-05-22 23:21:25 +03:00
Christos Margiolis
3c6fb586b9 riscv: do not duplicate sd of tp
Reviewed by:	jhb
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39894
2023-05-22 23:03:06 +03:00
Christos Margiolis
136b8bd610 arm64: use PSR_DAIF instead of each individual flag
No functional change intended.

Reviewed by:	mhorne, andrew
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D40165
2023-05-22 22:49:33 +03:00
Christos Margiolis
94fe28babf Add christos as a src committer and markj as mentor
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D40210
2023-05-22 22:49:32 +03:00
Christos Margiolis
0c08479898 git-arc: mention creation of separate reviews in man page
Reviewed by:	imp
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D39963
2023-05-22 22:49:32 +03:00
Christos Margiolis
0688eac1f9 git-arc: fix spelling error in -s option
Reviewed by:	imp
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D39962
2023-05-22 22:49:32 +03:00
Kyle Evans
172af24449 arm64: gicv3: setup PPIs on all APs after they're online
For all PPIs setup earlier than SI_SUB_SMP, PIC_INIT_SECONDARY ends up
cleaning these up for each AP as it comes online.  Once they're online,
we don't currently do anything to make sure they're configured for other
APs.  Fix it by using smp_rendezvous for the meaty bits of configuring a
PPI, which will just do single-thread behavior before APs are online but
do the right thing for other CPUs after.

While we're here, make sure redistributor config is correct for other
APs as they come online in gic_v3_init_secondary.

Reported/Tested by:	Souradeep Chakrabarti (Microsoft/Hyper-V)
Reviewed by:		andrew (before slight refactor)
Differential Revision:	https://reviews.freebsd.org/D40112
2023-05-22 10:23:53 -05:00
Alexander V. Chernikov
26056fa8d3 Revert "ifconfig: switch IPv4/IPv6 address manipulations to Netlink"
Revert the change as 2 non-expected issues have been reported.

This reverts commit 54418f79fd.
2023-05-22 15:17:57 +00:00
Alexander V. Chernikov
454d72ec40 Revert "ifconfig: Fix the build"
This reverts commit 5b8ce85e1a.
2023-05-22 15:17:45 +00:00
Mark Johnston
5b8ce85e1a ifconfig: Fix the build
Fix indentation in warn_nomask() while here.

Fixes:	54418f79fd ("ifconfig: switch IPv4/IPv6 address manipulations to Netlink")
2023-05-22 10:53:38 -04:00
Kristof Provost
af15ae9dd1 prepare-commit-msg: add 'Event'
Add 'Event' to the pre-commit template.

The key word is already documented at
https://docs.freebsd.org/en/articles/committers-guide/#_include_appropriate_metadata_in_a_footer

Suggested by:	imp@
Event:		BSDCan 2023
Differential Revision:	https://reviews.freebsd.org/D40184
2023-05-22 16:01:09 +02:00
Konstantin Belousov
6f49eafb05 libthr rtld locks: do not leak URWLOCK_READ_WAITERS into child
Since there is only the current thread in the child, no pending readers
exist.  Clear the bit, since it confuses future attempts to acquire
write ownership of the rtld locks, due to URWLOCK_PREFER_READERS flag.

To be future-proof, clear all state about pending writers and readers.

PR:	271490
Reported and tested by:	KJ Tsanaktsidis <kj@kjtsanaktsidis.id.au>
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40178
2023-05-22 16:46:42 +03:00
Alexander V. Chernikov
54418f79fd ifconfig: switch IPv4/IPv6 address manipulations to Netlink
Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D40182
2023-05-22 13:45:33 +00:00
Alexander V. Chernikov
050815ae7f netlink: call IPv6 hook when adding IPv4 addresses.
This provides compatibility with ifioctl() version of SIOCAIFADDR.
This change is temporary until the IPv4/IPv6 address handling code
 is moved to netinet[6].
2023-05-22 13:42:28 +00:00
Mark Johnston
e3f7081b1c fusefs: Remove an unused pbuf zone
The zone has been dead ever since commit
b9e2019755 ("fusefs: rewrite vop_getpages and vop_putpages")

No functional change intended.

Reviewed by:	asomers
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D40143
2023-05-22 09:33:57 -04:00
Hans Petter Selasky
47c887be4a Revert "mlx4: Move DEFINE_MUTEX() outside function body."
Requested by:	jrtc27@

This reverts commit 805d759338.
2023-05-22 12:53:38 +02:00
Dag-Erling Smørgrav
c8d84fa75e pam_tacplus: Mention nss_tacplus in the manual page.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D40135
2023-05-22 10:14:52 +00:00
Dag-Erling Smørgrav
6c5cdba1ba Add nss_tacplus, a TACACS+ NSS module.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D40133
2023-05-22 10:14:52 +00:00
Dag-Erling Smørgrav
951beab15d taclib: 0 (not set) is a valid auth type in authorization requests.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	rew
Differential Revision:	https://reviews.freebsd.org/D40132
2023-05-22 10:01:04 +00:00