Commit graph

20710 commits

Author SHA1 Message Date
Lexi Winter 961bcbeef2 mailwrapper(8): change behaviour if mailer.conf cannot be opened
Previously, mailwrapper(8) would default to invoking _PATH_DEFAULTMTA
(i.e., dma) if mailer.conf couldn't be opened for any reason, including
transient errors like ENFILE.  This behaviour is undesirable, because if
the administrator has configured a different MTA in mailer.conf, they
almost certainly don't want mailwrapper to unpredictably fall back to
the compiled-in default; and in any case, the default MTA is probably
not running, meaning the mail may be queued and then never delivered,
which is worse than not accepting it to begin with.

Change this behaviour depending on why mailer.conf can't be opened:

- If it doesn't exist, keep the existing behaviour of falling back to
  the default MTA, on the assumption that this is a reasonable default
  if mailer.conf hasn't been configured at all.

- If it cannot be opened for any other reason, do not invoke an MTA and
  instead return an error to the caller.

PR: 25218
Reviewed by: imp, emaste, markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/969
2024-04-19 16:20:44 -06:00
Fernando Apesteguía d3b6d70e0d freebsd-update(8): Use kern.module_path
Instead of tailored configuration files to look for module_path entries.

Reported by:		kevans@
Reviewed by:		kevans, imp, zlei
Approved by:		kevans,zlei
Differential Revision:	https://reviews.freebsd.org/D44797
2024-04-19 18:57:11 +02:00
Dag-Erling Smørgrav 170d088290 adduser: Overhaul.
Most importantly:

* Make local variables local.
* Use `$()` instead of backticks.
* Avoid unsafe use of `-a` and `-o` operators in `test` expressions.
* Remove a hack intended to ease the transition from Perl 22 years ago.

MFC after:	1 week
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44863
2024-04-19 17:13:30 +02:00
Martin Tournoij f122045e36 crunchgen: add --list option
"bsdbox --list" will print all tools in the binary, one per line. The
main use case for this is to make it easier to create links:

	for t in $(bsdbox --list); do
		ln -s bsdbox $t
	done

The name --list was taken from busybox.

This just adds a new "program" with the name "--list". I don't think we
need to do real argument parsing here, and this is also how busybox does
it.

An additional minor change is that just "bsdbox" will no longer print
the binary name itself ("bsdbox" in this case). Before it would do:

	% bsdbox
	usage: boxlike <prog> <args> ..., where <prog> is one of:
	 cp ls mv bsdbox

And now just:

	% bsdbox
	usage: boxlike <prog> <args> ..., where <prog> is one of:
	 cp ls mv

And just "bsdbox" will also exit with code 0 (and print to stdout)
rather than exit with 0 and print to stderr

Example output:

	% ./bsdbox
	usage: bsdbox program [args ...]
	       bsdbox --list
	       program [args ...]

	bsdbox combines several programs in one executable. Create a link to this
	executable with the program name to run that program, or give the program
	name as the first argument.

	Currently defined programs:
	 true false tail head uname

	% ./bsdbox --list
	true
	false
	tail
	head
	uname

	% ./bsdbox uname -a
	FreeBSD freebsd 13.2-RELEASE-p4 FreeBSD 13.2-RELEASE-p4 GENERIC amd64

	% ln -s bsdbox uname
	% ./uname -a
	FreeBSD freebsd 13.2-RELEASE-p4 FreeBSD 13.2-RELEASE-p4 GENERIC amd64

Pull Request:	https://github.com/freebsd/freebsd-src/pull/894
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/894
2024-04-17 12:07:25 -06:00
Mark Johnston 9d975e47d5 exports.5: Clarify that exported dirs should be local mount points
If not, then in general the entire filesystem containing the exported
directory is accessiable.  This may be surprising, so try to make it
more clear.

Reviewed by:	rmacklem, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44614
2024-04-16 18:27:02 -04:00
Mark Johnston 88d09ddea0 exports.5: Update an example to use service(8)
MFC after:	1 week
2024-04-16 18:25:19 -04:00
Ed Maste 73cce7d888 mergemaster: postpone removal to FreeBSD 15
Mergemaster has been deprecated for quite some time, but was not
removed prior to FreeBSD 14.0.  Update the deprecation notice in the man
page to reflect this.

