]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
20 months agoAllow the extres regulator code to build without FDT
Andrew Turner [Thu, 27 Oct 2022 16:28:56 +0000 (17:28 +0100)]
Allow the extres regulator code to build without FDT

This allows drivers that use this to build in an ACPI only kernel.

Sponsored by: The FreeBSD Foundation

20 months agoOnly build if_mvneta.c when FDT is defined
Andrew Turner [Thu, 27 Oct 2022 16:21:02 +0000 (17:21 +0100)]
Only build if_mvneta.c when FDT is defined

This is only ever used by a FDT specific attachment and calls into
FDT specific functions. Only build it when FDT is in the kernel config.
Sponsored by: The FreeBSD Foundation

20 months agoFix xdma_if.m in an ACPI only kernel
Andrew Turner [Thu, 27 Oct 2022 16:17:20 +0000 (17:17 +0100)]
Fix xdma_if.m in an ACPI only kernel

 - We depend on header polution to include sys/malloc.h. Include it
   directly.
 - Only define FDT-specific fuctions when building a FDT kernel.

Sponsored by: Innovate UK

20 months agoMark FDT only drivers as such
Andrew Turner [Thu, 27 Oct 2022 15:57:23 +0000 (16:57 +0100)]
Mark FDT only drivers as such

These drivers have FDT bindings, but not ACPI. Mark them as FDT only
to help a no-FDT LINT kernel build.

Sponsored by: The FreeBSD Foundation

20 months agoRemove an unneeded cpu_dcache_wb_range from arm64
Andrew Turner [Tue, 18 Oct 2022 16:37:43 +0000 (17:37 +0100)]
Remove an unneeded cpu_dcache_wb_range from arm64

The cpu_dcache_wb_range function is an expensive function that is
unneeded in ddb. It is used when the cache needs to be written to RAM,
e.g. when working with a non-cache coherent device.

Remove it as cpu_icache_sync_range already has the needed d-cache
handling to ensure any changed memory is visible to the i-cache.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37037

20 months agoarm64: add a std.ec2 config
Kyle Evans [Wed, 28 Sep 2022 20:24:53 +0000 (15:24 -0500)]
arm64: add a std.ec2 config

Mostly to document basic harware present on the platform; knowing that
Graviton exposes an ns8250 uart alone is quite helpful.

Reviewed by: andrew, imp, manu
Seems accurate: cperciva
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D36776

20 months agonetlink: use (void) for function definitions with no arguments
Ed Maste [Thu, 27 Oct 2022 14:49:51 +0000 (10:49 -0400)]
netlink: use (void) for function definitions with no arguments

For some of these Clang produced a warning that "a function declaration
without a prototype is deprecated in all versions of C".  In other cases
the function defintion used () which did not match the header
declaration, which used (void).

Sponsored by: The FreeBSD Foundation

20 months agobhyve: Remove an unused parameter from pci_nvme_append_iov_req()
Mark Johnston [Thu, 27 Oct 2022 14:47:17 +0000 (10:47 -0400)]
bhyve: Remove an unused parameter from pci_nvme_append_iov_req()

No functional change intended.

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

20 months agobhyve: Fix an apparent pointer arithmetic bug in the xhci emulation
Mark Johnston [Thu, 27 Oct 2022 14:46:53 +0000 (10:46 -0400)]
bhyve: Fix an apparent pointer arithmetic bug in the xhci emulation

Also remove the out-parameter of pci_xhci_find_stream(), since it's
unused by all callers.

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

20 months agobhyve: Make sure that the VNC version is initialized
Mark Johnston [Thu, 27 Oct 2022 14:46:36 +0000 (10:46 -0400)]
bhyve: Make sure that the VNC version is initialized

clang warned that "client_ver" can be left uninitialized.  This change
causes the new connection to be dropped if a version string is not
presented.

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

20 months agoscript: Add usage string for playback mode.
Dag-Erling Smørgrav [Wed, 26 Oct 2022 18:12:02 +0000 (18:12 +0000)]
script: Add usage string for playback mode.

Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37138

20 months agoscript: Correct -F in man page and usage string.
Dag-Erling Smørgrav [Wed, 26 Oct 2022 18:08:12 +0000 (18:08 +0000)]
script: Correct -F in man page and usage string.

Sponsored by: Klara, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37138

20 months agoarm64: Hyper-V: enablement for ARM64 in Hyper-V (Part 3, final)
Souradeep Chakrabarti [Thu, 27 Oct 2022 13:46:08 +0000 (13:46 +0000)]
arm64: Hyper-V: enablement for ARM64 in Hyper-V (Part 3, final)

This is the last part for ARM64 Hyper-V enablement. This includes
commone files and make file changes to enable the ARM64 FreeBSD
guest on Hyper-V. With this patch, it should be able to build
the ARM64 image and install it on Hyper-V.

Reviewed by: emaste, andrew, whu
Tested by: Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D36744

