]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 months agoperiodic: Make security diff(1) output as small is possible
Michael Osipov [Fri, 24 Nov 2023 09:26:41 +0000 (10:26 +0100)]
periodic: Make security diff(1) output as small is possible

Make, by default, security diff(1) produce a unified output with a context of
zero (0) lines. This reduces output of unrelated lines in e-mails delivered
to root.

PR: 270266
Approved by: jrm (mentor), karels
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D43071

(cherry picked from commit 3aa71ea7c231a4e60a7e1b9b677e379e17432fc8)

4 months agoreleng-gce: Advertise the availability of UEFI support in GCE images.
Xin LI [Sat, 27 Jan 2024 03:09:39 +0000 (19:09 -0800)]
releng-gce: Advertise the availability of UEFI support in GCE images.

The amd64 and arm64 images supported UEFI, mark it as so users can take
advantage of UEFI boot on GCE.  This is already done on FreeBSD
14.0-RELEASE but never codified into the release tools (and should).

PR: conf/276532
Reviewed by: lwhsu
Differential Revision: https://reviews.freebsd.org/D43557

(cherry picked from commit 72dd306e44bc531fa723f4cdb631cb63cc5f09cb)

4 months agowg: detach bpf upon destroy as well
Aaron LI [Mon, 22 Jan 2024 16:18:56 +0000 (10:18 -0600)]
wg: detach bpf upon destroy as well

bpfattach() is called in wg_clone_create(), but the bpfdetach() is
missing from wg_close_destroy().  Add the missing bpfdetach() to avoid
leaking both the associated bpf bits as well as the ifnet that bpf will
hold a reference to.

PR: 276526

(cherry picked from commit 43be2d7aaf25b719aec8f49aab110c0061f1edec)

4 months agoif_wg: fix access to noise_local->l_has_identity and l_private
Aaron LI [Wed, 17 Jan 2024 23:29:23 +0000 (23:29 +0000)]
if_wg: fix access to noise_local->l_has_identity and l_private

These members are protected by the identity lock, so rlock it in
noise_remote_alloc() and then assert that we have it held to some extent
in noise_precompute_ss().

PR: 276392

(cherry picked from commit 7a4d1d1df0b2e369adcb32aea9ef8c180f885751)

4 months agoif_wg: fix erroneous calculation in calculate_padding() for p_mtu == 0
Aaron LI [Wed, 17 Jan 2024 23:29:23 +0000 (23:29 +0000)]
if_wg: fix erroneous calculation in calculate_padding() for p_mtu == 0

In practice this is harmless; only keepalive packets may realistically have
p_mtu == 0, and they'll also have no payload so the math works out the same
either way.  Still, let's prefer technical accuracy and calculate the amount
of padding needed rather than the padded length...

PR: 276363

(cherry picked from commit b891f61ef538a4e9b4658b4b756635c8036a5788)

4 months agocondvar: Fix a user-after-free in _cv_wait() when ktrace is enabled
Mark Johnston [Mon, 15 Jan 2024 17:29:02 +0000 (12:29 -0500)]
condvar: Fix a user-after-free in _cv_wait() when ktrace is enabled

When a thread wakes up after sleeping on a CV, it must not dereference
the CV structure, as it may already have been freed.  At least ZFS
relies on this invariant, see commit
c636f94bd2ff15be5b904939872b4bce31456c18 for example.

Thus, when logging context-switch events, copy the wmesg into a stack
buffer while it is still safe to do so, and log that after waking up.

While here, move the initial ktrcsw() call later, after assertions and
the SCHEDULER_STOPPED_TD() condition are checked.

Reported by: syzkaller
Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D43450

(cherry picked from commit a5ef95cd228e43bcc459a5c8a9911e57888ba5fd)

4 months agocondvar: Clean up condvar.h a bit
Mark Johnston [Mon, 15 Jan 2024 17:27:11 +0000 (12:27 -0500)]
condvar: Clean up condvar.h a bit

- Remove a typedef that has been unused for a long time.
- Remove a LOCORE guard.  MI headers like condvar.h don't need such a
  guard in general.
- Move a forward declaration into the _KERNEL block.
- Add a types.h include to make the file self-contained.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D43449

(cherry picked from commit 61b0092be751b8241b65cc14e4167d431f1e5ad8)

4 months agorc.d/kdc: Support start of MIT krb5kdc
Cy Schubert [Sat, 20 Jan 2024 13:52:35 +0000 (05:52 -0800)]
rc.d/kdc: Support start of MIT krb5kdc

Some users wishing to use the MIT krb5kdc have discovered the
kdc script workaround applied to the MIT krb5 ports is insufficient.
Let's build into this rc script the smarts to determine whether
base or ports Hiemdal kdc is being invoked or the MIT krb5kdc.

While at it, remove kdc_start_precmd(). This will simplify a future
jail patch.

Suggested by: netchild
Original patch: netchild
Reviewed by: emaste, netchild
Differential Revision: https://reviews.freebsd.org/D43523

(cherry picked from commit 91f78c32befa08bf4010db7afd4407277a3e585f)

4 months agobhyve nvme: Add NQN value
Chuck Tuffli [Thu, 12 Oct 2023 22:04:17 +0000 (15:04 -0700)]
bhyve nvme: Add NQN value

