]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agolinuxkpi xarray: Correct expression in assertion.
John Baldwin [Fri, 11 Feb 2022 21:59:27 +0000 (13:59 -0800)]
linuxkpi xarray: Correct expression in assertion.

Reported by: GCC -Wparantheses
Reviewed by: wulf, hselasky
Differential Revision: https://reviews.freebsd.org/D34197

(cherry picked from commit b0c1600a8c42fc1b2c90714d5fefd3266385225a)

2 years agolinuxkpi: Add parentheses to pacify -Wparentheses warnings from GCC.
John Baldwin [Mon, 7 Feb 2022 21:43:22 +0000 (13:43 -0800)]
linuxkpi: Add parentheses to pacify -Wparentheses warnings from GCC.

Reviewed by: bz, emaste
Differential Revision: https://reviews.freebsd.org/D34145

(cherry picked from commit 7043ca9140d2bf4c42371e25716298d24da54cd0)

2 years agostand/efi: Pass --no-dynamic-linker to ld.bfd >= 2.34.
John Baldwin [Wed, 2 Feb 2022 20:18:43 +0000 (12:18 -0800)]
stand/efi: Pass --no-dynamic-linker to ld.bfd >= 2.34.

ld.bfd in binutils 2.34+ now reports an error in more cases for custom
ldscripts that do not place PHDRs in a LOAD segment.  However, EFI
binaries are not dynamic binaries which need PHDRs, so pass
--no-dynamic-linker to disable this check.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D34124

(cherry picked from commit 8bd5e2f15cc9756e7d6b7feb43ec47f18a38e2bf)

2 years agofstyp: Remove __packed from struct exfat_de_label.
John Baldwin [Tue, 1 Feb 2022 01:33:31 +0000 (17:33 -0800)]
fstyp: Remove __packed from struct exfat_de_label.

This fixes a -Waddress-of-packed-member warning about a possibly
unaligned pointer from GCC 9 when calling convert_label().

__packed has to be removed from struct exfat_dirent as well to fix an
alignment warning when casting from a struct exfat_dirent pointer to a
struct exfat_de_label pointer.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D32144

(cherry picked from commit 58862c0bea66139583f830d21c2f1d98fb844bb0)

2 years agoggatec: Use ANSI C definition for init_initial_buffer_size.
John Baldwin [Tue, 1 Feb 2022 01:12:04 +0000 (17:12 -0800)]
ggatec: Use ANSI C definition for init_initial_buffer_size.

This fixes -Wstrict-prototypes and -Wold-style-definition warnings
from GCC 9.

(cherry picked from commit 6c9ed428284e40f28a49eac2680f06ed33b7cca9)

2 years agohyperv storvsc: Don't abuse struct sglist to hold virtual addresses.
John Baldwin [Tue, 1 Feb 2022 01:11:27 +0000 (17:11 -0800)]
hyperv storvsc: Don't abuse struct sglist to hold virtual addresses.

struct sglist is intended for holding S/G lists of physical address
ranges, not virtual address ranges.  GCC 9.x issues several warnings
due to casts between pointers and integers of different sizes as a
result (vm_paddr_t is 64-bits on i386).  Instead, add a local 'struct
hv_sglist' which uses an array of 'struct iovec' to hold the S/G list
of virtual address ranges.

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

(cherry picked from commit 53e938e408be78a45c82012ca7a7be50b216159b)

2 years agocryptodev: Use a private malloc type (M_CRYPTODEV) instead of M_XDATA.
John Baldwin [Mon, 24 Jan 2022 23:27:39 +0000 (15:27 -0800)]
cryptodev: Use a private malloc type (M_CRYPTODEV) instead of M_XDATA.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33991

(cherry picked from commit 8f3f3fdf73a98e819d5f73c1da3286bd608e8208)

2 years agoIPsec: Use protocol-specific malloc types instead of M_XDATA.
John Baldwin [Mon, 24 Jan 2022 23:27:39 +0000 (15:27 -0800)]
IPsec: Use protocol-specific malloc types instead of M_XDATA.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33992

(cherry picked from commit 35d9e00dba8cf0c25fbfdbd41ad4d6d1906eed4b)

2 years agomount: Don't pass a NULL format string to xo_err().
John Baldwin [Sat, 25 Sep 2021 18:51:01 +0000 (11:51 -0700)]
mount: Don't pass a NULL format string to xo_err().

This fixes a -Wformat error from GCC 9.

Fixes: e725ee7eb672 mount: add libxo(3) support
(cherry picked from commit 9d324b5ffc8a783ceff2a78dea19602a1d8f045a)

2 years agobhyve: Add an empty case for event types in mevent_kq_fflags().
John Baldwin [Sat, 25 Sep 2021 18:25:25 +0000 (11:25 -0700)]
bhyve: Add an empty case for event types in mevent_kq_fflags().

This fixes a -Wswitch error raised by GCC 9.

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

(cherry picked from commit 7ecdfc823798a8f7add245651b26d9d900bc9889)

2 years agokernel: Disable errors for -Walloca-larger-than for GCC.
John Baldwin [Sat, 25 Sep 2021 18:24:35 +0000 (11:24 -0700)]
kernel: Disable errors for -Walloca-larger-than for GCC.

GCC complains about the use of alloca() with variable sizes (for XSAVE
state len) in sendsig() for i386.  Modern XSAVE state is probably
getting a bit large for the i386 kstack, but downgrade the error to a
warning.

Reviewed by: kib, emaste
Differential Revision: https://reviews.freebsd.org/D31934

(cherry picked from commit e72c7e2738ca9f5893ba5e5e9dc120dfc82fabfd)

2 years agoarm64: Fix a logic bug in is_load_instr().
John Baldwin [Wed, 15 Sep 2021 16:03:18 +0000 (09:03 -0700)]
arm64: Fix a logic bug in is_load_instr().

Logical and ('&&') was used to join two conditions instead of logical
or ('||') causing some store instructions to not be recognized.

Reported by: GCC 9 -Wparentheses

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D31949

(cherry picked from commit 8753039a8f231ab04c7f3db9eaa5d9144d73440d)

2 years agoarm64: Pass the right label to END() for handle_empty_exception.
John Baldwin [Wed, 15 Sep 2021 16:03:18 +0000 (09:03 -0700)]
arm64: Pass the right label to END() for handle_empty_exception.

GNU as reported an error for the argument to .size not being a constant.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D31950

