Commit graph

20671 commits

Author SHA1 Message Date
Bjoern A. Zeeb ad31d47642 bsdinstall: update comment related to pkg
pkg_add has been gone since 2013(?).  Refer to pkg(8) instead.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	jrtc27
Differential Revision: https://reviews.freebsd.org/D44946
2024-04-25 17:44:18 +00:00
Mark Johnston 71b2ba9099 bhyve.8: Document arm64 support
- Mention the options that are amd64-only.
- Provide a minimal example for booting an arm64 guest.

Reviewed by:	corvink
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D44738
2024-04-24 09:58:04 -04:00
Mark Johnston 107584716c bhyve.8: Remove mention of the -A flag
It is a no-op on amd64 now and is not implemented on arm64, so let's
remove mention of it altogether so as to reduce confusion for arm64
users.

Reviewed by:	corvink, jhb
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D44737
2024-04-24 09:57:12 -04:00
Warner Losh 560931508c Revert "bsdinstall/distfetch.c: check environment variables before downloading and handle memory allocation errors"
This reverts commit 91bdebc958. It wasn't
as ready as I thought
2024-04-23 21:18:56 -06:00
rilysh 91bdebc958 bsdinstall/distfetch.c: check environment variables before downloading and handle memory allocation errors
1. Currently, distfetch checks environment variables existence
when it will use them or in a case (in chdir()) it doesn't check
at all. As they are necessary to set before doing anything with
it, check them, if they set or not, before proceeding any further.
This also avoids extra cleaning when that environment variable
isn't set.

2. Handle memory allocation error in malloc(PATH_MAX) and replace
(sizeof const char *) with (sizeof char *). Both are similar and
const doesn't have a size.

3. Indent the error message a bit in chdir().

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1071
2024-04-23 16:42:38 -06:00
Lexi Winter 7209444a80 package: move cron into its own package
Reviewed by: imp, manu, Mina Galic
Pull Request: https://github.com/freebsd/freebsd-src/pull/1172
2024-04-22 22:36:35 -06:00
Lexi Winter 6ca1f3de57 package: move hv_{vss,kvp}_daemon into hyperv-tools
Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1170
2024-04-22 22:36:35 -06:00
Joseph Mingrone 5cafc38f11
adduser: Fix a syntax error
Reported by:	Jose Luis Duran <jlduran@gmail.com>
Fixes:		b37333899b
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44871
2024-04-22 16:06:38 -03:00
Dag-Erling Smørgrav b37333899b adduser: A few more improvements.
MFC after:	1 week
Reviewed by:	jrm
Differential Revision:	https://reviews.freebsd.org/D44871
2024-04-20 21:35:32 +02:00
Gordon Bergling 5235e9d646 binmiscctl.8: Remove a double word
- s/the the/the/

MFC after:	3 days
2024-04-20 11:15:20 +02:00
Lexi Winter dbd0366f34 package: move lpr into its own package
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1171
2024-04-19 16:54:31 -06:00
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