]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
20 months agonfsd: Handle file systems without a VOP_VPTOFH()
Rick Macklem [Fri, 23 Dec 2022 23:17:34 +0000 (15:17 -0800)]
nfsd: Handle file systems without a VOP_VPTOFH()

Unlike NFSv3, the NFSv4 server follows mount points
within the file system tree below the NFSv4 root directory.
If there is a file system mounted within this subtree
that returns EOPNOTSUPP for VOP_VPTOFH(), the NFSv4 server
would return an error for the mount point entry.
This resulted in an "I/O error" report from the Linux NFSv4
client.  It also put an error code in the Readdir reply
that is not defined in the NFSv4 RFCs.

For the FreeBSD NFSv4 client, the entry with the error would
be ignored, which I think is reasonable behaviour for a
mounted file system that can never be exported.

This patch changes the NFSv4 server behaviour to ignore the
mount point entry and not send it in the Readdir reply.
It also changes the behaviour of Lookup for the entry so
that it replies ENOENT for the mount point directory, so
that it is consistent with no entry in the Readdir reply.

With these two changes, the Linux client behaviour is the
same as the FreeBSD client behaviour.  It also avoids
putting an unknown error on the wire to the client.

MFC after: 1 week

20 months agonetlink: fix test-includes broken by f2c8381fce9b
Alexander V. Chernikov [Fri, 23 Dec 2022 17:57:09 +0000 (17:57 +0000)]
netlink: fix test-includes broken by f2c8381fce9b

Reported by: many

20 months agoAdd new rc: machine_id to generate /etc/machine-id
Tobias C. Berner [Sat, 17 Dec 2022 09:18:03 +0000 (10:18 +0100)]
Add new rc: machine_id to generate /etc/machine-id

This new default-enabled rc will generate a /etc/machine-id file if it
does not exist, and pre-fill it with a newly generated UUID of version 4
[2].

The file is generated in /var/db/machine-id and symlinked to
/etc/machine-id to allow for read-only root partitions.

This file is amongst other things used by libraries like GLib.

Bump FreeBSD version 1400076 to be able to easily add support for older
version of FreeBSD via a package.

[1] Linux machine-id(5): https://www.man7.org/linux/man-pages/man5/machine-id.5.html
[2] f176fe8e7f638e585afcd2f4dd52a522c4648f63

Approved by: bapt
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37722

20 months agonetlink: make snl(3) headers self-contained.
Alexander V. Chernikov [Fri, 23 Dec 2022 15:52:33 +0000 (15:52 +0000)]
netlink: make snl(3) headers self-contained.

20 months agonetlink: allow netlink to be build in the kernel
Alexander V. Chernikov [Thu, 22 Dec 2022 14:51:36 +0000 (14:51 +0000)]
netlink: allow netlink to be build in the kernel

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

20 months agonetlink: fix netlink_snl_route.h header includes
Alexander V. Chernikov [Fri, 23 Dec 2022 15:24:21 +0000 (15:24 +0000)]
netlink: fix netlink_snl_route.h header includes

20 months agonetlink: add snl(3) - simple netlink library
Alexander V. Chernikov [Sun, 18 Dec 2022 17:34:41 +0000 (17:34 +0000)]
netlink: add snl(3) - simple netlink library

Reviewed by: bapt, pauamma
Differential Revision: https://reviews.freebsd.org/D37736

20 months agoRename left off of eqos to if_eqos accordingly.
Søren Schmidt [Fri, 23 Dec 2022 05:28:50 +0000 (05:28 +0000)]
Rename left off of eqos to if_eqos accordingly.

20 months agoFixes for ptrace_syscallreq()
Konstantin Belousov [Thu, 22 Dec 2022 23:51:34 +0000 (01:51 +0200)]
Fixes for ptrace_syscallreq()

Re-assign the sc local (syscall number) before moving args for SYS_syscall.
Correct the audit and kdtrace hooks invocations.

Fixes: 140ceb5d956bb8795a77c23d3fd5ef047b0f3c68
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

20 months agotools/test/ptrace: update scescx to do remote getpid(2) on each SCX event
Konstantin Belousov [Fri, 2 Dec 2022 01:26:13 +0000 (03:26 +0200)]
tools/test/ptrace: update scescx to do remote getpid(2) on each SCX event

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

20 months agoptrace(2): document PT_SC_REMOTE
Konstantin Belousov [Fri, 2 Dec 2022 03:00:08 +0000 (05:00 +0200)]
ptrace(2): document PT_SC_REMOTE

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

20 months agoptrace(2): add PT_SC_REMOTE remote syscall request
Konstantin Belousov [Wed, 30 Nov 2022 08:45:52 +0000 (10:45 +0200)]
ptrace(2): add PT_SC_REMOTE remote syscall request

Reviewed by: markj
Discussed with: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37590

20 months agoptrace(2): explain how to select specific thread to operate on
Konstantin Belousov [Mon, 5 Dec 2022 22:43:18 +0000 (00:43 +0200)]
ptrace(2): explain how to select specific thread to operate on

Requested by: emaste
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37590

20 months agoAdd a thread debugging flag TDB_BOUNDARY
Konstantin Belousov [Thu, 1 Dec 2022 00:29:35 +0000 (02:29 +0200)]
Add a thread debugging flag TDB_BOUNDARY

It indicates to a debugger that the thread is stopped at the
kernel->user exit path.

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