(cherry picked from commit 857dc1c0ecfbf40509706b87de832a3f6d7338b2)

2 years agoinfiniband: Disable -Wredundant-decl warnings.
John Baldwin [Wed, 15 Sep 2021 16:03:18 +0000 (09:03 -0700)]
infiniband: Disable -Wredundant-decl warnings.

ib_uverbs_flow_resources_free() is declard in two header files in
upstream OFED.  Disable the warning to avoid introducing diffs to fix
the build on GCC 9.

While here, fix the ibcore module to disable the same warnings
disabled in OFED_CFLAGS.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D31943

(cherry picked from commit 44126818d2ec96d8247eafcae9b96905a473a264)

2 years agoAssert that invalid bus widths can't be passed to bus_width_str().
John Baldwin [Wed, 15 Sep 2021 16:03:17 +0000 (09:03 -0700)]
Assert that invalid bus widths can't be passed to bus_width_str().

This appeases a -Wreturn-type warning from GCC.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D31935

(cherry picked from commit d2bc7754a226c031b76184277e32c4d65a763f67)

2 years ago<linux/overflow.h>: Don't use __has_builtin().
John Baldwin [Wed, 15 Sep 2021 16:03:17 +0000 (09:03 -0700)]
<linux/overflow.h>: Don't use __has_builtin().

GCC only added support for __has_builtin in GCC 10.  However, all
supported versions of GCC and clang include these builtins so just use
them unconditionally.

This fixes the build with GCC 9.

Reviewed by: manu, hselasky, imp
Differential Revision: https://reviews.freebsd.org/D31942

(cherry picked from commit 9553c6af881e1f869cecb11b4476279e0ed6c4e0)

2 years agoRemove nonexistent include path for arm64 crypto files.
John Baldwin [Wed, 15 Sep 2021 16:03:17 +0000 (09:03 -0700)]
Remove nonexistent include path for arm64 crypto files.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D31932

(cherry picked from commit 828f257277bd7418bbc0431bbd78569a2f609af1)

2 years agoRemove an always-true check.
John Baldwin [Wed, 15 Sep 2021 16:03:17 +0000 (09:03 -0700)]
Remove an always-true check.

This fixes a -Wtype-limits error from GCC 9.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D31936

(cherry picked from commit 5ac4ac85ca20ce1f00c84502a65a3291bf416c18)

2 years agotop: Remove a duplicate extern declaration for show_args.
John Baldwin [Wed, 15 Sep 2021 16:03:17 +0000 (09:03 -0700)]
top: Remove a duplicate extern declaration for show_args.

This fixes a -Wnested-extern error with GCC 9.  There is an existing
extern declaration in top.h.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D31937

(cherry picked from commit 4c9cb057bd96bd10278f5ce7a735fff4c08e3c30)

2 years agoDisable -Woverflow errors for i386 for GCC 9.
John Baldwin [Mon, 13 Sep 2021 18:00:38 +0000 (11:00 -0700)]
Disable -Woverflow errors for i386 for GCC 9.

GCC 9 warns about floating point constants overflowing for i386.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D26201

(cherry picked from commit 93d6fa53c9951563be3081a347cc4dc1917ad452)

2 years agoUse an ANSI C function declaration for journal_check_space.
John Baldwin [Fri, 23 Jul 2021 22:06:26 +0000 (15:06 -0700)]
Use an ANSI C function declaration for journal_check_space.

GCC6 fails to compile this due to a -Wstrict-prototypes error.

Sponsored by: Chelsio Communications

(cherry picked from commit 58109a87d42b490eba76879f9007a4dbdaf7bb80)

2 years agoiflib: Cast the result of iflib_netmap_txq_init() to void.
John Baldwin [Fri, 19 Feb 2021 20:52:05 +0000 (12:52 -0800)]
iflib: Cast the result of iflib_netmap_txq_init() to void.

This fixes a warning from GCC for kernels without netmap since the
return value is never used.

Reviewed by: vmaffione, erj
Differential Revision: https://reviews.freebsd.org/D28598

(cherry picked from commit 2ccf971ace0bf23a9b27ec886a7f013c47661052)

2 years agoAdd a VA_IS_CLEANMAP() macro.
John Baldwin [Thu, 18 Feb 2021 00:32:11 +0000 (16:32 -0800)]
Add a VA_IS_CLEANMAP() macro.

This macro returns true if a provided virtual address is contained
in the kernel's clean submap.

In CHERI kernels, the buffer cache and transient I/O map are allocated
as separate regions.  Abstracting this check reduces the diff relative
to FreeBSD.  It is perhaps slightly more readable as well.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D28710

(cherry picked from commit 67932460c7b6893a637a47d98d5f29d63e92c727)

2 years agoarm64: Handle 32bits breakpoint exception.
Olivier Houchard [Tue, 21 Sep 2021 13:49:45 +0000 (15:49 +0200)]
arm64: Handle 32bits breakpoint exception.

A different exception is raised when we hit a 32bits breakpoint, rather than
a 64bits one, so handle those as well when COMPAT_FREEBSD32 is defined.
This should fix SIGBUS at least when using breakpoints with thumb2 code.

PR: 256468
MFC After: 1 week

(cherry picked from commit 2734050154927eaa63d3b65de5d46d05569b3a5b)

2 years agoxhci(4): Tweak USB port speed checks to allow newer super speed generations.
Hans Petter Selasky [Tue, 3 May 2022 20:20:27 +0000 (22:20 +0200)]
xhci(4): Tweak USB port speed checks to allow newer super speed generations.

This allows setting the U1 and U2 port timeout values.

Sponsored by: NVIDIA Networking

(cherry picked from commit a1c0442b418b39e57d287750147b0aeae5140766)

2 years agoxhci(4): Properly define all basic USB port speeds.
Hans Petter Selasky [Tue, 3 May 2022 20:19:35 +0000 (22:19 +0200)]
xhci(4): Properly define all basic USB port speeds.

Sponsored by: NVIDIA Networking

(cherry picked from commit d730333c80fe8bc60770d093cbf12f473a065ca4)

2 years agomlx5en(4): Use hard-coded 4K page size for RQ/SQ/CQ.
Hans Petter Selasky [Mon, 2 May 2022 15:14:50 +0000 (17:14 +0200)]
mlx5en(4): Use hard-coded 4K page size for RQ/SQ/CQ.

