]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agogetdirentries.2: fix for NFS mounts
Rick Macklem [Mon, 15 Feb 2021 02:16:58 +0000 (18:16 -0800)]
getdirentries.2: fix for NFS mounts

It was reported that getdirentries(2) was
returning dirents with d_off set to 0 for an NFS
mount.

This is believed to be correct behaviour at
this time (it may change for some NFS mounts
in the future), but is inconsistent with what the
getdirentries(2) man page says.

This patch fixes the man page.

This is a content change.

PR: 253428

(cherry picked from commit a0698341cd894ba4a640e9a9bb0f72c2133d1228)

3 years agoloader: autoload_font will hung loader when there is no local console
Toomas Soome [Sun, 21 Feb 2021 10:32:18 +0000 (12:32 +0200)]
loader: autoload_font will hung loader when there is no local console

If we start with console set to comconsole, the local
console (vidconsole, efi) is never initialized and attempt to
use the data can render the loader hung.

(cherry picked from commit 61c50cbc096d28e44cb8b627e524ae58158c423a)

Reported by: Kamigishi Rei

3 years agoInclude new data sent in PRR calculation
Richard Scheffenegger [Fri, 26 Feb 2021 21:30:33 +0000 (22:30 +0100)]
Include new data sent in PRR calculation

Reviewed By: #transport, kbowling
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28941

(cherry picked from commit 9e83a6a556ed8d9a2821de5d5f5c7d4b1292c694)

3 years agom_uiotombuf_nomap(): Stop clearing PG_ZERO in newly allocated pages
Mark Johnston [Mon, 22 Feb 2021 15:03:37 +0000 (10:03 -0500)]
m_uiotombuf_nomap(): Stop clearing PG_ZERO in newly allocated pages

The caller should not be passing M_ZERO in the first place, so PG_ZERO
will not be preserved by the page allocator and clearing it accomplishes
nothing.

Reviewed by: gallatin, jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28808

(cherry picked from commit 608c44f96e88f28f9607374a6c9327d13d3d3d0e)

3 years agouma: Update the comment above startup_alloc() to reflect reality
Mark Johnston [Mon, 22 Feb 2021 23:21:49 +0000 (18:21 -0500)]
uma: Update the comment above startup_alloc() to reflect reality

The scheme used for early slab allocations changed in commit a81c400e75.

Reported by: alc
Reviewed by: alc

(cherry picked from commit 537f92cd351090c09b178a1749cd1d0326f74dc7)

3 years agopmap: Fix largemap restart checks in the kernel_maps sysctl handler
Mark Johnston [Thu, 25 Feb 2021 23:49:47 +0000 (18:49 -0500)]
pmap: Fix largemap restart checks in the kernel_maps sysctl handler

The purpose of these checks is to ensure that the address of the
next-level page table page is valid, since nothing is synchronizing with
a concurrent update of the large map and large map PTPs are freed to the
system.  However, if PG_PS is set, there is no next level.

Reported by: rpokala
Reviewed by: kib
Tested by: rpokala
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28922

(cherry picked from commit aac25e222525780db8939d07a594d3e090c0a148)

3 years agopf: Fix incorrect fragment handling
Kristof Provost [Thu, 25 Feb 2021 07:07:36 +0000 (08:07 +0100)]
pf: Fix incorrect fragment handling

A sequence of overlapping IPv4 fragments could crash the kernel in
pf due to an assertion.

Reported by: Alexander Bluhm
Obtained from: OpenBSD
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5f1b1f184b7f12330cf4a027e3db7c6700c67640)

3 years agoTCP_NOOPT may prevent the negotiation of TCP features, which a server
Richard Scheffenegger [Thu, 25 Feb 2021 18:10:55 +0000 (19:10 +0100)]
TCP_NOOPT may prevent the negotiation of TCP features, which a server
has to take into consideration.

PR: 253576
Reviewed By: tuexen, #transport
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28652

(cherry picked from commit 2593f858d7d078efa85f78f20b6bfa0931cc1dc5)

3 years agoPRR: Avoid accounting left-edge twice in partial ACK.
Richard Scheffenegger [Thu, 25 Feb 2021 17:36:49 +0000 (18:36 +0100)]
PRR: Avoid accounting left-edge twice in partial ACK.

Reviewed By: #transport, kbowling
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28819

(cherry picked from commit 31d7a27c6e88c3d5bd0907774ec70176a92da5bb)

3 years agoAddress two incorrect calculations and enhance readability of PRR code
Richard Scheffenegger [Thu, 25 Feb 2021 16:59:45 +0000 (17:59 +0100)]
Address two incorrect calculations and enhance readability of PRR code

- address second instance of cwnd potentially becoming zero
- fix sublte bug due to implicit int to uint typecase in max()
- fix bug due to typo in hand-coded CEILING() function by using howmany() macro
- use int instead of long, and add a missing long typecast
- replace if conditionals with easier to read imax/imin (as in pseudocode)

Reviewed By: #transport, kbowling
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28813

(cherry picked from commit 48396dc77922c68377ecac0ead2f8b0b5453c451)

3 years agoPRR: use accurate rfc6675_pipe when enabled
Richard Scheffenegger [Sat, 20 Feb 2021 19:10:00 +0000 (20:10 +0100)]
PRR: use accurate rfc6675_pipe when enabled

Reviewed By: #transport, tuexen
MFC after:   1 week
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28816

(cherry picked from commit a8e431e1537d056a3f9e466eaceec28c399c220b)

3 years agoDelete dead CLUSTERDEBUG config option.
Konstantin Belousov [Thu, 18 Feb 2021 09:12:26 +0000 (11:12 +0200)]
Delete dead CLUSTERDEBUG config option.

(cherry picked from commit 750ea20d3fb143a95ccf3ff84cfbe86cce9b9cac)

3 years agoiflib: Avoid double counting in rxeof
Mark Johnston [Wed, 24 Feb 2021 15:08:53 +0000 (10:08 -0500)]
iflib: Avoid double counting in rxeof

iflib_rxeof() was counting everything twice.  This was introduced when
pfil hooks were added to the iflib receive path.  We want to count rx
packets/bytes before the pfil hooks are executed, so remove the counter
adjustments that are executed after.

PR: 253583
Reviewed by: gallatin, erj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28900

(cherry picked from commit b6999635b195e8c0dd5c08ac9ff268c92107cc66)

