Commit graph

276816 commits

Author SHA1 Message Date
Ed Maste f7d5459ece console: add U+276E and U+276F glyphs
U+276E Heavy Left-Pointing Angle Quotation Mark Ornament
U+276F Heavy Right-Pointing Angle Quotation Mark Ornament

U+276F is used by zprezto (zsh config package).

For the normal font I used the bold font glyphs for U+003C < and
U+003E >.  The bold font glyphs are new.

PR:		232494
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-19 11:52:13 -04:00
Ed Maste 119db52f42 vtfontcvt: improve hex font format validation
Previously an EOF would result in sscanf returning -1 leading to a
crash.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-19 11:48:09 -04:00
Mateusz Piotrowski f4b00609ec backlight(8): Update usage() to match the manual page
MFC after:	1 week
2022-07-19 16:56:27 +02:00
Mateusz Piotrowski 64a231b90b backlight.8: Show all possible modes in synopsis
MFC after:	1 week
2022-07-19 16:55:25 +02:00
Mateusz Piotrowski 5c3e424958 backlight.8: Standardize synopsis and improve examples
MFC after:	1 week
2022-07-19 16:49:50 +02:00
Mateusz Piotrowski ef2d0816dd vtfontcvt(8): Update usage() to match vtfontcvt.8
MFC after:	2 weeks
2022-07-19 16:35:50 +02:00
Mateusz Piotrowski cad64622ca vtfontcvt.8: Use D1 instead of Ql for readability
MFC after:	2 weeks
2022-07-19 16:35:49 +02:00
Mateusz Piotrowski e0bd2ab2eb vtfontcvt.8: Sort synopsis
MFC after:	2 weeks
2022-07-19 16:35:49 +02:00
Mateusz Piotrowski b38e3722f5 vtfontcvt.8: Improve synopsis and -f documentation
MFC after:	2 weeks
2022-07-19 16:35:48 +02:00
Ed Maste cd8401dbde Update Terminus console font to 4.49
As in the past Dimitar Zhekov provided a copy of Terminus under a BSD
license for use by our console.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-07-19 10:28:05 -04:00
Andrew Turner 36f1526a59 Add experimental 16k page support on arm64
Add initial 16k page support on arm64. It is considered experimental,
with no guarantee of compatibility with a userspace or kernel modules
built with the current a 4k page size as code will likely try to pass
in a too small size when working with APIs that take a multiple of a
page, e.g. mmap.

As this is experimental, and because userspace and the kernel need to
have the PAGE_SIZE macro kept in sync there is no kernel option to
enable this. To test a new image should be built with the
PAGE_{SIZE,SHIFT,MASK} macros changed to the 16k versions.

There are currently known issues with loading modules from an old
loader as it can misalign them to load on a non-16k boundary.

Testing has shown good results in kernel workloads that allocate and
free large amounts of memory as only a quarter of the number of calls
into the VM subsystem are needed in the best case.

Reviewed by:	markj
Tested by:	gallatin
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34793
2022-07-19 10:57:03 +01:00
Alan Cox 54291f7d65 swap_pager: Reduce the scope of the object lock in putpages
We don't need to hold the object lock while allocating swap space, so
don't.

Reviewed by:	dougm, kib, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D35839
2022-07-18 22:35:49 -05:00
Kristof Provost 0361f165f2 ipsec: replace SECASVAR mtx by rmlock
This mutex is a significant point of contention in the ipsec code, and
can be relatively trivially replaced by a read-mostly lock.
It does require a separate lock for the replay protection, which we do
here by adding a separate mutex.

This improves throughput (without replay protection) by 10-15%.

MFC after:	3 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D35763
2022-07-19 05:27:20 +02:00
Alan Cox 4eaaacc755 x86/iommu: Shrink the critical section in dmar_qi_task()
It is safe to test and clear the Invalidation Wait Descriptor
Complete flag before acquiring the DMAR lock in dmar_qi_task(),
rather than waiting until the lock is held.

