Commit graph

20710 commits

Author SHA1 Message Date
Jessica Clarke 7143521f4c Revert "bsdinstall: separate out dist selection in prep for pkgbase support"
Firstly, my review comments were not addressed and instead totally
ignored. Secondly, and a more valid justification for the revert, this
completely breaks the installer, since selectdists isn't installed.
Given the blatant lack of testing, back out this commit until it has
actually been tested and review comments taken on board so that the
installer actually works.

This reverts commit 009d3f66cb.
2024-02-03 01:31:11 +00:00
Lexi Winter 0a49be722f traceroute6: remove -l flag
The -l flag was used to tell traceroute6(8) to show both hostname and
address for each hop.  However, traceroute(8) already does this by
default, and there's no reason for traceroute6 to behave differently.

Make this the default behaviour, and accept -l for backward
compatibility as a no-op flag.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1023
2024-02-02 14:49:13 -07:00
Graham Perrin 0b287d19e4 freebsd-update(8): Update date
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/826
2024-02-02 13:36:50 -07:00
Graham Perrin 4c1c516c1a freebsd-update(8): wrap to 80 columns
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/826
2024-02-02 13:36:37 -07:00
Graham Perrin a8c1ffca7a freebsd-update(8): Explain conflicts in /etc
Unlike etcupdate(8), freebsd-update only prints the files with
conflicts. It doesn't merge.

PR: 204549
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/826
2024-02-02 13:35:25 -07:00
Lexi Winter 4b1d3a3091 daily/223.backup-zfs: improve daily_backup_zfs_verbose behaviour
- 223.backup-zfs would previously honour the daily_backup_zfs_verbose
  flag for zfs/zpool list, but not for the properties list.  fix it to
  show a diff for both of these if requested.

- if daily_backup_zfs_verbose was disabled, 223.backup-zfs would still
  set rc=1 if the backup files changed, which caused periodic(8) to send
  a useless email even if daily_show_success=NO was set.

  change this so that it only sets rc=1 if diff output is enabled, i.e.
  the output is actually useful to the admin.

MFC after:	2 weeks
Reviewed by:	imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1091
2024-02-02 11:27:05 -07:00
Mina Galić f4613af424 kldxref: Fix maketempfile function's way of finding the root dir
Rather than assuming that the "root" is passed as directory and will be
marked by a trailing slash, we just assume that the directory, which has
been checked previously to be a directory, is a directory.

This fixes an inconsistency between `kldxref /boot/modules`, which tries
to create the temp file in `/boot/`, and `kldxref /boot/modules/`, which
tries to create it in `/boot/modules/` itself.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1093
2024-02-02 08:35:49 -07:00
Baptiste Daroussin 0f4e803733 kbdmap: fix typo preventing kbdmap to work under vt 2024-02-01 08:45:50 +01:00
Baptiste Daroussin f14ea00c8f kbdmap: remove debug 2024-02-01 08:45:50 +01:00
Gregory Neil Shapiro 19d4fb85bf Add new source file for sendmail 8.18.1 2024-02-01 00:04:53 +00:00
Brad Davis 009d3f66cb bsdinstall: separate out dist selection in prep for pkgbase support
No functional change intended.

Approved by:	asiciliano
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43621
2024-01-31 15:05:27 -07:00
Enji Cooper d6251ebad5 periodic: fix a typo in a comment
No functional change.
2024-01-31 12:45:32 -08:00
John Baldwin c46860dbcb bhyve: Use NVMEF macro to construct fields
Reviewed by:	corvink, chuck (older version)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43607
2024-01-29 11:02:07 -08:00
John Baldwin c85b3903d1 bhyve: Use the NVMEM macro instead of expanded versions
Reviewed by:	corvink, chuck
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43603
2024-01-29 11:00:09 -08:00
John Baldwin 1dade1f255 nvme: Rename NVMEB helper macro to NVMEM
The current macro always builds a full mask for a named field, so use
the M suffix for mask.