20 months agosys: rename td_coredump to td_remotereq
Konstantin Belousov [Wed, 30 Nov 2022 08:48:24 +0000 (10:48 +0200)]
sys: rename td_coredump to td_remotereq

and TDB_COREDUMPRQ to TDB_COREDUMPREQ

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

20 months agocompat32: move struct ptrace_sc_ret32 definition from .c to .h
Konstantin Belousov [Thu, 1 Dec 2022 01:31:58 +0000 (03:31 +0200)]
compat32: move struct ptrace_sc_ret32 definition from .c to .h

Reviewed by: markj
Sponsoreed by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37590

20 months agoiommu_gas: avoid overflow in bounds check
Doug Moore [Thu, 22 Dec 2022 20:31:57 +0000 (14:31 -0600)]
iommu_gas: avoid overflow in bounds check

Change the range test in iommu_gas_match_one from '< ubound' to '<=
ubound', and pass a smaller-by-one ubound parameter to it, to avoid
overflow in ubound calculation.

Reported by: andrew
Reviewed by: andrew (previous version)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37764

20 months agosh(1): Allow non-printing characters in prompt strings
Juraj Lutter [Thu, 8 Dec 2022 20:30:26 +0000 (21:30 +0100)]
sh(1): Allow non-printing characters in prompt strings

Introduce new prompt format characters:

- '\[' starts the sequence of non-printing chatacters
- '\]' ends the sequence of non-printing characters

Within these sequences, the following characters are now supported:

- '\a' emits ASCII BEL (0x07, 007) character
- '\e' emits ASCII ESC (0x1b, 033) character
- '\r' emits ASCII CR (0x0d, 015) character
- '\n' emits ASCII CRLF sequence

These can be used to embed ANSI sequences into prompt strings.

Example in .shrc:

PS1="\[\e[7m\]\u@\h\[\e[0m\]:\w \\$ "

This tries to maintain some degree of compatibility with GNU bash,
that uses GNU readline library (which behaves slightly different from
BSD editline): It has two "non-printing boundary" characters:

- RL_PROMPT_START_IGNORE (\001)
- RL_PROMPT_END_IGNORE (\002)

while BSD editline only has one (when using EL_PROMPT_ESC setting), so
for this purpose, ASCII \001 was chosen and both \[ and \] emits
this character.

And while here, enlarge PROMPTLEN from 128 to 192 characters.

Reviewed by: jilles
Approved by: jilles
Differential Revision: https://reviews.freebsd.org/D37701

20 months agobsdinstall: s/to small/too small/
Mateusz Guzik [Thu, 22 Dec 2022 17:57:08 +0000 (17:57 +0000)]
bsdinstall: s/to small/too small/

Reported by: Sulev-Madis Silber <ketas@si.pri.ee>

20 months agonfscl: Improve the console message for NFSERR_NOFILEHANDLE
Rick Macklem [Thu, 22 Dec 2022 17:35:15 +0000 (09:35 -0800)]
nfscl: Improve the console message for NFSERR_NOFILEHANDLE

Since a NFSERR_NOFILEHANDLE reply from an NFSv4 server
usually means that the file system is not exported on
the server, change the console log message to indicate
that.

MFC after: 1 week

20 months agobspatch.1: fix missing argument
Mike Karels [Thu, 22 Dec 2022 17:13:32 +0000 (11:13 -0600)]
bspatch.1: fix missing argument

Fix typo

MFC after: 3 days
Reviewed by: gbe
Differential Revision: https://reviews.freebsd.org/D37727

20 months agorpc.tlsservd: Check for a tls syscall failure.
Rick Macklem [Thu, 22 Dec 2022 17:10:27 +0000 (09:10 -0800)]
rpc.tlsservd: Check for a tls syscall failure.

Although the tls syscall to set up the upcall should
not normally fail, the daemon should check for such
a failure.  This patch adds a check for that failure.

MFC after: 1 week

20 months agoAllow CPUs to be missing in the Arm PMU driver
Andrew Turner [Mon, 19 Dec 2022 13:51:48 +0000 (13:51 +0000)]
Allow CPUs to be missing in the Arm PMU driver

To support running on some emulators we allow CPU start to fail if the
CPU we are starting is not present. The PMU driver will then check if
the CPU is present and fail to attach if any are missing.

To allow the PMU to be used in such an environment don't fail to attach
when a CPU is missing.

Sponsored by: Arm Ltd

20 months agoAdd support for the new Arm Generic UART _HID
Andrew Turner [Mon, 19 Dec 2022 13:42:44 +0000 (13:42 +0000)]
Add support for the new Arm Generic UART _HID

Historically the ACPI _HID for both the Arm PL011 and Generic UARTs
was ARMH0011. In the Arm Base Boot Requirements 2.0 the Generic UART
_HID is changed to ARMHB000. Use this new value in the PL011 driver
where we support both UART types.

This has been observed in some recent EDK2 builds.

Sponsored by: Arm Ltd

20 months agoFix the SPDX-License-Identifier in DMC-620 files
Andrew Turner [Thu, 22 Dec 2022 10:10:47 +0000 (10:10 +0000)]
Fix the SPDX-License-Identifier in DMC-620 files

The SPDX-License-Identifier was wrong in the Arm CoreLink DMC-620
driver files. It used the incorrect FreeBSD variant of the BSD-2-Clause
identifier. According to [1] all files should use BSD-2-Clause.

[1] https://tools.spdx.org/app/check_license/

Reported by: emaste
Sponsored by: Arm Ltd