Reviewed by:	kib
MFC after:	2 weeks
2022-07-18 22:23:13 -05:00
Colin Percival 05350f0936 x86: Remove 1 second DELAY from cpu_reset
On SMP systems, cpu_reset broadcasts a message telling the APs to stop
themselves, and then the BSP waits 1 second before actually resetting
itself; this behaviour dates back to 1998-05-17.

I assume that this delay was added in order to allow the APs to stop
themselves before the BSP resets; but we wait until the APs have all
acknowledged entering the "stopped" state, so it no longer seems to
serve any purpose.

Reviewed by:	jhb, kib
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D35797
2022-07-18 17:23:25 -07:00
Colin Percival 84ec7df0d7 Add kern.reboot_wait_time sysctl
Historic FreeBSD behaviour (dating back to 1994-04-02) when rebooting
is to print "Rebooting..." and then
	/* wait 1 sec for printf's to complete and be read */

Prior to April 1994, there was a 100 ms delay (added 1993-11-12).

Since (a) most users will already be aware that the system is rebooting
and do not need to take time to read an additional message to that
effect, and (b) most FreeBSD systems don't have anyone actively looking
at the console anyway, this delay no longer serves much purpose.

This commit adds a kern.reboot_wait_time sysctl which defaults to 0;
historic behaviour can be regained by setting it to 1.

Reviewed by:	imp
Relnotes:	FreeBSD now reboots faster; to restore the traditional
		wait after printing "Rebooting..." to the console, set
		kern.reboot_wait_time=1 (or more).
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D35796
2022-07-18 17:23:25 -07:00
Mitchell Horne 4e2121c10a mac_ddb: add some validation functions
These global objects are easy to validate, so provide the helper
functions to do so and include these commands in the allow lists.

Reviewed by:	markj
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35372
2022-07-18 22:06:22 +00:00
Mitchell Horne 287d467c5d mac: add new mac_ddb(4) policy
Generally, access to the kernel debugger is considered to be unsafe from
a security perspective since it presents an unrestricted interface to
inspect or modify the system state, including sensitive data such as
signing keys.

However, having some access to debugger functionality on production
systems may be useful in determining the cause of a panic or hang.
Therefore, it is desirable to have an optional policy which allows
limited use of ddb(4) while disabling the functionality which could
reveal system secrets.

This loadable MAC module allows for the use of some ddb(4) commands
while preventing the execution of others. The commands have been broadly
grouped into three categories:
 - Those which are 'safe' and will not emit sensitive data (e.g. trace).
   Generally, these commands are deterministic and don't accept
   arguments.
 - Those which are definitively unsafe (e.g. examine <addr>, search
   <addr> <value>)
 - Commands which may be safe to execute depending on the arguments
   provided (e.g. show thread <addr>).

Safe commands have been flagged as such with the DB_CMD_MEMSAFE flag.

Commands requiring extra validation can provide a function to do so.
For example, 'show thread <addr>' can be used as long as addr can be
checked against the system's list of process structures.

The policy also prevents debugger backends other than ddb(4) from
executing, for example gdb(4).

Reviewed by:	markj, pauamma_gundo.com (manpages)
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35371
2022-07-18 22:06:15 +00:00
Mitchell Horne 2449b9e5fe mac: kdb/ddb framework hooks
Add three simple hooks to the debugger allowing for a loaded MAC policy
to intervene if desired:
 1. Before invoking the kdb backend
 2. Before ddb command registration
 3. Before ddb command execution

We extend struct db_command with a private pointer and two flag bits
reserved for policy use.

Reviewed by:	markj
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35370
2022-07-18 22:06:13 +00:00
Mitchell Horne a305b20ead ddb: tag core commands with DB_CMD_MEMSAFE
Those which are statically defined in db_command.c.

Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35584
2022-07-18 22:06:11 +00:00
Mitchell Horne c84c5e00ac ddb: annotate some commands with DB_CMD_MEMSAFE
This is not completely exhaustive, but covers a large majority of
commands in the tree.

