Commit graph

20710 commits

Author SHA1 Message Date
Lexi Winter fbbdfa2b8a nfsv4(4): mention the nfsv4_server_only setting
Add note about configuring the NFSv4-only option.

It is already mentioned in rc.conf(5), but documenting it here makes it
more likely that people see it when they need it.

MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1008
2024-01-06 19:21:25 +01:00
Michael Tuexen f402e08737 tcpsso: fix typos in man page
Reviewed by:		manpages (bcr)
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D43342
2024-01-06 19:17:04 +01:00
Kyle Evans f9b17005bf bhyveload: fix comment style
Reported by:	jrtc27
Fixes: c067be72e8 ("bhyveload: limit rights on the dirfds we create")
2024-01-05 09:54:46 -06:00
Kyle Evans 24cd5c26fe bhyveload: support guest rebooting from the loader
userboot has a EXIT_REBOOT code that it uses when the 'reboot' loader
command is executed.  Use that and longjmp back to reinit the VM
entirely with a reboot request.  This fixes the 'reboot' option in the
loader menu to actually reboot rather than shutdown the VM.

The JMP_* constants are introduced to keep track of why we're doing a
longjmp, though they aren't currently used.  We'll notably still do a
complete reload of the interpreter to give the rebooted VM that new
loader smell.  It just seemed forward thinking to just keep track of the
different setjmp points.

While we're here, we don't actually need to keep the fd we passed to
fdlopen(3), so let's avoid leaking it.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43300
2024-01-05 00:21:15 -06:00
Kyle Evans c067be72e8 bhyveload: limit rights on the dirfds we create
In neither case do we need write access to the directories we're working
with; userboot doesn't support fo_write on the host device, and the
bootfd is only ever needed for loader loading.

This improves on 8bf0882e18 ("bhyveload: enter capability mode [...]")
so that arbitrary code in the loader can't open writable fds to either
of the directories we need to maintain access to.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D43315
2024-01-05 00:21:14 -06:00
Kyle Evans 67082f077f bhyveload: fix non -l use
explicit_loader_fd should have been initialized to -1, not 0, but my
last round of testing was only with -l...

Fixes:	bf7c4fcbbb ("bhyveload: hold /boot and do relative [...]")
Pointy hat:	kevans
2024-01-03 19:36:06 -06:00
Kyle Evans 8bf0882e18 bhyveload: enter capability mode after we setup the vcpu
Reviewed by:	allanjude (earlier version), emaste, markj
Differential Revision:	https://reviews.freebsd.org/D43286
2024-01-03 16:19:15 -06:00
Kyle Evans bf7c4fcbbb bhyveload: hold /boot and do relative lookups for the loader
The next change will push bhyveload into capability mode right after we
allocate vcpu state, before we've setup or entered the loader, to limit
the surface area that a rogue loader script can touch.

With an explicit -l loader, we don't need to preopen /boot because
changing interpreters isn't allowed.  We'll just dlopen() entirely in
advance in that case to eliminate some complexity.

Reviewed by:	allanjude (earlier version), markj
Differential Revision:	https://reviews.freebsd.org/D43285
2024-01-03 16:19:15 -06:00
Kyle Evans 6779d44bd8 bhyveload: use a dirfd to support -h
Don't allow lookups from the loader scripts, which in rare cases may be
in guest control depending on the setup, to leave the specified host
root.  Open the root dir and strictly do RESOLVE_BENEATH lookups from
there.

cb_open() has been restructured a bit to work nicely with this, using
fdopendir() in the directory case and just using the fd we already
opened in the regular file case.

hostbase_open() was split out to provide an obvious place to apply
rights(4) if that's something we care to do.

Reviewed by:	allanjude (earlier version), markj
Differential Revision:	https://reviews.freebsd.org/D43284
2024-01-03 16:19:15 -06:00
Jose Luis Duran 0c2218d1d5 traceroute6: Implement ECN bleaching detection
Explicit Congestion Notification (ECN) is a mechanism that allows
end-to-end notification of network congestion without dropping packets
by explicitly setting the ECN code point (2 bits).

Per RFC 8087, section 3.5, network devices should not be configured to
change the ECN code point in the packets that they forward, except to
set the CE (Congestion Experienced) code point ('11') to signal
incipient congestion.

The current commit adds an -E flag to traceroute6 that crafts a packet
with an ECT(1) code point ('01').

If the packet is received back with a zero ECN code point ('00'), it
outputs that the hop in question erases or "bleaches" the ECN code point
values.  Bleaching may occur for various reasons (including normalizing
packets to hide which equipment supports ECN).  This policy prevents the
use of ECN by applications.

If the packet is received back with an all-ones ECN code point ('11'),
it outputs that the hop in question is experiencing "congestion".

If the packet is received back with a different ECN code point ('10'),
it outputs that the hop in question changes or "mangles" the ECN code
point values.

If the packet is received with the same ECN code point that was sent
('01'), it outputs that the hop has "passed" the ECN bits appropriately.

Inspired by:	Darwin
Reviewed by:	imp, markj
MFC after:	1 month
Pull Request:	https://github.com/freebsd/freebsd-src/pull/879
2024-01-03 12:57:29 -05:00
Jose Luis Duran 777e494a76 traceroute6: style(9) fixes
No functional change intended.

Reviewed by:	imp, markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/879
2024-01-03 12:54:53 -05:00
Alex Richardson 30887c7d48 kldxref: fix bootstrapping on Linux with Clang 16
The glibc fts_open() callback type does not have the second const
qualifier and it appears that Clang 16 errors by default for mismatched
function pointer types. Add an ifdef to handle this case.
2024-01-02 11:06:51 -08:00
Jose Luis Duran 518a1fd7d3 makefs: Fix ZFS cross-reference sections
MFC after:	1 week
Fixes:		240afd8c1f ("makefs: Add ZFS support")
Pull Request:	https://github.com/freebsd/freebsd-src/pull/979
2024-01-02 09:20:26 -05:00
Michael Osipov e2f6bafc38 periodic: Make daily diff(1) output as small is possible
Make, by default, daily diff(1) ignore whitespace changes and the unified output
a context of zero (0) lines. This reduces output of unrelated lines in e-mails
delivered to root.

PR:		270266
Approved by:	jrm (mentor), karels
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D42762
2023-12-31 11:24:43 +01:00
Michael Osipov 15e35d058c periodic: Make daily diff(1) flags configurable with daily_diff_flags
PR:		270266
Approved by:	jrm (mentor), karels
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D42900
2023-12-31 11:22:19 +01:00
Michael Osipov 3aa71ea7c2 periodic: Make security diff(1) output as small is possible
Make, by default, security diff(1) produce a unified output with a context of
zero (0) lines. This reduces output of unrelated lines in e-mails delivered
to root.

PR:		270266
Approved by:	jrm (mentor), karels
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D43071
2023-12-31 11:16:30 +01:00
Robert Wing 0600b57540 bhyve: verify that user provided fbuf values fall within limits
The upper limits for height/width are already checked, this commit
enforces the lower limit as well.

The behavior is also changed such that, the framebuffer fails to
initialize if the provided values don't parse cleanly.

Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D42692
2023-12-29 11:37:57 -09:00
Pierre Pronchery 19bb1886be bsdinstall: rename "Live CD" to "Live System"
This uses more generic wording in the FreeBSD installer, when offering
the user to use the system booted without running the installer.

The updated wording is also reflected in freebsd-version(1).

Reviewed by:		emaste
Sponsored by:		The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D43233
2023-12-29 15:24:25 -05:00
Vitaliy Gusev b831c7732c bhyve: increase SNAPSHOT_BUFFER_SIZE
After commit fb51ddb20d, suspending a vm fails with the error:
    vm_snapshot_buf: buffer too small

Sponsored by:   vStack
Reviewed by:    markj, rew
Fixes: fb51ddb20d ("bhyve: increase fbuf display resolution limit")
Differential Revision: https://reviews.freebsd.org/D43218
2023-12-29 08:52:40 -09:00
Xin LI 61174ad88e newsyslog(8): Add support of specifying compression method in configuration file.
Administrators can now specify a global compression method directly
at the beginning of the newsyslog.conf file, for example:

	<compress> none

Relnotes:	yes
Reviewed by:	dvl
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43174
2023-12-29 00:32:26 -08:00
Elyes Haouas 44cf844b16 tree: Use 1 semicolon at the end of a statement
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/889
2023-12-27 21:05:56 -07:00
Jose Luis Duran 0fef54255b route6d: Fix typo (triple S)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/955
2023-12-27 20:24:32 -07:00
Warner Losh e21ebb4d2d auto_master.5: Fix my push
Forgot the commit --amend before the push to fix the date. My bad.
Fixes: fc8ac5fedf
2023-12-27 16:59:48 -07:00
concussious fc8ac5fedf auto_master.5: improve description, bump date
Add autofs automounter to description to improve visibility.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/824
2023-12-27 16:57:20 -07:00
John Baldwin 0f3210b3a7 ctladm: Only autoload cfiscsi.ko for iSCSI-specific commands
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D42935
2023-12-27 10:11:19 -08:00
John Baldwin e8d8354834 ctladm: Fix a typo and add a FALLTHROUGH annotation
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D42934
2023-12-27 10:10:42 -08:00
John Baldwin f12d378f4f cltadm.8: Correct documentation of -r arg to port command
-r does not take a target port argument

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D42932
2023-12-27 10:10:27 -08:00
Alan Somers 2391e536c0 Fix multiple bugs with ctld's UCL parsing
* Don't segfault when parsing a misformatted auth-group section
* If the config file specifies a chap section within a target but no
  auth-group, create a new anonymous auth-group.  That matches the
  behavior with non-UCL config files.
* Protect some potential segfaults with assertions

PR:		274380
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	jhb
Differential Revision: https://reviews.freebsd.org/D43198
2023-12-27 10:49:15 -07:00
Kyle Evans e064557916 daemon: fix recent style regressions
Re-wrap the read(2) line, and make the listen_child loop more explicit
in intent.

Reported by:	kib
Fixes:	6ac7c9f06a ("daemon: remove redundant parameter from [...]")
2023-12-27 10:09:47 -06:00
Ihor Antonov 407e3790c3 daemon: separate pipe_fd[2] into pipe_rd and pipe_wr
This improves code readability and prevents mixing up read and write
ends of the pipe.

Reviewed by:	cperciva, kevans
Requested by:	kevans
2023-12-27 00:07:26 -06:00
Ihor Antonov 5745a58414 daemon: replace memchr with memrchr
Looping over lines in the buffer is not needed.
Same effect can be achieved by looking for the last new line.
If found the buffer is guaranteed to have one or more complete lines.
All complete lines are flushed at once with no looping.