20 months agoFix the SPDX-License-Identifier in CMN-600 files
Andrew Turner [Thu, 22 Dec 2022 10:10:47 +0000 (10:10 +0000)]
Fix the SPDX-License-Identifier in CMN-600 files

The SPDX-License-Identifier was wrong in the Arm CoreLink CMN-600
driver files. It used the incorrect FreeBSD variant of the BSD-2-Clause
identifier. According to [1] all files should use BSD-2-Clause.

[1] https://tools.spdx.org/app/check_license/

Reported by: emaste
Sponsored by: Arm Ltd

20 months agoFix loading the hwpmc module when ACPI is enabled
Andrew Turner [Thu, 22 Dec 2022 10:10:46 +0000 (10:10 +0000)]
Fix loading the hwpmc module when ACPI is enabled

In 0a9a4d2cd6092 a check for OPT_ACPI was added to the hwpmc Makefile
to fix loading the module in a kernel where ACPI has been disabled.
This broke loading the module when ACPI was enabled in the build as
OPT_ACPI isn't a Makefile macro so was always disabled.

Move this check to the C files where the DEV_ACPI macro does exist.

Reviewed by: gnn
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D37773

20 months agoarm64: Don't include td_inhibitors when checking td_ast in do_ast
Jessica Clarke [Thu, 22 Dec 2022 10:23:10 +0000 (10:23 +0000)]
arm64: Don't include td_inhibitors when checking td_ast in do_ast

The td_ast member is an int so only 4 bytes, yet we were using an 8 byte
load and thus also got td_inhibitors in the upper bits. The code prior
to the commit that introduced td_ast did also do a bogus 8 byte load of
td_flags but masked the flags so arguably was correct, if dodgy. Now
that we're using the right width for the load we can also fold the
immediate offset back into the load; because td_ast is at an odd
multiple of 4 bytes from the start of struct thread the normal scaled
load couldn't be used with such an immediate offset when doing an 8 byte
load due to its limited immediate range, but we can use a scaled load
once more now that the offset is a multiple of the load width.

Reviewed by: andrew, kib
Fixes: c6d31b8306eb ("AST: rework")
Differential Revision: https://reviews.freebsd.org/D37751

20 months agogpioevents: fix some white-space errors
Rene Ladan [Thu, 22 Dec 2022 10:16:32 +0000 (11:16 +0100)]
gpioevents: fix some white-space errors

Fixes: 453db42291a3 - gpioevents: add support for pull-down and floating input pins.
Approved by: manu (implicit)
MFC after: 1 week

20 months agogpioevents: add support for pull-down and floating input pins.
Rene Ladan [Wed, 21 Dec 2022 21:24:11 +0000 (22:24 +0100)]
gpioevents: add support for pull-down and floating input pins.

The pin-mode (ft, pd, pu for floating, pull-down, pull-up) is
specified after the intr-config (no, eb, ef, er) for each pin.

Tested on my Raspberry Pi 1B.

PR: 268504
Approved by: manu
MFC after:      1 week

20 months agoAdd initial support for the RK356X SOC Ethernet QoS controller (DesignWare)
Søren Schmidt [Thu, 22 Dec 2022 03:38:10 +0000 (03:38 +0000)]
Add initial support for the RK356X SOC Ethernet QoS controller (DesignWare)

Eqos driver works in all combinations of single/double ports with different layout.

20 months agoirdma(4): Upgrade driver to 1.1.5-k
Bartosz Sobczak [Thu, 22 Dec 2022 01:10:15 +0000 (17:10 -0800)]
irdma(4): Upgrade driver to 1.1.5-k

This is to upgrade current irdma driver version (in support of RDMA on
Intel(R) Ethernet Controller E810) to 1.1.5-k

change summary:
- refactor defines for hardware registers
- rereg_mr verb added in libirdma
- fix print warning during compilation
- rt_ros2priority macro fix
- irdma.4 validated with mandoc
- fixing nd6_resolve usage
- added libirdma_query_device
- sysctl for irdma version
- aeq_alloc_db fix
- dwork_flush protected with qp refcount
- PFC fixes

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
Sponsored by: Intel Corporation
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36944

20 months agorpc.tlsclntd: Check for a tls syscall failure.
Rick Macklem [Wed, 21 Dec 2022 23:12:06 +0000 (15:12 -0800)]
rpc.tlsclntd: Check for a tls syscall failure.

Although the tls syscall to set up the upcall should
not normally fail, the daemon should check for such
a failure.  This patch adds a check for that failure.

MFC after: 1 week

20 months agoFix spelling of NO_WINFINITE_RECURSION.
John Baldwin [Wed, 21 Dec 2022 22:45:29 +0000 (14:45 -0800)]
Fix spelling of NO_WINFINITE_RECURSION.

Reported by: dim
Fixes: 2e08e4b75ea1 zfs: Fix build with GCC 12.

20 months agoDrvAPI: Trivial mechanical conversions for various drivers
Justin Hibbits [Fri, 19 Aug 2022 19:48:39 +0000 (15:48 -0400)]
DrvAPI: Trivial mechanical conversions for various drivers

Mechanically convert the following drivers, with trivial changes:
* ipw(4)
* igc(4)
* enetc(4)
* malo(4)
* nfe(4)
* bxe(4)
* awg(4)
* otus(4)
* rtwn(4)
* bnxt(4)
* ath(4)

Sponsored by: Juniper Networks, Inc.

