]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
12 months agovm_map: Add a macro to fetch a map entry's split boundary index
Mark Johnston [Tue, 9 May 2023 14:07:15 +0000 (10:07 -0400)]
vm_map: Add a macro to fetch a map entry's split boundary index

The resulting code is a bit more concise.  No functional change
intended.

Reviewed by: alc, dougm, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D41249

(cherry picked from commit d0e4e53ebd6499d420c19426586eeeafec157150)

12 months agossh: comment deprecated option handling for retired local patches
Ed Maste [Wed, 2 Aug 2023 14:18:33 +0000 (10:18 -0400)]
ssh: comment deprecated option handling for retired local patches

Older versions of FreeBSD included the HPN patch set and provided
client-side VersionAddendum.  Both of these changes have been retired
but we've retained the option parsing for backwards compatibility to
avoid breaking upgrades.  Add comment references to the relevant
commits.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit a93cbba2deed209a30da1ecffa637bf5c61b7641)

12 months agoe1000: Fix lem(4)/em(4) TSO6
Kevin Bowling [Mon, 31 Jul 2023 15:16:24 +0000 (08:16 -0700)]
e1000: Fix lem(4)/em(4) TSO6

* Fix TSO6 by specializing IP checksum insertion and following Intel SDM
  values for IPv6.
* Remove unnecessary 82544 IP-bit handling
* Remove TSO6 from lem(4) capabilitities

Reviewed by: erj (earlier version)
Differential Revision: https://reviews.freebsd.org/D41170

(cherry picked from commit e1353dcb63bbdb33be6a907ed6236c120518129e)

12 months agovfs: Deleting a doubled inclusion of sys/capsicum.h
Dmitry Chagin [Sat, 29 Jul 2023 08:21:58 +0000 (11:21 +0300)]
vfs: Deleting a doubled inclusion of sys/capsicum.h

Reviewed by:
Differential Revision: https://reviews.freebsd.org/D41223
MFC after: 1 week

(cherry picked from commit dbac8474fe442a7fdbdcdc3ee4a9fe177b7bf46c)

12 months agolinux(4): Fix control message size calculation
Dmitry Chagin [Sat, 29 Jul 2023 08:21:35 +0000 (11:21 +0300)]
linux(4): Fix control message size calculation

To determine the size in bytes needed to hold a control message
and its contents of length len, CMSG_SPACE should be used.

Reviewed by:
Differential Revision: https://reviews.freebsd.org/D41224
MFC after: 1 week

(cherry picked from commit 67116c69052d27dbd6d6c066104850d4d53f0041)