3 years agonetgraph/ng_car: Add color marking code
Lutz Donnerhacke [Wed, 27 Jan 2021 20:19:14 +0000 (21:19 +0100)]
netgraph/ng_car: Add color marking code

Chained policing should be able to reuse the classification of
traffic.  A new mbuf_tag type is defined to handle gereral QoS
marking.  A new subtype is defined to track the color marking.

Reviewed by: manpages (bcr), melifaro, kp
Sponsored by: IKS Service GmbH
Differential Revision: https://reviews.freebsd.org/D22110

(cherry picked from commit d0d2e523bafb74180f8bebb90788790f0d2f0290)

3 years agoEnsure cwnd doesn't shrink to zero with PRR
Richard Scheffenegger [Fri, 19 Feb 2021 12:52:06 +0000 (13:52 +0100)]
Ensure cwnd doesn't shrink to zero with PRR

Under some circumstances, PRR may end up with a fully
collapsed cwnd when finalizing the loss recovery.

Reviewed By: #transport, kbowling
Reported by: Liang Tian
MFC after: 5 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28780

(cherry picked from commit 853fd7a2e39802e46bd3d6476529796ac22412d9)

3 years agoOpenSSL: Regen manual page for the previous commit
Jung-uk Kim [Wed, 17 Feb 2021 23:19:13 +0000 (18:19 -0500)]
OpenSSL: Regen manual page for the previous commit

This is regen for 9b2f020c14af71a2606012143432dd717c7cf90e.

MFC after: 1 week

(cherry picked from commit 351d06eeb509a420f3470c96b4a265467c87e2c2)

3 years agoHandle partial data re-sending on ktls/sendfile on FreeBSD
Oleksandr Tymoshenko [Wed, 17 Feb 2021 22:49:30 +0000 (14:49 -0800)]
Handle partial data re-sending on ktls/sendfile on FreeBSD

Add a handler for EBUSY sendfile error in addition to
EAGAIN. With EBUSY returned the data still can be partially
sent and user code has to be notified about it, otherwise it
may try to send data multiple times.

PR: 251969
Obtained from: OpenSSL (dfcfd17f2818cf520ce6381aed9ec3d2fc12170d)
Sponsored by: Netflix (merging to FreeBSD)

(cherry picked from commit 9b2f020c14af71a2606012143432dd717c7cf90e)

3 years agoFix crash with rtadv-originated multipath IPv6 routes.
Alexander V. Chernikov [Wed, 24 Feb 2021 16:42:48 +0000 (16:42 +0000)]
Fix crash with rtadv-originated multipath IPv6 routes.

PR: 253800
Reported by: Frederic Denis <freebsdml at hecian.net>
MFC after: immediately

(cherry picked from commit cc3fa1e29fda2cc761e793a61cef3bd2522b3468)

3 years agoReimplemen FreeBSD/arm64 dtrace_gethrtime() to use the system timer.
Robert Watson [Tue, 16 Feb 2021 15:19:05 +0000 (15:19 +0000)]
Reimplemen FreeBSD/arm64 dtrace_gethrtime() to use the system timer.
dtrace_gethrtime() is the high-resolution nanosecond timestemp used
for the DTrace 'timestamp' built-in variable.  The new implementation
uses the EL0 cycle counter and frequency registers in ARMv8-A.  This
replaces a previous implementation that relied on an
instrumentation-safe implementation of getnanotime(), which provided
only timer resolution.

Approved by: re (gjb)
Reviewed by: andrew, bsdimp (older version)
Useful comments appreciated: jrtc27, emaste
Differential Revision: https://reviews.freebsd.org/D28723

3 years agoautomount(8): fix absolute path when creating a mountpoint
Robert Wing [Wed, 17 Feb 2021 09:22:23 +0000 (00:22 -0900)]
automount(8): fix absolute path when creating a mountpoint

When executing automount(8), it will attempt to create the directory where an
autofs filesystem is to be mounted. Explicity set the root path for this
directory to "/".

This fixes the issue where the directory being created was being treated as a
relative path instead of an absolute path (as expected).

PR:     224601
Reported by:    kusumi.tomohiro@gmail.com
Reviewed by:    trasz
Differential Revision:  https://reviews.freebsd.org/D27832

(cherry picked from commit 63640b2f552c0476f50484635eb9888eafcd22dc)

3 years agoarm64: Include NUMA locality info in the CPU topology
Mark Johnston [Thu, 18 Feb 2021 15:50:57 +0000 (10:50 -0500)]
arm64: Include NUMA locality info in the CPU topology

The scheduler uses this topology to try and preserve locality when
migrating threads between CPUs and when performing work stealing.
Ensure that on NUMA systems it will at least take the NUMA topology into
account.

Reviewed by: mmel
Submitted by: Klara, Inc.
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D28579

(cherry picked from commit 17d0f830dddf38724068f4139b6bef9a5dab70c5)

3 years agovm_kern: Avoid sign extension in the KVA_QUANTUM definition
Mark Johnston [Mon, 22 Feb 2021 20:50:09 +0000 (15:50 -0500)]
vm_kern: Avoid sign extension in the KVA_QUANTUM definition

Otherwise, on a powerpc64 NUMA system with hashed page tables, the
first-level superpage reservation size is large enough that the value of
the kernel KVA arena import quantum, KVA_NUMA_IMPORT_QUANTUM, is
negative and gets sign-extended when passed to vmem_set_import().  This
results in a boot-time hang on such platforms.

Reported by: bdragon

(cherry picked from commit 23e875fd97fb9f17b3f5dc2b26082f25e1a86b6f)

3 years agoFix bug 253158 - Panic: snapacct_ufs2: bad block - mksnap_ffs(8) crash
Kirk McKusick [Fri, 12 Feb 2021 05:31:16 +0000 (21:31 -0800)]
Fix bug 253158 - Panic: snapacct_ufs2: bad block - mksnap_ffs(8) crash

PR:           253158

(cherry picked from commit 8563de2f2799b2cb6f2f06e3c9dddd48dca2a986)
(cherry picked from commit c31480a1f66537e59b02e935a547bcfc76715278)

3 years agoCall softdep_prealloc() before taking ffs_lock_ea(), if unlock is committing
Konstantin Belousov [Sun, 21 Feb 2021 10:11:54 +0000 (12:11 +0200)]
Call softdep_prealloc() before taking ffs_lock_ea(), if unlock is committing

(cherry picked from commit 6f30ac9995ff662a2fee5eda4cd87dd0f0e337ba)