20 months agoixl: Fix a mechanical mess-up in DrvAPI conversion
Justin Hibbits [Wed, 21 Dec 2022 19:22:23 +0000 (14:22 -0500)]
ixl: Fix a mechanical mess-up in DrvAPI conversion

ixl_iw.c is not compiled by default, and I missed this in code
inspection.

Reported by: erj@
Sponsored by: Juniper Networks, Inc.

20 months agolinuxkpi: seq_read: Fix off by one error
Emmanuel Vadot [Wed, 21 Dec 2022 11:42:24 +0000 (12:42 +0100)]
linuxkpi: seq_read: Fix off by one error

strscpy needs the buffer length not the string length (so including
the '\0').

Reviewed by: bz
Fixes: f697b9432d9c ("linuxkpi: drm-kmod debugfs support")
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37771

20 months agozfs: Fix build with GCC 12.
John Baldwin [Wed, 21 Dec 2022 18:49:23 +0000 (10:49 -0800)]
zfs: Fix build with GCC 12.

Silence -Winfinite-recursion for ldo.c in lua and -Wstringop-overread
for nvpair.c.

Reviewed by: mm
Differential Revision: https://reviews.freebsd.org/D37631

20 months agoDisable -Wzero-length-bounds for the kernel for GCC 12.
John Baldwin [Wed, 21 Dec 2022 18:47:08 +0000 (10:47 -0800)]
Disable -Wzero-length-bounds for the kernel for GCC 12.

The mlx5 driver and some other OFED bits use a somewhat dubious
pattern of:

  struct foo {
      uint64_t arg[0];
      /* Real members of a struct */
  };

The code then treats 'arg' as if it were really a kind of union
such that foo.arg[N] functions similarly to (uint64_t *)foo[N].
This uses of foo.arg[N] then trigger this warning.

No real bugs were found by this warning though, so just turn it off
globally.

Reviewed by: hselasky, kib
Differential Revision: https://reviews.freebsd.org/D37630

20 months agoDisable -Wdangling-pointer for the kernel for GCC 12.
John Baldwin [Wed, 21 Dec 2022 18:46:26 +0000 (10:46 -0800)]
Disable -Wdangling-pointer for the kernel for GCC 12.

Some of the warnings raised in the kernel seem to be outright bugs in
the compiler (e.g. the cases in ata_xpt.c and scsi_xpt.c).  Other
cases are not fatal and it didn't seem to find any legitimate bugs in
the kernel.

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

20 months agoDisable errors for -Wnonnull for the kernel for GCC 12.
John Baldwin [Wed, 21 Dec 2022 18:46:06 +0000 (10:46 -0800)]
Disable errors for -Wnonnull for the kernel for GCC 12.

The USB code and some other places raise false positives when a NULL
pointer is passed to an inlined function along with a separate length
and the compiler can't determine that the separate length of 0
prevents the use of the NULL pointer.

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

20 months agoiee80211_hwmp: Don't dereference NULL ni in debug printf.
John Baldwin [Wed, 21 Dec 2022 18:45:45 +0000 (10:45 -0800)]
iee80211_hwmp: Don't dereference NULL ni in debug printf.

In this call to IEEE80211_NOTE, ni is always NULL due to the assignment
a few lines earlier at the start of the function.  If debug traces are
enabled, then this will pass an invalid pointer as the 'mac' pointer to
ieee80211_note_mac.  Use IEEE80211_DPRINTF which doesn't take a 'ni'
argument instead.

Reported by: GCC -Wstringop-overread
Reviewed by: bz, emaste
Differential Revision: https://reviews.freebsd.org/D37626

20 months agomrsas: Don't leak a stack pointer value in the softc.
John Baldwin [Wed, 21 Dec 2022 18:45:26 +0000 (10:45 -0800)]
mrsas: Don't leak a stack pointer value in the softc.

mrsas_issue_blocked_cmd stores a pointer to an on-stack variable
in its softc so that the driver can call wakeup() on the correct
pointer.  Once the loop around tsleep() has finished however, the
pointer is no longer needed and any further use would be invalid.
Clear sc->chan to NULL after the loop.

Reported by: GCC -Wdangling-pointer
Differential Revision: https://reviews.freebsd.org/D37628

20 months agobhyve: Simplify spinup_ap_realmode slightly.
John Baldwin [Wed, 21 Dec 2022 18:33:34 +0000 (10:33 -0800)]
bhyve: Simplify spinup_ap_realmode slightly.

There is no reason to modify the passed in rip variable.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37647

20 months agobhyve: Tidy vCPU pthread startup.
John Baldwin [Wed, 21 Dec 2022 18:33:18 +0000 (10:33 -0800)]
bhyve: Tidy vCPU pthread startup.

Set the thread affinity in fbsdrun_start_thread next to where the
thread name is set.  This keeps all the pthread initialization
operations at the start of a thread in one place.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37646

20 months agobhyve: Don't access vcpumap[vcpu] directly in parse_cpuset().
John Baldwin [Wed, 21 Dec 2022 18:33:04 +0000 (10:33 -0800)]
bhyve: Don't access vcpumap[vcpu] directly in parse_cpuset().

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37645

20 months agobhyve: Allocate struct vm_exit on the stack in vm_loop.
John Baldwin [Wed, 21 Dec 2022 18:32:45 +0000 (10:32 -0800)]
bhyve: Allocate struct vm_exit on the stack in vm_loop.

The global vmexit[] array is no longer needed to smuggle the rip
value from fbsdrun_addcpu() to vm_loop().

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37644

