Re: git: 7a7741af18d6 - main - zfs: merge openzfs/zfs@b10992582

2024-10-11 Thread FreeBSD User
Am Fri, 11 Oct 2024 06:48:36 GMT
Martin Matuska  schrieb:

This commit break buildworld:

[...]
===> cddl/lib/libzfsbootenv (all)
--- all_subdir_cddl/lib/libzpool ---
--- arc_os.pico ---
/usr/src/sys/contrib/openzfs/module/os/linux/zfs/arc_os.c:45:10: fatal error: 
'sys/shrinker.h'
file not found 45 | #include 



Kind regards,
oh

> The branch main has been updated by mm:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=7a7741af18d6c8a804cc643cb7ecda9d730c6aa6
> 
> commit 7a7741af18d6c8a804cc643cb7ecda9d730c6aa6
> Merge: 3e501ef89667 3a9fca901b44
> Author: Martin Matuska 
> AuthorDate: 2024-10-11 06:39:18 +
> Commit: Martin Matuska 
> CommitDate: 2024-10-11 06:43:49 +
> 
> zfs: merge openzfs/zfs@b10992582
> 
> Notable upstream pull request merges:
>  #9416  -multiple zio_compress: introduce max size threshold
>  #10018 a10e552b9 Adding Direct IO Support
>  #15147 e419a63bf xattr dataset prop: change defaults to sa
>  #15454 7e957fde7 send/recv: open up additional stream feature flags
>  #15810 0d77e738e Defer resilver only when progress is above a threshold
>  #15921 3cf2bfa57 Allocate zap_attribute_t from kmem instead of stack
>  #16483 -multiple dmu_objset: replace dnode_hash impl with cityhash4
>  #16485 8be2f4c3d zio_resume: log when unsuspending the pool
>  #16491 88433e640 sys/types32.h: Remove struct timeval32 from libspl 
> header
>  #16496 f245541e2 zfs_file: implement zfs_file_deallocate for FreeBSD 14
>  #16511 308f7c2f1 Fix an uninitialized data access
>  #16529 29c9e6c32 Fix handling of DNS names with '-' in them for sharenfs
>  #16531 ddf5f34f0 Avoid fault diagnosis if multiple vdevs have errors
>  #16539 6f50f8e16 zfs_log: add flex array fields to log record structs
>  #16546 d40d40913 Evicting too many bytes from MFU metadata
>  #16551 3014dcb76 Reduce and handle EAGAIN errors on AIO label reads
>  #16554 80645d658 FreeBSD: restore zfs_znode_update_vfs()
>  #16565 832f66b21 FreeBSD: Sync taskq_cancel_id() returns with Linux
>  #16567 48d1be254 Properly release key in spa_keystore_dsl_key_hold_dd()
>  #16569 141368a4b Restrict raidz faulted vdev count
>  #16583 c84a37ae9 lua: add flex array field to TString type
>  #16584 86737c592 Avoid computing strlen() inside loops
>  #16587 d34d4f97a snapdir: add 'disabled' value to make .zfs inaccessible
>  #16593 224393a32 feature: large_microzap
>  #16597 412105977 Temporarily disable Direct IO by default
>  #16605 4ebe674d9 ARC: Cache arc_c value during arc_evict()
> 
> Backported pull request merges:
>  #16613 ab777f436 Return boolean_t in inline functions of
>   lib/libspl/include/sys/uio.h
>  #16616 efeb60b86 FreeBSD: ignore some includes when not building kernel
>  #16635 ---TBD--- zdb: fix printf format in dump_zap()
> 
> Obtained from:  OpenZFS
> OpenZFS commit: b109925820fb79db3e37670c159977f03edd950f
> OpenZFS tag:2.3.0-rc1
> 
>  cddl/lib/libzdb/Makefile   |   1 +
>  cddl/lib/libzfs_core/Makefile  |   1 +
>  cddl/lib/libzfsbootenv/Makefile|   1 +
>  cddl/lib/libzpool/Makefile |  18 +-
>  cddl/lib/libzutil/Makefile |   1 +
>  cddl/lib/pam_zfs_key/Makefile  |   1 +
>  cddl/share/zfs/compatibility.d/Makefile|  12 +-
>  stand/libsa/zfs/Makefile.inc   |   2 +-
>  sys/conf/files |   4 +-
>  sys/contrib/openzfs/.github/CONTRIBUTING.md|  18 +-
>  .../.github/workflows/build-dependencies.txt   |  57 ---
>  .../.github/workflows/checkstyle-dependencies.txt  |   5 -
>  .../openzfs/.github/workflows/checkstyle.yaml  |  23 +-
>  sys/contrib/openzfs/.github/workflows/codeql.yml   |  10 +-
>  .../openzfs/.github/workflows/scripts/README.md|  14 +
>  .../.github/workflows/scripts/generate-ci-type.py  | 107 +
>  .../.github/workflows/scripts/generate-summary.sh  | 119 --
>  .../.github/workflows/scripts/merge_summary.awk| 109 +
>  .../.github/workflows/scripts/qemu-1-setup.sh  |  91 
>  .../.github/workflows/scripts/qemu-2-start.sh  | 213 +
>  .../.github/workflows/scripts/qemu-3-deps.sh   | 221 ++
>  .../.github/workflows/scripts/qemu-4-build.sh  | 153 +++
>  .../.github/workflows/scripts/qemu-5-setup.sh  | 121 ++
>  .../.github/workflows/scripts/qemu-6-tests.sh  | 105 +
>  .../.github/workflows/scripts/qemu-7-prepare.sh| 123 ++
>  .../.github/workflows/scripts/qemu-8-summary.sh|  71 +++
>  .../workflows/scripts/qemu-9-summary-page.sh   |  57 +++
>  .../workflows/scripts/setup-dependencies.sh|  88 
>  .../.github/workflows/scripts/setup-functional.sh  |  24 --
>  .../openzfs/.github/workflows/zfs-linux-tests.yml  | 124 --
>  .../openzfs/.github/w

Re: git: 7a7741af18d6 - main - zfs: merge openzfs/zfs@b10992582

2024-10-11 Thread Martin Matuska
It builds fine with me. Looks like arc_os.c is read from the wrong place 
if depend is not cleaned and has to be added to 
tools/build/depend-cleanup.sh as well


On 11. 10. 2024 9:12, FreeBSD User wrote:

Am Fri, 11 Oct 2024 06:48:36 GMT
Martin Matuska  schrieb:

This commit break buildworld:

[...]
===> cddl/lib/libzfsbootenv (all)
--- all_subdir_cddl/lib/libzpool ---
--- arc_os.pico ---
/usr/src/sys/contrib/openzfs/module/os/linux/zfs/arc_os.c:45:10: fatal error: 
'sys/shrinker.h'
file not found 45 | #include 



Kind regards,
oh


The branch main has been updated by mm:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7a7741af18d6c8a804cc643cb7ecda9d730c6aa6

commit 7a7741af18d6c8a804cc643cb7ecda9d730c6aa6
Merge: 3e501ef89667 3a9fca901b44
Author: Martin Matuska 
AuthorDate: 2024-10-11 06:39:18 +
Commit: Martin Matuska 
CommitDate: 2024-10-11 06:43:49 +

 zfs: merge openzfs/zfs@b10992582
 
 Notable upstream pull request merges:

  #9416  -multiple zio_compress: introduce max size threshold
  #10018 a10e552b9 Adding Direct IO Support
  #15147 e419a63bf xattr dataset prop: change defaults to sa
  #15454 7e957fde7 send/recv: open up additional stream feature flags
  #15810 0d77e738e Defer resilver only when progress is above a threshold
  #15921 3cf2bfa57 Allocate zap_attribute_t from kmem instead of stack
  #16483 -multiple dmu_objset: replace dnode_hash impl with cityhash4
  #16485 8be2f4c3d zio_resume: log when unsuspending the pool
  #16491 88433e640 sys/types32.h: Remove struct timeval32 from libspl header
  #16496 f245541e2 zfs_file: implement zfs_file_deallocate for FreeBSD 14
  #16511 308f7c2f1 Fix an uninitialized data access
  #16529 29c9e6c32 Fix handling of DNS names with '-' in them for sharenfs
  #16531 ddf5f34f0 Avoid fault diagnosis if multiple vdevs have errors
  #16539 6f50f8e16 zfs_log: add flex array fields to log record structs
  #16546 d40d40913 Evicting too many bytes from MFU metadata
  #16551 3014dcb76 Reduce and handle EAGAIN errors on AIO label reads
  #16554 80645d658 FreeBSD: restore zfs_znode_update_vfs()
  #16565 832f66b21 FreeBSD: Sync taskq_cancel_id() returns with Linux
  #16567 48d1be254 Properly release key in spa_keystore_dsl_key_hold_dd()
  #16569 141368a4b Restrict raidz faulted vdev count
  #16583 c84a37ae9 lua: add flex array field to TString type
  #16584 86737c592 Avoid computing strlen() inside loops
  #16587 d34d4f97a snapdir: add 'disabled' value to make .zfs inaccessible
  #16593 224393a32 feature: large_microzap
  #16597 412105977 Temporarily disable Direct IO by default
  #16605 4ebe674d9 ARC: Cache arc_c value during arc_evict()
 
 Backported pull request merges:

  #16613 ab777f436 Return boolean_t in inline functions of
   lib/libspl/include/sys/uio.h
  #16616 efeb60b86 FreeBSD: ignore some includes when not building kernel
  #16635 ---TBD--- zdb: fix printf format in dump_zap()
 
 Obtained from:  OpenZFS

 OpenZFS commit: b109925820fb79db3e37670c159977f03edd950f
 OpenZFS tag:2.3.0-rc1

  cddl/lib/libzdb/Makefile   |   1 +
  cddl/lib/libzfs_core/Makefile  |   1 +
  cddl/lib/libzfsbootenv/Makefile|   1 +
  cddl/lib/libzpool/Makefile |  18 +-
  cddl/lib/libzutil/Makefile |   1 +
  cddl/lib/pam_zfs_key/Makefile  |   1 +
  cddl/share/zfs/compatibility.d/Makefile|  12 +-
  stand/libsa/zfs/Makefile.inc   |   2 +-
  sys/conf/files |   4 +-
  sys/contrib/openzfs/.github/CONTRIBUTING.md|  18 +-
  .../.github/workflows/build-dependencies.txt   |  57 ---
  .../.github/workflows/checkstyle-dependencies.txt  |   5 -
  .../openzfs/.github/workflows/checkstyle.yaml  |  23 +-
  sys/contrib/openzfs/.github/workflows/codeql.yml   |  10 +-
  .../openzfs/.github/workflows/scripts/README.md|  14 +
  .../.github/workflows/scripts/generate-ci-type.py  | 107 +
  .../.github/workflows/scripts/generate-summary.sh  | 119 --
  .../.github/workflows/scripts/merge_summary.awk| 109 +
  .../.github/workflows/scripts/qemu-1-setup.sh  |  91 
  .../.github/workflows/scripts/qemu-2-start.sh  | 213 +
  .../.github/workflows/scripts/qemu-3-deps.sh   | 221 ++
  .../.github/workflows/scripts/qemu-4-build.sh  | 153 +++
  .../.github/workflows/scripts/qemu-5-setup.sh  | 121 ++
  .../.github/workflows/scripts/qemu-6-tests.sh  | 105 +
  .../.github/workflows/scripts/qemu-7-prepare.sh| 123 ++
  .../.github/workflows/scripts/qemu-8-summary.sh|  71 +++
  .../workflows/scripts/qemu-9-summary-page.sh   |  57 +++
  .../workflows/scripts/setup-dependencies.sh|  88 
  .../.github/workflows/scripts/setup-fu

git: 72e277f41aa5 - stable/13 - xen-netfront: attempt to make cleanup idempotent

2024-10-11 Thread Roger Pau Monné
The branch stable/13 has been updated by royger:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=72e277f41aa5c31068c7f9c7e237d2926450a1d8

commit 72e277f41aa5c31068c7f9c7e237d2926450a1d8
Author: Roger Pau Monné 
AuthorDate: 2023-11-03 09:28:16 +
Commit: Roger Pau Monné 
CommitDate: 2024-10-11 07:41:17 +

xen-netfront: attempt to make cleanup idempotent

Current cleanup code assumes that all the fields are allocated and/or setup 
by
the time cleanup is called, but this is not always true: a failure in 
mid-setup
of the device will cause the functions to be called with possibly 
uninitialized
fields.

Fix the functions to cope with such sate, while also attempting to make the
cleanup idempotent.

Finally fix an error path during setup that would not mark the device as
closed, and hence prevents the kernel from finishing booting.

Fixes: 96375eac945c ("xen-netfront: add multiqueue support")
Sponsored by: Citrix Systems R&D

(cherry picked from commit 318bbb6d5a1eae77eb5dc687bcc63c0f99558e21)
---
 sys/dev/xen/netfront/netfront.c | 27 ++-
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c
index f6778fd3759d..391bc17e02d9 100644
--- a/sys/dev/xen/netfront/netfront.c
+++ b/sys/dev/xen/netfront/netfront.c
@@ -539,8 +539,10 @@ talk_to_backend(device_t dev, struct netfront_info *info)
num_queues = max_queues;
 
err = setup_device(dev, info, num_queues);
-   if (err != 0)
+   if (err != 0) {
+   xenbus_dev_fatal(dev, err, "setup device");
goto out;
+   }
 
  again:
err = xs_transaction_start(&xst);
@@ -667,7 +669,10 @@ disconnect_rxq(struct netfront_rxq *rxq)
 