Reviewed by:	chuck, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43601
2024-01-29 10:58:28 -08:00
John Baldwin c426923606 bhyve: Use NVMEV to read the ASQS field of AQA
This is not a functional change, but just being consistent instead of
omitting a shift by 0.

Reviewed by:	corvink, chuck, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43600
2024-01-29 10:51:07 -08:00
John Baldwin c9d9315b74 camdd: Use the NVMEV macro instead of expanded versions
Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43599
2024-01-29 10:50:41 -08:00
John Baldwin 94962f5a72 bhyve: Use the NVMEV macro instead of expanded versions
Reviewed by:	corvink, chuck (older version)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D43598
2024-01-29 10:49:49 -08:00
Lexi Winter a84e01f02b service(8): direct user to rc(8) for a list of valid commands
New users may refer to service(8) to discover how to manage services,
but this manpage does not explain which commands are permitted besides
start/stop (for example, 'enable').  Add a paragraph that directs the
reader to rc(8) to discover this.

While here, add a few examples of common use-cases.

Reported by:	Mina Galić <freebsd@igalic.co>
Pull request:	https://github.com/freebsd/freebsd-src/pull/1057
2024-01-29 18:47:09 +01:00
Warner Losh 2b92b754f1 kldxref: Be more conservative about what we reject.
kldxref anything whose name doesn't end in .ko or that has no dots (eg
the kernel).

Sponsored by:		Netflix
Reviewed by:		jrtc27, jhb
Differential Revision:	https://reviews.freebsd.org/D43507
2024-01-28 21:45:23 -07:00
Andriy Gapon bf87d4a4bf efibootmgr: fix potential endless loop with -v
I observed the problem on a system with fairly old and, apparently,
buggy EFI implementation.  A list of boot devices had an invalid
trailing entry.  efidp_size() for that entry returned zero, which means
that the code got stuck looping on that entry.
2024-01-28 15:20:29 +02:00
Ed Maste 176b9e0d72 makefs: warn that ffs sectorsize other than 512 may not work
newfs always sets sectorsize to DEV_BSIZE (512) and derives some other
values based on the number of 512-byte sectors per real sector.  Similar
logic is required in makefs.  Until that happens, emit a warning that
the image may be incorrect.

PR:		276571
2024-01-26 17:27:57 -05:00
Mark Johnston d56ce5915c mpsutil: Clean up libutil deps
mpsutil doesn't use libutil, so doesn't need to include libutil.h.  See
commit 76103694a0.

No functional change intended.

MFC after:	1 week
2024-01-24 17:10:24 -05:00
Ed Maste 1f41c1c1a3 crunch: remove fdisk from examples
It has been deprecated for a long time; gpart should be used instead.
The man page was updated in 2015 to declare it obsolete (b8c19fd719).
2024-01-24 09:12:19 -05:00
Mark Johnston 5f086566e0 bhyve: Prepare to add arm64 support to the gdb stub
In particular:
- Stop assuming that the breakpoint size is one byte.
- Avoid referencing the "rip" field in machine-independent code, use a
  helper.

No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D43483
2024-01-23 11:41:13 -05:00
Mark Johnston 5e728af444 bhyve: Simplify register definitions a bit
It's awkward to have separate tables for information which is logically
connected.  Merge the gdb_regset[] and gdb_regsize[] arrays and update
gdb_read_regs() to cope with the result.  This makes the addition of
arm64 support a bit cleaner.

No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D43481
2024-01-23 11:40:52 -05:00
Mark Johnston cfa2c78aee bhyve: Avoid underflows when handling remote commands
Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D43480
2024-01-23 11:40:40 -05:00
Christos Margiolis 9f550134a4 acpiconf: remove trailing space in "Mesurement Accuracy" output
No functional change intended.

MFC after: 1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43561
2024-01-23 17:39:40 +02:00
Jamie Gritton 768149ff15 jail: make sure jail.conf parse errors exit, and not crash.
Reported by:	Mason Loring Bliss
2024-01-20 21:20:59 -08:00
Mark Johnston e0deb85065 makefs: Make it possible to silence warnings about duplicate paths
When generating a VM image from an installworld mtree manifest, makefs
spits out several thousand warnings about duplicate paths in the
manifest.  These are harmless and have been around for a long time (see
the phabricator revision for some more details), so let's at least have
a way to make makefs quieter.

