Commit Graph

20230 Commits

Author SHA1 Message Date
Warner Losh
9524e274b5 Remove $FreeBSD$: one-line xdr pattern
Remove /^\s*%\s*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:55:47 -06:00
Warner Losh
9636a14538 Remove $FreeBSD$: two-line lua tag
Remove /^--\n--\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:30 -06:00
Warner Losh
05248206f7 Remove $FreeBSD$: one-line bare tag
Remove /^\s*\$FreeBSD\$$\n/
2023-08-16 11:55:20 -06:00
Warner Losh
b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh
fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh
c857356409 Remove $FreeBSD$: alt one-line .c pattern
Remove /^\s*__RCSID\("\$FreeBSD\$"\);\n/
2023-08-16 11:54:53 -06:00
Warner Losh
da5432eda8 Remove $FreeBSD$: alt two-line .c pattern
Remove /^\s*__RCSID\("\$FreeBSD\$"\);\n\n/
2023-08-16 11:54:48 -06:00
Warner Losh
1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh
2a63c3be15 Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:29 -06:00
Warner Losh
42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Warner Losh
b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Corvin Köhne
85a775e61b
bhyve: add Qemu PPI emulation for TPM devices
Windows requires a physical presence interface to recognize the TPM
device. Qemu's OVMF has an implementation for the PPI which can be
reused. Using the Qemu PPI makes it very easy because we don't have to
implement new PPI functionality into our OVMF. The Qemu implementation
is already there.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40462
2023-08-14 10:17:36 +02:00
Rick Macklem
2409231121 mountd: Fix type of signal variable
Without this patch got_sighup(), which is the SIGHUP handler,
would set a variable of type int.

This would appear to be incorrect, although it has worked reliably.
This patch changes the type to "_Atomic(int)", which appears
to be all that is needed to correct it.

Reported by:	pen@lysator.lui.se
Reviewed by:	theraven, karels (prev version), kevans (prev version)
Differential Revision:	https://reviews.freebsd.org/D41265
2023-08-10 12:50:35 -07:00
Corvin Köhne
29200a8133
bhyve: emulate TPM passthru by accessing /dev/tpmX
To send commands to the TPM device, bhyve can use the host TPM driver by
reading and writing from /dev/tpmX. Using this approach, only the host
TPM driver has to detect and interact with the physical TPM interface.
This simplifies bhyve's code much. As the host TPM driver has to
interact with the TPM regardless of bhyve making use of it or not, makes
it a good approach.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40460
2023-08-10 09:23:42 +02:00
Corvin Köhne
28dc1aa733
bhyve: add emulation for CRB register of TPM devices
Trap accesses to the CRB MMIO range and emulate them properly.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40459
2023-08-10 09:23:33 +02:00
Marius Strobl
9ec7a595ed mergemaster(8): Remove support for sparc64 2023-08-06 22:28:46 +02:00
Doug Rabson
1d7ffb373c pkgbase: reorganise caroot and openssl packages
This splits out the certctl utility into a new certctl package and the
openssl libs into an openssl-lib package.

PR:		272816
Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D41321
2023-08-05 09:30:35 +01:00
Gordon Bergling
85dab3fe7a i2c.8: Fix a typo in the manual page
- s/endianess/endianness/

MFC after:	5 days
2023-08-04 13:50:48 +02:00
John Baldwin
bed3ae1d78 bhyve: Fully reset the fwctl state machine if the guest requests a reset.
If a guest tries to reset the fwctl device while a pending request was
in flight, the fwctl state machine can be left in an incomplete state.
Specifically, rinfo is not cleared.

Normally the state machine for fwctl alternates between REQ (receiving
request) and RESP (sending response) and ignores port writes while in
RESP or port reads while in REQ.  Once a guest completes the writes to
the port to send a request, the state machine transitions to RESP and
ignores future writes.