12 months agolinux(4): Use M_LINUX for malloc type of proc emuldata
Dmitry Chagin [Tue, 18 Jul 2023 21:44:17 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type of proc emuldata

MFC after: 2 weeks

(cherry picked from commit b834497c6d0cccaeebad8d94a32c8dd3ec0d3f9b)

12 months agolinux(4): Use M_LINUX for malloc type in getdents
Dmitry Chagin [Tue, 18 Jul 2023 21:44:16 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type in getdents

MFC after: 2 weeks

(cherry picked from commit 7729467781670a84059d50c4726dc94cbf4500e9)

12 months agolinux(4): Use M_LINUX for malloc type in getdents64
Dmitry Chagin [Tue, 18 Jul 2023 21:44:16 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type in getdents64

MFC after: 2 weeks

(cherry picked from commit e27e3fa71c8f31304efa5e065876a34ee603a388)

12 months agolinux(4): Delete a useless variable in getdents64
Dmitry Chagin [Tue, 18 Jul 2023 21:44:16 +0000 (00:44 +0300)]
linux(4): Delete a useless variable in getdents64

MFC after: 2 weeks

(cherry picked from commit b27f3237c82bde866cb24f7299eaa356e8b29eb2)

12 months agolinux(4): Use M_LINUX for malloc type in readdir
Dmitry Chagin [Tue, 18 Jul 2023 21:44:15 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type in readdir

MFC after: 2 weeks

(cherry picked from commit 13d049ab8dd718d0723229d54062c91b2fc68fda)

12 months agolinux(4): Delete a useless variable in readdir
Dmitry Chagin [Tue, 18 Jul 2023 21:44:15 +0000 (00:44 +0300)]
linux(4): Delete a useless variable in readdir

MFC after: 2 weeks

(cherry picked from commit fffb2e8de691ba6677616f7e0e5c442f4e7e722a)

12 months agolinux(4): Properly allocate buffer for kern_getdirentries in readdir
Dmitry Chagin [Tue, 18 Jul 2023 21:44:15 +0000 (00:44 +0300)]
linux(4): Properly allocate buffer for kern_getdirentries in readdir

Looks like prior to ino64 project the size of the struct linux_dirent
was greater (or equal) to the size of the native struct dirent so the
native dirent fit into the buffer. After ino64 project the size of the
native struct dirent has increased.

Spotted by gcc12.
MFC after: 2 weeks

(cherry picked from commit fc1c787aa0157090e765ebba484e6e290e99f177)

12 months agoObsoleteFiles.inc: Remove leading slash from 20230714 entry
Marius Strobl [Wed, 19 Jul 2023 16:56:35 +0000 (18:56 +0200)]
ObsoleteFiles.inc: Remove leading slash from 20230714 entry

Fixes: c3f58005d92e signal: Remove gsignal references from manuals
(cherry picked from commit 37eec7f68a79d100d8f5d439138acc21cd8b4efa)

12 months agosignal: Remove gsignal references from manuals
Dmitry Chagin [Thu, 13 Jul 2023 21:15:47 +0000 (00:15 +0300)]
signal: Remove gsignal references from manuals

Reported by: Mina Galić, mhorne
Reviewed by: Mina Galić, mhorne
Differential Revision: https://reviews.freebsd.org/D41020
MFC after: 1 week

(cherry picked from commit c3f58005d92e5ac189e7dcb2d6d868ed5a0f27fa)

12 months agosignal: Get rid of gsignal() as it not used anywhere
Dmitry Chagin [Thu, 13 Jul 2023 07:41:51 +0000 (10:41 +0300)]
signal: Get rid of gsignal() as it not used anywhere

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D41007
MFC after: 1 week

(cherry picked from commit 17cb2ac3dfcab3f47727c3c1725c61f6b98f690b)

12 months agoman: Link _Fork(2) man page
Dmitry Chagin [Fri, 28 Jul 2023 08:54:20 +0000 (11:54 +0300)]
man: Link _Fork(2) man page

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D41221
MFC after: 1 week

(cherry picked from commit 03eab865aabab1e6737ad0fd1537f7d0a8c3ee02)

12 months agoarm64: Add constants for decoding ISS fields for WF* exceptions
Mark Johnston [Fri, 28 Jul 2023 13:32:45 +0000 (09:32 -0400)]
arm64: Add constants for decoding ISS fields for WF* exceptions

WFI and WFIT trap to EL2 when executed in a vmm guest.  (Currently
WFE/WFET are not configured to trap.)  We only handle WFI at the moment,
so these constants are useful when handling the exception.

Reviewed by: andrew
MFC after: 1 week
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41199

(cherry picked from commit dd24d475d514bba755111c5eecfef1d362b9d68c)

12 months agopcpu: Remove unused definitions of ALT_STACK_SIZE
Mark Johnston [Mon, 24 Jul 2023 15:26:08 +0000 (11:26 -0400)]
pcpu: Remove unused definitions of ALT_STACK_SIZE

This was added originally for the sparc64 port and apparently copied to
other platforms.  No functional change intended.

MFC after: 1 week

(cherry picked from commit 1083a8cd855b4ec09b62bf9c1df5b06a972a91ea)

12 months agocd9660: do not leak buffers in cd9660_rrip_loop()
Konstantin Belousov [Mon, 31 Jul 2023 22:55:13 +0000 (01:55 +0300)]
cd9660: do not leak buffers in cd9660_rrip_loop()

PR: 272856

(cherry picked from commit fa3cf6cdc68cb6d6f2c440f2653258d68eae1015)

12 months agofork1(): properly track the state of the pg_killsx lock
Konstantin Belousov [Wed, 26 Jul 2023 23:24:30 +0000 (02:24 +0300)]
fork1(): properly track the state of the pg_killsx lock

(cherry picked from commit 474708c334a7d4fb27049e7dabaf5b74542568dd)

12 months agokillpg(): close a race with fork(), part 2
Konstantin Belousov [Thu, 20 Jul 2023 21:19:03 +0000 (00:19 +0300)]
killpg(): close a race with fork(), part 2

(cherry picked from commit 232b922cb363e01ac0dd2a277d93cf74d8485e79)

12 months agosigtd(): prefer non-stopped thread as a target for signal queue
Konstantin Belousov [Fri, 21 Jul 2023 09:41:39 +0000 (12:41 +0300)]
sigtd(): prefer non-stopped thread as a target for signal queue

(cherry picked from commit dfe172484d0e1de0bb32bcab8775eb83e15031c0)

12 months agokillpg(2): close a race with fork(2), part1
Konstantin Belousov [Mon, 12 Jun 2023 07:33:43 +0000 (10:33 +0300)]
killpg(2): close a race with fork(2), part1

(cherry picked from commit 3360b48525fc966894e77b8cd9c124669664472d)

12 months agogitignore: whack dead architectures
Mateusz Guzik [Wed, 23 Nov 2022 01:18:03 +0000 (01:18 +0000)]
gitignore: whack dead architectures

(cherry picked from commit 04af98db59102159682c366cbdaeca2d260d46a8)

12 months agostand: Update testing script for arch retirement
Warner Losh [Sun, 14 Aug 2022 14:41:11 +0000 (08:41 -0600)]
stand: Update testing script for arch retirement

And catch up to changes in booting methods currently supported. Add
riscv.

(cherry picked from commit aff95057bca1dc929996a616b0c39a6ff89a1bbf)

12 months agotests: also remove sparc64 case
Ed Maste [Tue, 8 Nov 2022 18:14:55 +0000 (13:14 -0500)]
tests: also remove sparc64 case

(cherry picked from commit 185efcc376b9dcb3b920d1053a250ac754ad163a)

12 months agoffs: wait for trims earlier during unmount to avoid panic
Chuck Silvers [Fri, 8 Apr 2022 17:19:40 +0000 (10:19 -0700)]
ffs: wait for trims earlier during unmount to avoid panic

All softdep processing is supposed to be completed by
softdep_flushfiles() and no more deps are supposed to be created after
that, but if a pending trim completes after softdep_flushfiles() and
before softdep_unmount() then the blkfree that is performed by
ffs_blkfree_trim_task() will create a dep when none should exist, and
if softdep_unmount() is called before that dep is freed then the
kernel will panic.  Prevent this by waiting for trims to complete
earlier in the unmount process, in ffs_flushfiles(), so that any deps
will be freed and any modified CG buffers will be flushed by the final
fsync of the devvp in ffs_flushfiles() as intended.

(cherry picked from commit 3dc5f8e19d8c975a5e27752d65f9aa91d67c9c9e)

12 months agobase: Remove support for the VTOC8 partitioning scheme
Marius Strobl [Wed, 26 Jul 2023 11:08:37 +0000 (13:08 +0200)]
base: Remove support for the VTOC8 partitioning scheme

The removal of the sparc64 support in February 2020 obsoleted the
VTOC8 partitioning scheme as no other FreeBSD platform makes use
of it. Moreover, the code is bitrotting as nothing defines e. g.
LOADER_VTOC8_SUPPORT any more and, thus, should go now, too. With
this change, the following commits are reverted as far as VTOC8
is concerned and parts haven't already previously been deleted
along with prior sparc64 removals:
094fcb157d4c98211899cf09d06e2cf19149b7e0
a7d366e9589c95feda6f3bc78c59c6355d51f126
ba8d50d08b9df4e8213f9a6997ff6792ecebcd9b

The alignment example d9711c28efc4ec89ba5ea11f8fd63e9d0a7fc81b
added to the VTOC8 section of gpart.8 is folded into the MBR one.

This should finally conclude the deorbit of sparc64-specific bits.

        We had joy, we had fun
        we ran Unix on a Sun.
        But that source and the song
        of FreeBSD have all gone.

Credits to Michael Bueker for the original "Unix on a Sun" and Rod
McKuen for the "Seasons in the Sun" lyrics.

(cherry picked from commit 4ef1c6f75d25ba0c264ab274a1b449467a6ee817)

12 months agogeom(4): Add cross reference to geom(8)
Tom Hukins [Mon, 27 Mar 2023 20:50:25 +0000 (21:50 +0100)]
geom(4): Add cross reference to geom(8)

PR: 264387
Reviewed by: ceri
Pull Request: https://github.com/freebsd/freebsd-src/pull/702

(cherry picked from commit e5bc2547a5f8173d1e5b72c1713a54dc89e29620)

12 months agoMinor grammar nit
Andreas Bjornestad [Wed, 3 Mar 2021 16:17:26 +0000 (16:17 +0000)]
Minor grammar nit

PR: docs/253975
(cherry picked from commit 25352f9fda43f6ad112d78a8a6e00b77259802d7)

12 months agogpart(8): Improve manual page syntax
Tom Hukins [Fri, 2 Jun 2023 02:41:28 +0000 (20:41 -0600)]
gpart(8): Improve manual page syntax

Fix various warnings from `mandoc -Tlint lib/geom/part/gpart.8`.

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

(cherry picked from commit 409594ef340b71252a0dc1fedbdb36977642e20a)

12 months agocamcontrol(8): Use simpler language
Tom Hukins [Fri, 2 Jun 2023 02:41:27 +0000 (20:41 -0600)]
camcontrol(8): Use simpler language

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

(cherry picked from commit 2bcbf4d8314654b91f7d688194b047f7151aa955)

12 months agocamcontrol(8): Add manual page cross references
Tom Hukins [Fri, 2 Jun 2023 02:41:27 +0000 (20:41 -0600)]
camcontrol(8): Add manual page cross references

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

(cherry picked from commit 2675b8bd3d940e75fc5bfb550c46af5fca262072)

12 months agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 17:09:48 +0000 (17:09 +0000)]
update external URL

(cherry picked from commit c918f50f8bdf7fb34707df5bb2faa719336fb808)

12 months agocam(3): Add a manual page cross reference
Tom Hukins [Fri, 2 Jun 2023 02:41:27 +0000 (20:41 -0600)]
cam(3): Add a manual page cross reference

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

(cherry picked from commit 3e1af044c9b33109b48bcca1c8c27bbe91836d37)

12 months agogpart(8): Refer to a related manual page
Tom Hukins [Fri, 2 Jun 2023 02:41:27 +0000 (20:41 -0600)]
gpart(8): Refer to a related manual page

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

(cherry picked from commit d275d2e3d375ae3c60fde1d7b1fc2f4b1c3fb4ef)

12 months agoFix dead reference to boot0(8) to point to boot0cfg(8).
Jens Schweikhardt [Fri, 16 Sep 2022 17:08:22 +0000 (19:08 +0200)]
Fix dead reference to boot0(8) to point to boot0cfg(8).

(cherry picked from commit cf13e67730d232eb637987306b13bda100671d97)

12 months agoofw(4): Add my copyright and additional history for ofw_reg_to_paddr()
Marius Strobl [Wed, 26 Jul 2023 07:38:53 +0000 (09:38 +0200)]
ofw(4): Add my copyright and additional history for ofw_reg_to_paddr()

The ofw_reg_to_paddr() in this file is the powerpc OF_decode_addr()
formerly added in 812403402e0bc2165c03e37c6f657c7405f95c15. However,
the latter function in turn was based on the sparc64 counterpart I
previously added in 2b2250b149706f492dd615a518aa669e39b78d0a.

(cherry picked from commit 29fe5efc8aad3b283f2f53f24dc8ee3f3d0d6a58)

12 months agogif(4): Assert that gif_output() isn't called for EtherIP
Marius Strobl [Sun, 23 Jul 2023 16:58:42 +0000 (18:58 +0200)]
gif(4): Assert that gif_output() isn't called for EtherIP

With the current implementation of if_bridge(4), bridge_enqueue()
calls gif_transmit() only. Ensure it stays that way so that the
expectations in both drivers are either met or changed accordingly.

PR: 227450
(cherry picked from commit 8a0308722372a3ac6a94967ae4fe3123842309e2)

12 months agogif(4): Revert in{,6}_gif_output() misalignment handling
Marius Strobl [Wed, 19 Jul 2023 17:17:43 +0000 (19:17 +0200)]
gif(4): Revert in{,6}_gif_output() misalignment handling

The code added in c89c8a1029860182eece5d51ec09119b9500e5a1 in order
to compensate possible misalignment caused by prepending the IP4/6
header with an EtherIP one got broken at some point by a rewrite of
gif(4). For better or worse, 8018ac153f7671699ca008f31c0fad9caef2f531
relaxed the alignment of struct ip from 32 bit to 16 bit, though. As
a result, a 16 bit offset of the IPv4 header induced by the addition
of the 16 bit EtherIP one no longer is a problem in the first place.
The alignment of struct ip6_hdr currently is even only 8 bit, making
it even less problematic with regards to possible misalignment.
Thus, remove the code for handling misalignment in in{,6}_gif_output()
altogether again.
While at it, replace the 3 bcopy(9) calls in gif(4) with memcpy(9) as
there's no need to handle overlap here.

(cherry picked from commit e82d7b2952afaf9625a3d7b05d03c43c1d3e7d9c)

12 months agoxhci(4): Describe AMD 400 Series USB 3.1 controllers
Marius Strobl [Sat, 22 Jul 2023 21:13:46 +0000 (23:13 +0200)]
xhci(4): Describe AMD 400 Series USB 3.1 controllers

While at it, correct the string for 300 series ones, these also are
already xHCI 3.1.

Fixes: d171d2f2 Add AHCI/XHCI device IDs found on AMD Ryzen+B350 system
(cherry picked from commit 83e67a9d14d9cf3830cd52f4f49117bf7220ac49)

12 months agotest: remove remainder of testfloat
Marius Strobl [Fri, 30 Jun 2023 20:36:39 +0000 (22:36 +0200)]
test: remove remainder of testfloat

These bits are unused since the sparc64-specific glue has been deleted
in f33b14f0.

(cherry picked from commit eb33b693b364a4547dfcfd21c159ffc4fb339bc2)

12 months agocas.4: Remove remaining sparc64-specific bit
Marius Strobl [Tue, 18 Apr 2023 17:06:51 +0000 (19:06 +0200)]
cas.4: Remove remaining sparc64-specific bit

This was missed in 702547720ca01437081fb1b6f9eb281c9541021b.

(cherry picked from commit a12d60b99ee5a453e249adc8cf239117f50bd603)

12 months agogem(4): Remove onboard-only Sun ERI and remnants of SBus support
Marius Strobl [Tue, 18 Apr 2023 16:39:38 +0000 (18:39 +0200)]
gem(4): Remove onboard-only Sun ERI and remnants of SBus support

These bits are obsolete since 58aa35d42975c298ca0adba705c042596303c9f5.
This change reverts part of 9ba2b298dfda78b6669281507b314a4c441cd706 as
well as effectively bd3d9826d73b780d349c53ee373060bc7b8d0581, i. e. the
SBus-related modifications. This also gets rid of a nasty hack required
as bus_{read,write}_N(9) doesn't really fit bus_space_subregion(9).

(cherry picked from commit 8defc88c1345f4c048a05e6f20f60ed59d204129)

12 months agommc(4): Don't call bridge driver for timings not requiring tuning
Marius Strobl [Wed, 12 Apr 2023 21:46:02 +0000 (23:46 +0200)]
mmc(4): Don't call bridge driver for timings not requiring tuning

The original idea behind calling into the bridge driver was to have the
logic deciding whether tuning is actually required for a particular bus
timing in a given slot as well as doing the sanity checking only on the
controller layer which also generally is better suited for these due to
say SDHCI_SDR50_NEEDS_TUNING. On another thought, not every such driver
should need to check whether tuning is required at all, though, and not
everything is SDHCI in the first place.
Adjust sdhci(4) accordingly keeping sdhci_generic_tune() a bit cautious
still.

(cherry picked from commit bd15d31cef50060d90356384ba7b878d398fc9f3)

12 months agoman: Remove obsolete meteor.4
Marius Strobl [Sat, 18 Dec 2021 13:56:16 +0000 (14:56 +0100)]
man: Remove obsolete meteor.4

The corresponding interface has been deorbited as part of
daba5ace03e83a930c128ae644afd186e1fe4341.

(cherry picked from commit 7ed5694dd9b9d91e6afd7442b04b602041650354)

12 months agoRemove bt.4 man page.
Cy Schubert [Mon, 29 Mar 2021 05:14:36 +0000 (22:14 -0700)]
Remove bt.4 man page.

r339568 (a1db7455b75d7557fd171a537e2d95aceb20846e) removed bt(4).
This revision removes the man page

(cherry picked from commit e2b247fac21e3b82f84cc56c7caf94f6ec3e78b0)

12 months agoUFS/FFS: Migrate to modern uintXX_t from u_intXX_t.
Kirk McKusick [Thu, 27 Jul 2023 22:26:01 +0000 (15:26 -0700)]
UFS/FFS: Migrate to modern uintXX_t from u_intXX_t.

As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
move to the modern uintXX_t. While here also migrate u_char to uint8_t.
Where other kernel interfaces allow, migrate u_long to uint64_t.

No functional changes intended.

Sponsored-by: The FreeBSD Foundation
(cherry picked from commit 831b1ff7913fb0b317a258a43dce5abefee03a31)

12 months agoAdd diagnostics to fsck_ffs(8) for journaled soft-updates debugging.
Kirk McKusick [Wed, 26 Jul 2023 21:49:07 +0000 (14:49 -0700)]
Add diagnostics to fsck_ffs(8) for journaled soft-updates debugging.

Sponsored-by: The FreeBSD Foundation
(cherry picked from commit 6f0ca273a393bad293cc3ae12b3816ab1582bbc2)

12 months agoAdd quitclean command to fsdb(8) to request a filesystem not be marked dirty.
Kirk McKusick [Wed, 26 Jul 2023 02:42:41 +0000 (19:42 -0700)]
Add quitclean command to fsdb(8) to request a filesystem not be marked dirty.

Sponsored-by: The FreeBSD Foundation
(cherry picked from commit d059e44b800a308822ad920c28f948a1afcc0fa3)

12 months agoHave fsdb(8) only mark a filesystem dirty when it is modified.
Kirk McKusick [Wed, 26 Jul 2023 02:27:59 +0000 (19:27 -0700)]
Have fsdb(8) only mark a filesystem dirty when it is modified.

Sponsored-by: The FreeBSD Foundation
(cherry picked from commit d51bdf327d9381807cbeffead1ed3cc466bdb87b)

12 months agoComment cleanup.
Kirk McKusick [Tue, 25 Jul 2023 21:07:31 +0000 (14:07 -0700)]
Comment cleanup.

Sponsored-by: The FreeBSD Foundation
(cherry picked from commit 4a3444428de5e74f8e847f656eb25ad559902a74)

12 months agoDebugging output additions. No functional changes intended.
Kirk McKusick [Tue, 25 Jul 2023 21:02:33 +0000 (14:02 -0700)]
Debugging output additions. No functional changes intended.

Sponsored-by: The FreeBSD Foundation
(cherry picked from commit 4d512b07357f6a4feff8ac266f90d34939a57be4)

12 months agoText format cleanups. No functional changes intended.
Kirk McKusick [Tue, 18 Jul 2023 00:28:07 +0000 (17:28 -0700)]
Text format cleanups. No functional changes intended.

Sponsored-by: The FreeBSD Foundation
(cherry picked from commit 239597e0309d4d8e84c35929513aa4a2470735ad)

12 months agonfsserver: Fix a typo in a source code comment
Gordon Bergling [Wed, 2 Aug 2023 09:27:30 +0000 (11:27 +0200)]
nfsserver: Fix a typo in a source code comment

- s/restared/restarted/

(cherry picked from commit 11892bc710a741a03735b164dc089d40d7d80374)

12 months agonetpfil: Fix a typo in a source code comment
Gordon Bergling [Wed, 2 Aug 2023 07:41:29 +0000 (09:41 +0200)]
netpfil: Fix a typo in a source code comment

- s/interprted/interpreted/

(cherry picked from commit cfd05de1946799c6353b07da5d351027d8471203)

12 months agoaic7xxx: Fix two typos in source code comments
Gordon Bergling [Wed, 2 Aug 2023 07:20:17 +0000 (09:20 +0200)]
aic7xxx: Fix two typos in source code comments

- s/reslection/reselection/

(cherry picked from commit 3514686b344da607515decb500018d25aadacd33)

12 months agoisp(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 2 Aug 2023 09:48:46 +0000 (11:48 +0200)]
isp(4): Fix a typo in a source code comment

- s/Constatns/Constants/

Obtained from: NetBSD

(cherry picked from commit d3367c35cb12d4acde62ffbb72740801352cd3fc)

12 months agocam(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 2 Aug 2023 09:14:53 +0000 (11:14 +0200)]
cam(4): Fix a typo in a source code comment

- s/uppper/upper/

(cherry picked from commit 586eda6b244632d28d740e417133227b14324e3d)

12 months agoelf(3): Fix a typo in a source code comment
Gordon Bergling [Wed, 2 Aug 2023 09:51:56 +0000 (11:51 +0200)]
elf(3): Fix a typo in a source code comment

- s/speciaal/special/

(cherry picked from commit 2f0e0bd50633eafdfda503ec388151911e7383af)

12 months agolinux(4): Fix two typos in source code comments
Gordon Bergling [Wed, 2 Aug 2023 09:55:30 +0000 (11:55 +0200)]
linux(4): Fix two typos in source code comments

- s/decriptors/descriptors/

(cherry picked from commit 29eab3e4e0c9a6e954b0ee858e3d4c2a9f283ea4)

12 months agopsm(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 2 Aug 2023 07:14:04 +0000 (09:14 +0200)]
psm(4): Fix a typo in a source code comment

- s/diable/disable/

(cherry picked from commit 7eb8fbfb0421d38ec83a73f9b8ea13e7c52d3314)

12 months agovnic: Fix a typo in a source code comment
Gordon Bergling [Wed, 2 Aug 2023 07:33:35 +0000 (09:33 +0200)]
vnic: Fix a typo in a source code comment

- s/Enabele/Enable/

(cherry picked from commit b73763fc10d8000ec5c5682abccf6c8489eee8e3)

12 months agousb(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 2 Aug 2023 09:04:24 +0000 (11:04 +0200)]
usb(4): Fix a typo in a source code comment

- s/determin/determine/

(cherry picked from commit a924b48579c7a0c794431fbd3f540ce56c4cd662)

12 months agoet(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 2 Aug 2023 07:09:56 +0000 (09:09 +0200)]
et(4): Fix a typo in a source code comment

- s/diabled/disabled/

(cherry picked from commit 734c9698d9ae83206a47daa40031a4de3bce9c28)

12 months agopf: test rules evaluation in the face of multiple IPv6 fragment headers
Kristof Provost [Thu, 13 Jul 2023 06:34:54 +0000 (08:34 +0200)]
pf: test rules evaluation in the face of multiple IPv6 fragment headers

Send an ICMPv6 echo request packet with multiple IPv6 fragment headers.
Set rules to pass all packets, except for ICMPv6 echo requests.

pf ought to drop the echo request, but doesn't because it reassembles
the packet, and then doesn't handle the second fragment header. In other
words: it fails to detect the ICMPv6 echo header.

Reported by: Enrico Bassetti bassetti@di.uniroma1.it (NetSecurityLab @ Sapienza University of Rome)
MFC after: instant
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit b23dbabb7f3edb3f323a64f03e37be2c9a8b2a45)

12 months agopf: handle multiple IPv6 fragment headers
Kristof Provost [Thu, 13 Jul 2023 08:25:49 +0000 (10:25 +0200)]
pf: handle multiple IPv6 fragment headers

With 'scrub fragment reassemble' if a packet contains multiple IPv6
fragment headers we would reassemble the packet and immediately
continue processing it.

That is, we'd remove the first fragment header and expect the next
header to be a final header (i.e. TCP, UDP, ICMPv6, ...). However, if
it's another fragment header we'd not treat the packet correctly.
That is, we'd fail to recognise the payload and treat it as if it were
an IPv6 fragment rather than as its actual payload.

Fix this by restarting the normalisation on the reassembled packet.
If there are multiple fragment headers drop the packet.

Reported by: Enrico Bassetti bassetti@di.uniroma1.it (NetSecurityLab @ Sapienza University of Rome)
MFC after: instant
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 76afcbb52492f9b3e72ee7d4c4ed0a54c25e1c48)

12 months agoatf_pytest_wrapper: fix use with pytest-7.4
Kristof Provost [Tue, 18 Jul 2023 14:20:47 +0000 (16:20 +0200)]
atf_pytest_wrapper: fix use with pytest-7.4

As of pytest 7.4 it no longer walks all the way to the root directory
of the file system to find conftest files. As a result we don't find /
usr/tests/conftest.py, and don't load atf_python. That in turn causes
atf_python tests to fail.

Explicitly set the confcutdir, as advised by the pytest changelog.

See also: https://github.com/pytest-dev/pytest/pull/11043
MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D41064

(cherry picked from commit 9f23cbd6cae82fd77edfad7173432fa8dccd0a95)

12 months agosk(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 1 Aug 2023 05:50:45 +0000 (07:50 +0200)]
sk(4): Fix a typo in a source code comment

- s/nomral/normal/

(cherry picked from commit 135c2b71562f6a6b8e918cc66d5468342c198d02)

12 months agoe1000: HWCSUM excemption fixes
Kevin Bowling [Sat, 29 Jul 2023 01:14:29 +0000 (18:14 -0700)]
e1000: HWCSUM excemption fixes

Also disable IPV6 checksum offload.

Spell hw->mac.type < e1000_82543 as e1000_82542.  Confusingly, chips
like 82540 and 82541 come later and do not have these issues.  There
is no functional change here, as the enum was defined in such a way
it worked correctly.  But this reads literally.

(cherry picked from commit 38588749af45d738e6f548f15beb415c46ba8658)

12 months agoe1000: Corrections for lem(4)/em(4) txcsum offload
Kevin Bowling [Thu, 27 Jul 2023 22:50:32 +0000 (15:50 -0700)]
e1000: Corrections for lem(4)/em(4) txcsum offload

Explicitly set ipcss/ipcse/ipcso for IPv6 per intel SDM as indicated in
inline comments.

Fix and consolidate 82543/82547 hwcsum exemption.

While here rearrange and expand some commentary.

(cherry picked from commit cbcab907f8ad1a4ac38dbc574c747ac2901faa54)

12 months agoe1000: add missing parens in csum setup
Kevin Bowling [Sun, 23 Jul 2023 00:03:26 +0000 (17:03 -0700)]
e1000: add missing parens in csum setup

Reported by: rscheff
Fixes: 4f9a44a215f8 e1000: Fix/enable IPv6 transmit checksum offload

(cherry picked from commit 92fd2f39e5b1fd588fdc49a07d626273eb8f7539)

12 months agoe1000: Fix/enable IPv6 transmit checksum offload
Kevin Bowling [Sat, 22 Jul 2023 22:58:34 +0000 (15:58 -0700)]
e1000: Fix/enable IPv6 transmit checksum offload

Fixes and enables txcsum6 offload for lem(4) and em(4).

MFC after: 2 weeks

(cherry picked from commit 4f9a44a215f873c6842a693f2e81e0abbe1531cf)

12 months agoe1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes
Kevin Bowling [Sat, 22 Jul 2023 18:33:27 +0000 (11:33 -0700)]
e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes

* em(4) obey administrative ifcaps for using hwcsum offload
* em(4) obey administrative ifcaps for hw vlan receive tagging
* em(4) add additional TSO6 ifcap, but disabled by default as is TSO4
* lem(4) obey administrative ifcaps for using hwcsum offload
* lem(4) add support for hw vlan receive tagging
* lem(4) Add ifcaps for TSO offload experimentation, but disabled by
  default due to errata and possibly missing txrx code.
* lem(4) disable HWCSUM ifcaps by default on 82547 due to errata around
  full duplex links.  It may still be administratively enabled.

Reviewed by: markj (previous version)
Differential Revision: https://reviews.freebsd.org/D30072

(cherry picked from commit 918c25677d882a901696672bd4d39b62faa56dfa)

12 months agoRevert "e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes"
Kevin Bowling [Fri, 4 Aug 2023 01:21:00 +0000 (18:21 -0700)]
Revert "e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes"

This reverts commit bd07d5c451995353cbf1d86f97c5264232ea401b.

12 months agoe1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes
Kevin Bowling [Fri, 21 Jul 2023 03:30:00 +0000 (20:30 -0700)]
e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes

* em(4) obey administrative ifcaps for using hwcsum offload
* em(4) obey administrative ifcaps for hw vlan receive tagging
* em(4) add additional TSO6 ifcap, but disabled by default as is TSO4
* lem(4) obey administrative ifcaps for using hwcsum offload
* lem(4) add support for hw vlan receive tagging
* lem(4) Add ifcaps for TSO offload experimentation, but disabled by
  default due to errata and possibly missing txrx code.
* lem(4) disable HWCSUM ifcaps by default on 82547 due to errata around
  full duplex links.  It may still be administratively enabled.

Reviewed by: markj (previous version)
Differential Revision: https://reviews.freebsd.org/D30072

(cherry picked from commit 95f7b36e8fac45092b9a4eea5e32732e979989f0)

12 months agoe1000: Some fixes for em(4) TSO setup
Kevin Bowling [Fri, 21 Jul 2023 01:51:02 +0000 (18:51 -0700)]
e1000: Some fixes for em(4) TSO setup

Always set TXD_CMD_IP for 82544
Otherwise set TXD_CMD_IP for IPv4, not IPv6

Reviewed by: markj (previous version)
Differential Revision: https://reviews.freebsd.org/D30072

(cherry picked from commit 201c4b7c29da44500ccb9e47b854dc1207df8b0a)

12 months agoem(4): remove reference to CNVi
Kevin Bowling [Thu, 3 Aug 2023 20:26:28 +0000 (13:26 -0700)]
em(4): remove reference to CNVi

I misread the newer PCH datasheet, these are still refered to as PCH.

(cherry picked from commit 1b01772f0185bb6476ec76d1d66c26373cebc391)

12 months agoem(4): Update and expand on hardware support
Kevin Bowling [Thu, 3 Aug 2023 19:49:42 +0000 (12:49 -0700)]
em(4): Update and expand on hardware support

(cherry picked from commit 42ce724d8021132b5ebcf8cc944f14e19c1c439f)

12 months agoem(4): add link to lem(4)
Kevin Bowling [Thu, 3 Aug 2023 19:49:12 +0000 (12:49 -0700)]
em(4): add link to lem(4)

(cherry picked from commit 7bcdbacf8437ea710f2e7526f225ffa36e504d29)

12 months agonetstat -i: compute most field widths dynamically
Mike Karels [Wed, 26 Jul 2023 15:56:52 +0000 (10:56 -0500)]
netstat -i: compute most field widths dynamically

The network and address fields were sometimes truncated for netstat -i
without -W, and often much too wide for netstat -i with the -W option.
Fields such as normal packet counts often overflowed.  As a result,
columns didn't line up, and large white spaces made it harder to
follow a line across the display.  Change the code to compute the
required field sizes for network, address, and various packet counts.
Hoist the code to format network and address into a subroutine that
can be called twice, once to measure the required field widths,
and once to emit the values.  Use separate field widths for input
and output packets, byte counts, and error and drop counters.
These are left at defaults (the preceding values) with the -h
option, in which case the fields have a limited total width.
An extra space is included between the Network and Address, which
otherwise seemed too close.

Change the mention of -W with -i in the man page to say that most
field widths are computed dynamically in this case.

Reviewed by: sjg, glebius
Differential Revision: https://reviews.freebsd.org/D41160

(cherry picked from commit 372e3d561d82aba7a66fcd4ecb49a4d0a9f69345)

12 months agolibpfct: ensure the initial allocation is large enough
Kristof Provost [Wed, 26 Jul 2023 08:30:22 +0000 (10:30 +0200)]
libpfct: ensure the initial allocation is large enough

Ensure that we allocate enough memory for the packed nvlist, no matter
what size hint was provided.

MFC after: 1 week
Reported by: R. Christian McDonald <rcm@rcm.sh>
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 6422599e74db4bb8b47cead46760d96601d8396a)

