Commit graph

269332 commits

Author SHA1 Message Date
Mark Johnston 3681c4f065 ctf: Import ctf.h from OpenBSD
Use it instead of the existing ctf.h from OpenSolaris.  This makes it
easier to use CTF in the core kernel, and to extend the CTF format to
support wider type IDs.

The imported ctf.h is modified to depend only on _types.h, and also to
provide macros which use the "parent" bit of a type ID to refer to types
in a parent CTF container.

No functional change intended.

Reviewed by:	Domagoj Stolfa, emaste
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2d5d2a986c)
2022-04-06 20:30:44 -04:00
Chandrakanth Patil 09e161a29e mrsas: if controller reset is in progress, refrain from firing DCMDs to
firmware in shutdown

If controller reset is in progress, at same time if system shutdown is
issued then corresponding shutdown function in driver will be invoked
where driver is waiting 15 seconds to complete the controller reset.

If the reset is not complteted within that time frame driver will go
ahead and fire cache flush and shutdown DCMDs which will end up
accessing the the queues which are not initialized due to undergoing
reset leads to FMU error in firmware.

Fix:
In shutdown function, if controller reset is not finished within 15
seconds than driver will return to the OS without firing any DCMDs.

Reviewed by: imp
PR: 261375

(cherry picked from commit 79c4c4be96)
2022-04-06 10:27:25 -06:00
Chandrakanth Patil 2ebe518597 mrsas: remove additional MPT command allocation for R1 FP command
There is an additional MPT command allocation for R1 fp command which
will lead to MPT command unavailablity in case of rigorous R1 FP IOs.

Remove additional MPT command allocation for R1 FP.

Reviewed by: imp
PR: 261377

(cherry picked from commit 241bb95552)
2022-04-06 10:27:25 -06:00
Warner Losh c43786cc37 fix integer overflow bugs in *stosbt
68f57679d6 Fixed another class of integer overflows, but introduced a
boundary condition for 2-4s in ns conversion, 2-~4000s in us conversions
and 2-~4,000,000s in ms conversions. This was because we bogusly used
SBT_1S for the notion of 1 second, instead of the appropriate power of
10. To fix, just use the appropriate power of 10, which avoids these
overflows.

This caused some sleeps in ZFS to be on the order of an hour.

MFC:			1 day
PR:			263073
Sponsored by:		Netflix
Reviewed by:		asomers
Differential Revision:	https://reviews.freebsd.org/D34790

(cherry picked from commit 4c30b9ecd4)
2022-04-06 09:58:30 -06:00
Martin Matuska 43a449f2f1 libarchive: merge vendor bugfixes
Bugfixes:
  IS #1685 and OSS-Fuzz #38764 (security):
    (ISO reader) fix possible heap buffer overflow in read_children()
  IS #1715 and OSS-Fuzz #46279 (security):
    (RARv4 reader) fix heap-use-after-free in run_filters()

(cherry picked from commit 9f690fcfdc)
2022-04-06 10:24:00 +02:00
Jose Luis Duran 39665ad353 sysrc.8: Mention it requires chroot(8)
Option -R uses chroot(8). Mention it in the corresponding section.

MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D34630

(cherry picked from commit 1a0bd2665a)
2022-04-06 08:48:03 +02:00
Kyle Evans 227e52a9c0 bectl: push space-in-name check down into libbe
This check was previously in `create` only, not applying to renames.  It
should really be applied at the libbe level, so that we can avoid
writing about this restriction over and over again.

While we're here: `bectl rename` always succeeds, even when it doesn't.
Start returning the error.

Reported By:	Christian McDonald <cmcdonald netgate com>

(cherry picked from commit dadb9c7093)
2022-04-05 22:37:07 -05:00
Kyle Evans 0e90da6549 bectl: add some discussion about boot environment layouts
Discuss the standard type of layout, as well as the "deep" BE layout,
and some of the properties of both.  Point the various -r flags at this
new section, to help users understand which they're working with and
what the -r flag is actually doing. Note that we may just deprecate the
-r flag in future versions, but the flag will be recognized as a NOP at
that point.