3 years agoffs_close_ea: do not relock vnode under lock_ea
Konstantin Belousov [Sun, 21 Feb 2021 10:10:06 +0000 (12:10 +0200)]
ffs_close_ea: do not relock vnode under lock_ea

(cherry picked from commit 5e198e7646a27412c0541719f7bf1bbc0bd89223)

3 years agoffs_vnops.c: style
Konstantin Belousov [Sat, 20 Feb 2021 17:01:40 +0000 (19:01 +0200)]
ffs_vnops.c: style

(cherry picked from commit c6d68ca842a3f5b6814cdd5c87e406bad579b792)

3 years agoffs: do not call softdep_prealloc() from UFS_BALLOC()
Konstantin Belousov [Thu, 18 Feb 2021 14:51:50 +0000 (16:51 +0200)]
ffs: do not call softdep_prealloc() from UFS_BALLOC()

(cherry picked from commit 49831462794690155ce8dbe02679e6d9390f3d7d)

3 years agoffs_reallocblks: change the guard for softdep_prealloc() call to DOINGSUJ()
Konstantin Belousov [Fri, 19 Feb 2021 12:37:12 +0000 (14:37 +0200)]
ffs_reallocblks: change the guard for softdep_prealloc() call to DOINGSUJ()

(cherry picked from commit cc9958bf22f1426faf4be8bf492ce69587a9008f)

3 years agonetgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support
Neel Chauhan [Sun, 24 Jan 2021 19:23:39 +0000 (20:23 +0100)]
netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support

This extends upon the RFC 6598 support to libalias/ipfw in r357092.

Reviewed By: manpages (bcr), donner, adrian, kp
Differential Revision: https://reviews.freebsd.org/D23461

(cherry picked from commit 5fe433a6e4d8cab6b64284698301afc0c55a9db2)

3 years agonetgraph/ng_vlan_rotate: IEEE 802.1ad VLAN manipulation netgraph type
Lutz Donnerhacke [Tue, 26 Jan 2021 15:50:04 +0000 (16:50 +0100)]
netgraph/ng_vlan_rotate: IEEE 802.1ad VLAN manipulation netgraph type

This node is part of an A10-NSP (L2-BSA) development.

Carrier networks tend to stack three or more tags for internal
purposes and therefore hiding the service tags deep inside of the
stack. When decomposing such an access network frame, the processing
order is typically reversed: First distinguish by service, than by
other means.

This new netgragh node allows to bring the relevant VLAN in front (to
the out-most position). This way other netgraph nodes (like ng_vlan)
can operate on this specific type.

Reviewed by: manpages (gbe), brueffer (manpages), kp
Relnotes: yes
Sponsored by: IKS Service GmbH
Differential Revision: https://reviews.freebsd.org/D22076

(cherry picked from commit cfd6422a5217410fbd66f7a7a8a64d9d85e61229)

3 years agopwrite(2): add a BUGS section
Guangyuan Yang [Sat, 20 Feb 2021 08:03:15 +0000 (08:03 +0000)]
pwrite(2): add a BUGS section

Add a BUGS section about using pwrite(2) when O_APPEND is set on the fd.

Submitted by: Ka Ho Ng <khng300@gmail.com>
Reviewed by: gbe, yuripv
Differential Revision: https://reviews.freebsd.org/D28372

(cherry picked from commit 504e64af32ba6c62fdcc894a3b1da76061c64796)

3 years agocxgb(4): Rework my commit 9dc7c250.
Alexander Motin [Mon, 22 Feb 2021 22:21:05 +0000 (17:21 -0500)]
cxgb(4): Rework my commit 9dc7c250.

The previous implementation was reported to try to coalesce packets
in situations when it should not, that resulted in assertion later.
This implementation better checks the first packet of the chain for
the coallescing elligibility.

(cherry picked from commit d510bf133d045d6c83742aeda6949bec150f6cbf)

3 years agoFix possibly unitialized variables in __cxa_demangle_gnu3()
Dimitry Andric [Mon, 22 Feb 2021 20:01:09 +0000 (21:01 +0100)]
Fix possibly unitialized variables in __cxa_demangle_gnu3()

After 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 where I imported a more
recent libcxxrt snapshot, the variables 'rtn' and 'has_ret' could in
some cases be used while still uninitialized. Most obviously this would
lead to a jemalloc complaint about a bad free(), aborting the program.

Fix this by initializing a bunch variables in their declarations. This
change has also been sent upstream, with some additional changes to be
used in their testing framework.

PR: 253226

(cherry picked from commit d149877758f162f0c777e7760164bf2c1f7a1bc1)

3 years agonvme: Make nvme_ctrlr_hw_reset static
Warner Losh [Mon, 8 Feb 2021 20:28:18 +0000 (13:28 -0700)]
nvme: Make nvme_ctrlr_hw_reset static

nvme_ctrlr_hw_reset is no longer used outside of nvme_ctrlr.c, so
make it static. If we need to change this in the future we can.

(cherry picked from commit dd2516fc078f15633ad5aedaad6de140cb491f80)

3 years agonvme: use NVME_GONE rather than hard-coded 0xffffffff
Warner Losh [Mon, 8 Feb 2021 20:08:48 +0000 (13:08 -0700)]
nvme: use NVME_GONE rather than hard-coded 0xffffffff

Make it clearer that the value 0xfffffff is being used to detect the device is
gone. We use it other places in the driver for other meanings.

(cherry picked from commit 9600aa31aa633bbb9e8a56d91a781d5a7ce2bff6)

3 years agoefibootmgr: Check for efi supported after parsing args
Warner Losh [Thu, 11 Feb 2021 23:06:30 +0000 (16:06 -0700)]
efibootmgr: Check for efi supported after parsing args

Move the check for efi variables being supported to after parsing the args. This
allows '-h' to produce both as a normal user as well as on all systems.

(cherry picked from commit 7fe2f504f8a0e4237872f8528e911c5f7b7ed59d)

3 years agouefi: Add riscv to historical details
Jessica Clarke [Mon, 22 Feb 2021 22:27:00 +0000 (22:27 +0000)]
uefi: Add riscv to historical details

(cherry picked from commit 963cf6cb0fd7e8708c455ecf567fbc34fe2a7156)

3 years agoRestore missing word
Warner Losh [Mon, 22 Feb 2021 21:39:04 +0000 (14:39 -0700)]
Restore missing word

"in" got dropped when I shuffled things around.