Reviewed by:	cperciva, kevans
2023-12-27 00:07:26 -06:00
Ihor Antonov 24fd3e969e daemon: move buffer into daemon_state
There is no reason for a buffer in listen_child()
to be a static function variable. The buffer and
its position are parts of the daemon state and should
live together with the rest of the state variables.

Reviewed by:	cperciva, kevans
2023-12-27 00:07:25 -06:00
Ihor Antonov 6ac7c9f06a daemon: remove redundant parameter from listen_child()
state already contains pipe fd

Reviewed by:	cperciva, kevans
2023-12-27 00:07:25 -06:00
Ihor Antonov a6f795cc89 daemon: fix clang-tidy warnings
Fixed narrowing conversions:
- strtol replaced with strtonum with range check
- read returns ssize_t
- kevent.data explicitly cast to int before passing into strerror

While we we're here:
- Defined and documented maximum restart delay.
- Fixed typo in a comment.
- Remove unused includes

Reviewed by:	cperciva, kevans
2023-12-27 00:07:25 -06:00
lherschi c327288e8e bluetooth: fix comment in bluetooth.device.conf
The default for discoverable is 'NO' not 'YES'. This now matches the man
page.

Event: Advanced UNIX Programming Course (Fall'23) at NTHU.
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/939
2023-12-26 10:24:19 -07:00
rilysh 8f0498208d bhyve/audio.c: avoid re-calculating the length of dev_name
In the function audio_init(), strlen() is being called two times,
first to get the length of dev_name and second to use in memcpy().
Creating a local variable and keeping the length avoids this
re-calculation.

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/945
2023-12-26 09:36:31 -07:00
Xin LI 906748d208 newsyslog(8): Add option to globally override compression method.
Historically, newsyslog compressed rotated log files to save disk space.
This was useful in the early days. However, with modern file systems like
ZFS offering native compression, and with the availability of larger hard
drives, the benefits of additional compression have become less significant.
This is particularly true considering the inconvenience of decompressing
log files when searching for specific patterns.

Additionally, the original implementation of compression methods was not
future-proof.  As a result, we have redefined the J, X, Y, Z flags to
signify "treat the file as compressible" rather than "compress the file
with that specific method."

A new command-line option, -c, has been introduced to allow overriding
these settings in a more future-proof way. The available choices are:

 * none			 - do not compress, regardless of flag.
 * legacy		 - historical behavior: J=bzip2, X=xz, Y=zstd, Z=gzip.
 * bzip2, xz, zstd, gzip - apply the specified compression method.

Currently, the default is set to 'legacy' to preserve historical behavior.
However, our intention is to change this default to 'none' in FreeBSD 15.0.

Additionally, this update changes the default settings for zstd to use
multithreading and long-range options, better aligning with its intended
use.

Inspired by D42961 .

Reviewed by:	debdrup (earlier version, mdoc(7))
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43165
2023-12-22 22:46:33 -08:00
Rick Macklem 922e78f65f mountd: Update exports.5 for commit 7c5146da12
Commit 7c5146da12 modified mountd so that it uses
strunvis(3) to decode directory names in exports lines.
This allows special characters, such as blanks, to be
encoded in the directory names.

This patch updates the exports.5 man page for this change.

This is a content change.

Reviewed by:	karels, pauamma_gundo.com (manpages)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42163
2023-12-22 12:17:36 -08:00
John Baldwin d281fece43 kldxref: Appease a Coverity warning
While parsing .dynamic, nsym is set when parsing the symbol table from
.dynsym.  That parsing also sets ef->ef_symtab to a non-NULL value.
The value of nsym isn't validated until after a check for
ef->ef_symtab being NULL, so nsym always has a valid value when it is
read.  However, that chain of events is a bit much for static analysis
to follow, so initialize nsym to 0 before parsing sections to quiet
the warning.

Reported by:	Coverity Scan
CID:		1532339
Sponsored by:	DARPA
2023-12-22 07:49:40 -08:00
John Baldwin 0d557cdf6f kldxref: Simplify handling of ELF object files
Unlike the backend for ELF DSOs, the object file backend allocated an
aligned chunk of memory and read all of the in-memory sections from
the file into this memory even though most of the file contents were
never used.  Instead, just track a set of virtual addresses (based at
0) that each loaded section would be loaded at and only read the
necessary bits from the backing file when needed.

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43126
2023-12-22 07:49:18 -08:00
John Baldwin ed96fd7fc6 kldxref: Simplify elf_read_raw_data
Use pread as a valid offset is always passed now.  Originally the DSO
code read the .hash section in two separate requests and relied on the
implicit offset for the second read, but now the hash table is fetched
in a single call.

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43125
2023-12-22 07:49:03 -08:00
John Baldwin 6d46e2e0a7 kldxref: Tidy error handling for invalid addresses
- Don't print an offset value that's always zero.

- ef_get_offset can't return -1.

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43124
2023-12-22 07:48:47 -08:00
Konstantin Belousov 72f1e31f5f bhyve.8: fix -k description
Apparently 19eaa01bea inserted -K description in the middle of -k.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D43164
2023-12-22 17:29:33 +02:00
Konstantin Belousov 59a35b7c6b bhyve.8: add missed dot
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D43164
2023-12-22 17:29:25 +02:00
Dag-Erling Smørgrav fcaae06579 pwd_mkdb: Cosmetic nit.
Sponsored by:	Klara, Inc.
2023-12-20 22:42:42 +01:00
Warner Losh e02bee0b3e efibootmgr: Report the path to the device
Report the entire path to the device, rather than the the bit after /dev/
for the --esp command. Nothing in the tree depends on the output
format: Only bsdinstall's bootconfig script calls efibootmgr, and it
doesn't use the --esp/-E flag.

Sponsored by:		Netflix
2023-12-18 10:09:13 -07:00
Warner Losh 6aa1b4332f efibootmgr: Document -e command line switch
-e env will include `env` in the boot loader. Document that the boot
loader appends the `env` to the BootXXXX variable, and will parse it as
a series of a=b values to set in the boot loader's environment.  These
assignments are separated by spaces. The env arg needs to be quoted if
more than one env var is to be set (we parse only the next argument on
the command line).

Sponsored by:		Netflix
2023-12-18 10:01:38 -07:00
Jessica Clarke 2a622f14e8 kldxref: Reduce divergence between per-architecture files
Note that relbase is always 0 for DSOs so its omission for __KLD_SHARED
architectures was not a bug in practice.

Whilst here, also parenthesise the dest offset for where to avoid
transiently creating an out-of-bounds pointer, which is UB (though even
on CHERI architectures, where capability bounds compression can result
in that creating invalid capabilities that will trap on dereference,
optimisation will reassociate to the correct form in practice and thus
work just fine).
2023-12-14 20:17:20 +00:00
Jessica Clarke aaba1490ec kldxref: Implement aarch64 R_AARCH64_AB64 relocation
Doing nothing seems to be sufficient but is strange, inconsistent with
other architectures, and not necessary when it's easy to support
properly.
2023-12-14 20:17:20 +00:00
Jessica Clarke ae7925cafe kldxref: Fix MIPS Elf_Rel addend computation
Fixes:	0299afdff1 ("kldxref: Make use of libelf to be a portable cross tool")
2023-12-14 20:17:19 +00:00
Jessica Clarke c88f7d8fb5 kldxref: Add arm support 2023-12-14 18:27:09 +00:00
Jessica Clarke ada9d12f95 kldxref: Put each ef_CPUARCH.c on its own line to prepare for ef_arm.c
Adding ef_arm.c would push this past 80 columns, so prepare for its
addition by splitting the line up.
2023-12-14 18:27:09 +00:00
Jessica Clarke d1ce87ae0d kldxref: Fix for 32-bit powerpc
R_PPC_RELATIVE lost its 32-bit handling in the libelf conversion.

Reported by:	bapt
Fixes:		0299afdff1 ("kldxref: Make use of libelf to be a portable cross tool")
2023-12-14 16:37:34 +00:00
John Baldwin 894f3f48c3 kldxref: Cast rtype to int in ef_aarch64.c in warning
This is consistent with the other architecture-specific relocation
handlers.

Reported by:	mjg
Sponsored by:	DARPA
2023-12-13 12:17:44 -08:00
Baptiste Daroussin 97530894fc kldxref: fix build on 32 bits arches 2023-12-13 12:04:43 +01:00
John Baldwin 0299afdff1 kldxref: Make use of libelf to be a portable cross tool
This allows kldxref to operate on kernel objects from any
architecture, not just the native architecture.  In particular, this
will permit generating linker.hints files as part of a cross-arch
release build.

- elf.c is a new file that includes various wrappers around libelf
  including routines to read ELF data structures such as program and
  section headers and ELF relocations into the "generic" forms
  described in <gelf.h>.  This file also provides routines for
  converting a linker set into an array of addresses (GElf_Addr)
  as well as reading architecture-specific mod_* structures and
  converting them into "generic" Gmod_* forms where pointers are
  replaced with addresses.

- The various architecture-specific reloc handlers now use GElf_*
  types for most values (including GElf_Rel and GElf_Rela for
  relocation structures) and use routines from <sys/endian.h> to read
  and write target values.  A new linker set matches reloc handlers
  to specific ELF (class, encoding, machine) tuples.

- The bits of kldxref.c that write out linker.hints now use the
  encoding (ELFDATA2[LM]SB) of the first file encountered in a
  directory to set the endianness of the output file.  Input files
  with a different architecture in the same directory are skipped with
  a warning.  In addition, the initial version record for the file
  must be deferred until the first record is finished since the
  architecture of the output file is not known until then.

- Various places that used 'sizeof(void *)' throughout now use
  'elf_pointer_size()' to determine the size of a pointer in the
  target architecture.

Tested by:	amd64 binary on both amd64 and i386 /boot/kernel
Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42966
2023-12-12 15:43:00 -08:00
John Baldwin c40fa3dc98 kldxref: Refactor PNP entry parsing, no functional change
- Add a free_pnp_list to complement parse_pnp_list.  Add freeing
  of 'new_desc' which was previously leaked.

- Move body of loop that checked a single pnp list element against a
  table entry into a parse_pnp_entry function to reduce indentation
  and split parse_entry into a smaller function.

- Similarly, split out a record_pnp_info function from parse_entry
  which builds the pnp_list and walks a table.

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42965
2023-12-12 15:30:16 -08:00
John Baldwin 4a3cf5f329 Stop #defining FREEBSD_ELF
This was originally used (along with FREEBSD_AOUT) to prefer the use
of ELF in various tools instead of a.out as part of the a.out to ELF
transition in the 3.x days.  The last use of it was removed from
<link.h> in commit 66422f5b7a back in
2002, but various files still #define it.

Reviewed by:	kevans, imp, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42964
2023-12-12 15:30:00 -08:00
John Baldwin 087c4c90d1 kldxref: Add a copyright and license statement to ef.h
This uses the statement from other files in kldxref when the tool was
first imported in commit 9c6f92408c.

Reviewed by:	kevans
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42963
2023-12-12 15:29:43 -08:00
Bojan Novković ca96a942ca bhyve: refactor gdbstub to enable single-stepping on AMD CPUs
This patch refactors the existing Intel-specific single-stepping
mechanism in bhyve's GDB stub to work with both AMD and Intel CPUs.

Reviewed by:	jhb
Sponsored by:	Google, Inc. (GSoC 2022)
Differential Revision: https://reviews.freebsd.org/D42298
2023-12-12 15:28:59 -08:00
Simon J. Gerraty 5c8b07fe84 bsdinstall: add include to SUBDIR 2023-12-06 22:17:14 -08:00
Simon J. Gerraty 83d0b8c089 bsdinstall generate opt_osname.h in include
This allows the subdirs that do more work to run in parallel

Reviewed by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D42947
2023-12-06 18:34:52 -08:00
Jessica Clarke 47d669f10e bsdinstall: Encode dists to valid variable names in checksum script
Currently we just strip the .txz of the dist name (and add a status_
prefix) to get the shell variable name for its status, but this doesn't
give a valid result for dists like base-dbg, kernel-dbg and lib32-dbg,
or even kernel.KERNCONF (or, combining the two, kernel.KERNCONF-dbg). As
a result, four things go wrong for such dists:

1. If there is a dot and/or a dash in the name, writing to the variable
   fails and spits an error out on stderr to the log
3. If there is a dot in the name before any dash, the syntax is always
   invalid, reading the variable fails, spits an error out on stderr to
   the log, the result is the empty string and that is interpreted as
   being 0%
2. If there is a dash in the name before any dot, and there is a dist
   whose name is the substring up to that first dash, and it has already
   had its status written to, reading the variable instead reads that
   dist's variable and so the status of that dist is displayed instead
3. If there is a dash in the name before any dot, and either there is
   not a dist whose name is the substring up to that first dash or there
   is such a dist but it has not already had its status written to,
   reading the varaible instead results in the substring after the first
   dash, including any additional string expansion syntax that follows
   (i.e. ${status_kernel-dbg:--11}, the expression used to read the
   variable, is interpreted as reading status_kernel with a default
   value of "dbg:--11")

For example, in a default install with base, kernel, kernel-dbg and
lib32, the following sequence of displays happens:

1. base is In Progress, kernel is Pending, kernel-dbg is 0% (what shows
   for the garbage input "dbg:--11") and lib32 is Pending
2. base is Passed, kernel is In Progress, kernel-dbg is In Progress
   (since kernel has now had its status written to) and lib32 is
   Pending
3. base is Passed, kernel is Passed, kernel-dbg is Passed (again, since
   that is the status of kernel, despite that kernel-dbg is being
   verified at this point) and lib32 is Pending
4. base is Passed, kernel is Passed, kernel-dbg is Passed and lib32 is
   In Progress

Fix this with a crude encoding scheme. More special characters can
easily be added if needed in future.

Note that, prior to bsddialog being used (and thus for branches this is
MFC'ed to where dialog is still used), the same problem existed but
displayed slightly differently due to a combination of different default
values and different behaviour for unintended inputs.

Fixes:		b70047d413 ("Add generation of an installation manifest containing SHA256 checksums as ...")
MFC after:	1 week
2023-12-06 21:37:32 +00:00
Emmanuel Vadot 094abb6fb4 autofs: media: Always use sync option for fat*
Users of autofs for removable media expect to be able to copy files and
directly remove the media without having the need to call sync(8) or umount(8).
Only do that for fat/ntfs filesystems.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D42494
Reviewed by:	rew (older version)
2023-12-04 07:51:33 +01:00
Xin LI 3b3195f676 periodic/daily/480.leapfile-ntpd: only attempt to refresh leap-seconds.list
when ntpd is enabled.

The leap-seconds.list is used exclusively by ntpd, therefore, do not bother
to perform the fetch when ntpd is not enabled.

PR:		conf/275419
Reviewed by:	cy, michaelo, imp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D42875
2023-12-02 23:00:32 -08:00
Mark Johnston 1cc96501e5 bhyve: Fix a leak that happens when we fail to load a hostfwd rule
Reported by:	Coverity
Fixes:		c5359e2af5 ("bhyve: Add a slirp network backend")
2023-12-01 09:46:31 -05:00
Jamie Gritton 51e7276365 Unbreak build from ed31b3f4a1 (misapplied diff).
Differential Revision:	<https://reviews.freebsd.org/D28150
2023-11-29 17:27:37 -08:00
Jamie Gritton ed31b3f4a1 jail: Don't allow jail_set(2) to resurrect dying jails.
Currently, a prison in "dying" state (removed but still holding
resources) can be brought back to alive state via "jail -d", or
the JAIL_DYING flag to jail_set(2).  This seemed like a good idea
at the time.

Its main use was to improve support for specifying the jid when
creating a jail, which also seemed like a good idea at the time.
But resurrecting a jail that was partway through thr process of
shutting down is trouble waiting to happen.

This patch deprecates that flag, leaving it as a no-op for creating
jails (but still useful for looking at dying jails).  It sill allows
creating a new jail with the same jid as a dying one, but will renumber
the old one in that case.  That's imperfect, but allows for current
behavior.

Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D28150
2023-11-29 16:12:13 -08:00
Kristof Provost 2905d10b39 snmp_pf: use libpfctl's pfctl_get_rules_info() rather than DIOCGETRULES
Prefer libpfctl functions over direct access to the ioctl whenever
possible.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-11-27 21:36:48 +01:00
Warner Losh 4d65a7c695 usr.sbin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:01 -07:00
Warner Losh 0b8224d1cc Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh 5b31cc94b1 sccs: Manual changes
For the uncommon items: Go through the tree and remove sccs tags that
didn't fit any nice pattern. If in the neighborhood, other SCM tags were
removed when they were detritis of long-ago CVS somehow in the early
mists of the project. Some adjacent copyrights stringswere removed (they
duplicated the copyright notices in the file). This also removed
non-standard formations of omission of SCCS tags (usually by adding an
extra #if 0 somewhere.

After this commit, a number of strings tagged with the 'what' @(#)
prefix remain, but they are primarily copyright notices.

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh 8a7b612037 usr.sbin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:56 -07:00
Gordon Bergling 502e8f44fc iostat.8: Better wording for some use cases
The iostat(8) manual page should be more specific when using
options. Also extented the BUGS section.

PR:	153012
Reviewed by:	bcr
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42633
2023-11-26 19:30:58 +01:00
Xin LI 832c63f5e0 Update leap-seconds to leap-seconds.3676924800
Obtained from:  ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.3676924800
MFC after:	3 days
2023-11-25 17:13:23 -08:00
Ed Maste f72b4f7e14 etcupdate: temporarily comment out one tzsetup test
This test fails after tzsetup was changed to symlink rather than copy
the zoneinfo file (5e16809c95).
2023-11-24 17:31:28 -05:00
Emmanuel Vadot 5a78fcfce4 autofs: Remove stale comment
devd action for automount -c was never commented.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D42493
Reviewed by:	rew
2023-11-24 10:44:40 +01:00
Emmanuel Vadot 0b7c89c8c2 autofs: media: Don't include nosuid in the script
We already have nosuid option in auto_master so no need to redefine it.
Also it's easier for a user to modify the auto_master configuration file
than the script (which shouldn't be modified).

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D42492
Reviewed by:	rew
2023-11-24 10:44:20 +01:00
Ed Maste 5e16809c95 tzsetup: symlink /etc/localtime instead of copying
Using a symlink means that new timezone data (installed by an errata
update, say) will be usable without having to be copied again.

Reviewed by:	bapt, kevans, philip
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37005
2023-11-23 21:13:49 -05:00
Mark Johnston c5359e2af5 bhyve: Add a slirp network backend
This enables a subset of the functionality provided by QEMU's user
networking implementation.  In particular, it uses net/libslirp, the
same library as QEMU.

libslirp is permissively licensed but has some dependencies which make
it impractical to bring into the base system (glib in particular).  I
thus opted to make bhyve dlopen the libslirp.so, which can be installed
via pkg.  The library header is imported into bhyve.

The slirp backend takes a "hostfwd" which is identical to QEMU's
hostfwd.  When configured, bhyve opens a host socket and listens for
connections, which get forwarded to the guest.  For instance,
"hostfwd=tcp::1234-:22" allows one to ssh into the guest by ssh'ing to
port 1234 on the host, e.g., via 127.0.0.1.  I didn't try to hook up
guestfwd support since I don't personally have a use-case for it yet,
and I think it won't interact nicely with the capsicum sandbox.

Reviewed by:	jhb
Tested by:	rew
MFC after:	1 month
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D42510
2023-11-22 15:18:46 -05:00
Mark Johnston be74aede49 bhyve: Split backends into separate files
Currently the net_backend structure definition is private to
net_backends.c, so all of the backend definitions are there.  While
adding a new backend to use libslirp, it was noted that this file is
somewhat cluttered.  Move the netmap and netgraph backends to their own
files and clean up includes a bit.  No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	3 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D42689
2023-11-22 15:18:46 -05:00
Robert Wing fb51ddb20d bhyve: increase fbuf display resolution limit
This enables connecting to the VNC server at a higher resolution.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D42620
2023-11-20 16:17:53 -09:00
Jamie Gritton 6000d46fc3 Move "jail -e" out of the rest of jail(8) flow. 2023-11-18 12:47:50 -08:00
John Baldwin 84f773037e bsdinstall.8: Clarify the description of ZFSBOOT_FORCE_4K_SECTORS
This variable does not set the exact sector size of the pool, but
controls the minimum sector size.  The sector size of the underlying
disks can always be larger than the minium controlled by this knob.

PR:		274513
Reported by:	Albin "a12l" Otterhäll <bugs.freebsd.org@a12l.xyz>
2023-11-18 11:45:42 -08:00
John Baldwin de82aed119 bsdinstall zfsboot: Don't override ZFSBOOT_FORCE_4K_SECTORS if it is null.
Only set a default value of 1 if the shell variable is unset.  This allows
installer scripts to disable the variable.

PR:		274513
Reported by:	Albin "a12l" Otterhäll <bugs.freebsd.org@a12l.xyz>
Differential Revision:	https://reviews.freebsd.org/D42319
2023-11-18 11:18:29 -08:00
Jens Schweikhardt 8703e04009 Apply non-abrasive script-cleaning fluid.
* consistent use of tabs
* consistent quoting of parameters
* if/then cosmetics to match rc.subr style
2023-11-18 11:58:26 +01:00
Alexander Motin 3aebcb9ecb iostat: Restore lost spaces after tout
MFC after:	2 weeks
2023-11-15 23:45:22 -05:00
Alexander Motin d282baddb0 Add interface NVME to devstat
This allows to list only NVMe devices in systat, iostat, vmstat, etc.
Previously those were counted as OTHER.
2023-11-15 23:03:40 -05:00
John Baldwin fd9ae9ac04 pkg: Allocate a suitably-sized string for the local ABI
Previously the local ABI string was written to an on-stack buffer and
the pointer to that buffer was saved in a global before the function
returned.  This had two issues: c[ABI].val pointed to a
no-longer-valid on-stack buffer after config_init returned, and the
string could potentially be truncated.  Fix both of those by changing
pkg_get_myabi to return a pointer to a string allocated by asprintf.

Note that the allocated string is left in the global config array
until it is implicitly freed on process exit.

Reported by:	GCC 13 -Wdangling-pointer
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42623
2023-11-15 16:53:53 -08:00
John Baldwin cc61bf9ecc snmp_wlan: Fix a couple of type mismatches in function prototypes
Reported by:	GCC 13 via -Wenum-int-mismatch
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42582
2023-11-14 18:36:03 -08:00
John Baldwin 5fc8ed9313 makefs: Quiet a -Wdangling-pointer warning in cd9660_generate_path_table
This function temporarily stores a pointer to an on-stack variable (a
TAILQ_HEAD of a temporary list) into a global variable (*n).

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D42581
2023-11-14 18:35:44 -08:00
John Baldwin c06962057b makefs cd9660: Unexpand a few TAILQ macros
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42580
2023-11-14 18:35:27 -08:00
Mark Johnston 4e288572b8 bhyve: Fix the GDB_LOG build
MFC after:	1 week
Fixes:	7d9ef309bd ("libvmmapi: Add a struct vcpu and use it in most APIs.")
2023-11-11 12:15:30 -05:00
Alexander Motin 105c7c4b8d iostat: Tune formatting for higher disk speeds
MFC after:	2 weeks
2023-11-10 18:35:38 -05:00
Kyle Evans 8f2848eafa crunchgen: fix "keep" for an ELF world, break it out
"keep" currently adds a leading underscore, which hasn't been useful or
accurate since a.out days.  Preserve the symbol name as it's given
rather than mangle it to match ELF-style symbol names.

This was partially fixed back in
6cd35234a0 ("Assume ELF-style symbol names now.") for crunchgen, but
the keeplist wasn't changed to match it.

While we're here, break it out to bsd.crunchgen.mk for later use in
bsdbox.

Reviewed by:	adrian, imp
Differential Revision:	https://reviews.freebsd.org/D42499
2023-11-09 22:33:58 -06:00
Mark Johnston 7e5002e3d6 makefs/zfs: Add a regression test which checks file access permissions
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-11-08 07:18:58 -05:00
Mark Johnston 50565cf514 makefs/zfs: Don't set ZFS_NO_EXECS_DENIED in file flags
This flag was leftover from testing and should have been removed.

PR:		274938
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-11-08 07:04:12 -05:00
Dag-Erling Smørgrav f7d16a627e certctl: Convert line endings before inspecting files.
This ensures that certificate files or bundles with DOS or Mac line
endings are recognized as such and handled identically to those with
Unix line endings.

PR:		274952
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D42490
2023-11-07 20:53:09 +01:00
Mark Johnston 3e356fb885 crashinfo: Get local variable values in the gdb backtrace
This should make crash reports a bit more useful without having to ask
for additional information.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42465
2023-11-06 14:59:10 -05:00
Elyes Haouas e5f905c72a yppush: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Elyes Haouas 29ca151586 rpcbind: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Elyes Haouas 6e90567dde rpc.ypxfrd: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Elyes Haouas b5ebd8bb4e ypserv: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Elyes Haouas e9e666f7de keyserv: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Elyes Haouas be5a2c70b1 rtadvd: Remove return statement at the end of void functions
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-11-06 15:07:10 -04:00
Ed Maste 13a9745746 crashinfo: remove unused /usr/bin/gdb support
We have not had gdb 6.1 in the base system for some time; there is no
need to check for it.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34478
2023-11-04 21:45:15 -04:00
Dan Mcgregor 7c5146da12 mountd: Add support for spaces in exported directories
The previous code would correctly parse strings including quotation
marks (") or backslash (/), but the tests when creating the export
includes them in the final string. This prevents exporting paths
with embedded spaces, for example "/exports/with space". Trying
results in log lines resembling:

mountd[1337]: bad exports list line '/exports/with\ space':
    /exports/with\ space: lstat() failed: No such file or directory.

Turns out that when creating its exports list, zfs escapes strings
in a format compatible with vis(3). Since I expect that zfs sharenfs
is the dominating use case for generating an exports list, use
strunvis(3) to parse the export path. The result is lines like the
following allowing spaces:

/exports/with\040space -network 192.168.0 -mask 255.255.255.0

A man page update will be done as a separate commit.

MFC after:	1 month
Reviewed by:	rmacklem
Differential Revision:	https://reviews.freebsd.org/D42432
2023-11-04 15:07:56 -07:00
Ed Maste 5f4c09dd85 Track upstream project rename in contrib/blocklistd
Upstream is now https://github.com/zoulasc/blocklist/.  Rename the
contrib directory and update Makefiles to match, in advance of the next
vendor branch update.

Sponsored by:	The FreeBSD Foundation
2023-11-03 16:53:04 -04:00
Alexander Motin 7bca09e2bb mpsutil: Add higher PCIe speeds.
There are already PCIe Gen4 HBAs, reported improperly.

MFC after:	1 week
2023-11-03 11:49:59 -04:00
Dan McGregor d7f9a421df bhyve(8): fix manpage formatting
In commit 67c26eb2a5 a stray ".El" was introduced, breaking
formatting of options.

Reviewed by:	corvink, markj
Fixes:		67c26eb2a5 ("bhyve: add cmdline option for TPM emulation")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42434
2023-11-02 10:50:10 -04:00
Warner Losh 1fc478fb48 bhyve: ps2 implement command 0xf6
Implement PS2 Keyboard command 0xf6, which is "SET DEFAULTS". This is
the same as 0xf5 (DISABLE KEYBOARD), but without disabling the keyboard
(since that resets all the defaults as a side effect). Normally, we
clear the fifo when we re-enable the keyboard. However, since this
leaves the keyboard enabled, clear the fifo as part of this command and
send an ack.

Linux's keyboard driver sends this command on reboot. Other commands
enable / reset the kebyoard, so it doesn't matter too much this isn't
implemented for booting, eg ubuntu.

Sponsored by:		Netflix
Reviewed by:		corvink, markj
Differential Revision:	https://reviews.freebsd.org/D42384
2023-10-31 14:52:22 -06:00
Brooks Davis 6f7c45056f tzsetup: make UTC the first (default) region
Many sysadmins prefer to configure their systems to UTC and it's a
reasonable default when installing, making it easier to get a usable
system by just hitting <return> repeatidly.

Renumber UTC to 0 to preserve the finger memory of those selecting a
region by shortcut.

Reviewed by:	jrtc27, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42383
2023-10-30 23:35:21 +00:00
Stephen J. Kiernan 5e3190f700 dirdeps: Update Makefile.depend* files with empty contents
Some Makefile.depend* files were committed with no contents or empty
DIRDEPS list, but they should have DIRDEPS with some contents.
2023-10-29 17:01:04 -04:00
Warner Losh 731f91c077 efibootmgr: -C isn't implemented
-C isn't implemented, so just errx out until it is. It's not listed in
the man page, but is parsed for compatibility with the Linux
efibootmgr(8) command.

Sponsored by:		Netflix
2023-10-26 22:01:16 -06:00
Warner Losh 98d2608a2a efibootmgr: support '-b bootXXXX' as an alias for '-b XXXX'
Sponsored by:		Netflix
2023-10-26 22:01:16 -06:00
Gleb Smirnoff f407a72a50 bhyve: fix arguments to ioctl(VMIO_SIOCSIFFLAGS)
ioctl(2)'s with integer argument shall pass command argument by value,
not by pointer.  The ioctl(2) manual page is not very clear about that.
See sys/kern/sys_generic.c:sys_ioctl() near IOC_VOID.

Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D42366
Fixes:			fd8b9c73a5
2023-10-26 02:59:21 -07:00
Rick Macklem 82ea0132c8 gssd: Add support for the new upcall required by commit 428879dc91
Commit 428879dc91 adds a requirement for a new upcall for the
gssd(8).  This patch adds that upcall.

Unfortunately, the old gssd.c would not build against the new
patched gssd.x.

This patch will fix the build.

MFC after:	1 month
2023-10-23 14:41:26 -07:00
R. Christian McDonald 934a24e55a ndp: improve -c and -d handling in ndp_netlink
This patch restores/fixes some of the behavior present in pre-netlink ndp(8).

 1. Deleting a local address now correctly returns EPERM (instead of
    ENOENT)
 2. ndp -c no longer dumps the entire table while complaining about
    local addresses
 3. Return exit code when deleting entry (e.g. trying ndp -d on a local
    address is an error)

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42316
2023-10-23 22:58:29 +02:00
Mitchell Horne bcde15f5f8 ofwdump(8): cross-reference openfirm(4)
This utility relies on the openfirm(4) pseudo-device.

Sponsored by:	The FreeBSD Foundation
2023-10-23 14:56:29 -03:00
Mark Johnston ef067b5799 makefs/zfs: Update dd_used_breakdown after writing the MOS
Fixes:	96092bf910 ("makefs/zfs: Fill out dd_used_breakdown fields in DSL directories")
Sponsored by:	The FreeBSD Foundation
2023-10-23 12:29:20 -04:00
Mark Johnston 9f9d18d61e makefs/zfs: Add a regression test which checks the 'used*' properties
PR:		274613
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-10-23 11:15:00 -04:00
Mark Johnston 96092bf910 makefs/zfs: Fill out dd_used_breakdown fields in DSL directories
This is required for the "used", "usedds" and "usedchild" dataset
properties to be displayed.

PR:		274613
Reported by:	Mike Tancsa <mike@sentex.net>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-10-23 11:12:14 -04:00
Alfonso S. Siciliano c36b3dbc99
bsdconfig: Restore bsddialog
Readd bsddialog(1) to bsdconfig(8).

This can be considered an increment not a replacement: `$DIALOG=dialog'
restores dialog(1), no change for Xdialog(1). An exception is if an
error occurs, bsddialog(1) replaces dialog.
2023-10-23 16:11:54 +02:00
Alfonso S. Siciliano 0f8b2ba6c6
bsdconfig: Revert bsddialog support
This commit reverts "bsdconfig(8): add bsddialog(1) support"
30e9abf2fc because it is not intended for
the current bsddialog 1.0 version.
2023-10-23 15:59:31 +02:00
Devin Teske 608da65de9 bsdconfig: Add `network' keyword
Configuring a FreeBSD laptop, my fingers kept wanting to type
`bsdconfig network' and I could not figure out why this was not working.
Took me a second to realize that the shortcut was `bsdconfig networking'
for where I wanted to go.

Reviewed by:	jhb
Approved by:	jhb
Differential Revision:	https://reviews.freebsd.org/D42242
2023-10-22 11:45:36 -07:00
Brooks Davis def6ee77db certctl.8: document LOCALBASE
Document the LOCALBASE variable and that it's set to user.localbase by
default.  Update path defaults that depend on it.

Reviewed by:	bcr
Differential Revision:	https://reviews.freebsd.org/D40529
2023-10-20 20:52:10 +01:00
Dag-Erling Smørgrav 87945a0829 certctl: Fix recent regressions.
- If an untrusted certificate is also found in the list of trusted
  certificate, issue a warning and skip it, but don't fail.
- Split on -+BEGIN CERTIFICATE-+ instead of "Certificate:" since
  that's what we're really looking for.

Also fix a long-standing bug: .crl files are not certificates, so we
should not include them when searching for certificates.

Reported by:	madpilot, netchild, tijl
Reviewed by:	netchild, allanjude
Differential Revision:	https://reviews.freebsd.org/D42276
2023-10-20 12:29:40 +02:00
Alfonso S. Siciliano e44751530e
bsdinstall hostname: Restore bsdconfig API
Restore bsdconfig API to handle hostname dialog because bsddialog 1.0
matches all features required by bsdconfig(1). Implicitly this commit
restores also Xdialog(1) for this script.

This commit reverts:
 - "bsdinstall hostname: Replace dialog with bsddialog"
   6368dcb292
 - "bsdinstall(8) hostname: Update for bsddialog 0.3"
   5f3ec44e7e.

The script continues to use bsddialog(1) by default via $DIALOG in
bsdconfig(1).
2023-10-19 12:59:49 +02:00
Ed Maste 3d44241546 freebsd-update: allow user to break out of conflict resolution loop
When a conflict marker is found during update allow the user to confirm
they want it to remain in the file.

Suggested by:	Tim Hogard
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Fixes: ceb5f28ba5 ("freebsd-update: re-edit files if merge confli...")
Differential Revision: https://reviews.freebsd.org/D38896
2023-10-18 12:17:33 -04:00
Ed Maste 6b27e1f2ea freebsd-update: for rollback, first create directories
rollback_files() tried to install files before creating the directories
for those files.  In some cases this is due to special handling to
install certain classes of files earlier than others.

Just create all directories up front when performing rollback.

PR:		273950
Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42020
2023-10-18 10:52:59 -04:00
Ed Maste c0f5244316 freebsd-update: handle directories changing to files
Further to f6d37c9ca1 ("freebsd-update: handle file -> directory on
upgrade"), handle the reverse case of a directory changing to a file.
We may not encounter this case on upgradess (before freebsd-update is
retired) but it is needed to support rollback.

PR:		273950
Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41945
2023-10-18 10:48:58 -04:00
Fernando Apesteguía b9cf989234 bsdinstall: Fail nicely in jail target
If the directory is empty we fail with a message regarding mkdir in which
the empty directory can't be seen because it is not quoted.

Show a nice message so the user knows what is going on.

Reviewed by:		bapt@
Differential Revision:	https://reviews.freebsd.org/D42252
2023-10-18 09:46:05 +02:00
R. Christian McDonald 2bb78b46e0 ndp: fix timestamp display output
The current xo_format string is incorrect. This restores the display
format prior to libxo-ification work while also explicitly marking
tv_sec and tv_usec as encoded output only.

MFC after:	1 week
Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42269
2023-10-17 19:01:38 +02:00
Vitaliy Gusev 7de582874e bhyve: Remove init_snapshot() and initialize static vars
vCPU threads are starting before init_snapshot() is called. That can lead
to corruption of vcpu_lock userspace mutex (snapshot.c) and then VM hangs
in acquiring that mutex.

init_snapshot() initializes only static variables (mutex, cv) and that
code can be optimized and removed.

Fixes:		9a9a248964 ("bhyve: init checkput before caph_enter")
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	vStack
2023-10-17 14:26:51 -04:00
Konstantin Belousov 56c44bd92e automount(8): when flushing autofs, specify fsid
Which should avoid situation where flushed filesystem is not autofs,
because it was mounted over autofs mp.

Reported and tested by:	Andrew "RhodiumToad" Gierth <andrew@tao11.riddles.org.uk>
PR:	272446
Reviewed by:	mjg
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42023
2023-10-17 19:40:50 +03:00
Andrew Gierth 21b8e363c4 automount: check for mounted-over autofs instances on flush
PR:	272446
Reviewed by:	kib
MFC after:	1 week
Differential revision: https://reviews.freebsd.org/D40961
2023-10-17 19:40:45 +03:00
Jan Bramkamp fd8b9c73a5 bhyve: Use VMIO_SIOCSIFFLAGS instead of SIOCGIFFLAGS
Creating an IP socket to invoke the SIOCGIFFLAGS ioctl on is the only
thing preventing bhyve from working inside a bhyve jail with IPv4 and
IPv6 disabled restricting the jailed bhyve process to only access the
host network via a tap/vmnet device node.

PR:		273557
Fixes:		56be282bc9 ("bhyve: net_backends, automatically IFF_UP tap devices")
Reviewed by:	markj
MFC after:	1 week
2023-10-17 11:24:11 -04:00
Corvin Köhne 4a3810075f
bhyve: fix buffer overflow in QemuFwCfg
We're accessing one element of the newly allocated and the old directory
too much.

Reported by:		andy@omniosce.org
Reviewed by:		markj
Fixes:			6f9ebb3d0f ("bhyve: add helper for adding fwcfg files")
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D42220
2023-10-17 15:57:28 +02:00
Kristof Provost 4f8f43b06e netlink: cope with growing requests
If a request ends up growing beyong the initially allocated space the
netlink functions (such as snl_add_msg_attr_u32()) will allocate a
new buffer. This invalidates the header pointer we can have received
from snl_create_msg_request(). Always use the hdr returned by
snl_finalize_msg().

Reviewed by:	melifaro
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D42223
2023-10-17 08:47:52 +02:00
John Baldwin 6e8bf24073 bsdinstall partedit: Use snprintf instead of sprintf for error messages
When generating a message for a dialog box into a static buffer, use
snprintf instead of sprintf to avoid buffer overflows.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42240
2023-10-16 16:25:38 -07:00
John Baldwin a8676bf367 bsdinstall partedit: Use asprintf to build wrapper command for newfs
Don't abuse the message[] static buffer used elsewhere for error
messages to generate the command that actually newfs's each
filesystem.  Use asprintf to a more aptly-named 'char *command'
variable to construct the string instead.  This avoids potential bugs
from truncation of the command string.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42239
2023-10-16 16:25:25 -07:00
John Baldwin 51749e05e9 bsdinstall partedit: Replace malloc + sprintf with asprintf
This avoids potential bugs with the length passed to malloc not
matching the string written via sprintf.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42238
2023-10-16 16:25:15 -07:00
John Baldwin ae2fc74fe7 bsdinstall partedit: Avoid potential buffer overflow in newfs_command
Allocate the buffer holding the newfs command string dynamically
(building the string via open_memstream) rather than storing the
command into a caller-supplied buffer of unknown length.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42237
2023-10-16 16:25:03 -07:00
John Baldwin b0936440b8 bhyve: Replace many fprintf(stderr, ...) calls with EPRINTLN
EPRINTLN handles newlines appropriately when stdout/stderr have been
reused as the backend for a serial port.

For bhyverun.c itself, the rule this attempts to follow is to use
regular fprintf/perror/warn/err prior to init_pci() (which is when
serial ports are configured) and to switch to EPRINTLN afterwards.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D42182
2023-10-16 15:17:48 -07:00
John Baldwin 5307bbcc03 bsdinstall partedit: Apply changes from scripted installs
I got a check inverted in a previous cleanup commit and as a result
partedit was only applying GEOM changes (and generating an /etc/fstab)
if it got an error reading the current GEOM mesh.  Instead, it needed
to do those actions if it succeeded in reading the mesh.

The lack of /etc/fstab meant that bsdinstall mount didn't mount
anything in a scripted install.

PR:		273723
Reported by:	Andrey Fesenko <andrey@bsdnir.info>
Reported by:	Michal Nowak <mnowak@startmail.com>
Reviewed by:	cognet, brooks
Fixes:		2309909919 bsdinstall: Handle errors from geom_gettree.
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42236
2023-10-16 15:13:31 -07:00
Jake Freeland d556719e15 syslogd: Keep console and tty descriptors open
Console and tty descriptors are initially opened in parse_action() to
determine whether they are valid using isatty(). That descriptor is then
closed because it is never accessed by syslogd again; ttymsg() will reopen
the tty/console under a new descriptor when needed.

If the user attempts to log to a tty that is inactive outside of
syslogd, then syslogd must keep that descriptor open so the tty remains
accessible. For example, logging to `/dev/ttyvb` requires the initial
`/dev/ttyvb` descriptor to stay open so the user can view its buffer at
any time via CTRL+ALT+F12.

As a result, console and tty descriptors must remain open until a
potential configuration reload or a system shutdown. The given
descriptor will be closed in close_filed() in such circumstances.

PR:		274454
Fixes:		c3175a6e1c ("syslogd: Do not open console descriptor")
Reported by:	Trond Endrestøl <Trond.Endrestol@ximalas.info>
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D42215
2023-10-16 09:11:58 -04:00
Alfonso S. Siciliano 7ef6e99752
sade: Restore UI behavior like dialog(3)
Restore UI behavior like previous disk menu implementation built on
dialog(3):

 * Buttons of Create and Modify forms always active to close the
   dialogs just pressing Enter.
 * Disk menu indentation.
2023-10-16 14:06:06 +02:00
Ed Maste c08ba4a588 efibootmgr: provide explicit error message if run as non-root
This should be less confusing for new users.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42213
2023-10-15 14:31:51 -04:00
John Baldwin edd2a9b887 bhyve ahci: Replace WPRINTF with EPRINTLN
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D42181
2023-10-13 12:26:58 -07:00
John Baldwin f0852344e7 bhyve: Some fwctl simplifications.
- Collapse IDENT_SEND/IDENT_WAIT states down to a single state.

- Remove unused 'len' argument to op_data callback.  The value passed
  in (total amount of remaining data to receive) didn't seem very useful
  and no op_data implementations used it.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D41286
2023-10-13 12:26:22 -07:00
Pierre Pronchery 914ab28c59 tzsetup: add support for countries in two continents
This supports countries located across multiple continents, as per the
zone1970.tab file. This only affects Cyprus and Türkiye at the moment.

PR:		236874
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41306
2023-10-13 13:23:59 -04:00
Pierre Pronchery 60b37735f3 bsdinstall netconfig: avoid duplicate entries in rc.conf
This uses sysrc to write and update configuration variables in the
temporary configuration file for network access, ._rc.conf.net. This
replaces the previous mechanism, which was simply appending new values
as they were updated.

PR:		212396
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42194
2023-10-13 12:45:54 -04:00
Pierre Pronchery 01ab86f7e6 bsdinstall: reset the mirror when restarting
It is possible to restart the installation process upon errors, when
installing normally through the `auto` script, or when setting up a jail
with the `jail` script. However, some values obtained interactively from
the user or guessed by some scripts are kept in the environment when
restarting the process; this makes it impossible to run some steps as
expected after the restart.

For instance, if a bad choice of mirror was made in the `mirrorselect`
phase, restarting the installer remembers the choice made, and will
never prompt for a different one. Rebooting is then the only easy way
out of this situation.

This change only affects the `jail` script for now, as otherwise there
is no way to tell if the value had been specifically set by the user
before starting bsdinstall.

Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42183
2023-10-13 12:32:38 -04:00
Pierre Pronchery ac78e3e9c5 bsdinstall: Add "Finish" button to finalconfig
This adds a "Finish" button to the finalconfig step, replacing the
previous first choice, which was to "apply configuration and exit".
The new button is the default action, while the "OK" button is renamed
to "Select".

Also, if an unknown option is chosen, the code flow prompts the user
again instead of exiting.

Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42047
2023-10-13 12:23:01 -04:00
Pierre Pronchery a6d202077d bsdinstall: revisit the finalconfig step
This moves the "finalconfig" step into a dedicated script, where it uses
a loop instead of recursing into itself.

Reviewed by:	bapt
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42046
2023-10-13 12:19:39 -04:00
Alfonso S. Siciliano cdee659f93
sade: Fix F1 help message
Fix F1 message of the disk menu because the button label is "[Modify]".
This is a UI fix, no functional change.
2023-10-13 02:19:45 +02:00
Chuck Tuffli 32557d16e2 bhyve nvme: Add NQN value
Add a NVMe Qualified Name (NQN) to the Controller Data structure using
the "first format" (i.e., "... used by any organization that owns a
domain name" Section 7.9 NVM-Express 1.4c 2021.06.28 Ratified).

This avoids a Linux kernel warning about a missing or invalid NQN.

Reviewed by:	jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42058
2023-10-12 15:08:05 -07:00
Yuri Pankov da202b0fe6 bhyve: Document the hw.vmm.maxcpu tunable and the current limit on vCPUs
Reviewed by:	corvink (original version)
Co-authored-by: John Baldwin <jhb@FreeBSD.org>
Differential Revision:	https://reviews.freebsd.org/D40074
2023-10-12 12:49:47 -07:00
Kyle Evans 989c5f6da9 freebsd-update: create deep BEs by default
The -r flag to bectl needs to go away, and we need to just do the right
thing.  In the meantime, we can apply an -r in freebsd-update as a
minimal fix to stop creating partial backups in these (non-default) deep
BE setups.

PR:		267535
2023-10-11 21:54:03 -05:00
Emmanuel Vadot 0983e80a9a pkgbase: Move blacklist utilities to a new package
Unbloat a bit FreeBSD-utilities.
The only package that will depends on this new one is FreeBSD-ssh
which not anyone have in some setup.
And this will allow to have small pkgbase setup with ssh without
having to bring the bloated FreeBSD-utilities package
Name the package blocklist to reflect upstream futur changes.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42148
2023-10-11 21:07:05 +02:00
Alfonso S. Siciliano 04b465777a
bsdinstall auto: replace dialog with bsddialog
bsdinstall/scripts/auto: Replace dialog(1) with bsddialog(1).
2023-10-11 18:33:25 +02:00
Alfonso S. Siciliano 160ccec84c
bsdinstall: restore --calendar
Restore --calendar to select a date because bsddialog(1) >= 0.4
provides a calendar dialog.
2023-10-11 15:48:53 +02:00
Olivier Cochard 75ae7e436e syslogd: Prevent running tests in parallel
They all use the same listening port.

Approved by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D41989
2023-10-11 12:24:42 +02:00
Alfonso S. Siciliano 8df9efe877
bsdinstall: Fix command line argument list parsing
bsddialog(1) uses getopt_long(3) to parse command line argument list.
Add '--' to avoid errors caused by arguments (menu items) begin
with '-'.
The change is compatible with dialog(1) and Xdialog(1).
2023-10-11 10:17:04 +02:00
Alfonso S. Siciliano 7cff9672de
spkrtest.8: Add module info
Add the module and driver info as usual.

Approved by:		bcr, wosch
Differential Revision:	https://reviews.freebsd.org/D37710
2023-10-11 09:08:13 +02:00
John Baldwin f53355131f Trim various $FreeBSD$
Approved by:	markj (cddl/contrib changes)
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41961
2023-10-10 10:34:43 -07:00
Baptiste Daroussin 6d3c0798cc bsdconfig: rework packages selection TUI
Rework the packages TUI, do that the index caching is now done with
dialog --gauge (tested with cdialog and bsddialog).
With pkg we can know in avance the number of packages making it
possible to have a real gauge.

The cache of the index is now a file that can be sourced, meaning it
is not anymore an index like file, but a post process one, simplifying
the code.

Each menu is now built calling directly pkg rquery with just the
informations required to build the menu instead of parsing an indexfile

install all the awk index processing into a separate file to ease
reading and debuggung
2023-10-10 09:01:51 +02:00
Benedict Reuschling a3b3e89ff1 bhyve(8): Fix style warnings emitted by mandoc, no content changes 2023-10-09 16:43:35 +00:00
Felix Johnson 8120190f80 bhyve(8): Expand the -p option text with additional text and an example
PR:	249981
2023-10-09 16:32:33 +00:00
Danilo G. Baio 04c8bfc176 jexec.8: Add examples section
MFC after:	3 days
Reviewed by:	gbe, 0mp, danfe, pauamma_gundo.com
Differential Revision: https://reviews.freebsd.org/D40831
2023-10-07 19:44:44 -03:00
Dag-Erling Smørgrav cec8e6ba64 daemon: Disable stdio buffering.
The daemon utility already does its own buffering and retransmits its
child's output line by line.  There's no need for stdio to add its own
buffering on top of this.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D42111
2023-10-06 18:44:52 +02:00
Baptiste Daroussin 25fcf889bd bsdconfig: remove even more of the ftp support 2023-10-05 17:37:39 +02:00
Baptiste Daroussin 4ab0193290 bsdconfig: simplify pkg installation and ABI detection 2023-10-05 17:30:17 +02:00
Dag-Erling Smørgrav a401c8cb26 certctl: Split certificate bundles before processing.
This allows 'certctl rehash' to do the right thing when ca_root_nss is
installed, instead of linking the entire bundle to the hash of the
first certificate it contains.

MFC after:	3 days
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D42087
2023-10-05 17:11:22 +02:00
Dag-Erling Smørgrav 1525625c7c certctl: Clean up.
MFC after:	3 days
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D42086
2023-10-05 17:11:22 +02:00
Baptiste Daroussin 5ad9edd456 bsdconfig: use working respositories
pkg(8) packages have not been published in ftp.freebsd.org, so
remove this option
2023-10-05 14:44:18 +02:00
Baptiste Daroussin 5e7aa75744 bsdconfig: remove support for ftp, pkg does not support it anymore 2023-10-05 14:44:18 +02:00
Baptiste Daroussin 77e93191b9 bsdconfig: drop support for floppies
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D42083
2023-10-05 13:09:54 +02:00
Baptiste Daroussin 5b9f08dbc7 bsdconfig: always build and install
it does not depend on dialog(1) anymore
2023-10-05 09:51:16 +02:00
Alfonso S. Siciliano 30e9abf2fc bsdconfig(8): add bsddialog(1) support
Add bsddialog(1) to bsdconfig(8). This can be considered an increment not a
replacement, `$DIALOG=dialog' restores dialog(1).

Differential Revision:	https://reviews.freebsd.org/D37480
2023-10-05 09:31:18 +02:00
Mark Johnston 7228ad8da9 bhyve: Move the vm_inject_fault() implementation to vmexit.c
This function isn't generic and has a different signature on arm64.  No
functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40991
2023-10-04 12:53:17 -04:00
Mark Johnston 83b003fbe9 bhyve: Build the HPET ACPI table on amd64 only
There is no HPET on arm64 and vm_get_hpet_capabilities() is not
implemented there.  Move the vm_get_hpet_capabilities() call into
build_hpet(): I cannot see a downside, and doing so eliminates a global
variable and reduces the amount of code that needs to be conditionally
compiled.  No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40990
2023-10-04 12:53:17 -04:00
Mark Johnston f82af74c76 bhyve: Move most early initialization into an MD routine
Prior to initializing PCI devices, main() calls a number of
initialization routines, many of which are amd64-specific.  Move this
list of calls to bhyverun_machdep.c.  Similarly, add an MD function to
handle late initialization.

No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40989
2023-10-04 12:53:17 -04:00
Mark Johnston e20b74da22 bhyve: Move vcpu initialization into a MD source file
- Make handling of x86 config options, like x86.x2apic, conditional to
  amd64.
- Move fbsdrun_set_capabilities() and spinup_vcpu() to a new file,
  bhyverun_machdep.c.  The moved code is all highly x86 specific.

I'm not sure how best to handle the namespace.  I'm using "bhyve_" for
MD functions called from MI code.  We also have "fbsdrun_" for some MI
routines that are typically called from MD code.  The file name is
prefixed by "bhyverun_".

Reviewed by:	corvink
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40987
2023-10-04 12:53:17 -04:00
Mark Johnston ca2cda98d2 bhyve: Make gdb support optional
Add a BHYVE_GDB_SUPPORT make variable that can be set by per-arch
makefiles.  When set, BHYVE_GDB is defined and can be used as a
preprocessor predicate.  Use it to guard gdb stub calls in MI code.

The arm64 bhyve port currently does not have a functional gdb stub, but
that's not critical to landing the port, so this mechanism slightly
reduces the friction of adding support for a new platform.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40986
2023-10-04 12:53:17 -04:00
Mark Johnston 31cf78c921 bhyve: Make most I/O port handling specific to amd64
- The qemu_fwcfg interface, as implemented, is I/O port-based, but QEMU
  implements an MMIO interface that we'll eventually want to port for
  arm64.
- Retain support for I/O space PCI BARs, simply treat them like MMIO
  BARs for most purposes, similar to what the arm64 kernel does.  Such
  BARs are created by virtio devices.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40741
2023-10-04 12:53:17 -04:00
Mark Johnston 61429b49d2 bhyve: Conditionally compile framebuffer-related code
The arm64 port does not implement VGA, so move the device model sources.
Compile framebuffer code only on amd64 for now, but do not move the
sources, as we ought to be able to add support later.

No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40740
2023-10-04 12:53:17 -04:00
Mark Johnston 55c13f6e7a bhyve: Move legacy PCI interrupt handling under amd64/
Specifically, move IO-APIC, LPC and PIRQ routing code under amd64/.

Use ifdefs to conditionally compile related code in other files.  In
particular, legacy PCI interrupt handling is now compiled only on amd64.
This is not too invasive, but suggestions for a more modular approach
would be appreciated.

I am not sure why qemu fwcfg handling is tied to LPC, and I suspect it
should be decoupled.  In this commit I just apply an ifdef hammer, but
we will eventually want fwcfg on arm64 as well.

No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40739
2023-10-04 12:53:17 -04:00
Mark Johnston 71cc76e8d7 bhyve: Compile some device models only on amd64
These models register legacy PCI interrupts, which won't be supported in
the arm64 port.  In principle it should be possible to make these models
work on arm64 with a bit of effort, so don't move the sources to the
amd64 subdirectory.

No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40738
2023-10-04 12:53:17 -04:00
Mark Johnston c7c5d3e388 bhyve: Move AP startup code to amd64/
This code is only invoked via MD vmexit handlers.  No functional change
intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40737
2023-10-04 12:53:17 -04:00
Mark Johnston 4ab7aea8ec bhyve: Move the gvt-d driver to amd64/
It is amd64-only.  No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40736
2023-10-04 12:53:16 -04:00
Mark Johnston 75d1e855b0 bhyve: Move power management code to amd64/
This implements various x86-specific interfaces.  No functional change
intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40735
2023-10-04 12:53:16 -04:00
Mark Johnston a7f6c2ff73 bhyve: Move the RTC driver to amd64/
No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40734
2023-10-04 12:53:16 -04:00
Mark Johnston 548b11228f bhyve: Move MSR emulation into amd64/
No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40733
2023-10-04 12:53:16 -04:00
Mark Johnston 145ffd5db7 bhyve: Remove some unneeded includes from snapshot.c
MFC after:	1 week
Sponsored by:	Innovate UK
2023-10-04 12:53:16 -04:00
Mark Johnston 72f9c9d82f bhyve: Split vmexit handling into a separate file
Put it in amd64, since most of it is MD and won't be used on arm64.  Add
a bit of glue to bhyverun.h to make CPU startup and shutdown work
without having to export more global variables.  AP startup will be
reworked further in a future revision.

This makes bhyverun.c much more machine-independent.

No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40556
2023-10-04 12:53:16 -04:00
Mark Johnston a1642451ce bhyve: Move kernemu to amd64/
This code handles instruction emulation for accesses to various
amd64-specific MMIO regions.

No functional change intended.

Reviewed by:	corvink, jhb, emaste
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40554
2023-10-04 12:53:16 -04:00
Mark Johnston 4fe5b70cae bhyve: Move more amd64-specific code under amd64/
mptable and the e820 are both rather amd64-specific and can be moved
easily.

In the case of e820, move the registration with qemu_fwcfg into e820.c,
as it simplifies bhyverun.c a bit and I can't see any downsides.

No functional change intended.

Reviewed by:	corvink, jhb, emaste
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40552
2023-10-04 12:53:16 -04:00
Mark Johnston f927afc1a6 bhyve: Move some more amd64-specific drivers to their own subdir
No functional change intended.

Reviewed by:	corvink, jhb, emaste
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40551
2023-10-04 12:53:16 -04:00
Mark Johnston 4f2bd4027b bhyve: Start moving machine-dependent code into subdirectories
In preparation for an arm64 port, make an easy change which puts some
machine-dependent code in its own directory.

Going forward, code which is only used on one platform should live in a
MD directory.  We should strive to layer modules in such a way as to
avoid polluting shared code with lots of ifdefs.  For some existing
files this will take some effort.

task_switch.c and fwctl.c are an easy place to start: the former is very
x86-specific, and the latter provides an I/O port interface which can't
be used on anything other than x86.  (fwcfg as implemented has the same
problem, but QEMU also supports a MMIO fwcfg interface.)  So I propose
that we start by simply making those files conditional.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40501
2023-10-04 12:53:16 -04:00
Mark Johnston 01d53c34e7 bhyve: Improve pcifd function naming
read_config() and write_config() are externally visible, so give them
more descriptive names.  No functional change intended.

MFC after:	1 week
Sponsored by:	Innovate UK
2023-10-04 12:53:16 -04:00
Baptiste Daroussin 61ba55bcf7 bsddialog: import version 1.0 2023-10-04 18:12:03 +02:00
Ed Maste 30beebe444 freebsd-update: add a note about when files may be deleted
Files under /var/db/freebsd-update are required during the upgrade
process, and to support rollback.  They may be deleted if no upgrade is
in progress and rollback will not be required.

PR:		273601
Reviewed by:	bcr
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42022
2023-10-04 10:45:57 -04:00
Mitchell Horne 773606fcdf ofwdump: install dependent on MK_FDT
The utility depends on the presence of the openfirm(4) pseudo-device,
which is gated by the FDT kernel option. The MK_FDT knob is correctly
set to "yes" for FDT/OFW-enabled platforms (powerpc* included); use it
to install the utility and eliminate the arch-specific Makefile logic.

No functional change intended.

Reviewed by:	emaste, pkubaj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41977
2023-10-02 10:40:18 -03:00
Dimitry Andric 8a77bc5e1b makefs/zfs: fix build with gcc 12 after b5a2bf512d
Due to integer promotion rules, dn_nlevels (uint8_t) gets promoted to a
plain int, resulting in -Werror warnings with gcc 12:

  In file included from /workspace/src/usr.sbin/makefs/zfs.c:35:
  /workspace/src/usr.sbin/makefs/zfs.c: In function '_dnode_cursor_flush':
  /workspace/src/usr.sbin/makefs/zfs.c:684:23: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
    684 |         assert(levels <= c->dnode->dn_nlevels - 1);
        |                       ^~
  /workspace/src/usr.sbin/makefs/zfs.c:691:27: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
    691 |                 if (level == c->dnode->dn_nlevels - 1) {
        |                           ^~
  /workspace/src/usr.sbin/makefs/zfs.c: In function 'dnode_cursor_next':
  /workspace/src/usr.sbin/makefs/zfs.c:739:41: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
    739 |                 for (levels = 0; levels < c->dnode->dn_nlevels - 1; levels++) {
        |                                         ^

Fix it by subtracting 1U instead of 1.

Fixes:		b5a2bf512d
MFC after:	3 days
2023-09-30 20:27:20 +02:00
Mark Johnston b6da7f2fd1 makefs/zfs tests: Add a test case which appends to a file after import
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-09-28 16:36:12 -04:00
Mark Johnston ef20cd33d3 makefs/zfs: Ensure that the last block of a file has the right size
When copying a file's contents into the pool, a loop copies blocks of
the maximum size (128KB), allocating space from the vdev for each block.
The space allocator rounds up to the nearest block size, but for files
larger than the maximum size, this can result in the last block having a
smaller logical size than the rest of the blocks belonging to that
dnode.  This violates some ZFS invariants when appending to that file.

Modify fs_populate_file() to use the same block size for the final
block.

Reported by:	cperciva
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-09-28 16:16:17 -04:00
Jake Freeland 94cae4cb33 syslogd: Do not add shutdown sockets to the kqueue
If syslogd is in secure mode, all INET sockets are shutdown. Do not
add these to the kqueue because we can't read from them.

Also, remove the listen() call when setting up sockets. Syslogd
exclusively uses SOCK_DGRAM sockets, so calling listen() is useless.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41526
2023-09-28 11:51:54 -04:00
Jake Freeland 8536447a07 syslogd: Use pipe to communicate with daemon
Previously, syslogd's daemon process would signal that it had finished
initialization using SIGALRM. In capability mode, signal delivery is not
allowed, so use a pipe to indicate that it is ready to accept messages.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41459
2023-09-28 11:51:54 -04:00
Jake Freeland 4ac6582472 syslogd: Ignore signals in sigcatch[]
Instead of blocking signals in sigcatch[], just ignore them. This frees
up some space on the proc's sigqueue.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41433
2023-09-28 11:51:54 -04:00
Jake Freeland 7428ebfe7e syslogd: Pre-open null file descriptor
Open _PATH_DEVNULL before entering capability mode. Access to /dev/null
is needed for dup2() when piping commands.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41381
2023-09-28 11:51:54 -04:00
Jake Freeland c3175a6e1c syslogd: Do not open console descriptor
Setup consfile filed for logging while Initialized is false, but do not
bother opening the console. Close console/tty descriptors after parsing,
as well. The ttymsg() function will re-open these descriptors for us.

Also, remove references to the ctty global variable since it will always
be _PATH_CONSOLE.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41380
2023-09-28 11:51:54 -04:00
Jake Freeland 5b44c24f85 syslogd: unlink() -> unlinkat()
Save basename and dirname for use in unlinkat() when removing UNIX
sockets from fs.

Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41379
2023-09-28 11:51:53 -04:00
Jake Freeland 3854dd52a3 syslogd: Add closelogfiles() function
The closelogfiles() function completely disassembles the global filed
list by freeing all filed components and removing them from the list.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41388
2023-09-28 11:51:53 -04:00
Jake Freeland 09080d8ec5 syslogd: Fix sizeof() styling
Use parentheses when applying sizeof() per style(9).

Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41376
2023-09-28 11:51:53 -04:00
Jake Freeland 8f49f83ef5 syslogd: Move action parsing into its own function
Clean up the cfline() function by moving action parsing into its own
function.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41375
2023-09-28 11:51:53 -04:00
Jake Freeland f4b4a10abb syslogd: Move selector parsing into its own function
Clean up the cfline() function by moving selector parsing into its
own function.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41374
2023-09-28 11:51:53 -04:00
Jake Freeland 688ecad8e1 syslogd: Move prop_filter allocation into function
Clean up the cfline() function by moving the prop_filter memory
allocation into the prop_filter_compile() function.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41373
2023-09-28 11:51:53 -04:00
Jake Freeland cd90f3afb7 syslogd: Do not print bad data
If errno is zero, then buf is never filled and we're printing
uninitialized data. Print the msg buffer instead to mitigate this.

Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41371
2023-09-28 11:51:53 -04:00
Jake Freeland bbde787c66 syslogd: Merge loops
Merge the two loops that traverse the global filed queue. Both loops'
actions are not dependent on the other, so combining them is safe.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41370
2023-09-28 11:51:53 -04:00
Jake Freeland fe233250d6 syslogd: Do not reap child processes
Use the SA_NOCLDWAIT sigaction() flag to disable the creation of
zombie processes. This leaves no reason to wait() on children, so
remove the reaping routine.

Previously, deadq entries were removed in reapchild(). Move deadq
removal into markit() after SIGKILL is sent.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41415
2023-09-28 11:51:53 -04:00
Jake Freeland 95381c0139 syslogd: Use process descriptors
Prepare for program Capsicumization by storing process descriptors
instead of pids. Signal delivery is not permitted in capability mode,
so we can use pdkill(2) to terminate child processes.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41369
2023-09-28 11:51:53 -04:00
Jake Freeland 599db1e026 syslogd: Simplify filed structure
Rearrange fields and add some comments.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41368
2023-09-28 11:51:53 -04:00
Jake Freeland 929568b9d5 syslogd: Style fixes
Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41367
2023-09-28 11:51:53 -04:00
Jake Freeland fcc1e1777d syslogd: Simplify property filters
* Use enums for property filter properties and comparisons.
* Rename property and comparison values.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41366
2023-09-28 11:51:53 -04:00
Jake Freeland b772f1ce14 syslogd: Clean up allowedpeer structure
* Use boolean values in validate() and struct allowedpeer.
* Remove useless peer count loop.

Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41365
2023-09-28 11:51:53 -04:00
Jake Freeland f30b063ee6 syslogd: Only use peerlist during flag parsing
Add logging sockets directly to the socklist, unless parsing flags. The
peerlist is still needed to temporarily hold socket information until
the configuration flags have been parsed.

It is tempting to remove the entire peerlist, but addsock() can not
determine if syslogd is in secure mode unless the flags have been
parsed.

Also, call pidfile_open() right after flag parsing so we can terminate
if another syslogd instance is already running.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41364
2023-09-28 11:51:52 -04:00
Jake Freeland 1bb61348e6 syslogd: Use boolean reload parameter for init()
Replace init()'s integer "signo" parameter with boolean "reload"
for clarity.

Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41416
2023-09-28 11:51:52 -04:00
Jake Freeland f804f23650 syslogd: Centralize operations into a kevent loop
Use kqueue(2) for socket I/O and signal notification. Previously,
select(2) and traditional signal handlers were being used.

This change centralizes all of the async notification delivery into a
single loop so future Capsicum sandboxing will be easier. It also
simplifies the code by removing boiler-plate cruft that comes with the
older interfaces.

Reviewed by:	Slawa Olhovchenkov, markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41363
2023-09-28 11:51:52 -04:00
Jake Freeland 3f8b49dd1a syslogd: Replace int with bool, where applicable
Many of syslogd's global configuration options are declared as integers
but are treated as booleans. Declare those options as booleans instead.

Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41362
2023-09-28 11:51:52 -04:00
Jake Freeland 8113e030f9 syslogd: Move fhead under filed struct declaration
Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41360
2023-09-28 11:51:52 -04:00
Jake Freeland 2d69e4c373 syslogd: Remove addfile() and free up some memory
cfline() already allocates a filed structure on the heap, so we can
avoid redundant memory allocations by skipping a second calloc() inside
addfile().

addfile() can be removed altogether since a simple STAILQ_INSERT_TAIL()
will add the filed to the global filed list.

Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41359
2023-09-28 11:51:52 -04:00
Jake Freeland 931d05fc08 syslogd: Read configuration outside of init loop
Move all configuration-file code outside of the initialization loop and
into its own set of functions. Create a readconfigfile() to open the
config and call parseconfigfile() to parse it.

The init() function no longer returns if there was a failure to open the
configuration file. Initialization will be finished, using the backup
logging rules: *.ERR to /dev/console and *.PANIC to all logged in users.

Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41358
2023-09-28 11:51:52 -04:00
Mark Johnston 518bd54167 syslogd: Fix fd type, add enum for filed types
Reviewed by:	markj, emaste
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41357
2023-09-28 11:51:52 -04:00
Corvin Köhne 6a0e7f9088
bhyve: always generate ACPI tables
Most systems don't work properly without sane ACPI tables. Therefore,
we're always generating them.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41778
2023-09-28 10:43:04 +02:00
Mark Johnston 60c95af88f makefs/zfs: Remove a nonsensical comment
When populating files, makefs needs to copy their contents into
userspace in order to compute a checksum, so copy_file_range(2) is out
of the question.  Though, it could possibly be used when building other
types of filesystems.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-09-27 19:03:26 -04:00
Ed Maste f6d37c9ca1 freebsd-update: handle file -> directory on upgrade
Upgrading from FreeBSD 13.2 to 14.0 failed with
  install: ///usr/include/c++/v1/__string exists but is not a directory
because __string changed from a file to a directory with an LLVM
upgrade.

Now, remove the existing file when the type conflicts.  Note that this
is only an interim fix to facilitate upgrades from 13.2 for 14.0 BETA
testing.  This change does not handle the directory -> file case and
further work is needed.

PR:		273661
Reviewed by:	dim, gordon
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41893
2023-09-27 15:23:08 -04:00
Mitchell Horne c362fe939f pmcstat: fix duplicate event allocation on CPU 0
Commit b6e28991bf modified the allocation path for system scope PMCs
so that the event was allocated early for CPU 0. The reason is so that
the PMC's capabilities could be checked, to determine if pmcstat should
allocate the event on every CPU, or just on one CPU in each NUMA domain.
In the current scheme, there is no way to determine this information
without performing the PMC allocation.

This broke the established use-case of log analysis, and so
0aa1507751 was committed to fix the assertion. The result was what
appeared to be functional, but in normal counter measurement pmcstat was
silently allocating two counters for CPU 0.

This cuts the total number of counters that can be allocated from a CPU
in half. Additionally, depending on the particular hardware/event, we
might not be able to allocate the same event twice on a single CPU.

The simplest solution is to release the early-allocated PMC once we have
obtained its capabilities, and reallocate it later on. This restores the
event list logic to behave as it has for many years, and partially
reverts commit b6e28991bf.

Reported by:	alc, kevans
Reviewed by:	jkoshy, ray
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41978
2023-09-27 13:39:56 -03:00
Mark Johnston 87534f95dd makefs/zfs tests: Run zdb prior to importing makefs-created pools
zdb contains quite a few assertions that can help catch bugs.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-09-27 12:00:00 -04:00
Mark Johnston 46402fd216 makefs/zfs: Set the objset block pointer fill field correctly
It is supposed to contain the number of objects allocated from the set,
excluding the meta dnode.

Reported by:	mav
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-09-27 12:00:00 -04:00
Mark Johnston b5a2bf512d makefs/zfs: Use unsigned integers for indirect block level counts
No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2023-09-27 12:00:00 -04:00
Greg Lehey 915af88322 Explain the -d option. 2023-09-26 15:05:16 +10:00
John Baldwin eba230afba Purge more stray embedded $FreeBSD$ strings
These do not use __FBSDID but instead use bare char arrays.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41957
2023-09-25 07:54:56 -07:00
John Baldwin e4c68414d0 lpr: Remove now unused fallback definition for __FBSDID
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41956
2023-09-25 07:50:33 -07:00
Stéphane Rochoy d26c1a0f8b makefs: Handle missing link keyword in mtree spec
PR:		241178
Reviewed by:	emaste
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/850
2023-09-21 12:49:11 -04:00
Alan Somers 7d154c4dc6 mprutil: "fix user reply buffer (64)..." warnings
Depending on the card's firmware version, it may return different length
responses for MPI2_FUNCTION_IOC_FACTS.  But the first part of the
response contains the length of the rest, so query it first to get the
length and then use that to size the buffer for the full response.

Also, correctly zero-initialize MPI2_IOC_FACTS_REQUEST.  It only worked
by luck before.

PR:		264848
Reported by:	Julien Cigar <julien@perdition.city>
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	scottl, imp
Differential Revision: https://reviews.freebsd.org/D38739
2023-09-21 08:38:24 -06:00
Lars Kellogg-Stedman c0e249d32c
bsdinstall: avoid conflicts with fd 3
Throughout the bsdinstall script fd 3 is used by f_dprintf (set through
$TERMINAL_STDOUT_PASSTHRU). In several places in the bsdinstalls scripts,
we use fd 3 to juggle stdout when calling out to other tools, which can
cause the installer to fail with a "Bad file descriptor" error when
f_dprintf attempts to use it.

This commit replaces all constructs like this:

    exec 3>&1
    SOME_VARIABLE=$(some command 2>&1 1>&3)
    exec 3>&-

With:

    exec 5>&1
    SOME_VARIABLE=$(some command 2>&1 1>&5)
    exec 5>&-

PR:			273148
Reviewed by:		corvink
Fixes:			1f7746d81f ("bsdinstall: stop messing with file descriptors")
MFC after:		1 week
2023-09-21 08:41:48 +02:00
Juraj Lutter 39f4633b3d freebsd-update: Allow for upper/lowercase y/n
Allow for upper/lowercase y/n in "Does this look right?" question.

Reviewed by:		emaste
Approved by:		emaste
Differential revision:	https://reviews.freebsd.org/D40434
2023-09-20 18:50:11 +02:00
Stephen J. Kiernan 8789e3b021 rpcbind: Add flag for foreground mode
Added the -N flag to enable foreground mode.

It is useful to be able to run rpcbind in foreground mode when
starting from launcher applications. The existing debug flag
is not sufficient as it enables additional debug messages.

Update man page to document the added flag.

Reviewed by:	imp
Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D41674
2023-09-20 11:40:52 -04:00
Ed Maste 84696cf10c makefs: remove ISO9660 Archimedes extension support
We have no need to create ISO images with RISC OS specific metadata.

Reviewed by:	imp
Relnotes:	yes
Obtained from:	OpenBSD a435da44c07f
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39344
2023-09-20 07:37:19 -04:00