12 months agortld_malloc: add cp2op() helper
Konstantin Belousov [Sat, 22 Jul 2023 04:24:03 +0000 (07:24 +0300)]
rtld_malloc: add cp2op() helper

(cherry picked from commit 86c7368f2bcefeb257f7dc40e4296261b295a674)

12 months agortld_malloc: only include internal rtld headers when building for rtld
Konstantin Belousov [Sat, 22 Jul 2023 04:39:20 +0000 (07:39 +0300)]
rtld_malloc: only include internal rtld headers when building for rtld

(cherry picked from commit bc7e86106d428c7da328ad7fc9d4cb5f7f303e0e)

12 months agortld: remove dup __crt_malloc prototypes
Konstantin Belousov [Sat, 22 Jul 2023 04:37:50 +0000 (07:37 +0300)]
rtld: remove dup __crt_malloc prototypes

(cherry picked from commit cf6dbdd135072fc2b74e0a10c22474b0282ca122)

12 months agortld_malloc: remove outdated comments
Konstantin Belousov [Sat, 22 Jul 2023 04:13:58 +0000 (07:13 +0300)]
rtld_malloc: remove outdated comments

(cherry picked from commit a24726a6f3b43473093267e2b4e81d186817dc7d)

12 months agobsd.linker.mk: Use :C not :S for regex
Jessica Clarke [Mon, 24 Jul 2023 00:50:55 +0000 (01:50 +0100)]
bsd.linker.mk: Use :C not :S for regex