Reviewed by:	markj
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35583
2022-07-18 22:06:09 +00:00
Mitchell Horne bb61cba751 ddb: add the DB_CMD_MEMSAFE flag for commands
This flag value can be used to indicate if a command has the property of
being "memory safe". In this instance, memory safe means that the
command does not allow/enable reads or writes of arbitrary memory,
regardless of the arguments passed to it. For example, 'backtrace' is
considered a memory-safe command since its output is deterministic,
while 'show vnode' is not, since it requires a memory address as an
argument and will print the contents beginning at that location.

Apply the flag to the "show all" command macros. It is expected that
commands added to this table will always exhibit this property.

Reviewed by:	markj
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35581
2022-07-18 22:06:04 +00:00
Eric van Gyzen 3ca4a33903 bge: tell debugnet there are 2 rx rings, not 1,024
debugnet provides the network stack for netgdb and netdump.  Since it
must operate under panic/debugger conditions and can't rely on dynamic
memory allocation, it preallocates mbufs during boot or network
configuration.  At that time, it does not yet know which interface
will be used for debugging, so it does not know the required size and
quantity of mbufs to allocate.  It takes the worst-case approach by
calculating its requirements from the largest MTU and largest number
of receive queues across all interfaces that support debugnet.

Unfortunately, the bge NIC driver told debugnet that it supports 1,024
receive queues.  It actually supports only 2 queues (with 1,024 slots,
thus the error).  This greatly exaggerated debugnet's preallocation,
so with an MTU of 9000 on any interface, it allocated 600 MB of memory.
A tiny fraction of this memory would be used if netgdb or netdump were
invoked; the rest is completely wasted.

Reviewed by:	markj, rlibby
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D35845
2022-07-18 16:05:18 -05:00
Mark Johnston bd980ca847 sched_ule: Ensure we hold the thread lock when modifying td_flags
The load balancer may force a running thread to reschedule and pick a
new CPU.  To do this it sets some flags in the thread running on a
loaded CPU.  But the code assumed that a running thread's lock is the
same as that of the corresponding runqueue, and there are small windows
where this is not true.  In this case, we can end up with non-atomic
modifications to td_flags.

Since this load balancing is best-effort, simply give up if the thread's
lock doesn't match; in this case the thread is about to enter the
scheduler anyway.

Reviewed by:	kib
Reported by:	glebius
Fixes:		e745d729be ("sched_ule(4): Improve long-term load balancer.")
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35821
2022-07-18 15:52:27 -04:00
Mateusz Guzik f5ad538d90 i386: fix pmap_trm_arena_last atomic load type
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-07-18 18:43:39 +00:00
Ed Maste df777aeb98 vtfontcvt: correct usage
Commit e7fd9688ea changed vtfontcvt's command line parsing, but did
not correctly update the usage (it omitted the new -o flag).

Fixes:		e7fd9688ea ("Move font related data structured to...")
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-18 13:24:29 -04:00
Kornel Dulęba 939f0b6323 Implement shared page address randomization
It used to be mapped at the top of the UVA.
If the randomization is enabled any address above .data section will be
randomly chosen and a guard page will be inserted in the shared page
default location.
The shared page is now mapped in exec_map_stack, instead of
exec_new_vmspace. The latter function is called before image activator
has a chance to parse ASLR related flags.
The KERN_PROC_VM_LAYOUT sysctl was extended to provide shared page
address.
The feature is enabled by default for 64 bit applications on all
architectures.
It can be toggled kern.elf64.aslr.shared_page sysctl.

Approved by:	mw(mentor)
Sponsored by:	Stormshield
Obtained from:	Semihalf
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D35349
2022-07-18 16:27:37 +02:00
Kornel Dulęba 361971fbca Rework how shared page related data is stored
Store the shared page address in struct vmspace.
Also instead of storing absolute addresses of various shared page
segments save their offsets with respect to the shared page address.
This will be more useful when the shared page address is randomized.

Approved by:	mw(mentor)
Sponsored by:	Stormshield
Obtained from:	Semihalf
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D35393
2022-07-18 16:27:32 +02:00
Kornel Dulęba f6ac79fb12 Introduce the PROC_SIGCODE() macro
Use a getter macro instead of fetching the sigcode address directly
from a sysent of a given process. It assumes that the sigcode is stored
in the shared page, which is true in all cases, except for a.out
binaries. This will be later useful when the shared page address
randomization is introduced.
No functional change intended.