(cherry picked from commit c0f846ff23)
2022-04-05 22:37:07 -05:00
Kyle Evans 6ce8e35cea libbe: fix be_mounted_at() with props after bootonce
propinfo.bootonce was filled with garbage, leading to a segfault later
during prop building.  Initialize it to NULL.

(cherry picked from commit d155d8e138)
2022-04-05 22:37:03 -05:00
Kyle Evans bed9c972ae libbe: pull props for the correct dataset in be_mounted_at()
The props feature to this API was added as a "just in case", with no
planned consumer.  It turns out that it was implemented incorrectly,
tapping out props for the BE root (BE's parent) rather than the BE
itself in all cases.

Fetch properties for the dataset that's actually mounted at the queried
path.

Reported by:	Christian McDonald <cmcdonald netgate com>

(cherry picked from commit 31190aa02e)
2022-04-05 22:36:10 -05:00
Alexander Motin e3b3dfa779 gpart: Avoid geom_gettree() call in "bootcode -b".
geom_gettree() may be pretty expensive on large systems, and it is
not needed if only -b flag specified, that is processed by kernel.

MFC after:	1 month

(cherry picked from commit 5c20bfc787)
2022-04-05 22:07:40 -04:00
Alexander Motin 59c15b83be geom: Allow "load" command for already loaded modules.
I see more user-friendly to do nothing if the module is already
loaded, rather than returning quite confusing error message.

As side effect it allows to avoid std_list_available() call, using
quite expensive on large systems geom_gettree().

MFC after:	1 month

(cherry picked from commit 5678114cd8)
2022-04-05 22:07:40 -04:00
Alexander Motin aacc157926 GEOM: Make G_F_CTLDUMP also dump result.
MFC after:	1 month

(cherry picked from commit dd7a5bc1e6)
2022-04-05 22:07:40 -04:00
Alexander Motin 4340533721 GEOM: Introduce gctl_add_param() API.
Make gctl_add_param() API public, allowing more precise control over
parameter flags.  Previously it was impossible to properly declare
write-only ASCII parameters, used for result reporting, they were
declared as read-write binary instead, that was not nice.

MFC after:	1 month

(cherry picked from commit 2117cdd4b4)
2022-04-05 22:07:40 -04:00
Alexander Motin be6abdb259 GEOM: Skip copyin() for GCTL_PARAM_WR parameters.
Kernel does not read those parameters, so copyin is pointless.

While there, replace some KASSERT()s with CTASSERT()s.

MFC after:	1 month

(cherry picked from commit 01b9c48b5d)
2022-04-05 22:07:39 -04:00
Bjoern A. Zeeb 72617f9246 net80211: validate Mesh ID length in ieee80211_parse_beacon
Reported by:	m00nbsd working with Trend Micro Zero Day Initiative

(cherry picked from commit fb8c87b4f3)
2022-04-05 18:59:22 -04:00
Mark Johnston 53f7220947 bhyve: validate e82545 checksum offset field
Reported by:	Mehdi Talbi, Synacktiv

(cherry picked from commit b0aa20bec5)
2022-04-05 18:59:08 -04:00
Bjoern A. Zeeb 7b9d8e33bc LinuxKPI: 802.11: fix RSSI (and NF)
As in 4a22cd6c4e nf and rss should be
signed and not unsigned.  Change the types in the header and while
here change a magic number to a define as done elsewhere (value does
not change).

When calculating c_rssi we need to make it relative so subtract nf.
And while here improve the debug output.

This will hopefully fix ifconfig wlanN list scan S:N output which
tools use to chose a BSSID and help net80211 internal calculations.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 60970a328e)
2022-04-05 14:47:13 +00:00
Bjoern A. Zeeb 7311128e69 net80211: correct types for nf and rssi
NF and RSSI should be signed and not unsigned to avoid problems.
Change the type accordingly.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4a22cd6c4e)
2022-04-05 14:47:08 +00:00
Bjoern A. Zeeb 2a8e509ba3 LinuxKPI: 802.11: fix compat code for i386
Compiling another driver on i386 revealed two problems:
- ieee80211_tx_info.status.status_driver_data space needs to be
  calculated.  While a pointer is 32bit vm_paddr_t is 64 bit on i386
  so we didn't fit more than one of these in but needed more space.
- the arguments to ieee80211_txq_get_depth() are expected to
  unsigned long and not uint64_t.