Reviewed by:	brooks, imp, emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D43513
2024-01-19 19:50:56 -05:00
Robert Wing fdd1e1a564 bhyve: correct slirp_recv_disable()
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D43472
2024-01-17 09:12:44 -09:00
Goran Mekić 6caa19a08b fwget: Use versioned packages for RDNA3 firmware
Fixes:	f596620302 ("fwget: Update for Radeon RX 7900 XT (RDNA3) PCI-ID")
Pointy hat to:	manu
2024-01-17 11:10:49 +01:00
Goran Mekić f596620302 fwget: Update for Radeon RX 7900 XT (RDNA3) PCI-ID
Latest DRM/firmware added support for RDNA3 based GPUs,
update fwget with the proper PCI ID.

Differential Revision:	https://reviews.freebsd.org/D43468
2024-01-17 10:38:07 +01:00
Alexander Leidinger e0dfe185cb jail(8): add support for ZFS datasets
Add zfs.dataset to jail(8) to add a list of ZFS datasets.
Bump FreeBSD version for jail managers to switch to native
dataset support.

Datasets are attached to the jail after the jail creation and
before the execution of any start command. Unlike current
implementations in jail managers which attach datasets after
the start command, this allows the zfs rc.d script to mount
the datasets on start.

Discussed with:	jamie
2024-01-17 08:40:40 +01:00
rilysh e2e956828c bhyve: return ENOMEM instead of EFAULT and call free() after being used
1. In basl_load() function, when allocation fails,
it returns an EFAULT instead of ENOMEM. An EFAULT
can mislead in some scenarios, whereas an ENOMEM
for an allocation function makes much more sense.

2. Call free() on addr, as it's not being used
anymore after the basl_table_append_bytes()
function.

Signed-off-by: rilysh <nightquick@proton.me>

MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1016
2024-01-16 09:39:25 -05:00
Pete Zaitcev 11500481c8 mptable: improve error reporting for invalid commands
mptable ignores arguments with matching first letters, report errors
when it gets garbate.

PR: 38727
Reviewed by: imp
2024-01-15 17:57:28 -07:00
Mark Johnston 2524b7dfb0 crashinfo: Print stack traces for all on-CPU threads
Add a python script which implements the bulk of this functionality.
Over time, this would ideally evolve into a library of python routines
which can be used to inspect kernel data structures and automate some
debugging tasks, similar to jhb's out-of-tree scripts, but written in a
somewhat nicer language and with better integration into the kgdb
command prompt.

Note that kgdb currently won't auto-load scripts in this directory.
This should perhaps change in the future.  It probably also makes more
sense to have a crashinfo.py which provides all the kgdb output that we
want to include in core.txt, rather than having crashinfo.sh pipe in
several commands.

Reviewed by:	avg, imp
Discussed with:	jhb
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33817
2024-01-15 16:36:40 -05:00
Michael Tuexen 256fe4a154 tcpsso: fix TIME_WAIT description in man-page
Reviewed by:		manpages(pauamma_gundo.com)
Fixes:			e179d9739b ("tcpsso: support TIME_WAIT state")
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D43424
2024-01-14 14:45:43 +01:00
Peter Grehan 0c243cd4a3 Fix issue with Linux guest XHCI tablet probing.
The USB3 spec mandates that the	device-descriptor max packet size
be 512 bytes, which requires a field size of 9 since it	is a
power-of-2.

Linux kernels recently started validating this field, resulting	in
the table not being probed and the cursor not working in bhyve VNC.