However, if a guest writes a full request and then resets the fwctl
device, the state would transition to REQ without draining the pending
response or discarding the received request.  Instead, additional
port writes after the reset were treated as new payload bytes, but
were appended to the previously-received request and could overflow
the fget_str buffer.

To fix, fully reset the fwctl state machine if the guest requests a
reset.

admbugs:	998
Approved by:	so
Reviewed by:	markj
Reported by:	Omri Ben Bassat <t-benbassato@microsoft.com>
Security:	FreeBSD-SA-23:07.bhyve
Security:	CVE-2023-3494
2023-08-01 15:45:41 -04:00
Jessica Clarke
309ec6ab28 etcupdate: Remove redundant semicolons
Fixes:	03e62670c3 ("etcupdate: Consolidate nobuild cases and make more robust")
2023-07-27 07:55:13 +01:00
Jessica Clarke
246364454f etcupdate: Use new buildetc and installetc targets when available
These new targets avoid the need to invoke internal build system targets
or set internal variables when building, and also have the added benefit
of working with BUILD_WITH_STRICT_TMPPATH. Old source trees lacking such
targets will not work with BUILD_WITH_STRICT_TMPPATH; they could be made
to work by copying the steps, but it's not worth doing so, as they never
have worked in the past. The primary goal of this is to support changing
the default of BUILD_WITH_STRICT_TMPPATH to enabled.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D41206
2023-07-27 05:10:49 +01:00
Jessica Clarke
03e62670c3 etcupdate: Consolidate nobuild cases and make more robust
The distrib-dirs and distribution steps are shared between the two, the
only difference is whether MAKEOBJDIRPREFIX is in the environment for
the latter. Having in the environment for the former is currently not
needed but does no harm and will be needed in future, so we can just
export it up-front in the subshell. When we do distrib-dirs relative to
_obj and everything also doesn't matter, so move it next to distribution
where it makes more sense. Finally, to avoid complicated && chains, use
"|| exit 1" everywhere to make the subshell fail, and add an extra one
on to the cd $SRCDIR to handle that failing (otherwise we'd go on and
try to build the current directory after cd prints its error, which is
unhelpful).

These changes will make it easier to bundle these steps up into new
top-level targets to allow the build system to manage the steps rather
than etcupdate, which will also handle BUILD_WITH_STRICT_TMPPATH, which
currently does not work with etcupdate.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D41204
2023-07-27 05:10:48 +01:00
Marius Strobl
4ef1c6f75d base: Remove support for the VTOC8 partitioning scheme
The removal of the sparc64 support in February 2020 obsoleted the
VTOC8 partitioning scheme as no other FreeBSD platform makes use
of it. Moreover, the code is bitrotting as nothing defines e. g.
LOADER_VTOC8_SUPPORT any more and, thus, should go now, too. With
this change, the following commits are reverted as far as VTOC8
is concerned and parts haven't already previously been deleted
along with prior sparc64 removals:
094fcb157d
a7d366e958
ba8d50d08b

The alignment example d9711c28ef
added to the VTOC8 section of gpart.8 is folded into the MBR one.

This should finally conclude the deorbit of sparc64-specific bits.

        We had joy, we had fun
        we ran Unix on a Sun.
        But that source and the song
        of FreeBSD have all gone.

Credits to Michael Bueker for the original "Unix on a Sun" and Rod
McKuen for the "Seasons in the Sun" lyrics.
2023-07-26 13:16:12 +02:00
Yuri Pankov
bb255cee93 tzsetup: fix "misleading indentation" warning with -DVERBOSE 2023-07-26 12:33:42 +02:00
Vitaliy Gusev
65f8467e33
bhyvectl: Add '--get-debug-cpus' command
vmm and libvmmapi already have handlers for that. When adding debug
cpus, they were only used for the debug stub. Over time, they were
reused by other parts like snapshots or idle APs.