Add a NVMe Qualified Name (NQN) to the Controller Data structure using
the "first format" (i.e., "... used by any organization that owns a
domain name" Section 7.9 NVM-Express 1.4c 2021.06.28 Ratified).

This avoids a Linux kernel warning about a missing or invalid NQN.

(cherry picked from commit 32557d16e2c3c24c04eccfafd895e1514dc65b35)

4 months agoFix issue with Linux guest XHCI tablet probing.
Peter Grehan [Sun, 14 Jan 2024 11:27:12 +0000 (21:27 +1000)]
Fix issue with Linux guest XHCI tablet probing.

The USB3 spec mandates that the device-descriptor max packet size
be 512 bytes, which requires a field size of 9 since it is a
power-of-2.

Linux kernels recently started validating this field, resulting in
the table not being probed and the cursor not working in bhyve VNC.

PR: 275760

(cherry picked from commit 0c243cd4a3671bf728f33378ac593c08d8367bc2)

4 months agohv_kbd: Fix build with EVDEV_SUPPORT kernel option disabled.
Vladimir Kondratyev [Thu, 22 Apr 2021 22:13:25 +0000 (01:13 +0300)]
hv_kbd: Fix build with EVDEV_SUPPORT kernel option disabled.

Reported by: olivier
PR: 268653

(cherry picked from commit 55eb41bb1fb69429330ea415fb463735ae08da64)

4 months agofsck_msdosfs: do not call checksize() if the cluster is bad
John F. Carr [Sat, 20 Jan 2024 23:18:18 +0000 (01:18 +0200)]
fsck_msdosfs: do not call checksize() if the cluster is bad

PR: 276464

(cherry picked from commit deeb1d34024b3f843d965cdf204c745165c9bac0)

4 months agopthread_attr_get_np(3): Revamp
Olivier Certner [Fri, 5 Jan 2024 13:14:48 +0000 (14:14 +0100)]
pthread_attr_get_np(3): Revamp

Fix and more thoroughly describe the attributes object lifecycle.

Also, correct the text about which attributes' values are reported.

Add the ENOMEM error.

While here, rephrase unclear passages, add references and fix the
example's style.

Reviewed by:            kib, emaste
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D43330

(cherry picked from commit 6211cd4be32dfdc51b5ac452d4ead98a36ec42a6)

Approved by:            markj (mentor)

4 months agopthread_attr_get_np(): Use malloc(), report ENOMEM, don't tamper on error
Olivier Certner [Thu, 4 Jan 2024 17:45:52 +0000 (18:45 +0100)]
pthread_attr_get_np(): Use malloc(), report ENOMEM, don't tamper on error

Similarly as in the previous commit, using calloc() instead of malloc()
is useless here in the regular case since the subsequent call to
cpuset_getaffinify() is going to completely fill the allocated memory.

However, there is an additional complication.  This function tries to
allocate memory to hold the cpuset if it previously wasn't, and does so
before the thread lock is acquired, which can fail on a bad thread ID.
In this case, it is necessary to deallocate the memory allocated in this
function so that the attributes object appears unmodified to the caller
when an error is returned.  Without this, a subsequent call to
pthread_attr_getaffinity_np() would expose uninitialized memory (not
a security problem per se, since it comes from the same process) instead
of returning a full mask as it would before the failing call to
pthread_attr_get_np().  So the caller would be able to notice a change
in the state of the attributes object even if pthread_attr_get_np()
reported failure, which would be quite surprising.  A similar problem
that could occur on failure of cpuset_setaffinity() has been fixed.

Finally, we shall always report memory allocation failure.  This already
goes for pthread_attr_init(), so, if for nothing else, just be
consistent.

Reviewed by:            emaste, kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D43329

(cherry picked from commit aadb4a1b3fd185d547087f6eafca6ce0b4df3291)

Approved by:            markj (mentor)

4 months agolibhtr: pthread_attr_setaffinity_np(): Replace calloc() with malloc()
Olivier Certner [Thu, 4 Jan 2024 15:20:50 +0000 (16:20 +0100)]
libhtr: pthread_attr_setaffinity_np(): Replace calloc() with malloc()

Using calloc() instead of malloc() is useless here since the allocated
memory is to be wholly crushed by the memcpy() call that follows.

Suggested by:           kib
Reviewed by:            emaste, kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Differential Revision:  https://reviews.freebsd.org/D43328

(cherry picked from commit 15bb0300eeca233827a6a13cd2ed883e0034979d)

Approved by:            markj (mentor)

4 months agolibthr: thr_attr.c: More style and clarity fixes
Olivier Certner [Thu, 4 Jan 2024 15:10:40 +0000 (16:10 +0100)]
libthr: thr_attr.c: More style and clarity fixes

The change of argument for sizeof() (from a type to an object) is to be
consistent with the change done for the malloc() code just above in the
preceding commit touching this file.

Consider bit flags as integers and test whether they are set with an
explicit comparison with 0.

Use an explicit flag value (PTHREAD_SCOPE_SYSTEM) in place of a variable
that has this value at point of substitution.

All other changes are straightforward.

Suggested by:           kib
Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Differential Revision:  https://reviews.freebsd.org/D43327

(cherry picked from commit 4d312aa051414ad77d3515f258230d01ad11d6dc)

Approved by:            markj (mentor)

4 months agotop: Avoid printing a blank line when the ZFS ARC is empty
Mark Johnston [Thu, 11 Jan 2024 14:58:31 +0000 (09:58 -0500)]
top: Avoid printing a blank line when the ZFS ARC is empty

PR: 275994
MFC after: 2 weeks

(cherry picked from commit 1f62718d8ba26d813d8c2e826ac5f4caee4c6730)

4 months agonet80211: Fix a typo in a source code comment
Gordon Bergling [Mon, 22 Jan 2024 20:54:36 +0000 (21:54 +0100)]
net80211: Fix a typo in a source code comment

- s/recevied/received/

(cherry picked from commit c1ada39783109c496fde853cc2fe32f31a8f7516)

4 months agoif_llatbl: Fix a typo in a KASSERT message
Gordon Bergling [Sat, 20 Jan 2024 20:00:22 +0000 (21:00 +0100)]
if_llatbl: Fix a typo in a KASSERT message

- s/entires/entries/

(cherry picked from commit b4c94968d1bd1ffdd43976b0315e2b6c2b620ee2)

4 months agometa2deps.py: Fix a typo in a source code comment
Gordon Bergling [Mon, 22 Jan 2024 21:00:36 +0000 (22:00 +0100)]
meta2deps.py: Fix a typo in a source code comment

- s/follwing/following/

(cherry picked from commit ad92f3d9d0b56ee723271152cec9174f74e17cb9)

4 months agonetinet6: Fix two typos in source code comments
Gordon Bergling [Mon, 22 Jan 2024 20:48:34 +0000 (21:48 +0100)]
netinet6: Fix two typos in source code comments

- s/adddress/address/

(cherry picked from commit 496432f192165b8700da4b0ab8ebdd253002e265)

4 months agofusefs(5): Fix a typo in a SDT probe
Gordon Bergling [Sat, 20 Jan 2024 16:24:22 +0000 (17:24 +0100)]
fusefs(5): Fix a typo in a SDT probe

- s/userpace/userspace/

(cherry picked from commit 6f0da017c973f40c1bc70552c922c500a0a8c858)

4 months agonetpfil: Fix a typo in a source code comment
Gordon Bergling [Mon, 22 Jan 2024 20:50:57 +0000 (21:50 +0100)]
netpfil: Fix a typo in a source code comment

- s/strucutre/structure/

(cherry picked from commit cde9ec6a451d22ad65fbe602dc57135177c0a865)

4 months agoaic7xxx: Fix a typo in a kernel message
Gordon Bergling [Sat, 20 Jan 2024 21:01:10 +0000 (22:01 +0100)]
aic7xxx: Fix a typo in a kernel message

- s/recevied/received/

(cherry picked from commit 54e047b13baaa5eb613e98991f807e7b6f893f78)

4 months agobce(4): Fix a typo in a kernel message
Gordon Bergling [Sat, 20 Jan 2024 19:10:21 +0000 (20:10 +0100)]
bce(4): Fix a typo in a kernel message

- s/adddress/address/

(cherry picked from commit e1c0d368d630cce01691e1967ada9f36d6b8c751)

4 months agobootpd(8): Fix a typo in a source code comment
Gordon Bergling [Mon, 22 Jan 2024 20:46:31 +0000 (21:46 +0100)]
bootpd(8): Fix a typo in a source code comment

- s/adddress/address/

(cherry picked from commit d04df664776b436f712051520d48f84be93ab269)

4 months agousb: Fix a typo in a source code comment
Gordon Bergling [Mon, 22 Jan 2024 20:57:06 +0000 (21:57 +0100)]
usb: Fix a typo in a source code comment

- s/recevied/received/

(cherry picked from commit d743711016298046ca77c5661bab41739396a180)

4 months agovmd(4): Fix typos in source code comments
Gordon Bergling [Mon, 22 Jan 2024 20:55:33 +0000 (21:55 +0100)]
vmd(4): Fix typos in source code comments

- s/harwdare/hardware/

(cherry picked from commit b2c48aa4d19268610191a0b7d7b76d01d28b0a13)

4 months agotcp_fastopen: Fix a typo in a source code comment
Gordon Bergling [Mon, 22 Jan 2024 20:49:47 +0000 (21:49 +0100)]
tcp_fastopen: Fix a typo in a source code comment

- s/posession/possession/

(cherry picked from commit 9b035689f15fc4aec96f9c18c6c86bd615faed2f)

4 months agoaic7xxx: Fix two typos in source code comments
Gordon Bergling [Mon, 22 Jan 2024 20:47:23 +0000 (21:47 +0100)]
aic7xxx: Fix two typos in source code comments

- s/recevied/received/

(cherry picked from commit b971c51a4d9498c26079fd8229f7af6ef1585020)

4 months agortsock: Fix a typo in a source code comment
Gordon Bergling [Mon, 22 Jan 2024 20:53:21 +0000 (21:53 +0100)]
rtsock: Fix a typo in a source code comment

- s/adddress/address/

(cherry picked from commit ab6d773dbf926e4f92e37b67a85c3290cfb90723)

4 months agovirtio(4): Fix a typo in a source code comment
Gordon Bergling [Mon, 22 Jan 2024 20:59:06 +0000 (21:59 +0100)]
virtio(4): Fix a typo in a source code comment

- s/recevied/received/

(cherry picked from commit 97a4045aaf36079f54ee05a8cb314b8a90f20af8)

4 months agogjournal(8): Fix a typo in a sysctl description
Gordon Bergling [Sat, 20 Jan 2024 19:58:08 +0000 (20:58 +0100)]
gjournal(8): Fix a typo in a sysctl description

- s/entires/entries/

(cherry picked from commit 3fb6adb07915b6759892c937fe4ae8a07ed1a029)

4 months agonetlink(4): Fix a typo in a source code comment
Gordon Bergling [Mon, 22 Jan 2024 20:52:16 +0000 (21:52 +0100)]
netlink(4): Fix a typo in a source code comment

- s/permament/permanent/

(cherry picked from commit c90f1ed104606f5a691ea2defc5711ca9d28fcc7)

4 months agomsdosfs_remount_ro(): correct vfs_unbusy() loop
Konstantin Belousov [Fri, 19 Jan 2024 23:50:48 +0000 (01:50 +0200)]
msdosfs_remount_ro(): correct vfs_unbusy() loop

PR: 276408

(cherry picked from commit 4b3ffc5918b9968ea6ddee6f6cdf3538072e5ef4)

4 months agomsdosfs_integrity_error(): plug possible busy leak
Konstantin Belousov [Thu, 18 Jan 2024 15:35:56 +0000 (17:35 +0200)]
msdosfs_integrity_error(): plug possible busy leak

(cherry picked from commit 13ccb04589e2c5c840e19b407a59e44cb70ac28e)

4 months agomsdosfs_rename(): implement several XXXs about downgrading to ro
Konstantin Belousov [Wed, 17 Jan 2024 23:05:55 +0000 (01:05 +0200)]
msdosfs_rename(): implement several XXXs about downgrading to ro

(cherry picked from commit 661db9b390b4a40418d838876b58d2186d72aabf)

4 months agomsdosfs_rename(): handle errors from msdosfs_lookup_ino()
Konstantin Belousov [Wed, 17 Jan 2024 22:55:05 +0000 (00:55 +0200)]
msdosfs_rename(): handle errors from msdosfs_lookup_ino()

PR: 276408

(cherry picked from commit be0df84849ff3e8fb5ec65176ffde88dbefdc434)

4 months agosysctl vm.objects/vm.swap_objects: do not fill vnode info if jailed
Konstantin Belousov [Sat, 13 Jan 2024 01:46:04 +0000 (03:46 +0200)]
sysctl vm.objects/vm.swap_objects: do not fill vnode info if jailed

(cherry picked from commit 38f5f2a4af5daeec7f13d39cad1ff4dc90da52d8)

4 months agoperiodic: Fix periodic reports when log files are not compressed.
Yoshihiro Takahashi [Wed, 10 Jan 2024 11:48:56 +0000 (20:48 +0900)]
periodic: Fix periodic reports when log files are not compressed.

The modern zcat(1) is capable of handling compressed and uncompressed
text files, so we can simply use zcat command.

PR: 253168
Reviewed by: delphij
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D43357

(cherry picked from commit 1fa4ddcc6de6a0c46416f719a5b7efa1169f51ce)

4 months ago_umtx_op.2: Fix a typo in the manual page
Gordon Bergling [Sat, 20 Jan 2024 16:26:34 +0000 (17:26 +0100)]
_umtx_op.2: Fix a typo in the manual page

- s/interpeted/interpreted/

(cherry picked from commit b2ec175fcaac90fc6a1caf066656eaa092f32611)

4 months agoatse(4): Fix a typo in a source code comment
Gordon Bergling [Sat, 20 Jan 2024 16:35:51 +0000 (17:35 +0100)]
atse(4): Fix a typo in a source code comment

- s/addresss/address/

(cherry picked from commit 2b1e4e5be3047411df5e4d5442aa7de6489a0309)

4 months agonet: Fix two typos in source code comments
Gordon Bergling [Sat, 20 Jan 2024 16:28:12 +0000 (17:28 +0100)]
net: Fix two typos in source code comments

- s/strucutres/structures/

(cherry picked from commit a2fcd3af5c8ad43e8d2c7b89f7bbe3edf2f22e2a)

4 months agonetgraph: Fix two typos in source code comments
Gordon Bergling [Sat, 20 Jan 2024 16:22:28 +0000 (17:22 +0100)]
netgraph: Fix two typos in source code comments

- s/bascially/basically/
- s/simpliest/simplest/

(cherry picked from commit 7037ebe63dd1a2ff2a818359c58ca24b6d44388a)

4 months agonetpfil: Fix two typos in source code comments
Gordon Bergling [Sat, 20 Jan 2024 16:30:57 +0000 (17:30 +0100)]
netpfil: Fix two typos in source code comments

- s/withing/within/

(cherry picked from commit 938918a9f478e94fbe65ba84510e4755024560be)

4 months agovmware: Fix a typo in a source code comment
Gordon Bergling [Sat, 20 Jan 2024 16:33:27 +0000 (17:33 +0100)]
vmware: Fix a typo in a source code comment

- s/withing/within/

(cherry picked from commit 623848af604116aa33bc8a66d2ac45b4cbaccfd8)

4 months agousb: Fix two typos in source code comments
Gordon Bergling [Sat, 20 Jan 2024 16:32:20 +0000 (17:32 +0100)]
usb: Fix two typos in source code comments

- s/bascially/basically/
- s/assistence/assistance/

(cherry picked from commit f5e3329a5a480aa1b2904106b2fdfd999439455b)

4 months agociss(4): Fix a typo in a source code comment
Gordon Bergling [Sat, 20 Jan 2024 16:34:25 +0000 (17:34 +0100)]
ciss(4): Fix a typo in a source code comment

- s/strucutre/structure/

(cherry picked from commit ced92d000a9435745ca2891734e6e37ab1c5e873)

4 months agotcp_hpts: Fix a typo of a function name in a comment
Gordon Bergling [Sat, 20 Jan 2024 16:29:28 +0000 (17:29 +0100)]
tcp_hpts: Fix a typo of a function name in a comment

- s/tcp_ouput/tcp_output/

(cherry picked from commit ef0ac0a1ad6750291b881203030384b7f7241efb)

4 months agoPCI_IOV_INIT.9: Fix a typo in the manual page
Gordon Bergling [Sat, 20 Jan 2024 19:20:32 +0000 (20:20 +0100)]
PCI_IOV_INIT.9: Fix a typo in the manual page

- s/infrastucture/infrastructure/

(cherry picked from commit bce295fcbe533d46d2f600168403c7968599b86b)

4 months agodevfs(5): Fix a typo in a source code comment
Gordon Bergling [Sat, 20 Jan 2024 16:25:45 +0000 (17:25 +0100)]
devfs(5): Fix a typo in a source code comment

- s/interpeted/interpreted/

(cherry picked from commit 7cf293536ebacc92150be12e0be928500e670610)

4 months agosigfastblock.2: Fix a typo in the manual page
Gordon Bergling [Sat, 20 Jan 2024 18:54:33 +0000 (19:54 +0100)]
sigfastblock.2: Fix a typo in the manual page

- s/successfull/successful/

(cherry picked from commit a70008e95b907336bddbcc2aa9d567df6e3a41b6)

4 months agopkru.3: Fix a typo in the manual page
Gordon Bergling [Sat, 20 Jan 2024 18:55:08 +0000 (19:55 +0100)]
pkru.3: Fix a typo in the manual page

- s/successfull/successful/

(cherry picked from commit 8593b5b2addf91987f81ebac0d8b2e51207e4793)

4 months agoinpcb: Allow SO_REUSEPORT_LB to be used in jails
Mark Johnston [Wed, 2 Nov 2022 17:08:07 +0000 (13:08 -0400)]
inpcb: Allow SO_REUSEPORT_LB to be used in jails

Currently SO_REUSEPORT_LB silently does nothing when set by a jailed
process.  It is trivial to support this option in VNET jails, but it's
also useful in traditional jails.

This patch enables LB groups in jails with the following semantics:
- all PCBs in a group must belong to the same jail,
- PCB lookup prefers jailed groups to non-jailed groups

This is a straightforward extension of the semantics used for individual
listening sockets.  One pre-existing quirk of the lbgroup implementation
is that non-jailed lbgroups are searched before jailed listening
sockets; that is preserved with this change.

Discussed with: glebius
MFC after: 1 month
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37029

(cherry picked from commit d93ec8cb1324d04d7cae19fb7fa98ade2ff33c80)

4 months agoinpcb: Remove a PCB from its LB group upon a subsequent error
Mark Johnston [Wed, 2 Nov 2022 17:05:14 +0000 (13:05 -0400)]
inpcb: Remove a PCB from its LB group upon a subsequent error

If a memory allocation failure causes bind to fail, we should take the
inpcb back out of its LB group since it's not prepared to handle
connections.

Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37027

(cherry picked from commit a152dd863418638c3eb08b5c101b10b82f8072f5)

4 months agoinpcb: Remove NULL checks of credential references
Mark Johnston [Wed, 2 Nov 2022 17:03:41 +0000 (13:03 -0400)]
inpcb: Remove NULL checks of credential references

Some auditing of the code shows that "cred" is never non-NULL in these
functions, either because all callers pass a non-NULL reference or
because they unconditionally dereference "cred".  So, let's simplify the
code a bit and remove NULL checks.  No functional change intended.

Reviewed by: glebius
MFC after: 1 week
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37025

(cherry picked from commit ac1750dd143e53225c518bc1ca0462c3fffe10f6)

4 months agorouting: plug mbuf leak for the packets hitting IPv6 blackhole route
Alexander V. Chernikov [Wed, 17 May 2023 09:06:04 +0000 (09:06 +0000)]
routing: plug mbuf leak for the packets hitting IPv6 blackhole route

Reported by: Dmitriy Smirnov <fox@sage.su>
Tested by: Dmitriy Smirnov <fox@sage.su>
MFC after: 1 day

(cherry picked from commit b50e1465e88dcf5f6f008892d802df010e7029d1)

4 months agoarm64: fix db_read_bytes() for size == 8
Mitchell Horne [Wed, 17 Jan 2024 16:45:41 +0000 (12:45 -0400)]
arm64: fix db_read_bytes() for size == 8

There is a mistake in the cast, resulting in a truncated read to tmp64.
Switch from int to uint64_t, and adjust the other casts for clarity.

Add a comment explaining why we do this at all.

Reported by: dfr
Reviewed by: dfr, mmel, emaste, jhb (all a previous version)
PR: 276406
Fixes: a67687fcd8f5 ("Use native-sized accesses when accessing memory from kdb")
Differential Revision: https://reviews.freebsd.org/D43479

(cherry picked from commit 9c2e1a54f71a399fc4645c4b8bed044705629143)

4 months agobhyveload(8): document some SECURITY CONSIDERATIONS
Kyle Evans [Fri, 12 Jan 2024 19:57:53 +0000 (13:57 -0600)]
bhyveload(8): document some SECURITY CONSIDERATIONS

The situation is improved now that we're running in a sandbox, but there
is still some host machine access that could be concerning depending on
the context.  These concerns may be somewhat mitigated by the fact that
the host machine usually provides the loader binary, even when the guest
image is providing the loader scripts -- they only bring the lua
scripts, and they have to be able to execute arbitrary syscalls rather
than the interfaces provided by libsa(3).

Reviewed by: jhb, markj

(cherry picked from commit 5df041c4bbf70d549b055f332630925295ad5aaf)

4 months agobhyveload: add CAP_SEEK to our dirfd rights
Kyle Evans [Tue, 9 Jan 2024 03:08:16 +0000 (21:08 -0600)]
bhyveload: add CAP_SEEK to our dirfd rights

In the case of hostbase_fd, this is infact a bug fix; we have a seek
callback that the host: filesystem may use in loader, and we really
don't have a good excuse to break it.

bootfd-derived fds will only be used with fdlopen(3) and rtld doesn't
seem to need pread / lseek at all for it today, but there's no reason to
break if it finds a good reason to later.

Suggested by: markj

(cherry picked from commit cef5e56f3fea33d6c421276af49f2967453ad4ff)

4 months agobhyveload: make error printing consistent
Kyle Evans [Mon, 8 Jan 2024 17:49:40 +0000 (11:49 -0600)]
bhyveload: make error printing consistent

Previously we used a mix of perror(3) + exit(3) and err(3); standardize
on the latter instead.  This does remove one free() in an error path,
because we're decidedly leaking a lot more than just the loader name
there (loader handle, vcpu, vmctx...) anyways.

Reviewed by: markj

(cherry picked from commit a4a838a31ac24e19c8ee68d45cf5234615d0b958)

4 months agobhyveload: support guest rebooting from the loader
Kyle Evans [Fri, 5 Jan 2024 06:21:15 +0000 (00:21 -0600)]
bhyveload: support guest rebooting from the loader

userboot has a EXIT_REBOOT code that it uses when the 'reboot' loader
command is executed.  Use that and longjmp back to reinit the VM
entirely with a reboot request.  This fixes the 'reboot' option in the
loader menu to actually reboot rather than shutdown the VM.

The JMP_* constants are introduced to keep track of why we're doing a
longjmp, though they aren't currently used.  We'll notably still do a
complete reload of the interpreter to give the rebooted VM that new
loader smell.  It just seemed forward thinking to just keep track of the
different setjmp points.

While we're here, we don't actually need to keep the fd we passed to
fdlopen(3), so let's avoid leaking it.

Reviewed by: markj

(cherry picked from commit 24cd5c26fe3ef7181e85467d9d55afbd76af5a2c)

4 months agobhyveload: limit rights on the dirfds we create
Kyle Evans [Fri, 5 Jan 2024 06:21:14 +0000 (00:21 -0600)]
bhyveload: limit rights on the dirfds we create

In neither case do we need write access to the directories we're working
with; userboot doesn't support fo_write on the host device, and the
bootfd is only ever needed for loader loading.

This improves on 8bf0882e18 ("bhyveload: enter capability mode [...]")
so that arbitrary code in the loader can't open writable fds to either
of the directories we need to maintain access to.

Reviewed by: imp

(cherry picked from commit c067be72e835e469518ec985b6cc4e475c378944)
(cherry picked from commit f9b17005bf8f1a30e2a74a3e66c92e34aa87f9bf)

4 months agobhyveload: enter capability mode after we setup the vcpu
Kyle Evans [Wed, 3 Jan 2024 22:18:00 +0000 (16:18 -0600)]
bhyveload: enter capability mode after we setup the vcpu

Reviewed by: allanjude (earlier version), emaste, markj

(cherry picked from commit 8bf0882e186effbd3d742ce17613cf9dfb81ce0c)

4 months agobhyveload: hold /boot and do relative lookups for the loader
Kyle Evans [Wed, 3 Jan 2024 22:17:59 +0000 (16:17 -0600)]
bhyveload: hold /boot and do relative lookups for the loader

The next change will push bhyveload into capability mode right after we
allocate vcpu state, before we've setup or entered the loader, to limit
the surface area that a rogue loader script can touch.

With an explicit -l loader, we don't need to preopen /boot because
changing interpreters isn't allowed.  We'll just dlopen() entirely in
advance in that case to eliminate some complexity.

Reviewed by: allanjude (earlier version), markj

(cherry picked from commit bf7c4fcbbb05ff99afde0744d013feeb35d77191)
(cherry picked from commit 67082f077f39d9c7b7bd561c14622e6f3ef23681)

4 months agoroute: error on IPv4 network routes with incorrect destination
Mike Karels [Mon, 15 Jan 2024 21:14:54 +0000 (15:14 -0600)]
route: error on IPv4 network routes with incorrect destination

Route destinations like 10/8 are most likely intended as a shorthand
for 10.0.0.0/8, but instead it means 0.0.0.10/8, which includes
only bits in the host part of the mask, and hence adds a route to
0.0.0.0/8.  In 12.x, there was code to "do what I mean", which was
removed as part of a cleanup of old network class remnants.  Given
that we have gone this long without that code, do not restore that
behavior.  Instead, detect the issue and produce an error.
Specifically, if there are no dots in a numeric IPv4 address, the
mask is specified with CIDR notation (using a slash), and there are
bits set in the host part, produce an error like this for 10/8:

    route: malformed address, bits set after mask; 10 means 0.0.0.10

PR: 258874
Reviewed by: melifaro, emaste
Differential Revision: https://reviews.freebsd.org/D43384

(cherry picked from commit b9e8ae1d8a424194b4e185359da4ded163f24f4e)

4 months agorelease/oci.conf: add missing vm_extra_pre_umount() steps
Ed Maste [Wed, 24 May 2023 15:45:29 +0000 (11:45 -0400)]
release/oci.conf: add missing vm_extra_pre_umount() steps

vm.subr's default vm_extra_pre_umount removes /qemu and
/etc/resolv.conf.  When vm_extra_pre_umount is overridden these steps
need to be performed in the cloud-specific conf file.

PR: 271602
Reviewed by: dch, lwhsu
Event: Kitchener-Waterloo Hackathon 202305
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40257

(cherry picked from commit ae60012e46ecfe59a3506b903e685b6a3347807b)

4 months agomakefs: Handle missing link keyword in mtree spec
Stéphane Rochoy [Thu, 21 Sep 2023 07:14:20 +0000 (09:14 +0200)]
makefs: Handle missing link keyword in mtree spec

PR: 241178
Reviewed by: emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/850

(cherry picked from commit d26c1a0f8bceb6748436fe3fc57bac3ef8179dd3)
(cherry picked from commit be31bd59895e57fb7359de870ea3ecc19e3d1ae1)

4 months agopci_vendors: update to 2023-11-11
Baptiste Daroussin [Mon, 4 Dec 2023 10:51:59 +0000 (11:51 +0100)]
pci_vendors: update to 2023-11-11

(cherry picked from commit 01e286b54190620ceec85ef865a51eb79b5d81c0)

4 months agojail: add security.jail.mlock_allowed
Baptiste Daroussin [Thu, 4 Jan 2024 14:09:44 +0000 (15:09 +0100)]
jail: add security.jail.mlock_allowed

when the parameter allow.mlock was added a way for jails to check
if the parameter was set or now has not been added, this change
covers it.

MFC After: 3 days
Reviewed by: jamie@
Differential Revision: https://reviews.freebsd.org/D43314

(cherry picked from commit 9fd978680db6495180a4d46f76529d344b003c80)

4 months agolinuxkpi: correct zone item size for linux_mm_zone
Konstantin Belousov [Sun, 14 Jan 2024 21:00:18 +0000 (23:00 +0200)]
linuxkpi: correct zone item size for linux_mm_zone

(cherry picked from commit 4958df5dabce62ef4e9e96b0d1bf62f3a6cce689)

4 months agorenice: Clean up the tests a bit.
Dag-Erling Smørgrav [Wed, 20 Dec 2023 16:59:37 +0000 (17:59 +0100)]
renice: Clean up the tests a bit.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: ngie, asomers
Differential Revision: https://reviews.freebsd.org/D43087

(cherry picked from commit afdce0837014fb7a41fced959c9457f89e878052)

4 months agorenice: Force /bin/sh usage on su calls for the regression tests.
Olivier Cochard [Thu, 13 Oct 2022 15:23:54 +0000 (17:23 +0200)]
renice: Force /bin/sh usage on su calls for the regression tests.

If the root account is configured to use a different shell than sh,
it fails to retreive the pid of the background process.

Approved by: des
Obtained from: chs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36930

(cherry picked from commit 07b1ea961af77d728dfef4d0a11f98a8ab2fe226)

4 months agovm/vm_object.c: minor cleanup
Konstantin Belousov [Sat, 13 Jan 2024 01:44:39 +0000 (03:44 +0200)]
vm/vm_object.c: minor cleanup

(cherry picked from commit 69748e62e82a1f5ef77fd3e1b0c9d7e6a89d22b2)

4 months agoAdd a regression test for PR 276191.
Alan Somers [Mon, 8 Jan 2024 01:03:40 +0000 (18:03 -0700)]
Add a regression test for PR 276191.

The bug isn't fusefs-specific, but this is the easiest way to reproduce
it.

PR: 276191
MFC with: bdb46c21a3e68d4395d6e0b6a205187e655532b0
Differential Revision:  https://reviews.freebsd.org/D43446
Reviewed by:  kib

(cherry picked from commit 6b1c534927ad47e9b0dd8be1a39f56c3ea813d44)

4 months agonfsstat: make -q work without -e/-E
Lexi Winter [Thu, 28 Dec 2023 12:56:57 +0000 (12:56 +0000)]
nfsstat: make -q work without -e/-E

Pull Request: https://github.com/freebsd/freebsd-src/pull/961

(cherry picked from commit f79b200b6aefb9bdcbe931c5b7ea604e259beee0)

4 months agonfsstat: update option strings in docs
Lexi Winter [Wed, 27 Dec 2023 17:30:31 +0000 (17:30 +0000)]
nfsstat: update option strings in docs

Add the missing -q option to the nfsstat(1) manpage SYNOPSIS (it is
already documented in DESCRIPTION), and add the missing -E and -q
options to the built-in usage output.

PR: 275912
Pull Request: https://github.com/freebsd/freebsd-src/pull/958

(cherry picked from commit 30ce26cacfd626552c647c9327dd510e7f421d97)

4 months agoFix multiple bugs with ctld's UCL parsing
Alan Somers [Mon, 9 Oct 2023 18:26:25 +0000 (12:26 -0600)]
Fix multiple bugs with ctld's UCL parsing

* Don't segfault when parsing a misformatted auth-group section
* If the config file specifies a chap section within a target but no
  auth-group, create a new anonymous auth-group.  That matches the
  behavior with non-UCL config files.
* Protect some potential segfaults with assertions

PR: 274380
Sponsored by: Axcient
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D43198

(cherry picked from commit 2391e536c01cb51d2a2c11a0f5820481314e9ec2)

4 months agoRemove _POSIX_PRIORITIZED_IO references from man pages
Alan Somers [Wed, 15 Nov 2023 17:56:05 +0000 (10:56 -0700)]
Remove _POSIX_PRIORITIZED_IO references from man pages

We don't support it, so there's no need to tell readers what would
happen if we did.  Also, don't remind the user that a certain field is
ignored by aio_read.  Mentioning every ignored field would make the man
pages too verbose.

Sponsored by: Axcient
Reviewed by: Pau Amma <pauamma@gundo.com>
Differential Revision: https://reviews.freebsd.org/D42622

(cherry picked from commit 18e2c4175f78f1aaa648dd7fb7530220aed23671)

4 months agocap_net.3: remove a copypasta
Alan Somers [Tue, 5 Dec 2023 23:23:29 +0000 (16:23 -0700)]
cap_net.3: remove a copypasta

This line appears to have been copied from cap_sysctl.3.  While I'm
here, reorder and reword the description of cap_net_limit a bit.

[skip ci]

Sponsored by: Axcient
Reviewed by: oshogbo
Differential Revision: https://reviews.freebsd.org/D42919

(cherry picked from commit 6b96125afdf245ae61dd82b59891ad0d6aab0066)

4 months agosigaction.2: clarify that fork isn't async-signal-safe, but _Fork is
Alan Somers [Fri, 1 Dec 2023 15:19:24 +0000 (08:19 -0700)]
sigaction.2: clarify that fork isn't async-signal-safe, but _Fork is

[skip ci]

Sponsored by: Axcient
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D42865

(cherry picked from commit c2ed7a63604fc86244adee2966e19f8aba2a07cb)

4 months agozfsd: fault disks that generate too many I/O delay events
Alan Somers [Wed, 12 Jul 2023 20:46:27 +0000 (14:46 -0600)]
zfsd: fault disks that generate too many I/O delay events

If ZFS reports that a disk had at least 8 I/O operations over 60s that
were each delayed by at least 30s (implying a queue depth > 4 or I/O
aggregation, obviously), fault that disk.  Disks that respond this
slowly can degrade the entire system's performance.

Sponsored by: Axcient
Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D42825

(cherry picked from commit d565784a7ebaa59e26febdcfd4a60329786ea5f5)

4 months agoiichid(4): Switch taskqueue to "fast"
Alexander Motin [Wed, 27 Dec 2023 00:36:34 +0000 (19:36 -0500)]
iichid(4): Switch taskqueue to "fast"

While "fast" taskqueue may be more expensive due to spinlock use,
when used mainly for timeout tasks it allows to avoid extra context
switches to and from callout thread, that is even more expensive.

MFC after: 1 month

(cherry picked from commit 358453ce9bdd99eb69641b02f2d7e29cedecbe27)

4 months agoiichid(4): Unify two taskqueue tasks
Alexander Motin [Wed, 27 Dec 2023 00:28:56 +0000 (19:28 -0500)]
iichid(4): Unify two taskqueue tasks

taskqueue_enqueue_timeout(0) is equivalent to taskqueue_enqueue(),
so no need to create a separate periodic_task and event_task to run
exactly the same handler.

MFC after: 1 month

(cherry picked from commit a8f80c0c16c7fb38c46ddccd7e1b06dc46c407b1)

4 months agoiichid(4): Restore/increase sampling rate
Alexander Motin [Sun, 24 Dec 2023 00:10:49 +0000 (19:10 -0500)]
iichid(4): Restore/increase sampling rate

My previous commit by reducing precision reduced the sampling rate
from 60Hz to 40Hz on idle system.  Return it back to 60-80Hz range,
that should be good for mouse smoothness on 60Hz displays.

MFC after: 1 months

(cherry picked from commit 68e457df0268113646264883515412af4c8808cb)

4 months agoiicbb: Fix pause_sbt() arguments order
Alexander Motin [Sat, 23 Dec 2023 23:52:17 +0000 (18:52 -0500)]
iicbb: Fix pause_sbt() arguments order

It should make pause interval less strict.

While there, add cpu_spinwait() into a tight spin wait loop to burn
less power and let other SMT thread work more.

MFC after: 1 month

(cherry picked from commit a74df3f96e3ea4cc632088be870d9b0b0198859c)

4 months agoiichid(4): Improve idle sampling hysteresis
Alexander Motin [Sat, 23 Dec 2023 03:50:52 +0000 (22:50 -0500)]
iichid(4): Improve idle sampling hysteresis

In sampling mode some devices return same data indefinitely even if
there is nothing to report.  Previous idle hysteresis implementation
activated only when device returned no data, so some devices ended up
polled at fast rate all the time.  This new implementation compares
each new report with the previous, and, if they are identical, after
reaching threshold also drop sampling rate to slow.

On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
reduces idle power consumption by ~0.5W by reducing number of context
switches in the driver from ~4000 to ~700 per second when not touched.

MFC after: 1 month

(cherry picked from commit 8c86b981240324c1daaa387d4d3f8e3e53db3d2e)

4 months agoig4: Actively use FIFO thresholds
Alexander Motin [Sun, 24 Dec 2023 23:18:11 +0000 (18:18 -0500)]
ig4: Actively use FIFO thresholds

Before every wait for FIFO interrupt set how much data/space do we
want to see there.  Previous code was not using it for receive, as
result aggregating interrupts only within processing latency.  The
new code needs only one interrupt per transfer per FIFO length.

On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
reduces the interrupt rate per device down to 2 per sample or 16-20
per second when idle and 120-160 per second when actively touched.

MFC after: 1 month

(cherry picked from commit 13037eaabede7fb7fbc25f4e84b549c73f9acb3c)

4 months agoig4: Fix FIFO depths detection
Alexander Motin [Sun, 24 Dec 2023 00:02:49 +0000 (19:02 -0500)]
ig4: Fix FIFO depths detection

At least on my Tiger Lake-LP queue depth detection failed before the
ig4iic_set_config() call, resulting in no FIFO use.  Moving it after
solves the problem, getting proper 64 bytes size.

On my Dell XPS 13 9310 with iichid(4) touchscreen and touchpad this
by few times reduces context switch rate in the driver, and probably
also improves the I2C bus utilization.

MFC after: 1 month

(cherry picked from commit 9c9d7fdd9f0041783955c5f540ac55a900877c0c)

4 months agoispfw(4): Update and add firmware
Joerg Pulz [Fri, 27 Oct 2023 14:02:07 +0000 (16:02 +0200)]
ispfw(4): Update and add firmware

Update 25xx firmware: version 8.8.207
Add 26xx firmware: version 8.8.231
Add 27xx firmware: version 9.12.0
Add 28xx firmware: version 9.12.1

Remove BUGS section from manpage as we now have firmware for
all supported controllers.

PR: 273263
MFC after: 1 month
Pull Request: https://github.com/freebsd/freebsd-src/pull/877
Sponsored by: Technical University of Munich

(cherry picked from commit b0c6b06836351b3908ba5b2a847c89c42d1a46c3)

4 months agoisp: Fix endianness conversion in isp_read_flash_data()
Mark Johnston [Sun, 31 Dec 2023 23:52:52 +0000 (18:52 -0500)]
isp: Fix endianness conversion in isp_read_flash_data()

Reported by: Jenkins
Fixes: 10ed63fc06cb ("isp(4): Rework firmware handling/loading")

(cherry picked from commit 91d2a093dfaccdf288db663b6e9d47539ea1c1bf)

4 months agoisp(4): Rework firmware handling/loading
Joerg Pulz [Fri, 27 Oct 2023 15:27:37 +0000 (17:27 +0200)]
isp(4): Rework firmware handling/loading

Correctly identify the active firmware in flash on adapters with
primary and secondary firmware region in flash.
Correctly identify the active NVRAM on adapters with primary
and secondary NVRAM region in flash.

Loading ispfw(4) moved from isp_pci_attach() to isp_reset().
Drop the reference to ispfw(4) after using it so one can kldunload(8) it.
New isp_load_ram() function to load either ispfw(4) or flash firmware
into RISC's RAM.
New functions to read data from flash. The old ones will be removed later.
A bunch of new helper functions to identify and validate active flash
regions for firmware, auxiliary and NVRAM.
Overhaul ISP_FW_* macros and make use of it when comparing firmware
versions. We can handle firmware versions up to 255.255.255.

Firmware load priority slightly changed:
For 27xx and newer adapters:
- load ispfw(4) firmware
- request (active) flash firmware information
- compare version numbers of ispfw(4) and flash firmware
- load firmware with highest version into RISC's RAM
- if loading ispfw(4) is disabled or failed - load firmware from flash
- if everything else fails use MBOX_LOAD_FLASH_FIRMWARE as fallback

For 26xx and older adapters nothing changed:
- load ispfw(4) firmware and load it into RISC's RAM
- if loading ispfw(4) is disabled or failed use MBOX_EXEC_FIRMWARE
- for 26xx a preceding MBOX_LOAD_FLASH_FIRMWARE is used

New read only sysctl(8)'s:
 dev.isp.N.fw_version_run: the firmware version actually running
 dev.isp.N.fw_version_ispfw: the firmware version provided by ispfw(4)
 dev.isp.N.fw_version_flash: the (active) firmware version in flash

While here:
  - firmware attribute handling/parsing reworked
    + renamed defines from ISP2400_FW_ATTR_* to ISP_FW_ATTR_*
    + changed values to match new handling/parsing
    + added some more attributes
  - enable FLT support on 26xx based adapters
  - log level adjustments
  - new function return status codes (some for now, some for later use)
  - some minor style changes

Tested and approved to work on real hardware with:
  - Qlogic ISP 2532 (QLogic QLE2560 8Gb FC Adapter)
  - Qlogic ISP 2031 (QLogic QLE2662 16Gbit 2Port FC Adapter)
  - Qlogic ISP 2722 (QLogic QLE2690 16Gb FC Adapter)
  - Qlogic ISP 2812 (QLogic QLE2772 32Gbit 2Port FC Adapter)

PR: 273263
Reviewed by: mav
Pull Request: https://github.com/freebsd/freebsd-src/pull/877
MFC after: 1 month
Sponsored by: Technical University of Munich

(cherry picked from commit 10ed63fc06cb9902cc783ce8d0086c9aa97ed1e1)

4 months agoisp(4): Style changes
Joerg Pulz [Fri, 7 Jul 2023 21:43:35 +0000 (15:43 -0600)]
isp(4): Style changes

Please tools/build/checkstyle9.pl as mentioned by imp@

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726

(cherry picked from commit 348ec8dc036bf4ba1f607bb8acb25a0358436cc7)

4 months agoisp(4): Remove redundant functions for reading data from FLT and flash
Joerg Pulz [Fri, 7 Jul 2023 21:43:34 +0000 (15:43 -0600)]
isp(4): Remove redundant functions for reading data from FLT and flash

Rename isp_rd_2400_nvram to isp_rd_2xxx_flash.
Cleanup some leftovers.
Hide all output regarding FLT parsing behind ISP_LOGDEBUG0.

Thanks to imp@ and mav@ for reviewing and commenting.

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726

(cherry picked from commit 295fd9c1caeb42a4c93005080320d011bf01e4c0)

4 months agoisp(4): Use the FLT on all supported controllers
Joerg Pulz [Fri, 7 Jul 2023 21:43:34 +0000 (15:43 -0600)]
isp(4): Use the FLT on all supported controllers

The ISP26xx based HBAs are left as is for now with static NVRAM addressing.
Those HBAs are known as 83xx (2031 and 8031 for real) and need special handling.
This is left for further investigation for now.

Cosmetics:
  - rename functions and defines as they are no longer specific to 28xx
  - set reasonable log levels
  - sort FLT and NVRAM functions (in the order they are used)

Tested and approved to work on real hardware with:
  - Qlogic ISP 2532 (QLogic QLE2562 8Gb 2Port FC Adapter)
  - Qlogic ISP 2722 (QLogic QLE2690 16Gb FC Adapter)
  - Qlogic ISP 2812 (QLogic QLE2772 32Gbit 2Port FC Adapter)

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726

(cherry picked from commit 707e4d1b20aa3983f7cd2f444d6ce41eebc02698)

4 months agoisp(4): Add support to read contents of the FLT (flash layout table)
Joerg Pulz [Fri, 7 Jul 2023 21:43:34 +0000 (15:43 -0600)]
isp(4): Add support to read contents of the FLT (flash layout table)

The FLT is like a TOC for the flash area and contains entries for every flash
region with start/end address, size and flags.
Start using NVRAM addresses from FLT instead of hardcoded ones for ISP28xx
based HBAs.

The FLT should be available on earlier HBAs too, probably since ISP24xx based.
This needs further investigation and testing.

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726

(cherry picked from commit 27b4a1b7e5b871c248dc501aa359c93f7263b074)

4 months agoisp(4): Fix reading NVRAM contents for 28xx based devices
Joerg Pulz [Fri, 7 Jul 2023 21:43:34 +0000 (15:43 -0600)]
isp(4): Fix reading NVRAM contents for 28xx based devices

Use correct NVRAM address for ISP28xx based HBAs to read NVRAM contents.
  WWPN/WWNN and framesize are correctly read from NVRAM now.

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726

(cherry picked from commit f76f7fefa1bb5dc2ec0c9e44740faac0b46dac25)

4 months agoisp(4): Add support for QLogic 28xx devices
Joerg Pulz [Fri, 7 Jul 2023 21:43:34 +0000 (15:43 -0600)]
isp(4): Add support for QLogic 28xx devices

This covers the following HBAs:
  ISP2812-based 64/32G Fibre Channel to PCIe Controller:
    QLE2770 Single Port 32GFC PCIe Gen4 x8 Adapter
    QLE2772 Dual Port 32GFC PCIe Gen4 x8 Adapter
    QLE2870 Single Port 64GFC PCIe Gen4 x8 Adapter
    QLE2872 Dual Port 64GFC PCIe Gen4 x8 Adapter

  ISP2814-based 64/32G Fibre Channel to PCIe Controller:
    QLE2774 Quad Port 32GFC PCIe Gen4 x16 Adapter
    QLE2874 Quad Port 64GFC PCIe Gen4 x16 Adapter

While here, add required bits to support 64GB FC.

Default framesize is set to 2048 for ISP28xx based HBAs for now.

PR: 271062
Reviewed by: imp, mav
Sponsored by: Technical University of Munich
Pull Request: https://github.com/freebsd/freebsd-src/pull/726

(cherry picked from commit 407abff6a445c8db335093868e9e7e70438c5901)

4 months agoisp: Remove unused variable.
John Baldwin [Tue, 12 Apr 2022 21:58:59 +0000 (14:58 -0700)]
isp: Remove unused variable.

(cherry picked from commit e4d4beba435815841616d8c4e1e94d3ff00fc36b)

4 months agoacpi_cpu: Reduce BUS_MASTER_RLD manipulations
Alexander Motin [Tue, 26 Dec 2023 02:19:28 +0000 (21:19 -0500)]
acpi_cpu: Reduce BUS_MASTER_RLD manipulations

Instead of setting and clearing BUS_MASTER_RLD register on every C3
state enter/exit, set it only once if the system supports C3 state
and we are going to "disable" bus master arbitration while in it.

This is what Linux does for the past 14 years, and for even more time
this register is not implemented in a relevant hardware.  Same time
since this is only a single bit in a bigger register, ACPI has to
do take a global lock and do read-modify-write for it, that is too
expensive, saved only by C3 not entered frequently, but enough to be
seen in idle system CPU profiles.

MFC after: 1 month

(cherry picked from commit 5bc10feacc9d81e3bba9d28734a85e996682b408)