No user noticable changes.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 86220d3cbd)
2022-04-05 14:46:58 +00:00
Warner Losh 4e94b3542d linuxkpi: move io_mapping_create_wc to .c
Move io_mapping_create_wc to .c because it encodes the size of struct
io_mapping so we move this from the client module to the linuxkpi
module.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34776

(cherry picked from commit 132b00f906)
2022-04-05 08:40:11 -06:00
Warner Losh 211621030e linuxkpi: Move lkpi_pcim_iomap_devres_find to .c file
lkpi_pcim_iomap_devres_find encodes the size of struct pcim_iomap_devres
in the code, so move from .h to .c to move from client driver to
linuxkpi module.

Sponsored by:		Netflix
Reviewed by:		hselasky
Differential Revision:	https://reviews.freebsd.org/D34775

(cherry picked from commit 2bf3361d56)
2022-04-05 08:40:11 -06:00
Warner Losh bc01b38394 linuxkpi: Move pci_alloc_irq_vectors to .c file
pci_alloc_irq_vectors encodes the size of struct msix_entry
into its code. Move from .h to .c to move this knowledge from
client modules to linuxkpi module.

Sponsored by:		Netflix
Reviewed by:		hselasky
Differential Revision:	https://reviews.freebsd.org/D34774

(cherry picked from commit 36b5c44002)
2022-04-05 08:40:11 -06:00
Warner Losh 4859994c42 linuxkpi: Move pci_request_region and _lkpi_pci_iomap into .c
Both pci_request_region and _lkpi_pci_iomap encode the size of struct
pci_mmio_region into their code. Move from .h to .c files to move that
knowledge from the client drivers into the linuxkpi module.

Sponsored by:		Netflix
Reviewed by:		hselasky
Differential Revision:	https://reviews.freebsd.org/D34773

(cherry picked from commit 1cdb25340f)
2022-04-05 08:40:11 -06:00
Warner Losh 2cd55de380 linuxkpi: Move lkpi_pci_devres_get_alloc into .c file
lkpi_pci_devres_get_alloc encodes the struct pci_devres into its
code. Move from .h file to .c file to move this knowledge into linuxkpi
module.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34772

(cherry picked from commit 3ea682e21e)
2022-04-05 08:40:10 -06:00
Warner Losh d1f93d6721 linuxkpi: Move cdev_alloc into .c file
Move cdev_alloc into linux_compat.c since it encodes the size of struct
linux_cdev into the client modules otherwise.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34771

(cherry picked from commit aca0bcbca3)
2022-04-05 08:40:10 -06:00
Warner Losh 98d2b4a158 linuxkpi: Move class_create to .c file
class_create encodes the size of struct class into the generated
code. Move from .h file to .c file to move this knowledge from the
client modules that call this into the linuxkpi module.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34769

(cherry picked from commit 1341ac9f9c)
2022-04-05 08:40:10 -06:00
Warner Losh 417f1c8149 linuxkpi: Move device_create_groups_vargs to linux_compat.c
device_create_groups_vargs encodes the size of struct device. Move
definition from .h to .c to move this size into the linuxkpi module
rather than encoding it in all client driver modules.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34768

(cherry picked from commit 702b687503)
2022-04-05 08:40:10 -06:00
Warner Losh 2f3d11894b linuxkpi: move kobject_create to .c file
kobject_create knows the size of struct kobject. Move it to
linux_compat.c so this knowledge is confined to the loadable module and
not the clients.

Sponsored by:		Netflix
Reviewed by:		hselasky, emaste
Differential Revision:	https://reviews.freebsd.org/D34767

(cherry picked from commit 36929b5584)
2022-04-05 08:40:10 -06:00
Mateusz Piotrowski 39289f6127 Cross-reference nextboot(8) and freebsd-update(8)
MFC after:	1 week

(cherry picked from commit 075999d3f1)
2022-04-05 16:08:43 +02:00
Mateusz Piotrowski dee5ec942e freebsd-update.8: Fix use of mdoc(8) macros
- Use Ar for arguments.
- Use Cm for freebsd-update commands like "upgrade".
- Reference other manuals with Xr when possible.

MFC after:	1 week