Reviewed by:		corvink, jhb
MFC after:		1 week
Sponsored by:		vStack
Differential Revision:	https://reviews.freebsd.org/D40804
2023-07-25 14:03:54 +02:00
Corvin Köhne
f0124ab111
bhyve: do not hold CRB mutex when executing TPM commands
TPM commands can take up to several seconds to execute. If we hold the
CRB mutex while executing the command, MMIO accesses could be blocked
for a long time. Therefore, just copy all required values and work on
the copied values.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40724
2023-07-25 08:50:23 +02:00
Ed Maste
e0a63d875e pciconf: add PCIe 5.0 and PCIe 6.0 link speeds
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40710
2023-07-20 13:39:17 -04:00
Naman Sood
181692ab08
pw: Add regression tests for useradd bug fixes
PR:		238995
Reviewed by:	jrm
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41080
2023-07-19 10:43:12 -03:00
Naman Sood
1a8d37b8cf
pw: Use existing group entry, even if it already has members
Fix the following problem:

1. A nonexistent user, someuser, is added to /etc/group as
   someuser:*:12345:someuser.
2. someuser is then created with the default login group.

A second group entry for someuser will be created.

   someuser:*:12345:someuser
   someuser:*:12346:

With this fix, the existing group entry will be used.

PR:		238995
Reviewed by:	bapt, jrm
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41057
2023-07-19 10:40:53 -03:00
Naman Sood
17839f45d8
pw: Ensure group membership is not duplicated
Fix the following problem:

1. A nonexistent user, someuser, is added to somegroup in /etc/group.
2. someuser is then created with membership in somegroup.

The entry for somegroup in /etc/group will then contain

    somegroup:*:12345:someuser,someuser

With this fix, the entry will be

    somegroup:*:12345:someuser

PR:		238995
Reviewed by:	bapt, jrm
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41076
2023-07-19 10:36:09 -03:00
Sven Ruediger
9efad6f9e1 add defaults for adduser.sh (OK? [yes] & additional user [no])
Event:		Kitchener-Waterloo Hackathon 202305
Differential Revision:	https://reviews.freebsd.org/D40157
2023-07-18 10:37:48 -07:00
Mark Johnston
af20d58ef1 bhyve: Remove an unneeded vm_get_register() call in main()
At one point the RIP value was passed to fbsdrun_addcpu(), but this is
no longer the case.  No functional change intended.

Reviewed by:	jhb, corvink
Sponsored by:	Innovate UK
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D40988
2023-07-17 11:15:54 -04:00
Mark Johnston
0855749d29 bhyve: Fix whitespace in bhyverun.c
No functional change intended.

MFC after:	1 week
2023-07-17 11:15:49 -04:00
Mark Johnston
0dea4f064d bhyve: Deduplicate some code in modify_bar_registration()
No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40877
2023-07-11 15:22:37 -04:00
Mitchell Horne
a5b3e56330 pmcstat(8): Drop .Ud
This utility has existed for a long time and should not be advertised as
"currently under development".

While here, fix the one other warning from igor about using a newline
for a new sentence.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-07-10 14:30:03 -03:00
Alfonso Gregory
a2cc93ec7f Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory
a9cce232a6 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Alfonso Gregory
72e1ea2f13 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Emmanuel Vadot
c81495a621 fwget: Fix quoting
This kind of quoting doesn't work, no idea why shellcheck wanted this.
If there is a "safer" way to "fix" this feel free to do it just test
that it's working after.

Reported by:	Kenneth Raplee <kenrap@kennethraplee.com>
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Fixes:	7ad4d94d5b ("Fix some shell issues by adding quotes and replace backticks with $()")
2023-07-07 09:19:41 +02:00
Vadim Goncharov
a81b559dad Fix saving STRUCTURED-DATA in RFC 5424 log format
When saving log files in RFC 5424 format presence of STRUCTURED-DATA
in message caused line to not appear in log file at all, because
a variable forgotten to initialize. This could be tested by (slightly
modified) example from RFC:

    echo '<165>1 2003-10-11T22:14:15.003Z mymachine.example.com su 12345 ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][id@2 test="tast"] BOM"su root" failed for lonvick on /dev/pts/8" ' | nc -w1 -Uu /var/run/log

