Commit graph

20889 commits

Author SHA1 Message Date
Baptiste Daroussin
88a198af3c powerd: use nlsysevent if possible
instead of depending on devd and its socket, try to use nlsysevent
instead. This makes powerd independant from devd.

Approved by:		des
Reviewed by:		des
Differential Revission:	https://reviews.freebsd.org/D46972
2024-10-08 08:40:58 +02:00
Ka Ho Ng
0a2cfd653e libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed
ELF parsing helpers specialized in parsing KLDs and the kernel
executable. The library can be used to read metadata such as linker_set,
mod_depend, mod_version and PNP match info, and raw data from the ELF.

To promote the reuse of the facilities the ELF parsing code is separated
from kldxref(8) into a new private library.

kldxref(8) is modified to link against the libkldelf library.

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D46719
2024-10-08 04:24:07 +00:00
Graham Percival
c801836ff4 manuals: Fix "skipping end of block" .El errors
These were reported by `mandoc -T lint ...` as errors; this commit only
handles unnecessary .El commands.

The rendered output (in ascii and html) is not affected by this commit.

Signed-off-by:	Graham Percival <gperciva@tarsnap.com>
Reviewed by:	mhorne
MFC after:	3 days
Sponsored by:	Tarsnap Backup Inc.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1447
2024-10-07 15:37:47 -03:00
Ed Maste
be9243409d pkg: improve error message
Print the complete list of url that have failed

PR:		281924
Co-authored-by: Baptiste Daroussin <bapt@FreeBSD.org>
Differential Revision: https://reviews.freebsd.org/D46983
2024-10-07 13:05:07 -04:00
Ed Maste
f5c847ae84 pkg: prefer .pkg extension
.pkg is the default extension as of commit c244b1d8a3, falling back to
.txz if not found.

PR:		281924
Reviewed by:	bapt
Fixes: a2aac2f5e5 ("pkg(7): when bootstrapping first search for pkg.bsd file then pkg.txz")
Fixes: c244b1d8a3 ("pkg: settle the uniq extension to .pkg instead of .bsd")
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46977
2024-10-07 12:01:36 -04:00
Chuck Tuffli
b0a24be007 bhyve/nvme: Fix out-of-bounds read in NVMe log page
The function nvme_opc_get_log_page in the file usr.sbin/bhyve/pci_nvme.c
is vulnerable to buffer over-read. The value logoff is user controlled
but never checked against the value of logsize. Thus the difference:
	logsize - logoff
can underflow.

Due to the sc structure layout, an attacker can dump internals fields of
sc and the content of next heap allocation.

Reported by: Synacktiv
Reviewed by:	emaste, jhb
Security: HYP-07
Sponsored by: Alpha-Omega Project, The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46021
2024-10-06 06:50:28 -07:00
Jeremy Faulkner
7d893fce0d sesutil: Fix a typo in an error message
PR:		281658
MFC after:	1 week
2024-10-06 13:22:33 +00:00
Mark Johnston
d9fe718287 makefs: Remove the warning printed when makefs -t zfs is used
We haven't seen bug reports relating to this feature for a while, so
stop printing a warning.

Reviewed by:	cperciva
MFC after:	2 weeks
2024-10-04 15:56:34 +00:00
Warner Losh
593d7a1634 apcidump: Add dumping SPCR
When we find a SPCR (Serial Port Console Redirection) TABLE, print all
the details. This includes support for the recent Revision 3 and
Revision 4 tables, though I've not encountered them in the wild yet, so
that code is untested.

https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table

Sponsored by:		Netflix
2024-10-03 18:01:07 -06:00
Pierre Pronchery
e94a1d6a7f bhyve: improve bounds checks in hda_codec
The function hda_codec_command is vulnerable to buffer over-read, the
payload value is extracted from the command and used as an array index
without any validation.
Fortunately, the payload value is capped at 255, so the information
disclosure is limited and only a small part of .rodata of bhyve binary
can be disclosed.

The risk is low because the leaked information is not sensitive. An
attacker may be able to validate the version of the bhyve binary using
this information disclosure (layout of .rodata information, ex:
jmp_tables) before executing an exploit.

Reported by:	Synacktiv
Reviewed by:	christos, emaste
Security:	HYP-13
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46098
2024-10-03 17:14:11 -04:00
Graham Percival
c013ca2cf7 manuals: Fix typos in -offset for .Bd and .Bl
The intended value is:
    -offset indent
If there's any typo such that the value doesn't match the pre-defined
strings, then the offset is the same width as the value.  So by chance,
"-offset -ident" ended up being a standard-width indent (since the
default indent is 6 chars, and "-ident" also has 6 chars), whereas
"-offset -indent" had a longer indent, and "-offset ident" had a shorter
one.

Signed-off-by:	Graham Percival <gperciva@tarsnap.com>
Reviewed by:	mhorne, Alexander Ziaee <concussious.bugzilla@runbox.com>
MFC after:	3 days
Sponsored by:	Tarsnap Backup Inc.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1436
2024-10-03 14:49:31 -03:00
John Baldwin
ad152571b8 bhyve uart: Fix errors from GCC
- Place 'static' before other qualifiers (-Wold-style-declaration)