20 months agostress2: Added a newfs(8) test scenario
Peter Holm [Thu, 27 Oct 2022 07:59:16 +0000 (09:59 +0200)]
stress2: Added a newfs(8) test scenario

20 months agostress2: Added a regression test for a ffs validate_sblock() fix
Peter Holm [Thu, 27 Oct 2022 07:57:57 +0000 (09:57 +0200)]
stress2: Added a regression test for a ffs validate_sblock() fix

20 months agoMFV: Restore the ability to process files from stdin immediately.
Xin LI [Thu, 27 Oct 2022 07:12:53 +0000 (00:12 -0700)]
MFV: Restore the ability to process files from stdin immediately.

PR: bin/267221
MFC after: 3 days

20 months agoUse the -n flag to produce immediate results and kill the short-lived -I.
Christos Zoulas [Wed, 26 Oct 2022 16:56:14 +0000 (16:56 +0000)]
Use the -n flag to produce immediate results and kill the short-lived -I.

(cherry picked from commit 425f9897f0ed791a6c216c24375bd9b3a42330a2)

20 months agoIn immediate mode, print with the current width.
Christos Zoulas [Mon, 24 Oct 2022 20:21:54 +0000 (20:21 +0000)]
In immediate mode, print with the current width.

(cherry picked from commit 7d489233e5f27decdbcfb0e8ecba0b0b5fdc6066)

20 months agoPR/397: dadv: Restore the ability of processing filenames from stdin
Christos Zoulas [Sun, 23 Oct 2022 14:22:53 +0000 (14:22 +0000)]
PR/397: dadv: Restore the ability of processing filenames from stdin
immediately, using the -I flag.

(cherry picked from commit ae5c1ff8df0d6e00cbf5e31875d777edbb88d60a)

20 months agopsci: set psci_present as early as possible
Kyle Evans [Thu, 27 Oct 2022 03:46:45 +0000 (22:46 -0500)]
psci: set psci_present as early as possible

psci_attach is way too late to provide the intended semantics for
psci_present.  psci calls can be made immediately after psci_init(),
called way earlier at SI_SUB_CPU + SI_ORDER_FIRST, and we need it to
be valid as early as we can possibly call a psci function.

This fixes booting RPi3+4 with the in-review spintable patch;
rpi3-psci-monitor patches the FDT to add a PSCI node, but it doesn't
patch each cpus' enable-method.  Because of this, we would stall the
boot while enabling CPU 1 as we saw a valid looking enable-method and
"no" functional PSCI and attempted to use the spintable rather than
simply not starting secondary APs.

Fixes: 2218070b2c3c32 ("psci: finish psci_present implementation")
Reported by: karels

20 months agoffs validate_sblock(): avoid 32bit mul overflow
Konstantin Belousov [Mon, 24 Oct 2022 21:34:15 +0000 (00:34 +0300)]
ffs validate_sblock(): avoid 32bit mul overflow

Reported by: soralx@cydem.org
Tested by: pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

20 months agovfs_lookup(): Minor performance optimizations
Jason A. Harmening [Thu, 20 Oct 2022 03:33:19 +0000 (22:33 -0500)]
vfs_lookup(): Minor performance optimizations

Refactor the symlink and mountpoint traversal logic to avoid
repeatedly checking the vnode type; a symlink cannot be a mountpoint
and vice versa.  Avoid repeatedly checking cn_flags for NOCROSSMOUNT
and simplify the check which determines whether the vnode is a
mountpoint.

Suggested by: mjg
Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D35054

20 months agovfs_busy(): fix wording in comment
Jason A. Harmening [Thu, 20 Oct 2022 03:31:44 +0000 (22:31 -0500)]
vfs_busy(): fix wording in comment

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D35054

20 months agoRemove witness directives from crossmp locking VOPs
Jason A. Harmening [Fri, 5 Aug 2022 05:39:04 +0000 (00:39 -0500)]
Remove witness directives from crossmp locking VOPs

These are of limited use since the crossmp vnode locking ops have not
actually used a lock since commit
a2d35545429117e68fbcbc68e14ad55e84265d69.  We in fact require that
these operations are always issued with LK_SHARED.  Additionally,
these directives can produce a false positive in certain VV_CROSSLOCK
cases which require upgrading of the covered vnode lock from shared
to exclusive.

While here, replace the runtime check of LK_SHARED with a KASSERT and
expand the check to include LK_NOWAIT, which all callers pass.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D35054

20 months agoAdd VV_CROSSLOCK vnode flag to avoid cross-mount lookup LOR
Jason A. Harmening [Fri, 5 Aug 2022 05:32:49 +0000 (00:32 -0500)]
Add VV_CROSSLOCK vnode flag to avoid cross-mount lookup LOR

