1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00
Commit Graph

20865 Commits

Author SHA1 Message Date
Pierre Pronchery
f505f9a842 bhyve: simplify slot validation in xHCI emulation
This is a follow-up to commit e72d86ad9c ("bhyve: improve input
validation in pci_xhci") -- introducing a helper for slot validation.

Co-authored-by:	John Baldwin <jhb@FreeBSD.org>
Reviewed by:	markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46696
2024-09-21 13:36:10 -04:00
Mark Johnston
7cfdb02a73 bhyve: Fix an inverted check when enabling PCI busmastering
Reported by:	Andy Fiddaman <andy@omniosce.org>
Fixes:	e962b37bf0 ("bhyve: Do not enable PCI BAR decoding if a boot ROM is present")
2024-09-21 13:42:15 +00:00
Ingo Schwarze
e36af20691 jail.conf.5: cleanup introduction
Suggested by ingo on mandoc-tech@

MFC after:	3 days

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1422
2024-09-21 07:03:21 -06:00
Warner Losh
dca2b27e42 jail.conf.5: Minor igor issues
Sponsored by:		Netflix
2024-09-21 06:43:34 -06:00
Alexander Ziaee
944c74b7d9 jail.conf.5: minor cleanup (spdx, macros, xrefs)
+ expand see also section with other relevant pages and the handbook
+ tag paths with the path macro so they can be searched with apropos
+ tag spdx, one sentance per line

MFC after:	3 days

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1371
2024-09-21 06:41:50 -06:00
Graham Percival
2878d99dfc manuals: Misc macro typos
These were reported by `mandoc -T lint` as
    ERROR: skipping unknown macro
When these pages were rendered with `man`, the "unknown macro" meant
that the entire line was omitted from the output.

Obvious typos in:
lib/libsys/swapon.2
lib/libsys/procctl.2
share/man/man9/firmware.9

lib/libcasper/services/cap_net/cap_net.3: 'mode' describes a function
    argument.

lib/libsys/statfs.2: there's no .Tm command ("trademark?"), and
    .Tn ("tradename") is deprecated, so remove the macro entirely.

usr.sbin/mfiutil/mfiutil.8: man was interpreting '/dev/' as a macro
    (which it didn't recognize).

share/man/man4/qat.4: same issue as above, but with '0'.  In this case,
    given the context of the previous line, rewriting as "Value '0'"
    seemed more appropriate.

usr.sbin/mlx5tool/mlx5tool.8: typo in .Xr

Signed-off-by:	Graham Percival <gperciva@tarsnap.com>
Sponsored by:	Tarsnap Backup Inc.
Reviewed by:	concussious, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1417
2024-09-21 05:25:15 -06:00
WHR
c6ad7dcd9c mfiutil: Fix incorrect accesses of an union member in 'struct mfi_evt_detail'
PR: 281156
Reviewed by: imp, delphij
Pull Request: https://github.com/freebsd/freebsd-src/pull/1402
2024-09-20 16:22:44 -06:00
John F. Carr
14980d69ff i2c: Don't print uninitialized data when verbose
i2c -sv or i2c -rv prints an uninitialized field i2c_opt.addr.
Suppress the verbose message entirely for scan and reset,
where it provides no information, and zero initialize the field.

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279261

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1345
2024-09-20 09:37:58 -06:00
Ahmad Khalifa
599273f942 Copy the new ia32 loader
This handles copying in install-boot.sh and bsdinstall's bootconfig.

install-boot.sh:
make_esp_file now optionally takes extra arguments so it can copy
multiple files. This is used by the amd64 release scripts.
make_esp_device also takes an extra optional argument for efibootname.
This is currently unused, but it can be used in the future to do
something like:
make_esp_device loader.efi bootx64
make_esp_device loader_ia32.efi bootia32

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
2024-09-20 08:45:10 -06:00
Jamie Gritton
ae1a0648b0 jail: unbreak the zfs.mount_snapshot option
The change of its description from integer to boolean didn't actually
change it to a boolean, but only made it impossible to set as either
a boolean or an integer.

Rather than make it work as a boolean parameter should, just revert
to the old (working) integer parameter, and change the documentation
to match.

PR:		274263
Reported by:	andrew.hotlab at hotmail
2024-09-19 12:49:01 -07:00
Pierre Pronchery
e72d86ad9c bhyve: improve input validation in pci_xhci
Several functions did not validate the slot index resulting in OOB read
on the heap of the slot device structure which could lead to arbitrary
reads/writes and potentially code execution.

Reported by:	Synacktiv
Reviewed by:	markj (earlier), jhb
Security:	CVE-2024-41721
Security:	HYP-02
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45996
2024-09-19 08:26:07 -04:00
Mark Johnston
5d045d556b syslogd: Ignore getaddrinfo() errors if -ss is specified
This can arise if the jail doesn't have networking configured, and if
-ss is specified, syslogd won't listen on port 514 anyway.

Add a regression test case for this as well.

PR:		238006
MFC after:	1 month
2024-09-19 10:01:37 +00:00
SHENG-YI HONG
1f903953fb bhyve: Add raw tcp to uart backend
This feature is required by OpenStack Nova that needs a serial output
through tcp socket. When enable this feature, a tcp server will be
started and wait for connection on specified port under capsicum's protection.
We only accept one connection at the same time. Other connection try to
connect will fail.

Reviewed by:	corvink, markj
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D45120
2024-09-19 09:20:25 +00:00
Alan Somers
5f89aea7b7 ctld: fix several process setup/teardown bugs
All of the below bugs could result in a system where ctld is not
running, but LUNs and targets still exist in the kernel; a difficult
situation to recover from.

* open the pidfile earlier.  Open the pidfile before reading the
  kernel's current state, so two racing ctld processes won't step on
  each others' toes.

* close the pidfile later.  Close it after tearing down the
  configuration, for the same reason.

* If the configured pidfile changes, then rename it on SIGHUP rather
  than remove and recreate it.

* When running in debug mode, don't close the pidfile while handling a
  new connection.  Only do that in non-debug mode, in the child of the
  fork.

* Register signal handlers earlier.  Otherwise a SIGTERM signal received
  during startup could kill ctld without tearing down the configuration.

MFC after:	2 weeks
PR:		271460
Sponsored by:	Axcient
Reviewed by:	mav
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1370
2024-09-18 14:06:31 -06:00
Stephen J. Kiernan
ce9c3abf69 config: Search include paths for files to be read (options, files)
This is useful for downstream consumers to add their own kernel config
files in another directory other than the default ones.

Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D44538
2024-09-18 15:49:46 -04:00
Stephen J. Kiernan
9e2b87207b Allow additional "options" files to be specified in kernel config
The "includeoptions" directive can be used to specify an additional
options file to be used.

This is useful in conjunction with the "files" directive for build
environments to be able to add custom files and options.

Add "-v" flag to enable verbose mode. Added some additional error
messages when in verbose mode.

Obtained from:	Juniper Networks, Inc.
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D39540
2024-09-18 13:02:42 -04:00
Jessica Clarke
05996f453d kldxref: Don't warn and skip file if no relocations are found
This case is hit for the kernel itself on riscv64, and did not used to
be checked. Since the code here can already handle missing Elf_Rel
and/or Elf_Rela just delete the check.

Reviewed by:	jhb, imp
Fixes:		0299afdff1 ("kldxref: Make use of libelf to be a portable cross tool")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D46517
2024-09-10 18:56:22 +01:00
Mark Peek
dda0f9837b bhyve: support noVNC SetPixelFormat request
The bhyve VNC server would ignore the SetPixelFormat message from the
VNC client. This change supports a limited implementation to detect
and reorder the colors such as requested from the noVNC client.

PR:		280984
Reviewed by:	corvink
Differential Revision:	https://reviews.freebsd.org/D46402
MFC after:	3 weeks
2024-09-09 10:21:17 -07:00
Martin Matuska
e2df9bb441 zfs: merge openzfs/zfs@b10992582
Notable upstream pull request merges:
 #15892 -multiple Fast Dedup: Introduce the FDT on-disk format and feature flag
 #15893 -multiple Fast Dedup: “flat” DDT entry format
 #15895 -multiple Fast Dedup: FDT-log feature
 #16239 6be8bf555 zpool: Provide GUID to zpool-reguid(8) with -g
 #16277 -multiple Fast Dedup: prune unique entries
 #16316 5807de90a Fix null ptr deref when renaming a zvol with snaps and snapdev=visible
 #16343 77a797a38 Enable L2 cache of all (MRU+MFU) metadata but MFU data only
 #16446 83f359245 FreeBSD: fix build without kernel option MAC
 #16449 963e6c9f3 Fix incorrect error report on vdev attach/replace
 #16505 b10992582 spa_prop_get: require caller to supply output nvlist

Obtained from:	OpenZFS
OpenZFS commit:	b109925820
2024-09-09 18:13:02 +02:00
Mark Johnston
c6b41ba650 mixer tests: Serialize
These tests modify attributes of a global mixer device, and aren't
prepared to run in parallel.
2024-09-09 15:28:30 +00:00
Rick Macklem
3df987c99d mountd: Add check for "=" after exports(5) options
Some exports(5) options take a "=arg" component that provides an
argument value for the option.  Others do not.
Without this patch, if "=arg" was provided for an option that did
not take an argument value, the "=arg" was simply ignored.
This could result in confusion w.r.t. what was being exported,
as noted by the Problem Report.

This patch adds a check for "=arg" for the options that do not
take an argument value and fails the exports line if one is found.

PR:	281003
MFC after:	 2 weeks
2024-09-06 16:41:12 -07:00
Jose Luis Duran
9cb98ab7ce getaddrinfo.{1,3}: Cross-reference ip6addrctl(8)
Reviewed by: imp, glebius
Pull Request: https://github.com/freebsd/freebsd-src/pull/1375
2024-09-06 12:34:32 -06:00
Jose Luis Duran
6bfbfc8f4f ip6addrctl: Update the sample configuration file
Update the sample ip6addrctl.conf.sample file to match the default
policy, currently based on RFC 6724.

MFC after:	3 days
Signed-off-by:	Jose Luis Duran <jlduran@gmail.com>

Reviewed by: imp, glebius
Pull Request: https://github.com/freebsd/freebsd-src/pull/1375
2024-09-06 12:34:32 -06:00
Jose Luis Duran
3272054073 ip6addrctl.8: Reference RFC 6724 instead
Commit e695500d3c updated the policy table
to match RFC 6724, which obsoletes RFC 3484.

Add a reference to RFC 6724, and mark it up as a technical report (%R).

MFC after:	3 days
Signed-off-by:	Jose Luis Duran <jlduran@gmail.com>

Reviewed by: imp, glebius
Pull Request: https://github.com/freebsd/freebsd-src/pull/1375
2024-09-06 12:34:32 -06:00
Alexander Ziaee
1f882a5834 adduser.8: update log location + spdx
Closes:		280538
Fixes:		cf8a18 (back out logging to /var/log/adduser)
MFC after:	3 days
Reported by:	Herbert Baerschneider <herbert.baerschneider@protonmail.com>

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1354
2024-09-06 12:34:31 -06:00
Bram
a0d6f89e69 lastlogin: Add version information to libxo output
Add version information to libxo output so that
libxo content consumers can track changes.

Reviewed by: imp, markj
Pull Request: https://github.com/freebsd/freebsd-src/pull/1350
2024-09-06 12:34:30 -06:00
Pierre Pronchery
5c9308a413 bhyve: fix off by one error in pci_xhci
The function pci_xhci_find_stream validates that the streamid is valid
but the bound check accepts up to ep_MaxPStreams included.

The bug results in an out-of-bounds write on the heap with controlled
data.

Reported by:	Synacktiv
Reviewed by:	jhb
Security:	FreeBSD-SA-24:12.bhyve
Security:	CVE-2024-32668
Security:	HYP-04
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45994
2024-09-04 14:38:11 +00:00
Pierre Pronchery
a06fc21e77 bhyve: fix Out-Of-Bounds read/write heap in tpm_ppi_mem_handler
The function tpm_ppi_mem_handler is vulnerable to buffer over-read and
over-write, the MMIO handler serves the heap allocated structure
tpm_ppi_qemu.
The issue is that the structure size is smaller than 0x1000 and the
handler does not validate the offset and size (sizeof is 0x15A while the
handler allows up to 0x1000 bytes)

Reported by:	Synacktiv
Reviewed by:	corvink
Security:	FreeBSD-SA-24:10.bhyve
Security:	CVE-2024-41928
Security:	HYP-01
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45980
2024-09-04 14:38:11 +00:00
John Baldwin
f5541f9f47 nvmfd/nvmft: Fix a typo "whiled" -> "while"
Sponsored by:	Chelsio Communications
2024-09-03 16:12:04 -04:00
WHR
bac98f86c9 mfiutil: Handle potential ioctl(2) failures in mfi_flash.c
The return value of function 'mfi_dcmd_command' should always be checked for
the potential ioctl(2) failure.

PR:		281158
MFC after:	1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1403
2024-09-02 22:46:51 -07:00
Helge Oldach
209905ec38 ndp: Fix libxo formatting for the header of neighbor cache
PR:		272749
Reviewed by:	zlei
Fixes:		e1c7783e22 ndp(8): add structured output formatting via libxo
Fixes:		91fbe0819b ndp: convert ndp(8) to netlink
MFC after:	3 days
2024-09-02 18:15:15 +08:00
Tom Hukins
a2f53837f0 valectl(8): explicitly mention network switches
Use the term "network switch" instead of the ambiguous term "switch".

Signed-off-by:	Tom Hukins <tom@FreeBSD.org>
Reviewed by:	imp, mhorne
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1369
2024-08-30 16:39:56 -03:00
Olivier Cochard-Labbé
080c85127e mixer(8) tests: Fix cleanup routine
The tests correctly skip if no snd_dummy neither mixer is found, but the
cleanup is still called with the skip condition, which fails if there is
no mixer.

MFC after:		2 days
Reviewed by:		christos
Differential Revision:	https://reviews.freebsd.org/D46491
2024-08-30 20:23:29 +03:00
Michael Tuexen
6e25bccb98 tcpsso: remove support for some IPPROTO_TCP-level socket option names
Remove support for IPPROTO_TCP-level socket option names, because these
names will be removed from the source tree soon.
The corresponding socket options are not implemented by the TCP stack
at all.
This change was suggested by Peter Lei.

Reviewed by:		cc
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D46437
2024-08-30 09:32:50 +02:00
Pierre Pronchery
85707cfdad bhyve: avoid updating fbaddr when vm_mmap_memseg fails
In the function pci_fbuf_baraddr the field sc->fbaddr was set with a
user-controlled value, even though the call to vm_mmap_memseg failed.

No security risk as currently sc->fbaddr is not really used in the
source code.

Reported by:    Synacktiv
Reviewed by:	emaste
Sponsored by:   Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D46109
2024-08-26 16:23:52 -04:00
Christos Margiolis
9aac27599a mixer(8): Implement hot-swapping
Introduce a -V option, which can be used alongside -d (default unit
change), in order to hot-swap devices (i.e switch to them on the fly
without needing to restart the track), in case virtual_oss(8) exists and
is running.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46253
2024-08-24 15:07:35 +03:00
Li-Wen Hsu
abdc7bb796
bhyve(8): Remove mention of -A flag, again
Follow 107584716c to remove the mention
of -A flag added in b30a7e5418 .

Sponsored by:	The FreeBSD Foundation
2024-08-23 19:57:09 +08:00
Mark Johnston
e962b37bf0 bhyve: Do not enable PCI BAR decoding if a boot ROM is present
Let the boot ROM handle BAR initialization.  This fixes a problem where
u-boot's BAR remapping conflicts with some limitations in bhyve.  See
https://lists.freebsd.org/archives/freebsd-virtualization/2024-April/002103.html
for a description of what goes wrong.

The old behaviour can be restored by setting the pci.enable_bars
configuration variable.

Reviewed by:	corvink, jhb
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D45049
2024-08-19 13:56:06 +00:00
Mark Johnston
43caa2e805 bhyve: Make boot ROM handling more consistent
- On amd64, deprecate lpc.bootrom and lpc.bootvars.  Use top-level
  config variables instead.
- Introduce a generic predicate which can be used to determine whether
  the guest has a boot ROM.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D46282
2024-08-19 13:55:47 +00:00
Dag-Erling Smørgrav
9ff2ebd928 adduser: Better document ZFS dataset creation.
MFC after:	3 days
PR:		280873
Reviewed by:	bcr
Differential Revision:	https://reviews.freebsd.org/D46316
2024-08-19 10:30:11 +02:00
Jamie Gritton
5cf7054917 jail: only chdir to user's home directory when user is specified
jail(8) with the "exec.clean" parameter not only cleans the enviromnent
variables before running commands, but also changes to the user's home
directory.  While this makes sense when auser is specified (via one of
the exec.*_user parameters), it leads to all commands being run in the
jail's /root directory even in the absence of an explicitly specified
user.  This can lead to problems when e.g. rc scripts are run from that
non-world-readable directory, and run counter to expectations that jail
startup is analogous to system startup.

Restrict this behvaiour to only users exlicitly specified, either via
the command line or jail parameters, but not the implicit root user.
While this changes long-stand practice, it's the more intuitive action.

jexec(8) has the same problem, and the same fix.

PR:		277210
Reported by:	johannes.kunde at gmail
Differential Revision:	https://reviews.freebsd.org/D46226
2024-08-12 15:23:28 -07:00
Jessica Clarke
97c31cc800 kldxref: Clarify ambiguous comment
This previously read, to me at least, as if the not only applied to
ending with ".ko", not to the entire rest of the sentence, and thus the
implementation looked wrong. The history of D43507 however shows that
the behaviour is as intended.
2024-08-12 22:53:13 +01:00
Corvin Köhne
f325f81f4a
bhyve: remove empty E820 entries
When reserving a block with the same size of a RAM segement, we can end up with
an empty RAM segmenet. Avoid that by removing this empty segment from the E820
table.

Reviewed by:		jhb, markj (older version)
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D45480
2024-08-09 08:15:06 +02:00
Michael Tuexen
ad0d39ecc9 tcpsso: remove support for TCP_BBR_POLICER_DETECT
TCP_BBR_POLICER_DETECT will be removed by an upcoming commit.

Reviewed by:		rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D46244
2024-08-08 19:24:53 +02:00
Mark Johnston
a9e4753b4f bhyve: Optionally put vCPUs back in the debug state after resuming
When the gdb stub is configured to pause guest execution upon boot (i.e.,
the "w" flag is passed to -G), vCPUs end up suspended in two senses: first,
suspended by the GDB stub (marked in the vcpus_suspended set), and suspended
by the kernel (because fbsdrun_addcpu() suspends APs before spawning their
vCPU threads).  When the guest is resumed by the debugger, vCPUs are
unsuspended in both senses, but this is not correct for APs.

Hack around this problem by re-suspending vCPUs after the debugger
resumes guest execution, if they were suspended beforehand.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D46196
2024-08-07 19:27:23 +00:00
Alan Somers
969876fcee ctld: parse config file independently of getting kernel info
Separate the parsing of the config file from the reading of kernel port
information.  This has three benefits:

* Separation of concerns makes future changes easier.
* Allows the config file to be read earlier, which is necessary for
  fixing PR 271460.
* Reduces total line count, by eliminating duplication between parse.y
  (for traditional config file) and uclparse.c (for UCL config file).

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	mav
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1287
2024-08-07 08:36:52 -06:00
Pierre Pronchery
1f3bfc6055
bhyve: avoid a potential deadlock
This unlocks a mutex in an error path, that would otherwise remain locked and
potentially cause a deadlock later on.

Reported by:		Coverity Scan
CID:			1521334
Reviewed by:		corvink, markj
MFC after:		1 week
Sponsored by: 		The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45401
2024-08-05 09:48:22 +02:00
Michael Zhilin
d471b4f71d usr.sbin/gstat: add microsecond precision for disk latency
This patch makes gstat to show latency in microseconds if actual latency
is less than 1ms. It affects only "ms/r" and "ms/w" columns.

Before patch:
 L(q)  ops/s    r/s   kBps   ms/r    w/s   kBps   ms/w   %busy Name
    0    922      0      0    0.0    922  35809    0.0    2.8| nda0
    0    928      2     34    0.1    926  35809    0.0    3.1| nda1

After patch:
 L(q)  ops/s    r/s   kBps   ms/r    w/s   kBps   ms/w   %busy Name
    0    496      1     31  0.156    495  16020  0.040    1.5| nda0
    0    492      0      0  0.000    492  16020  0.042    1.5| nda1

Reviewed by:	imp
MFC after:	3 days
Sponsored by:	Postgres Professional
Differential Revision:	https://reviews.freebsd.org/D41999
2024-08-04 11:31:06 +03:00
Michael Tuexen
2edac5a60a tcpsso: improve man page
Address comment provided by bcr.

MFC after:		1 week
Sponsored by:		Netflix, Inc.
2024-08-03 20:30:10 +02:00
Michael Tuexen
5c44e69d2f tcpsso: add example to man page
Describe how to switch the TCP stack on all endpoints in the
LISTEN state.

Reviewed by:		concussious.bugzilla_runbox.com
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D46218
2024-08-03 20:01:45 +02:00