Noticed by: rpokala@
MFC After: 3 days

(cherry picked from commit f11e9f325aee3459fee94f3a660a8e6c1a25c2ac)

3 years agouefi: add historical details
Warner Losh [Mon, 22 Feb 2021 21:20:00 +0000 (14:20 -0700)]
uefi: add historical details

Add details about when armv6 and armv7 support was added.

(cherry picked from commit 8c09ecb2e25155b4f1490a177826608d52b1bd1b)

3 years agoRemove incorrect statement about EFI environment variables being unsupported.
Warner Losh [Mon, 22 Feb 2021 20:19:21 +0000 (13:19 -0700)]
Remove incorrect statement about EFI environment variables being unsupported.

Our uefi support has included environment variable support for several years
now. Remove the bogus blanket statement saying we don't support them.

MFC After: 3 days

(cherry picked from commit ab77cc9e7bf6d0c2d862dfd514539b81ae248dfd)

3 years agouart: only use MSI on devices that advertise 1 MSI vector
Warner Losh [Wed, 17 Feb 2021 22:08:19 +0000 (15:08 -0700)]
uart: only use MSI on devices that advertise 1 MSI vector

This updates r311987/fb1d9b7f4113d which allowed any number of vectors to be
used. Since we're just attaching one instance, the meaning of more than one
vector is not clear and seems to cause problems. Fall back to old methods for
these cards.

PR: 235016
Submitted by: David Cross

(cherry picked from commit 955b6109bb36036e9357006be42dfa89cd7cb0f2)

3 years agoboot: remove gptboot.efifat, it never should have been
Warner Losh [Fri, 19 Feb 2021 22:34:25 +0000 (15:34 -0700)]
boot: remove gptboot.efifat, it never should have been

conical hat reduction: Make sure we also remove gotboot.efifat. It was created,
briefly, and shouldn't have existed in the first place. Kill it at the same
place we kill boot1.efifat.

Pointy Hat to: imp@

(cherry picked from commit 8cd1b2b1a7ab55e96aaf40a401d8792f2697b274)

3 years agoiflib: Fix detach of pseudo interfaces
Mark Johnston [Fri, 19 Feb 2021 22:08:34 +0000 (17:08 -0500)]
iflib: Fix detach of pseudo interfaces

In commit 38bfc6dee33b we added an IFDI_DETACH() call to
iflib_pseudo_deregister() since it looked like it was missing.  One is
present in the error-handling path of iflib_pseudo_register().  However,
the detach actually comes from the DEVICE_DETACH() method for the
above-mentioned device_t, so now we're calling IFDI_DETACH() twice when
destroying a pseudo interface.

Fix the problem by not calling IFDI_DETACH() from the device detach
routine.  This way we can ensure that iflib de-initialization always
happens in a consistent order.  It also ensures that you can't do silly
things like "devctl detach <pseudo ifnet>", which would previously
detach the driver without tearing down the corresponding ifnet.

PR: 253541
Reviewed by: erj
Fixes: 38bfc6dee33b
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28774

(cherry picked from commit 0f9544d03e89d180f94a7a84b110ec7d2b6c625a)

3 years agoarm64: extend struct db_reg to include watchpoint registers
Mitchell Horne [Thu, 28 Jan 2021 17:49:47 +0000 (13:49 -0400)]
arm64: extend struct db_reg to include watchpoint registers

The motivation is to provide access to these registers from userspace
via ptrace(2) requests PT_GETDBREGS and PT_SETDBREGS.

This change breaks the ABI of these particular requests, but is
justified by the fact that the intended consumers (debuggers) have not
been taught to use them yet. Making this change now enables active
upstream work on lldb to begin using this interface, and take advantage
of the hardware debugging registers available on the platform.

PR: 252860
Reported by: Michał Górny (mgorny@gentoo.org)
Reviewed by: andrew, markj (earlier version)
Tested by: Michał Górny (mgorny@gentoo.org)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f2583be110ca3a5b32f0993f1464a5c69151c62f)

3 years agoarm64: handle watchpoint exceptions from EL0
Mitchell Horne [Fri, 5 Feb 2021 21:46:48 +0000 (17:46 -0400)]
arm64: handle watchpoint exceptions from EL0

This is a prerequisite to allowing the use of hardware watchpoints for
userspace debuggers.

This is also a slight departure from the x86 behaviour, since `si_addr`
returns the data address that triggered the watchpoint, not the
address of the instruction that was executed. Otherwise, there is no
straightforward way for the application to determine which watchpoint
was triggered. Make a note of this in the siginfo(3) man page.

Reviewed by: jhb, markj (earlier version)
Tested by: Michał Górny (mgorny@gentoo.org)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit bd012c71592323d957b409bb5e0cf7940729650e)

3 years agoarm64: validate breakpoint registers
Mitchell Horne [Tue, 9 Feb 2021 18:29:38 +0000 (14:29 -0400)]
arm64: validate breakpoint registers

In particular, we want to disallow setting breakpoints on kernel
addresses from userspace. The control register fields are validated or
ignored as appropriate.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation

(cherry picked from commit de2b9422807586d376ec7ffa7b660cd492464bdf)

3 years agopf tests: Explicitly ask for python3
Kristof Provost [Wed, 17 Feb 2021 10:45:54 +0000 (11:45 +0100)]
pf tests: Explicitly ask for python3

If we install the scapy package (which we do list as a dependency) we
don't automatically install python (but we do have python3).

MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC (“Netgate”’)

(cherry picked from commit 4a7d84058d88244c405fc0b73d6985681eb661f5)

3 years agopf: Assert that pfil_link() calls succeed
Kristof Provost [Wed, 17 Feb 2021 10:44:37 +0000 (11:44 +0100)]
pf: Assert that pfil_link() calls succeed

These should only fail if we use them incorrectly, so assert that they
succeed.

MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC (“Netgate”’)

(cherry picked from commit c4e0f7aa1ae7729df8c3e525e511b84f8052375c)

3 years agopf: Remove unused return value from (de)hook_pf()
Kristof Provost [Tue, 16 Feb 2021 11:40:51 +0000 (12:40 +0100)]
pf: Remove unused return value from (de)hook_pf()

These functions always return 0, which is good, because the code calling
them doesn't handle this error gracefully.

As the functions always succeed remove their return value, and the code
handling their errors (because it was never executed anyway).

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (“Netgate”’)

(cherry picked from commit 8a439f324e9010a122fa4c00426bde70dc373c2f)