xn_release_rx_bufs(rxq);
gnttab_free_grant_references(rxq->gref_head);
-   gnttab_end_foreign_access(rxq->ring_ref, NULL);
+   if (rxq->ring_ref != GRANT_REF_INVALID) {
+   gnttab_end_foreign_access(rxq->ring_ref, NULL);
+   rxq->ring_ref = GRANT_REF_INVALID;
+   }
/*
 * No split event channel support at the moment, handle will
 * be unbound in tx. So no need to call xen_intr_unbind here,
@@ -682,6 +687,7 @@ destroy_rxq(struct netfront_rxq *rxq)
 
callout_drain(&rxq->rx_refill);
free(rxq->ring.sring, M_DEVBUF);
+   rxq->ring.sring = NULL;
 }
 
 static void
@@ -713,6 +719,8 @@ setup_rxqs(device_t dev, struct netfront_info *info,
 
rxq->id = q;
rxq->info = info;
+
+   rxq->gref_head = GNTTAB_LIST_END;
rxq->ring_ref = GRANT_REF_INVALID;
rxq->ring.sring = NULL;
snprintf(rxq->name, XN_QUEUE_NAME_LEN, "xnrx_%u", q);
@@ -769,7 +777,10 @@ disconnect_txq(struct netfront_txq *txq)
 
xn_release_tx_bufs(txq);
gnttab_free_grant_references(txq->gref_head);
-   gnttab_end_foreign_access(txq->ring_ref, NULL);
+   if (txq->ring_ref != GRANT_REF_INVALID) {
+   gnttab_end_foreign_access(txq->ring_ref, NULL);
+   txq->ring_ref = GRANT_REF_INVALID;
+   }
xen_intr_unbind(&txq->xen_intr_handle);
 }
 
@@ -778,9 +789,14 @@ destroy_txq(struct netfront_txq *txq)
 {
 
free(txq->ring.sring, M_DEVBUF);
+   txq->ring.sring = NULL;
buf_ring_free(txq->br, M_DEVBUF);
-   taskqueue_drain_all(txq->tq);
-   taskqueue_free(txq->tq);
+   txq->br = NULL;
+   if (txq->tq) {
+   taskqueue_drain_all(txq->tq);
+   taskqueue_free(txq->tq);
+   txq->tq = NULL;
+   }
 }
 
 static void
@@ -813,6 +829,7 @@ setup_txqs(device_t dev, struct netfront_info *info,
txq->id = q;
txq->info = info;
 
+   txq->gref_head = GNTTAB_LIST_END;
txq->ring_ref = GRANT_REF_INVALID;
txq->ring.sring = NULL;
 



git: 7174b9817cdd - stable/13 - xen: fix initialization of grant table frame array

2024-10-11 Thread Roger Pau Monné
The branch stable/13 has been updated by royger:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7174b9817cddb72abb9f0d8cec8689b498de1d97

commit 7174b9817cddb72abb9f0d8cec8689b498de1d97
Author: Roger Pau Monné 
AuthorDate: 2023-11-02 17:23:25 +
Commit: Roger Pau Monné 
CommitDate: 2024-10-11 07:40:16 +

xen: fix initialization of grant table frame array

The current sizing of the array used to store grant table frames is broken, 
as
the calculation:

   max_nr_glist_frames = (boot_max_nr_grant_frames *
  GREFS_PER_GRANT_FRAME /
  (PAGE_SIZE / sizeof(grant_ref_t)));

Is plain bogus, for once grant_ref_t is the type of the grant reference, but
not the entry used to store such references in the grant frames.  But even 
if
the above calculation is switched to use grant_entry_v1_t, it would end up 
as:

   max_nr_glist_frames = (boot_max_nr_grant_frames *
  (PAGE_SIZE / sizeof(grant_entry_v1_t)) /
  (PAGE_SIZE / sizeof(grant_entry_v1_t)));

Which is pointless (note GREFS_PER_GRANT_FRAME has been expanded to 
(PAGE_SIZE
/ sizeof(grant_entry_v1_t))).

Just use boot_max_nr_grant_frames directly to size the grant table frames
array.

Fixes: 30d1eefe3937 ("Import OS interfaces to Xen services.")
Sponsored by: Citrix Systems R&D

(cherry picked from commit 1a12f0aea81b57d0dd2374047b8f4c97a037a8df)
---
 sys/dev/xen/grant_table/grant_table.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/sys/dev/xen/grant_table/grant_table.c 
b/sys/dev/xen/grant_table/grant_table.c
index c68c9331233b..df6c13dd8507 100644
--- a/sys/dev/xen/grant_table/grant_table.c
+++ b/sys/dev/xen/grant_table/grant_table.c
@@ -631,20 +631,12 @@ static int
 granttable_attach(device_t dev)
 {
int i;
-   unsigned int max_nr_glist_frames;
unsigned int nr_init_grefs;
 
nr_grant_frames = 1;
boot_max_nr_grant_frames = __max_nr_grant_frames();
 
-   /* Determine the maximum number of frames required for the
-* grant reference free list on the current hypervisor.
-*/
-   max_nr_glist_frames = (boot_max_nr_grant_frames *
-  GREFS_PER_GRANT_FRAME /
-  (PAGE_SIZE / sizeof(grant_ref_t)));
-
-   gnttab_list = malloc(max_nr_glist_frames * sizeof(grant_ref_t *),
+   gnttab_list = malloc(boot_max_nr_grant_frames * sizeof(grant_ref_t *),
M_DEVBUF, M_NOWAIT);
 
if (gnttab_list == NULL)



git: 73c7cb57a4d7 - main - depend-cleanup.sh: Add a rule to work around zfs arc_os.c dependency changes

2024-10-11 Thread Martin Matuska
The branch main has been updated by mm:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=73c7cb57a4d79caa1c6b3f27b49a623d16490b7a

commit 73c7cb57a4d79caa1c6b3f27b49a623d16490b7a
Author: Martin Matuska 
AuthorDate: 2024-10-11 07:22:15 +
Commit: Martin Matuska 
CommitDate: 2024-10-11 07:23:30 +

depend-cleanup.sh: Add a rule to work around zfs arc_os.c dependency changes
---
 tools/build/depend-cleanup.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
index efffbeded84f..94cafbd9a8d6 100755
--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -196,3 +196,6 @@ clean_dep   cddl/lib/libzpool abd_os c "linux/zfs/abd_os\.c"
 
 # 20241007
 clean_dep   cddl/lib/libzpool zfs_debug c "linux/zfs/zfs_debug\.c"
+
+# 20241011
+clean_dep   cddl/lib/libzpool arc_os c "linux/zfs/arc_os\.c"



git: c1782c2d28a5 - stable/14 - xen-netfront: attempt to make cleanup idempotent

2024-10-11 Thread Roger Pau Monné
The branch stable/14 has been updated by royger:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c1782c2d28a59fab389aa6457f109afe3e9b43fc

commit c1782c2d28a59fab389aa6457f109afe3e9b43fc
Author: Roger Pau Monné 
AuthorDate: 2023-11-03 09:28:16 +
Commit: Roger Pau Monné 
CommitDate: 2024-10-11 07:06:25 +

xen-netfront: attempt to make cleanup idempotent

Current cleanup code assumes that all the fields are allocated and/or setup 
by
the time cleanup is called, but this is not always true: a failure in 
mid-setup
of the device will cause the functions to be called with possibly 
uninitialized
fields.

Fix the functions to cope with such sate, while also attempting to make the
cleanup idempotent.

Finally fix an error path during setup that would not mark the device as
closed, and hence prevents the kernel from finishing booting.

Fixes: 96375eac945c ("xen-netfront: add multiqueue support")
Sponsored by: Citrix Systems R&D

(cherry picked from commit 318bbb6d5a1eae77eb5dc687bcc63c0f99558e21)
---
 sys/dev/xen/netfront/netfront.c | 27 ++-
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c
index da0f1680a87e..e13fb8765bae 100644
--- a/sys/dev/xen/netfront/netfront.c
+++ b/sys/dev/xen/netfront/netfront.c
@@ -597,8 +597,10 @@ talk_to_backend(device_t dev, struct netfront_info *info)
num_queues = max_queues;
 
err = setup_device(dev, info, num_queues);
-   if (err != 0)
+   if (err != 0) {
+   xenbus_dev_fatal(dev, err, "setup device");
goto out;
+   }
 
  again:
err = xs_transaction_start(&xst);
@@ -725,7 +727,10 @@ disconnect_rxq(struct netfront_rxq *rxq)
 
xn_release_rx_bufs(rxq);
gnttab_free_grant_references(rxq->gref_head);
-   gnttab_end_foreign_access(rxq->ring_ref, NULL);
+   if (rxq->ring_ref != GRANT_REF_INVALID) {
+   gnttab_end_foreign_access(rxq->ring_ref, NULL);
+   rxq->ring_ref = GRANT_REF_INVALID;
+   }
/*
 * No split event channel support at the moment, handle will
 * be unbound in tx. So no need to call xen_intr_unbind here,
@@ -740,6 +745,7 @@ destroy_rxq(struct netfront_rxq *rxq)
 
callout_drain(&rxq->rx_refill);
free(rxq->ring.sring, M_DEVBUF);
+   rxq->ring.sring = NULL;
 }
 
 static void
@@ -771,6 +777,8 @@ setup_rxqs(device_t dev, struct netfront_info *info,
 
rxq->id = q;
rxq->info = info;
+
+   rxq->gref_head = GNTTAB_LIST_END;
rxq->ring_ref = GRANT_REF_INVALID;
rxq->ring.sring = NULL;
snprintf(rxq->name, XN_QUEUE_NAME_LEN, "xnrx_%u", q);
@@ -827,7 +835,10 @@ disconnect_txq(struct netfront_txq *txq)
 
xn_release_tx_bufs(txq);
gnttab_free_grant_references(txq->gref_head);
-   gnttab_end_foreign_access(txq->ring_ref, NULL);
+   if (txq->ring_ref != GRANT_REF_INVALID) {
+   gnttab_end_foreign_access(txq->ring_ref, NULL);
+   txq->ring_ref = GRANT_REF_INVALID;
+   }
xen_intr_unbind(&txq->xen_intr_handle);
 }
 
@@ -837,9 +848,14 @@ destroy_txq(struct netfront_txq *txq)
unsigned int i;
 
free(txq->ring.sring, M_DEVBUF);
+   txq->ring.sring = NULL;
buf_ring_free(txq->br, M_DEVBUF);
-   taskqueue_drain_all(txq->tq);
-   taskqueue_free(txq->tq);
+   txq->br = NULL;
+   if (txq->tq) {
+   taskqueue_drain_all(txq->tq);
+   taskqueue_free(txq->tq);
+   txq->tq = NULL;
+   }
 
for (i = 0; i <= NET_TX_RING_SIZE; i++) {
bus_dmamap_destroy(txq->info->dma_tag,
@@ -878,6 +894,7 @@ setup_txqs(device_t dev, struct netfront_info *info,
txq->id = q;
txq->info = info;
 
+   txq->gref_head = GNTTAB_LIST_END;
txq->ring_ref = GRANT_REF_INVALID;
txq->ring.sring = NULL;
 



git: 329a3b0844e6 - stable/14 - xen: fix initialization of grant table frame array

2024-10-11 Thread Roger Pau Monné
The branch stable/14 has been updated by royger:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=329a3b0844e6671a3119a3f4da98e826c1c6199e

commit 329a3b0844e6671a3119a3f4da98e826c1c6199e
Author: Roger Pau Monné 
AuthorDate: 2023-11-02 17:23:25 +
Commit: Roger Pau Monné 
CommitDate: 2024-10-11 07:06:13 +

xen: fix initialization of grant table frame array

The current sizing of the array used to store grant table frames is broken, 
as
the calculation:

   max_nr_glist_frames = (boot_max_nr_grant_frames *
  GREFS_PER_GRANT_FRAME /
  (PAGE_SIZE / sizeof(grant_ref_t)));

Is plain bogus, for once grant_ref_t is the type of the grant reference, but
not the entry used to store such references in the grant frames.  But even 
if
the above calculation is switched to use grant_entry_v1_t, it would end up 
as:

   max_nr_glist_frames = (boot_max_nr_grant_frames *
  (PAGE_SIZE / sizeof(grant_entry_v1_t)) /
  (PAGE_SIZE / sizeof(grant_entry_v1_t)));

Which is pointless (note GREFS_PER_GRANT_FRAME has been expanded to 
(PAGE_SIZE
/ sizeof(grant_entry_v1_t))).

Just use boot_max_nr_grant_frames directly to size the grant table frames
array.

Fixes: 30d1eefe3937 ("Import OS interfaces to Xen services.")
Sponsored by: Citrix Systems R&D

(cherry picked from commit 1a12f0aea81b57d0dd2374047b8f4c97a037a8df)
---
 sys/dev/xen/grant_table/grant_table.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/sys/dev/xen/grant_table/grant_table.c 
b/sys/dev/xen/grant_table/grant_table.c
index 13ca966c1f90..1cf9fe5e339a 100644
--- a/sys/dev/xen/grant_table/grant_table.c
+++ b/sys/dev/xen/grant_table/grant_table.c
@@ -610,20 +610,12 @@ static int
 granttable_attach(device_t dev)
 {
int i;
-   unsigned int max_nr_glist_frames;
unsigned int nr_init_grefs;
 
nr_grant_frames = 1;
boot_max_nr_grant_frames = __max_nr_grant_frames();
 
-   /* Determine the maximum number of frames required for the
-* grant reference free list on the current hypervisor.
-*/
-   max_nr_glist_frames = (boot_max_nr_grant_frames *
-  GREFS_PER_GRANT_FRAME /
-  (PAGE_SIZE / sizeof(grant_ref_t)));
-
-   gnttab_list = malloc(max_nr_glist_frames * sizeof(grant_ref_t *),
+   gnttab_list = malloc(boot_max_nr_grant_frames * sizeof(grant_ref_t *),
M_DEVBUF, M_NOWAIT);
 
if (gnttab_list == NULL)



git: cc07d914bc80 - stable/13 - nfsd: Fix close handling when vfs.nfsd.enable_locallocks=1

2024-10-11 Thread Rick Macklem
The branch stable/13 has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=cc07d914bc80f0c644584de6eab2efd30e911d8d

commit cc07d914bc80f0c644584de6eab2efd30e911d8d
Author: Rick Macklem 
AuthorDate: 2024-09-30 22:49:57 +
Commit: Rick Macklem 
CommitDate: 2024-10-12 00:49:55 +

nfsd: Fix close handling when vfs.nfsd.enable_locallocks=1

nfsrv_freeopen() was being called after the mutex
lock was released, making it possible for other
kernel threads to change the lists while nfsrv_freeopen()
took the nfsstateid out of the lists.

This patch moves the code around
"if (nfsrv_freeopen(stp, vp, 1 p) == 0) {"
into nfsrv_freeopen(), so that it can remove the nfsstateid
structure from all lists before unlocking the mutex.
This should avoid any race between CLOSE and other nfsd threads
updating the NFSv4 state.

The patch does not affect semantics when vfs.nfsd.enable_locallocks=0.

PR: 280978
Tested by:  Matthew L. Dailey 

(cherry picked from commit eb345e05ac6602eeef0c33fce9025bbc8ec44d0f)
---
 sys/fs/nfsserver/nfs_nfsdstate.c | 62 +++-
 1 file changed, 30 insertions(+), 32 deletions(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
index 44f8aeb2a70d..ac02f390fb72 100644
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -139,7 +139,7 @@ static void nfsrv_dumpaclient(struct nfsclient *clp,
 struct nfsd_dumpclients *dumpp);
 static void nfsrv_freeopenowner(struct nfsstate *stp, int cansleep,
 NFSPROC_T *p);
-static int nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep,
+static void nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep,
 NFSPROC_T *p);
 static void nfsrv_freelockowner(struct nfsstate *stp, vnode_t vp, int cansleep,
 NFSPROC_T *p);
@@ -1549,7 +1549,7 @@ nfsrv_freeopenowner(struct nfsstate *stp, int cansleep, 
NFSPROC_T *p)
while (nstp != LIST_END(&stp->ls_open)) {
tstp = nstp;
nstp = LIST_NEXT(nstp, ls_list);
-   (void) nfsrv_freeopen(tstp, NULL, cansleep, p);
+   nfsrv_freeopen(tstp, NULL, cansleep, p);
}
if (stp->ls_op)
nfsrvd_derefcache(stp->ls_op);
@@ -1564,12 +1564,11 @@ nfsrv_freeopenowner(struct nfsstate *stp, int cansleep, 
NFSPROC_T *p)
  * are no other opens on the file.
  * Returns 1 if it free'd the nfslockfile, 0 otherwise.
  */
-static int
+static void
 nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep, NFSPROC_T *p)
 {
struct nfsstate *nstp, *tstp;
struct nfslockfile *lfp;
-   int ret;
 
LIST_REMOVE(stp, ls_hash);
LIST_REMOVE(stp, ls_list);
@@ -1578,35 +1577,46 @@ nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int 
cansleep, NFSPROC_T *p)
lfp = stp->ls_lfp;
/*
 * Now, free all lockowners associated with this open.
+* Note that, if vp != NULL, nfsrv_freelockowner() will
+* not call nfsrv_freeallnfslocks(), so it needs to be called, below.
 */
LIST_FOREACH_SAFE(tstp, &stp->ls_open, ls_list, nstp)
nfsrv_freelockowner(tstp, vp, cansleep, p);
 
+   if (vp != NULL) {
+   KASSERT(cansleep != 0, ("nfsrv_freeopen: cansleep == 0"));
+   mtx_assert(NFSSTATEMUTEXPTR, MA_OWNED);
+   /*
+* Only called with vp != NULL for Close when
+* vfs.nfsd.enable_locallocks != 0.
+* Lock the lfp so that it will not go away and do the
+* nfsrv_freeallnfslocks() call that was not done by
+* nfsrv_freelockowner().
+*/
+   nfsrv_locklf(lfp);
+   NFSUNLOCKSTATE();
+   NFSVOPUNLOCK(vp);
+   nfsrv_freeallnfslocks(stp, vp, cansleep, p);
+   NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
+   NFSLOCKSTATE();
+   nfsrv_unlocklf(lfp);
+   }
+
/*
 * The nfslockfile is freed here if there are no locks
 * associated with the open.
 * If there are locks associated with the open, the
 * nfslockfile structure can be freed via nfsrv_freelockowner().
-* Acquire the state mutex to avoid races with calls to
-* nfsrv_getlockfile().
 */
-   if (cansleep != 0)
-   NFSLOCKSTATE();
if (lfp != NULL && LIST_EMPTY(&lfp->lf_open) &&
LIST_EMPTY(&lfp->lf_deleg) && LIST_EMPTY(&lfp->lf_lock) &&
LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) &&
lfp->lf_usecount == 0 &&
-   (cansleep != 0 || nfsv4_testlock(&lfp->lf_locallock_lck) == 0)) {
+   nfsv4_testlock(&lfp->lf_locallock_lck) == 0)
nfsrv_freenfslockfile(lfp);
-   ret = 1;
-   } else
-   ret = 0;
-   if (c

git: d032508ef0aa - stable/14 - hv_netvsc.4: mlink to hn(4)/if_hn(4) + tag spdx

2024-10-11 Thread Warner Losh
The branch stable/14 has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d032508ef0aacdfd02c765182e6aa012509c54fd

commit d032508ef0aacdfd02c765182e6aa012509c54fd
Author: Alexander Ziaee 
AuthorDate: 2024-08-11 06:01:40 +
Commit: Warner Losh 
CommitDate: 2024-10-11 22:10:22 +

hv_netvsc.4: mlink to hn(4)/if_hn(4) + tag spdx

dmesg for this device says:
> hn0:  on vmbus0

Add links so that `man hn` and `man if_hn` work.

MFC after:  3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1377

(cherry picked from commit 83e93d53f67448a7546c32cd44cb145eceb6c8fb)
---
 share/man/man4/Makefile| 2 ++
 share/man/man4/hv_netvsc.4 | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index efe0625cc620..5f3d4b221465 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -687,6 +687,8 @@ MLINKS+=gpioths.4 dht11.4
 MLINKS+=gpioths.4 dht22.4
 MLINKS+=gre.4 if_gre.4
 MLINKS+=hpet.4 acpi_hpet.4
+MLINKS+=hv_netvsc.4 hn.4 \
+   hv_netvsc.4 if_hn.4
 MLINKS+=${_hptrr.4} ${_rr232x.4}
 MLINKS+=${_attimer.4} ${_i8254.4}
 MLINKS+=ip.4 rawip.4
diff --git a/share/man/man4/hv_netvsc.4 b/share/man/man4/hv_netvsc.4
index 226fa016f695..e5c7004713c5 100644
--- a/share/man/man4/hv_netvsc.4
+++ b/share/man/man4/hv_netvsc.4
@@ -1,3 +1,5 @@
+.\"-
+.\" SPDX-License-Identifier: BSD-2-Clause
 .\"
 .\" Copyright (c) 2012 Microsoft Corp.
 .\" All rights reserved.



git: 95273f59d0fb - stable/14 - sysctl.8: mark sysctls as vars per style.mdoc(7)

2024-10-11 Thread Warner Losh
The branch stable/14 has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=95273f59d0fb0172ed79a7f6b0812745a5795c25

commit 95273f59d0fb0172ed79a7f6b0812745a5795c25
Author: Alexander Ziaee 
AuthorDate: 2024-09-14 18:33:21 +
Commit: Warner Losh 
CommitDate: 2024-10-11 22:10:23 +

sysctl.8: mark sysctls as vars per style.mdoc(7)

+ while here, fix alignment and tag SPDX

MFC after:  3 days

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1421

(cherry picked from commit 2a680c5c37ea020467fce545734afea019d3a3ea)
---
 sbin/sysctl/sysctl.8 | 154 ++-
 1 file changed, 78 insertions(+), 76 deletions(-)

diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8
index ed768510eb6c..fef7d3842c49 100644
--- a/sbin/sysctl/sysctl.8
+++ b/sbin/sysctl/sysctl.8
@@ -1,3 +1,6 @@
+.\"-
+.\" SPDX-License-Identifier: BSD-3-Clause
+.\"
 .\" Copyright (c) 1993
 .\"The Regents of the University of California.  All rights reserved.
 .\"
@@ -52,11 +55,10 @@ privilege to set kernel state.
 The state to be retrieved or set is described using a
 .Dq Management Information Base
 .Pq Dq MIB
-style name, described as a dotted set of
-components.
+style name, described as a dotted set of components.
 .Pp
 The following options are available:
-.Bl -tag -width indent
+.Bl -tag -width "-f filename"
 .It Fl A
 Equivalent to
 .Fl o a
@@ -204,77 +206,77 @@ String and integer values can be set using
 .Nm .
 .Bl -column security.bsd.unprivileged_read_msgbuf integerxxx
 .It Sy "Name   TypeChangeable"
-.It "kern.ostype   string  no"
-.It "kern.osreleasestring  no"
-.It "kern.osrevision   integer no"
-.It "kern.version  string  no"
-.It "kern.maxvnodesinteger yes"
-.It "kern.maxproc  integer no"
-.It "kern.maxprocperuidinteger yes"
-.It "kern.maxfiles integer yes"
-.It "kern.maxfilesperproc  integer yes"
-.It "kern.argmax   integer no"
-.It "kern.securelevel  integer raise only"
-.It "kern.hostname string  yes"
-.It "kern.hostid   integer yes"
-.It "kern.clockratestruct  no"
-.It "kern.posix1versioninteger no"
-.It "kern.ngroups  integer no"
-.It "kern.job_control  integer no"
-.It "kern.saved_idsinteger no"
-.It "kern.boottime struct  no"
-.It "kern.domainname   string  yes"
-.It "kern.filedelayinteger yes"
-.It "kern.dirdelay integer yes"
-.It "kern.metadelayinteger yes"
-.It "kern.osreldateinteger no"
-.It "kern.bootfile string  yes"
-.It "kern.corefile string  yes"
-.It "kern.logsigexit   integer yes"
-.It "security.bsd.suser_enabledinteger yes"
-.It "security.bsd.see_other_uids   integer yes"
-.It "security.bsd.see_other_gids   integer yes"
-.It "security.bsd.see_jail_procinteger yes"
-.It "security.bsd.unprivileged_proc_debug  integer yes"
-.It "security.bsd.unprivileged_read_msgbuf integer yes"
-.It "vm.loadavgstruct  no"
-.It "hw.machinestring  no"
-.It "hw.model  string  no"
-.It "hw.ncpu   integer no"
-.It "hw.byteorder  integer no"
-.It "hw.physmeminteger no"
-.It "hw.usermeminteger no"
-.It "hw.pagesize   integer no"
-.It "hw.floatingpoint  integer no"
-.It "hw.machine_arch   string  no"
-.It "hw.realmeminteger no"
-.It "machdep.adjkerntz integer yes"
-.It "machdep.disable_rtc_set   integer yes"
-.It "machdep.guessed_bootdev   string  no"
-.It "user.cs_path  string  no"
-.It "user.bc_base_max  integer no"
-.It "user.bc_dim_max   integer no"
-.It "user.bc_scale_max integer no"
-.It "user.bc_string_maxinteger no"
-.It "user.coll_weights_max integer no"
-.It "user.expr_nest_maxinteger no"
-.It "user.line_max integer no"
-.It "user.re_dup_max   integer no"
-.It "user.posix2_version   integer no"
-.It "user.posix2_c_bindinteger no"
-.It "user.posix2_c_dev integer no"
-.It "user.posix2_char_term integer no"
-.It "user.posix2_fort_dev  integer no"
-.It "user.posix2_fort_run  integer no"
-.It "user.posix2_localedef integer no"
-.It "user.posix2_sw_devinteger no"
-.It "user.posix2_upe   integer no"
-.It "user.stream_max   integer no"
-.It "user.tzname_max   integer no"
-.It "user.localbasestring  no"
+.It Va "kern.ostypestring  no"
+.It Va "kern.osrelease string  no"
+.It Va "kern.osrevisioninteger no"
+.It Va "kern.version   string  no"
+.It Va "kern.maxvnodes integer yes"
+.It Va "kern.maxproc   integer no"
+.It Va "kern.maxprocperuid integer yes"
+.It Va "kern.maxfiles  integer yes"
+.It Va "kern.maxfilesperproc   integer yes"
+.It Va "kern.argmaxinteger no"
+.It Va "kern.securelevel   integer raise only"
+.It Va "kern.hostname  string  yes"
+.It Va "kern.hostidinteger yes"
+.It Va "kern.clockrate struct  no"
+.It Va "kern.posix1version integer no"
+.It Va "kern.ngroups   integer no"
+.It Va "kern.job_control   i

git: 83a8160fe6f3 - stable/14 - jail.conf.5: cleanup introduction

2024-10-11 Thread Warner Losh
The branch stable/14 has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=83a8160fe6f3d23b9b7cd8a97f92ee4a32f1aa9d

commit 83a8160fe6f3d23b9b7cd8a97f92ee4a32f1aa9d
Author: Ingo Schwarze 
AuthorDate: 2024-09-14 01:12:18 +
Commit: Warner Losh 
CommitDate: 2024-10-11 22:10:22 +

jail.conf.5: cleanup introduction

Suggested by ingo on mandoc-tech@

MFC after:  3 days

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1422

(cherry picked from commit e36af20691d8922ecf416170a56d06aca62a0ccd)
---
 usr.sbin/jail/jail.conf.5 | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/usr.sbin/jail/jail.conf.5 b/usr.sbin/jail/jail.conf.5
index dda2c0366dd1..1bce1535455a 100644
--- a/usr.sbin/jail/jail.conf.5
+++ b/usr.sbin/jail/jail.conf.5
@@ -30,29 +30,29 @@
 .Os
 .Sh NAME
 .Nm jail.conf
-.Nd configuration file for
-.Xr jail 8
+.Nd configuration file for system jails
 .Sh DESCRIPTION
-A
+The
+.Nm
+file consists of one or more jail definitions statements for use by the
 .Xr jail 8
-configuration file consists of one or more jail definitions statements,
-and parameter or variable statements within those jail definitions.
-A jail definition statement looks something like a C compound statement.
-A parameter statement looks like a C assignment,
-including a terminating semicolon.
+management program.
+A jail definition statement consists of a single word, the name of the jail,
+an opening curly brace, a list of at least two parameter assignments,
+and a closing curly brace.
+A parameter assignment consists of a single word, the parameter name,
+an equals sign, a value enclosed in double quotes, and a terminating semicolon.
 .Pp
-The general syntax of a jail definition is:
-.Bd -literal -offset indent
-jailname {
-   parameter = "value";
-   parameter = "value";
-   ...
-}
+The syntax of a jail definition is as follows:
+.Bd -unfilled
+. Ar jailname Cm \&{
+.Bd -unfilled -offset indent -compact
+.Ar parameter Cm = Qq Ar value ;
+\&...
+.Ed
+.Cm \&}
 .Ed
 .Pp
-Each jail is required to have a
-.Va name
-at the front of its definition.
 This is used by
 .Xr jail 8
 to specify a jail on the command line and report the jail status,



git: 5439ebff8512 - stable/14 - jail.conf.5: minor cleanup (spdx, macros, xrefs)

2024-10-11 Thread Warner Losh
The branch stable/14 has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5439ebff8512fcbbce0ce77b6f050edecfc5c78d

commit 5439ebff8512fcbbce0ce77b6f050edecfc5c78d
Author: Alexander Ziaee 
AuthorDate: 2024-08-07 19:14:38 +
Commit: Warner Losh 
CommitDate: 2024-10-11 22:10:22 +

jail.conf.5: minor cleanup (spdx, macros, xrefs)

+ expand see also section with other relevant pages and the handbook
+ tag paths with the path macro so they can be searched with apropos
+ tag spdx, one sentance per line

MFC after:  3 days

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1371

(cherry picked from commit 944c74b7d93c60709b966a5a522110e4fe1038b2)
---
 usr.sbin/jail/jail.conf.5 | 30 +-
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/usr.sbin/jail/jail.conf.5 b/usr.sbin/jail/jail.conf.5
index 0b82a972020c..dda2c0366dd1 100644
--- a/usr.sbin/jail/jail.conf.5
+++ b/usr.sbin/jail/jail.conf.5
@@ -1,3 +1,6 @@
+.\"-
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
 .\" Copyright (c) 2012 James Gritton
 .\" All rights reserved.
 .\"
@@ -22,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd September 5, 2023
+.Dd September 21, 2024
 .Dt JAIL.CONF 5
 .Os
 .Sh NAME
@@ -169,17 +172,17 @@ A line of the form
 .Pp
 will include another file (or files) in the configuration.
 The filename should be either absolute, or relative to the
-configuration file's directory.  It cannot contain variable
-expansions, but may contain
+configuration file's directory.
+It cannot contain variable expansions, but may contain
 .Xr glob 3
 patterns.
 .Pp
 The included file must exist, though a filename glob may match zero or
-more files.  This allows inclusion of any/all files in a directory,
-such as
-.Dq /etc/jail.conf.d/*.conf ,
+more files.
+This allows inclusion of any/all files in a directory, such as
+.Dq Pa /etc/jail.conf.d/*.conf ,
 or conditional inclusion of a single file, such as
-.Dq jail.foo[.]conf .
+.Dq Pa jail.foo[.]conf .
 .Ss Comments
 The configuration file may contain comments in the common C, C++, and
 shell formats:
@@ -238,10 +241,19 @@ bar {
 \[char46]include "/usr/local/etc/jail.*.conf";
 .Ed
 .Sh SEE ALSO
-.Xr jail_set 2 ,
+.Xr jail 2 ,
+.Xr jail 3 ,
+.Xr jail 3lua ,
 .Xr rc.conf 5 ,
 .Xr jail 8 ,
-.Xr jls 8
+.Xr jexec 8 ,
+.Xr jls 8 ,
+.Xr zfs-jail 8
+.Pp
+The
+.Dq Jails and Containers
+chapter of the
+.%B FreeBSD Handbook .
 .Sh HISTORY
 The
 .Xr jail 8



git: e92dd815de89 - stable/14 - mitigations.7: explain installing firmware + spdx

2024-10-11 Thread Warner Losh
The branch stable/14 has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e92dd815de891be18ef66dcda8ddea5e4c9c66d6

commit e92dd815de891be18ef66dcda8ddea5e4c9c66d6
Author: Alexander Ziaee 
AuthorDate: 2024-09-15 01:23:52 +
Commit: Warner Losh 
CommitDate: 2024-10-11 22:10:21 +

mitigations.7: explain installing firmware + spdx

MFC after:  3 days
Reported by:imp (ucode is for security)
Reported by:emaste (ucode is not minix)
Reported by:delphij (please ucode asap)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1411

(cherry picked from commit b15aff050530a791262e166ee0c8fed3a118e7d6)
---
 share/man/man7/mitigations.7 | 48 +---
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/share/man/man7/mitigations.7 b/share/man/man7/mitigations.7
index 9dceffb368a9..7156327a7795 100644
--- a/share/man/man7/mitigations.7
+++ b/share/man/man7/mitigations.7
@@ -1,3 +1,6 @@
+.\"-
+.\" SPDX-License-Identifer: BSD-2-Clause
+.\"
 .\" Copyright © 2023 The FreeBSD Foundation
 .\"
 .\" This documentation was written by Ed Maste , and
@@ -41,6 +44,7 @@ or per-process basis, some are optionally enabled or disabled 
at compile time,
 and some are inherent to the implementation and have no controls.
 .Pp
 The following vulnerability mitigations are covered in this document:
+.Pp
 .Bl -bullet -compact
 .It
 Address Space Layout Randomization (ASLR)
@@ -59,9 +63,11 @@ Stack Overflow Protection
 .It
 Supervisor Mode Memory Protection
 .It
-Hardware Vulnerability Mitigation Controls
-.It
 Capsicum
+.It
+Firmware and Microcode
+.It
+Architectural Vulnerability Mitigations
 .El
 .Pp
 Please note that the effectiveness and availability of these mitigations may
@@ -330,18 +336,14 @@ kernel.
 .Pp
 These features are automatically used by the kernel.
 There is no user-facing configuration.
-.Ss Hardware vulnerability controls
-See
-.Xr security 7
-for more information.
 .\"
 .Ss Capsicum
 Capsicum is a lightweight OS capability and sandbox framework.
 See
 .Xr capsicum 4
 for more information.
-.Pp
 .Sh HARDWARE VULNERABILITY MITIGATIONS
+.Ss Firmware and Microcode
 Recent years have seen an unending stream of new hardware vulnerabilities,
 notably CPU ones generally caused by detectable microarchitectural side-effects
 of speculative execution which leak private data from some other thread or
@@ -349,18 +351,36 @@ process or sometimes even internal CPU state that is 
normally inaccessible.
 Hardware vendors usually address these vulnerabilities as they are discovered 
by
 releasing microcode updates, which may then be bundled into platform firmware
 updates
-.Pq historically called BIOS updates for PCs .
+.Pq historically called BIOS updates for PCs
+or packages to be updated by the operating system at boot time.
+.Pp
+Platform firmware updates, if available from the manufacturer,
+are the best defense as they provide coverage during early boot.
+Install them with
+.Pa sysutils/flashrom
+from the
+.Fx
+Ports Collection.
+.Pp
+If platform firmware updates are no longer available,
+packaged microcode is available for installation at
+.Pa sysutils/cpu-microcode
+and can be loaded at runtime using
+.Xr loader.conf 5 ,
+see the package message for more details.
 .Pp
 The best defense overall against hardware vulnerabilities is to timely apply
-these updates when available and to disable the affected hardware's problematic
-functionalities when possible (e.g., CPU Simultaneous Multi-Threading).
+these updates when available, as early as possible in the boot process,
+and to disable the affected hardware's problematic functionalities when 
possible
+(e.g., CPU Simultaneous Multi-Threading).
 Software mitigations are only partial substitutes for these, but they can be
 helpful on out-of-support hardware or as complements for just-discovered
 vulnerabilities not yet addressed by vendors.
 Some software mitigations depend on hardware capabilities provided by a
 microcode update.
-.Pp
-FreeBSD's usual policy is to apply by default all OS-level mitigations that do
+.Ss Architectural Vulnerability Mitigations
+.Fx Ap s
+usual policy is to apply by default all OS-level mitigations that do
 not require recompilation, except those the particular hardware it is running 
on
 is known not to be vulnerable to
 .Pq which sometimes requires firmware updates ,
@@ -449,6 +469,10 @@ should be considered when configuring and deploying them 
in a
 .Fx
 system.
 .Pp
+Additional mitigation knobs are listed in the
+.Sx KNOBS AND TWEAKS
+section of
+.Xr security 7 .
 .Sh SEE ALSO
 .Xr elfctl 1 ,
 .Xr proccontrol 1 ,



git: 03b4f232354c - stable/14 - uncompress: Avoid reading an extra byte

2024-10-11 Thread Warner Losh
The branch stable/14 has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=03b4f232354ce68fe1cb462038654f6527f63579

commit 03b4f232354ce68fe1cb462038654f6527f63579
Author: David Jones 
AuthorDate: 2024-10-11 15:49:17 +
Commit: Warner Losh 
CommitDate: 2024-10-11 22:11:02 +

uncompress: Avoid reading an extra byte

When reading the next code in a stream, avoid reading an extra byte if
we're going to throw it away. When there's no more bits to extract from
the stream, bits will be 0 and we'll mask the read byte with 0 anyway.
At worst, this will avoid reading one past the end of gbuf array (which
is not possible in well formed streams).

PR: 127912
Reviewed by:emaste
Differential Revision:  https://reviews.freebsd.org/D47041

(cherry picked from commit 818c7b769a4f7d3c8fecc4cf491f4e22ef816eba)
---
 usr.bin/compress/zopen.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr.bin/compress/zopen.c b/usr.bin/compress/zopen.c
index a5b34ef83ecb..0d0900cabfa1 100644
--- a/usr.bin/compress/zopen.c
+++ b/usr.bin/compress/zopen.c
@@ -623,7 +623,8 @@ getcode(struct s_zstate *zs)
}
 
/* High order bits. */
-   gcode |= (*bp & rmask[bits]) << r_off;
+   if (bits > 0)
+   gcode |= (*bp & rmask[bits]) << r_off;
roffset += n_bits;
 
return (gcode);



git: 197de660d2bf - stable/14 - hn: fix build on !x86

2024-10-11 Thread Warner Losh
The branch stable/14 has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=197de660d2bfcf027af5224902950d36dc0611c3

commit 197de660d2bfcf027af5224902950d36dc0611c3
Author: Warner Losh 
AuthorDate: 2024-09-21 13:54:32 +
Commit: Warner Losh 
CommitDate: 2024-10-11 22:10:23 +

hn: fix build on !x86

hv_netvm aren't installed on !x64. Do the canonical thing with the
links.

Fixes: 83e93d53f674
Sponsored by: Netflix

(cherry picked from commit e47939b3b110689b63bb14d0cf9f55ace4c7a8a2)
---
 share/man/man4/Makefile | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 5f3d4b221465..d4b5e39e94d9 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -687,8 +687,8 @@ MLINKS+=gpioths.4 dht11.4
 MLINKS+=gpioths.4 dht22.4
 MLINKS+=gre.4 if_gre.4
 MLINKS+=hpet.4 acpi_hpet.4
-MLINKS+=hv_netvsc.4 hn.4 \
-   hv_netvsc.4 if_hn.4
+MLINKS+=${_hv_netvsc.4} ${_hn.4} \
+   ${_hv_netvsc.4} ${_if_hn.4}
 MLINKS+=${_hptrr.4} ${_rr232x.4}
 MLINKS+=${_attimer.4} ${_i8254.4}
 MLINKS+=ip.4 rawip.4
@@ -812,6 +812,7 @@ _cpuctl.4=  cpuctl.4
 _dpms.4=   dpms.4
 _ftgpio.4= ftgpio.4
 _ftwd.4=   ftwd.4
+_hn.4= _hn.4
 _hpt27xx.4=hpt27xx.4
 _hptiop.4= hptiop.4
 _hptmv.4=  hptmv.4
@@ -827,6 +828,7 @@ _hwpstate_intel.4=  hwpstate_intel.4
 _i8254.4=  i8254.4
 _ichwd.4=  ichwd.4
 _if_bxe.4= if_bxe.4
+_if_hn.4=  if_hn.4
 _if_nfe.4= if_nfe.4
 _if_urtw.4=if_urtw.4
 _if_vmx.4= if_vmx.4



git: 7e229794ca37 - stable/13 - uncompress: Avoid reading an extra byte

2024-10-11 Thread Warner Losh
The branch stable/13 has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7e229794ca37d25265b0472bce26e8fd2b9bee2c

commit 7e229794ca37d25265b0472bce26e8fd2b9bee2c
Author: David Jones 
AuthorDate: 2024-10-11 15:49:17 +
Commit: Warner Losh 
CommitDate: 2024-10-11 22:12:41 +

uncompress: Avoid reading an extra byte

When reading the next code in a stream, avoid reading an extra byte if
we're going to throw it away. When there's no more bits to extract from
the stream, bits will be 0 and we'll mask the read byte with 0 anyway.
At worst, this will avoid reading one past the end of gbuf array (which
is not possible in well formed streams).

PR: 127912
Reviewed by:emaste
Differential Revision:  https://reviews.freebsd.org/D47041

(cherry picked from commit 818c7b769a4f7d3c8fecc4cf491f4e22ef816eba)
---
 usr.bin/compress/zopen.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr.bin/compress/zopen.c b/usr.bin/compress/zopen.c
index a5b34ef83ecb..0d0900cabfa1 100644
--- a/usr.bin/compress/zopen.c
+++ b/usr.bin/compress/zopen.c
@@ -623,7 +623,8 @@ getcode(struct s_zstate *zs)
}
 