Reviewed by:	corvink
PR:		275760
MFC after:	1 week
2024-01-14 21:38:55 +10:00
Alexander Ziaee 246e0457d9 mixer.8: Add terse example for increasing volume
Reviewed by:	jhb
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1044
2024-01-12 14:55:36 -08:00
Kyle Evans 5df041c4bb bhyveload(8): document some SECURITY CONSIDERATIONS
The situation is improved now that we're running in a sandbox, but there
is still some host machine access that could be concerning depending on
the context.  These concerns may be somewhat mitigated by the fact that
the host machine usually provides the loader binary, even when the guest
image is providing the loader scripts -- they only bring the lua
scripts, and they have to be able to execute arbitrary syscalls rather
than the interfaces provided by libsa(3).

Reviewed by:	jhb, markj
Differential Revision:	https://reviews.freebsd.org/D43299
2024-01-12 13:58:16 -06:00
Yoshihiro Takahashi 1fa4ddcc6d periodic: Fix periodic reports when log files are not compressed.
The modern zcat(1) is capable of handling compressed and uncompressed
text files, so we can simply use zcat command.

PR:		253168
Reviewed by:	delphij
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D43357
2024-01-10 20:48:56 +09:00
John Baldwin 6631e2f9b4 kldxref: Workaround incorrect PT_DYNAMIC in existing powerpc kernels
Existing powerpc kernels include additional sections beyond .dynamic
in the PT_DYNAMIC segment.  Relax the requirement for an exact size
match of the section and segment for PowerPC files as a workaround.

Reported by:	jrtc27
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43123
2024-01-09 10:57:48 -08:00
Michael Gmelin 731704f5ea bsdinstall: Fix installation script splitting
This allows writing setup scripts that contain lines starting with
"#!", e.g., a shebang when creating a shell script using cat:

    #!/bin/sh
    echo "Populate rc.local"
    cat >/etc/rc.local<<EOF
    #!/bin/sh
    echo booted | logger -s -t 'example'
    EOF

Prevent accidentally running a setup script left behind by a
previous invocation of bsdinstall.

Reviewed by:	imp, jrtc27
Differential Revision:	https://reviews.freebsd.org/D43350
2024-01-09 19:14:17 +01:00
Daniel Ebdrup Jensen 45486372ca nfsv4(4): Reflow lines to 80 character limit
In belatedly fixing a mistake made in fbbdfa2b8a, I noticed that igor
and mandoc -Tlint had a few more things to say.

As such, I'm reflowing a few lines and fixing a contraction.

MFC with:	fbbdfa2b8a
2024-01-09 12:14:57 +01:00
Daniel Ebdrup Jensen c925f0720f nfsv4(4): Belatedly bump .Dd
I forgot to do it when making the commit, so hat-tip to asomers@

Reported by:	asomers@
Fixes:		fbbdfa2b8a (nfsv4(4): mention the nfsv4_server_only..)
MFC with:	fbbdfa2b8a
2024-01-09 12:14:56 +01:00
Kyle Evans cef5e56f3f bhyveload: add CAP_SEEK to our dirfd rights
In the case of hostbase_fd, this is infact a bug fix; we have a seek
callback that the host: filesystem may use in loader, and we really
don't have a good excuse to break it.

bootfd-derived fds will only be used with fdlopen(3) and rtld doesn't
seem to need pread / lseek at all for it today, but there's no reason to
break if it finds a good reason to later.

Suggested by:	markj
2024-01-08 21:08:16 -06:00
John Baldwin 78258ee013 kldxref: Correct contract number in license ACK
Reviewed by:	brooks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D43371
2024-01-08 17:01:05 -08:00
Kyle Evans a4a838a31a bhyveload: make error printing consistent
Previously we used a mix of perror(3) + exit(3) and err(3); standardize
on the latter instead.  This does remove one free() in an error path,
because we're decidedly leaking a lot more than just the loader name
there (loader handle, vcpu, vmctx...) anyways.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43331
2024-01-08 11:49:40 -06:00
Michael Tuexen e179d9739b tcpsso: support TIME_WAIT state
TCP endpoints in TIME_WAIT are not handled in a special way anymore.
Therefore, they can be handled now by tcpsso.

Reviewed by:		rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D43351
2024-01-06 21:31:46 +01:00
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