3 years agolockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK)
Konstantin Belousov [Fri, 29 Jan 2021 23:48:55 +0000 (01:48 +0200)]
lockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK)

(cherry picked from commit fa3bd463cee5c3abeac29a83dc86eb3abfa97b06)
(cherry picked from commit 662283b1088d6488671b90ab18a66a997c526448)

3 years agofifo: minor comment and assert improvements.
Konstantin Belousov [Mon, 1 Feb 2021 10:43:16 +0000 (12:43 +0200)]
fifo: minor comment and assert improvements.

(cherry picked from commit adf28ab45670329459aed8afeec2dbe91c9b3713)

3 years agoffs_unlock: assert that IN_ENDOFF is not leaked past locked scope
Konstantin Belousov [Sun, 31 Jan 2021 19:01:17 +0000 (21:01 +0200)]
ffs_unlock: assert that IN_ENDOFF is not leaked past locked scope

(cherry picked from commit 26af9f72f7cb162abeced8b7e444800b601e5017)

3 years agoffs softdep: Force processing of VI_OWEINACT vnodes when there is inode shortage
Konstantin Belousov [Sun, 31 Jan 2021 18:39:49 +0000 (20:39 +0200)]
ffs softdep: Force processing of VI_OWEINACT vnodes when there is inode shortage

(cherry picked from commit 28703d27130c9cb7e7830ff53155c379a502c248)

3 years agosoftdep_request_cleanup: wait for softdep_request_clean_flush() to pass
Konstantin Belousov [Wed, 3 Feb 2021 23:58:05 +0000 (01:58 +0200)]
softdep_request_cleanup: wait for softdep_request_clean_flush() to pass

(cherry picked from commit 2011b44fa3f2b2bd5a24be01094420cce9144b2d)

3 years agoufs_inactive(): stop hiding ERELOOKUP from ffs_truncate(), return it.
Konstantin Belousov [Sat, 30 Jan 2021 19:18:22 +0000 (21:18 +0200)]
ufs_inactive(): stop hiding ERELOOKUP from ffs_truncate(), return it.

(cherry picked from commit 013168db8cea926c3dde1247d400d6bedf9a889d)

3 years agoStop ignoring ERELOOKUP from VOP_INACTIVE()
Konstantin Belousov [Sat, 30 Jan 2021 19:17:29 +0000 (21:17 +0200)]
Stop ignoring ERELOOKUP from VOP_INACTIVE()

(cherry picked from commit b59a8e63d6bf9092419b7a421c655d0ae2099662)

3 years agoufs vnops: brace softdep_prelink() with DOINGSUJ instead of DOINGSOFTDEP
Konstantin Belousov [Sat, 23 Jan 2021 23:12:39 +0000 (01:12 +0200)]
ufs vnops: brace softdep_prelink() with DOINGSUJ instead of DOINGSOFTDEP

(cherry picked from commit 6aed2435c8bf1fa55891c7d30186c9ad91064da8)

3 years agoffs softdep: remove will_direnter argument of softdep_prelink()
Konstantin Belousov [Sat, 23 Jan 2021 22:40:19 +0000 (00:40 +0200)]
ffs softdep: remove will_direnter argument of softdep_prelink()

(cherry picked from commit ede40b0675155b5cc862652f2fee11c738a46bcd)

3 years agoufs_direnter: directory truncation does not need special case for rename
Konstantin Belousov [Fri, 29 Jan 2021 12:31:52 +0000 (14:31 +0200)]
ufs_direnter: directory truncation does not need special case for rename

(cherry picked from commit 06f2918ab8a2621c6e6bc5729ed9ab982741aaf2)

3 years agoufs_rename: use VOP_VPUT_PAIR and rely on directory sync/truncation there
Konstantin Belousov [Thu, 28 Jan 2021 13:34:56 +0000 (15:34 +0200)]
ufs_rename: use VOP_VPUT_PAIR and rely on directory sync/truncation there

(cherry picked from commit 038fe6e089f03ca864c1dd5ac0c76404a13bbe79)

3 years agoufs_direnter: move directory truncation to ffs_vput_pair().
Konstantin Belousov [Wed, 27 Jan 2021 20:34:14 +0000 (22:34 +0200)]
ufs_direnter: move directory truncation to ffs_vput_pair().

(cherry picked from commit 74a3652f832f4ed0f1ad9f7eb60d70013b478e1a)

3 years agoffs_vput_pair(): try harder to recover from the vnode reclaim
Konstantin Belousov [Wed, 27 Jan 2021 18:10:51 +0000 (20:10 +0200)]
ffs_vput_pair(): try harder to recover from the vnode reclaim

(cherry picked from commit 30bfb2fa0fad8e5bbcce369df46dcaa2e08324f3)

3 years agoFFS: implement special VOP_VPUT_PAIR().
Konstantin Belousov [Wed, 27 Jan 2021 18:09:53 +0000 (20:09 +0200)]
FFS: implement special VOP_VPUT_PAIR().

(cherry picked from commit f2c9d038bdee547be07c8b0404547617b71f2232)

3 years agonfsserver: use VOP_VPUT_PAIR().
Konstantin Belousov [Sun, 24 Jan 2021 13:02:27 +0000 (15:02 +0200)]
nfsserver: use VOP_VPUT_PAIR().

(cherry picked from commit 4a21bcb24174438e0944d6e4d6633290a067b7a8)

3 years agoffs_snapshot: use VOP_VPUT_PAIR after VOP_CREATE.
Konstantin Belousov [Sun, 24 Jan 2021 13:56:05 +0000 (15:56 +0200)]
ffs_snapshot: use VOP_VPUT_PAIR after VOP_CREATE.

(cherry picked from commit be44e986377780f533f961fe7c009b93379b4710)

3 years agoUse VOP_VPUT_PAIR() for eligible VFS syscalls.
Konstantin Belousov [Thu, 28 Jan 2021 22:31:30 +0000 (00:31 +0200)]
Use VOP_VPUT_PAIR() for eligible VFS syscalls.

(cherry picked from commit 3b2aa36024abcb2d8fdbf3a6ecc7438b073b04e4)

3 years agonullfs: provide special bypass for VOP_VPUT_PAIR
Konstantin Belousov [Sun, 24 Jan 2021 13:22:48 +0000 (15:22 +0200)]
nullfs: provide special bypass for VOP_VPUT_PAIR