/* High order bits. */
-   gcode |= (*bp & rmask[bits]) << r_off;
+   if (bits > 0)
+   gcode |= (*bp & rmask[bits]) << r_off;
roffset += n_bits;
 
return (gcode);



git: e7474c619270 - stable/14 - nfsd: Fix close handling when vfs.nfsd.enable_locallocks=1

2024-10-11 Thread Rick Macklem
The branch stable/14 has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e7474c619270c5c325ce844b77eecc2dcf98147c

commit e7474c619270c5c325ce844b77eecc2dcf98147c
Author: Rick Macklem 
AuthorDate: 2024-09-30 22:49:57 +
Commit: Rick Macklem 
CommitDate: 2024-10-12 00:43:27 +

nfsd: Fix close handling when vfs.nfsd.enable_locallocks=1

nfsrv_freeopen() was being called after the mutex
lock was released, making it possible for other
kernel threads to change the lists while nfsrv_freeopen()
took the nfsstateid out of the lists.

This patch moves the code around
"if (nfsrv_freeopen(stp, vp, 1 p) == 0) {"
into nfsrv_freeopen(), so that it can remove the nfsstateid
structure from all lists before unlocking the mutex.
This should avoid any race between CLOSE and other nfsd threads
updating the NFSv4 state.

The patch does not affect semantics when vfs.nfsd.enable_locallocks=0.

PR: 280978
Tested by:  Matthew L. Dailey 

(cherry picked from commit eb345e05ac6602eeef0c33fce9025bbc8ec44d0f)
---
 sys/fs/nfsserver/nfs_nfsdstate.c | 62 +++-
 1 file changed, 30 insertions(+), 32 deletions(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
index 6b40e0f64141..6cd8c1c861ec 100644
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -139,7 +139,7 @@ static void nfsrv_dumpaclient(struct nfsclient *clp,
 struct nfsd_dumpclients *dumpp);
 static void nfsrv_freeopenowner(struct nfsstate *stp, int cansleep,
 NFSPROC_T *p);
-static int nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep,
+static void nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep,
 NFSPROC_T *p);
 static void nfsrv_freelockowner(struct nfsstate *stp, vnode_t vp, int cansleep,
 NFSPROC_T *p);
@@ -1566,7 +1566,7 @@ nfsrv_freeopenowner(struct nfsstate *stp, int cansleep, 
NFSPROC_T *p)
while (nstp != LIST_END(&stp->ls_open)) {
tstp = nstp;
nstp = LIST_NEXT(nstp, ls_list);
-   (void) nfsrv_freeopen(tstp, NULL, cansleep, p);
+   nfsrv_freeopen(tstp, NULL, cansleep, p);
}
if (stp->ls_op)
nfsrvd_derefcache(stp->ls_op);
@@ -1581,12 +1581,11 @@ nfsrv_freeopenowner(struct nfsstate *stp, int cansleep, 
NFSPROC_T *p)
  * are no other opens on the file.
  * Returns 1 if it free'd the nfslockfile, 0 otherwise.
  */
-static int
+static void
 nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep, NFSPROC_T *p)
 {
struct nfsstate *nstp, *tstp;
struct nfslockfile *lfp;
-   int ret;
 
LIST_REMOVE(stp, ls_hash);
LIST_REMOVE(stp, ls_list);
@@ -1595,35 +1594,46 @@ nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int 
cansleep, NFSPROC_T *p)
lfp = stp->ls_lfp;
/*
 * Now, free all lockowners associated with this open.
+* Note that, if vp != NULL, nfsrv_freelockowner() will
+* not call nfsrv_freeallnfslocks(), so it needs to be called, below.
 */
LIST_FOREACH_SAFE(tstp, &stp->ls_open, ls_list, nstp)
nfsrv_freelockowner(tstp, vp, cansleep, p);
 
+   if (vp != NULL) {
+   KASSERT(cansleep != 0, ("nfsrv_freeopen: cansleep == 0"));
+   mtx_assert(NFSSTATEMUTEXPTR, MA_OWNED);
+   /*
+* Only called with vp != NULL for Close when
+* vfs.nfsd.enable_locallocks != 0.
+* Lock the lfp so that it will not go away and do the
+* nfsrv_freeallnfslocks() call that was not done by
+* nfsrv_freelockowner().
+*/
+   nfsrv_locklf(lfp);
+   NFSUNLOCKSTATE();
+   NFSVOPUNLOCK(vp);
+   nfsrv_freeallnfslocks(stp, vp, cansleep, p);
+   NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
+   NFSLOCKSTATE();
+   nfsrv_unlocklf(lfp);
+   }
+
/*
 * The nfslockfile is freed here if there are no locks
 * associated with the open.
 * If there are locks associated with the open, the
 * nfslockfile structure can be freed via nfsrv_freelockowner().
-* Acquire the state mutex to avoid races with calls to
-* nfsrv_getlockfile().
 */
-   if (cansleep != 0)
-   NFSLOCKSTATE();
if (lfp != NULL && LIST_EMPTY(&lfp->lf_open) &&
LIST_EMPTY(&lfp->lf_deleg) && LIST_EMPTY(&lfp->lf_lock) &&
LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) &&
lfp->lf_usecount == 0 &&
-   (cansleep != 0 || nfsv4_testlock(&lfp->lf_locallock_lck) == 0)) {
+   nfsv4_testlock(&lfp->lf_locallock_lck) == 0)
nfsrv_freenfslockfile(lfp);
-   ret = 1;
-   } else
-   ret = 0;
-   if (c

git: 83ac4cebe84e - stable/14 - Revert "nfscl: Enable support for the Lookup+Open RPC"

2024-10-11 Thread Rick Macklem
The branch stable/14 has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=83ac4cebe84e651e4130e0e31e0c3ceff7affaa1

commit 83ac4cebe84e651e4130e0e31e0c3ceff7affaa1
Author: Rick Macklem 
AuthorDate: 2024-09-28 22:01:36 +
Commit: Rick Macklem 
CommitDate: 2024-10-12 00:45:22 +

Revert "nfscl: Enable support for the Lookup+Open RPC"

This reverts commit 9792c7d3eb41dc1e3709e00a98734c3312d1b4fe.

The email thread "panic: nfsv4root ref cnt cpuid=1"
on freebsd...@freebsd.org descibes
crashes that occurred for a NFSv4.1 client mount
using "oneopenown" where the same file is re-opened
many times by different processes.

The crashes appear to have been caused by the use
of the Lookup+Open RPC (which only happens for
mounts using the "oneopenown" option).
There appears to be a race between closure of the
open and the open acquired by the Lookup+Open RPC.

Since Lookup+Open RPCs are only an optimization
and can only be done for "oneopenown" at this time,
this patch reverts enabling of them.

It may be possible to fix the code so that
Lookup+Open works reliably, so the code is left
in place (although it will never be executed) for now.

Reported by:J David 

(cherry picked from commit 6df05714da160a8ac3e27ee34ff903bd0e760002)
---
 sys/fs/nfsclient/nfs_clvnops.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index 13341dfc26e0..bf24a161b94b 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -1309,6 +1309,11 @@ nfs_lookup(struct vop_lookup_args *ap)
}
 