PR:		274967
Reported by:	naddy
Sponsored by:	The FreeBSD Foundation
2024-04-16 10:19:14 -04:00
Ed Maste 40b57cb616 tzsetup: be explicit about *timezone* abbreviation
During the install process tzsetup asks a question like

    Does the abbreviation `EDT' look reasonable?

The installer asks lots of questions, some that relate to the previous
screen or topic and some that do not.  A new user installed FreeBSD for
the first time and was confused by this question, not realizing that it
was asking whether the abbreviation is correct for the selected
timezone.

Reviewed by:	bapt, brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44500
2024-04-16 09:55:46 -04:00
Fernando Apesteguía bc0c6c9cf3 freebsd-update: Add check for kernel modules
People get confused when some software (VirtualBox, etc) does not work as
expected (or at all) after a major upgrade.

We have a nice way to deal with this when using sources, namely including
PORTS_MODULES in /etc/make.conf, but we lack something similar for binary
updates.

This patch retrieves a list of kernel modules installed from packages and
advises the user to recompile from ports to avoid problems.

Approved by:		zlei@
Differential Revision:	https://reviews.freebsd.org/D39695
2024-04-14 19:46:23 +02:00
Mathieu bbc6e6c5ec daemon: fix -R to enable supervision mode
If we're doing restarts, then we must supervise -- the 'R' case simply
got missed.

PR:	278342
Fixes:	f907027b49 ("daemon: set supervise_enabled during [..]")
2024-04-13 22:12:36 -05:00
Collin Funk 52a19a90de kldxref: Prefer sys/cdefs.h __unreachable over the builtin
The __builtin_unreachable macro provided by Clang and GCC is a hint to
the compiler used for optimization. The programs work fine even if the
compiler doesn't support it. The sys/cdefs.h has had __unreachable for
9 years (commit 732b31de5d). It expands
to the builtin if it is available. In the rare case that it is
unsupported it expands to a null statement so compilation does not
fail.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed by: imp, freebsd@igalic.co
Pull Request: https://github.com/freebsd/freebsd-src/pull/1117
2024-04-12 16:39:25 -06:00
Collin Funk f7a10a7752 daemon: Prefer sys/cdefs.h __unreachable over the builtin
The __builtin_unreachable macro provided by Clang and GCC is a hint to
the compiler used for optimization. The programs work fine even if the
compiler doesn't support it. The sys/cdefs.h has had __unreachable for
9 years (commit 732b31de5d). It expands
to the builtin if it is available. In the rare case that it is
unsupported it expands to a null statement so compilation does not
fail.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed by: imp, freebsd@igalic.co
Pull Request: https://github.com/freebsd/freebsd-src/pull/1117
2024-04-12 16:39:18 -06:00
rilysh 16e5eb212f fdwrite.c: initialize pointers to NULL and a few other cleanups
1. Both trackbuf and vrfybuf are initialized to
zero (NULL). While it's okay to initialize pointers
to zero, to keep consistency, as they're explicitly
pointers, it's better to just use NULL ((void *)0)
instead of 0 (both are equivalent to the compilers).

2. Call free() for both trackbuf and vrfybuf after
their job has been done.

3. Remove the register keyword. Compilers generally
ignore this keyword (except for very very old compilers
and CPUs).

4. Remove the ctype.h header. It's not being used
anywhere in the file.

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1059
2024-04-11 12:24:36 -06:00
John Grafton 215c0a5158 adduser(8): support creation of ZFS dataset
On systems utilizing ZFS, default to creating a ZFS dataset for a new
user's home directory if the parent directory resides on a ZFS dataset.
Add a flag that disables this behavior if the administrator explicitly
does not want it.

If run during installation from within a chroot, set mountpoint to legacy
after dataset creation and mount directly into the chroot.  Then umount
and reset the mountpoint to inherit from parent.

Also support ZFS default encryption on user's home directory.

Feedback by: delphij
Reviewed by: imp, kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/881
2024-04-11 12:13:05 -06:00
Elyes Haouas ec8a394d9c usr.sbin: Remove repeated words
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/887
2024-04-11 11:53:37 -06:00
Elyes Haouas c384235c16 mergemaster: Fix typo
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/882
2024-04-11 11:40:47 -06:00
Elyes Haouas 6addf2595e inetd: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/882
2024-04-11 11:40:44 -06:00
Elyes Haouas dc8725726d pnfsdscopymr: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/882
2024-04-11 11:40:42 -06:00
Elyes Haouas e57d2e4aee crunch: Fix typo
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/882
2024-04-11 11:40:40 -06:00
Elyes Haouas 068e918057 manctl: Fix typo
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/882
2024-04-11 11:40:37 -06:00
Elyes Haouas 5ef49c7820 zonectl: Fix a typo
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/882
2024-04-11 11:40:35 -06:00
Jessica Clarke 014d7082a2 bhyve: Implement a PL031 RTC on arm64
Unlike amd64's, this RTC is implemented entirely in userspace. This is
the same RTC as is provided by QEMU's virt machine.

Reviewed by:	jhb
MFC after:	2 weeks
Obtained from:	CheriBSD
2024-04-10 11:17:56 -04:00
Jessica Clarke e3bd5730ca bhyve: Extract uart-clock from fdt_add_uart as an apb-pclk
This clock will also be used by the PL031 RTC (rather than defining
redundant per-device clocks).

Reviewed by:	jhb
MFC after:	2 weeks
Obtained from:	CheriBSD
2024-04-10 11:17:56 -04:00
Jessica Clarke 4dfa329f48 bhyve: Extend mevent to support updating timers
This will be used by a new PL031 implementation to provide an RTC for
arm64 guests.

Reviewed by:	jhb
MFC after:	2 weeks
Obtained from:	CheriBSD
2024-04-10 11:17:56 -04:00
Jessica Clarke 95b948c1d1 bhyve: Fix arm64 PCI I/O range to match FDT
This is supposed to combine with the memory range to make one contiguous
block, as is laid out in the FDT, so make this match what the OS is told
and thus actually configures.

Also drop the confusing leading zero from all three of these constants
that is making these 9 rather than 8 hex digits long (as one would
expect for a 32-bit address).

Reviewed by:	jhb
MFC after:	2 weeks
Obtained from:	CheriBSD
2024-04-10 11:17:56 -04:00
Jessica Clarke 0efad4aceb bhyve: Support legacy PCI interrupts on arm64
This allows us to remove various #ifdef hacks and enable building more
PCI devices.

Note that a hole is left in the interrupt mapping for the RTC rather
than having the two core devices straddle the PCIe interrupts. QEMU's
virt machine also takes this approach.

Reviewed by:	jhb
MFC after:	2 weeks
Obtained from:	CheriBSD
2024-04-10 11:17:56 -04:00
Mark Johnston 981f9f7495 bhyve: Push option parsing down into bhyverun_machdep.c
After a couple of attempts I think this is the cleanest approach despite
the expense of some code duplication.  Quite a few of the single-letter
bhyve options are x86-specific.

I think that going forward we should strongly discourage the addition of
new options and instead configure guests using the more general
configuration file syntax.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D41753
2024-04-10 11:17:56 -04:00
Mark Johnston 11c79f9e35 arm64: Connect bhyve and libvmmapi to the build
Reviewed by:	corvink, andrew, jhb, emaste
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D41742
2024-04-10 11:17:56 -04:00
Mark Johnston 4bb929cc6d bhyve: Partially disable INT#x support in virtio for arm64
A FreeBSD guest won't make use of this support and pci_lintr_* is not
implemented on arm64.  Simply make pci_lintr_*() calls amd64-specific
for now.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D41741
2024-04-10 11:17:56 -04:00
Mark Johnston dc6a00f2e4 bhyve: Use vm_raise_msi() instead of vm_lapic_msi()
No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D41740
2024-04-10 11:17:56 -04:00
Mark Johnston f286f746f4 bhyve: Add PCI mappings for arm64
- The extended config space and BAR ranges are listed in the FDT.
- Avoid referencing I/O ports in ACPI tables.  Currently the arm64 port
  does not support ACPI in any case.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D41739
2024-04-10 11:17:56 -04:00
Mark Johnston fc98569fc3 bhyve: Do not compile PCI passthrough support on arm64
Some required kernel functionality is not yet implemented.

For now this means that one cannot specify host PCI register values, but
that functionality is only used by amd64-specific device models for now.
Note that this limitation is rather artificial; it arises only because
pci_host_read_config() lives in pci_passthru.c.

Reviewed by:	corvink, andrew, jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D41738
2024-04-10 11:17:56 -04:00
Andrew Turner ff50e9d53f bhyve: Add bhyverun and vmexit handlers for arm64
Reviewed by:	corvink, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D41006
2024-04-10 11:17:56 -04:00
Mark Johnston e497fe8657 bhyve: Use vm_get_highmem_base() instead of hard-coding the value
This reduces the coupling between libvmmapi (which creates the highmem
segment) and bhyve, in preparation for the arm64 port.

No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40992
2024-04-10 11:17:55 -04:00
Mark Johnston eaff4c4f92 bhyve: Add FDT building code for arm64
fdt.c provides some basic routines which let platform initialization
code build the FDT that gets passed into the guest.  For now this is not
very generic; we declare info about CPUs, memory, a single UART
(specified by -o console), a PCIe controller (used for virtio devices),
an interrupt controller and the platform timer.

Co-authored-by:	andrew
Reviewed by:	corvink, jhb
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40996
2024-04-10 11:17:55 -04:00
Mark Johnston d878f72a73 bhyve: Provide optional libfdt linking
The arm64 port currently does not support ACPI, it instead builds up an
FDT which is exported to the guest.  This mechanism will not be used on
amd64 but isn't really arm64-specific either, so provide an opt-in
mechanism to link libfdt.

No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40995
2024-04-10 11:17:55 -04:00
Andrew Turner f3003a0dfb bhyve: Add PL011 UART emulation
This will be use for arm64 guests, instead of the existing ns16550 UART
model.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D40997
2024-04-10 11:17:55 -04:00
Konstantin Belousov 1e6db7be69 pciconf(8): dump AMD IOMMU Base Capability
Reviewed by:	emaste
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44732
2024-04-10 08:28:24 +03:00
Lexi Winter 493908c4b4 periodic/daily/801.trim-zfs: Add a daily zfs trim script
As mentioned in zpoolprops(7), on some SSDs, it may not be desirable to
use ZFS autotrim because a large number of trim requests can degrade
disk performance; instead, the pool should be manually trimmed at
regular intervals.

Add a new daily periodic script for this purpose, 801.trim-zfs.  If
enabled (daily_trim_zfs_enable=YES; the default is NO), it will run a
'zpool trim' operation on all online pools, or on the pools listed in
'daily_trim_zfs_pools'.

The trim is not started if the pool is degraded (which matches the
behaviour of the existing 800.scrub-zfs script) or if a trim is already
running on that pool.  Having autotrim enabled does not inhibit the
periodic trim; it's sometimes desirable to run periodic trims even with
autotrim enabled, because autotrim can elide trims for very small
regions.

PR:		275965
MFC after:	1 week
Reviewed by:	imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/956
2024-04-09 15:55:11 -06:00
Rick Macklem cce11997a0 mountd.8: Document the new -A mountd option
Commit fefb7c399b added warning messages noting
that administrative controls that exported directories
that are not local server file system mount points actually
export the entire local server file system.
This commit also added a new command line option "-A' that
silences these warnings.

This patch documents the new "-A' mountd option.

This is a content change.

Reviewed by:	markj, pauamma_gundo.com (manpages)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44692
2024-04-08 18:58:40 -07:00
Rob Norris b9fa1500cb bhyvectl: generate usage from options table
The usage text had fallen out of sync with the actually available
options. Rather than keep them in sync by hand, just generate usage from
the available options.

Signed-off-by: Rob Norris <robn@despairlabs.com>

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44641
2024-04-08 09:08:54 -04:00
Rick Macklem 401c0f8aa1 exports.5: Add RFC number for NFS over TLS
This is a content change.

MFC after:	1 week
2024-04-07 16:35:55 -07:00
Konstantin Belousov f1519a8229 acpidump: add Foundation copyright
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-04-05 18:17:55 +03:00
Konstantin Belousov 6d789b6126 acpidump: dump AMD IVRS table describing IOMMU layout
Reviewed by:	markj
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44634
2024-04-05 18:17:55 +03:00
Konstantin Belousov 969a4b8be5 acpidump: add printfield() helper
Reviewed by:	markj
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44634
2024-04-05 18:17:55 +03:00
Konstantin Belousov 29a6b72775 acpidump: bump WARNS to 6
and disable warnings about unused function args coming from the vendor
acpi headers.

Reviewed by:	markj
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44634
2024-04-05 18:17:55 +03:00
Konstantin Belousov 4262ad56a0 acpidump: the acpi_get_fadt_revision() argument is unused
everywhere except i386.

Reviewed by:	markj
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44634
2024-04-05 18:17:55 +03:00
Konstantin Belousov de937ecb75 acpidump: silent the warning about unaligned uuid
The field comes from the ACPI NFIT table and must be already properly
aligned by BIOS (at least so is written in the spec).

Reviewed by:	markj
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44634
2024-04-05 18:17:55 +03:00
Yan-Hao Wang 1caa5d0861
efitable(8): Complete libxo transition
Reviewed by:	des
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D41411
2024-04-04 02:32:00 +08:00
SHENG-YI HONG 861f5b95b3
acpidump(8) Fix typo in error message
acpidump(8) uses iasl(8) to parse acpi information.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44596
2024-04-03 01:28:23 +08:00
a-biardi 9181171162 freebsd-update: Fix typo in comment
s/patchname expansion/pathname expansion/

Signed-off-by: a.biardi@tiscali.it
Pull-request: https://github.com/freebsd/freebsd-src/pull/1152
2024-04-02 08:44:56 -04:00
Philipp Ost 2db2566f55 fwget: Add needed firmware for Radeon 780M GPU
PR:	278115
2024-04-02 07:38:00 +02:00
Rick Macklem fefb7c399b mountd.c: Add warning messages for administrative controls
When "administrative controls" (which are exports of subdirectories
within a NFS server's local file system) are used, they export the
entire local server file system. (The subdirectory only applies to
the Mount protocol used for NFSv3 mounts.)

To minimize the risk that this causes confusion w.r.t. what is exported
to NFS client(s), this patch generates warning messages for these.
Only one message is generated for each server local file system.
The messages can be silenced via a new "-A" command line option.

The mountd.8 man page will be patched via a separate commit.

Reviewed by:	emaste, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D44502
2024-03-31 12:00:08 -07:00
Emmanuel Vadot 0cade55660 pkgbase: Remove FreeBSD-ipfilter package
Put the periodic script for ipfilter in the FreeBSD-ipf package with
all the utilities.

PR:	278042
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-03-30 09:39:52 +01:00
Mike Karels 970ea0b2cb bsdinstall: draw attention to new network config options
The network configuration options have changed in bsdinstall, with
an Auto option to proceed directly to DHCP and IPv6 autoconfig (which
is the default) as well as Manual (the old mode).  For users like me
that were used to hitting return automatically to select an interface,
but want manual configuration, attempt to call out the difference:
Change the menu caption to say "Please select a network interface
and configuration mode:" and not just an interface.

Reviewed by:	jrtc27
2024-03-27 15:20:26 -05:00
Mark Peek 3fed4f0db5 certctl: Revert to symlinks.
Unfortunately tar will not be able to extract base.txz to a system where
/etc and /usr are not on the same filesystem if the certificates are
hard links.

PR:		277828
Reviewed by:	mp
Differential Revision:	https://reviews.freebsd.org/D44496
2024-03-25 16:59:02 +01:00
Mark Peek 65904399db efibootmgr: allow -u as a valid option
PR:		277907
Reported by:	vsasjason@gmail.com
MFC after:	1 week
2024-03-24 12:37:12 -07:00
Mark Johnston d1c5d0cfcc bhyve: Move device model-independent UART code into a separate file
Currently bhyve implements a ns16550-compatible UART in uart_emul.c.
This file also contains generic code to manage RX FIFOs and to handle
reading from and writing to a TTY.  bhyve instantiates UARTs to
implement COM devices (via pci_lpc.c) and PCI UART devices.

The arm64 port will bring with it a PL011 device model which is used as
the default console (i.e., no COM ports).  To simplify its integration,
add a UART "backend" layer which lets UART device models allocate an RX
FIFO and interact with TTYs without duplicating code.  In particular,
code in uart_backend.* is to be shared among device models, and the
namespace for uart_emul.* is changed to uart_ns16550_*.

This is based on andrew@'s work in
https://github.com/zxombie/freebsd/tree/bhyvearm64 but I've made a
number of changes, particularly with respect to naming and source code
organization.

No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40993
2024-03-21 01:04:48 -04:00
Konstantin Belousov 8eaa6be80d daemon(8): handle case of waitpid() returning without exited child
Not checking for either WIFEXITED(status) or zero result results in
never finishing the loop.

PR:	277764
Reviewed by:	kevans (previous version)
Discussed with:	Daniel Tameling
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44401
2024-03-20 03:07:00 +02:00
John Baldwin 785600d0fb kldxref: Properly handle reading strings near the end of an ELF file
If a string is at or near the end of an input file and the amount of
remaining data in the file is smaller than the maximum string size,
the pread(2) system call would return a short read which is treated as
an error.  Instead, add a new helper function for reading a string
which permits short reads so long as the data read from the file
contains a terminated string.

Reported by:	jrtc27
Reviewed by:	jrtc27
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D44419
2024-03-18 17:01:23 -07:00
Rick Macklem 8f13abb4fd nfsd.8: Document ways to minimize Copy operation times
For NFSv4.2, a Copy operation can take a long time to complete.
If there is a concurrent ExchangeID or DelegReturn operation
which requires the exclusive lock on all NFSv4 state, this can
result in a stall of the nfsd server.

This patch documents ways to avoid this problem.

This is a content change.

Reviewed by:	karels, wollman, pauamma_gundo.com (manpages)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D44395
2024-03-18 15:40:41 -07:00
Michael Osipov 85c3ef77cc freebsd-update: mark "cron" as fetched as "fetch" itself
The change in 33bd05c318 was incomplete
because it did not mark "cron" as ISFETCHED=1 although it performs the
same operations as "install", but less output and does not perform a
hard exit. Mark result as such and make "install" know that updates have
been fetched.

PR:		277699
Approved by:	jrm (mentor), emaste, cperciva
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D44356
2024-03-18 11:01:59 +01:00
Michael Osipov 59b02bb420 freebsd-update: Don't provide copiable commands in output
Previously, freebsd-update provided ready-to-go commands for copying and
pasting into the terminal. This causes problems as soon as options are
used and not supplied again by the user, e.g., '-b' or '-d'.
Stop making them copiable and force the user to construct a valid command
line by himself to avoid failures.

PR:		276102
Approved by:	jrm (mentor), emaste
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43700
2024-03-18 10:33:42 +01:00
Jamie Gritton d50685b303 jail: add the -C flag to clean up after a partially removed jail
Differential Revision:	https://reviews.freebsd.org/D42670
2024-03-16 22:11:14 -07:00
Jessica Clarke 75464941dc kldxref: Fix bootstrapping on macOS with Clang 16 / Apple Clang 15
macOS, like Linux, does not include an outer const qualifier for its
fts_open callback arguments, so -Wincompatible-function-pointer-types
also picks this up and breaks the build now Clang 16 makes it an error
by default. Extend the existing Linux support to fix this.

MFC after:	1 week
2024-03-16 01:50:21 +00:00
Kyle Evans 6e2cfb24ee crunchgen: slap a dependency on the generated makefile for .lo
crunchgen generates a foo.lo for each binary it will end up crunching
into the final product.  While they have a dependency on the libs that
are used to link them, nothing will force relinking if the set of libs
needed to link them is changed.  Because of this, incremental builds may
not be possible if one builds a version of, e.g., rescue/ with a broken
set of libs specified for a project -- a subsequent fix won't be rolled
in cleanly, it will require purging the rescue/ objdir.

This is a bit crude, but the foo.mk we generate doesn't actually get
regenerated all that often in practice, so a spurious relink for the
vast majority of crunched objects won't actually happen all that often.

Reviewed by:	bapt, emaste, imp
Differential Revision:	https://reviews.freebsd.org/D43869
2024-03-08 20:01:25 -06:00
Mark Johnston 8a802df1de bhyve/gdb: Avoid rebuilding target.xml for install targets
Otherwise it's impossible to install from a read-only objdir.

Fixes:	f81cdf24ba ("bhyve: Add support for XML register definitions")
Reported by:	olivier
2024-03-07 00:39:07 -05:00
Eugene Grosbein e333110d1d diskinfo(8): introduce new option -l
In modes -p or -s, add an option -l to start each line
with a device name separated with a tab. Update the manual page.
Add an example to list names with corresponding serial numbers:

diskinfo -ls /dev/da?

MFC after:	2 weeks
2024-03-06 00:29:04 +07:00
Hartmut Brandt 83550d02fe Add a missing space in a warning. 2024-03-04 20:08:25 +01:00
Baptiste Daroussin 8fe86d923f usbconfig: allow to get usb vendors and products from the usb.ids database
Reviewed by:		emaste, manu
Differential Revision:	https://reviews.freebsd.org/D3392
2024-02-29 13:01:06 +01:00
Warner Losh bc4c7e78f8 ofwdump: Convert ints that are booleans to bool.
No functional changes...

Sponsored by:		Netflix
2024-02-26 16:15:55 -07:00
Jessica Clarke 09cb8031b4 efibootmgr: Simplify make_next_boot_var_name and fix cnt == 0 case
If cnt == 0 we access element 0 unconditionally, which is out of bounds,
and then if that doesn't crash and happens to be 0 we will access
element - 1, also out of bounds, and then if that doesn't crash will add
1 to whatever junk is there and use that for the variable. On CHERI,
though, this does crash. This code is also overly complicated, with
unnecessary special cases and tracking more state than needed.

Rewrite it in a more general manner that doesn't need those special
cases and naturally works for cnt == 0.

Found by:	CHERI
Reviewed by:	imp
Fixes:		1285bcc833 ("Import Netflix's efibootmgr to help manage UEFI boot variables")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44029
2024-02-23 02:36:21 +00:00
Chuck Silvers 34467bd762 x86/ucode: add support for early loading of CPU ucode on AMD.
Sponsored by:	Netflix
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43318
2024-02-22 10:04:31 -08:00
Mark Johnston f81cdf24ba bhyve: Add support for XML register definitions
This is useful for exposing additional registers to debuggers.  For
instance, control registers are now available on amd64 when using gdb to
debug a guest.

The stub indicates support by including the string
"qXfer:features:read+" in its feature list.  The debugger queries for
target descriptions by sending the query "qXfer:features:read:" followed
by a file path.

The XML definitions are copied from QEMU and installed to
/usr/share/bhyve/gdb.

Note that we currently don't handle the SIMD registers at all, since
that's of somewhat limited utility (for me at least) and since that
requires new ioctls to fetch the register values.

Reviewed by:	jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D43666
2024-02-20 19:51:34 -05:00
Gleb Smirnoff 6a3e87e130 arp: fix arp -s/-S
When setting a permanent ARP entry, the route(4) would use
rtm->rtm_rmx.rmx_expire == 0 as a flag for installing a static entry, but
netlink(4) is looking for explicit NTF_STICKY flag in the request.  The
arp(8) utility was adopted to use netlink(4) by default, but it has lots
of route-era guts internally. Specifically there is global variable 'opts'
that shares configuration for both protocols, and it is still initialized
with route(4) specific RTF_xxx flags.  In set_nl() these flags are
translated to netlink(4) parameters. However, RTF_STATIC is a flag that is
never set by default, so attempt to use it as a proxy flag manifesting
-s/-S results in losing it.  Use zero opts.expire_time as a manifest of
-s/-S operation.  This is a minimal fix.  A better one would be to fully
get rid of route(4) legacy.

The change also corrects the logic to set NUD_PERMANENT flag for
consistency.  This flag is ignored by our kernel (now).

Reviewed by:		melifaro, tuexen, emaste
PR:			277063
Fixes:			6ad73dbf65
Differential Revision:	https://reviews.freebsd.org/D43983
2024-02-20 10:31:05 -08:00
Boris Lytochkin 03cc3489a0 ndp(8): increase buffer size in rtsock mode
On a router with many connected devices (~10k+) `ndp -an` can fail
with ENOMEM because of some additional NDP records were added
between sysctl() buffer size estimate and data fetch calls.

Allocate more space based on size estimate: 1/64 (~2%) of additional
space, but not less that 4 m_rtmsg structures.

Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D43956
2024-02-19 10:44:52 +03:00
Muhammad Moinur Rahman da9cd485d0
crontab/crontab.1: Fix crontab path in man
In FreeBSD the crontabs are stored in /var/cron/tabs directory and not
in /var directory.

Approved by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43181
2024-02-19 00:56:16 +01:00
Mark Johnston 23d4d0fcc1 pmc: Fix some problems with the makefile
- For some reason we don't build it as a PIE, but I don't have any
  problems doing so with either clang or gcc.
- There is no apparent need to override WARNS, so don't.
- Some building with -O0, presumably that's left over from debugging.

MFC after:	1 week
Reviewed by:	imp, brooks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D43923
2024-02-16 09:50:43 -05:00
Philip Paeps 2911c44baf bsdinstall: remove two dead mirrors 2024-02-15 21:49:33 +08:00
Philip Paeps 9c59988175 bsdinstall: prefer HTTP
In 2024, users are more likely to have working HTTP than working FTP.
Present http://ftp.FreeBSD.org as the first option in the installer.
Keep ftp://ftp.FreeBSD.org as the second option.

MFC after:	3 weeks
2024-02-15 21:49:33 +08:00
Shi-Xin Huang f4e0aec989
ypldap(8): Fix grammar in ypldap.c
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/991
2024-02-13 14:11:07 +08:00
Christos Margiolis 5daa7cf42f mixer(8): Use new mixer if we change the default unit
If we use the -d option to change the default unit, close the current
mixer and open the one we set as the default to avoid printing and
applying changes (if any) to the old one.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D43809
2024-02-12 13:00:05 +02:00
Christos Margiolis cc7479d7dc mixer(8): Improve mute and recsrc controls
The input options of "dev.mute" (+, -, ^) and "dev.recsrc" (+, -, ^, =)
are quite cryptic. Allow the input to also be an actual description of
what these options do.

+ -> add (recsrc)
- -> remove (recsrc)
^ -> toggle (recsrc, mute)
= -> set (recsrc)
0 -> off (mute)
1 -> on (mute)

Also, deprecate the use of the symbol options in the EXAMPLES section of
the man page, by using the new descriptive options.

In the future, we might want to get rid of the symbol options
altogether, but preserve backwards compatibility for now.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, imp
Differential Revision:	https://reviews.freebsd.org/D43796
2024-02-12 13:00:05 +02:00
Christos Margiolis 7bd14d09a9 mixer.8: Fix wrong sentence
246e0457d9 ("mixer.8: Add terse example
for increasing volume") mentions that the example changes the volume of
the "first mixer found", while the example shows how the change the
volume of the current mixer's "vol" device. Re-phrease sentence to
reflect the actual behavior of the command.

Also, improve the example by using the % operator, instead of hardcoding
0.05.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D43795
2024-02-12 13:00:05 +02:00
Christos Margiolis 75be886e58 mixer(8): Allow full PCM device names as input for the -d option
The -d option is a wrapper around hw.snd.default_unit. Currently
mixer(8) expects the option argument to be just the unit's number (e.g
pcm0 -> 0). To avoid confusion, allow full device names of the form
"pcmN" as well.

While here, improve the -d option's description in the man page.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, imp
Differential Revision:	https://reviews.freebsd.org/D43794
2024-02-12 13:00:05 +02:00
Christos Margiolis 09ba07011a mixer(8): Improve error messsages and warnings
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, imp
Differential Revision:	https://reviews.freebsd.org/D43793
2024-02-12 12:59:58 +02:00
Jessica Clarke c994f226bb bsdinstall: Add new Auto option to netconfig interface selection dialog
This changes the OK / Cancel buttons into Auto / Manual / Cancel, with
Auto being the default. Manual behaves like OK used to, i.e. presents a
series of dialogs asking exactly how to configure the interface, and
Cancel is unchanged, exiting with exit code 1. Auto will attempt to
configure IPv4+DHCP and IPv6+SLAAC with no interaction, failing only if
neither can be configured, thereby supporting all of IPv4-only,
IPv6-only and dual-stack environments. If at least one DNS server is
provided, it will also skip asking for DNS settings, otherwise it will
act like Manual mode for the purposes of DNS settings and prompt. For a
standard dual-stack environment this cuts down the number of netconfig
dialogs from 6 (interface, IPv4, DHCP, IPv6, SLAAC, DNS) to just the
first one.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D43731
2024-02-09 18:13:47 +00:00
Mark Johnston 72c166696b traceroute6: Update .PATH and include path after traceroute moved
Fixes:	9b7a920a12 ("traceroute: move from contrib to usr.sbin")
2024-02-08 12:57:33 -05:00
Lexi Winter 3f0b108924 traceroute: remove rcsid tags
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1100
2024-02-08 09:52:42 -07:00
Lexi Winter 6a6c5572c3 traceroute: remove configuration #defines
traceroute used a series of #defines to specify what features are
available on the host platform.  As traceroute is now in source, these
are unnecessary and complicate the code, so remove them.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1100
2024-02-08 09:52:42 -07:00
Lexi Winter 9b7a920a12 traceroute: move from contrib to usr.sbin
traceroute hasn't had a vendor import since 2002, while since then it's
had several significant FreeBSD-specific commits.  Since it's unlikely
another vendor import will happen, and to make the merge of traceroute6
into traceroute easier, import traceroute into usr.sbin.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1100
2024-02-08 09:52:42 -07:00
Mark Johnston e6516294f4 bhyve: Add support for the 'p' query
This lets gdb query individual registers.  It's easy to implement and is
used by gdb when attaching to a CHERI target, so let's support it.

Sponsored by:	Innovate UK
Reviewed by:	corvink, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D43664
2024-02-07 08:46:59 -05:00
Mariusz Zaborski cd724c2592 bsdinstall: complete whitelabeling the installer
The commit 147585b489 introduces
whitlabeling. This commit addresses couple more places where the
os name was missed.

Reviewed by:	imp, asiciliano, brd
Differential Revision:	https://reviews.freebsd.org/D43638
2024-02-04 13:01:08 +01:00
Jessica Clarke 1e75e61d5c bsdinstall: Fix broken netconfig persistence for installed system
The replacement of echo >> with sysrc -f used sysrc key value, which
means "read variables key and value" and thus did nothing useful (and in
fact emitted errors to the log about neither existing). Instead use the
correct sysrc key=value form so the installed system comes back up with
working networking.

Fixes:	60b37735f3 ("bsdinstall netconfig: avoid duplicate entries in rc.conf")
2024-02-03 22:50:47 +00:00
Jose Luis Duran 5eb1aebf8d traceroute: Lint manuals
Fix a number of warning mandoc -Tlint and igor turned up.  No changes
intended.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/901
2024-02-02 20:14:09 -07:00
Jose Luis Duran ba09352b73 traceroute: Standardize usage
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/901
2024-02-02 20:14:09 -07:00
Jose Luis Duran 00aa635337 traceroute: Update values in examples
Standardize the documentation and update it to reflect the current
values.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/901
2024-02-02 20:14:09 -07:00
Jessica Clarke 7414d14bd5 bsdinstall: Drop Error from title in netconfig no interfaces dialog
This isn't inherently an error. It is if you're attempting to download
dist tarballs or later install packages, but a FreeBSD system with no
NIC is a reasonable setup to have, especially in a throwaway VM setting,
so we shouldn't say it is one.

Leaving the exit code as 1 is still fine, since auto will ignore it, and
avoids breaking other uses.

MFC after:	1 week
2024-02-03 01:52:53 +00:00
Jessica Clarke b809c7d6a2 bsdinstall: Fix netconfig script when no interfaces are present
The script uses [ -z "$INTERFACES" ] to check if the list of interfaces
is empty and will exit early if so, but INTERFACES always contains at
least a space due to the way it appends the list of wireless devices.
Fix this by only adding the space when there are devices to append,
mirroring the behaviour for non-wireless devices above (both will result
in a redundant leading space when the list is non-empty, but that one is
harmless).

Fixes:		159ca5c844 ("Adapt to new wireless scheme where base wlan interfaces do not show up in ifconfig anymore.")
MFC after:	1 week
2024-02-03 01:52:37 +00:00
Ricardo Branco 752a340419 quot: Use getopt(3) and show usage() if no arguments
Also update the man page and usage to be a little more accurate with the
-a flag.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/983
2024-02-02 18:34:59 -07:00