The page size specified for RQ, SQ and CQ is always in units of 4KBytes.
Make sure we subtract MLX5_ADAPTER_PAGE_SHIFT, 12, instead of PAGE_SHIFT
which may vary. This fixes support for using the mlx5en driver on systems
having non-4K page size.

Linux commit:
68cdf5d6e91068c98d6091b193dc7a5ab7dcf5eb

Sponsored by: NVIDIA Networking

(cherry picked from commit d735d604f063617909d98bd0fc36a6f25a14c699)

2 years agolinuxkpi: Mitigate a seqlock livelock
Mark Johnston [Mon, 25 Apr 2022 13:13:03 +0000 (09:13 -0400)]
linuxkpi: Mitigate a seqlock livelock

Disable preemption in seqlock write sections when using the _irqsave
variant.  This ensures that a writer can't be preempted and subsequently
starved by a reader running in a callout handler on the same CPU.

This fixes occasional display hangs seen when using the i915 driver.

Tested by: emaste, wulf
Reviewed by: wulf, hselasky
Sponsored by: The FreeBSD Foundation

(cherry picked from commit efb8f0b8db8747243f7999b874403d5c86e93b74)

2 years agocross-build: fix some redeclaration warnings during bootstrap
Alex Richardson [Mon, 13 Sep 2021 09:11:47 +0000 (10:11 +0100)]
cross-build: fix some redeclaration warnings during bootstrap

MFC after: 3 days

(cherry picked from commit a89410ef91798859f3fd7a5f675184b4d711ade4)

2 years agoAdd missing const after 6c4f95161d6e
Alex Richardson [Mon, 11 Oct 2021 12:20:36 +0000 (13:20 +0100)]
Add missing const after 6c4f95161d6e

I accidentally didn't include hunk in the committed patch.

Fixes: 6c4f95161d6e ("virtio: make the write_config buffer argument const")
(cherry picked from commit 9017870541daf46358c6cbaa3d4a40e1bffaaaa1)

2 years agovirtio: make the write_config buffer argument const
Alex Richardson [Mon, 11 Oct 2021 10:52:17 +0000 (11:52 +0100)]
virtio: make the write_config buffer argument const

No functional change intended, but noticed that we could add const here
while adding linuxkpi support for virtio.

Reviewed By: bryanv, imp
Differential Revision: https://reviews.freebsd.org/D32370

(cherry picked from commit 6c4f95161d6e38ba3fd50ca1cceee3110cbfa02e)

2 years agolinuxkpi: implement ida_alloc()
Alex Richardson [Fri, 8 Oct 2021 08:36:30 +0000 (09:36 +0100)]
linuxkpi: implement ida_alloc()

Needed for the virtio-gpu driver.

Reviewed By: #linuxkpi, manu, bz, hselasky
Differential Revision: https://reviews.freebsd.org/D32366

(cherry picked from commit d98f2712c7f5e4636afa65c8c3875bbb5ff981cf)

2 years agolinuxkpi: Allow BUILD_BUG_ON in if statements without braces
Alex Richardson [Fri, 8 Oct 2021 08:35:31 +0000 (09:35 +0100)]
linuxkpi: Allow BUILD_BUG_ON in if statements without braces

I got a compilation failure in virtio-gpu without this change.

Reviewed By: #linuxkpi, manu, bz, hselasky
Differential Revision: https://reviews.freebsd.org/D32366

(cherry picked from commit 6d15ccde4d9579ad2a77f93630695804a7efcbc4)

2 years agolinuxkpi: Add sg_init_one
Alex Richardson [Fri, 8 Oct 2021 08:32:46 +0000 (09:32 +0100)]
linuxkpi: Add sg_init_one

Needed for the virtio-gpu driver.

Reviewed By: #linuxkpi, manu, bz, hselasky
Differential Revision: https://reviews.freebsd.org/D32366

(cherry picked from commit 2686b10db41c79dd1a0a0c33a7e0c0b67e0701cc)

2 years agoAdd missing dep patterns for .pieo
Alex Richardson [Mon, 13 Sep 2021 12:22:07 +0000 (13:22 +0100)]
Add missing dep patterns for .pieo

While adding sanitizer support, I noticed that all other extensions were
handled but .pieo was missing.

Reviewed By: emaste, imp
MFC after: 1 week

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

(cherry picked from commit 2d78130185b5518e0bdb4a2f3c5d5ede6773312d)

2 years agoAdd a test for https://reviews.freebsd.org/D31858 (PR 258310)
Alex Richardson [Mon, 13 Sep 2021 09:16:05 +0000 (10:16 +0100)]
Add a test for https://reviews.freebsd.org/D31858 (PR 258310)

This test (based on https://github.com/jiixyj/epoll-shim/pull/32#issuecomment-891276654)
fails reproducibly on QEMU with KVM and `-smp 2` prior to D31858 (committed
as 98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0) and passes with the patch applied.

Reviewed By: kib, imp
Differential Revision: https://reviews.freebsd.org/D31862

(cherry picked from commit d7d962ead0b6e5e8a39202d0590022082bf5bfb6)

2 years agoExport _mmap and __sys_mmap from libc.so
Alex Richardson [Thu, 9 Sep 2021 10:46:53 +0000 (11:46 +0100)]
Export _mmap and __sys_mmap from libc.so

Unlike the other syscalls these two symbols were missing from the
version script. I noticed this while looking into the compiler-rt
runtime libraries for CHERI.

Reviewed by: brooks
Obtained from: https://github.com/CTSRD-CHERI/cheribsd/pull/1063
MFC after: 3 days

(cherry picked from commit 395db99f32bc615a3df2cd469e9537938d022c88)

2 years agoRemove stray .Pp from WITH_LOADER_EFI_SECUREBOOT description
Ed Maste [Mon, 2 May 2022 19:42:32 +0000 (15:42 -0400)]
Remove stray .Pp from WITH_LOADER_EFI_SECUREBOOT description

MFC after: 3 days
Fixes: 13ea0450a9c8 ("Extend libsecureboot(old libve) to...")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 729ee789117026e980487d0de19ce98ad064af1c)

2 years agoCorrect markup in WITH_/WITHOUT_UNIFIED_OBJDIR descriptions
Ed Maste [Sat, 30 Apr 2022 19:39:21 +0000 (15:39 -0400)]
Correct markup in WITH_/WITHOUT_UNIFIED_OBJDIR descriptions

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 60b08330a503b5a3380b5f68c2aa4c1c4f610a85)

