Commit graph

280554 commits

Author SHA1 Message Date
Warner Losh 0cd612664e UPDATING: update notes on EFI booting
The notes on EFI booting and updating for ZFS had become dated and only
partially updated. Expand the notes with a few more details and a
pointer to laoder.efi(8) and uefi(8).

Sponsored by:		Netflix
Discussed with:		pauamma, karels
Differential Revision:	https://reviews.freebsd.org/D36629
2023-01-20 16:13:54 -07:00
Konstantin Belousov 456f05756b Handle int rank issues in in vn_getsize_locked() and vn_seek()
In vn_getsize_locked(), when storing vattr.va_size of type u_quad_t into
off_t size, we must avoid overflow.

Then, the check for fsize < 0, introduced in the commit
f45feecfb2 'vfs: add vn_getsize', is nop [1].

Reported and reviewed by:	jhb
Coverity CID:	1502346
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38133
2023-01-20 23:56:29 +02:00
Konstantin Belousov 5657f49ef3 kern_umtx.c do_wait(): correct confusing indent
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-20 23:33:11 +02:00
Yuri 6f7b5d5d3c hms(4): Fix a copy/paste issue and check both _X and _Y
instead of checking _X 2 times.

Reviewed by:	wulf
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D38135
2023-01-20 23:29:53 +03:00
Robert Wing 27029bc08f vmm: fix use after free in ppt_detach()
The vmm module destroys the host_domain before unloading the ppt module
causing a use after free. This can happen when kldunload'ing vmm.

Reviewed by:	markj, jhb
Differential Revision:	https://reviews.freebsd.org/D38072
2023-01-20 11:25:27 +00:00
Robert Wing c668e8173a vmm: take exclusive mem_segs_lock in vm_cleanup()
The consumers of vm_cleanup() are vm_reinit() and vm_destroy().

The vm_reinit() call path is, here vmmdev_ioctl() takes mem_segs_lock:
    vmmdev_ioctl()
    vm_reinit()
    vm_cleanup(destroy=false)

The call path for vm_destroy() is (mem_segs_lock not taken):
    sysctl_vmm_destroy()
    vmmdev_destroy()
    vm_destroy()
    vm_cleanup(destroy=true)

Fix this by taking mem_segs_lock in vm_cleanup() when destroy == true.

Reviewed by:	corvink, markj, jhb
Fixes:  67b69e76e8 ("vmm: Use an sx lock to protect the memory map.")
Differential Revision:	https://reviews.freebsd.org/D38071
2023-01-20 11:10:53 +00:00
Robert Wing ccf32a68f8 vmm: take exclusive mem_segs_lock when (un)assigning ppt dev
PR:             268744
Reported by:    mmatalka@gmail.com
Reviewed by:	corvink, markj, jhb
Fixes:  67b69e76e8 ("vmm: Use an sx lock to protect the memory map.")
Differential Revision:	https://reviews.freebsd.org/D37962
2023-01-20 10:03:59 +00:00
Brooks Davis fa1d803c0f epoch: replace hand coded assertion
The assertion is equivalent to kstack_contains() so use that rather
than spelling it out.

Suggested by:	jhb
Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D38107
2023-01-20 18:04:40 +00:00
John Baldwin cf57f20edc bhyve: Fix a buffer overread in the PCI hda device model.
The sc->codecs array contains HDA_CODEC_MAX (15) entries.  The
guest-supplied cad field in the verb provided to hda_send_command is a
4-bit field that was used as an index into sc->codecs without any
bounds checking.  The highest value (15) would overflow the array.

Other uses of sc->codecs in the device model used sc->codecs_no to
determine which array indices have been initialized, so use a similar
check to reject requests for uninitialized or invalid cad indices in
hda_send_command.

PR:		264582
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	corvink, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38128
2023-01-20 09:58:38 -08:00
John Baldwin bfe8e339eb bhyve: Fix a global buffer overread in the PCI hda device model.
hda_write did not validate the relative register offset before using
it as an index into the hda_set_reg_table array to lookup a function
pointer to execute after updating the register's value.