(cherry picked from commit e4aaf35ab54958f74409790fa2b7df8c2d230cee)

3 years agoAdd VOP_VPUT_PAIR() with trivial default implementation.
Konstantin Belousov [Thu, 28 Jan 2021 22:30:53 +0000 (00:30 +0200)]
Add VOP_VPUT_PAIR() with trivial default implementation.

(cherry picked from commit 49c117c193768b10f5fb1c5e4d6b88300cfbcdd6)

3 years agovn_open(): If the vnode is reclaimed during open(2), do not return error.
Konstantin Belousov [Wed, 3 Feb 2021 11:02:18 +0000 (13:02 +0200)]
vn_open(): If the vnode is reclaimed during open(2), do not return error.

(cherry picked from commit ee965dfa64929227ced8adb68900c35f877480e7)

3 years agoufs_direnter/SU: unconditionally UFS_UPDATE inode when extending directory
Konstantin Belousov [Sat, 23 Jan 2021 21:52:10 +0000 (23:52 +0200)]
ufs_direnter/SU: unconditionally UFS_UPDATE inode when extending directory

(cherry picked from commit 08c2dc2841214187a162d5e4475aa1b94d03fd77)

3 years agoffs_syncvnode: only clear IN_NEEDSYNC after successfull sync
Konstantin Belousov [Sat, 23 Jan 2021 21:50:55 +0000 (23:50 +0200)]
ffs_syncvnode: only clear IN_NEEDSYNC after successfull sync

(cherry picked from commit 1de1e2bfbf3c089418bbe67c096d60315c8ca5dd)

3 years agoMerge ufs_fhtovp() into ffs_inotovp().
Konstantin Belousov [Thu, 28 Jan 2021 12:20:48 +0000 (14:20 +0200)]
Merge ufs_fhtovp() into ffs_inotovp().

(cherry picked from commit 89fd61d955ada4fdb20030253206201bc279cdf0)

3 years agoffs_inotovp(): interface to convert (ino, gen) into alive vnode
Konstantin Belousov [Tue, 26 Jan 2021 11:52:59 +0000 (13:52 +0200)]
ffs_inotovp(): interface to convert (ino, gen) into alive vnode

(cherry picked from commit 5952c86c78b177b5e904bf139e6b56519897c7e0)

3 years agoffs: Add FFSV_REPLACE_DOOMED flag to ffs_vgetf()
Konstantin Belousov [Tue, 26 Jan 2021 11:35:21 +0000 (13:35 +0200)]
ffs: Add FFSV_REPLACE_DOOMED flag to ffs_vgetf()

(cherry picked from commit f16c26b1c009fd0d87d07d3b1cf0d5078ad7f511)

3 years agoffs: call ufsdirhash_dirtrunc() right after setting directory size
Konstantin Belousov [Thu, 28 Jan 2021 18:33:58 +0000 (20:33 +0200)]
ffs: call ufsdirhash_dirtrunc() right after setting directory size

(cherry picked from commit e94f2f1be32294cb6d519b6631f7522466fbbb3b)

3 years agobuf SU hooks: track buf_start() calls with B_IOSTARTED flag
Konstantin Belousov [Sat, 30 Jan 2021 02:10:34 +0000 (04:10 +0200)]
buf SU hooks: track buf_start() calls with B_IOSTARTED flag

(cherry picked from commit bf0db19339e770a82236b74f523be4b572bde15d)

3 years ago504ebd612ec: kern: sonewconn: set so_options before pru_attach()
Kyle Evans [Wed, 20 Jan 2021 17:53:05 +0000 (11:53 -0600)]
504ebd612ec: kern: sonewconn: set so_options before pru_attach()

Protocol attachment has historically been able to observe and modify
so->so_options as needed, and it still can for newly created sockets.
779f106aa169 moved this to after pru_attach() when we re-acquire the
lock on the listening socket.

Restore the historical behavior so that pru_attach implementations can
consistently use it. Note that some pru_attach() do currently rely on
this, though that may change in the future. D28265 contains a change to
remove the use in TCP and IB/SDP bits, as resetting the requested linger
time on incoming connections seems questionable at best.

This does move the assignment out from under the head's listen lock, but
glebius notes that head won't be going away and applications cannot
assume any specific ordering with a race between a connection coming in
and the application changing socket options anyways.

4c0bef07be0: kern: net: remove TCP_LINGERTIME

TCP_LINGERTIME can be traced back to BSD 4.4 Lite and perhaps beyond, in
exactly the same form that it appears here modulo slightly different
context.  It used to be the case that there was a single pr_usrreq
method with requests dispatched to it; these exact two lines appeared in
tcp_usrreq's PRU_ATTACH handling.

The only purpose of this that I can find is to cause surprising behavior
on accepted connections. Newly-created sockets will never hit these
paths as one cannot set SO_LINGER prior to socket(2). If SO_LINGER is
set on a listening socket and inherited, one would expect the timeout to
be inherited rather than changed arbitrarily like this -- noting that
SO_LINGER is nonsense on a listening socket beyond inheritance, since
they cannot be 'connected' by definition.

Neither Illumos nor Linux reset the timer like this based on testing and
inspection of Illumos, and testing of Linux.

(cherry picked from commit 504ebd612ec61165bb949cfce3a348b0d6f37008)
(cherry picked from commit 4c0bef07be071a1633ebc86a653f9bd59d40796e)

3 years agopam_login_access: Fix negative entry matching logic
Mark Johnston [Tue, 23 Feb 2021 22:01:29 +0000 (17:01 -0500)]
pam_login_access: Fix negative entry matching logic

PR: 252194
Approved by: so
Security: CVE-2020-25580
Security: FreeBSD-SA-21:03.pam_login_access

(cherry picked from commit 6ab923cbca8759503a08683a5978b9ebf5efd607)

3 years agoFix divide-by-zero panic when ASLR is enabled and superpages disabled
Jason A. Harmening [Mon, 15 Feb 2021 02:47:22 +0000 (18:47 -0800)]
Fix divide-by-zero panic when ASLR is enabled and superpages disabled

When locating the anonymous memory region for a vm_map with ASLR
enabled, we try to keep the slid base address aligned on a superpage
boundary to minimize pagetable fragmentation and maximize the potential
usage of superpage mappings.  We can't (portably) do this if superpages
have been disabled by loader tunable and pagesizes[1] is 0, and it
would be less beneficial in that case anyway.

PR: 253511