2 years agoUpdate UNIFIED_OBJDIR descriptions
Ed Maste [Mon, 2 May 2022 17:53:30 +0000 (13:53 -0400)]
Update UNIFIED_OBJDIR descriptions

src.conf(5) previously stated they would be removed before FreeBSD 12.0,
but that did not happen.  Change it to "a future version of FreeBSD."

Also pick up LOADER_KBOOT change (enabled on x86) in src.conf regen.

Reported by: jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b7f53cdcf8d5025bf5bb04f60602e6f2bb4ae7ae)

2 years agoUpdate WITH_PROFILE description as it is yet removed
Ed Maste [Sat, 30 Apr 2022 19:25:35 +0000 (15:25 -0400)]
Update WITH_PROFILE description as it is yet removed

GCC still wants to link against (for example) libc_p.a when -pg is in
use, and it's unclear when and how this will be addressed.  Change the
WITH_PROFILE option description to claim that it may be removed from an
unspecified future version of FreeBSD, rather than FreeBSD 14.

Reported by: Steve Kargl
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f768ecf247b7acd98fd0ee395522e559769e3e51)

2 years agonfs: do not panic on bootpc_init when no interfaces are found
Alfredo Dal'Ava Junior [Thu, 7 Apr 2022 22:33:26 +0000 (19:33 -0300)]
nfs: do not panic on bootpc_init when no interfaces are found

Replaces panic with a warning message to allow kernel continue
when no bootp eligible network interfaces are found.

This avoids having to build a custom kernel when using a local root
file system on targets like powerpcspe that expects bootp/NFS by
default.

Reviewed by: rmacklem
MFC after: 2 weeks
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D34567

(cherry picked from commit 0b1b30d66450b20bf18fb4ab39bc6d4f5a6a28fe)

2 years agoclockcalib: Fix an overflow bug
Mark Johnston [Thu, 20 Jan 2022 13:23:38 +0000 (08:23 -0500)]
clockcalib: Fix an overflow bug

tc_counter_mask is an unsigned int and in the TSC timecounter is equal
to UINT_MAX, so the addition tc->tc_counter_mask + 1 can overflow to 0,
resulting in a hang during boot.

Fixes: c2705ceaeb09 ("x86: Speed up clock calibration")
Reviewed by: cperciva
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c3196306f092e46008d5ffa626fbafe1f8a94848)

2 years agosubr_unit.c: make userspace tests buildable
Konstantin Belousov [Thu, 28 Apr 2022 00:00:14 +0000 (03:00 +0300)]
subr_unit.c: make userspace tests buildable

(cherry picked from commit 6fe78ad434557a713ebf5159ac6ac4052ef3da1c)

2 years agounr(9): allow to avoid internal locking
Konstantin Belousov [Wed, 20 Apr 2022 22:14:37 +0000 (01:14 +0300)]
unr(9): allow to avoid internal locking

(cherry picked from commit e59b940dcb45b887974aeae8d8f86665aed2c913)

2 years agoinit_unrhdr(): make it usable by initializing everything
Konstantin Belousov [Wed, 20 Apr 2022 21:58:22 +0000 (00:58 +0300)]
init_unrhdr(): make it usable by initializing everything

(cherry picked from commit c4be460e84b48f2c76e27768ee8132a1d639ebc2)

2 years agoLinuxKPI: 802.11: fill in two more TODOs
Bjoern A. Zeeb [Sat, 30 Apr 2022 08:00:04 +0000 (08:00 +0000)]
LinuxKPI: 802.11: fill in two more TODOs

Implement ieee80211_is_data_present() and a subset of
ieee80211_is_bufferable_mmpdu() which hopefully is good enough in
the compat code for now.
This is partly in preparation for some TXQ changes coming up soon.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 00614c9c2ddc34f3f9061e87542efb4edbd936a9)

2 years agoLinuxKPI: 802.11: use ieee80211_beacon_miss()
Bjoern A. Zeeb [Sat, 30 Apr 2022 07:57:34 +0000 (07:57 +0000)]
LinuxKPI: 802.11: use ieee80211_beacon_miss()

In ieee80211_beacon_loss() call into net80211::ieee80211_beacon_miss()
rather than manually bouncing our state.  That should give us the
ability to send a probereq and see if the AP is till there rather than
right away going to scan.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 3540911bfdd83ce69d1c436f6773becefef403fa)

2 years agoLinuxKPI: 802.11 ieee80211_sn_sub() fix
Bjoern A. Zeeb [Mon, 25 Apr 2022 11:35:57 +0000 (11:35 +0000)]
LinuxKPI: 802.11 ieee80211_sn_sub() fix

In ieee80211_sn_sub() we need to shift the mask before applying it.
This fixes the logic from 978f25e840fe4975f243e6077a764842f0e9d3eb.

Reported by: J.R. Oldroyd (fbsd opal.com)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b3e7f403a509c1e643ef14d95562f5d7e329d77e)

2 years agolibpfctl: grow request buffer on ENOSPC
Kristof Provost [Thu, 14 Apr 2022 12:08:53 +0000 (14:08 +0200)]
libpfctl: grow request buffer on ENOSPC

When we issue a request to pf and expect a serialised nvlist as a reply
we have to supply a suitable buffer to the kernel.
The required size for this buffer is difficult to predict, and may be
(slightly) different from request to request.
If it's insufficient the kernel will return ENOSPC. Teach libpfctl to
catch this and send the request again with a larger buffer.

MFC after: 2 weeks
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34908

(cherry picked from commit 7ed19f5c7780ebe9ec67121f0c5aa19fbc80bf1a)

2 years agopfctl: fix recursive printing of rules
Matteo Riondato [Wed, 13 Apr 2022 07:38:44 +0000 (09:38 +0200)]
pfctl: fix recursive printing of rules

When asked to print rules recursively, correctly recurse for anchors
included in pf.conf with "anchorname/*".

PR: 262590
Reviewed by: kp
MFC after: 3 weeks

(cherry picked from commit d86cf4435021d0abf3f3d65039583ee8cfde1be1)

2 years agoCAM: Keep periph_links when restoring CCB in camperiphdone().
Alexander Motin [Thu, 28 Apr 2022 01:39:50 +0000 (21:39 -0400)]
CAM: Keep periph_links when restoring CCB in camperiphdone().