20 months agobhyve: Remove some no-op code for setting RIP.
John Baldwin [Wed, 21 Dec 2022 18:32:24 +0000 (10:32 -0800)]
bhyve: Remove some no-op code for setting RIP.

fbsdrun_addcpu() read the current vCPU's RIP register from the kernel
via vm_get_register() to pass along through some layers to vm_loop()
which then set the register via vm_set_register().  However, this is
just always setting the value back to itself.

Reviewed by: corvink
Differential Revision: https://reviews.freebsd.org/D37643

20 months agobhyve: Simplify setting vCPU capabilities.
John Baldwin [Wed, 21 Dec 2022 18:31:16 +0000 (10:31 -0800)]
bhyve: Simplify setting vCPU capabilities.

- Enable VM_CAP_IPI_EXIT in fbsdrun_set_capabilities along with other
  capabilities enabled on all vCPUs.

- Don't call fbsdrun_set_capabilities a second time on the BSP in
  spinup_vcpu.

- To preserve previous behavior, don't unconditionally enable
  unrestricted guest mode on the BSP (this unbreaks single-vCPU guests
  on Nehalem systems, though supporting such setups is of dubious
  value).  Other places that enbale UG on the BSP are careful to check
  the result of the operation and fail if it is not available.

- Don't set any capabilities in spinup_ap().  These are now all
  redundant with earlier settings from spinup_vcpu().

- While here, axe a stale comment from fbsdrun_addcpu().  This
  function is now always called from the main thread for all vCPUs.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37642

20 months agobhyve: Remove unused return value from spinup_ap.
John Baldwin [Wed, 21 Dec 2022 18:31:02 +0000 (10:31 -0800)]
bhyve: Remove unused return value from spinup_ap.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37641

20 months agobhyve: Remove handler for VM_EXITCODE_SPINUP_AP.
John Baldwin [Wed, 21 Dec 2022 18:30:45 +0000 (10:30 -0800)]
bhyve: Remove handler for VM_EXITCODE_SPINUP_AP.

Since commit 0bda8d3e9f7a, bhyve always enables VM_EXITCODE_IPI exits
instead, so this handler is no longer used.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37640

20 months agobsd-family-tree: macOS 13 added
Sergey A. Osokin [Wed, 21 Dec 2022 17:02:49 +0000 (12:02 -0500)]
bsd-family-tree: macOS 13 added

MFC after: 3 days

20 months agosmmu: fix FDT and !FDT builds.
Ruslan Bukin [Wed, 21 Dec 2022 15:45:13 +0000 (15:45 +0000)]
smmu: fix FDT and !FDT builds.

Reviewed by: andrew
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D37762

20 months agosmmu: set guest address space range to 48-bit, which is a hardware
Ruslan Bukin [Tue, 20 Dec 2022 11:25:18 +0000 (11:25 +0000)]
smmu: set guest address space range to 48-bit, which is a hardware
limit in our configuration.

Reviewed by: andrew
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D37756

20 months agoAttach Motorcomm YT8511 GbE PHY driver to the build.
Søren Schmidt [Wed, 21 Dec 2022 14:37:19 +0000 (14:37 +0000)]
Attach Motorcomm YT8511 GbE PHY driver to the build.

20 months agoConvert iflib(4) and iflib-based drivers to the DrvAPI
Justin Hibbits [Wed, 20 Oct 2021 20:49:00 +0000 (15:49 -0500)]
Convert iflib(4) and iflib-based drivers to the DrvAPI

Summary:
Convert iflib(4) and the following drivers:
* axgbe
* em
* ice
* ixl
* vmxnet

Sponsored by: Juniper Networks, Inc.
Reviewed by: kbowling, #iflib
Differential Revision: https://reviews.freebsd.org/D37768

20 months agoUse hwreset_array in the Rockchip tsadc driver
Andrew Turner [Fri, 11 Nov 2022 08:58:34 +0000 (08:58 +0000)]
Use hwreset_array in the Rockchip tsadc driver

The order of asserting/deasserting the resets doesn't matter so use
the new hwreset_array to manage them all.

Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37358

20 months agoAdd support for an array of hwresets
Andrew Turner [Fri, 11 Nov 2022 08:55:59 +0000 (08:55 +0000)]
Add support for an array of hwresets

In some drivers we need to assert and deassert a group of hardware
resets in any order. To support this add a new hwreset_array that
manages all hwresets defined for a device.

Reviewed by: bz, manu, mmel
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37357

20 months agoFormat cleanups.
Kirk McKusick [Wed, 21 Dec 2022 02:30:36 +0000 (18:30 -0800)]
Format cleanups.

No functional change intended.

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

20 months agojail: Fix output of IPv[46] addresses of DDB `show prison`
Zhenlei Huang [Wed, 21 Dec 2022 01:53:28 +0000 (09:53 +0800)]
jail: Fix output of IPv[46] addresses of DDB `show prison`

Reviewed by: melifaro, jamie
Approved by: kp (mentor)
Fixes: eb8dcdeac22d jail: network epoch protection for IP address lists
Differential Revision: https://reviews.freebsd.org/D37732

20 months agonetlink: Use NET_EPOCH_[CALL|WAIT] macros
Zhenlei Huang [Wed, 21 Dec 2022 01:40:05 +0000 (09:40 +0800)]
netlink: Use NET_EPOCH_[CALL|WAIT] macros

Reviewed by: melifaro, kp
Approved by: kp (mentor)
Differential Revision: https://reviews.freebsd.org/D37730