When a lookup operation crosses into a new mountpoint, the mountpoint
must first be busied before the root vnode can be locked. When a
filesystem is unmounted, the vnode covered by the mountpoint must
first be locked, and then the busy count for the mountpoint drained.
Ordinarily, these two operations work fine if executed concurrently,
but with a stacked filesystem the root vnode may in fact use the
same lock as the covered vnode. By design, this will always be
the case for unionfs (with either the upper or lower root vnode
depending on mount options), and can also be the case for nullfs
if the target and mount point are the same (which admittedly is
very unlikely in practice).

In this case, we have LOR. The lookup path holds the mountpoint
busy while waiting on what is effectively the covered vnode lock,
while a concurrent unmount holds the covered vnode lock and waits
for the mountpoint's busy count to drain.

Attempt to resolve this LOR by allowing the stacked filesystem
to specify a new flag, VV_CROSSLOCK, on a covered vnode as necessary.
Upon observing this flag, the vfs_lookup() will leave the covered
vnode lock held while crossing into the mountpoint. Employ this flag
for unionfs with the caveat that it can't be used for '-o below' mounts
until other unionfs locking issues are resolved.

Reported by: pho
Tested by: pho
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D35054

20 months agovmm: Fix AP startup with old userspace binaries.
John Baldwin [Wed, 26 Oct 2022 21:22:56 +0000 (14:22 -0700)]
vmm: Fix AP startup with old userspace binaries.

Older binaries that do not request IPI exits to userspace do not
start user threads for other vCPUs until a STARTUP IPI triggers a
VM_EXITCODE_SPINUP_AP exit to userland.  This means that those vcpus
are not yet active (in terms of vm_active_cpus) when the INIT and
STARTUP IPIs are delivered to the vCPUs.

The changes in commit 0bda8d3e9f7a changed the INIT and STARTUP IPIs
to reuse the existing vlapic_calcdest() function.  This function
silently ignores IPIs sent to inactive vCPUs.  As a result, when using
an old bhyve binary, the INIT and STARTUP IPIs sent to wakeup APs were
ignored.

To fix, restructure the compat code for the INIT and STARTUP IPIs to
ignore the results of vlapic_calcdest() and manually parse the APIC ID
and resulting vcpuid.  As part of this, make the compat code always
conditonal on the ipi_exit capability being disabled.

Reviewed by: c.koehne_beckhoff.com, markj
Differential Revision: https://reviews.freebsd.org/D37093

20 months agoUPDATING: correct spearate typo
Ed Maste [Wed, 26 Oct 2022 18:25:12 +0000 (14:25 -0400)]
UPDATING: correct spearate typo

Reported by: manu
Fixes: 9c36300582ec ("UPDATING: add an introductory...")

20 months agoUPDATING: add an introductory sentence to 20221026's entry
Ed Maste [Wed, 26 Oct 2022 18:10:46 +0000 (14:10 -0400)]
UPDATING: add an introductory sentence to 20221026's entry

20 months agoUPDATING: Add note for pkgbase users after splitting packages.
Emmanuel Vadot [Wed, 26 Oct 2022 17:48:32 +0000 (19:48 +0200)]
UPDATING: Add note for pkgbase users after splitting packages.

20 months agopkgbase: Put less in FreeBSD-runtime
Emmanuel Vadot [Tue, 16 Aug 2022 19:25:38 +0000 (21:25 +0200)]
pkgbase: Put less in FreeBSD-runtime

Useful to have a pager in it.

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

20 months agopkgbase: Create a FreeBSD-games package
Emmanuel Vadot [Mon, 8 Aug 2022 17:56:50 +0000 (19:56 +0200)]
pkgbase: Create a FreeBSD-games package

And put :
- pom
- caesar
- grdc

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

20 months agopkgbase: Put devmatch in its own package
Emmanuel Vadot [Fri, 22 Jul 2022 20:30:11 +0000 (22:30 +0200)]
pkgbase: Put devmatch in its own package

devmatch is useful on standalone machine but not on jails.
Put devinfo(8) and libdevinfo there too.

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

20 months agopkgbase: Put devd in its own package
Emmanuel Vadot [Fri, 22 Jul 2022 12:46:30 +0000 (14:46 +0200)]
pkgbase: Put devd in its own package

It's not that useful in a jail or in a mdroot.

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

20 months agopkgbase: Put ufs related tools and lib in their own package
Emmanuel Vadot [Fri, 22 Jul 2022 11:22:29 +0000 (13:22 +0200)]
pkgbase: Put ufs related tools and lib in their own package

It's not really useful in a jail or in a mdroot or even if a users
wants to do a full zfs machine.

Reviewed by: mckusick
Differential Revision: https://reviews.freebsd.org/D36227

20 months agopkgbase: Put libwrap in FreeBSD-tcpd package
Emmanuel Vadot [Fri, 22 Jul 2022 09:06:05 +0000 (11:06 +0200)]
pkgbase: Put libwrap in FreeBSD-tcpd package

It belongs there with the tcp wrapper utilities

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

20 months agopkgbase: Put zfs utilities and lib in their own package
Emmanuel Vadot [Fri, 22 Jul 2022 08:43:39 +0000 (10:43 +0200)]
pkgbase: Put zfs utilities and lib in their own package