Approved by:	mw(mentor)
Sponsored by:	Stormshield
Obtained from:	Semihalf
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D35392
2022-07-18 16:27:26 +02:00
Mark Johnston ddd9004e7a Bump __FreeBSD_version after the removal of OBJT_DEFAULT
Out-of-tree modules which allocate an object of type OBJT_DEFAULT need
to be recompiled.  No other changes are required, however.
2022-07-18 09:45:31 -04:00
Mike Karels a11f080e86 ofed/infiniband: fix ifdefs for new INET changes, fixing LINT-NOIP
Some of the ofed/infiniband code has INET and INET6 address handling
code without using ifdefs.  This failed with a recent change to INET,
in which IN_LOOPBACK() started using a VNET variable, and which is not
present if INET is not configured.  Add #ifdef INET, and INET6 for good
measure, in cma_loopback_addr(), along with inclusion of the options
headers in ib_cma.c.

Reviewed by:	hselasky rgrimes bz
Differential Revision: https://reviews.freebsd.org/D35835

(cherry picked from commit 752b7632776237f9c071783acdd1136ebf5f287d)
2022-07-18 08:02:01 -05:00
Ed Maste b1e81e6dde blacklistd: Handle 0 sized messages
Patch obtained from https://github.com/zoulasc/blocklist commit
ada75856bc6fcabbdd25ffbe08fbad5cf2a2c08a

PR:		264599
MFC after:	1 week
2022-07-18 08:55:30 -04:00
Bjoern A. Zeeb fe88072dc6 arm64, qoriq_therm: fix handling sites on version 1 and 2
For version 2 extend the TMUV2_TMSAR() write loop over all site_ids
registered for a particular SoC and actually use the site_id rather
than always just the first [0] (which for the LX2080 would be a
problem given there is no site0).

Later, while version 2 adds the SITEs to enable to TMSR in bits 0..<n>,
version 1 (e.g., LS1028, LS1046, LS1088) add MSITEs to TMR
bits 16..31 or rather 15..0(16-<n>).  Adjust the loops to only enable
the site_ids listed for the particular SoC for monitoring.  This now
also deals with sparse site_ids (not starting at 0, or not being
contiguous).

MFC after:	1 week
Sponsored by:	Traverse Technologies (providing Ten64 HW for testing)
Reviewed by:	mmel
Differential Revision: https://reviews.freebsd.org/D35764
2022-07-18 11:51:03 +00:00
Bjoern A. Zeeb 394453302b arm64, qoriq_therm: configure the number of sites base don SoC
Configure the number of sites (sensors) based on SoC.
This avoids timeouts reading non-existent sensors.

The changes are based on mmel's initial work at:
914e3f0098

MFC after:	1 week
Sponsored by:	Traverse Technologies (providing Ten64 HW for testing)
Reviewed by:	mmel
Differential Revision: https://reviews.freebsd.org/D35759
2022-07-18 11:47:16 +00:00
Mateusz Piotrowski 203be0938d jail.8: Fix formatting of synopsis and some code examples
MFC after:	3 days
2022-07-18 13:41:35 +02:00
Mateusz Piotrowski aa35037ba5 beinstall.8: Update example distsites for BSDINSTALL_DISTSITE
MFC after:	1 week
2022-07-18 13:41:35 +02:00
Xin LI 1fbfa7a8dc usr.bin/cksum: localize _total variables. 2022-07-17 17:24:31 -07:00
Mark Johnston 46eab86035 callout: Simplify the inner loop in callout_process() a bit
- Use LIST_FOREACH_SAFE.
- Simplify control flow.

No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-17 13:58:19 -04:00
Mark Johnston aac7c7ac54 callout: Remove a redundant parameter to callout_cc_add()
The passed cpuid is always equal to the one stored in the callout
structure.  No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-17 13:58:19 -04:00
Dimitry Andric fb0493d559 Fix clang 15 warning in cxgbe
Clang 15 warns:

    sys/dev/cxgbe/cudbg/cudbg_lib.c:2949:6: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
            int i = 0;
                ^