PR:		264435
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	corvink, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38127
2023-01-20 09:57:45 -08:00
Alan Somers 5205908816 Revert "ifconfig: abort if loading a module fails other than for ENOENT"
This reverts commit 2c24ad3377.

This change causes some commands to fail, for example when working with
renamed interfaces or when trying to list a nonexistent interface by
name.

PR:		269042
Reported by:	dbaio, Michael Paepcke <bugs.fbsd@paepcke.de>
MFC with:	2c24ad3377
2023-01-20 10:17:21 -07:00
Alex Richardson 34ac629b40 Shell-escape assignments to PATH in the top-level makefiles
Since 16fbf01912 PATH is no longer set
to a hardcoded value on non-FreeBSD build hosts, so we can end up with
spaces in $PATH. Instead of only escaping PATH I updated all `env PATH=`
uses in the toplevel makefile. While many of these currently can't
contain any special characters (since the build would have failed
already), in theory this gets us closer to allowing build/source
directory to contain e.g. spaces.
2023-01-20 10:47:17 +00:00
Elliott Mitchell e5c30ac930 vmstat: fix overflow of interrupt name buffer
sysctl() provides a count of number of bytes in the buffer.  That is the
actual buffer length.  Whereas looking for an interrupt entry with an
empty name could terminate too early, or overflow the end of the buffer.
The overflow will occur if the table of interrupt names is full.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36628
2023-01-20 04:51:13 +02:00
Elliott Mitchell d4d7971849 vmstat: remove shadow variables
These appear to simply be the style of arguments are left untouched and
only local variables are modified.  While some may prefer that style
this simply serves to complicate things as they're perfectly writeable.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36628
2023-01-20 04:51:12 +02:00
Konstantin Belousov ad8feb1ed9 md.c: another style fix
Noted by:	jkim
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-20 04:39:36 +02:00
Konstantin Belousov 6189672e60 Handle ERELOOKUP from VOP_FSYNC() in several other places
We need to repeat the operation if the vnode was relocked.

Reported and reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38114
2023-01-20 03:54:56 +02:00
Konstantin Belousov 70e1b11216 vm_object.c: minor style
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-01-20 03:54:42 +02:00
John Baldwin 43703bc489 stdlib.h: Fix qsort_r compatibility with GCC 12.
GCC 12 (unlike GCC 9) does not match a function argument passed to the
old qsort_r() API (as is used in the qsort_r_compat test) to a
function pointer type via __generic.  It treats the function type as a
distinct type from a function pointer.  As a workaround, add a second
definition of qsort_r for GCC 12 which uses the bare function type.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D37410
2023-01-19 14:48:52 -08:00
Jake Freeland 16fbf01912 Makefile: Avoid sanitizing PATH on non-FreeBSD systems
Allow the build process to find host binaries during the host-symlinks target when
cross-building on non-FreeBSD systems. Whilst most non-FreeBSD systems have all
the needed tools in /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin (the final
path added by host-symlinks itself), Homebrew for macOS on Arm defaults to
/opt/homebrew/bin, other more niche systems may also deviate and users may
expect tools in a customised PATH to be picked up, unlike on FreeBSD where we
want to ensure everything comes from base. In particular, (un)xz are needed
from Homebrew on macOS, and thus cannot be found on Arm without this.

Note that non-FreeBSD builds enforce BUILD_WITH_STRICT_TMPPATH, and so the
actual main build steps will still use a sanitised PATH.

Reviewed by:	jrtc27, arichardson
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D37991
2023-01-19 22:24:44 +00:00
John Baldwin fc1901abcf <sys/sysctl.h>: Reduce overly broad header pollution.
Commit d3f96f6610 removed <sys/queue.h>
and replaced it with the very broad <sys/systm.h>.  However, none of
the changes to sysctl.h in that commit require anything defined in
<sys/systm.h>.  On the other hand, <sys/sysctl.h> does still make use
of queue macros.  Drop the include of <sys/systm.h> and re-add
<sys/queue.h>.