It is useful to have zfs utilities and lib in a separate package as
it allow users to create image that can support ZFS (i.e. not with
WITHOUT_ZFS in src.conf set) without bloating the default image with
all zfs tools (for example for jails).

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

20 months agopkgbase: Put geom utilities in their own package
Emmanuel Vadot [Fri, 22 Jul 2022 08:19:07 +0000 (10:19 +0200)]
pkgbase: Put geom utilities in their own package

For most users it's not needed to boot and they are also
available in the FreeBSD-rescue package in case an update
break and FreeBSD-geom package isn't updated correctly.

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

20 months agopkgbase: Put resolvconf in its own package
Emmanuel Vadot [Fri, 22 Jul 2022 08:01:59 +0000 (10:01 +0200)]
pkgbase: Put resolvconf in its own package

It doesn't really make sense to have it in runtime and let's not
bloat utilities more.

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

20 months agopkgbase: Put dhclient in its own package
Emmanuel Vadot [Fri, 22 Jul 2022 08:00:03 +0000 (10:00 +0200)]
pkgbase: Put dhclient in its own package

It doesn't really make sense to have it in runtime and let's not
bloat utilities more.

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

20 months agopkgbase: Put nvmecontrol in its own package
Emmanuel Vadot [Fri, 22 Jul 2022 07:58:11 +0000 (09:58 +0200)]
pkgbase: Put nvmecontrol in its own package

It doesn't really make sense to have it in runtime and let's not
bloat utilities more.

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

20 months agosendmail: fix auth with cyrus-sasl-2.1.28
Ed Maste [Tue, 25 Oct 2022 15:53:07 +0000 (11:53 -0400)]
sendmail: fix auth with cyrus-sasl-2.1.28

Apply patch extracted from sendmail-8-17.1.9 snapshot by dinoex@.

PR: 262935
Reviewed by: gshapiro
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37119

20 months agow: Fix premature rounding.
Dag-Erling Smørgrav [Mon, 24 Oct 2022 14:02:11 +0000 (14:02 +0000)]
w: Fix premature rounding.

If the system has been up more longer than a minute, we add 30 seconds to
the uptime so that subsequent calculations will round to the nearest minute
rather than truncate.  However, since the introduction of libxo, we output
the raw value after performing the adjustment.  Rewrite so that we output
the raw value first, then perform the adjustment and recalculate before
outputting the humanized value.

While there, reduce stack usage and avoid needless allocations.

Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37128

20 months agovfs: use cache_assert_no_entries instead of open-coding it
Mateusz Guzik [Wed, 26 Oct 2022 15:33:47 +0000 (15:33 +0000)]
vfs: use cache_assert_no_entries instead of open-coding it

20 months agoqlnxe(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 26 Oct 2022 15:27:07 +0000 (17:27 +0200)]
qlnxe(4): Fix a typo in a source code comment

- s/defult/default/

MFC after: 3 days

20 months agonetinet*: add back necessary headers
Gleb Smirnoff [Tue, 25 Oct 2022 21:19:34 +0000 (14:19 -0700)]
netinet*: add back necessary headers

The LINT successful build was provided by the includes that SCTP
pulled in.

Fixes: 92e190f11fe872f7b1f1a1a22c1f10edeb3b7f8d

20 months agoHyper-V: Code refactor to avoid redundancy of MSR values on x86 and arm64
Souradeep Chakrabarti [Wed, 26 Oct 2022 03:29:01 +0000 (03:29 +0000)]
Hyper-V: Code refactor to avoid redundancy of MSR values on x86 and arm64

Refactor the code to put split the MSR values for x86 and arm64
Hyper-V. Code not yet built. This is one of several patches for
the arm64 Hyper-V enablement.

Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D37103

20 months agosplit: add word order fix
Kyle Evans [Tue, 25 Oct 2022 21:51:21 +0000 (16:51 -0500)]
split: add word order fix

This was meant to note that both pattern and line matching were
previously restricted, but words are difficult.  +line and rearrange.

Sponsored by: Klara, Inc.

20 months agostrfmon(3): Fix # explanation
Jose Luis Duran [Thu, 13 Oct 2022 16:11:31 +0000 (13:11 -0300)]
strfmon(3): Fix # explanation

There's only one value that specifies the number of digits after the
decimal point (oh, sorry, the "radix character") the other specifies the
number before...

While here, add a little more info on the effects of using the #n value.

Obtained from: https://github.com/NetBSD/src/commit/d1dd1a086400ae719bde1f2c45938d9bc1d29e8b
Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon(3): Remove repeated words
Jose Luis Duran [Thu, 13 Oct 2022 16:22:54 +0000 (13:22 -0300)]
strfmon(3): Remove repeated words

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Fix formatting of a second fixed-width value
Jose Luis Duran [Fri, 21 Oct 2022 19:34:09 +0000 (16:34 -0300)]
strfmon: Fix formatting of a second fixed-width value

