Commit Graph

294433 Commits

Author SHA1 Message Date
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
Warner Losh 6c711019f2 nvme: Don't create sysctl for io queues not created
When we can't set the number of I/O queues ont he admin queue, we
continue on. However, we don't create the I/O queue structures, so
having pointers (NULL) into them for sysctls makes no sense and leads to
a panic when accessed. When summing up different stats, also skip the
ioq stats when it's NULL.

Sponsored by:		Netflix
2024-10-07 22:22:40 -06:00
Maxim Konovalov 3ebb738a93 bsd-family-tree: FreeBSD 13.4 and OpenBSD 7.6 added 2024-10-07 21:16:19 +00:00
Dag-Erling Smørgrav a0dfb0668b env: Improve documentation.
* The `env` utility's inability to run a command whose name contains an
  equal sign is a feature, not a bug, so move that paragraph up from the
  BUGS section to the DESCRIPTION section.

* Mention that this can be worked around by prefixing the command name
  with `command`, and add an example of this to the EXAMPLE section.

* Add a test case which verifies that `env` does not run a command with
  an equal sign in its name even if it exists, and also demonstrates the
  workaround.

MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D46997
2024-10-07 23:01:09 +02:00
Dag-Erling Smørgrav 334af5e413 env: Add a handful of test cases.
MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D46996
2024-10-07 23:01:09 +02:00
Mark Johnston c59166e5b4 vm_page: Fix a logic bug in vm_page_unwire_managed()
When releasing a page reference, we have logic for various cases, based
on the value of the counter.  But, the implementation fails to take into
account the possibility that the VPRC_BLOCKED flag is set, which is ORed
into the counter for short windows when removing mappings of a page.  If
the flag is set while the last reference is being released, we may fail
to add the page to a page queue when the last wiring reference is
released.

Fix the problem by performing comparisons with VPRC_BLOCKED masked off.
While here, add a related assertion.

Reviewed by:	dougm, kib
Tested by:	pho
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D46944
2024-10-07 20:52:15 +00:00
Mark Johnston d8b32da235 vm_page: Use atomic loads for cmpset loops
Make sure that the compiler loads the initial value value only once.
Because atomic_fcmpset is used to load the value for subsequent
iterations, this is probably not needed, but we should not rely on that.

I verified that code generated for an amd64 GENERIC kernel does not
change.

Reviewed by:	dougm, alc, kib
Tested by:	pho
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D46943
2024-10-07 20:52:08 +00:00
Ed Maste 6684779b32 capsicum-test: rights are propagated on accept(2)
As of commit 85b0f9de11 ("capsicum: propagate rights on accept(2)")
a capability is generated from accept(cap_fd,...).  Enable the
corresponding test code.

PR:		201052
Reviewed by:	oshogbo
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46994
2024-10-07 15:40:06 -04:00
Graham Percival c8b31033c3 manuals: Misc syntax fixes
These were reported by `mandoc -T lint ...` as errors.

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

Additional clarification: there was a non-breaking space in
lib/libcasper/services/cap_grp/cap_grp.3.

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/1449
2024-10-07 15:41:14 -03:00
Graham Percival d21e322d56 manuals: Fix "missing end of block" errors
These were reported by `mandoc -T lint ...` as errors.

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/1448
2024-10-07 15:40:58 -03: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
Navdeep Parhar 52e5a66eac cxgbe(4): Use correct synchronization when marking the adapter offline.
adapter->flags are guarded by a synch_op, as noted in the comment in
adapter.h where the flags are defined.

Fixes:	5241b210a4 cxgbe(4): Basic infrastructure for ULDs to participate in adapter reset.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-10-07 10:25:53 -07: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
Roger Pau Monné 9a73b5b1e8 xen: remove PV suspend/resume support copyright
Thew code for PV suspend/resume support has long been removed, also remove the
copyright notice associated with it.

There are still two copyright blocks with (to my understanding) slightly
different wordings of the BSD 2 clause license.  I however don't feel like
merging them due to those wording differences.

The removal of the PV suspend/resume code was done in
ed95805e90.