Reviewed by:	imp, kib, asomers
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D37950
2023-01-19 10:32:45 -08:00
John Baldwin 6a284cacb1 bhyve: Remove vmctx argument from PCI device model methods.
Most of these arguments were unused.  Device models which do need
access to the vmctx in one of these methods can obtain it from the
pi_vmctx member of the pci_devinst argument instead.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D38096
2023-01-19 10:30:18 -08:00
John Baldwin b36b14beda bhyve: Avoid triggering false -Wfree-nonheap-object warnings.
XHCI port and slot numbers are 1-based rather than 0-based.  To handle
this, bhyve was subtracting one item from the pointers saved in the
softc so that index 1 accessed index 0 of the allocated array.

However, this is UB and confused GCC 12.  The compiler noticed that
the calls to free() were using an offset and emitted a warning.
Rather than storing UB pointers in the softc, push the decrement
operation into the existing macros that wrap accesses to the relevant
arrays.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D36829
2023-01-19 10:21:50 -08:00
Gordon Bergling 05187f2ffc amd64: Fix a common typo in source code comments
- s/comparision/comparison/

MFC after:	3 days
2023-01-19 14:27:18 +01:00
Gordon Bergling 72e709040f nfs: Fix a common typo in source code comments
- s/ingore/ignore/

MFC after:	3 days
2023-01-19 14:26:06 +01:00
Gordon Bergling afc55510b1 mountd(8): Fix a typo in a source code comment
- s/ingore/ignore/

MFC after:	3 days
2023-01-19 14:23:51 +01:00
Gordon Bergling 74d2a3c16d cxgbetool(8): Fix common typos in sysctl descriptions
- s/addres/address/

MFC after:	5 days
2023-01-19 14:22:00 +01:00
Gordon Bergling 7a184a41c6 bsnmpget.1: Fix a typo in the man page
- s/ingore/ignore/

MFC after:	3 days
2023-01-19 14:18:52 +01:00
Gordon Bergling 30985d19b0 rc.initdiskless: Fix a typo in a comment
- s/attemping/attempting/

MFC after:5 days
2023-01-19 14:17:37 +01:00
Gordon Bergling e4b7980c5c ath(4): Fix a sysctl description and a typo in a comment
- s/delimeter/delimiter/

MFC after:	7 days
2023-01-19 14:16:05 +01:00
Gordon Bergling fa7de6dcb9 ip_gre: Fix a common typo in source code comments
- s/addres/address/

MFC after:	3 days
2023-01-19 14:13:02 +01:00
Gordon Bergling 73e994a998 extra_tcp_stacks: Fix a common typo in source code comments
- s/orginal/original/

MFC after:	3 days
2023-01-19 14:11:00 +01:00
Jason A. Harmening 5a4a83fd0e Improve debuggability of VOP_* locking assertions
Include the phase and argument field to make it easier to determine
at a glance where the failure originated.

Reviewed by:	kib, markj
Differential Revision: https://reviews.freebsd.org/D38091
2023-01-18 22:11:05 -06:00
John Baldwin 846e4a206f ktls_disable_ifnet_help: Set curvnet around sorele().
This is required in kernels with VIMAGE such as GENERIC.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2023-01-18 15:39:04 -08:00
Jean-Sébastien Pédron bb651c77f5
linuxkpi: Define hrtimer_try_to_cancel()
It is the same as callout_stop(9) but the return values are different.

Reviewed by:	hselasky
Approved by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D38081
2023-01-18 23:02:24 +01:00
Konstantin Belousov 424f1296bd ipsec.c: typos in the comment
Sponsored by:	NVIDIA Networking
MFC after:	3 days
2023-01-18 23:22:35 +02:00
Konstantin Belousov b1d10b49e2 if_ipsec(4): handle situations where there are no policy or SADB entry for if
Reviewed by:	ae, hselasky
Sponsored by:	NVIDIA Networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38093
2023-01-18 23:18:39 +02:00
Konstantin Belousov eac971545b if_ipsec(4): protect against user supplying unknown address family
Reviewed by:	ae, hselasky
Sponsored by:	NVIDIA Networking
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38093
2023-01-18 23:18:39 +02:00
Allan Jude fd5e921059 Add CPU Ident for Qualcomm Kryo 400 (used in MS Dev Kit)
Reviewed by:	imp
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37767
2023-01-18 21:04:49 +00:00
Pau Amma 5faf9f4dff Refresh CPU types and classes from sys/sys/pmc.h.
While here, fix a few nits.