Whilst ^ and $ are supported with C, those are special cases, and
general regex syntax like groups and alternations are not. Use the
correct modifier so we get a version number out that's not 0 (which is
what happens when it can't be parsed by the later code).

Fixes: c4177f5b41d4 ("bsd.linker.mk: Handle Xcode 15 linker identification")
MFC after: 1 week

(cherry picked from commit 7f9318a022ef0e5104fd429dc2d9ac37b9916353)

12 months agobsd.linker.mk: Handle Xcode 15 linker identification
Jessica Clarke [Mon, 24 Jul 2023 00:34:17 +0000 (01:34 +0100)]
bsd.linker.mk: Handle Xcode 15 linker identification

The upcoming Xcode 15 introduces a new linker (called ld-prime or ld-new
in some documentation) to replace the classic ld64, which we need to
handle.

Previously, the linker would identify itself as:

  @(#)PROGRAM:ld  PROJECT:ld64-<version>

Now, there are two cases. When the classic ld64 is in use, it identifies
itself as:

  @(#)PROGRAM:ld-classic  PROJECT:ld64-<version>

When the new linker is in use, it identifies itself as:

  @(#)PROGRAM:ld  PROJECT:dyld-<version>

Thus, tweak the detection to allow a -classic suffix in the PROGRAM
string and to allow a dyld- prefix instead of an ld64- prefix on the
version number in the PROJECT string.

MFC after: 1 week

(cherry picked from commit c4177f5b41d45f3c83a0ef329a50e4ae05da3878)

12 months agokmod.mk: Use portable printf '%s' over non-portable echo -n
Jessica Clarke [Tue, 11 Jul 2023 20:30:06 +0000 (21:30 +0100)]
kmod.mk: Use portable printf '%s' over non-portable echo -n

Whilst /bin/echo on macOS and Linux implement -n, as do the builtin
echos in bash and zsh, the builtin echo in dash does not, causing the
first line of the output to be -n foo rather than just foo, and there to
be an extra newline in the output and thus blank line, both of which
result in "Symbol ... is not present in *.kld" warnings appearing in the
build output (once for -n foo and once for the empty string for each
module where EXPORT_SYMS is a list of symbols).

MFC after: 1 week

(cherry picked from commit d1e44bc94494448de196948d698b637b6e1df4bf)

12 months agogetlocalbase.3: Fix AUTHORS formatting
Jessica Clarke [Tue, 11 Jul 2023 17:50:32 +0000 (18:50 +0100)]
getlocalbase.3: Fix AUTHORS formatting

MFC after: 1 week

(cherry picked from commit bfc47586acee94ade461f2210c700abca93647af)

12 months agoresizewin: Stop printing bogus NUL to TTY
Jessica Clarke [Wed, 14 Jun 2023 22:58:36 +0000 (23:58 +0100)]
resizewin: Stop printing bogus NUL to TTY

A char array has an implicit NUL terminating it, which sizeof will
include, so we need to subtract 1 here. Printing a NUL can cause issues
for things like CI environments that aren't expecting it, especially
with recent Jenkins being stricter about not putting NUL in XML files.

Fixes: 3d222369acbe ("Add a small tool, resizewin(1), to query terminal for window size")
MFC after: 1 week

(cherry picked from commit 456c1199d3b3ee477463c6469940c0370de2b2ea)

12 months agolibpmc: Handle PMCALLOCATE log with PMC code on PMU event system
Jessica Clarke [Wed, 7 Jun 2023 14:21:18 +0000 (15:21 +0100)]
libpmc: Handle PMCALLOCATE log with PMC code on PMU event system

On an arm64 system that reports as a Cortex A72 r0p3, running

  pmcstat -P CPU_CYCLES command

works, but

  pmcstat -P cpu-cycles command

does not. This is because the former uses the PMU event from the JSON
source, resulting in pl_event in the log event being a small index
(here, 5) into the generated events table, whilst the latter does not
match any of the JSON events and falls back on PMC's own tables, mapping
it to the PMC event 0x14111, i.e. PMC_EV_ARMV8_EVENT_11H. Then, when
libpmc gets the PMCALLOCATE event, it tries to use the event as an index
into the JSON-derived table, but doing so only makes sense for the
former, whilst for the latter it will go way out of bounds and either
read junk (which may trigger the != NULL assertion) or segfault. As far
as I can tell we don't have anything lying around to tell us which of
the two cases we're in, but we can exploit the fact that the first
0x1000 PMC event codes are reserved, and that none of our PMU events
tables reach that number of entries yet.

PR: 268857
Reviewed by: mhorne
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D39592

(cherry picked from commit 21f7397a61f7bff61a1221cc6340cd980a922540)

12 months agoriscv: Add pass(4) to GENERIC kernel
Jessica Clarke [Wed, 3 May 2023 04:14:57 +0000 (05:14 +0100)]
riscv: Add pass(4) to GENERIC kernel

Whilst we don't have ahci(4) currently, we do have umass(4), and need
pass(4) for smartctl(8) to be able to talk to such devices.

Reported by: David Gilbert <dgilbert@daveg.ca>
MFC after: 1 week

(cherry picked from commit f78cc42f10cbfb5811276bc6827732ca32eb5485)

12 months agoMakefile.inc1: Support building with macOS Ventura's AMFI Launch Constraints
Jessica Clarke [Fri, 3 Mar 2023 02:15:30 +0000 (02:15 +0000)]
Makefile.inc1: Support building with macOS Ventura's AMFI Launch Constraints

As of macOS Ventura, Apple-signed binaries cannot be run if copied away from
their system location. This security feature doesn't really make sense for
boring things like sh(1), more so for applications with special entitlements,
but it's universally present, and results in the following error:

  >>> Install check world
  bmake[2]: "/Users/Jess/cheri/freebsd/Makefile.inc1" line 572: warning: "MAKEFLAGS= CPUTYPE=dummy /Users/Jess/cheri/build/freebsd-riscv64-build/bmake-install/bin/bmake -f /dev/null  -m /Users/Jess/cheri/freebsd/share/mk MK_AUTO_OBJ=no -V CPUTYPE" exited on a signal
  bmake[2]: "/Users/Jess/cheri/freebsd/Makefile.inc1" line 575: CPUTYPE global should be set with ?=.

As with host-symlinks, we don't actually need to copy the files on macOS, since
we're not updating the current machine, so copy its approach and just symlink
them instead.

MFC after: 1 week

(cherry picked from commit dda4d97289f17aa8b2bbfd8d63a746b3a7836fd5)

12 months agoriscv: Add da9063_pmic and da9063_rtc to GENERIC and NOTES
Jessica Clarke [Tue, 13 Sep 2022 16:46:28 +0000 (17:46 +0100)]
riscv: Add da9063_pmic and da9063_rtc to GENERIC and NOTES

This is the PMIC on SiFive's HiFive Unmatched; add it and the RTC child
device driver so we have a working RTC.

Reviewed by: mhorne, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36201

(cherry picked from commit 100f79569dbcee9a7c66f8fe543fa04e8bfb04bd)

12 months agoda9063_rtc: Add new driver for the Dialog Semiconductor DA9063 RTC
Jessica Clarke [Tue, 13 Sep 2022 16:46:21 +0000 (17:46 +0100)]
da9063_rtc: Add new driver for the Dialog Semiconductor DA9063 RTC

This is a simple RTC present in the PMIC, supporting 1s precision.

This is the PMIC on SiFive's HiFive Unmatched.

Reviewed by: mhorne, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36200

(cherry picked from commit 129028c79c6c287c3c028714e3e7993299357b6c)

12 months agoda9063_iic: Add new driver for the Dialog Semiconductor DA9063 PMIC
Jessica Clarke [Tue, 13 Sep 2022 16:46:09 +0000 (17:46 +0100)]
da9063_iic: Add new driver for the Dialog Semiconductor DA9063 PMIC

This is an MFD with regulators, an RTC and a watchdog, among other
things. This adds the necessary infrastructure for specific children to
be added.

Note that the PMIC can also be attached via SPI, not just I2C, and so
the interface is abstracted. No SPI implementation is added, however.

This is the PMIC on SiFive's HiFive Unmatched.

Reviewed by: manu, mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36199

(cherry picked from commit 80466455adcab3952f7b1727c6332832540a8d14)

12 months agorelease: Set loader_menu_multi_user_prompt to "Installer" for installer
Jessica Clarke [Fri, 2 Sep 2022 19:30:50 +0000 (20:30 +0100)]
release: Set loader_menu_multi_user_prompt to "Installer" for installer

This makes it more obvious that the media being booted is an installer
rather than an installed system, which is otherwise hard to distinguish.
It also provides a more user-friendly, and more accurate, prompt.

Reviewed by: gjb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36419

(cherry picked from commit 2a90c47af158625b3e28390801639c21d6d0ed2a)

12 months agoMakefile.inc1: Fix -DNO_ROOT distributeworld certctl usage
Jessica Clarke [Thu, 14 Jul 2022 00:25:50 +0000 (01:25 +0100)]
Makefile.inc1: Fix -DNO_ROOT distributeworld certctl usage

Currently for distributeworld we pass DESTDIR to certctl.sh as an
environment variable, which sets the default value in the script.
However, for -DNO_ROOT builds, CERTCTLFLAGS has METALOG_INSTALLFLAGS
which includes -D ${DESTDIR}, overriding the custom DESTDIR pointing at
the base dist directory.

Moreover, in order to ensure that the METALOG includes the base/ prefix
for all the files, we need to have certctl call install with -D set to
DESTDIR/DISTDIR without the /base suffix but also ensure the files get
installed to DESTDIR/DISTDIR/base.

Fix these by passing the custom DESTDIR to certctl via -D rather than in
the environment and to pass the /base suffix in the distributeworld case
via the newly-added -d option.

We also need to run certctl rehash before we generate the .meta files
from the METALOG, not after, otherwise they won't include the METALOG
additions, so move the certctl rehash call.

Finally, add a missing semicolon that results in no message being
printed in the missing openssl case. By not including the semicolon,
else echo "..." is treated as extra arguments to certctl, which is lax
in its argument parsing and ignores additional arguments, and the
semicolon and fi after the intended echo terminate the if statement as
normal so there's no syntax error at the shell level. This is harmless
as we weren't trying to do anything other than echo anyway, all that
happens is the echo doesn't actually get run.

Reported by: markj (missing semicolon)
Reviewed by: brooks, kevans
Obtained from: CheriBSD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35809

(cherry picked from commit 7e45839aca7157a73b0309e8cf4cb811d2cb5512)

12 months agocertctl: Introduce a new -d <distbase> option
Jessica Clarke [Thu, 14 Jul 2022 00:23:42 +0000 (01:23 +0100)]
certctl: Introduce a new -d <distbase> option

This will be used by Makefile.inc1 to fix -DNO_ROOT distributeworld,
which needs to split out DESTDIR from DISTBASE so the METALOG file
includes the base/ prefix.

Reviewed by: kevans
Obtained from: CheriBSD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35808

(cherry picked from commit 232cf6be4bc493412f1c8b80a4cdc00fe53075c6)