(cherry picked from commit 41032835dc2d489ec7841d7529f74f6389329cd3)

3 years agohkbd: Fix handling of keyboard ErrorRollOver reports
Vladimir Kondratyev [Sat, 13 Feb 2021 18:18:07 +0000 (21:18 +0300)]
hkbd: Fix handling of keyboard ErrorRollOver reports

Ignore fantom keyboard state reports entirelly rather than ignore
RollOver states for each key separatelly.  Latter results in spurious
release/push pairs of events on each fantom keyboard state report.

Reported by: Jan Martin Mikkelsen <janm_AT_transactionware_DOT_com>
Submitted by: Jan Martin Mikkelsen (initial version)
PR: 253249
MFC after: 1 week

(cherry picked from commit 812c59ed614df94380e0b1f9ff4a3d15b78ce1bf)

3 years agoukbd: Fix handling of keyboard ErrorRollOver reports
Vladimir Kondratyev [Sat, 13 Feb 2021 18:12:56 +0000 (21:12 +0300)]
ukbd: Fix handling of keyboard ErrorRollOver reports

Ignore fantom keyboard state reports entirelly rather than ignore
RollOver states for each key separatelly.  Latter results in spurious
release/push pairs of events on each fantom keyboard state report.

Reported by: Jan Martin Mikkelsen <janm_AT_transactionware_DOT_com>
Submitted by: Jan Martin Mikkelsen (initial version)
PR: 253249
MFC after: 1 week

(cherry picked from commit 032d3153877ef1767c121bbdf8e00f4f93b30a5d)

3 years agohidraw: Make HIDIOCGRDESCSIZE ioctl return report descriptor size
Vladimir Kondratyev [Sat, 13 Feb 2021 18:19:02 +0000 (21:19 +0300)]
hidraw: Make HIDIOCGRDESCSIZE ioctl return report descriptor size

defined by hardware rather than cached one to match HIDIOCGRDESC ioctl.
This fixes errors reported by hid-tools being run against /dev/hidraw#
device node belonging to driver which overloads report descriptor.

MFC after: 1 week

(cherry picked from commit f988d7fa050e4886cdeb9483a039e75d58c31883)

3 years agoFix nd6 rib_action() handling.
Alexander V. Chernikov [Tue, 23 Feb 2021 22:31:07 +0000 (22:31 +0000)]
Fix nd6 rib_action() handling.

rib_action() guarantees valid rc filling IFF it returns without error.
Check rib_action() return code instead of checking rc fields.

PR: 253800
Reported by: Frederic Denis <freebsdml@hecian.net>

(cherry picked from commit 9c4a8d24f0ffd5243fa5c6fe27178f669f16d1f5)

3 years agoofwfb: fix incorrect colors on powerpc* and add new tunable parameters
Alfredo Dal'Ava Junior [Fri, 19 Feb 2021 06:22:25 +0000 (03:22 -0300)]
ofwfb: fix incorrect colors on powerpc* and add new tunable parameters

- Implements little-endian support (powerpc64le)
- Adds 'hw.ofwfb.physaddr' kernel parameter so user can manually
  provide correct address if it's not detected correctly
- Adds 'hw.ofwfb.argb32_pixel' so user can set it manually if
  colors are inverted due to incorrect pixel format (default = 1)
- Automatically selects RGBA32 pixel format if NVidia graphic adapter
  is detected (sets hw.ofwfb.argb32_pixel=0)

Machines equipped with NVidia graphic adapters tend to use RGBA32
pixel format. By default ARGB32 pixel format is used, proved to work
on machines equipped with ATI graphic adapter and the onboard adapter
used on Talos II and Blackbird machines from Raptor Computing Systems.

Original patch developed by bdragon

Reviewed by: bdragon, luporl
MFC after: 3 days
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D28604

(cherry picked from commit 50b7c1f530f174be720b83f7e1d13e0fd42c5974)

3 years agocgem: improve usage of busdma(9) KPI
Mitchell Horne [Wed, 20 Jan 2021 15:07:53 +0000 (11:07 -0400)]
cgem: improve usage of busdma(9) KPI

BUS_DMA_NOCACHE should only be used when one needs to guarantee the
created mapping has uncached memory attributes, usually as a result
of buggy hardware. Normal use cases should pass BUS_DMA_COHERENT, to
create an appropriate mapping based on the flags passed to
bus_dma_tag_create().

This should have no functional change, since the DMA tags in this driver
are created without the BUS_DMA_COHERENT flag.

Reported by: mmel
Reviewed by: mmel, Thomas Skibo <thomas-bsd@skibo.net>

(cherry picked from commit 04d2d2d7fd22bba638ccb5a0b2e0805087a70cd3)

3 years agoddb: fix show devmap output on 32-bit arm
Thomas Skibo [Mon, 11 Jan 2021 20:58:12 +0000 (16:58 -0400)]
ddb: fix show devmap output on 32-bit arm

The output has been broken since 1b6dd6d772ca. Casting to uintmax_t
before the call to printf is necessary to ensure that 32-bit addresses
are interpreted correctly.

PR: 243236

(cherry picked from commit 9976b42b697ce203b1d257b2a6fe64c8a2961645)

3 years agopf tests: Test unicast reverse path forwarding check
Kristof Provost [Mon, 15 Feb 2021 21:16:36 +0000 (22:16 +0100)]
pf tests: Test unicast reverse path forwarding check

Ensure that pf's urpf-failed keyword works as expected.

PR: 253479
MFC after: 1 week
Reviewed by: melifaro@
Differential Revision: https://reviews.freebsd.org/D28694

(cherry picked from commit 6b52139eb8e8eda0ea263b24735556194f918642)

3 years agopf tests: Test that dup-to doesn't produce extra duplicate packets
Kristof Provost [Thu, 28 Jan 2021 10:02:20 +0000 (11:02 +0100)]
pf tests: Test that dup-to doesn't produce extra duplicate packets

(cherry picked from commit cd579b6fba46b9f5005358d1e82def7b26703224)

3 years agopf: duplicate frames only once when using dup-to pf rule
Yannis Planus [Thu, 28 Jan 2021 13:59:07 +0000 (14:59 +0100)]
pf: duplicate frames only once when using dup-to pf rule

When using DUP-TO rule, frames are duplicated 3 times on both output
interfaces and duplication interface. Add a flag to not duplicate a
duplicated frame.