Inspired by reviewing D35342.

Sources for trademark info
- https://www.arm.com/company/policies/trademarks (no Arm8, curiously)
- https://www.ibm.com/legal/copytrade?mhsrc=ibmsearch_a&mhq=trademark

Reviewed by:	carlavilla, luporl, mhorne
Approved by:	carlavilla (mentor), mhorne (src)
Differential Revision: https://reviews.freebsd.org/D35344
2023-01-18 21:50:49 +01:00
Steffen Dirkwinkel 8580e334b0
umodem: ignore CDC_CM descriptor for baltech smartcard reader
The CDC_CM descriptor points to the wrong interface for serial port use.
Ignore it to use the CDC_UNION descriptor.

usbconfig dump (spec at: https://usb.org/sites/default/files/CDC1.2_WMC1.1_012011.zip):
ugen0.2: <Baltech AG Smartcard Reader> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (300mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x13ad
  idProduct = 0xf019
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <Baltech AG>
  iProduct = 0x0002  <Smartcard Reader>
  iSerialNumber = 0x0003  <45031910>
  bNumConfigurations = 0x0001

 Configuration index 0

    bLength = 0x0009
    bDescriptorType = 0x0002
    wTotalLength = 0x0064
    bNumInterfaces = 0x0003
    bConfigurationValue = 0x0001
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x0080
    bMaxPower = 0x0096

    Interface 0
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0000
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0003  <HID device>
      bInterfaceSubClass = 0x0000
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x09
      bDescriptorType = 0x21
      bDescriptorSubType = 0x11
       RAW dump:
       0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0xd0,
       0x08 | 0x00

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0081  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0040
        bInterval = 0x0001
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x08
      bDescriptorType = 0x0b
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x08, 0x0b, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00

    Interface 1
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0002  <Communication device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x00
       RAW dump:
       0x00 | 0x05, 0x24, 0x00, 0x10, 0x01

      Additional Descriptor

      bLength = 0x04
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x04, 0x24, 0x02, 0x00

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x06
       RAW dump:
       0x00 | 0x05, 0x24, 0x06, 0x01, 0x02

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x05, 0x24, 0x01, 0x00, 0x01

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0085  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0008
        bInterval = 0x0010
        bRefresh = 0x0000
        bSynchAddress = 0x0000

    Interface 2
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0002
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0002
      bInterfaceClass = 0x000a  <CDC-data>
      bInterfaceSubClass = 0x0000
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0086  <IN>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0040
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000

     Endpoint 1
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0006  <OUT>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0040
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000

Reviewed by:		manu
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37942
2023-01-18 12:17:17 +01:00
Steffen Dirkwinkel 73c3e8b1de
umodem: add quirk to ignore CDC_CM descriptor
Some devices have CDC_CM descriptors that would point us to
the wrong interfaces. Add a quirk to ignore those (prefering the
CDC_UNION descriptor effectively)

Reviewed by:		manu
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37942
2023-01-18 12:17:09 +01:00
Andrew Turner 896f556205 Add the fixed memory type to the pci ecam driver
Add ACPI_RESOURCE_TYPE_FIXED_MEMORY32 to the PCI ECAM driver. This is
used on the Microsoft Dev Kit 2023 and reportedly the Lenovo x13s.

Reviewed by:	Robert Clausecker <fuz@fuz.su> (Earlier version)
Tested by:	Robert Clausecker <fuz@fuz.su> (Earlier version)
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D38031
2023-01-18 09:31:50 +00:00
Andrew Turner a85cf421d1 Reduce an arm64 VFP critical section
In set_fpcontext we only need a critical section around vfp_discard.
The remainder of the code can run without it.

While here add an assert to check the passed in thread is the
current thread as the code already this.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D38000
2023-01-18 09:31:50 +00:00
Andrew Turner 61f5462fde Always store the arm64 VFP context
If a thread enters a kernel FP context the PCB_FP_STARTED may be
unset when calling get_fpcontext even if the VFP unit has been used
by the current thread.

Reduce the use of this flag to just decide when to store the VFP state.

While here add an assert to check the assumption that the passed in
thread is the current thread and remove the unneeded critical section.
The latter is unneeded as the only place we would need it is in
vfp_save_state and this already has a critical section when needed.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D37998
2023-01-18 09:31:45 +00:00
Andrew Turner 95dd6974b5 Always read the VFP regs in the arm64 fill_fpregs
The PCB_FP_STARTED is used to indicate that the current VFP context
has been used since either 1. the start of the thread, or 2. exiting
a kernel FP context.

When case 2 was added to the kernel this could cause incorrect results
to be returned when a thread exits the kernel FP context and fill_fpregs
is called before it has restored the VFP state, e.g. by trappin on a
userspace VFP instruction.

In both of the cases the base save area is still valid so reduce the
use of the PCB_FP_STARTED flag check to help decide if we need to
store the current threads VFP state.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D37994
2023-01-18 09:31:35 +00:00
Juraj Lutter 1d577bedba unbound: Fix config file path
Commit 1838dec318 changed the
config file path to /usr/local/etc/unbound/unbound.conf which
is wrong for unbound in base.

Reported by:	Ihor Antonov <ihor_AT_antonovs_family>
Reviewed by:	zlei
Approved by:	zlei
Differential Revision: https://reviews.freebsd.org/D38106

Fixes:          1838dec318
MFC after:      1 month
X-MFC with:     1838dec318
2023-01-18 08:50:07 +01:00
Justin Hibbits 701bb67bc5 ifnet: Rename DrvAPI to "IfAPI"
"DrvAPI" is too generic a name.  Make the name more specific as "IfAPI"
(InterFace API).

Sponsored by:	Juniper Networks, Inc.
2023-01-17 15:15:51 -05:00
Brooks Davis b75062f234 riscv: Fix thread0.td_kstack_pages init
Commit 0ef3ca7ae3 initialized
thread0.td_kstack_pages to KSTACK_PAGES.  Due to the lack of an
include of opt_kstack_pages.h it used the fallback value of 4 from
machine/param.h.  This meant that increasing KSTACK_PAGES in the kernel
config resulted in a panic in _epoch_enter_preempt as the following
assertion was false during network stack setup:

	MPASS((vm_offset_t)et >= td->td_kstack &&
	    (vm_offset_t)et + sizeof(struct epoch_tracker) <=
	    td->td_kstack + td->td_kstack_pages * PAGE_SIZE);

Switch to initializing with kstack_pages following other architectures.

Reviewed by:	imp, markj
Sponsored by:   DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D38049
2023-01-17 16:37:42 +00:00
Brooks Davis e1b610f76c arm64: Fix thread0.td_kstack_pages init
Commit 86a994d653 initialized
thread0.td_kstack_pages to KSTACK_PAGES.  Due to the lack of an
include of opt_kstack_pages.h it used the fallback value of 4 from
machine/param.h.  This meant that increasing KSTACK_PAGES in the kernel
config resulted in a panic in _epoch_enter_preempt as the following
assertion was false during network stack setup:

        MPASS((vm_offset_t)et >= td->td_kstack &&
	    (vm_offset_t)et + sizeof(struct epoch_tracker) <=
	    td->td_kstack + td->td_kstack_pages * PAGE_SIZE);

Switch to initializing with kstack_pages following other architectures.

Reviewed by:	imp, markj
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D38048
2023-01-17 16:37:09 +00:00
Dag-Erling Smørgrav c968598479 df: Return non-zero status on write failure.
While here, complete the libxo conversion and switch return value to standard constants.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential revision: https://reviews.freebsd.org/D38097
2023-01-17 16:25:28 +01:00