While recovery command executed, some other commands from the periph
may complete, that may affect periph_links of this CCB.  So restoring
original CCB we must keep current periph_links as more up to date.

I've found this triggering assertions with debug kernel and suspect
some memory corruptions otherwise when spun down disk receives two
or sometimes more concurrent requests.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

(cherry picked from commit 404f001161b975164d8b52d9f404d07ac7584027)

2 years agoOpenSSL: Merge OpenSSL 1.1.1o
Jung-uk Kim [Tue, 3 May 2022 19:12:42 +0000 (15:12 -0400)]
OpenSSL: Merge OpenSSL 1.1.1o

(cherry picked from commit 9a3583bfbd1740a158b3916432286190e0f2bf60)

2 years agoOpenSSL: Merge OpenSSL 1.1.1o
Jung-uk Kim [Tue, 3 May 2022 19:07:06 +0000 (15:07 -0400)]
OpenSSL: Merge OpenSSL 1.1.1o

(cherry picked from commit 34252e89a96c8d498d7537ade16d20602bf2106a)

2 years agoxhci(4): Always add and evaluate the slot context.
Hans Petter Selasky [Tue, 3 May 2022 16:10:49 +0000 (18:10 +0200)]
xhci(4): Always add and evaluate the slot context.

Because the maximum number of endpoint contexts is stored there.

Tested by: ehaupt@
PR: 262882
Approved by: re (gjb, early MFC)
Sponsored by: NVIDIA Networking

(cherry picked from commit 09dd1adfa4c9bb1b49f4ef5524a308732883e132)

2 years agoxhci(4): Only drop BULK and INTERRUPT endpoints to reset data toggle.
Hans Petter Selasky [Tue, 3 May 2022 16:09:17 +0000 (18:09 +0200)]
xhci(4): Only drop BULK and INTERRUPT endpoints to reset data toggle.

Only drop BULK and INTERRUPT endpoints, to reset the data toggle,
because for other endpoint types this is not critical.

While at it fix some whitespace.

Tested by: ehaupt@
PR: 262882
Approved by: re (gjb, early MFC)
Sponsored by: NVIDIA Networking

(cherry picked from commit e276d281503160ba3648bd394cde95736ee53329)

2 years agoteken: color #3 is yellow not brown - use TC_YELLOW as the name
Ed Maste [Fri, 11 Mar 2022 21:37:03 +0000 (16:37 -0500)]
teken: color #3 is yellow not brown - use TC_YELLOW as the name

The console escape code standard (ECMA-48) specifies color #3 (escape
code 33) as yellow.  A brown console color is an artifact of the VGA
palette, which replaces dim (but not bright) yellow with brown.

Reviewed by: adrian, imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34531

(cherry picked from commit cf8880d52b8962edeb807a8ee1811d342fafa26d)

2 years agontp: disable format string warnings in libopts
Ed Maste [Sun, 27 Feb 2022 19:21:12 +0000 (14:21 -0500)]
ntp: disable format string warnings in libopts

libopts uses generated format string tables that contain embedded NULs.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34386

(cherry picked from commit 1ffe6d7909109e22d5dbd9369b00900b00b1169b)

2 years agoAdd a number of five letter words to the dictionary
Ed Maste [Wed, 16 Feb 2022 13:47:33 +0000 (08:47 -0500)]
Add a number of five letter words to the dictionary

(And a four letter root of one of them.)

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D34299

(cherry picked from commit e49b6ead4114c6c3963111362e7314b9dd73d6ee)

2 years agokcov: use __func__ in KASSERT instead of old function name
Ed Maste [Mon, 7 Mar 2022 14:48:38 +0000 (09:48 -0500)]
kcov: use __func__ in KASSERT instead of old function name

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 080b4e8a0cfce3579a660669967d200064822ca1)

2 years agoClean up warnings in pthread tests
Ed Maste [Wed, 16 Feb 2022 21:10:45 +0000 (16:10 -0500)]
Clean up warnings in pthread tests

I intend to move these into lib/libthr/tests/ and connect to kyua.  This
is a first step to address warnings emitted when building using standard
make infrastructure.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34306

(cherry picked from commit ef135466f81bc3f203efa77d1eb81132f7646196)
(cherry picked from commit 7bfe5e45153b3d214cdb09ced8fccdef02337369)

2 years agoDisable subr_physmem_test on mips
Andrew Turner [Tue, 3 May 2022 15:47:33 +0000 (16:47 +0100)]
Disable subr_physmem_test on mips

It doesn't build.

Direct commit as mips doesn't exist in 14.

Sponsored by: The FreeBSD Foundation

2 years agoOnly return a mapped address from efi_phys_to_kva
Andrew Turner [Sat, 9 Apr 2022 11:43:08 +0000 (12:43 +0100)]
Only return a mapped address from efi_phys_to_kva

On some hardware the EFI system table is not in memory mapped in the
DMAP section. Rather than panic the kernel check if it is mapped and
return a failure if not from efi_phys_to_kva.

Reported by: kevans
Differential Revision: https://reviews.freebsd.org/D34858

(cherry picked from commit f3ef799f564515b58a24a328739a4c749a02b110)

2 years agoInclude the EFI Runtime Code in the DMAP
Andrew Turner [Sat, 9 Apr 2022 20:17:43 +0000 (21:17 +0100)]
Include the EFI Runtime Code in the DMAP

Some UEFI implementations place the system table in a runtime code
memory region. Include it in the DMAP so we can read it later.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D34861

(cherry picked from commit 57e47ae514b6ab605298b4595e0219048f59ab7a)

2 years agoHave stpncpy tests ask the kernel for the page size
Andrew Turner [Thu, 7 Apr 2022 15:05:57 +0000 (16:05 +0100)]
Have stpncpy tests ask the kernel for the page size

It may be dynamic so we can't rely on PAGE_SIZE being present or
correct.

(cherry picked from commit 748f7c8db756361f3ba43623612fcfd13cece268)

2 years agoHave path_test ask the kernel for the page size
Andrew Turner [Thu, 7 Apr 2022 14:59:38 +0000 (15:59 +0100)]
Have path_test ask the kernel for the page size

It may be dynamic so we can't rely on PAGE_SIZE being present or
correct.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8d40ee599d130a7dcf57eba448d3966a7ce30638)

2 years agoHave the coredump_phnum test ask for the page size
Andrew Turner [Thu, 7 Apr 2022 14:59:32 +0000 (15:59 +0100)]
Have the coredump_phnum test ask for the page size