While here, update stale information in comment to logmsg() that RFC 5424
log format was not supported.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/717
2023-07-06 23:15:10 -06:00
Warner Losh
761ab48d6a kbdcontrol: Remove compat code for 4.x -> 5.x transition
I think we're safely past that now...

Sponsored by:		Netflix
2023-07-06 23:10:18 -06:00
Michael
971bac5ace kbd: consolidate kb interfaces (phase one)
Refactor to eliminate duplicated rate and delay tables, with minor style
tweaks for changed lines.  Remove an obsolete comment about needing to
convert from microseconds to ticks (that's done elsewhere). Remove
traiing whitespace in kbdcontrol.c.

Except for the new warning, no change in behavior

Sponsored by: 		DSS GmbH
Reviewed by:		imp [minor style tweaks as well]
Pull Request:		https://github.com/freebsd/pull/683
Differential Revision: 	https://reviews.freebsd.org/D38818
2023-07-06 23:10:18 -06:00
Mateusz Guzik
65e55a0a2a flowctl: low-effort fix to make it compilable with neither inet nor inet6 2023-07-05 10:03:10 +00:00
Mateusz Guzik
fda83023cd jls: low-effort fix to make it compilable with neither inet nor inet6 2023-07-05 10:03:07 +00:00
Mark Johnston
f4841d8af0 bhyve: Rename a pci_cfgrw() parameter
pci_cfgrw() may be called via a write to the extended config space,
which is memory-mapped.  In this case, the name "eax" is misleading.
Give it a more generic name.  No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40732
2023-06-28 16:29:49 -04:00
Mark Johnston
13013d266e bhyve: Stop calling pci_lintr_request() in the NVMe device model
The device model effectively assumes that MSI-X is enabled (it never
asserts the legacy interrupt), so any guest which relies on being able
to use the legacy PCI interrupt will fail.

The WIP arm64 port does not implement legacy PCI interrupts, but NVMe
emulation is potentially useful there.  Simply remove the call.

Reviewed by:	corvink, chuck, jhb
Tested by:	chuck
MFC after:	1 month
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40731
2023-06-28 16:29:49 -04:00
John Baldwin
a80e5bdff5 camdd: Remove some dead code but also make -E functional.
- Pass down the top-level arglist from main down to camdd_rw and use
  it in place of the hardcoded CAMDD_ARG_ERR_RECOVER when calling
  camdd_probe_pass.  This now disables error recovery by default
  unless -E is specified.

- Use the return value of parse_btl to determine if an explicit LUN
  was specified.

- Remove most CAMDD_ARG_* flags that are only set and never checked.
  CAMDD_ARG_VERBOSE remains, but could perhaps be removed (and possibly
  -v should be removed as well since it is currently a no-op).

Reported by:	clang -Wunused-but-set-variable (arglist in main)
Differential Revision:	https://reviews.freebsd.org/D40666
2023-06-28 11:12:50 -07:00
John Baldwin
2309909919 bsdinstall: Handle errors from geom_gettree.
geom_gettree probably never fails, and if it does there isn't much of
a fallback other than aborting partitioning.  However, a few places
were checking the return value and not doing anything with it
triggering a unused-but-set-variable warning.  Checking the errors
resolves the warning.

While here, check for errors in other places that weren't checking for
them at all, remove a spurious double call (the second call overwrote
the mesh structure leaking all the pointers from the first), and close
a few resource leaks on error paths.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D40779
2023-06-28 11:11:00 -07:00
Benedict Reuschling
7776cec946 Add quotes around variables and replace backticks with $()
The quotes are added to prevent word splits and globbing. Some
whitespaces were also removed after variables.

Approved by:	imp
Differential Revision: https://reviews.freebsd.org/D40726
2023-06-28 16:48:39 +00:00