Sponsored by: Cloud Software Group
Reviewed by: imp
Differential revision: https://reviews.freebsd.org/D46860
2024-10-07 18:59:45 +02:00
Roger Pau Monné 9dd5105f22 xen: expose support for poweroff/reboot/suspend on xenbus
Some toolstacks won't attempt the signal power actions on xenbus unless the VM
explicitly exposes support for them.  FreeBSD supports all power actions, hence
signal on xenbus such support by setting the nodes to the value of "1".

Sponsored by: Cloud Software Group
Reviewed by: markj
Differential review: https://reviews.freebsd.org/D46859
2024-10-07 18:59:45 +02:00
Bojan Novković 596a36ddc4 vmstat: Add NOFREE page count to -s report
This change adds the number of permanently allocated pages
to the 'sum' structure report.

Differential Revision:	https://reviews.freebsd.org/D46980
Reviewed by:	markj
2024-10-07 18:46:32 +02:00
Bojan Novković a02f9685ed vm_meter: Add counter for NOFREE pages
This change adds a new counter that tracks the total number
of permanently allocated pages.

Differential Revision:	https://reviews.freebsd.org/D46978
Reviewed by:	alc, markj
2024-10-07 18:46:32 +02:00
Doug Moore 6af02087d2 swap_pager: rename iter init functions
Add _init to the function names of the functions that initialize
iterators for swblks.

Reported by:	alc, markj
Reviewed by:	alc
Differential Revision:	https://reviews.freebsd.org/D46974
2024-10-07 11:11:33 -05: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
Michael Tuexen 3326ab87cc getsockopt: improve locking for SOL_SOCKET level socket options
Ensure SOLISTENING() is done inside SOCK_LOCK()/SOCK_UNLOCK()
for getsockopt() handling of SOL_SOCKET-level socket options.

Reviewed by:		markj, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D46881
2024-10-07 16:46:41 +02:00
Zhenlei Huang 8161000892 iflib: Make iflib_stop() static
It is declared as static. Make the definition consistent with the
declaration.

This follows 7ff9ae90f0 and partially reverts 09f6ff4f1a.

Reviewed by:	erj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D46185
2024-10-07 22:19:02 +08:00
Baptiste Daroussin 782766a32d genl: small cleanup
Following up from another review using basically the same code:
remove useless cast
replace uint32_t with unsigned int.

No functional changes expected
2024-10-07 15:28:54 +02:00
Ed Maste 8b41e693fc libsys: connect membarrier.2
Sponsored by:	The FreeBSD Foundation
2024-10-07 08:01:34 -04:00
Igor Ostapenko dfcb8de5ef dummymbuf: Log the entire rule set if no delimiters are present
An empty string was printed instead.

Reviewed by:	kp
Approved by:	kp (mentor)
Differential Revision:	https://reviews.freebsd.org/D46964
2024-10-07 11:16:44 +00:00
Konstantin Belousov 3670421e21 getrlimitusage.2: add the man page
Reviewed by:	olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46823
2024-10-07 13:50:08 +03:00
Konstantin Belousov cdd9629921 sysctl.3: document missing oids from kern.proc. node
Reviewed by:	olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46823
2024-10-07 13:50:00 +03:00
Konstantin Belousov 4e2803878f sysctl.3: document missing fixed oids from the kern. node
Reviewed by:	olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46823
2024-10-07 13:49:54 +03:00
Konstantin Belousov 2918dbc1cc sysctl.3: Remove KERN_QUANTUM
It is not present in the sources and 'git log -S KERN_QUANTUM main'
returns nothing.