(cherry picked from commit 15647a7106)
2022-04-05 16:08:43 +02:00
Mateusz Piotrowski 69c70456e8 ifconfig.8: Simplify -G & -g synopsis
MFC after:	1 week

(cherry picked from commit d1d14f0428)
2022-04-05 16:08:43 +02:00
Warner Losh 86d5c66106 linuxkpi: add padding to struct pci_driver
Add 32 or 64 bytes of padding to struct pci_driver at the end in the
_spare field like we should have done when we branched stable/13, but
neglected to do so since we didn't properly anticipate the need.

We cannot safely use these spare fields until after 13.0 EOL since
drivers compiled on 13.0 won't have that space reserved and we'll step
on something else using them. This isn't 100% KBI compatible through the
13.x release branch, but is compatible enough so that drm packages built
on the oldest supported release will work on the latest stable/13 and
any newer releases. It's not ideal, but makes the best of a bad
situation and is a pragmatic approach that belatedly builds in some
future proofing.

Direct commit to stable/13 because this is not relevant to main in this
exact form.

Sponsored by:		Netflix
Reviewed by:		bz
Differential Revision:	https://reviews.freebsd.org/D34754
2022-04-04 22:54:49 -06:00
Warner Losh aa61c28b42 linuxkpi: Restore the KBI for struct pci_driver
The size of the 13.0 version of struct pci_driver was 92 or 184 bytes on
32- or 64-bit systems respectively. We recently added bsd_probe_return
at the end of this struct, breaking the KBI on the stable/13 branch.

Fix this by removing the isdrm member. We don't need it because we can
do a strcmp in the few places that need it as they aren't performance
critical. Move the newly added bsd_probe_return to that slot. It's the
same size in all our supported KBIs as bool and fits into that slot due
to padding rules.

Direct commit to stable/13 because this is not relevant to main.

Sponsored by:		Netflix
Reviewed by:		bz
Differential Revision:	https://reviews.freebsd.org/D34754
2022-04-04 22:48:27 -06:00
Piotr Kubaj 16c3f5d03e powerpc: implement __clear_cache
Merge LLVM commit 81f5c6270cdfcdf80e6296df216b696a7a37c8b5.

This fixes runtime of most notably pcre libraries (currently patched in ports),
and probably also other ports since currently __clear_cache() just calls
SIGABRT on powerpc.

Reviewed by:	dim
Differential Revision: https://reviews.freebsd.org/D34736

(cherry picked from commit 57b6ac48a9)
2022-04-05 02:33:22 +02:00
Konstantin Belousov 123b4031e9 sys/stdatomic.h: be nicer to c++
PR:	262683

(cherry picked from commit c1a24b9dbe)
2022-04-05 01:55:33 +03:00
Mike Karels a999acabfc Add release note about change to lowest address in IPv4 (sub)net.
This change was made earlier, note it now.
This is a direct commit.
2022-04-04 17:05:57 -05:00
Xin LI c4727a47f1 lib/libz: remove ZLIBprivate_1.0 namespace.
These symbols were hidden and no longer exposed, and were never exposed in headers.

MFC after:	3 days

(cherry picked from commit a7f127b653)
2022-04-04 15:30:18 -04:00
Mateusz Guzik 792ebbb155 vfs: fixup WANTIOCTLCAPS on open
In some cases vn_open_cred overwrites cn_flags, effectively nullifying
initialisation done in NDINIT. This will have to be fixed.

In the meantime make sure the flag is passed.

Reported by:	jenkins
Noted by:	Mathieu <sigsys@gmail.com>

(cherry picked from commit b7262756e2)
2022-04-04 19:17:05 +00:00
Mateusz Guzik 838d8e6fb6 vfs: fix memory leak on lookup with fds with ioctl caps
Reviewed by:	markj
PR:		262515
Noted by:	firk@cantconnect.ru
Differential Revision:	https://reviews.freebsd.org/D34667

(cherry picked from commit 0c805718cb)
2022-04-04 19:16:18 +00:00
Colin Percival 5cc5cd739e uart(4): Add a concept of "unique" serial devices
FreeBSD detects serial ports twice: First, very early in the boot
process, in order to obtain a usable console; and second, during
the device probe/attach process.  When a UART is discovered during
device probing, FreeBSD attempts to determine whether it is a
device which was already being used as a console; without this,
the console doesn't work in userland.