The page size may be dynamically selected on boot. Have the
coredump_phnum test helper ask the kernel for the correct value.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit df696a2fb640aee06b38ff487985209f97b944aa)

2 years agoHave rtld query the page size from the kernel
Andrew Turner [Mon, 4 Apr 2022 15:05:40 +0000 (16:05 +0100)]
Have rtld query the page size from the kernel

To allow for a dynamic page size on arm64 have the runtime linker
query the kernel for the currentl page size.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34765

(cherry picked from commit e85eaa930862d5b4dc917bc31e8d7254a693635d)

2 years agoHandle non-page aligned/sized memory in physmem
Andrew Turner [Mon, 28 Mar 2022 11:37:09 +0000 (12:37 +0100)]
Handle non-page aligned/sized memory in physmem

In some configurations the firmware may pass memory regions that are
not page sized or aligned, e.g. when using 16k pages on arm64. If this
is the case we will calculate many small regions because the alignment
is applied before being inserted. As we round the start up and end down
this will leave a 1 page hole between what should have been a single
region.

Fix by keeping the original alignment until we are just about to insert
the region into the avail array.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34694

(cherry picked from commit d8bff5b67c9b6a85f409a7408e45e7e87d39c5a2)

2 years agoPort subr_physmem to userspace and add tests
Andrew Turner [Mon, 28 Mar 2022 10:20:29 +0000 (11:20 +0100)]
Port subr_physmem to userspace and add tests

These give us some confidience we haven't broken anything in early
boot code that may be running before the console.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34691

(cherry picked from commit 8c99dfed541263bd51cae943684bcc13768c2a36)

Disable the physmem test for now

It fails to build on at least i386

(cherry picked from commit d8819d88af529974bac1fe49b713dacf1f3d7239)

Enable subr_physmem_test on supported architectures

Only build where it's supported.

While here add support for amd64 to help with testing.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 41e6d2091ce5653d4ace3f0b9cbde1375d458c67)

2 years agoFix a coherent bus check in the arm64 busdma
Andrew Turner [Mon, 4 Apr 2022 09:28:59 +0000 (10:28 +0100)]
Fix a coherent bus check in the arm64 busdma

In the arm64 busdma we have an internal flag to signal when a tag is
for a cache-coherent device. In this case we don't need to adjust the
size and alignment of allocated buffers to be within a cache line.

The cache line adjustment was incorrectly using the coherent flag
passed in to bus_dma_tag_create and not the internal flag. Fix it to
use the latter to reduce the memory usage slightly.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34763

(cherry picked from commit 3532bcd282b3ba508f0b39560626983463512813)

2 years agolibarchive: import changes from upstream
Martin Matuska [Tue, 12 Apr 2022 18:12:34 +0000 (20:12 +0200)]
libarchive: import changes from upstream

Libarchive 3.6.1

Bug fixes:
  PR #1549: archive_digest: check return value of EVP_DigestInit()

(cherry picked from commit 7ec51a3e2b91caaea5c1de1a4c7b362b20d35a62)

2 years agosched_getaffinity(3): more compatibility with Linux
Konstantin Belousov [Sun, 24 Apr 2022 22:10:18 +0000 (01:10 +0300)]
sched_getaffinity(3): more compatibility with Linux

(cherry picked from commit 67fc95025ccfc696ea5eaea0ecb1fff295760723)

2 years agofwcontrol: eliminate set but not used warning
Ed Maste [Sun, 27 Feb 2022 19:04:09 +0000 (14:04 -0500)]
fwcontrol: eliminate set but not used warning

The variable was used in an #if 0 block; just move the variable
definition and setting into the same block since Firewire is mainly of
historical interest and is unlikely to see ongoing development in
FreeBSD.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2d015cffc73ab1ff0e8be9004ab89ecbc777af78)

2 years agossh: remove 11.x from FREEBSD-upgrade instructions
Ed Maste [Wed, 23 Feb 2022 18:34:39 +0000 (13:34 -0500)]
ssh: remove 11.x from FREEBSD-upgrade instructions

11.x is no longer supported.

(cherry picked from commit 2e6ec1e4fe0bd55698187d31352c79f18da2a505)

2 years agoman3: Add links for some bitstring(3) routines
Mark Johnston [Mon, 25 Apr 2022 13:08:19 +0000 (09:08 -0400)]
man3: Add links for some bitstring(3) routines

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 15a28c00203d38e703e2781be5869051a33535e2)

2 years agossh: use upstream SSH_OPENSSL_VERSION macro
Ed Maste [Sat, 23 Apr 2022 19:52:03 +0000 (15:52 -0400)]
ssh: use upstream SSH_OPENSSL_VERSION macro

With the upgrade to OpenSSH 6.7p1 in commit a0ee8cc636cd we replaced
WITH_OPENSSL ifdefs with an OPENSSL_VERSION macro, later changing it
to OPENSSL_VERSION_STRING.

A few years later OpenSSH made an equivalent change (with a different
macro name), in commit 4d94b031ff88.  Switch to the macro name they
chose.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6e24fe61287b02600be19042a6f6ce939aabfaa6)

2 years agolacp: short timeout erroneously declares link-flapping
Greg Foster [Tue, 26 Apr 2022 06:38:23 +0000 (23:38 -0700)]
lacp: short timeout erroneously declares link-flapping

Panasas was seeing a higher-than-expected number of link-flap events.
After joint debugging with the switch vendor, we determined there were
problems on both sides; either of which might cause the occasional
event, but together caused lots of them.

On the switch side, an internal queuing issue was causing LACP PDUs --
which should be sent every second, in short-timeout mode -- to sometimes
be sent slightly later than they should have been. In some cases, two
successive PDUs were late, but we never saw three late PDUs in a row.

On the FreeBSD side, we saw a link-flap event every time there were two
late PDUs, while the spec says that it takes *three* seconds of downtime
to trigger that event. It turns out that if a PDU was received shortly
before the timer code was run, it would decrement less than a full
second after the PDU arrived. Then two delayed PDUs would cause two
additional decrements, causing it to reach zero less than three seconds
after the most-recent on-time PDU.

The solution is to note the time a PDU arrives, and only decrement if at
least a full second has elapsed since then.

Reported by: Greg Foster <gfoster@panasas.com>
Reviewed by: gallatin
Tested by: Greg Foster <gfoster@panasas.com>
MFC after: 3 days
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D35070