Apparently 'i' was meant as the current retry counter, but '1' was used
in the while loop comparison instead, making the loop potentially
infinite, if 'busy' never gets reset.

MFC after:	3 days
Reviewed by:	np
Differential Revision: https://reviews.freebsd.org/D35834
2022-07-17 19:57:03 +02:00
Cy Schubert 752b6daecc unbound: Update version strings to 1.16.1
The last number of unbound upgrades failed to manually update the
version strings in usr.sbin/unbound/config.h. This commit fixes that.

Reported by:	"Herbert J. Skuhra" <herbert@gojira.at>
Fixes:		0a92a9fca7
		a39a5a6905
		9cf5bc93f6
		273016e836
		24e3652200
		5469a99530
MFC after:	3 days
2022-07-17 07:25:06 -07:00
Ed Maste a5f59e8565 cd9660: Use ANSI (c89) prototypes
Sponsored by:	The FreeBSD Foundation
2022-07-17 08:14:49 -04:00
Mark Johnston 7f3c78fbc9 vm_pager: Remove references to KVME_TYPE_DEFAULT in the kernel
Keep the definition around since it's used by userspace.

Reviewed by:	alc, imp, kib
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35791
2022-07-17 07:09:48 -04:00
Mark Johnston 1424f65bbc vm_pager: Remove the default pager
It's unused now.  Keep the OBJ_DEFAULT identifier, but make it an alias
of OBJT_SWAP for the benefit of out-of-tree code.

Reviewed by:	alc, imp, kib
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35790
2022-07-17 07:09:48 -04:00
Mark Johnston fff19e0ed2 vm_object: Remove redundant OBJ_SWAP checks
With the removal of OBJT_DEFAULT, OBJ_ANON implies OBJ_SWAP.

Note, this means that vm_object_split() is more expensive than it used
to be, as it holds busy locks until the end of the range is reached,
even if the object has no swap blocks allocated.

Reviewed by:	alc, kib
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35789
2022-07-17 07:09:48 -04:00
Mark Johnston 0cb2610ee2 vm: Remove handling for OBJT_DEFAULT objects
Now that OBJT_DEFAULT objects can't be instantiated, we can simplify
checks of the form object->type == OBJT_DEFAULT || (object->flags &
OBJ_SWAP) != 0.  No functional change intended.

Reviewed by:	alc, kib
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35788
2022-07-17 07:09:48 -04:00
Mark Johnston fffc1c594a vm_object: Release object swap charge in the swap pager destructor
With the removal of OBJT_DEFAULT, we can simply handle this in
swap_pager_dealloc().  No functional change intended.

Suggested by:	alc
Reviewed by:	alc, kib
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35787
2022-07-17 07:09:48 -04:00
Mark Johnston cb6757c0a6 swap_pager: Removing handling for objects with OBJ_SWAP clear
With the removal of OBJT_DEFAULT, we can assume that pager operations
provide an object with OBJ_SWAP set.  Also, we do not need to convert
objects from type OBJT_DEFAULT.  Thus, remove checks for OBJ_SWAP and
remove code which modifies the object type.  In some places, replace the
check for OBJ_SWAP with a check for whether any swap blocks are
assigned.

Reviewed by:	alc, kib
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35786
2022-07-17 07:09:48 -04:00
Mark Johnston 5d32157d4e vm_object: Modify vm_object_allocate_anon() to return OBJT_SWAP objects
With this change, OBJT_DEFAULT objects are no longer allocated.
Instead, anonymous objects are always of type OBJT_SWAP and always have
OBJ_SWAP set.

Modify the page fault handler to check the swap block radix tree in
places where it checked for objects of type OBJT_DEFAULT.  In
particular, there's no need to invoke getpages for an OBJT_SWAP object
with no swap blocks assigned.

Reviewed by:	alc, kib
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35785
2022-07-17 07:09:48 -04:00
Peter Holm 6226f8f254 stress2: Update the exclude list 2022-07-17 09:16:03 +02:00