Unfortunately it's possible for a UART to be mapped to a different
location in memory when it is discovered on a bus than it has when
it is announced via the ACPI SPCR table; this breaks the matching
process, which relies on comparing bus addresses.

To address this, we introduce a concept of "unique" serial devices,
i.e. devices which are guaranteed to be present *only once* on any
system.  If we discover one of these during device probing, we can
match it to a same-PCI-vendor-and-device-numbers console which was
announced via the ACPI SPCR table, regardless of the differing bus
addresses.

At present, the only unique serial device is the "Amazon PCI serial
device" (vendor 0x1d0f, device 0x8250) found in some EC2 instances.
This unbreaks the serial console on those systems.

Reviewed by:	imp
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D34703

(cherry picked from commit ad93649d23)
2022-04-04 12:11:41 -07:00
Colin Percival 7d160dc9a1 sysctl(8): Mention CTLFLAG_SKIP
`sysctl -a` does not print values with this flag.

Reviewed by:	debdrup
Differential Revision:	https://reviews.freebsd.org/D34615

(cherry picked from commit 1dee7c74d1)
2022-04-04 12:11:36 -07:00
Colin Percival 794e30fcfe tslog: Add CTLFLAG_SKIP to sysctls
The timestamp logs are quite large (often much larger than all the
other sysctls combined) so it's unlikely anyone will want to have
them displayed by `sysctl -a`.

Differential Revision:	https://reviews.freebsd.org/D34616

(cherry picked from commit 2406867f5b)
2022-04-04 12:11:30 -07:00
Andrew Gallatin 392d7f0269 cxgbe: fix enabling lro & rxtimestamps
A recent change caused iq flags, like LRO, to be set before
init_iq(). However, init_iq() clears those flags, so they
became effectively impossible to set.   This change moves
the initializion of these flags to after the call to init_iq().
This fixes LRO.

Differential Revision: https://reviews.freebsd.org/D30460
Reviewed by: np, rrs
Sponsored by: Netflix
Fixes: 43bbae1948

(cherry picked from commit df8437a93d)
2022-04-04 11:57:15 -07:00
Mateusz Piotrowski 25acd1d3d6 locking.9: Reference lockstat(1) from this manual page
MFC after:	3 days

(cherry picked from commit fd126a732c)
2022-04-04 19:49:55 +02:00
Mateusz Piotrowski e4ed6079d7 uefi.8: Document i386 and riscv EFI bootloader names
Based on tools/boot/install-boot.sh.

MFC after:	2 weeks

(cherry picked from commit 12912d0e0c)
2022-04-04 19:49:55 +02:00
Mateusz Piotrowski 1df2b7c954 loader.efi: Improve the manual page
- Add SPDX tag
- Add a files section describing different locations related to the
  loader
- Add an example explaining how to install a new loader.efi to ESP
- Reference uefi(8)

Reviewed by:	tsoome
Reviewed by:	Pau Amma <pauamma@gundo.com>
Reviewed by:	Jose Luis Duran <jlduran@gmail.com>
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D34592

(cherry picked from commit 9ecf6e0f9f)
2022-04-04 19:49:55 +02:00
Xin LI 9587a10b42 sys/contrib/zlib: Always define Z_U8 and Z_U4
This is a temporary hack for zlib to make sure that the library
still builds when building with Z_SOLO (used in kernel and loader),
as zlib is depending on limits.h which is only available in STDC
case.

PR:		kern/262977
MFC after:	3 days

(cherry picked from commit 0a21252adf)

Approved by:	re (gjb, early MFC)
2022-04-04 11:58:10 -04:00
Xin LI 6b0e0c9e95 MFV 7b495a2a7a (zlib): Correct incorrect inputs provided to the CRC
functions.

MFC after:	3 days

(cherry picked from commit c61bc1110c)
2022-04-04 11:31:46 -04:00
Xin LI 6349675dec MFV c144cc5479: zlib 1.2.12.
MFC after:	3 days
Relnotes:	yes

(cherry picked from commit cd8822075a)
2022-04-04 11:31:13 -04:00