20 months agorouting: Use NET_EPOCH_[CALL|WAIT] macros
Zhenlei Huang [Wed, 21 Dec 2022 01:33:31 +0000 (09:33 +0800)]
routing: Use NET_EPOCH_[CALL|WAIT] macros

Reviewed by: melifaro, kp
Approved by: kp (mentor)
Differential Revision: https://reviews.freebsd.org/D37729

20 months agogeom_part: Fix potential integer overflow when checking size of the table
Zhenlei Huang [Wed, 21 Dec 2022 01:04:30 +0000 (09:04 +0800)]
geom_part: Fix potential integer overflow when checking size of the table

`hdr_entries` and `hdr_entsz` are both uint32_t as defined in UEFI spec.
Current spec does not have upper limit of the number of partition
entries and the size of partition entry, it is potential that malicious
or corrupted GPT header read from untrusted source contains large size of
entry number or size.

PR: 266548
Reviewed by: oshogbo, cem, imp, markj
Approved by: kp (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36709

20 months ago.github: Switch to v3 of actions/checkout.
John Baldwin [Wed, 21 Dec 2022 00:27:17 +0000 (16:27 -0800)]
.github: Switch to v3 of actions/checkout.

GitHub is emitting a warning that v2 is deprecated due to using
Node.js 12.

Reported by: GitHub
Reviewed by: arichardson, emaste
Differential Revision: https://reviews.freebsd.org/D37769

20 months agoinet6: Fix LINT build
Justin Hibbits [Tue, 20 Dec 2022 20:08:34 +0000 (15:08 -0500)]
inet6: Fix LINT build

mli_delete_locked() is the only function that takes a const ifnet.
Since it's a static function there's no advantage to keeping it const.
Since `if_t` is not a const struct (currently) the compiler throws an
error passing the ifp around to ifnet functions.

Fixes: eb1da3e5258238e1c0555c6a006a341df0821d8e
Sponsored by: Juniper Networks, Inc.

20 months agoktls_tests: Ignore errors from close for receive error tests.
John Baldwin [Tue, 20 Dec 2022 19:38:28 +0000 (11:38 -0800)]
ktls_tests: Ignore errors from close for receive error tests.

For tests that send invalid data to a TLS socket to trigger read
errors the kernel may end up dropping the connection before close is
called at the conclusion of the test resulting in spurious ECONNRESET
errors from close.  Ignore any errors from close for these tests.

PR: 268390
Reported by: olivier, Michal Gulbicki <michalx.gulbicki@intel.com>
Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37717

20 months agoktls_tests: Ignore spurious errors from shutdown(2).
John Baldwin [Tue, 20 Dec 2022 19:38:07 +0000 (11:38 -0800)]
ktls_tests: Ignore spurious errors from shutdown(2).

For some of the "bad size" tests, the remote end can notice the error
and drop the connection before the test program returns from write to
call shutdown.  In that case, shutdown fails with ENOTCONN.  Permit
these ENOTCONN errors without failing the test.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37693

20 months agoUpdate DrvAPI convert script for new KPIs
Justin Hibbits [Wed, 17 Aug 2022 20:13:58 +0000 (16:13 -0400)]
Update DrvAPI convert script for new KPIs

Bring the DrvAPI convert script forward from the initial commit to
account for the last 8 years of changes to the KPIs.

Sponsored by: Juniper Networks, Inc.

20 months agoDrvAPI: Extend driver KPI with more accessors
Justin Hibbits [Fri, 9 Dec 2022 20:54:51 +0000 (15:54 -0500)]
DrvAPI: Extend driver KPI with more accessors

Summary:
Add the following accessors to hide some more netstack details:
* if_get/setcapabilities2 and *bits analogue
* if_setdname
* if_getxname
* if_transmit - wrapper for call to ifp->if_transmit()
- This required changing the existing if_transmit to
if_transmit_default, since that's its purpose.
* if_getalloctype
* if_getindex
* if_foreach_addr_type - Like if_foreach_lladdr() but for any address
  family type.  Used by some drivers to iterate over all AF_INET
  addresses.
* if_init() - wrapper for ifp->if_init() call
* if_setinputfn
* if_setsndtagallocfn
* if_togglehwassist

Reviewers: #transport, #network, glebius, melifaro

Reviewed by: #network, melifaro
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37664

20 months agoipfw: Constify name argument for hash lookup
Justin Hibbits [Fri, 16 Dec 2022 18:16:52 +0000 (13:16 -0500)]
ipfw: Constify name argument for hash lookup

The name doesn't get modified, and it gets passed through to a hash
function that accepts only a const pointer.  Const it for correctness.

Sponsored by: Juniper Networks, Inc.

20 months agouart(4): Add support for AMT virtual serial port (C610/X99 series)
Stuart McLaren [Tue, 20 Dec 2022 14:58:32 +0000 (22:58 +0800)]
uart(4): Add support for AMT virtual serial port (C610/X99 series)

PR: 267053
MFC after: 3 days

20 months agostress2: Added link to problem found
Peter Holm [Tue, 20 Dec 2022 09:12:41 +0000 (10:12 +0100)]
stress2: Added link to problem found

20 months agostress2: Fix long run time
Peter Holm [Tue, 20 Dec 2022 09:12:01 +0000 (10:12 +0100)]
stress2: Fix long run time

20 months agoGet clocks for Rockchip RK3568.
Søren Schmidt [Tue, 20 Dec 2022 08:53:58 +0000 (08:53 +0000)]
Get clocks for Rockchip RK3568.

20 months agoufs/ffs: detect endian mismatch between machine and filesystem
Alfredo Dal'Ava Junior [Sat, 17 Dec 2022 02:54:39 +0000 (23:54 -0300)]
ufs/ffs: detect endian mismatch between machine and filesystem

Mount on a LE machine a filesystem formatted for BE is not supported
currently. This adds a check for the superblock magic number using
swapped bytes to guess and warn the user that it may be a valid
superblock but endian is incompatible.

MFC after: 2 weeks
Reviewed by: mckusick
Obtained from: mckusick, alfredo
Differential Revision: https://reviews.freebsd.org/D37675

20 months agoAdd Rockchip RK3568 SoC
Søren Schmidt [Tue, 20 Dec 2022 03:01:41 +0000 (03:01 +0000)]
Add Rockchip RK3568 SoC

Attach its clock drivers and rk817 pmic driver to the build.

20 months agonvme: Clear the notify flag if the consumer rejects the controller.
Dag-Erling Smørgrav [Tue, 20 Dec 2022 01:50:30 +0000 (02:50 +0100)]
nvme: Clear the notify flag if the consumer rejects the controller.

While here, fix some type mismatch warnings.

Reviewed by: imp
Sponsored by: Netapp, Inc.
Sponsored by: Klara, Inc.
MFC after: 1 week

20 months agoAdd support for ARM System Control and Management Interface (SCMI) v3.1.
Ruslan Bukin [Mon, 19 Dec 2022 20:16:18 +0000 (20:16 +0000)]
Add support for ARM System Control and Management Interface (SCMI) v3.1.

The SCMI specification describes a set of standard interfaces for power,
performance and system management.

SCMI is extensible and provides interfaces to access functions which are
often implemented in firmwares in the System Control Processor (SCP).

This implements Shared Memory-based transfer, which is one of the ways on
how messages are exchanged between agents and the platform.

This includes a driver for ARM Message Handling Unit (MHU) Doorbell, which
is a mechanism that the caller can use to alert the callee of the presence
of a message.

The support implements clock management interface. For instance this allows
us to control HDMI pixel clock on ARM Morello Board.

Tested on ARM Morello Board.

Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D37316
Reviewed by: manu
Sponsored by: UKRI

20 months agomount_nullfs.8: Bump .Dd for file mounts update.
Ceri Davies [Mon, 19 Dec 2022 18:58:39 +0000 (18:58 +0000)]
mount_nullfs.8: Bump .Dd for file mounts update.

20 months agoreadelf: match GNU readelf formatting
Ed Maste [Tue, 13 Dec 2022 20:07:46 +0000 (15:07 -0500)]
readelf: match GNU readelf formatting

GNU readelf emits a blank line before, and uses single quotes around the
symbol table name, in each "Symbol table 'name' contains ## entries"
header.

Reviewed by: markj
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37746

20 months agoDon't allow stacking of file mounts
Doug Rabson [Tue, 6 Dec 2022 13:24:55 +0000 (13:24 +0000)]
Don't allow stacking of file mounts

Reviewed by:    mjg, kib
Tested by:      pho

20 months agoAllow realpath to work for file mounts
Doug Rabson [Sun, 4 Dec 2022 15:53:07 +0000 (15:53 +0000)]
Allow realpath to work for file mounts

For file mounts, the directory vnode is not available from namei and this
prevents the use of vn_fullpath_hardlink. In this case, we can use the
vnode which was covered by the file mount with vn_fullpath.

This also disallows file mounts over files with link counts greater than
one to ensure a deterministic path to the mount point.

Reviewed by:    mjg, kib
Tested by:      pho

20 months agoAdd support for mounting single files in nullfs
Doug Rabson [Wed, 23 Nov 2022 14:51:13 +0000 (14:51 +0000)]
Add support for mounting single files in nullfs

The main use-case for this is to support mounting config files and
secrets into OCI containers. My current workaround copies the files into
the container which is messy and risks secrets leaking into container
images if the cleanup fails.

This adds a VFCF flag to indicate whether the filesystem supports file
mounts and allows fspath to be either a directory or a file if the flag
is set.

Test Plan:
$ sudo mkdir -p /mnt
$ sudo touch /mnt/foo
$ sudo mount -t nullfs /COPYRIGHT /mnt/foo

Reviewed by:    mjg, kib
Tested by:      pho

20 months agoAdd vn_path_to_global_path_hardlink
Doug Rabson [Fri, 2 Dec 2022 14:09:31 +0000 (14:09 +0000)]
Add vn_path_to_global_path_hardlink

This is similar to vn_path_to_global_path but allows for regular files
which may not be present in the cache.

Reviewed by:    mjg, kib
Tested by:      pho

20 months agoAdd support for mounting single files in nullfs
Doug Rabson [Mon, 7 Nov 2022 16:56:09 +0000 (16:56 +0000)]
Add support for mounting single files in nullfs

My main use-case for this is to support mounting config files and secrets
into OCI containers. My current workaround copies the files into the
container which is messy and risks secrets leaking into container images
if the cleanup fails.

Reviewed by: mjg, kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D37478

20 months agoRevert "Enable setting the phy id."
Ganbold Tsagaankhuu [Mon, 19 Dec 2022 15:13:46 +0000 (15:13 +0000)]
Revert "Enable setting the phy id."

This reverts commit 6692670f58f9069e59bc0c958fdaefb9bea5f726.

20 months agoautofs: whack an always-false branch
Mateusz Guzik [Mon, 19 Dec 2022 14:56:42 +0000 (14:56 +0000)]
autofs: whack an always-false branch

20 months agoEnable setting the phy id.
Søren Schmidt [Mon, 19 Dec 2022 12:56:51 +0000 (12:56 +0000)]
Enable setting the phy id.

It is needed for the RK356X combo phy.

20 months agovfs: retire the now unused SAVESTART flag
Mateusz Guzik [Wed, 14 Dec 2022 09:40:20 +0000 (09:40 +0000)]
vfs: retire the now unused SAVESTART flag

Bump __FreeBSD_version to 1400075

Tested by:      pho

20 months agovfs: stop using SAVESTART for rename
Mateusz Guzik [Wed, 14 Dec 2022 09:34:53 +0000 (09:34 +0000)]
vfs: stop using SAVESTART for rename

ni_startdir has never reached rename routines anyway

Reviewed by: mckusick
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D34468

20 months agovfs: make relookup take an additional argument
Mateusz Guzik [Thu, 10 Nov 2022 01:45:13 +0000 (01:45 +0000)]
vfs: make relookup take an additional argument

instead of looking at SAVESTART

This is a step towards removing the flag.

Reviewed by: mckusick
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D34468

20 months agonfs: stop using SAVESTART
Mateusz Guzik [Thu, 10 Nov 2022 02:15:04 +0000 (02:15 +0000)]
nfs: stop using SAVESTART

Only the name is wanted which is already always provided.

Reviewed by: rmacklem
Tested by: pho, rmacklem
Differential Revision: https://reviews.freebsd.org/D34470

20 months agovfs: retire NDFREE
Mateusz Guzik [Thu, 17 Nov 2022 16:59:20 +0000 (16:59 +0000)]
vfs: retire NDFREE

There are no consumers anymore. Interested parties can NDFREE_PNBUF
and vput or vrele relevant vnodes.

Tested by: pho

20 months agovfs: stop using NDFREE
Mateusz Guzik [Thu, 17 Nov 2022 16:58:28 +0000 (16:58 +0000)]
vfs: stop using NDFREE

It provides nothing but a branchfest and next to no consumers want it
anyway.

Tested by: pho

20 months agoxlocale(3): Link man pages
Jose Luis Duran [Mon, 19 Dec 2022 04:54:52 +0000 (05:54 +0100)]
xlocale(3): Link man pages

- provide various missing MLINKS for library functions
- update various SEE ALSO section to include the
  new linked manual pages
- add various definitions of new functions like isideogram_l(3)
- document COMPATIBILITY for some functions
- bump man page dates

Reviewed by: gbe, bcr
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/621
Differential Revision: https://reviews.freebsd.org/D37203

20 months agokrpc: Allow mountd/nfsd to optionally run in a jail
Rick Macklem [Sun, 18 Dec 2022 20:40:48 +0000 (12:40 -0800)]
krpc: Allow mountd/nfsd to optionally run in a jail

This patch modifies the kernel RPC so that it will allow
mountd/nfsd to run inside of a vnet jail.  Running mountd/nfsd
inside a vnet jail will be enabled via a new kernel build
option called VNET_NFSD, which will be implemented in future
commits.

Although I suspect cr_prison can be set from the credentials
of the current thread unconditionally, I #ifdef'd the code
VNET_NFSD and only did this for the jailed case mainly to
document that it is only needed for use in a jail.

The TLS support code has not yet been modified to work in
a jail.  That is planned as future development after the
basic VNET_NFSD support is in the kernel.

This patch should not result in any semantics change until
VNET_NFSD is implemented and used in a kernel configuration.

MFC after: 4 months

20 months agoAdd initial clocks support for Rockchip RK3568 SoC.
Søren Schmidt [Sun, 18 Dec 2022 12:05:29 +0000 (12:05 +0000)]
Add initial clocks support for Rockchip RK3568 SoC.

Partially from: https://reviews.freebsd.org/D36027

This can be eventually improved or simplified or fixed if necessary.

Following devices work with proper drivers and with the necessary clocks:
Native networking via eqos driver
USB3 and USB2
PCIe support is working but a bit picky about what hardware it supports (but so is Linux)
SD & (e)MMC
With the EDK2 loader video also works

Supported hardwares are Quartz64, NanoPI R5S and Firefly Station P2, more to come as DTS files gets done.

20 months agoFix/add compat strings for Rockchip RK356x GRF.
Søren Schmidt [Sun, 18 Dec 2022 11:22:11 +0000 (11:22 +0000)]
Fix/add compat strings for Rockchip RK356x GRF.

20 months agogrep.1: Add an ENVIRONMENT section
Jose Luis Duran [Sun, 18 Dec 2022 07:22:24 +0000 (08:22 +0100)]
grep.1: Add an ENVIRONMENT section

Document the environment variables used by grep(1).

Reviewed by: pauamma, kevans
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D37726

20 months agojail.8: Update the man page for allow.nfsd
Rick Macklem [Sat, 17 Dec 2022 21:54:33 +0000 (13:54 -0800)]
jail.8: Update the man page for allow.nfsd

Commit bba7a2e89602 added "allow.nfsd" to optionally allow
mountd/nfsd to be run inside a vnet prison when the kernel
is built with "options VNET_NFSD".

This patch updates the man page for this change.

This is a content change.

Reviewed by: jamie, bcr (manpages)
MFC after: 4 months
Differential Revision: https://reviews.freebsd.org/D37665