- Correct the order of arguments to calloc (-Wcalloc-transposed-args)

Reported by:	GCC 14
Fixes:		1f903953fb bhyve: Add raw tcp to uart backend
2024-10-02 17:31:59 -04:00
Takanori Watanabe
f5a04b16b1 acpidump: add 's' option to parse dsdt and ssdt's separately. In some machine, they may not be parsed if they are concatinated into one image.
Reviewed by:           kib
MFC after:              1 week
Differential Revision:  https://reviews.freebsd.org/D46796
2024-10-02 15:36:41 +09:00
Ed Maste
030c387f5d tzsetup: correct timezone symlink target
In chroot mode tzsetup prepended the chroot path to the symlink target,
which is not correct.  Use the same path for the symlink regardless of
chroot mode.

PR:		281332
Reported by:	scf, Herbert J. Skuhra
Reviewed by:	olce
Fixes: 5e16809c95 ("tzsetup: symlink /etc/localtime instead of co...")
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46725
2024-09-30 10:22:34 -04:00
Pierre Pronchery
8934002959 bhyve: avoid buffer overflow in pci_vtcon_control_send
The program copies an input buffer to an output buffer without verifying
that the size of the input buffer is less than the size of the output
buffer, leading to a buffer overflow.

Inside the function pci_vtcon_control_send, the length of the iov buffer
is not validated before copy of the payload.

Reported by:    Synacktiv
Reviewed by:	markj
Security:       HYP-19
Sponsored by:   The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46105
2024-09-30 08:01:28 -04:00
Joyu Liao
f321956d98 nfsd.c: Synchronize error handling
Synchronize the error handling in nfsd. If you check other error
handlings in those same condition blocks, it uses nfsd_exit instead,
which will call killchildren() and call the rpcbind service to do
the service un-mapping.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D46442
2024-09-29 13:11:54 -07:00
Gleb Popov
1df198cf93 usr.sbin/jail/jail.8: Make a reference more accurate
The zfs-jail(8) link is also used in the other place within this man

Approved By: imp
Differential Revision: https://reviews.freebsd.org/D46832
2024-09-29 11:33:14 +03:00
Pierre Pronchery
869d760cb9 bhyve: avoid TOCTOU on iov_len in virtio_vq_recordon()
Avoid a race condition when accessing guest memory, by reading memory
contents only once.

This has also been applied to _vq_record() in
sys/dev/beri/virtio/virtio.c, as per markj@'s suggestion.

Reported by:	Synacktiv
Reviewed by:	markj
Security:	HYP-10
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45735
2024-09-27 10:20:53 -04:00
Pierre Pronchery
71fa171c64 bhyve: Initialize stack buffer in pci_ahci
In the function ahci_handle_dsm_trim, if the call to read_prdt fails,
the variable buf[512] is used while it contains uninitialized data.

It is easy to make the call to read_prdt fail, for instance if
hdr->prdtl == NULL, the function will return without writing anything in
buf.

In addition, this code could be hardened by checking the value of done
before accessing &buf[done].

Reported by:	Synacktiv
Reviewed by:	markj
Security:	HYP-15
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46090
2024-09-26 14:06:10 -04:00
Greg Lehey
b7b7800043 Explain the relationship between -p and -Z. 2024-09-26 12:07:02 +10:00
Alexander Ziaee
c7a33fe37d ntp: Improve descriptions in man pages
+ ntpd added to ntp.conf(5) description (search keywords)
+ expand NTP so these pages are shown when `apropos time`
+ "standard" => "reference" for increased consistency
- removed redundant or duplicated search keywords

ntp.org bug:	https://bugs.ntp.org/show_bug.cgi?id=3936
MFC after:	3 days
Reviewed by:	Harlan Stenn <stenn@nwtime.org>
Reviewed by:	Cy Schubert <cy@nwtime.org>
2024-09-25 05:40:17 -07:00
Joseph Mingrone
0a7e5f1f02 tcpdump: Update to 4.99.5
Changes:        https://git.tcpdump.org/tcpdump/blob/4a789712f187e3ac7b2c0044c3a3f8c71b83646e:/CHANGES
Obtained from:  https://www.tcpdump.org/release/tcpdump-4.99.5.tar.xz
Sponsored by:   The FreeBSD Foundation
2024-09-23 20:23:25 +01:00
Alexander Ziaee
f8afe99cc8 efibootmgr: minor cleanup (spdx, typos, see also)
This page was getting pulled into `apropos unix` results due to
arguments being on the same line as a name macro in synopsis.
While here, tag spdx, fold a line slightly better, add loader.efi(8)
to see also and fix it's order.

MFC after:	3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1430
2024-09-22 09:21:39 -06:00
Ed Maste
a305f44d14 bhyve: validate corb->wp to avoid infinite loop
Guests must set HDAC_CORBWP less than corb->size.  Treat invalid values
as an error rather than entering an infinite loop.

Reported by:	Synacktiv
Reviewed by:	markj
Security:	HYP-12
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46134
2024-09-22 07:25:02 -04:00
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