openmode = 0;
+#if 0
+   /*
+* The use of LookupOpen breaks some builds.  It is disabled
+* until that is fixed.
+*/
/*
 * If this an NFSv4.1/4.2 mount using the "oneopenown" mount
 * option, it is possible to do the Open operation in the same
@@ -1328,6 +1333,7 @@ nfs_lookup(struct vop_lookup_args *ap)
openmode |= NFSV4OPEN_ACCESSWRITE;
}
NFSUNLOCKMNT(nmp);
+#endif
 
newvp = NULLVP;
NFSINCRGLOBAL(nfsstatsv1.lookupcache_misses);



git: 367d8c86a182 - stable/13 - ctl: limit memory allocation in pci_virtio_scsi

2024-10-11 Thread Ed Maste
The branch stable/13 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=367d8c86a182813d88f728fdb2c3ef1a4679a852

commit 367d8c86a182813d88f728fdb2c3ef1a4679a852
Author: Pierre Pronchery 
AuthorDate: 2024-07-19 17:32:27 +
Commit: Ed Maste 
CommitDate: 2024-10-11 15:53:53 +

ctl: limit memory allocation in pci_virtio_scsi

The virtio_scsi device allows a VM guest to directly send SCSI commands
(ctsio->cdb array) to the kernel driver exposed on /dev/cam/ctl
(ctl.ko).

All kernel commands accessible from the guest are defined by
ctl_cmd_table.

The command ctl_persistent_reserve_out (cdb[0]=0x5F and cbd[1]=0) allows
the caller to call malloc() with an arbitrary size (uint32_t). This can
be used by the guest to overload the kernel memory (DOS attack).

Reported by:Synacktiv
Reviewed by:asomers
Security:   HYP-08
Sponsored by:   The Alpha-Omega Project
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46044

(cherry picked from commit 64b0f52be2c9d7bcecebfeef393f8ec56cb85f47)
(cherry picked from commit 2e7f4728fa738a7a7b6c4e4c46eb68952386efce)
---
 sys/cam/ctl/ctl.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index ed97bb7c2115..13b7995fd74c 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -8313,6 +8313,18 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
 
param_len = scsi_4btoul(cdb->length);
 
+   /* validate the parameter length */
+   if (param_len != 24) {
+   ctl_set_invalid_field(ctsio,
+   /*sks_valid*/ 1,
+   /*command*/ 1,
+   /*field*/ 5,
+   /*bit_valid*/ 1,
+   /*bit*/ 0);
+   ctl_done((union ctl_io *)ctsio);
+   return (CTL_RETVAL_COMPLETE);
+   }
+
if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) {
ctsio->kern_data_ptr = malloc(param_len, M_CTL, M_WAITOK);
ctsio->kern_data_len = param_len;



git: 8f9567628cb2 - main - LinuxKPI: add time_is_before_jiffies()

2024-10-11 Thread Bjoern A. Zeeb
The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8f9567628cb2ccb335640c4bb044df2ebf45d83a

commit 8f9567628cb2ccb335640c4bb044df2ebf45d83a
Author: Bjoern A. Zeeb 
AuthorDate: 2024-09-28 22:32:03 +
Commit: Bjoern A. Zeeb 
CommitDate: 2024-10-11 20:48:58 +

LinuxKPI: add time_is_before_jiffies()

Add time_is_before_jiffies() as needed by iwlwifi from v6.11.

Sponsored by:   The FreeBSD Foundation
MFC after:  3 days
Reviewed by:emaste
Differential Revision: https://reviews.freebsd.org/D46841
---
 sys/compat/linuxkpi/common/include/linux/jiffies.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/jiffies.h 
b/sys/compat/linuxkpi/common/include/linux/jiffies.h
index d5cb6e14860e..bd05a0db0767 100644
--- a/sys/compat/linuxkpi/common/include/linux/jiffies.h
+++ b/sys/compat/linuxkpi/common/include/linux/jiffies.h
@@ -52,6 +52,7 @@
(time_after_eq(a,b) && time_before_eq(a,c))
 #definetime_is_after_eq_jiffies(a) time_after_eq(a, jiffies)
 #definetime_is_after_jiffies(a) time_after(a, jiffies)
+#definetime_is_before_jiffies(a)   time_before(a, jiffies)
 
 #defineHZ  hz
 



git: 5dbb0b7c19cf - main - man.4: Add .Sh HARDWARE for some wireless drivers for release notes

2024-10-11 Thread Bjoern A. Zeeb
The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5dbb0b7c19cf40ab6562c03396d245cf3a7374fe

commit 5dbb0b7c19cf40ab6562c03396d245cf3a7374fe
Author: Bjoern A. Zeeb 
AuthorDate: 2024-09-30 20:01:23 +
Commit: Bjoern A. Zeeb 
CommitDate: 2024-10-11 20:52:32 +

man.4: Add .Sh HARDWARE for some wireless drivers for release notes

iwlwifi.4 and rtw88.4 did not show up in the hardware list in the
release notes for 13.4.
The doc/website/tools/hardware-notes-processor.rb script parses
the .Sh HARDWARE section to automagically create a note once the
manual page is listed in the website/archetypes/release/hardware.adoc
file.

While here update the other committed man pages not yet connected
to the build.

Reported by:re (cperciva), grahamperrin
Sponsored by:   The FreeBSD Foundation
MFC after:  3 days
Reviewed by:concussious.bugzilla_runbox.com (Alexander Ziaee)
Differential Revision: https://reviews.freebsd.org/D46851
---
 share/man/man4/ath10k.4  | 31 ---
 share/man/man4/iwlwifi.4 | 65 +---
 share/man/man4/mt7915.4  | 19 --
 share/man/man4/mt7921.4  | 19 --
 share/man/man4/rtw88.4   | 25 +++
 5 files changed, 87 insertions(+), 72 deletions(-)

diff --git a/share/man/man4/ath10k.4 b/share/man/man4/ath10k.4
index 61c44543815f..4e23382e2450 100644
--- a/share/man/man4/ath10k.4
+++ b/share/man/man4/ath10k.4
@@ -1,5 +1,5 @@
 .\"-
-.\" Copyright (c) 2022 Bjoern A. Zeeb
+.\" Copyright (c) 2022-2024 Bjoern A. Zeeb
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 22, 2023
+.Dd September 30, 2024
 .Dt ATH10K 4
 .Os
 .Sh NAME
@@ -47,18 +47,7 @@ It is discouraged to load the driver from
 .Sh DESCRIPTION
 The
 .Nm
-driver is derived from Qualcomm Atheros' Linux ath10k driver and
-provides support for the following PCI chipsets:
-.Pp
-.Bl -tag -width Ds -offset indent -compact
-.It QCA6174
-.It QCA9377
-.It QCA9887
-.It QCA9888
-.It QCA988X
-.It QCA9984
-.It QCA99X0
-.El
+driver is derived from Qualcomm Atheros' Linux ath10k driver
 .Pp
 This driver requires firmware to be loaded before it will work.
 The package
@@ -87,6 +76,20 @@ While
 supports all 802.11 a/b/g/n and ac
 the compatibility code currently only supports 802.11 a/b/g modes.
 Support for 802.11 n/ac is to come.
+.Sh HARDWARE
+The
+.Nm
+driver supports PCIe devices with the following chipsets:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It QCA6174
+.It QCA9377
+.It QCA9887
+.It QCA9888
+.It QCA988X
+.It QCA9984
+.It QCA99X0
+.El
 .Sh SEE ALSO
 .Xr wlan 4 ,
 .Xr ifconfig 8 ,
diff --git a/share/man/man4/iwlwifi.4 b/share/man/man4/iwlwifi.4
index 1cf61c0008b5..ddeeb549d0f4 100644
--- a/share/man/man4/iwlwifi.4
+++ b/share/man/man4/iwlwifi.4
@@ -1,5 +1,5 @@
 .\"-
-.\" Copyright (c) 2021-2023 The FreeBSD Foundation
+.\" Copyright (c) 2021-2024 The FreeBSD Foundation
 .\"
 .\" This documentation was written by Bj\xc3\xb6rn Zeeb under sponsorship from
 .\" the FreeBSD Foundation.
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd September 21, 2023
+.Dd September 30, 2024
 .Dt IWLWIFI 4
 .Os
 .Sh NAME
@@ -54,10 +54,39 @@ It is discouraged to load the driver from
 .Sh DESCRIPTION
 The
 .Nm
-driver is derived from Intel's Linux iwlwifi driver and provides support for
-all chipsets supported by the
+driver is derived from Intel's Linux iwlwifi driver
+.Pp
+.Nm
+will be a successor to
+.Xr iwm 4
+and may supersede that driver in the future.
+It still complements the
+.Xr iwn 4
+driver which supports older chipsets.
+.Pp
+The driver uses the
+.\" No LinuxKPI man pages so no .Xr here.
+.Em linuxkpi_wlan
+and
+.Em linuxkpi
+compat framework to bridge between the Linux and
+native
+.Fx
+driver code as well as to the native
+.Xr net80211 4
+wireless stack.
+.Pp
+While
+.Nm
+supports all 802.11 a/b/g/n/ac/ax
+the compatibility code currently only supports 802.11 a/b/g modes.
+Support for 802.11 n/ac is to come. 802.11ax and 6Ghz support are planned.
+.Sh HARDWARE
+The
+.Nm
+driver supports PCIe devices from the
 .Em mvm
-part of that driver.
+sub-driver with the following chipsets:
 .Pp
 .Bl -bullet -compact
 .\" -
@@ -182,32 +211,6 @@ Intel(R) Wi-Fi 6 AX204 160MHz
 Intel(R) TBD Sc device
 .\" -
 .El
-.Pp
-.Nm
-will be a successor to
-.Xr iwm 4
-and may supersede that driver in the future.
-It still complements the
-.Xr iwn 4
-driver which supports older chipsets.
-.Pp
-The driver uses the
-.\" No LinuxKPI man pages 

git: 41283b454b7a - main - LinuxKPI: always include linux/kconfig.h

2024-10-11 Thread Bjoern A. Zeeb
The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=41283b454b7abd3de251ec8234d19b67dbca3916

commit 41283b454b7abd3de251ec8234d19b67dbca3916
Author: Bjoern A. Zeeb 
AuthorDate: 2024-09-26 21:36:17 +
Commit: Bjoern A. Zeeb 
CommitDate: 2024-10-11 20:50:27 +

LinuxKPI: always include linux/kconfig.h

Always include linux/kconfig.h which seems to match Linux behaviour
and avoid errors compiling code expected from that file but never
included.

Sponsored by:   The FreeBSD Foundation
MFC after:  3 days
Reviewed by:emaste, imp
Differential Revision: https://reviews.freebsd.org/D46801
---
 sys/conf/kern.pre.mk | 3 ++-
 sys/conf/kmod.mk | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index c676418aca93..50a81a29d18d 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -324,7 +324,8 @@ NORMAL_CTFCONVERT=  @:
 
 # Linux Kernel Programming Interface C-flags
 LINUXKPI_INCLUDES= -I$S/compat/linuxkpi/common/include \
-   -I$S/compat/linuxkpi/dummy/include
+   -I$S/compat/linuxkpi/dummy/include \
+   -include 
$S/compat/linuxkpi/common/include/linux/kconfig.h
 LINUXKPI_C=${NORMAL_C} ${LINUXKPI_INCLUDES}
 
 # Infiniband C flags.  Correct include paths and omit errors that linux
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index 4dc66c69d67b..03bf42f5b413 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -109,7 +109,8 @@ LINUXKPI_GENSRCS+= \
 
 LINUXKPI_INCLUDES+= \
-I${SYSDIR}/compat/linuxkpi/common/include \
-   -I${SYSDIR}/compat/linuxkpi/dummy/include
+   -I${SYSDIR}/compat/linuxkpi/dummy/include \
+   -include ${SYSDIR}/compat/linuxkpi/common/include/linux/kconfig.h
 
 CFLAGS+=   ${WERROR}
 CFLAGS+=   -D_KERNEL



git: 6621842ccfb4 - main - LinuxKPI: add new dummy headers visibility.h and of_net.h

2024-10-11 Thread Bjoern A. Zeeb
The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6621842ccfb4dd01470e9085697b553d10634eb0

commit 6621842ccfb4dd01470e9085697b553d10634eb0
Author: Bjoern A. Zeeb 
AuthorDate: 2024-09-28 22:35:56 +
Commit: Bjoern A. Zeeb 
CommitDate: 2024-10-11 20:58:35 +

LinuxKPI: add new dummy headers visibility.h and of_net.h

Those files are required by updated wireless drivers.

Sponsored by:   The FreeBSD Foundation
MFC after:  3 days
---
 sys/compat/linuxkpi/dummy/include/kunit/visibility.h | 0
 sys/compat/linuxkpi/dummy/include/linux/of_net.h | 0
 2 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/sys/compat/linuxkpi/dummy/include/kunit/visibility.h 
b/sys/compat/linuxkpi/dummy/include/kunit/visibility.h
new file mode 100644
index ..e69de29bb2d1
diff --git a/sys/compat/linuxkpi/dummy/include/linux/of_net.h 
b/sys/compat/linuxkpi/dummy/include/linux/of_net.h
new file mode 100644
index ..e69de29bb2d1



git: 87b759f0fa1f - main - Add targets/pseudo/bootstrap-packages

2024-10-11 Thread Simon J. Gerraty
The branch main has been updated by sjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=87b759f0fa1f7554d50ce640c40138512bbded44

commit 87b759f0fa1f7554d50ce640c40138512bbded44
Author: Simon J. Gerraty 
AuthorDate: 2024-10-11 21:15:47 +
Commit: Simon J. Gerraty 
CommitDate: 2024-10-11 21:15:47 +

Add targets/pseudo/bootstrap-packages

Try to compensate for the lack any origin for a DIRDEPS build.

bootstrap-packages will extract the PACKAGE lines from
the tree's Makefiles and use them to populate
targets/packages/Makefile.depend and targets/packages/*/Makefile.depend
so we can at least try to keep the Makefile.depend files throughout
the tree up to date.

This is far from ideal, as we cannot (easily) take into account
options that affect the contents of various packages.

Reviewed by:stevek
Sponsored by:   Juniper Networks, Inc.
Differential Revision:  https://reviews.freebsd.org/D47065
---
 targets/pseudo/bootstrap-packages/Makefile | 23 ++
 .../bootstrap-packages/bootstrap-packages.sh   | 96 ++
 2 files changed, 119 insertions(+)

diff --git a/targets/pseudo/bootstrap-packages/Makefile 
b/targets/pseudo/bootstrap-packages/Makefile
new file mode 100644
index ..6523e88f84db
--- /dev/null
+++ b/targets/pseudo/bootstrap-packages/Makefile
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Compensate (a bit) for the lack of per package makefiles or other means
+# of knowing what goes in each package in the base system.
+# We can derive some of the information we want from the makefiles that
+# set PACKAGE.
+
+all:
+.if ${.MAKE.LEVEL} > 0
+all: packages
+.endif
+
+PACKAGES?= ${.CURDIR:H:H}/packages
+
+packages: package-makefile.list
+   @${.CURDIR}/bootstrap-packages.sh PACKAGES=${PACKAGES} ${.ALLSRC}
+
+package-makefile.list:
+   @(cd ${SRCTOP} && \
+   find ${TOPS:U*bin etc lib*} -name 'Makefile' | \
+   xargs grep '^PACKAGE[[:space:]]*=' ) | \
+   sed 's/[[:space:]]*=[[:space:]]*/=/' > ${.TARGET}
+
diff --git a/targets/pseudo/bootstrap-packages/bootstrap-packages.sh 
b/targets/pseudo/bootstrap-packages/bootstrap-packages.sh
new file mode 100755
index ..a2fe250d68a3
--- /dev/null
+++ b/targets/pseudo/bootstrap-packages/bootstrap-packages.sh
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: BSD-2-Clause
+
+# Our input is the output of something like:
+#
+#  (cd ${SRCTOP} &&
+#  find *bin etc lib* -name Makefile |
+#  xargs grep '^PACKAGE[[:space:]]*=' )
+#
+# With some cleanup and looks like:
+#
+#  usr.bin/ofed/libibverbs/Makefile:PACKAGE=FreeBSD-rdma
+#  usr.bin/last/Makefile:PACKAGE=acct
+#  usr.bin/lastcomm/Makefile:PACKAGE=acct
+#  usr.bin/users/Makefile:PACKAGE=acct
+#  usr.bin/who/Makefile:PACKAGE=acct
+#  usr.sbin/ac/Makefile:PACKAGE=acct
+#  usr.sbin/accton/Makefile:PACKAGE=acct
+#  usr.sbin/lastlogin/Makefile:PACKAGE=acct
+#  ..
+#
+# which we use to populate $PACKAGES/*/Makefile.depend
+# and $PACKAGES/Makefile.depend to make it easier to keep
+# Makefile.depend files throughout the tree up-to-date.
+#
+# The result is not ideal, as we do not (yet) take into account all
+# the MK_* knobs that can impact DIRDEPS.
+#
+
+Mydir=`dirname $0`
+
+while :
+do
+case "$1" in
+*=*) eval "$1"; shift;;
+*) break;;
+esac
+done
+
+to_reldir() {
+sed "s,$SRCTOP/,,"
+}
+
+SRCTOP=${SRCTOP:-$(realpath $Mydir/../../..)}
+PACKAGES=${PACKAGES:-$(realpath $Mydir/../..)}
+case "$PACKAGES" in
+/*) ;;
+*) PACKAGES=$SRCTOP/$PACKAGES;;
+esac
+
+script_name=$(realpath $0 | to_reldir)
+
+start_depend() {
+depfile=$1
+
+mkdir -p ${depfile%/*}
+cat < $depfile
+# Generated by $script_name
+
+DIRDEPS= \\
+EOF
+}
+
+end_depend() {
+depfile=$1
+
+cat <> $depfile
+
+.include 
+EOF
+}
+
+start_depend $PACKAGES/Makefile.depend || exit 1
+sort -t= -k2 "$@" | sed 's,/Makefile:PACKAGE=, ,' |
+(
+lpackage=
+while read reldir package
+do
+case "$package" in \
+   lib?{LIB}) package=${reldir##*/};;
+   lib?{LIB:tl}) package=`echo ${reldir##*/} | tr 'A-Z' 'a-z'`;;
+   esac
+   if test "$package" != "$lpackage"; then \
+   test -z "$lpackage" || end_depend $ddeps
+   target=$PACKAGES/$package
+ddeps=$target/Makefile.depend
+start_depend $ddeps
+   lpackage=$package
+   echo "  $target \\"
+   fi
+   echo "  $reldir \\" >> $ddeps
+done
+end_depend $ddeps
+) | to_reldir >> $PACKAGES/Makefile.depend
+end_depend $PACKAGES/Makefile.depend



git: 1e434da3b065 - main - powerpc: Add nominal support for POWER10 and POWER11

2024-10-11 Thread Justin Hibbits
The branch main has been updated by jhibbits:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1e434da3b065ef96b389e5e0b604ae05a51e794e

commit 1e434da3b065ef96b389e5e0b604ae05a51e794e
Author: Justin Hibbits 
AuthorDate: 2024-10-11 21:03:12 +
Commit: Justin Hibbits 
CommitDate: 2024-10-11 21:17:43 +

powerpc: Add nominal support for POWER10 and POWER11
---
 sys/powerpc/include/cpu.h |  2 ++
 sys/powerpc/include/spr.h |  2 ++
 sys/powerpc/powerpc/cpu.c | 18 ++
 3 files changed, 22 insertions(+)

diff --git a/sys/powerpc/include/cpu.h b/sys/powerpc/include/cpu.h
index 02ff42877f0e..35b32566484c 100644
--- a/sys/powerpc/include/cpu.h
+++ b/sys/powerpc/include/cpu.h
@@ -90,6 +90,8 @@ extern u_long cpu_features2;
 #definePPC_FEATURE2_DARN   0x0020
 #definePPC_FEATURE2_SCV0x0010
 #definePPC_FEATURE2_HTM_NOSUSPEND  0x0008
+#definePPC_FEATURE2_ARCH_3_1   0x0004
+#definePPC_FEATURE2_MMA0x0002
 
 #definePPC_FEATURE_BITMASK 
\
"\20"   \
diff --git a/sys/powerpc/include/spr.h b/sys/powerpc/include/spr.h
index 751a9e8184b6..5bb3858b0fb5 100644
--- a/sys/powerpc/include/spr.h
+++ b/sys/powerpc/include/spr.h
@@ -220,7 +220,9 @@
 #define  IBMPOWER9   0x004e
 #define  MPC860  0x0050
 #define  IBMCELLBE   0x0070
+#define  IBMPOWER10  0x0080
 #define  MPC8240 0x0081
+#define  IBMPOWER11  0x0082
 #define  PA6T0x0090
 #define  IBM405GP0x4011
 #define  IBM405L 0x4161
diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c
index 19907e3973e7..f73ed25c8924 100644
--- a/sys/powerpc/powerpc/cpu.c
+++ b/sys/powerpc/powerpc/cpu.c
@@ -192,6 +192,24 @@ static const struct cputab models[] = {
   PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO | 
   PPC_FEATURE2_ARCH_3_00 | PPC_FEATURE2_HAS_IEEE128 |
   PPC_FEATURE2_DARN, cpu_powerx_setup },