Inspired by a patch from Miłosz Kaniewski milosz.kaniewski at gmail.com
https://lists.freebsd.org/pipermail/freebsd-pf/2015-November/007886.html

Reviewed by: kp@
Differential Revision: https://reviews.freebsd.org/D27018

(cherry picked from commit 0c458752ceee14818034df7bfcdfb04129dceeda)

3 years agopgcache read: protect against reads past end of the vm object size
Konstantin Belousov [Mon, 15 Feb 2021 03:34:06 +0000 (05:34 +0200)]
pgcache read: protect against reads past end of the vm object size

PR: 253158

(cherry picked from commit c61fae1475f1864dc4bba667b642f279afd44855)

3 years agoloader: unload command should reset tg_kernel_supported in gfx_state
Toomas Soome [Thu, 28 Jan 2021 07:45:47 +0000 (09:45 +0200)]
loader: unload command should reset tg_kernel_supported in gfx_state

While loading kernel, we check if vt/vbe backend support is included in
kernel and set the tg_kernel_supported flag in gfx_state. unload
command needs to reset this flag to allow next load to perform
this check with new kernel.

Reported by: jhb

(cherry picked from commit 9b388ac30375ad4e0259b264a006753edcb2bd3c)

3 years agoFix loader detection of vbefb support on !amd64
Dimitry Andric [Wed, 27 Jan 2021 21:28:43 +0000 (22:28 +0100)]
Fix loader detection of vbefb support on !amd64

On i386, after 6c7a932d0b8baaaee16eca0ba061bfa6e0e57bfd, the vbefb vt
driver was no longer detected by the loader, if any kernel module was
loaded after the kernel itself.

This was caused by the parse_vt_drv_set() function being called multiple
times, resetting the detection flag. (It was called multiple times,
becuase i386 .ko files are shared objects like the kernel proper, while
this is not the case on amd64.)

Fix this by skipping the set_vt_drv_set lookup if vbefb was already
detected.

Reviewed by: tsoome
(cherry picked from commit 6e26189be406a9a3799074b16925e6cd63cc703b)

3 years agoloader: start kernel in text mode when there is no vbefb vt driver
Toomas Soome [Tue, 26 Jan 2021 22:47:56 +0000 (00:47 +0200)]
loader: start kernel in text mode when there is no vbefb vt driver

If kernel is built without VT vbefb driver, make sure
we start kernel in text mode.

(cherry picked from commit 6c7a932d0b8baaaee16eca0ba061bfa6e0e57bfd)

3 years agolinux: Update the i386/linux vdso deinitialization routine
Mark Johnston [Tue, 16 Feb 2021 22:06:20 +0000 (17:06 -0500)]
linux: Update the i386/linux vdso deinitialization routine

This was missed in commit 0fc8a796722 ("linux: Unmap the VDSO page when
unloading").

Reported by: Mark Millard
MFC with: 0fc8a796722

(cherry picked from commit aa5fef60bf663d31cddf53d7a8c6856d5e4672c0)

3 years agolinux: Unmap the VDSO page when unloading
Mark Johnston [Tue, 16 Feb 2021 14:30:21 +0000 (09:30 -0500)]
linux: Unmap the VDSO page when unloading

linux_shared_page_init() creates an object and grabs and maps a single
page to back the VDSO.  When destroying the VDSO object, we failed to
destroy the mapping and free KVA.  Fix this.

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

(cherry picked from commit 0fc8a796722846d0d676548aa0f5cc660199db73)

3 years agoxen-blkback: fix leak of grant maps on ring setup failure
Roger Pau Monné [Wed, 20 Jan 2021 18:40:51 +0000 (19:40 +0100)]
xen-blkback: fix leak of grant maps on ring setup failure

Multi page rings are mapped using a single hypercall that gets passed
an array of grants to map. One of the grants in the array failing to
map would lead to the failure of the whole ring setup operation, but
there was no cleanup of the rest of the grant maps in the array that
could have likely been created as a result of the hypercall.

Add proper cleanup on the failure path during ring setup to unmap any
grants that could have been created.

This is part of XSA-361.

Sponsored by: Citrix Systems R&D

(cherry picked from commit 808d4aad1022a2a33d222663b0c9badde30b9d45)

3 years agoExclude reserved iSCSI Initiator Task Tag.
Alexander Motin [Sun, 24 Jan 2021 19:23:04 +0000 (14:23 -0500)]
Exclude reserved iSCSI Initiator Task Tag.

RFC 7143 (11.2.1.8):
   An ITT value of 0xffffffff is reserved and MUST NOT be assigned for a
   task by the initiator.  The only instance in which it may be seen on
   the wire is in a target-initiated NOP-In PDU (Section 11.19) and in
   the initiator response to that PDU, if necessary.

MFC after: 1 month

3 years agoExclude reserved iSCSI Target Transfer Tag.
Alexander Motin [Sun, 24 Jan 2021 18:58:29 +0000 (13:58 -0500)]
Exclude reserved iSCSI Target Transfer Tag.

RFC 7143 (11.7.4):
   The Target Transfer Tag values are not specified by this protocol,
   except that the value 0xffffffff is reserved and means that the
   Target Transfer Tag is not supplied.

MFC after: 1 month

3 years agocxgbe(4): Save proper zone index on low memory in refill_fl().
Alexander Motin [Wed, 17 Feb 2021 02:15:28 +0000 (21:15 -0500)]
cxgbe(4): Save proper zone index on low memory in refill_fl().

When refill_fl() fails to allocate large (9/16KB) mbuf cluster, it
falls back to safe (4KB) ones.  But it still saved into sd->zidx
the original fl->zidx instead of fl->safe_zidx.  It caused problems
with the later use of that cluster, including memory and/or data
corruption.

While there, make refill_fl() to use the safe zone for all following
clusters for the call, since it is unlikely that large succeed.

MFC after: 3 days
Sponsored by: iXsystems, Inc.
Reviewed by: np, jhb
Differential Revision: https://reviews.freebsd.org/D28716

(cherry picked from commit 294e62bebf36f873fd083d2fe8edd78919dda4e8)

3 years agoloader_lua: consider userboot console as serial
Toomas Soome [Sun, 14 Feb 2021 08:28:29 +0000 (10:28 +0200)]
loader_lua: consider userboot console as serial

We use ascii box chars with serial console because we do not know
if terminal can draw unixode box chars. Same problem is about userboot
console.

(cherry picked from commit 5d8c062fe3ee7b2d6aed0b46d22f62c7771c0af8)