(cherry picked from commit 00a80538b4471b2978c5a1990f48189f2c692e24)

2 years agoCAM: Replicate e0ceec676dc8 from da to ada and nda.
Alexander Motin [Sun, 24 Apr 2022 00:14:10 +0000 (20:14 -0400)]
CAM: Replicate e0ceec676dc8 from da to ada and nda.

MFC after: 1 week

(cherry picked from commit 38f8addaab1aac0830948189826bd7c7931859fd)

2 years agopowerpc: enable wlan and ath modules in GENERIC64*
Piotr Kubaj [Thu, 28 Apr 2022 00:05:56 +0000 (02:05 +0200)]
powerpc: enable wlan and ath modules in GENERIC64*

Reviewed by: jhibbits (src)
Differential Revision: https://reviews.freebsd.org/D35089

(cherry picked from commit 25768526bbedf2ae8ba35001d53c4a5eb09c36d8)

2 years agouudecode: correct error message
Piotr Pawel Stefaniak [Mon, 8 Nov 2021 14:31:03 +0000 (15:31 +0100)]
uudecode: correct error message

PR: 153276
Reported by: David Brennan

(cherry picked from commit 9f3203c003144a4ef6309435036f985afe549ff0)

uudecode: add missing test files to Makefile

(cherry picked from commit 1b3af110bcd522a077f01350b6a51b3ffe434393)

uudecode: use SRCDIR in the regression test

(cherry picked from commit f5138631fb6f9dc73d696560caa006f3df714b9a)

uudecode: move the new uudecode test from uuencode/ to uudecode/

I don't know how that happened.

(cherry picked from commit ae6aa2d43daa6276dd18dc974a1c5b7c15264615)

2 years agouu{encode,decode}: improve style
Piotr Pawel Stefaniak [Mon, 8 Nov 2021 14:31:01 +0000 (15:31 +0100)]
uu{encode,decode}: improve style

(cherry picked from commit d5d3f5dab209a4643dd189b2012b60329c220662)

2 years agosh: implement persistent history storage
Baptiste Daroussin [Tue, 30 Mar 2021 08:28:08 +0000 (10:28 +0200)]
sh: implement persistent history storage

Implement persistent history storage:
the strategy is simple at start: loads the existing .sh_history file
at exit dump it.

The implementation respects the HISTFILE variable and its POSIX
definition: ~/.sh_history is used if HISTFILE is not set.

to avoid sh to create the history file, set HISTSIZE to 0 or HISTFILE to
en empty value

(cherry picked from commit 988b1bb0c54e50654112f0bd649aee68307a5a80)

sh: try to avoid overwriting HISTFILE produced by other shells

If an attempt to load history from an existing history file was
unsuccessful, do not try to save command history to that file on exit.

(cherry picked from commit 1f82fb3834105fd8f1186b1c6d719d8a24738180)

2 years agolibfetch: remove a set-but-not-used variable
Stefan Eßer [Wed, 20 Apr 2022 14:56:57 +0000 (16:56 +0200)]
libfetch: remove a set-but-not-used variable

(cherry picked from commit ce700f78f7fb28a252978382a1d0a66d08b6469a)

2 years agocxgbe tom: Compile fix for disabled KTR trace.
John Baldwin [Tue, 8 Mar 2022 22:07:51 +0000 (14:07 -0800)]
cxgbe tom: Compile fix for disabled KTR trace.

Sponsored by: Chelsio Communications

(cherry picked from commit bca6e339ac15fd04792be93422ac5638a2531ff6)

2 years agocxgbe tom: Use VM_PAGE_TO_PHYS().
John Baldwin [Tue, 8 Mar 2022 18:10:59 +0000 (10:10 -0800)]
cxgbe tom: Use VM_PAGE_TO_PHYS().

Sponsored by: Chelsio Communications

(cherry picked from commit 87b0e7711f2552ff6ad575deb546124d8b5ae5d8)

2 years agocxgbe tom: Use be64toh instead of htobe64 to convert to host order.
John Baldwin [Tue, 8 Mar 2022 18:26:45 +0000 (10:26 -0800)]
cxgbe tom: Use be64toh instead of htobe64 to convert to host order.

This is a no-op but more accurately conveys intent.

Sponsored by: Chelsio Communications

(cherry picked from commit 44e7472d0ededdcee787bb08f301af234c732ff3)

2 years agocxgbe tom: Use vm_paddr_t for physical addresses in page pod routines.
John Baldwin [Tue, 8 Mar 2022 18:25:41 +0000 (10:25 -0800)]
cxgbe tom: Use vm_paddr_t for physical addresses in page pod routines.

Sponsored by: Chelsio Communications

(cherry picked from commit de414339c9826d0a560fd4faafdba74756803f35)

2 years agocxgbe: Move page pods KTR traces under VERBOSE_TRACES.
John Baldwin [Wed, 2 Mar 2022 23:32:21 +0000 (15:32 -0800)]
cxgbe: Move page pods KTR traces under VERBOSE_TRACES.

(cherry picked from commit 2753997438ae16e520a55fd2381aef3e2f35746e)

2 years agoctl ramdisk: Free compare buffer after a compare I/O request.
John Baldwin [Fri, 18 Feb 2022 23:20:14 +0000 (15:20 -0800)]
ctl ramdisk: Free compare buffer after a compare I/O request.

For a compare request, the ramdisk backend allocates a temporary
buffer to hold the I/O data and then compares it against the LUN's
pages in ctl_backend_ramdisk_cmp after the data has been filled.
However, the tempory buffer was leaked when after the comparison was
complete.  Fix this by freeing the buffer after the comparison.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34316

(cherry picked from commit bd6e8729d6f6d42102b0359b56b7e3c89edd0ec9)

2 years agocxgbei: Replace worker thread pools with per-connection kthreads.
John Baldwin [Tue, 8 Feb 2022 00:20:40 +0000 (16:20 -0800)]
cxgbei: Replace worker thread pools with per-connection kthreads.

Having a single pool of worker threads adds extra complexity and
overhead.  The software backend also uses per-connection kthreads.

Sponsored by: Chelsio Communications

(cherry picked from commit 511b83b167b02608a1f857fa2e0cc5fb3218e09d)

2 years agocxgbei: Dispatch sent PDUs to the NIC asynchronously.
John Baldwin [Tue, 8 Feb 2022 00:20:06 +0000 (16:20 -0800)]
cxgbei: Dispatch sent PDUs to the NIC asynchronously.