There is a bug when formatting two consecutive values using fixed-widths
and the values need padding.  This was because the value of pad_size
was zeroed only every other time.

Format           Before                         After
[%8n] [%8n]      [ $123.45] [       $123.45]    [ $123.45] [ $123.45]

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Fix an edge case when sep_by_space is 2
Jose Luis Duran [Tue, 18 Oct 2022 02:24:03 +0000 (23:24 -0300)]
strfmon: Fix an edge case when sep_by_space is 2

Fix an edge case by printing the required space when, the currency
symbol succeeds the value, a space separates the sign from the value and
the sign position precedes the quantity and the currency symbol.

In other words:

    n_cs_precedes = 0
    n_sep_by_space = 2
    n_sign_posn = 1

From The Open Group's localeconv[1]:

> When {p,n,int_p,int_n}_sep_by_space is 2:
> If the currency symbol and sign string are adjacent, a space separates
> them; otherwise, a space separates the sign string from the value.

    Format    Before        After
    [%n]      [-123.45¤]    [- 123.45¤]

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/localeconv.html

Obtained from: Darwin
Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Fix alignment when enclosed by parentheses
Jose Luis Duran [Fri, 14 Oct 2022 23:26:32 +0000 (20:26 -0300)]
strfmon: Fix alignment when enclosed by parentheses

Take into consideration the possibility of quantities enclosed by
parentheses when aligning.

Matches the examples from The Open Group's:

Format  Before          After
%(#5n   [$   123.45]    [ $   123.45 ]  Use an alternative pos/neg style
        [($   123.45)]  [($   123.45)]
        [$ 3,456.78]    [ $ 3,456.78 ]

%!(#5n  [   123.45]     [    123.45 ]   Disable the currency symbol
        [(   123.45)]   [(   123.45)]
        [ 3,456.78]     [  3,456.78 ]

https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html

SD5-XSH-ERN-29 is applied, updating the examples for %(#5n and %!(#5n.

Obtained from: Darwin
Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Trim the SPACE from international currency symbol
Jose Luis Duran [Fri, 21 Oct 2022 16:13:27 +0000 (13:13 -0300)]
strfmon: Trim the SPACE from international currency symbol

The international currency symbol (int_curr_symbol) has a mandatory
SPACE character as the last character.

Trim this space after reading it, otherwise this extra space will always
be printed when displaying the int_curr_symbol.

Fixes the output when the international currency format is selected
(%i).

    Locale         Format    Before           After
    en_US.UTF-8    [%i]      [USD 123.45]     [USD123.45]
    fr_FR.UTF-8    [%i]      [123,45 EUR ]    [123,45 EUR]

Note that the en_US.UTF-8 locale states that no space should be printed
between the currency symbol and the value (sep_by_space = 0).

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Avoid an out-of-bounds access
Jose Luis Duran [Thu, 13 Oct 2022 15:51:27 +0000 (12:51 -0300)]
strfmon: Avoid an out-of-bounds access

Avoid an out-of-bounds access when trying to set the space_char using an
international currency format (%i) and the C/POSIX locale.

The current code tries to read the SPACE from int_curr_symbol[3]:

    currency_symbol = strdup(lc->int_curr_symbol);
    space_char = *(currency_symbol+3);

But on C/POSIX locales, int_curr_symbol is empty.

Three implementations have been examined: NetBSD[1], Darwin[2], and
Illumos[3].  Only NetBSD has fixed it[4].

Darwin and NetBSD also trim the mandatory final SPACE character after
reading it.

    Locale         Format    Darwin/NetBSD    FreeBSD/Illumos
    en_US.UTF-8    [%i]      [USD123.45]      [USD 123.45]
    fr_FR.UTF-8    [%i]      [123,45 EUR]     [123,45 EUR ]

This commit only fixes the out-of-bounds access.

[1]: https://github.com/NetBSD/src/blob/trunk/lib/libc/stdlib/strfmon.c
[2]: https://opensource.apple.com/source/Libc/Libc-1439.141.1/stdlib/NetBSD/strfmon.c.auto.html
[3]: https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libc/port/locale/strfmon.c
[4]: https://github.com/NetBSD/src/commit/3d7b5d498aa9609f2bc9ece9c734c5f493a8e239

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Fix typos in source code comments
Jose Luis Duran [Thu, 13 Oct 2022 14:49:21 +0000 (11:49 -0300)]
strfmon: Fix typos in source code comments

s/defult/default
s/internaltion/international

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Fix typo in constant
Jose Luis Duran [Thu, 13 Oct 2022 14:36:46 +0000 (11:36 -0300)]
strfmon: Fix typo in constant

s/SUPRESS_CURR_SYMBOL/SUPPRESS_CURR_SYMBOL

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon: Code cleanup
Jose Luis Duran [Fri, 14 Oct 2022 17:05:22 +0000 (14:05 -0300)]
strfmon: Code cleanup

No functional change intended.
Not claiming full style(9) compliance.

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon_test: Add some tests
Jose Luis Duran [Sun, 16 Oct 2022 04:01:17 +0000 (01:01 -0300)]
strfmon_test: Add some tests

Attempt to test the correctness of strfmon(3).

Some of them were inspired from the examples section at:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html

Items marked with XXX represent an invalid output.

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agostrfmon_test: Fix typo and remove extra space
Jose Luis Duran [Sun, 16 Oct 2022 03:04:44 +0000 (00:04 -0300)]
strfmon_test: Fix typo and remove extra space

Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week

20 months agonetinet*: remove unneeded headers from files that just declare domains
Gleb Smirnoff [Tue, 25 Oct 2022 18:09:23 +0000 (11:09 -0700)]
netinet*: remove unneeded headers from files that just declare domains

20 months agotcp: remove useless today lock assertion in a middle of function
Gleb Smirnoff [Tue, 25 Oct 2022 18:09:22 +0000 (11:09 -0700)]
tcp: remove useless today lock assertion in a middle of function

It was added back in 7cfc6904408b, when there was a jump label
above and tcp_input() hadn't been locked all through.

20 months agotimes: Use modern function definitions
Warner Losh [Tue, 25 Oct 2022 05:03:11 +0000 (23:03 -0600)]
times: Use modern function definitions

Use the modern ANSI function defition syntax rather than the old K&R
syntax for times.

Sponsored by: Netflix

20 months agochio: Mark some arguments as unused.
Warner Losh [Tue, 25 Oct 2022 05:02:44 +0000 (23:02 -0600)]
chio: Mark some arguments as unused.

Sponsored by: Netflix

20 months agointrng: Remove from NOTES file
Warner Losh [Tue, 25 Oct 2022 16:52:44 +0000 (10:52 -0600)]
intrng: Remove from NOTES file

INTRNG is required on these platforms. Remove it from the NOTES file
since it is now in the DEFAULTS file.

Suggested by: mhorne
Sponsored by: Netflix

20 months agosubr_physmem: Fix userspace build
Warner Losh [Tue, 25 Oct 2022 05:05:07 +0000 (23:05 -0600)]
subr_physmem: Fix userspace build

Include stdbool.h in userspace configurations. For the kernel builds we
get it from sys/types.h, but bool isn't defined there for non-kernel
builds and this otherwise kernel-only file is used for the physmem test
suite.

Fixes: deb1e3b71998
Sponsored by: Netflix

20 months agovnic: work_done here only used for debug
Warner Losh [Tue, 25 Oct 2022 14:52:27 +0000 (08:52 -0600)]
vnic: work_done here only used for debug

Sponsored by: Netflix

20 months agogenet: cnt here is write only and can be removed
Warner Losh [Tue, 25 Oct 2022 14:52:53 +0000 (08:52 -0600)]
genet: cnt here is write only and can be removed

Sponsored by: Netflix

20 months agohccontrol.8: missed underscore fixed.
Maxim Konovalov [Tue, 25 Oct 2022 16:29:44 +0000 (16:29 +0000)]
hccontrol.8: missed underscore fixed.

PR: 267343

20 months agox86/include/elf.h: make inclusion blocks for elf32.h and elf64.h similar
Konstantin Belousov [Sat, 22 Oct 2022 20:05:59 +0000 (23:05 +0300)]
x86/include/elf.h: make inclusion blocks for elf32.h and elf64.h similar

They were copy-pasted when x86/include/elf.h file was merged from its
i386 and amd64 counterparts.  Having the text around inclusions
significantly different is somewhat confusing.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37085

20 months agoi386: move hard-coded load address for PIE below default linker base
Konstantin Belousov [Sat, 22 Oct 2022 20:03:17 +0000 (23:03 +0300)]
i386: move hard-coded load address for PIE below default linker base

both for i386 native and compat32 amd64.  We know the ld-elf.so.1 size
in advance, it fits there.  Trying to push it up after the end of a
binary cannot work reliably and eventually fail for large binaries.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37085

20 months agoarm, arm64: tweak hard-coded load addresses for PIE binaries
Konstantin Belousov [Sat, 22 Oct 2022 10:58:43 +0000 (13:58 +0300)]
arm, arm64: tweak hard-coded load addresses for PIE binaries

They are used when ASLR is not applied.
The need for adjusting is due to rtld direct exec mode puts ld-elf.so.1
at the PIE load address, and this address must not conflict with the
default linker' load address for non-PIE binaries.  Otherwise rtld in
direct mode cannot activate image.  Example of implicit failure is ldd(1)
refusing to run.

Reported by: kp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37085

20 months agophysmem: Add physmem_excluded to query if a region is excluded
Warner Losh [Thu, 6 Oct 2022 03:55:26 +0000 (21:55 -0600)]
physmem: Add physmem_excluded to query if a region is excluded

In order to safely reuse excluded memory when it's reserved for special
purpose, we need to test whether or not the memory has been reserved
early in boot. physmem_excluded will return true when the entire range
is excluded, false otherwise.

Sponsored by: Netflix

20 months agoefi: Add linux memory reserve table defniitions
Warner Losh [Thu, 6 Oct 2022 02:56:43 +0000 (20:56 -0600)]
efi: Add linux memory reserve table defniitions

There is some hardware which can't be completely reset to release the
memory it is using(so far only the GICv3 on arm has fit this
bill). Since that meory needs to be reserved by the OS for that
hardware's later use of it, create defines for code that will parse that
memory table. Otherise the system may allocate the memory for block I/O,
network packets, etc which will lead to memory corruption.

When booting via Linux's kexec protocol, it will add this table to the
EFI systbl's cfgtbl array. While the mechanism to pass 'configuration'
is standardized, these specific tables are not documented except in the
Linux source. Include comments gleened from its study.

Sponsored by: Netflix

20 months agobuild: Use `rm -fv` for BATCH_DELETE_OLD_FILES
Ed Maste [Mon, 24 Oct 2022 18:06:41 +0000 (14:06 -0400)]
build: Use `rm -fv` for BATCH_DELETE_OLD_FILES

It's possible to have files with odd permissions in the tmproot (or
sysroot), causing rm to prompt for each one during e.g. buildworld.
Add -f to forcibly delete these.

Reviewed by: brooks
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37111

20 months agobhyve: Address some signed/unsigned comparison warnings
Mark Johnston [Sun, 23 Oct 2022 14:32:45 +0000 (10:32 -0400)]
bhyve: Address some signed/unsigned comparison warnings

MFC after: 1 week

20 months agobhyve: Address signed/unsigned comparison warnings in the e1000 model
Mark Johnston [Tue, 25 Oct 2022 13:54:50 +0000 (09:54 -0400)]
bhyve: Address signed/unsigned comparison warnings in the e1000 model

No functional change intended.

MFC after: 1 week

20 months agobhyve: Address signed/unsigned comparison warnings in the AHCI model
Mark Johnston [Tue, 25 Oct 2022 13:39:07 +0000 (09:39 -0400)]
bhyve: Address signed/unsigned comparison warnings in the AHCI model

No functional change intended.

MFC after: 1 week

20 months agobhyve: Address warnings in blockif_proc()
Mark Johnston [Tue, 25 Oct 2022 13:16:23 +0000 (09:16 -0400)]
bhyve: Address warnings in blockif_proc()

- Use unsigned types for all arithmetic.  Use a new signed variable for
  holding the return value of pread() and pwrite().
- Handle short I/O from pwrite().

MFC after: 1 week

20 months agobhyve: Fix a typo in a function name
Mark Johnston [Tue, 25 Oct 2022 13:22:12 +0000 (09:22 -0400)]
bhyve: Fix a typo in a function name

MFC after: 1 week

20 months agobhyve: Avoid arithmetic on void pointers
Mark Johnston [Tue, 25 Oct 2022 13:07:14 +0000 (09:07 -0400)]
bhyve: Avoid arithmetic on void pointers

No functional change intended.

MFC after: 1 week

20 months agobhyve: Avoid shadowing global variables in bhyverun.c
Mark Johnston [Fri, 9 Sep 2022 00:40:02 +0000 (20:40 -0400)]
bhyve: Avoid shadowing global variables in bhyverun.c

- Rename the global cores/sockets/threads to cpu_cores/sockets/threads.
  This way, num_vcpus_allowed() doesn't shadow them.
- The global maxcpus is unused, remove it for the same reason.

MFC after: 1 week

20 months agosplit: add some tests
Kyle Evans [Tue, 23 Aug 2022 02:08:03 +0000 (21:08 -0500)]
split: add some tests

This should cover all of the basic functionality, as well as the recent
enhancement to use a dynamic buffer size rather than limiting patterns
and lines to MAXBSIZE.

Reviewed by: bapt
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D36324

20 months agosplit: switch to getline() for line/pattern matching
Kyle Evans [Tue, 23 Aug 2022 02:05:58 +0000 (21:05 -0500)]
split: switch to getline() for line/pattern matching

Get rid of split's home-grown logic for growing the buffer; arbitrarily
breaking at LONG_MAX bytes instead of 65536 bytes gives us much more
wiggle room.  Additionally, we'll actually fail out entirely if we can't
fit a line, which makes noticing this class of problem much easier.

Reviewed by: bapt, emaste, pauamma
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D36323

20 months agonetmap(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 25 Oct 2022 12:56:25 +0000 (14:56 +0200)]
netmap(4): Fix a typo in a source code comment

- s/microsconds/microseconds/

MFC after: 3 days

20 months agosmartpqi(4): Fix two typos in kernel error messages
Gordon Bergling [Tue, 25 Oct 2022 11:17:20 +0000 (13:17 +0200)]
smartpqi(4): Fix two typos in kernel error messages

- s/runnning/running/

MFC after: 2 weeks

20 months agodconschat(8): Fix a typo in an error message
Gordon Bergling [Tue, 25 Oct 2022 10:58:55 +0000 (12:58 +0200)]
dconschat(8): Fix a typo in an error message

- s/faild/failed/

MFC after: 1 week

20 months agoarcmsr(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 25 Oct 2022 10:57:37 +0000 (12:57 +0200)]
arcmsr(4): Fix a typo in a source code comment

- s/faild/failed/

MFC after: 3 days

20 months agozfsd(8): Fix a typo in an error message
Gordon Bergling [Tue, 25 Oct 2022 10:55:42 +0000 (12:55 +0200)]
zfsd(8): Fix a typo in an error message

- s/faild/failed/

MFC after: 1 week

20 months agofirewire(4): Fix a typo in an error message
Gordon Bergling [Tue, 25 Oct 2022 10:54:15 +0000 (12:54 +0200)]
firewire(4): Fix a typo in an error message

- s/faild/failed/

MFC after: 5 days

20 months agoocs_fc(4): Fix a typo in an error message
Gordon Bergling [Tue, 25 Oct 2022 10:52:24 +0000 (12:52 +0200)]
ocs_fc(4): Fix a typo in an error message

- s/faild/failed/

MFC after: 5 days

20 months agoCMSG_DATA.3: Fix a typo in the EXAMPLES section
Gordon Bergling [Tue, 25 Oct 2022 10:49:21 +0000 (12:49 +0200)]
CMSG_DATA.3: Fix a typo in the EXAMPLES section

- s/faild/failed/

MFC after: 3 days

20 months agorun.4: Fix a typo in the DIAGNOSTICS section
Gordon Bergling [Tue, 25 Oct 2022 10:47:29 +0000 (12:47 +0200)]
run.4: Fix a typo in the DIAGNOSTICS section

- s/faild/failed/

MFC after: 3 days

20 months agoman: hook acpi_ged.4 to build.
Takanori Watanabe [Mon, 24 Oct 2022 23:11:49 +0000 (08:11 +0900)]
man: hook acpi_ged.4 to build.

Submittet by: yuri@astern.org

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

20 months agonetpfil: Fix two typos in source code comments
Gordon Bergling [Tue, 25 Oct 2022 02:32:59 +0000 (04:32 +0200)]
netpfil: Fix two typos in source code comments

- s/missmatch/mismatch/

MFC after: 3 days

20 months agonet8021: Fix a typo in a kernel error message
Gordon Bergling [Tue, 25 Oct 2022 02:31:51 +0000 (04:31 +0200)]
net8021: Fix a typo in a kernel error message

- s/missmatch/mismatch/

MFC after: 1 week

20 months agoopencrypto: fix null esp crypt
Konstantin Belousov [Mon, 24 Oct 2022 23:02:58 +0000 (02:02 +0300)]
opencrypto: fix null esp crypt

Fixes: 3e9470482a1357eef90d007b27ec5d9725ae1111
Reviewed by: jhb
Sponsored by: Nvidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37113

20 months agoLinuxKPI: seq_file add "private" versions.
Bjoern A. Zeeb [Sat, 22 Oct 2022 18:07:37 +0000 (18:07 +0000)]
LinuxKPI: seq_file add "private" versions.

Add __seq_open_private() and seq_release_private() needed by iwlwifi
debugfs support.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37089

20 months agobhyve: Drop a bogus const qualifier
Mark Johnston [Mon, 24 Oct 2022 21:35:16 +0000 (17:35 -0400)]
bhyve: Drop a bogus const qualifier

No functional change intended.

MFC after: 1 week

20 months agobhyve: Use the new vm_limit_rights() interface
Mark Johnston [Mon, 24 Oct 2022 21:32:04 +0000 (17:32 -0400)]
bhyve: Use the new vm_limit_rights() interface

This addresses a compiler warning arising from the fact that bhyve
needs to cast away a const qualifier in order to call free().

No functional change intended.

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

20 months agolibvmmapi: Provide an interface for limiting rights on the device fd
Mark Johnston [Mon, 24 Oct 2022 21:31:11 +0000 (17:31 -0400)]
libvmmapi: Provide an interface for limiting rights on the device fd

Currently libvmmapi provides a way to get a list of the allowed ioctls
on the vmm device file, so that bhyve can limit rights on the device
file fd.  The interface is rather strange: it allocates a copy of the
list but returns a const pointer, so the caller has to cast away the
const in order to free it without aggravating the compiler.

As far as I can see, there's no reason to make a copy of the array, but
changing vm_get_ioctls() to not do that would break compatibility.  So
this change just introduces a better interface: move all rights-limiting
logic into libvmmapi.

Any new operations on the fd should be wrapped by libvmmapi, so also
discourage use of vm_get_device_fd().  Currently bhyve uses it only when
limiting rights on the device fd.

No functional change intended.

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