Reviewed by:	olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46823
2024-10-07 13:49:46 +03:00
Baptiste Daroussin 883722891a genl: add parser for nlsysevent
genl monitor nlsysevent is now able to print the messages received
2024-10-07 12:11:20 +02:00
Baptiste Daroussin 33938d88e3 genl(1): fix typo 2024-10-07 12:08:29 +02:00
Baptiste Daroussin f45132db21 genl: subscribe to all if no group is provided
the monitor command now subscribes too all groups if no "multicast
group" is provided, this avoid potential collision with a group that
could be named "all"
2024-10-07 12:07:07 +02:00
Baptiste Daroussin 65e7a64869 genl: allow to monitor all know groups
Add a special keyword "all" for the group name, which allows genl
to monitor all groups in an existing family
2024-10-07 11:46:32 +02:00
Franco Fichtner 1d7a33888e fetch: correct env var name for --crl option to work
Reviewed by:	grembo
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D46973
2024-10-07 11:37:28 +02:00
Konstantin Belousov 2d84f79c4e vmstat -o: report objects backing SysV shm segments
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46959
2024-10-07 11:22:13 +03:00
Konstantin Belousov 65b832eb6f procstat vm: report SysV shm segment mapping
Also print its key and sequence number.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46959
2024-10-07 11:22:12 +03:00
Konstantin Belousov 6a3fbdc7e9 kinfo_vmobject: report backing object of the SysV shm segments
Use reserved work for kvo_flags.
Mark such object with KVMO_FLAG_SYSVSHM.
Provide segment key in kvo_vn_fileid, vnode never can back shm mapping.
Provide sequence number in kvo_vn_fsid_freebsd11.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46959
2024-10-07 11:22:12 +03:00
Konstantin Belousov d3dd6bd403 kinfo_vmentry: report mappings of the SysV shm segments
Mark such mappings with the new flag KVME_FLAG_SYSVSHM.
Provide segment key in kve_vn_fileid, vnode never can back shm mapping.
Provide sequence number in kve_vn_fsid_freebsd11.

Reviewed by:	markj (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46959
2024-10-07 11:22:12 +03:00
Konstantin Belousov b72029589e sysvshm: add shmobjinfo() function to find key/seq of the segment backed by obj
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46959
2024-10-07 11:22:12 +03:00
Konstantin Belousov f186252e0d vm_object: add OBJ_SYSVSHM flag to indicate SysV shm backing object
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46959
2024-10-07 11:22:12 +03:00
Konstantin Belousov 34935a6b37 vm_object: reformat flags definitions
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46959
2024-10-07 11:22:12 +03:00
Konstantin Belousov 8771dc950a sysv_ipc: remove sys/cdefs.h include
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46959
2024-10-07 11:22:12 +03:00
Zsolt Udvari 2458957238 Add myself (uzsolt) to the calendar
Reported by:	mckusick
2024-10-07 09:54:00 +02:00
Cy Schubert 5a5c227981 unbound: Vendor import 1.21.1
Release notes at
	https://nlnetlabs.nl/news/2024/Oct/03/unbound-1.21.1-released/

Security:       CVE-2024-8508
MFC After:	3 days

Merge commit '9b8db746ac608ff7cdad3c9ac7ac395319e4ea0f'
2024-10-06 18:45:53 -07:00
Cy Schubert 9b8db746ac unbound: Vendor import 1.21.1
Release notes at
	https://nlnetlabs.nl/news/2024/Oct/03/unbound-1.21.1-released/

Security:	CVE-2024-8508
2024-10-06 18:37:36 -07:00
Mark Johnston fdd100a715 devctl: Add missing validation to DEV_RESET
As in other ioctls which access the parent bus, we need to check for a
NULL parent here.  Otherwise it's possible to trigger a null pointer
dereference by resetting the root device.

Reported by:	Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D46965
2024-10-07 00:16:07 +00:00
Ed Maste 1fc766e3b4 membarrier: Add manual page
Add a minimal membarrier man page that documents the available cmd
values and errors that can be returned.  We can add more information and
iterate on it in the tree.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46967
2024-10-06 19:41:57 -04:00
Mark Johnston 7f1dfd6c33 vm_object: Fix the argument type to vm_object_set_flag()
Reported by:	kib
Fixes:		9d52823bf1 ("vm_object: Widen the flags field")
2024-10-06 22:55:02 +00:00
Doug Moore 9147a0c93b pctrie: don't assign to root
User pctrie_root_store(*, PCTRIE_LOCKED) to change the root value of a
pctrie, to ensure proper synchronization when smr is in use.

Reviewed by:	alc
Differential Revision:	https://reviews.freebsd.org/D46968
2024-10-06 15:10:10 -05:00
Ed Maste 357185a966 membarrier.h: fix typo
Sponsored by:	The FreeBSD Foundation
2024-10-06 13:22:21 -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