Previously the driver was called to send PDUs to the NIC synchronously
from the icl_conn_pdu_queue_cb callback.  However, this performed a
fair bit of work while holding the icl connection lock.  Instead,
change the callback to add sent PDUs to a STAILQ and defer dispatching
of PDUs to the NIC to a helper thread similar to the scheme used in
the TCP iSCSI backend.

- Replace rx_flags int and the sole RXF_ACTIVE flag with a simple
  rx_active bool.

- Add a pool of transmit worker threads for cxgbei.

- Fix worker thread exit to depend on the wakeup in kthread_exit()
  to fix a race with module unload.

Reported by: mav
Sponsored by: Chelsio Communications

(cherry picked from commit fd8f61d6e970fa443d393d330ae70c54c9a523a4)

2 years agoExtend the VMM stats interface to support a dynamic count of statistics.
John Baldwin [Mon, 7 Feb 2022 22:11:10 +0000 (14:11 -0800)]
Extend the VMM stats interface to support a dynamic count of statistics.

- Add a starting index to 'struct vmstats' and change the
  VM_STATS ioctl to fetch the 64 stats starting at that index.
  A compat shim for <= 13 continues to fetch only the first 64
  stats.

- Extend vm_get_stats() in libvmmapi to use a loop and a static
  thread local buffer which grows to hold the stats needed.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D27463

(cherry picked from commit 64269786170ffd8e3348edea0fc5f5b09b79391e)

2 years agocfiscsi_done: Free the dummy PDU earlier.
John Baldwin [Mon, 7 Feb 2022 20:55:08 +0000 (12:55 -0800)]
cfiscsi_done: Free the dummy PDU earlier.

The dummy PDU needs to be freed before marking task abortion complete
as otherwise cfiscsi_session_terminate_tasks can return and destroy
the session in another thread before the PDU is freed.

Fixes: 2e8d1a55258d iscsi: Allocate a dummy PDU for the internal nexus reset task.
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34176

(cherry picked from commit a3d71fffa78619fb394b8bb595d2ef680bd0e43a)

2 years agobsd.compat.mk: A few cosmetic fixes.
John Baldwin [Fri, 4 Feb 2022 23:57:28 +0000 (15:57 -0800)]
bsd.compat.mk: A few cosmetic fixes.

- Add a missing ')' to a warning.

- Consistently use {} when expanding variables.

- Remove a spurious blank line.

Reviewed by: imp, emaste
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D34172

(cherry picked from commit ffe74ab77f234fabe691bd79e254cd000e07dfe0)

2 years agocxgbei: Rework parsing of pre-offload PDUs.
John Baldwin [Fri, 4 Feb 2022 23:38:49 +0000 (15:38 -0800)]
cxgbei: Rework parsing of pre-offload PDUs.

sbcut() returns mbufs in reverse order so is not suitable for reading
data from the socket buffer.  Instead, check for already-received data
in the receive worker thread before passing offload PDUs up to the
iSCSI layer.  This uses soreceive() to read data from the socket and
is also to use M_WAITOK since it now runs from a worker thread instead
of an interrupt thread.

Also, fix decoding of the data segment length for pre-offload PDUs.

Reported by: Jithesh Arakkan @ Chelsio
Fixes: a8c4147edcdc cxgbei: Parse all PDUs received prior to enabling offload mode.
Sponsored by: Chelsio Communications

(cherry picked from commit 74fea8eb4fee65163fa745d0dbfcefc138ff7925)

2 years agoiscsi: Allocate a dummy PDU for the internal nexus reset task.
John Baldwin [Fri, 28 Jan 2022 21:07:04 +0000 (13:07 -0800)]
iscsi: Allocate a dummy PDU for the internal nexus reset task.

When an iSCSI target session is terminated, an internal nexus reset
task is posted to abort existing tasks belonging to the session.
Previously, the ctl_io for this internal nexus reset stored a pointer
to the session in the slot that normally holds a pointer to the PDU
from the initiator that triggered the I/O request.  The completion
handler then assumed that any nexus reset I/O was due to an internal
request and fetched the session pointer (instead of the PDU pointer)
from the ctl_io.  However, it is possible to trigger a nexus reset via
an on-the-wire task management PDU.  If such a PDU were sent to the
target, then the completion handler would incorrectly treat this
request as an internal request and treat the pointer to the received
PDU as a pointer to the session instead.

To fix, allocate a dummy PDU for the internal reset task and use an
invalid opcode to differentiate internal nexus resets from resets
requested by the initiator.

PR: 260449
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34055

(cherry picked from commit 2e8d1a55258d39f7315fa4f2164c0fce96e79802)

2 years agolibthr: Use TLS_TCB_* in _tcb_[cd]tor.
John Baldwin [Tue, 25 Jan 2022 19:38:34 +0000 (11:38 -0800)]
libthr: Use TLS_TCB_* in _tcb_[cd]tor.

This matches libc and rtld in using the alignment (TLS_TCB_ALIGN) from
machine/tls.h instead of hardcoding 16.

Reviewed by: kib
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D34023

(cherry picked from commit 8de1a8131e42f96f8dcfbca9073896d249ff7d2c)

2 years agocxgbei: Parse all PDUs received prior to enabling offload mode.
John Baldwin [Sat, 22 Jan 2022 01:02:16 +0000 (17:02 -0800)]
cxgbei: Parse all PDUs received prior to enabling offload mode.

Previously this would only handle a single PDU that did not contain
any data.  This should now handle an arbitrary number of PDUs.

While here check for these PDUs in the T6-specific CPL_RX_ISCSI_CMP
handler in addition to CPL_RX_ISCSI_DDP.

Reported by: Jithesh Arakkan @ Chelsio
Sponsored by: Chelsio Communications

(cherry picked from commit a8c4147edcdce934f93dd848c6ed083500dff22c)

2 years agofreebsd32: Fix layout of struct shmid_kernel32.
John Baldwin [Tue, 18 Jan 2022 18:42:21 +0000 (10:42 -0800)]
freebsd32: Fix layout of struct shmid_kernel32.

The kernel pointers in this structure need to be 32-bit pointers,
not native pointers to 32-bit integers.

Reviewed by: kib
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33905

(cherry picked from commit da7fc5c33f9a4c906068a9a43f43f8d295100418)