+{ "IBM POWER10",   IBMPOWER10, REVFMT_MAJMIN,
+  PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
+  PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
+  PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX | PPC_FEATURE_TRUE_LE,
+  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_DSCR | PPC_FEATURE2_EBB |
+  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO |
+  PPC_FEATURE2_ARCH_3_00 | PPC_FEATURE2_HAS_IEEE128 |
+  PPC_FEATURE2_DARN | PPC_FEATURE2_ARCH_3_1 | PPC_FEATURE2_MMA,
+  cpu_powerx_setup },
+{ "IBM POWER11",   IBMPOWER11, REVFMT_MAJMIN,
+  PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
+  PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
+  PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX | PPC_FEATURE_TRUE_LE,
+  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_DSCR | PPC_FEATURE2_EBB |
+  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO |
+  PPC_FEATURE2_ARCH_3_00 | PPC_FEATURE2_HAS_IEEE128 |
+  PPC_FEATURE2_DARN | PPC_FEATURE2_ARCH_3_1 | PPC_FEATURE2_MMA,
+  cpu_powerx_setup },
 { "Motorola PowerPC 7400", MPC7400,REVFMT_MAJMIN,
   PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
 { "Motorola PowerPC 7410", MPC7410,REVFMT_MAJMIN,



git: f2e62e601304 - main - loader/powerpc: Add some CAS support for newer POWER CPUs

2024-10-11 Thread Justin Hibbits
The branch main has been updated by jhibbits:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f2e62e601304cea927bbeea70c484030b8e9fe45

commit f2e62e601304cea927bbeea70c484030b8e9fe45
Author: Justin Hibbits 
AuthorDate: 2024-10-11 21:01:15 +
Commit: Justin Hibbits 
CommitDate: 2024-10-11 21:17:43 +

loader/powerpc: Add some CAS support for newer POWER CPUs

* Add PVR bits for POWER10 and POWER11
* Initialize the `err` outvar, in case it's not touched on success by
  the hypervisor, to prevent spurious errors.
---
 stand/powerpc/ofw/cas.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/stand/powerpc/ofw/cas.c b/stand/powerpc/ofw/cas.c
index b112aae67d85..45fd4d8d567f 100644
--- a/stand/powerpc/ofw/cas.c
+++ b/stand/powerpc/ofw/cas.c
@@ -40,10 +40,13 @@
 #define PVR_CPU_P8NVL  0x004c
 #define PVR_CPU_P8 0x004d
 #define PVR_CPU_P9 0x004e
+#define PVR_CPU_P100x0080
+#define PVR_CPU_P110x0082
 #define PVR_CPU_MASK   0x
 
 #define PVR_ISA_2070x0f04
 #define PVR_ISA_3000x0f05
+#define PVR_ISA_31 0x0f06
 #define PVR_ISA_MASK   0x
 
 /* loader version of kernel's CPU_MAXSIZE */
@@ -122,7 +125,7 @@ struct opt_vec5 {
 } __packed;
 
 static struct ibm_arch_vec {
-   struct pvr  pvr_list[7];
+   struct pvr  pvr_list[10];
uint8_t num_opts;
struct opt_vec_ignore   vec1;
struct opt_vec_ignore   vec2;
@@ -135,8 +138,11 @@ static struct ibm_arch_vec {
{ htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P8E) },
{ htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P8NVL) },
{ htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P9) },
+   { htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P10) },
+   { htobe32(PVR_CPU_MASK), htobe32(PVR_CPU_P11) },
{ htobe32(PVR_ISA_MASK), htobe32(PVR_ISA_207) },
{ htobe32(PVR_ISA_MASK), htobe32(PVR_ISA_300) },
+   { htobe32(PVR_ISA_MASK), htobe32(PVR_ISA_31) },
{ 0, 0xu }  /* terminator */
},
4,  /* num_opts (4 actually means 5 option vectors) */
@@ -185,7 +191,7 @@ ppc64_cas(void)
 {
phandle_t pkg;
ihandle_t inst;
-   cell_t err;
+   cell_t err = 0;
uint8_t buf[16], idx, val;
int i, len, rc, radix_mmu;
const char *var;



git: baa7e9cd3083 - main - loader: Use Cyan instead of Blue for some menu items

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=baa7e9cd3083ccaed8f26e9ad786ff9657ab85fc

commit baa7e9cd3083ccaed8f26e9ad786ff9657ab85fc
Author: Warner Losh 
AuthorDate: 2024-10-11 19:06:24 +
Commit: Warner Losh 
CommitDate: 2024-10-11 21:27:46 +

loader: Use Cyan instead of Blue for some menu items

BLUE often translates to DARK BLUE. On BLACK this is hard to
read. Instead, use CYAN which looks good on both black and white
backgrounds.

Discussed with: kevans
Sponsored by: Netflix
---
 stand/lua/menu.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua
index 72f5648cae91..2d92be3b7c6e 100644
--- a/stand/lua/menu.lua
+++ b/stand/lua/menu.lua
@@ -122,7 +122,7 @@ menu.boot_environments = {
if is_default then
name_color = color.escapefg(color.GREEN)
else
-   name_color = color.escapefg(color.BLUE)
+   name_color = color.escapefg(color.CYAN)
end
bootenv_name = bootenv_name .. name_color ..
choice .. color.resetfg()
@@ -342,7 +342,7 @@ menu.welcome = {
name_color = color.escapefg(color.GREEN)
kernel_name = "default/"
else
-   name_color = color.escapefg(color.BLUE)
+   name_color = color.escapefg(color.CYAN)
end
kernel_name = kernel_name .. name_color ..
choice .. color.resetfg()



git: 9bb56359e6ed - main - uart: Document rw:XXX field of hw.uart.console

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9bb56359e6ed4facb18ee5575aacfe95e049f1e8

commit 9bb56359e6ed4facb18ee5575aacfe95e049f1e8
Author: Warner Losh 
AuthorDate: 2024-10-11 19:31:31 +
Commit: Warner Losh 
CommitDate: 2024-10-11 21:27:46 +

uart: Document rw:XXX field of hw.uart.console

Add a one-liner description of rw - Register Width added in eae36de826cc.

Fixes: eae36de826cc
Sponsored by:   Netflix
---
 sys/dev/uart/uart_subr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/dev/uart/uart_subr.c b/sys/dev/uart/uart_subr.c
index 03c7fd8caea9..49a046f019bb 100644
--- a/sys/dev/uart/uart_subr.c
+++ b/sys/dev/uart/uart_subr.c
@@ -185,6 +185,7 @@ out:
  * mm = Memory mapped I/O address
  * pa = Parity
  * rs = Register shift
+ * rw = Register width
  * sb = Stopbits
  * xo = Device clock (xtal oscillator)
  *



git: 9d81f99b127f - main - mac_bsdextended: Use SYSCTL VARIABLES section

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9d81f99b127fe8533a6049df5d265ec8b176dfbb

commit 9d81f99b127fe8533a6049df5d265ec8b176dfbb
Author: Warner Losh 
AuthorDate: 2024-10-11 20:06:22 +
Commit: Warner Losh 
CommitDate: 2024-10-11 21:27:46 +

mac_bsdextended: Use SYSCTL VARIABLES section

All the other man pages, except iicbus(4), use .Sh SYSCTL VARIABLES for
documentig sysctls. iicbus(4) has a legitmate reason for varying,
though.

Sponsored by:   Netflix
---
 share/man/man4/mac_bsdextended.4 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/share/man/man4/mac_bsdextended.4 b/share/man/man4/mac_bsdextended.4
index c96370a8175b..2131ca85282c 100644
--- a/share/man/man4/mac_bsdextended.4
+++ b/share/man/man4/mac_bsdextended.4
@@ -28,7 +28,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 21, 2005
+.Dd October 11, 2024
 .Dt MAC_BSDEXTENDED 4
 .Os
 .Sh NAME
@@ -87,7 +87,7 @@ This means that not all rules are applied,
 only the first matched rule; thus if
 Rule A allows access and Rule B blocks
 access, Rule B will never be applied.
-.Ss Sysctls
+.Sh SYSCTL VARIABLES
 The following sysctls may be used to tweak the behavior of
 .Nm :
 .Bl -tag -width indent



git: 852233cf7620 - main - uart: Small style tweak

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=852233cf7620fd98eb8b5221e662fc863750e0f7

commit 852233cf7620fd98eb8b5221e662fc863750e0f7
Author: Warner Losh 
AuthorDate: 2024-10-11 19:26:19 +
Commit: Warner Losh 
CommitDate: 2024-10-11 21:27:46 +

uart: Small style tweak

Use if (err == 0) rather than if (!err) to follow stlye(9) and also the
rest of the file.

Sponsored by:   Netflix
---
 sys/dev/uart/uart_cpu_fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/uart/uart_cpu_fdt.c b/sys/dev/uart/uart_cpu_fdt.c
index 1cc1c795f29f..fd1647cd78aa 100644
--- a/sys/dev/uart/uart_cpu_fdt.c
+++ b/sys/dev/uart/uart_cpu_fdt.c
@@ -81,7 +81,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
/* Allow overriding the FDT using the environment. */
class = &uart_ns8250_class;
err = uart_getenv(devtype, di, class);
-   if (!err)
+   if (err == 0)
return (0);
 
err = uart_cpu_fdt_probe(&class, &bst, &bsh, &br, &rclk,



git: 0bd23ca0ee28 - main - uart: Fix cut-n-paste error in DBG2 code

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0bd23ca0ee28894c44aa7b4bdfb5609bfb1e2303

commit 0bd23ca0ee28894c44aa7b4bdfb5609bfb1e2303
Author: Warner Losh 
AuthorDate: 2024-10-11 19:23:44 +
Commit: Warner Losh 
CommitDate: 2024-10-11 21:27:46 +

uart: Fix cut-n-paste error in DBG2 code

This code is parsing the DBG2 ACPI table, not the SPCR table, so tweak
the comment.

Sponsored by:   Netflix
---
 sys/dev/uart/uart_cpu_acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/uart/uart_cpu_acpi.c b/sys/dev/uart/uart_cpu_acpi.c
index 7892437e11de..ae22a9822aa6 100644
--- a/sys/dev/uart/uart_cpu_acpi.c
+++ b/sys/dev/uart/uart_cpu_acpi.c
@@ -222,7 +222,7 @@ uart_cpu_acpi_dbg2(struct uart_devinfo *di)
int error;
bool found;
 
-   /* Look for the SPCR table. */
+   /* Look for the DBG2 table. */
dbg2_physaddr = acpi_find_table(ACPI_SIG_DBG2);
if (dbg2_physaddr == 0)
return (ENXIO);



git: 37798b1d5dd1 - main - loader/4th: Move from hint.acpi.0.rsdp to acpi.rsdp

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=37798b1d5dd12cd5e842b6f99135a2e4af8cf9e0

commit 37798b1d5dd12cd5e842b6f99135a2e4af8cf9e0
Author: Warner Losh 
AuthorDate: 2024-10-04 04:50:50 +
Commit: Warner Losh 
CommitDate: 2024-10-11 21:40:53 +

loader/4th: Move from hint.acpi.0.rsdp to acpi.rsdp

Use acpi.rsdp to test for ACPI. 4th wasn't updated with the old compat
was dropped a while ago.

MFC After:  1 week
Sponsored by:   Netflix
---
 stand/forth/menu.4th   |  2 +-
 stand/forth/menu.4th.8 | 10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/stand/forth/menu.4th b/stand/forth/menu.4th
index 87b4efb8c185..cc9b0c867e87 100644
--- a/stand/forth/menu.4th
+++ b/stand/forth/menu.4th
@@ -147,7 +147,7 @@ only forth definitions
 ;
 
 : acpipresent? ( -- flag ) \ Returns TRUE if ACPI is present, FALSE otherwise
-   s" hint.acpi.0.rsdp" getenv
+   s" acpi.rsdp" getenv
dup -1 = if
drop false exit
then
diff --git a/stand/forth/menu.4th.8 b/stand/forth/menu.4th.8
index bd066a8b706f..2421fe03be0c 100644
--- a/stand/forth/menu.4th.8
+++ b/stand/forth/menu.4th.8
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd August 6, 2013
+.Dd October 4, 2024
 .Dt MENU.4TH 8
 .Os
 .Sh NAME
@@ -210,8 +210,8 @@ is enabled
 When set to a number
 .Dq Li x
 associated with a given menuitem, that menuitem will only appear when
-running on i386-compatible hardware,
-.Va hint.acpi.0.rsdp
+running on ACPI-compatible hardware,
+.Va acpi.rsdp
 is set (indicating the presence of hardware ACPI support as detected by
 .Xr loader 8 ) ,
 and
@@ -224,10 +224,10 @@ but continue to function as expected.
 On i386-compatible hardware lacking ACPI support (as detected by
 .Xr loader 8 ) ,
 subsequent menuitems will retain their associated numbers.
-.It Va hint.acpi.0.rsdp
+.It Va acpi.rsdp
 Set automatically by
 .Xr loader 8
-on i386-compatible hardware when ACPI support is detected at boot time.
+on ACPI-compatible hardware when ACPI support is detected at boot time.
 Effects the display of the
 .Dq Li menu_acpi
 menuitem (if configured).



git: 440f4ba18e3a - main - tcp: fix duplicate retransmissions when RTO happens during SACK loss recovery

2024-10-11 Thread Richard Scheffenegger
The branch main has been updated by rscheff:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=440f4ba18e3ab7be912858bbcb96a419fcf14809

commit 440f4ba18e3ab7be912858bbcb96a419fcf14809
Author: Richard Scheffenegger 
AuthorDate: 2024-10-10 10:50:22 +
Commit: Richard Scheffenegger 
CommitDate: 2024-10-10 11:02:47 +

tcp: fix duplicate retransmissions when RTO happens during SACK loss 
recovery

When snd_nxt doesn't track snd_max, partial SACK ACKs may elicit
unexpected duplicate retransmissions. This is usually masked by
LRO not necessarily ACKing every individual segment, and prior
to RFC6675 SACK loss recovery, harder to trigger even when an
RTO happens while SACK loss recovery is ongoing.

Address this by improving the logic when to start a SACK loss recovery
and how to deal with a RTO, as well as improvements to the adjusted
congestion window during transmission selection.

Reviewed By:tuexen, cc, #transport
Sponsored by:   NetApp, Inc.
MFC after:  1 week
Differential Revision:  https://reviews.freebsd.org/D43355
---
 sys/netinet/tcp_input.c  | 18 ++
 sys/netinet/tcp_output.c | 25 -
 sys/netinet/tcp_sack.c   | 22 ++
 sys/netinet/tcp_var.h|  2 +-
 4 files changed, 41 insertions(+), 26 deletions(-)

diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index b64a71837ab4..5d14664f3fc0 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -444,10 +444,7 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, 
uint32_t type)
case CC_RTO:
tp->t_dupacks = 0;
tp->t_bytes_acked = 0;
-   if ((tp->t_rxtshift > 1) ||
-   !((tp->t_flags & TF_SACK_PERMIT) &&
- (!TAILQ_EMPTY(&tp->snd_holes
-   EXIT_RECOVERY(tp->t_flags);
+   EXIT_RECOVERY(tp->t_flags);
if (tp->t_flags2 & TF2_ECN_PERMIT)
tp->t_flags2 |= TF2_ECN_SND_CWR;
break;
@@ -2747,7 +2744,6 @@ enter_recovery:
}
if (tcp_is_sack_recovery(tp, &to)) {

TCPSTAT_INC(tcps_sack_recovery_episode);
-   tp->snd_recover = tp->snd_nxt;
tp->snd_cwnd = maxseg;
(void) tcp_output(tp);
if (SEQ_GT(th->th_ack, 
tp->snd_una)) {
@@ -2790,8 +2786,12 @@ enter_recovery:
__func__));
if (tp->t_dupacks == 1)
tp->snd_limited = 0;
-   tp->snd_cwnd =
-   (tp->snd_nxt - tp->snd_una) +
+   if ((tp->snd_nxt == tp->snd_max) &&
+   (tp->t_rxtshift == 0))
+   tp->snd_cwnd =
+   SEQ_SUB(tp->snd_nxt,
+   tp->snd_una);
+   tp->snd_cwnd +=
(tp->t_dupacks - tp->snd_limited) *
maxseg;
/*
@@ -2840,7 +2840,9 @@ enter_recovery:
 * counted as dupacks here.
 */
if (tcp_is_sack_recovery(tp, &to) &&
-   (sack_changed != SACK_NOCHANGE)) {
+   (((tp->t_rxtshift == 0) && (sack_changed != 
SACK_NOCHANGE)) ||
+((tp->t_rxtshift > 0) && (sack_changed == 
SACK_NEWLOSS))) &&
+   (tp->snd_nxt == tp->snd_max)) {
tp->t_dupacks++;
/* limit overhead by setting maxseg last */
if (!IN_FASTRECOVERY(tp->t_flags) &&
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 78ecfe5289b6..a048abf5f97a 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -259,6 +259,7 @@ tcp_default_output(struct tcpcb *tp)
}
}
 again:
+   sendwin = 0;
/*
 * If we've recently taken a timeout, snd_max will be greater than
 * snd_nxt.  There may be SACK information that allows us to avoid
@@ -266,12 +267,12 @@ again:
 */
if ((tp->t_flags & TF_SACK_PERMIT) &&
SEQ_LT(tp->snd_nxt, tp->snd_max))
-   tcp_sack_adjust(tp);
+   sendwin = tcp_sack_adjust(tp);
sendalot = 0;
tso = 0;
mtu = 0;
off

git: d80d7a8e4643 - main - rc.conf.5: Clarify wording

2024-10-11 Thread Mateusz Piotrowski
The branch main has been updated by 0mp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d80d7a8e46433b90dc5e7ae69144664b9a6e35df

commit d80d7a8e46433b90dc5e7ae69144664b9a6e35df
Author: Andrew Stevenson 
AuthorDate: 2024-10-11 09:49:42 +
Commit: Mateusz Piotrowski <0...@freebsd.org>
CommitDate: 2024-10-11 09:52:56 +

rc.conf.5: Clarify wording

PR: 196736
MFC after:  3 days
---
 share/man/man5/rc.conf.5 | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 2897efffd780..62707e7f13d6 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 22, 2024
+.Dd October 11, 2024
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -103,9 +103,8 @@ and
 will be loaded.
 If
 .Ao Ar dir Ac Ns Pa /rc.conf.d/ Ns Ao Ar name Ac
-is a directory,
-all of the files in the directory will be loaded.
-Also see the
+is a directory then all of files in the directory will be loaded.
+See also the
 .Va rc_conf_files
 variable below.
 .Pp



git: 21d9853ed553 - main - arm64/gicv3: Skip programming vPE GITS_BASERs to avoid a boot crash

2024-10-11 Thread Ed Maste
The branch main has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=21d9853ed5533a87f59937b564a53a2d6ac3c637

commit 21d9853ed5533a87f59937b564a53a2d6ac3c637
Author: D Scott Phillips 
AuthorDate: 2024-10-11 14:12:15 +
Commit: Ed Maste 
CommitDate: 2024-10-11 14:13:04 +

arm64/gicv3: Skip programming vPE GITS_BASERs to avoid a boot crash

On AmpereOne, the current programming of GITS_BASER2 to individual
allocations per ITS causes a:

panic: APEI Fatal Hardware Error!

This is due to the ITS reporting a BASER2_DATA_ERR error. The GIC-700
expects all GITS_BASER2.Physical_Address fields to match system-wide.

Skip programming any vPE GITS_BASER registers to avoid this crash.

Sponsored by:   Ampere Computing LLC
Reviewed by:andrew
Differential Revision: https://reviews.freebsd.org/D46094
---
 sys/arm64/arm64/gicv3_its.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c
index a79706526c80..5ecd9b8c0e94 100644
--- a/sys/arm64/arm64/gicv3_its.c
+++ b/sys/arm64/arm64/gicv3_its.c
@@ -586,11 +586,20 @@ gicv3_its_table_init(device_t dev, struct gicv3_its_softc 
*sc)
its_tbl_size = l1_esize * l1_nidents;
its_tbl_size = roundup2(its_tbl_size, page_size);
break;
-   case GITS_BASER_TYPE_VP:
case GITS_BASER_TYPE_PP: /* Undocumented? */
case GITS_BASER_TYPE_IC:
its_tbl_size = page_size;
break;
+   case GITS_BASER_TYPE_VP:
+   /*
+* If GITS_TYPER.SVPET != 0, the pending table is
+* shared amongst the redistibutors and ther other
+* ITSes. Requiring sharing across the ITSes when none
+* of the redistributors have GICR_VPROPBASER.Valid==1
+* isn't specified in the architecture, but that's how
+* the GIC-700 behaves. We don't handle vPE tables at
+* all yet, so just skip this base register.
+*/
default:
if (bootverbose)
device_printf(dev, "Unhandled table type %lx\n",



git: ff5a685270a3 - stable/14 - if_vlan: handle VID conflicts

2024-10-11 Thread Kristof Provost
The branch stable/14 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ff5a685270a3946bf7941e82bb77528670b3aba3

commit ff5a685270a3946bf7941e82bb77528670b3aba3
Author: Kristof Provost 
AuthorDate: 2024-05-21 11:31:13 +
Commit: Kristof Provost 
CommitDate: 2024-10-11 10:04:09 +

if_vlan: handle VID conflicts

If we fail to change the vlan id we have to undo the removal (and vlan id
change) in the error path. Otherwise we'll have removed the vlan object 
from the
hash table, and have the wrong vlan id as well. Subsequent modification 
attempts
will then try to remove an entry which doesn't exist, and panic.

Undo the vlan id modification if the insertion in the hash table fails, and
re-insert it under the original vlan id.

PR: 279195
Reviewed by:zlei
MFC atfer:  1 week
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D45285

(cherry picked from commit bdd12889eaa64032b3d09ef47e9a6f7081863378)
---
 sys/net/if_vlan.c| 10 ++
 tests/sys/net/if_vlan.sh | 37 +
 2 files changed, 47 insertions(+)

diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 206d46e7f9be..c586b513e008 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1702,10 +1702,20 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, 
uint16_t vid,
ifv->ifv_proto = proto;
 
if (ifv->ifv_vid != vid) {
+   int oldvid = ifv->ifv_vid;
+
/* Re-hash */
vlan_remhash(trunk, ifv);
ifv->ifv_vid = vid;
error = vlan_inshash(trunk, ifv);
+   if (error) {
+   int ret __diagused;
+
+   ifv->ifv_vid = oldvid;
+   /* Re-insert back where we found it. */
+   ret = vlan_inshash(trunk, ifv);
+   MPASS(ret == 0);
+   }
}
/* Will unlock */
goto done;
diff --git a/tests/sys/net/if_vlan.sh b/tests/sys/net/if_vlan.sh
index 458e3cc36bc6..41dac6222cbb 100755
--- a/tests/sys/net/if_vlan.sh
+++ b/tests/sys/net/if_vlan.sh
@@ -297,6 +297,42 @@ bpf_pcp_cleanup()
vnet_cleanup
 }
 
+atf_test_case "conflict_id" "cleanup"
+conflict_id_head()
+{
+   atf_set descr 'Test conflicting VLAN IDs, PR #279195'
+   atf_set require.user root
+}
+
+conflict_id_body()
+{
+   vnet_init
+
+   epair=$(vnet_mkepair)
+
+   vnet_mkjail alcatraz ${epair}b
+   vlan_a=$(jexec alcatraz ifconfig vlan create)
+   vlan_b=$(jexec alcatraz ifconfig vlan create)
+
+   jexec alcatraz ifconfig ${vlan_a} vlan 100 vlandev ${epair}b
+   jexec alcatraz ifconfig ${vlan_b} vlan 101 vlandev ${epair}b
+
+   atf_check -s exit:1 -o ignore -e ignore \
+   jexec alcatraz ifconfig ${vlan_a} vlan 101
+
+   atf_check -s exit:0 -o match:"vlan: 100" \
+   jexec alcatraz ifconfig ${vlan_a}
+
+   atf_check -s exit:0 -o ignore -e ignore \
+   jexec alcatraz ifconfig ${vlan_a} vlan 100
+}
+
+conflict_id_cleanup()
+{
+   vnet_cleanup
+
+}
+
 atf_init_test_cases()
 {
atf_add_test_case "basic"
@@ -306,4 +342,5 @@ atf_init_test_cases()
atf_add_test_case "qinq_dot"
atf_add_test_case "qinq_setflags"
atf_add_test_case "bpf_pcp"
+   atf_add_test_case "conflict_id"
 }



git: 310c31d3f04e - main - rtw89: add man page and hook driver up to the build

2024-10-11 Thread Bjoern A. Zeeb
The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=310c31d3f04ef9d3ebe598fd076d017a48d0ca0d

commit 310c31d3f04ef9d3ebe598fd076d017a48d0ca0d
Author: Bjoern A. Zeeb 
AuthorDate: 2023-04-18 15:17:41 +
Commit: Bjoern A. Zeeb 
CommitDate: 2024-10-11 13:47:11 +

rtw89: add man page and hook driver up to the build

After two years, add the initial man page and hook Realteks rtw89
driver up to the build for more people to test given successful
reports.
devd.conf is already providing support based on the rtw regex.
The driver uses the LinuxKPI compat layer.

Firmware is provided by ports: net/wifi-firmware-rtw89-kmod or
one of the flavours.  People are advised to used fwget(8) to
automatically install the correct firmware for their chipset.

Please note that for the moment the driver requires a tunable to
be set in loader.conf: compat.linuxkpi.skb.mem_limit=1

Many thanks to everyone who in the last two years helped testing,
debugged, submitted patches to get the driver to this stage where
initial functionality seems working.

Sponsored by:   The FreeBSD Foundation
MFC after:  3 days
---
 share/man/man4/Makefile |   1 +
 share/man/man4/rtw89.4  | 126 
 sys/modules/Makefile|   2 +
 3 files changed, 129 insertions(+)

diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index e2448660a112..6f7eefe734f7 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -494,6 +494,7 @@ MAN=aac.4 \
rtnetlink.4 \
rtsx.4 \
rtw88.4 \
+   rtw89.4 \
rtwn.4 \
rtwnfw.4 \
rtwn_pci.4 \
diff --git a/share/man/man4/rtw89.4 b/share/man/man4/rtw89.4
new file mode 100644
index ..2e1f2676eb8e
--- /dev/null
+++ b/share/man/man4/rtw89.4
@@ -0,0 +1,126 @@
+.\"-
+.\" Copyright (c) 2023-2024 Bjoern A. Zeeb
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 10, 2024
+.Dt RTW89 4
+.Os
+.Sh NAME
+.Nm rtw89
+.Nd Realtek IEEE 802.11ax wireless network driver
+.Sh SYNOPSIS
+The driver will auto-load without any user interaction using
+.Xr devmatch 8
+if enabled in
+.Xr rc.conf 5 .
+.Pp
+Only if auto-loading is explicitly disabled, place the following
+lines in
+.Xr rc.conf 5
+to manually load the driver as a module at boot time:
+.Bd -literal -offset indent
+kld_list="${kld_list} if_rtw89"
+.Ed
+.Pp
+It is discouraged to load the driver from
+.Xr loader 8 .
+.Sh DESCRIPTION
+The
+.Nm
+driver is derived from Realtek's Linux rtw89 driver.
+.Pp
+This driver requires firmware to be loaded before it will work.
+The package
+.Pa wifi-firmware-rtw89-kmod
+from the
+.Pa ports/net/wifi-firmware-rtw89-kmod
+port needs to be installed before the driver is loaded.
+Otherwise no
+.Xr wlan 4
+interface can be created using
+.Xr ifconfig 8 .
+One should use
+.Xr fwget 8
+to install the correct firmware package.
+.Pp
+The driver uses the
+.\" No LinuxKPI man pages so no .Xr here.
+.Em linuxkpi_wlan
+and
+.Em linuxkpi
+compat framework to bridge between the Linux and
+native
+.Fx
+driver code as well as to the native
+.Xr net80211 4
+wireless stack.
+.Pp
+While
+.Nm
+supports all 802.11 a/b/g/n/ac and ax
+the compatibility code currently only supports 802.11 a/b/g modes.
+Support for 802.11 n/ac is to come.
+.Sh LOADER TUNABLES
+.Bl -tag -width indent
+.It Va compat.linuxkpi.skb.mem_limit
+If you are running a 64bit system with more than 4GB of main memory
+you need to set this tunable to
+.Sy 1
+in
+.Xr loader.conf 5
+and reboot once to make it effective.
+This tunable will work around a problem w

git: 7ff12dd25ada - main - rtw8xfw: remove module build dirs for firmware long gone

2024-10-11 Thread Bjoern A. Zeeb
The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7ff12dd25ada486c4d33e854977514b2db690e7f

commit 7ff12dd25ada486c4d33e854977514b2db690e7f
Author: Bjoern A. Zeeb 
AuthorDate: 2024-10-10 22:43:29 +
Commit: Bjoern A. Zeeb 
CommitDate: 2024-10-11 13:40:15 +

rtw8xfw: remove module build dirs for firmware long gone

rtw88 and rtw89 firmware files were removed from main a year ago
after core members asked to not import more biinary blobs into main.
Also remove the module build framework for them being long gone.

People are asked to use fwget(8) to automatically install firmware
from ports according to the man page.  A solution for the install
media is still pending.

Fixes:  cf94672363d6638b7268c05b4628b62bbfc8dbe5
MFC after:  3 days (rtw89 only)
Sponsored by:   The FreeBSD Foundation
---
 sys/modules/rtw88fw/Makefile  |  8 
 sys/modules/rtw88fw/Makefile.inc  | 16 
 sys/modules/rtw88fw/rtw8723d/Makefile |  4 
 sys/modules/rtw88fw/rtw8821c/Makefile |  4 
 sys/modules/rtw88fw/rtw8822b/Makefile |  4 
 sys/modules/rtw88fw/rtw8822c/Makefile |  4 
 sys/modules/rtw88fw/rtw8822c_wow/Makefile |  4 
 sys/modules/rtw89fw/Makefile  |  5 -
 sys/modules/rtw89fw/Makefile.inc  | 16 
 sys/modules/rtw89fw/rtw8852a/Makefile |  4 
 sys/modules/rtw89fw/rtw8852c/Makefile |  4 
 11 files changed, 73 deletions(-)

diff --git a/sys/modules/rtw88fw/Makefile b/sys/modules/rtw88fw/Makefile
deleted file mode 100644
index 928c80fbff95..
--- a/sys/modules/rtw88fw/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-SUBDIR=\
-   rtw8723d \
-   rtw8821c \
-   rtw8822b \
-   rtw8822c \
-   rtw8822c_wow
-
-.include 
diff --git a/sys/modules/rtw88fw/Makefile.inc b/sys/modules/rtw88fw/Makefile.inc
deleted file mode 100644
index b03298a7d563..
--- a/sys/modules/rtw88fw/Makefile.inc
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Common rules for building firmware.  Note this gets auto-included
-# by the subdir Makefile's as a consequence of included bsd.kmod.mk.
-
-_NAME= rtw${NAME}_fw.bin
-
-IMG=   ${_NAME}
-KMOD=  ${_NAME}
-
-CLEANFILES+=   ${IMG}
-
-FIRMWS=${IMG}:${IMG}:${VERSION}
-
-${IMG}: ${SRCTOP}/sys/contrib/dev/rtw88fw/${IMG}
-   cp ${.ALLSRC} ${.TARGET}
-
diff --git a/sys/modules/rtw88fw/rtw8723d/Makefile 
b/sys/modules/rtw88fw/rtw8723d/Makefile
deleted file mode 100644
index e60918ea8457..
--- a/sys/modules/rtw88fw/rtw8723d/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-VERSION=   48
-NAME=  8723d
-
-.include 
diff --git a/sys/modules/rtw88fw/rtw8821c/Makefile 
b/sys/modules/rtw88fw/rtw8821c/Makefile
deleted file mode 100644
index d71aaa7d8669..
--- a/sys/modules/rtw88fw/rtw8821c/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-VERSION=   2408
-NAME=  8821c
-
-.include 
diff --git a/sys/modules/rtw88fw/rtw8822b/Makefile 
b/sys/modules/rtw88fw/rtw8822b/Makefile
deleted file mode 100644
index 1b428c30a3fb..
--- a/sys/modules/rtw88fw/rtw8822b/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-VERSION=   0
-NAME=  8822b
-
-.include 
diff --git a/sys/modules/rtw88fw/rtw8822c/Makefile 
b/sys/modules/rtw88fw/rtw8822c/Makefile
deleted file mode 100644
index 06676b5a0fa4..
--- a/sys/modules/rtw88fw/rtw8822c/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-VERSION=   9910
-NAME=  8822c
-
-.include 
diff --git a/sys/modules/rtw88fw/rtw8822c_wow/Makefile 
b/sys/modules/rtw88fw/rtw8822c_wow/Makefile
deleted file mode 100644
index d03b5c7d05a6..
--- a/sys/modules/rtw88fw/rtw8822c_wow/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-VERSION=   994
-NAME=  8822c_wow
-
-.include 
diff --git a/sys/modules/rtw89fw/Makefile b/sys/modules/rtw89fw/Makefile
deleted file mode 100644
index 62340479737d..
--- a/sys/modules/rtw89fw/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-SUBDIR=\
-   rtw8852a \
-   rtw8852c
-
-.include 
diff --git a/sys/modules/rtw89fw/Makefile.inc b/sys/modules/rtw89fw/Makefile.inc
deleted file mode 100644
index 349041ea5fff..
--- a/sys/modules/rtw89fw/Makefile.inc
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Common rules for building firmware.  Note this gets auto-included
-# by the subdir Makefile's as a consequence of included bsd.kmod.mk.
-
-_NAME= rtw${NAME}_fw.bin
-
-IMG=   ${_NAME}
-KMOD=  ${_NAME}
-
-CLEANFILES+=   ${IMG}
-
-FIRMWS=${IMG}:${IMG}:${VERSION}
-
-${IMG}: ${SRCTOP}/sys/contrib/dev/rtw89fw/${IMG}
-   cp ${.ALLSRC} ${.TARGET}
-
diff --git a/sys/modules/rtw89fw/rtw8852a/Makefile 
b/sys/modules/rtw89fw/rtw8852a/Makefile
deleted file mode 100644
index 876e8145759b..
--- a/sys/modules/rtw89fw/rtw8852a/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-VERSION=   

git: ce15215befa1 - main - rtw89: add missing bsddriver.name assignments for two chipsets

2024-10-11 Thread Bjoern A. Zeeb
The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ce15215befa1022d9a20ec15bdb0739dbe55f10f

commit ce15215befa1022d9a20ec15bdb0739dbe55f10f
Author: Bjoern A. Zeeb 
AuthorDate: 2024-10-10 23:07:55 +
Commit: Bjoern A. Zeeb 
CommitDate: 2024-10-11 13:40:15 +

rtw89: add missing bsddriver.name assignments for two chipsets

On FreeBSDs we locally set bsddriver.name in struct pci_driver to have
the same name for all chipsets.  This helps with, e.g., device
enumeration.  For two chipsets the manual entry was missing.

Sponsored by:   The FreeBSD Foundation
MFC after:  3 days
---
 sys/contrib/dev/rtw89/rtw8851be.c | 3 +++
 sys/contrib/dev/rtw89/rtw8852be.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/sys/contrib/dev/rtw89/rtw8851be.c 
b/sys/contrib/dev/rtw89/rtw8851be.c
index 0f7711c50bd1..76216b790450 100644
--- a/sys/contrib/dev/rtw89/rtw8851be.c
+++ b/sys/contrib/dev/rtw89/rtw8851be.c
@@ -78,6 +78,9 @@ static struct pci_driver rtw89_8851be_driver = {
.probe  = rtw89_pci_probe,
.remove = rtw89_pci_remove,
.driver.pm  = &rtw89_pm_ops,
+#if defined(__FreeBSD__)
+   .bsddriver.name = KBUILD_MODNAME,
+#endif
 };
 module_pci_driver(rtw89_8851be_driver);
 
diff --git a/sys/contrib/dev/rtw89/rtw8852be.c 
b/sys/contrib/dev/rtw89/rtw8852be.c
index ecf39d2d9f81..be96ff56d699 100644
--- a/sys/contrib/dev/rtw89/rtw8852be.c
+++ b/sys/contrib/dev/rtw89/rtw8852be.c
@@ -82,6 +82,9 @@ static struct pci_driver rtw89_8852be_driver = {
.probe  = rtw89_pci_probe,
.remove = rtw89_pci_remove,
.driver.pm  = &rtw89_pm_ops,
+#if defined(__FreeBSD__)
+   .bsddriver.name = KBUILD_MODNAME,
+#endif
 };
 module_pci_driver(rtw89_8852be_driver);
 



git: fbc593342cbf - stable/14 - capsicum-test: rights are propagated on accept(2)

2024-10-11 Thread Ed Maste
The branch stable/14 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fbc593342cbf1ba962cf3266a245402169c0ffcf

commit fbc593342cbf1ba962cf3266a245402169c0ffcf
Author: Ed Maste 
AuthorDate: 2024-10-07 18:26:58 +
Commit: Ed Maste 
CommitDate: 2024-10-11 15:24:55 +

capsicum-test: rights are propagated on accept(2)

As of commit 85b0f9de11c3 ("capsicum: propagate rights on accept(2)")
a capability is generated from accept(cap_fd,...).  Enable the
corresponding test code.

PR: 201052
Reviewed by:oshogbo
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46994

(cherry picked from commit 6684779b321590c71f162390bcf28feee2a3b967)
---
 contrib/capsicum-test/capsicum-freebsd.h | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/contrib/capsicum-test/capsicum-freebsd.h 
b/contrib/capsicum-test/capsicum-freebsd.h
index 96ceb9b6d5f1..da7bb38f073b 100644
--- a/contrib/capsicum-test/capsicum-freebsd.h
+++ b/contrib/capsicum-test/capsicum-freebsd.h
@@ -59,10 +59,9 @@ typedef unsigned long cap_ioctl_t;
 // Too many links
 #define E_TOO_MANY_LINKS EMLINK
 
-// TODO(FreeBSD): uncomment if/when FreeBSD propagates rights on accept.
-// FreeBSD does not generate a capability from accept(cap_fd,...).
-// https://bugs.freebsd.org/201052
-// #define CAP_FROM_ACCEPT
+// As of commit 85b0f9de11c3 ("capsicum: propagate rights on accept(2)")
+// FreeBSD generates a capability from accept(cap_fd,...).
+#define CAP_FROM_ACCEPT
 // TODO(FreeBSD): uncomment if/when FreeBSD propagates rights on sctp_peeloff.
 // FreeBSD does not generate a capability from sctp_peeloff(cap_fd,...).
 // https://bugs.freebsd.org/201052



git: a8458496b4d9 - stable/14 - capsicum-test: include SCTP tests

2024-10-11 Thread Ed Maste
The branch stable/14 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a8458496b4d98962ca194e93b039dba172d7753d

commit a8458496b4d98962ca194e93b039dba172d7753d
Author: Ed Maste 
AuthorDate: 2024-10-07 19:18:33 +
Commit: Ed Maste 
CommitDate: 2024-10-11 15:24:55 +

capsicum-test: include SCTP tests

HAVE_SCTP is #defined in syscalls.h, so move the #ifdef after the
inclusion of the header that #defines it.

Issue https://github.com/google/capsicum-test/issues/60 is open upstream
in case a slightly different version is needed for Linux.

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

(cherry picked from commit e4550c9aa06af54d066c794f1da14f7c91bb5bc0)
---
 contrib/capsicum-test/sctp.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/capsicum-test/sctp.cc b/contrib/capsicum-test/sctp.cc
index 76302059fa19..c8c642454a80 100644
--- a/contrib/capsicum-test/sctp.cc
+++ b/contrib/capsicum-test/sctp.cc
@@ -1,6 +1,5 @@
 // Tests of SCTP functionality
 // Requires: libsctp-dev package on Debian Linux, CONFIG_IP_SCTP in kernel 
config
-#ifdef HAVE_SCTP
 #include 
 #include 
 #include 
@@ -12,6 +11,7 @@
 #include "capsicum.h"
 #include "capsicum-test.h"
 
+#ifdef HAVE_SCTP
 static cap_rights_t r_ro;
 static cap_rights_t r_wo;
 static cap_rights_t r_rw;



git: e7f3888b31c2 - stable/14 - capsicum-test: skip SCTP tests if SCTP not available

2024-10-11 Thread Ed Maste
The branch stable/14 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e7f3888b31c23ef3e26dc2bc04accf03ef943517

commit e7f3888b31c23ef3e26dc2bc04accf03ef943517
Author: Ed Maste 
AuthorDate: 2024-10-07 20:04:05 +
Commit: Ed Maste 
CommitDate: 2024-10-11 15:24:55 +

capsicum-test: skip SCTP tests if SCTP not available

Skip the test rather than failing if SCTP is not available (e.g., if
sctp.ko is not loaded).

Also submitted upstream as
https://github.com/google/capsicum-test/pull/61

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

(cherry picked from commit 1d83090d850f627b6d6ebe7837e807df5d29799f)
---
 contrib/capsicum-test/sctp.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/capsicum-test/sctp.cc b/contrib/capsicum-test/sctp.cc
index 5f0d169456a8..76302059fa19 100644
--- a/contrib/capsicum-test/sctp.cc
+++ b/contrib/capsicum-test/sctp.cc
@@ -61,6 +61,9 @@ static int SctpClient(int port, unsigned char byte) {
 
 TEST(Sctp, Socket) {
   int sock = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
+  if (sock == -1 && errno == EPROTONOSUPPORT) {
+GTEST_SKIP() << "socket(..., IPPROTO_SCTP) -> EPROTONOSUPPORT";
+  }
   EXPECT_OK(sock);
   if (sock < 0) return;
 



git: 2f29060f4613 - stable/14 - pkg: improve error message

2024-10-11 Thread Ed Maste
The branch stable/14 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2f29060f46138bbfc52c5944825293d598cc68de

commit 2f29060f46138bbfc52c5944825293d598cc68de
Author: Ed Maste 
AuthorDate: 2024-10-07 16:33:12 +
Commit: Ed Maste 
CommitDate: 2024-10-11 15:27:42 +

pkg: improve error message

Print the complete list of url that have failed

PR: 281924
Co-authored-by: Baptiste Daroussin 
Differential Revision: https://reviews.freebsd.org/D46983

(cherry picked from commit be9243409d6be99f5d7815b6d074a85a6e84f7ce)
---
 usr.sbin/pkg/pkg.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c
index b78565b9437a..bb42526f56cb 100644
--- a/usr.sbin/pkg/pkg.c
+++ b/usr.sbin/pkg/pkg.c
@@ -856,7 +856,11 @@ bootstrap_pkg(bool force, const char *fetchOpts)
goto cleanup;
 
 fetchfail:
-   warnx("Error fetching %s: %s", url, fetchLastErrString);
+   for (int j = 0; bootstrap_names[j] != NULL; j++) {
+   warnx("Attempted to fetch %s/Latest/%s", packagesite,
+   bootstrap_names[j]);
+   }
+   warnx("Error: %s", fetchLastErrString);
if (fetchLastErrCode == FETCH_RESOLV) {
fprintf(stderr, "Address resolution failed for %s.\n", 
packagesite);
fprintf(stderr, "Consider changing PACKAGESITE.\n");



git: fef1f3fecd5b - stable/14 - pkg: prefer .pkg extension

2024-10-11 Thread Ed Maste
The branch stable/14 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fef1f3fecd5b6e7bf040f6dd2e31177332c3c0ec

commit fef1f3fecd5b6e7bf040f6dd2e31177332c3c0ec
Author: Ed Maste 
AuthorDate: 2024-10-07 15:11:09 +
Commit: Ed Maste 
CommitDate: 2024-10-11 15:27:41 +

pkg: prefer .pkg extension

.pkg is the default extension as of commit c244b1d8a387, falling back to
.txz if not found.

PR: 281924
Reviewed by:bapt
Fixes: a2aac2f5e564 ("pkg(7): when bootstrapping first search for pkg.bsd 
file then pkg.txz")
Fixes: c244b1d8a387 ("pkg: settle the uniq extension to .pkg instead of 
.bsd")
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46977

(cherry picked from commit f5c847ae849aab9354d0956afd683f1c90bfd91e)
---
 usr.sbin/pkg/pkg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c
index 0689c67cf822..b78565b9437a 100644
--- a/usr.sbin/pkg/pkg.c
+++ b/usr.sbin/pkg/pkg.c
@@ -896,7 +896,7 @@ static const char args_bootstrap_message[] =
 
 static const char args_add_message[] =
 "Too many arguments\n"
-"Usage: pkg add [-f] [-y] {pkg.txz}\n";
+"Usage: pkg add [-f] [-y] {pkg.pkg}\n";
 
 static int
 pkg_query_yes_no(void)
@@ -1168,7 +1168,7 @@ main(int argc, char *argv[])
 
if (add_pkg) {
if (pkgarg == NULL) {
-   fprintf(stderr, "Path to pkg.txz required\n");
+   fprintf(stderr, "Path to pkg.pkg required\n");
exit(EXIT_FAILURE);
}
if (access(pkgarg, R_OK) == -1) {



git: c008b8f585b6 - main - git-arc: minor manpage edits

2024-10-11 Thread Ed Maste
The branch main has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c008b8f585b62bb93271500f3307383731661d6e

commit c008b8f585b62bb93271500f3307383731661d6e
Author: Ed Maste 
AuthorDate: 2024-10-11 14:52:14 +
Commit: Ed Maste 
CommitDate: 2024-10-11 15:14:43 +

git-arc: minor manpage edits

Explicitly mention that it requires the arcanist port or package, and
edit some grammar and markup.

Reviewed by:markj
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47060
---
 tools/tools/git/git-arc.1 | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/tools/git/git-arc.1 b/tools/tools/git/git-arc.1
index 10662899f5fc..587b304dd794 100644
--- a/tools/tools/git/git-arc.1
+++ b/tools/tools/git/git-arc.1
@@ -59,8 +59,11 @@ The
 utility creates and manages
 .Fx
 Phabricator reviews based on git commits.
+It requires the
+.Pa devel/arcanist
+port or package.
 .Pp
-Git
+.Nm
 assumes a one-to-one relationship between git commits and
 Differential Revisions, and the Differential Revision title must match
 the summary line of the corresponding commit.
@@ -79,13 +82,13 @@ Before processing commit(s) display list of commits to be 
processed
 and wait for confirmation.
 .It Fl r Ar reviewer
 Add one or more reviewers, separated by commas, to revision(s) being created.
-Argument(s) must be existing Phabricator user or group.
+Each argument must be an existing Phabricator user or group.
 .It Fl s Ar subscriber
 Add one or more subscribers, separated by commas, to revision(s) being created.
 Each argument must be an existing Phabricator user or group.
 .It Fl p Ar parent
 Specify the parent of the first commit in the list.
-This is useful when adding more commits on top of the already existing
+This is useful when adding more commits on top of an already existing
 stack in Phabricator.
 .El
 .It Cm list



git: a5be19efbb7c - stable/14 - bhyve/nvme: Fix out-of-bounds read in NVMe log page

2024-10-11 Thread Ed Maste
The branch stable/14 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a5be19efbb7c6b07d574ef048b2ebade00440873

commit a5be19efbb7c6b07d574ef048b2ebade00440873
Author: Chuck Tuffli 
AuthorDate: 2024-09-19 15:11:30 +
Commit: Ed Maste 
CommitDate: 2024-10-11 15:34:27 +

bhyve/nvme: Fix out-of-bounds read in NVMe log page

The function nvme_opc_get_log_page in the file usr.sbin/bhyve/pci_nvme.c
is vulnerable to buffer over-read. The value logoff is user controlled
but never checked against the value of logsize. Thus the difference:
logsize - logoff
can underflow.

Due to the sc structure layout, an attacker can dump internals fields of
sc and the content of next heap allocation.

Reported by: Synacktiv
Reviewed by:emaste, jhb
Security: HYP-07
Sponsored by: Alpha-Omega Project, The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46021

(cherry picked from commit b0a24be007d83f7929de5b3fc320a29e6868067d)
---
 usr.sbin/bhyve/pci_nvme.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 45ab1b11fda4..b8eb24d91b49 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -1398,7 +1398,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct 
nvme_command* command,
logsize *= sizeof(uint32_t);
logoff  = ((uint64_t)(command->cdw13) << 32) | command->cdw12;
 
-   DPRINTF("%s log page %u len %u", __func__, logpage, logsize);
+   DPRINTF("%s log page %u offset %lu len %u", __func__, logpage, logoff, 
logsize);
 
switch (logpage) {
case NVME_LOG_ERROR:
@@ -1410,7 +1410,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct 
nvme_command* command,
 
nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1,
command->prp2, (uint8_t *)&sc->err_log + logoff,
-   MIN(logsize - logoff, sizeof(sc->err_log)),
+   MIN(logsize, sizeof(sc->err_log) - logoff),
NVME_COPY_TO_PRP);
break;
case NVME_LOG_HEALTH_INFORMATION:
@@ -1433,7 +1433,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct 
nvme_command* command,
 
nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1,
command->prp2, (uint8_t *)&sc->health_log + logoff,
-   MIN(logsize - logoff, sizeof(sc->health_log)),
+   MIN(logsize, sizeof(sc->health_log) - logoff),
NVME_COPY_TO_PRP);
break;
case NVME_LOG_FIRMWARE_SLOT:
@@ -1445,7 +1445,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct 
nvme_command* command,
 
nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1,
command->prp2, (uint8_t *)&sc->fw_log + logoff,
-   MIN(logsize - logoff, sizeof(sc->fw_log)),
+   MIN(logsize, sizeof(sc->fw_log) - logoff),
NVME_COPY_TO_PRP);
break;
case NVME_LOG_CHANGED_NAMESPACE:
@@ -1457,7 +1457,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct 
nvme_command* command,
 
nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1,
command->prp2, (uint8_t *)&sc->ns_log + logoff,
-   MIN(logsize - logoff, sizeof(sc->ns_log)),
+   MIN(logsize, sizeof(sc->ns_log) - logoff),
NVME_COPY_TO_PRP);
memset(&sc->ns_log, 0, sizeof(sc->ns_log));
break;



git: c8f75686adc6 - stable/13 - bhyve/nvme: Fix out-of-bounds read in NVMe log page

2024-10-11 Thread Ed Maste
The branch stable/13 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c8f75686adc6bc2078ade279d838cbc5b1745e71

commit c8f75686adc6bc2078ade279d838cbc5b1745e71
Author: Chuck Tuffli 
AuthorDate: 2024-09-19 15:11:30 +
Commit: Ed Maste 
CommitDate: 2024-10-11 15:42:40 +

bhyve/nvme: Fix out-of-bounds read in NVMe log page

The function nvme_opc_get_log_page in the file usr.sbin/bhyve/pci_nvme.c
is vulnerable to buffer over-read. The value logoff is user controlled
but never checked against the value of logsize. Thus the difference:
logsize - logoff
can underflow.

Due to the sc structure layout, an attacker can dump internals fields of
sc and the content of next heap allocation.

Reported by: Synacktiv
Reviewed by:emaste, jhb
Security: HYP-07
Sponsored by: Alpha-Omega Project, The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46021

(cherry picked from commit b0a24be007d83f7929de5b3fc320a29e6868067d)
(cherry picked from commit a5be19efbb7c6b07d574ef048b2ebade00440873)
---
 usr.sbin/bhyve/pci_nvme.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 3db306a19119..cbe4d87b6f60 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -1454,7 +1454,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct 
nvme_command* command,
logsize *= sizeof(uint32_t);
logoff  = ((uint64_t)(command->cdw13) << 32) | command->cdw12;
 
-   DPRINTF("%s log page %u len %u", __func__, logpage, logsize);
+   DPRINTF("%s log page %u offset %lu len %u", __func__, logpage, logoff, 
logsize);
 
switch (logpage) {
case NVME_LOG_ERROR:
@@ -1466,7 +1466,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct 
nvme_command* command,
 
nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1,
command->prp2, (uint8_t *)&sc->err_log + logoff,
-   MIN(logsize - logoff, sizeof(sc->err_log)),
+   MIN(logsize, sizeof(sc->err_log) - logoff),
NVME_COPY_TO_PRP);
break;
case NVME_LOG_HEALTH_INFORMATION:
@@ -1489,7 +1489,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct 
nvme_command* command,
 
nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1,
command->prp2, (uint8_t *)&sc->health_log + logoff,
-   MIN(logsize - logoff, sizeof(sc->health_log)),
+   MIN(logsize, sizeof(sc->health_log) - logoff),
NVME_COPY_TO_PRP);
break;
case NVME_LOG_FIRMWARE_SLOT:
@@ -1501,7 +1501,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct 
nvme_command* command,
 
nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1,
command->prp2, (uint8_t *)&sc->fw_log + logoff,
-   MIN(logsize - logoff, sizeof(sc->fw_log)),
+   MIN(logsize, sizeof(sc->fw_log) - logoff),
NVME_COPY_TO_PRP);
break;
case NVME_LOG_CHANGED_NAMESPACE:
@@ -1513,7 +1513,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct 
nvme_command* command,
 
nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1,
command->prp2, (uint8_t *)&sc->ns_log + logoff,
-   MIN(logsize - logoff, sizeof(sc->ns_log)),
+   MIN(logsize, sizeof(sc->ns_log) - logoff),
NVME_COPY_TO_PRP);
memset(&sc->ns_log, 0, sizeof(sc->ns_log));
break;



git: 2e7f4728fa73 - stable/14 - ctl: limit memory allocation in pci_virtio_scsi

2024-10-11 Thread Ed Maste
The branch stable/14 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2e7f4728fa738a7a7b6c4e4c46eb68952386efce

commit 2e7f4728fa738a7a7b6c4e4c46eb68952386efce
Author: Pierre Pronchery 
AuthorDate: 2024-07-19 17:32:27 +
Commit: Ed Maste 
CommitDate: 2024-10-11 15:53:17 +

ctl: limit memory allocation in pci_virtio_scsi

The virtio_scsi device allows a VM guest to directly send SCSI commands
(ctsio->cdb array) to the kernel driver exposed on /dev/cam/ctl
(ctl.ko).

All kernel commands accessible from the guest are defined by
ctl_cmd_table.

The command ctl_persistent_reserve_out (cdb[0]=0x5F and cbd[1]=0) allows
the caller to call malloc() with an arbitrary size (uint32_t). This can
be used by the guest to overload the kernel memory (DOS attack).

Reported by:Synacktiv
Reviewed by:asomers
Security:   HYP-08
Sponsored by:   The Alpha-Omega Project
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46044

(cherry picked from commit 64b0f52be2c9d7bcecebfeef393f8ec56cb85f47)
---
 sys/cam/ctl/ctl.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index de759f81bc86..5c33645f0f0d 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -8314,6 +8314,18 @@ ctl_persistent_reserve_out(struct ctl_scsiio *ctsio)
 
param_len = scsi_4btoul(cdb->length);
 
+   /* validate the parameter length */
+   if (param_len != 24) {
+   ctl_set_invalid_field(ctsio,
+   /*sks_valid*/ 1,
+   /*command*/ 1,
+   /*field*/ 5,
+   /*bit_valid*/ 1,
+   /*bit*/ 0);
+   ctl_done((union ctl_io *)ctsio);
+   return (CTL_RETVAL_COMPLETE);
+   }
+
if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) {
ctsio->kern_data_ptr = malloc(param_len, M_CTL, M_WAITOK);
ctsio->kern_data_len = param_len;



git: 4f2ca36c7bec - main - arm64: Disable coverage sanitization of `pmap_update_strided`

2024-10-11 Thread Mark Johnston
The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4f2ca36c7becd20b21ce5ef7256bbd42f732dafe

commit 4f2ca36c7becd20b21ce5ef7256bbd42f732dafe
Author: Zhuo Ying Jiang Li 
AuthorDate: 2024-10-11 16:41:49 +
Commit: Mark Johnston 
CommitDate: 2024-10-11 16:52:53 +

arm64: Disable coverage sanitization of `pmap_update_strided`

The break-before-make update invalidates PTEs, including the PTE
pointing to curthread, causing a fault in `trace_pc`. This
addresses a similar issue in
01bb9a2a3557bc9389f628d301cd691e08266f1d.

Reviewed by:markj
MFC after:  1 week
---
 sys/arm64/arm64/pmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 6f758b7ff10c..2c8f8b416a9e 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -4618,7 +4618,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *ptep, 
pd_entry_t newpte,
 /*
  * Performs a break-before-make update of an ATTR_CONTIGUOUS mapping.
  */
-static void
+static void __nosanitizecoverage
 pmap_update_strided(pmap_t pmap, pd_entry_t *ptep, pd_entry_t *ptep_end,
 pd_entry_t newpte, vm_offset_t va, vm_offset_t stride, vm_size_t size)
 {



git: a78bacf3b0ec - main - cdefs: Add __nosanitizecoverage

2024-10-11 Thread Mark Johnston
The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a78bacf3b0ec0526e38f299fe4e17557f0930303

commit a78bacf3b0ec0526e38f299fe4e17557f0930303
Author: Mark Johnston 
AuthorDate: 2024-10-11 16:51:13 +
Commit: Mark Johnston 
CommitDate: 2024-10-11 16:52:53 +

cdefs: Add __nosanitizecoverage

Obtained from:  CheriBSD
MFC after:  1 week
---
 sys/sys/cdefs.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index a56839d57c7a..9c4c8e0a324a 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -719,9 +719,11 @@
 #define __nosanitizeaddress__attribute__((no_sanitize("address")))
 #define __nosanitizememory __attribute__((no_sanitize("memory")))
 #endif
+#define __nosanitizecoverage   __attribute__((no_sanitize("coverage")))
 #define __nosanitizethread __attribute__((no_sanitize("thread")))
 #else
 #define __nosanitizeaddress
+#define __nosanitizecoverage
 #define __nosanitizememory
 #define __nosanitizethread
 #endif



git: 8056c665574e - main - acpica: Update the SPCR table to version 4

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8056c665574e2bca135658764773281893e8fc27

commit 8056c665574e2bca135658764773281893e8fc27
Author: Sia Jee Heng 
AuthorDate: 2024-02-29 06:39:50 +
Commit: Warner Losh 
CommitDate: 2024-10-11 18:06:33 +

acpica: Update the SPCR table to version 4

cherry pick 1eeff52124a45d5cd887ba5687bbad0116e4d211 from acpica:

SPCR: Update the SPCR table to version 4

The Microsoft Serial Port Console Redirection (SPCR) specification
revision 1.09 comprises additional fields [1]. The newly added fields
are:
- RISC-V SBI
- Precise Baud Rate
- NamespaceStringLength
- NamespaceStringOffset
- NamespaceString

Additionaly, this code will support up to SPCR revision 1.10, as it
includes only minor wording changes.

[1] 
https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table

Signed-off-by: Sia Jee Heng 
---
 sys/contrib/dev/acpica/common/dmtbinfo3.c|  8 ++--
 sys/contrib/dev/acpica/compiler/dttemplate.h |  8 +---
 sys/contrib/dev/acpica/include/actbl3.h  | 12 
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/sys/contrib/dev/acpica/common/dmtbinfo3.c 
b/sys/contrib/dev/acpica/common/dmtbinfo3.c
index 702cdc0133b3..7a482ba0ffa9 100644
--- a/sys/contrib/dev/acpica/common/dmtbinfo3.c
+++ b/sys/contrib/dev/acpica/common/dmtbinfo3.c
@@ -255,7 +255,7 @@ ACPI_DMTABLE_INFO   AcpiDmTableInfoSpcr[] =
 {ACPI_DMT_UINT8,ACPI_SPCR_OFFSET (StopBits),"Stop 
Bits", 0},
 {ACPI_DMT_UINT8,ACPI_SPCR_OFFSET (FlowControl), "Flow 
Control", 0},
 {ACPI_DMT_UINT8,ACPI_SPCR_OFFSET (TerminalType),"Terminal 
Type", 0},
-{ACPI_DMT_UINT8,ACPI_SPCR_OFFSET (Reserved2),   
"Reserved", 0},
+{ACPI_DMT_UINT8,ACPI_SPCR_OFFSET (Language),
"Language", 0},
 {ACPI_DMT_UINT16,   ACPI_SPCR_OFFSET (PciDeviceId), "PCI 
Device ID", 0},
 {ACPI_DMT_UINT16,   ACPI_SPCR_OFFSET (PciVendorId), "PCI 
Vendor ID", 0},
 {ACPI_DMT_UINT8,ACPI_SPCR_OFFSET (PciBus),  "PCI Bus", 
0},
@@ -263,7 +263,11 @@ ACPI_DMTABLE_INFO   AcpiDmTableInfoSpcr[] =
 {ACPI_DMT_UINT8,ACPI_SPCR_OFFSET (PciFunction), "PCI 
Function", 0},
 {ACPI_DMT_UINT32,   ACPI_SPCR_OFFSET (PciFlags),"PCI 
Flags", 0},
 {ACPI_DMT_UINT8,ACPI_SPCR_OFFSET (PciSegment),  "PCI 
Segment", 0},
-{ACPI_DMT_UINT32,   ACPI_SPCR_OFFSET (Reserved2),   
"Reserved", 0},
+{ACPI_DMT_UINT32,   ACPI_SPCR_OFFSET (UartClkFreq), "Uart 
Clock Freq", 0},
+{ACPI_DMT_UINT32,   ACPI_SPCR_OFFSET (PreciseBaudrate), "Precise 
Baud rate", 0},
+{ACPI_DMT_UINT16,   ACPI_SPCR_OFFSET (NameSpaceStringLength),   
"NameSpaceStringLength", 0},
+{ACPI_DMT_UINT16,   ACPI_SPCR_OFFSET (NameSpaceStringOffset),   
"NameSpaceStringOffset", 0},
+{ACPI_DMT_STRING,   ACPI_SPCR_OFFSET (NameSpaceString), 
"NamespaceString", 0},
 ACPI_DMT_TERMINATOR
 };
 
diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h 
b/sys/contrib/dev/acpica/compiler/dttemplate.h
index c97a8ed24eee..1560f2008cfa 100644
--- a/sys/contrib/dev/acpica/compiler/dttemplate.h
+++ b/sys/contrib/dev/acpica/compiler/dttemplate.h
@@ -1956,8 +1956,8 @@ const unsigned char TemplateSlit[] =
 
 const unsigned char TemplateSpcr[] =
 {
-0x53,0x50,0x43,0x52,0x50,0x00,0x00,0x00,  /* "SPCRP..." */
-0x01,0xE3,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 0008"..INTEL " */
+0x53,0x50,0x43,0x52,0x5A,0x00,0x00,0x00,  /* "SPCRZ..." */
+0x04,0x4E,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 0008"..INTEL " */
 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 0010"TEMPLATE" */
 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 0018"INTL" */
 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00,  /* 0020"(.. " */
@@ -1965,7 +1965,9 @@ const unsigned char TemplateSpcr[] =
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 0030"" */
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 0038"" */
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 0040"" */
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00   /* 0048"" */
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 0048"" */
+0x00,0x00,0x00,0x00,0x02,0x00,0x58,0x00,  /* 0050"..X." */
+0x2E,0x00 /* 0058".." */
 };
 
 const unsigned char TemplateSpmi[] =
diff --git a/sys/contrib/dev/acpica/include/actbl3.h 
b/sys/contrib/dev/acpica/include/actbl3.h
index 1438c1db507c..81a022544a4a 100644
--- a/sys/contrib/dev/acpica/include/actbl3.h
+++ b/sys/contrib/dev/acpica/include/actbl3.h
@@ -243,10 +243,10 @@ typedef struct a

git: ca9e31eead41 - main - Revert "apcidump: Add dumping SPCR"

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ca9e31eead41ff1b5d2fcf8989ab527c89485a90

commit ca9e31eead41ff1b5d2fcf8989ab527c89485a90
Author: Warner Losh 
AuthorDate: 2024-10-11 17:52:59 +
Commit: Warner Losh 
CommitDate: 2024-10-11 18:06:33 +

Revert "apcidump: Add dumping SPCR"

This reverts commit 593d7a1634b5:

In preparation for importing new SPCR definitions, back out my hack
since it conflicts with the new definitions.

Sponsored by:   Netflix
---
 usr.sbin/acpi/acpidump/acpi.c | 170 +-
 usr.sbin/acpi/acpidump/acpidump.8 |   1 -
 2 files changed, 3 insertions(+), 168 deletions(-)

diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c
index 95ecb42825eb..fe68b5062351 100644
--- a/usr.sbin/acpi/acpidump/acpi.c
+++ b/usr.sbin/acpi/acpidump/acpi.c
@@ -1257,180 +1257,18 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp)
 
printf(END_COMMENT);
 }
-
 static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp)
 {
ACPI_TABLE_TPM2 *tpm2;
-
+   
printf (BEGIN_COMMENT);
acpi_print_sdt(sdp);
tpm2 = (ACPI_TABLE_TPM2 *) sdp;
printf ("\t\tControlArea=%jx\n", tpm2->ControlAddress);
-   printf ("\t\tStartMethod=%x\n", tpm2->StartMethod);
-   printf (END_COMMENT);
-}
-
-static int spcr_xlate_baud(uint8_t r)
-{
-   static int rates[] = { 9600, 19200, -1, 57600, 115200 };
-   _Static_assert(nitems(rates) == 7 - 3 + 1, "rates array size 
incorrect");
-
-   if (r == 0)
-   return (0);
-
-   if (r < 3 || r > 7)
-   return (-1);
-
-   return (rates[r - 3]);
-}
-
-static const char *spcr_interface_type(int ift)
-{
-   static const char *if_names[] = {
-   [0x00] = "Fully 16550-compatible",
-   [0x01] = "16550 subset compatible with DBGP Revision 1",
-   [0x02] = "MAX311xE SPI UART",
-   [0x03] = "Arm PL011 UART",
-   [0x04] = "MSM8x60 (e.g. 8960)",
-   [0x05] = "Nvidia 16550",
-   [0x06] = "TI OMAP",
-   [0x07] = "Reserved (Do Not Use)",
-   [0x08] = "APM88",
-   [0x09] = "MSM8974",
-   [0x0a] = "SAM5250",
-   [0x0b] = "Intel USIF",
-   [0x0c] = "i.MX 6",
-   [0x0d] = "(deprecated) Arm SBSA (2.x only) Generic UART 
supporting only 32-bit accesses",
-   [0x0e] = "Arm SBSA Generic UART",
-   [0x0f] = "Arm DCC",
-   [0x10] = "BCM2835",
-   [0x11] = "SDM845 with clock rate of 1.8432 MHz",
-   [0x12] = "16550-compatible with parameters defined in Generic 
Address Structure",
-   [0x13] = "SDM845 with clock rate of 7.372 MHz",
-   [0x14] = "Intel LPSS",
-   [0x15] = "RISC-V SBI console (any supported SBI mechanism)",
-   };
-
-   if (ift >= (int)nitems(if_names) || if_names[ift] == NULL)
-   return ("Reserved");
-   return (if_names[ift]);
-}
-
-static const char *spcr_interrupt_type(int ift)
-{
-   static char buf[100];
-
-#define APPEND(b,s) \
-   if ((ift & (b)) != 0) { \
-   if (strlen(buf) > 0) \
-   strlcat(buf, ",", sizeof(buf)); \
-   strlcat(buf, s, sizeof(buf)); \
-   }
-
-   *buf = '\0';
-   APPEND(0x01, "PC/AT IRQ");
-   APPEND(0x02, "I/O APIC");
-   APPEND(0x04, "I/O SAPIC");
-   APPEND(0x08, "ARMH GIC");
-   APPEND(0x10, "RISC-V PLIC/APLIC");
-
-#undef APPEND
-
-   return (buf);
-}
-
-static const char *spcr_terminal_type(int type)
-{
-   static const char *term_names[] = {
-   [0] = "VT100",
-   [1] = "Extended VT100",
-   [2] = "VT-UTF8",
-   [3] = "ANSI",
-   };
-
-   if (type >= (int)nitems(term_names) || term_names[type] == NULL)
-   return ("Reserved");
-   return (term_names[type]);
-}
-
-/*
- * Serial Port Console Redirection version 3 and 4 are too new to have proper
- * definitions in ACPI headers, so provide them.
- */
-#pragma pack(1)
-struct SPCR_3
-{
-   ACPI_TABLE_SPCR spcr2;
-   UINT32  UARTClockFrequency;
-};
-
-struct SPCR_4
-{
-   struct SPCR_3   spcr3;
-   UINT32  PreciseBaudRate;
-   UINT16  NamespaceStringLength;
-   UINT16  NamespaceStringOffset;
-};
-#pragma pack()
-
-static void acpi_handle_spcr(ACPI_TABLE_HEADER *sdp)
-{
-   ACPI_TABLE_SPCR *spcr;
-
-   printf (BEGIN_COMMENT);
-   acpi_print_sdt(sdp);
-
-   /* Rev 1 and 2 are the same size */
-   spcr = (ACPI_TABLE_SPCR *) sdp;
-   printf ("\tInterfaceType=%d (%s)\n", spcr->InterfaceType,
-   spcr_interface_type(spcr->InterfaceType));
-   printf ("\tSerialPort=");
-   acpi_print_gas(&spcr->SerialPort);
-   printf ("\n\tInterruptType=%#x (%s)\n", spcr

git: 5d57fad876ee - main - acpidump: Print SPCR v3 and v4 fields

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5d57fad876ee6b55761a7643f5b94e3d6d54e3e0

commit 5d57fad876ee6b55761a7643f5b94e3d6d54e3e0
Author: Warner Losh 
AuthorDate: 2024-10-11 17:51:57 +
Commit: Warner Losh 
CommitDate: 2024-10-11 18:06:33 +

acpidump: Print SPCR v3 and v4 fields

This reapplies 593d7a1634b5 to implement printing of SPCR v3 and SPCR v4
fields after ACPI actble3.h update. ACPIca used different names and
didn't do the weird nesting I did in the prior commit for better
co-existance.

Sponsored by: Netflix
---
 usr.sbin/acpi/acpidump/acpi.c | 143 +-
 1 file changed, 142 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c
index fe68b5062351..4eb361a6f479 100644
--- a/usr.sbin/acpi/acpidump/acpi.c
+++ b/usr.sbin/acpi/acpidump/acpi.c
@@ -1257,6 +1257,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp)
 
printf(END_COMMENT);
 }
+
 static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp)
 {
ACPI_TABLE_TPM2 *tpm2;
@@ -1268,7 +1269,145 @@ static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp)
printf ("\t\tStartMethod=%x\n", tpm2->StartMethod); 
printf (END_COMMENT);
 }
-   
+
+static int spcr_xlate_baud(uint8_t r)
+{
+   static int rates[] = { 9600, 19200, -1, 57600, 115200 };
+   _Static_assert(nitems(rates) == 7 - 3 + 1, "rates array size 
incorrect");
+
+   if (r == 0)
+   return (0);
+
+   if (r < 3 || r > 7)
+   return (-1);
+
+   return (rates[r - 3]);
+}
+
+static const char *spcr_interface_type(int ift)
+{
+   static const char *if_names[] = {
+   [0x00] = "Fully 16550-compatible",
+   [0x01] = "16550 subset compatible with DBGP Revision 1",
+   [0x02] = "MAX311xE SPI UART",
+   [0x03] = "Arm PL011 UART",
+   [0x04] = "MSM8x60 (e.g. 8960)",
+   [0x05] = "Nvidia 16550",
+   [0x06] = "TI OMAP",
+   [0x07] = "Reserved (Do Not Use)",
+   [0x08] = "APM88",
+   [0x09] = "MSM8974",
+   [0x0a] = "SAM5250",
+   [0x0b] = "Intel USIF",
+   [0x0c] = "i.MX 6",
+   [0x0d] = "(deprecated) Arm SBSA (2.x only) Generic UART 
supporting only 32-bit accesses",
+   [0x0e] = "Arm SBSA Generic UART",
+   [0x0f] = "Arm DCC",
+   [0x10] = "BCM2835",
+   [0x11] = "SDM845 with clock rate of 1.8432 MHz",
+   [0x12] = "16550-compatible with parameters defined in Generic 
Address Structure",
+   [0x13] = "SDM845 with clock rate of 7.372 MHz",
+   [0x14] = "Intel LPSS",
+   [0x15] = "RISC-V SBI console (any supported SBI mechanism)",
+   };
+
+   if (ift >= (int)nitems(if_names) || if_names[ift] == NULL)
+   return ("Reserved");
+   return (if_names[ift]);
+}
+
+static const char *spcr_interrupt_type(int ift)
+{
+   static char buf[100];
+
+#define APPEND(b,s) \
+   if ((ift & (b)) != 0) { \
+   if (strlen(buf) > 0) \
+   strlcat(buf, ",", sizeof(buf)); \
+   strlcat(buf, s, sizeof(buf)); \
+   }
+
+   *buf = '\0';
+   APPEND(0x01, "PC/AT IRQ");
+   APPEND(0x02, "I/O APIC");
+   APPEND(0x04, "I/O SAPIC");
+   APPEND(0x08, "ARMH GIC");
+   APPEND(0x10, "RISC-V PLIC/APLIC");
+
+#undef APPEND
+
+   return (buf);
+}
+
+static const char *spcr_terminal_type(int type)
+{
+   static const char *term_names[] = {
+   [0] = "VT100",
+   [1] = "Extended VT100",
+   [2] = "VT-UTF8",
+   [3] = "ANSI",
+   };
+
+   if (type >= (int)nitems(term_names) || term_names[type] == NULL)
+   return ("Reserved");
+   return (term_names[type]);
+}
+
+static void acpi_handle_spcr(ACPI_TABLE_HEADER *sdp)
+{
+   ACPI_TABLE_SPCR *spcr;
+
+   printf (BEGIN_COMMENT);
+   acpi_print_sdt(sdp);
+
+   /* Rev 1 and 2 are the same size */
+   spcr = (ACPI_TABLE_SPCR *) sdp;
+   printf ("\tInterfaceType=%d (%s)\n", spcr->InterfaceType,
+   spcr_interface_type(spcr->InterfaceType));
+   printf ("\tSerialPort=");
+   acpi_print_gas(&spcr->SerialPort);
+   printf ("\n\tInterruptType=%#x (%s)\n", spcr->InterruptType,
+   spcr_interrupt_type(spcr->InterruptType));
+   printf ("\tPcInterrupt=%d (%s)\n", spcr->PcInterrupt,
+   (spcr->InterruptType & 0x1) ? "Valid" : "Invalid");
+   printf ("\tInterrupt=%d\n", spcr->Interrupt);
+   printf ("\tBaudRate=%d (%d)\n", spcr_xlate_baud(spcr->BaudRate), 
spcr->BaudRate);
+   printf ("\tParity=%d\n", spcr->Parity);
+   printf ("\tStopBits=%d\n", spcr->StopBits);
+   printf ("\tFlowControl=%d\n", spcr->FlowControl);
+   printf ("\tTerminalT

git: 2af5769e3431 - main - fdisk: Make confusing fdisk messages a little less ambiguous

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2af5769e3431f6b5d1bc0ddaac9082e53096e308

commit 2af5769e3431f6b5d1bc0ddaac9082e53096e308
Author: Warner Losh 
AuthorDate: 2024-10-11 16:13:08 +
Commit: Warner Losh 
CommitDate: 2024-10-11 18:06:33 +

fdisk: Make confusing fdisk messages a little less ambiguous

We print an error when we can't read the MBR. Add minimal messages about
continuing anyway.

PR: 167036
Sponsored by:   Netflix
---
 sbin/fdisk/fdisk.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index 6cfa2b510f22..d9514555ae34 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -380,7 +380,8 @@ main(int argc, char *argv[])
printf("*** Working on device %s ***\n",disk);
 
if (I_flag) {
-   read_s0();
+   if (read_s0())
+   warnx("Ignoring bad existing MBR.");
reset_boot();
partp = &mboot.parts[0];
partp->dp_typ = DOSPTYP_386BSD;
@@ -410,8 +411,10 @@ main(int argc, char *argv[])
else
print_params();
 
-   if (read_s0())
+   if (read_s0()) {
+   printf("Will replace existing bad MBR\n");
init_sector0(dos_sectors);
+   }
 
printf("Media sector size is %d\n", secsize);
printf("Warning: BIOS sector numbering starts with sector 1\n");



git: 911ebc3d8cb3 - stable/13 - pkg: prefer .pkg extension

2024-10-11 Thread Ed Maste
The branch stable/13 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=911ebc3d8cb3907ec44a772aafe2310b3c8fe27c

commit 911ebc3d8cb3907ec44a772aafe2310b3c8fe27c
Author: Ed Maste 
AuthorDate: 2024-10-07 15:11:09 +
Commit: Ed Maste 
CommitDate: 2024-10-11 16:17:40 +

pkg: prefer .pkg extension

.pkg is the default extension as of commit c244b1d8a387, falling back to
.txz if not found.

PR: 281924
Reviewed by:bapt
Fixes: a2aac2f5e564 ("pkg(7): when bootstrapping first search for pkg.bsd 
file then pkg.txz")
Fixes: c244b1d8a387 ("pkg: settle the uniq extension to .pkg instead of 
.bsd")
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46977

(cherry picked from commit f5c847ae849aab9354d0956afd683f1c90bfd91e)
(cherry picked from commit fef1f3fecd5b6e7bf040f6dd2e31177332c3c0ec)
---
 usr.sbin/pkg/pkg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c
index 519445e97484..7867b89e07d4 100644
--- a/usr.sbin/pkg/pkg.c
+++ b/usr.sbin/pkg/pkg.c
@@ -894,7 +894,7 @@ static const char args_bootstrap_message[] =
 
 static const char args_add_message[] =
 "Too many arguments\n"
-"Usage: pkg add [-f] [-y] {pkg.txz}\n";
+"Usage: pkg add [-f] [-y] {pkg.pkg}\n";
 
 static int
 pkg_query_yes_no(void)
@@ -1156,7 +1156,7 @@ main(int argc, char *argv[])
 
if (add_pkg) {
if (pkgarg == NULL) {
-   fprintf(stderr, "Path to pkg.txz required\n");
+   fprintf(stderr, "Path to pkg.pkg required\n");
exit(EXIT_FAILURE);
}
if (access(pkgarg, R_OK) == -1) {



git: 40b58e3183ac - stable/13 - pkg: improve error message

2024-10-11 Thread Ed Maste
The branch stable/13 has been updated by emaste:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=40b58e3183ac23dbb14d1be2c35dcef7efb6111d

commit 40b58e3183ac23dbb14d1be2c35dcef7efb6111d
Author: Ed Maste 
AuthorDate: 2024-10-07 16:33:12 +
Commit: Ed Maste 
CommitDate: 2024-10-11 16:17:56 +

pkg: improve error message

Print the complete list of url that have failed

PR: 281924
Co-authored-by: Baptiste Daroussin 
Differential Revision: https://reviews.freebsd.org/D46983

(cherry picked from commit be9243409d6be99f5d7815b6d074a85a6e84f7ce)
(cherry picked from commit 2f29060f46138bbfc52c5944825293d598cc68de)
---
 usr.sbin/pkg/pkg.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c
index 7867b89e07d4..1915893af283 100644
--- a/usr.sbin/pkg/pkg.c
+++ b/usr.sbin/pkg/pkg.c
@@ -854,7 +854,11 @@ bootstrap_pkg(bool force, const char *fetchOpts)
goto cleanup;
 
 fetchfail:
-   warnx("Error fetching %s: %s", url, fetchLastErrString);
+   for (int j = 0; bootstrap_names[j] != NULL; j++) {
+   warnx("Attempted to fetch %s/Latest/%s", packagesite,
+   bootstrap_names[j]);
+   }
+   warnx("Error: %s", fetchLastErrString);
if (fetchLastErrCode == FETCH_RESOLV) {
fprintf(stderr, "Address resolution failed for %s.\n", 
packagesite);
fprintf(stderr, "Consider changing PACKAGESITE.\n");



git: 6cde8f3ef7cd - main - lpd: Tighten permissions on /var/run/printer

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6cde8f3ef7cd060be39d78055eaf982b06b19a3b

commit 6cde8f3ef7cd060be39d78055eaf982b06b19a3b
Author: Stanislav Shalunov 
AuthorDate: 2024-10-11 15:49:02 +
Commit: Warner Losh 
CommitDate: 2024-10-11 15:50:08 +

lpd: Tighten permissions on /var/run/printer

Exclude group read/write permissions as well. Otherwise, group wheel can
submit things w/o the normal accounting. While group wheel is generally
trusted on the machine, submitting jobs w/o checks is not one of the
functions we document for that group.

PR: 17289
Differential Revision:  https://reviews.freebsd.org/D47040
---
 usr.sbin/lpr/lpd/lpd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c
index b78077dfa225..089b8fedc2d5 100644
--- a/usr.sbin/lpr/lpd/lpd.c
+++ b/usr.sbin/lpr/lpd/lpd.c
@@ -314,7 +314,7 @@ main(int argc, char **argv)
sigaddset(&nmask, SIGTERM);
sigprocmask(SIG_BLOCK, &nmask, &omask);
 
-   (void) umask(07);
+   (void) umask(077);
signal(SIGHUP, mcleanup);
signal(SIGINT, mcleanup);
signal(SIGQUIT, mcleanup);



git: 818c7b769a4f - main - uncompress: Avoid reading an extra byte

2024-10-11 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=818c7b769a4f7d3c8fecc4cf491f4e22ef816eba

commit 818c7b769a4f7d3c8fecc4cf491f4e22ef816eba
Author: David Jones 
AuthorDate: 2024-10-11 15:49:17 +
Commit: Warner Losh 
CommitDate: 2024-10-11 15:50:09 +

uncompress: Avoid reading an extra byte

When reading the next code in a stream, avoid reading an extra byte if
we're going to throw it away. When there's no more bits to extract from
the stream, bits will be 0 and we'll mask the read byte with 0 anyway.
At worst, this will avoid reading one past the end of gbuf array (which
is not possible in well formed streams).

PR: 127912
Reviewed by:emaste
Differential Revision:  https://reviews.freebsd.org/D47041
---
 usr.bin/compress/zopen.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr.bin/compress/zopen.c b/usr.bin/compress/zopen.c
index be66358884ca..cb7e6e9eb10a 100644
--- a/usr.bin/compress/zopen.c
+++ b/usr.bin/compress/zopen.c
@@ -620,7 +620,8 @@ getcode(struct s_zstate *zs)
}
 
/* High order bits. */
-   gcode |= (*bp & rmask[bits]) << r_off;
+   if (bits > 0)
+   gcode |= (*bp & rmask[bits]) << r_off;
roffset += n_bits;
 
return (gcode);



git: 1107834090be - main - swap_pager: swapoff detecting object death

2024-10-11 Thread Doug Moore
The branch main has been updated by dougm:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1107834090be4df01070028f6a8cdb37ff1f51f1

commit 1107834090be4df01070028f6a8cdb37ff1f51f1
Author: Doug Moore 
AuthorDate: 2024-10-11 17:45:54 +
Commit: Doug Moore 
CommitDate: 2024-10-11 17:45:54 +

swap_pager: swapoff detecting object death

In swap_pager_swapoff_object, the object is initially not dead, and
can only become dead while the object lock is not held. Move the test
for object-death so that it is right after the early loop-break that
happens after lock re-acquisition, and before the iterator is
re-initialized, which fails an assertion when the object is dead,
and not swap.

Addresses a problem produced in testing by @pho and diagnosed by @kib.

Reported by:pho
Reviewed by:alc, kib
Differential Revision:  https://reviews.freebsd.org/D47064
---
 sys/vm/swap_pager.c | 28 +---
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index f4db46a32dee..23b5e1c34b07 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -1910,6 +1910,8 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t 
object)
VM_OBJECT_ASSERT_WLOCKED(object);
KASSERT((object->flags & OBJ_SWAP) != 0,
("%s: Object not swappable", __func__));
+   KASSERT((object->flags & OBJ_DEAD) == 0,
+   ("%s: Object already dead", __func__));
KASSERT((sp->sw_flags & SW_CLOSING) != 0,
("%s: Device not blocking further allocations", __func__));
 
@@ -1917,15 +1919,6 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t 
object)
swp_pager_init_freerange(&range);
sb = swblk_iter_init(&blks, object, 0);
while (sb != NULL) {
-   if ((object->flags & OBJ_DEAD) != 0) {
-   /*
-* Make sure that pending writes finish before
-* returning.
-*/
-   vm_object_pip_wait(object, "swpoff");
-   swp_pager_meta_free_all(object);
-   break;
-   }
sb_empty = true;
for (i = 0; i < SWAP_META_PAGES; i++) {
/* Skip an invalid block. */
@@ -1983,8 +1976,21 @@ swap_pager_swapoff_object(struct swdevt *sp, vm_object_t 
object)
}
if (i < SWAP_META_PAGES) {
/*
-* With the object lock released and regained, the
-* swapblk could have been freed, so reset the pages
+* The object lock has been released and regained.
+* Perhaps the object is now dead.
+*/
+   if ((object->flags & OBJ_DEAD) != 0) {
+   /*
+* Make sure that pending writes finish before
+* returning.
+*/
+   vm_object_pip_wait(object, "swpoff");
+   swp_pager_meta_free_all(object);
+   break;
+   }
+
+   /*
+* The swapblk could have been freed, so reset the pages
 * iterator and search again for the first swblk at or
 * after blks.index.
 */



git: ac9b565b1aa1 - main - kinfo_vmentry: report cdev name for device mappings

2024-10-11 Thread Konstantin Belousov
The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ac9b565b1aa1adc359a5b0a0d83d0aea63643d62

commit ac9b565b1aa1adc359a5b0a0d83d0aea63643d62
Author: Konstantin Belousov 
AuthorDate: 2024-10-10 09:31:37 +
Commit: Konstantin Belousov 
CommitDate: 2024-10-11 10:14:04 +

kinfo_vmentry: report cdev name for device mappings

Reviewed by:emaste, markj
Sponsored by:   The FreeBSD Foundation
MFC after:  1 week
Differential revision:  https://reviews.freebsd.org/D47038
---
 sys/kern/kern_proc.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 1e90116f1cb0..f3ecaf4e2547 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2614,9 +2615,11 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, 
ssize_t maxlen, int flags)
struct ucred *cred;
struct vnode *vp;
struct vmspace *vm;
+   struct cdev *cdev;
+   struct cdevsw *csw;
vm_offset_t addr;
unsigned int last_timestamp;
-   int error;
+   int error, ref;
key_t key;
unsigned short seq;
bool guard, super;
@@ -2714,6 +2717,19 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, 
ssize_t maxlen, int flags)
 
kve->kve_ref_count = obj->ref_count;
kve->kve_shadow_count = obj->shadow_count;
+   if (obj->type == OBJT_DEVICE ||
+   obj->type == OBJT_MGTDEVICE) {
+   cdev = obj->un_pager.devp.dev;
+   if (cdev != NULL) {
+   csw = dev_refthread(cdev, &ref);
+   if (csw != NULL) {
+   strlcpy(kve->kve_path,
+   cdev->si_name, sizeof(
+   kve->kve_path));
+   dev_relthread(cdev, ref);
+   }
+   }
+   }
VM_OBJECT_RUNLOCK(obj);
if ((lobj->flags & OBJ_SYSVSHM) != 0) {
kve->kve_flags |= KVME_FLAG_SYSVSHM;



git: d9daa28c364d - main - sysctl vm.vm_objects: report cdev name for device-backed objects

2024-10-11 Thread Konstantin Belousov
The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d9daa28c364d0b1189ab616d8d697b4c9f748038

commit d9daa28c364d0b1189ab616d8d697b4c9f748038
Author: Konstantin Belousov 
AuthorDate: 2024-10-10 09:37:19 +
Commit: Konstantin Belousov 
CommitDate: 2024-10-11 10:14:15 +

sysctl vm.vm_objects: report cdev name for device-backed objects

Reviewed by:emaste. markj
Sponsored by:   The FreeBSD Foundation
MFC after:  1 week
Differential revision:  https://reviews.freebsd.org/D47038
---
 sys/vm/vm_object.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 0b9a8af2ccb1..83d6b709e277 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -66,6 +66,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2506,8 +2507,10 @@ vm_object_list_handler(struct sysctl_req *req, bool 
swap_only)
struct vattr va;
vm_object_t obj;
vm_page_t m;
+   struct cdev *cdev;
+   struct cdevsw *csw;
u_long sp;
-   int count, error;
+   int count, error, ref;
key_t key;
unsigned short seq;
bool want_path;
@@ -2594,6 +2597,17 @@ vm_object_list_handler(struct sysctl_req *req, bool 
swap_only)
sp = swap_pager_swapped_pages(obj);
kvo->kvo_swapped = sp > UINT32_MAX ? UINT32_MAX : sp;
}
+   if (obj->type == OBJT_DEVICE || obj->type == OBJT_MGTDEVICE) {
+   cdev = obj->un_pager.devp.dev;
+   if (cdev != NULL) {
+   csw = dev_refthread(cdev, &ref);
+   if (csw != NULL) {
+   strlcpy(kvo->kvo_path, cdev->si_name,
+   sizeof(kvo->kvo_path));
+   dev_relthread(cdev, ref);
+   }
+   }
+   }
VM_OBJECT_RUNLOCK(obj);
if ((obj->flags & OBJ_SYSVSHM) != 0) {
kvo->kvo_flags |= KVMO_FLAG_SYSVSHM;



git: 5c385a54fe9c - main - debugnet: Use precise types when accessing mbuf contents

2024-10-11 Thread Mark Johnston
The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5c385a54fe9ccbd3f28f20b5a025a856d229fa05

commit 5c385a54fe9ccbd3f28f20b5a025a856d229fa05
Author: Mark Johnston 
AuthorDate: 2024-10-09 15:28:57 +
Commit: Mark Johnston 
CommitDate: 2024-10-11 13:23:25 +

debugnet: Use precise types when accessing mbuf contents

This might be useful when adding bounds checks to mtod().  No functional
change intended.

MFC after:  1 week
---
 sys/net/debugnet.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c
index 8b1419bcaa28..32a91256f51d 100644
--- a/sys/net/debugnet.c
+++ b/sys/net/debugnet.c
@@ -199,7 +199,7 @@ debugnet_udp_output(struct debugnet_pcb *pcb, struct mbuf 
*m)
return (ENOBUFS);
}
 
-   udp = mtod(m, void *);
+   udp = mtod(m, struct udphdr *);
udp->uh_ulen = htons(m->m_pkthdr.len);
/* Use this src port so that the server can connect() the socket */
udp->uh_sport = htons(pcb->dp_client_port);
@@ -226,7 +226,7 @@ debugnet_ack_output(struct debugnet_pcb *pcb, uint32_t 
seqno /* net endian */)
m->m_len = sizeof(*dn_ack);
m->m_pkthdr.len = sizeof(*dn_ack);
MH_ALIGN(m, sizeof(*dn_ack));
-   dn_ack = mtod(m, void *);
+   dn_ack = mtod(m, struct debugnet_ack *);
dn_ack->da_seqno = seqno;
 
return (debugnet_udp_output(pcb, m));
@@ -400,7 +400,7 @@ debugnet_handle_rx_msg(struct debugnet_pcb *pcb, struct 
mbuf **mb)
}
}
 
-   dnh = mtod(m, const void *);
+   dnh = mtod(m, const struct debugnet_msg_hdr *);
if (ntohl(dnh->mh_len) + sizeof(*dnh) > m->m_pkthdr.len) {
DNETDEBUG("Dropping short packet.\n");
return;
@@ -459,7 +459,7 @@ debugnet_handle_ack(struct debugnet_pcb *pcb, struct mbuf 
**mb, uint16_t sport)
return;
}
}
-   dn_ack = mtod(m, const void *);
+   dn_ack = mtod(m, const struct debugnet_ack *);
 
/* Debugnet processing. */
/*
@@ -503,7 +503,7 @@ debugnet_handle_udp(struct debugnet_pcb *pcb, struct mbuf 
**mb)
return;
}
}
-   udp = mtod(m, const void *);
+   udp = mtod(m, const struct udphdr *);
 
/* We expect to receive UDP packets on the configured client port. */
if (ntohs(udp->uh_dport) != pcb->dp_client_port) {