]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
15 months agolinux(4): Fix stack unwinding on arm64 [1/2]
Dmitry Chagin [Sun, 14 May 2023 21:24:57 +0000 (00:24 +0300)]
linux(4): Fix stack unwinding on arm64 [1/2]

An Aarch64 sigreturn trampoline frame can't currently be described in
a DWARF .eh_frame section, because Aarch64 does not define a register
number for PC and provide no direct way to encode PC of the previous
frame. Instead, unwinders (libgcc, gdb, libunwind) detect the sigreturn
frame by looking for the sigreturn instruction. If a sigreturn frame is
detected, unwinders restores all the gprs, SP and PC by assuming that
sp points to an rt_sigframe Linux kernel struct
When entering the kernel, the link register (lr) contains the return
address of the previous frame, the exception link register (elr) contains
the address of the next instruction after the one which generated the
exception, i.e., PC.

MFC after: 1 week

15 months agoktrace: Fix syscall number on a child return path from fork
Dmitry Chagin [Sun, 14 May 2023 21:23:50 +0000 (00:23 +0300)]
ktrace: Fix syscall number on a child return path from fork

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

16 months agosys.dirdeps.mk we do want to override OBJTOP
Simon J. Gerraty [Sun, 14 May 2023 16:50:03 +0000 (09:50 -0700)]
sys.dirdeps.mk we do want to override OBJTOP

Add more comments to explain what and why.
Ensure OBJROOT ends in / or - (/ preferred).
Export OBJTOP if level > 0
this avoids the issue with bmake/unit-tests.

Check if we have to override MAKEOBJDIR
and if so, put it into env correctly.

16 months agosrc.conf.5: regen
Ed Maste [Sun, 14 May 2023 14:17:59 +0000 (10:17 -0400)]
src.conf.5: regen

Fixes: df9974197e46 ("Add description of WITH_META_ERROR_TARGET")
Fixes: 2b519b170709 ("Update description of WITH_DIRDEPS_BUILD")
Fixes: 722cfce5f494 ("Fix typo and use .Fx in WITH_DIRDEPS_BUILD")
Sponsored by: The FreeBSD Foundation

16 months agoUpdate UPDATING
Graham Perrin [Sun, 14 May 2023 13:05:05 +0000 (07:05 -0600)]
Update UPDATING

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

16 months agoCONTRIBUTING.md: minor changes
Graham Perrin [Sun, 14 May 2023 12:49:00 +0000 (06:49 -0600)]
CONTRIBUTING.md: minor changes

Fix a singular/plural mistake, spelling error, a markup error, and a
handful of other minor changes.

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

16 months agolocal.dirdeps.mk no qual for PSEUDO_MACHINE_LIST
Simon J. Gerraty [Sat, 13 May 2023 21:06:20 +0000 (14:06 -0700)]
local.dirdeps.mk no qual for PSEUDO_MACHINE_LIST

dirdeps.mk takes care of "host"
but we still need to deal with other PSEUDO_MACHINE_LIST members

16 months agoUpdate dirdeps.mk
Simon J. Gerraty [Sat, 13 May 2023 21:05:19 +0000 (14:05 -0700)]
Update dirdeps.mk

Ensure host build_dirs are not qualified.

16 months agosh: improve style
Piotr Pawel Stefaniak [Sat, 29 Apr 2023 20:42:15 +0000 (22:42 +0200)]
sh: improve style

16 months agoGENERIC: remove a stray space character
Piotr Pawel Stefaniak [Sat, 13 May 2023 19:30:28 +0000 (21:30 +0200)]
GENERIC: remove a stray space character

16 months agosys.dirdeps.mk use ?= for OBJTOP
Simon J. Gerraty [Sat, 13 May 2023 17:46:24 +0000 (10:46 -0700)]
sys.dirdeps.mk use ?= for OBJTOP

This broke bmake's after-import step.

16 months agobmake forloop test was removed
Simon J. Gerraty [Sat, 13 May 2023 17:12:08 +0000 (10:12 -0700)]
bmake forloop test was removed

16 months agoMerge bmake-20230510
Simon J. Gerraty [Sat, 13 May 2023 17:05:48 +0000 (10:05 -0700)]
Merge bmake-20230510

Merge commit '945078deae448e0a13c34b3393d836087719fb16'

16 months agoImport bmake-20230510
Simon J. Gerraty [Sat, 13 May 2023 17:03:50 +0000 (10:03 -0700)]
Import bmake-20230510

Relevant/interesting changes:

o parse.c: don't print null filename in stack traces
o for.c: skip syntactically wrong .for loops
o var.c: allow for :gmtime=${mtime}
add :mtime[=timestamp] where timestamp is used if stat(2)
fails, if :mtime=error stat(2) failure causes error.
o make.1: fix documentation of .PREFIX to match reality and POSIX
o unit-tests: improved var-scope-local

16 months agoMove MACHINE/MACHINE_ARCH handling to sys.machine.mk
Simon J. Gerraty [Sat, 13 May 2023 15:15:49 +0000 (08:15 -0700)]
Move MACHINE/MACHINE_ARCH handling to sys.machine.mk

Rather than define the TARGETS and TARGET_ARCHES in src/Makefile
put them in sys.machine.mk so they can also be leveraged by
non-top-level builds.

We have TARGET_MACHINE_LIST as the list of MACHINES we build for.

For each MACHINE we have a MACHINE_ARCH_LIST_${MACHINE}
and the first entry of each list is used as default for
MACHINE_ARCH_${MACHINE}

We can now remove a bunch of MACHINE_ARCH.* handling from
local.sys.dirdeps*mk

Reviewed by: imp
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D40083

16 months agolibefi: add efi_devpath_next_instance()
Toomas Soome [Fri, 12 May 2023 15:41:14 +0000 (18:41 +0300)]
libefi: add efi_devpath_next_instance()

UEFI device path may be path to one device, or concatenated list of instances
to different devices (textually represented as comma separated list).

Provide generic function to get next instance from device path.
Returns next instance or end node.

The use case is like:

EFI_DEVICE_PATH *node = (EFI_DEVICE_PATH *)buf;
while (!IsDevicePathEnd(node)) {
process(node);
node = efi_devpath_next_instance(node);
}

Where buf is pointing to either single device path or
concatenated list of device paths (such as from ConIn or ConOut).

Reviewers: imp
Differential Revision: https://reviews.freebsd.org/D40081

16 months agorc.subr(8): delete debug cpuset helper
Enji Cooper [Thu, 11 May 2023 05:47:09 +0000 (22:47 -0700)]
rc.subr(8): delete debug cpuset helper

Summary:
The intention of the original author (I assume) was to add this logic
for testing. This removes the debug statement so it no longer shows up
in calls to `status`.

MFC after: 2 weeks
MFC with: 0661f9389

Reviewers: kevans

Subscribers: imp

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

16 months agoMove more DIRDEPS_BUILD settings
Simon J. Gerraty [Sat, 13 May 2023 00:40:37 +0000 (17:40 -0700)]
Move more DIRDEPS_BUILD settings

local.meta.sys.env.mk should now concern itself only with
META_MODE.

Move any DIRDEPS_BUILD settings to local.sys.dirdeps.env.mk

16 months agoMFV: xz 5.4.3.
Xin LI [Fri, 12 May 2023 22:49:34 +0000 (15:49 -0700)]
MFV: xz 5.4.3.

Relnotes: yes
MFC-after: 2 weeks

16 months agoloader: restore userboot help file
Ed Maste [Tue, 9 May 2023 13:19:42 +0000 (09:19 -0400)]
loader: restore userboot help file

Commit e32fecd0c2c3 intended to skip installing all but one copy of
each loader variant's help file, but accidentally skipped all copies for
the userboot help file.  (Other loaders install help files via the _simp
variant, but there is is no userboot_simp.)

PR: 271178
Fixes: e32fecd0c2c3 ("loader: install help files only once")
Sponsored by: The FreeBSD Foundation

16 months agoFix typo and use .Fx in WITH_DIRDEPS_BUILD
Simon J. Gerraty [Fri, 12 May 2023 16:49:03 +0000 (09:49 -0700)]
Fix typo and use .Fx in WITH_DIRDEPS_BUILD

16 months agospdx: The BSD-3-Clause-FreeBSD identifier never was, drop -FreeBSD
Warner Losh [Wed, 10 May 2023 15:40:58 +0000 (09:40 -0600)]
spdx: The BSD-3-Clause-FreeBSD identifier never was, drop -FreeBSD

There never was a BSD-3-Clause-FreeBSD SPDX identifier. Replace it
with BSD-3-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

16 months agoSPDX: It's spelled 'SPDX-License-Identifier'
Warner Losh [Thu, 11 May 2023 16:03:59 +0000 (10:03 -0600)]
SPDX: It's spelled 'SPDX-License-Identifier'

Sponsored by: Netflix

16 months agospdx: Simplify BSD-2-Clause AND BSD-2-Clause
Warner Losh [Wed, 10 May 2023 15:40:58 +0000 (09:40 -0600)]
spdx: Simplify BSD-2-Clause AND BSD-2-Clause

After removing the -FreeBSD and -NetBSD, we're left with a nuber of
BSD-2-Clause AND BSD-2-Clause, so tidy that up.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

16 months agospdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD
Warner Losh [Wed, 10 May 2023 15:40:58 +0000 (09:40 -0600)]
spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD

The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

16 months agospdx: Remove duplicate lines
Warner Losh [Wed, 10 May 2023 22:42:54 +0000 (16:42 -0600)]
spdx: Remove duplicate lines

Remove duplicated SPDX lines.

Sponsored by: Netflix

16 months agospdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
Warner Losh [Wed, 10 May 2023 15:40:58 +0000 (09:40 -0600)]
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

16 months agoUpdate description of WITH_DIRDEPS_BUILD
Simon J. Gerraty [Fri, 12 May 2023 16:42:21 +0000 (09:42 -0700)]
Update description of WITH_DIRDEPS_BUILD

16 months agoAdd description of WITH_META_ERROR_TARGET
Simon J. Gerraty [Fri, 12 May 2023 16:21:30 +0000 (09:21 -0700)]
Add description of WITH_META_ERROR_TARGET

16 months agokern.opts.mk: rationalize i386 EFI default with src.opts.mk
Ed Maste [Fri, 12 May 2023 14:39:42 +0000 (10:39 -0400)]
kern.opts.mk: rationalize i386 EFI default with src.opts.mk

PR: 269994
Fixes: ad9d10a859a ("efi: mark as broken on i386")
Sponsored by: The FreeBSD Foundation

16 months agosrc.conf.5: regen
Ed Maste [Fri, 12 May 2023 14:53:11 +0000 (10:53 -0400)]
src.conf.5: regen

Fixes: ad9d10a859ac ("efi: mark as broken on i386")
Fixes: bee3d4bf8ed5 ("Move DIRDEPS_BUILD settings to sys.dirdeps.mk")
Sponsored by: The FreeBSD Foundation

16 months agonetlink: reduce default log levels
Kristof Provost [Thu, 11 May 2023 13:08:42 +0000 (15:08 +0200)]
netlink: reduce default log levels

Reduce the default log level for netlink to LOG_INFO. This removes a
number of messages such as

> [nl_iface] dump_sa: unsupported family: 0, skipping
or
> [nl_iface] get_operstate_ether: error calling SIOCGIFMEDIA on vlan0: 22

that are useful for debugging, but not for most users.

Reviewed by: melifaro
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40062

16 months agoath11k: import ath11k driver
Bjoern A. Zeeb [Thu, 11 May 2023 22:23:00 +0000 (22:23 +0000)]
ath11k: import ath11k driver

Import BSD-3-Clause-Clear ath11k driver assumed to be
based on Linux kvalo/ath.git master at
6bae9de622d3ef4805aba40e763eb4b0975c4f6d.

Complement the driver to make compile on FreeBSD
using LinuxKPI with changes covered by #ifdef (__FreeBSD__).
Further select updates were applied since the initial import
in order to keep compiling along with other LinuxKPI based
drivers.

Add the module build framework but keep disconnected from the
build for now.
The current driver (or rather LinuxKPI) lacks support for some
"qcom" bits needed in order to get things working.
There was interest by various people to enhance support further.

We initially only plan to support PCI parts but it would be great
to further enhance qcom SoC support to run on several (cheap) APs.

The firmware is provided by port net/wifi-firmware-ath11k-kmod.

Given the lack of full license texts on most files this is
imported under the draft policy for handling SPDX files (D29226)
and with approval for BSD-3-Clause-Clear. [1]

Approved by:    core (jhb, 2023-05-11) [1]
MFC after:      2 months

16 months agoLinuxKPI: add dummy hash.h and kernel_connect()
Bjoern A. Zeeb [Thu, 11 May 2023 22:19:57 +0000 (22:19 +0000)]
LinuxKPI: add dummy hash.h and kernel_connect()

Add crypto/hash.h and a dummy kernel_connect() needed to compile
the ath11k wireless driver.  While I hope we will not actually need
the hash.h fallbacks, kernel_connect() we will have to deal with once
we sort out more QMI bits.

MFC after: 10 days

16 months agoamd64: pmap.h put a guard around a pcpu.h function
Bjoern A. Zeeb [Fri, 12 May 2023 11:14:54 +0000 (11:14 +0000)]
amd64: pmap.h put a guard around a pcpu.h function

pmap_get_pcid() calls zpcpu_get() which is defined in pcpu.h.
It is unclear why we do not include that header but like right
above the change add another guard around pmap_get_pcid().
This allows some LinuxKPI headers to compile again.

Suggested by: markj
MFC after: 10 days

16 months agozfs: merge openzfs/zfs@e61076683
Martin Matuska [Fri, 12 May 2023 11:12:59 +0000 (13:12 +0200)]
zfs: merge openzfs/zfs@e61076683

Notable upstream pull request merges:
  #14744 Optimize check_filesystem() and process_error_log()
  #14773 Allow zhack label repair to restore detached devices
  #14794 zpool import -m also removing spare and cache when log device
         is missing
  #14805 Simplify and optimize random_int_between()
  #14813 Enable the head_errlog feature to remove errors
  #14816 Fix two abd_gang_add_gang() issues
  #14817 Verify block pointers before writing them out
  #14819 Add dmu_tx_hold_append() interface
  #14823 Remove single parent assertion from zio_nowait()
  #14824 Plug memory leak in zfsdev_state
  #14825 Block cloning dbuf fixes
  #14828 Remove duplicate code in l2arc_evict()
  #14837 Fixes in head_errlog feature with encryption
  #14839 Prevent panic during concurrent snapshot rollback and zvol read
  #14853 zil: Don't expect zio_shrink() to succeed

Obtained from: OpenZFS
OpenZFS commit: e6107668385044718b0a73330ed6423650806473

16 months agovlan: fix setting flags on a QinQ interface
Kristof Provost [Fri, 12 May 2023 08:42:48 +0000 (10:42 +0200)]
vlan: fix setting flags on a QinQ interface

Setting vlan flags needlessly takes the exclusive VLAN_XLOCK().

If we have stacked vlan devices (i.e. QinQ) and we set vlan flags (e.g.
IFF_PROMISC) we call rtnl_handle_ifevent() to send a notification about
the interface.
This ends up calling SIOCGIFMEDIA, which requires the VLAN_SLOCK().
Trying to take that one with the VLAN_XLOCK() held deadlocks us.

There's no need for the exclusive lock though, as we're only accessing
parent/trunk information, not modifying it, so a shared lock is
sufficient.

While here also add a test case for this issue.

Backtrace:
shared lock of (sx) vlan_sx @ /usr/src/sys/net/if_vlan.c:2192
while exclusively locked from /usr/src/sys/net/if_vlan.c:2307
panic: excl->share
cpuid = 29
time = 1683873033
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe015d4ad4b0
vpanic() at vpanic+0x152/frame 0xfffffe015d4ad500
panic() at panic+0x43/frame 0xfffffe015d4ad560
witness_checkorder() at witness_checkorder+0xcb5/frame 0xfffffe015d4ad720
_sx_slock_int() at _sx_slock_int+0x67/frame 0xfffffe015d4ad760
vlan_ioctl() at vlan_ioctl+0xf8/frame 0xfffffe015d4ad7c0
dump_iface() at dump_iface+0x12f/frame 0xfffffe015d4ad840
rtnl_handle_ifevent() at rtnl_handle_ifevent+0xab/frame 0xfffffe015d4ad8c0
if_setflag() at if_setflag+0xf6/frame 0xfffffe015d4ad930
ifpromisc() at ifpromisc+0x2a/frame 0xfffffe015d4ad960
vlan_setflags() at vlan_setflags+0x60/frame 0xfffffe015d4ad990
vlan_ioctl() at vlan_ioctl+0x216/frame 0xfffffe015d4ad9f0
if_setflag() at if_setflag+0xe4/frame 0xfffffe015d4ada60
ifpromisc() at ifpromisc+0x2a/frame 0xfffffe015d4ada90
bridge_ioctl_add() at bridge_ioctl_add+0x499/frame 0xfffffe015d4adb10
bridge_ioctl() at bridge_ioctl+0x328/frame 0xfffffe015d4adbc0
ifioctl() at ifioctl+0x972/frame 0xfffffe015d4adcc0
kern_ioctl() at kern_ioctl+0x1fe/frame 0xfffffe015d4add30
sys_ioctl() at sys_ioctl+0x154/frame 0xfffffe015d4ade00
amd64_syscall() at amd64_syscall+0x140/frame 0xfffffe015d4adf30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe015d4adf30
--- syscall (54, FreeBSD ELF64, ioctl), rip = 0x22b0f0ef8d8a, rsp = 0x22b0ec63f2c8, rbp = 0x22b0ec63f380 ---
KDB: enter: panic
[ thread pid 5715 tid 101132 ]

Sponsored by: Rubicon Communications, LLC ("Netgate")

16 months agoarm64: Fix a typo in a source code comment
Gordon Bergling [Fri, 12 May 2023 08:45:46 +0000 (10:45 +0200)]
arm64: Fix a typo in a source code comment

- s/inferface/interface/

MFC after: 3 days

16 months agobhyve: import OpRegion definitions
Corvin Köhne [Wed, 10 May 2023 10:25:19 +0000 (12:25 +0200)]
bhyve: import OpRegion definitions

Those definitions are required for the GVT-d emulation to parse the
OpRegion.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40037

16 months agobhyve: add helper for passthru specific mmio ranges
Corvin Köhne [Wed, 10 May 2023 10:22:33 +0000 (12:22 +0200)]
bhyve: add helper for passthru specific mmio ranges

Intel GPUs have two special memory regions. They are called Graphics
Stolen Memory and OpRegion. bhyve has to emulate both of them. In order
to keep track of those special regions, add generic mmio ranges to the
passthru emulation.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40036

16 months agobhyve: don't panic if e820 finds no available memory
Corvin Köhne [Tue, 9 May 2023 12:32:33 +0000 (14:32 +0200)]
bhyve: don't panic if e820 finds no available memory

The GVT-d emulation tries to allocate some specific memory. It could
happen that this address doesn't exist. In that case, GVT-d will fall
back to allocate any address. Nevertheless, this only works if the e820
fails with an error instead of exiting on an assertion.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40034

16 months agoVendor import of xz 5.4.3 (trimmed)
Xin LI [Fri, 12 May 2023 06:31:50 +0000 (23:31 -0700)]
Vendor import of xz 5.4.3 (trimmed)

16 months agoMove DIRDEPS_BUILD settings to sys.dirdeps.mk
Simon J. Gerraty [Thu, 11 May 2023 23:15:04 +0000 (16:15 -0700)]
Move DIRDEPS_BUILD settings to sys.dirdeps.mk

When originally implemented, there was no distinction between
DIRDEPS_BUILD and META_MODE, they were one and the same.

META_MODE however is useful by itself, but since meta.sys.mk
had lots of settings related to DIRDEPS_BUILD its use was limited
to DIRDEPS_BUILD.

Move (most) DIRDEPS_BUILD related items to sys.dirdeps.mk
so that meta.sys.mk can be used for just META_MODE.
There is of course some bluring of the lines, so settings remain
in meta.sys.mk

Add MK_META_ERROR_TARGET to enable the META_MODE .ERROR target
independent of DIRDEPS_BUILD, it copies failed .meta files to ${SB}/error
to make it easier to identify the cause of build failures.

Since sys.dirdeps.mk should be included first, most of
local.meta.sys.mk becomes local.sys.dirdeps.mk
and some other bits need to move to local.sys.dirdeps.env.mk

Also fix dirdeps.mk to not add CURDIR to DIRDEPS when it is SRCTOP.

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D40053

16 months agoMake sure we are not trying to clone a spill block.
Pawel Jakub Dawidek [Wed, 10 May 2023 05:32:30 +0000 (22:32 -0700)]
Make sure we are not trying to clone a spill block.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825

16 months agoCorrect comment.
Pawel Jakub Dawidek [Thu, 4 May 2023 23:14:19 +0000 (16:14 -0700)]
Correct comment.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825

16 months agoRemove badly placed comment.
Pawel Jakub Dawidek [Thu, 4 May 2023 06:25:22 +0000 (23:25 -0700)]
Remove badly placed comment.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825

16 months agoDon't call zfs_exit_two() before zfs_enter_two().
Pawel Jakub Dawidek [Wed, 3 May 2023 07:24:47 +0000 (00:24 -0700)]
Don't call zfs_exit_two() before zfs_enter_two().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825

16 months agoDon't use dmu_buf_is_dirty() for unassigned transaction.
Pawel Jakub Dawidek [Tue, 2 May 2023 22:46:14 +0000 (15:46 -0700)]
Don't use dmu_buf_is_dirty() for unassigned transaction.

The dmu_buf_is_dirty() call doesn't make sense here for two reasons:
1. txg is 0 for unassigned tx, so it was a no-op.
2. It is equivalent of checking if we have dirty records and we are doing
   this few lines earlier.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825

16 months agoDeny block cloning is dbuf size doesn't match BP size.
Pawel Jakub Dawidek [Tue, 2 May 2023 21:24:43 +0000 (14:24 -0700)]
Deny block cloning is dbuf size doesn't match BP size.

I don't know an easy way to shrink down dbuf size, so just deny block cloning
into dbufs that don't match our BP's size.

This fixes the following situation:
1. Create a small file, eg. 1kB of random bytes. Its dbuf will be 1kB.
2. Create a larger file, eg. 2kB of random bytes. Its dbuf will be 2kB.
3. Truncate the large file to 0. Its dbuf will remain 2kB.
4. Clone the small file into the large file. Small file's BP lsize is
   1kB, but the large file's dbuf is 2kB.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825

16 months agoAdditional block cloning fixes.
Pawel Jakub Dawidek [Sun, 30 Apr 2023 09:47:09 +0000 (02:47 -0700)]
Additional block cloning fixes.

Reimplement some of the block cloning vs dbuf logic, mostly to fix
situation where we clone a block and in the same transaction group
we want to partially overwrite the clone.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825

16 months agodma: specify OpenSSL 1.1 API
Pierre Pronchery [Tue, 9 May 2023 14:06:40 +0000 (16:06 +0200)]
dma: specify OpenSSL 1.1 API

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation

16 months agodma: use OpenSSL 1.1 init API
Ed Maste [Thu, 11 May 2023 14:44:05 +0000 (10:44 -0400)]
dma: use OpenSSL 1.1 init API

> The SSL_library_init() and OpenSSL_add_ssl_algorithms() functions were
> deprecated in OpenSSL 1.1.0 by OPENSSL_init_ssl().

and

> The ERR_load_crypto_strings(), SSL_load_error_strings(), and
> ERR_free_strings() functions were deprecated in OpenSSL 1.1.0 by
> OPENSSL_init_crypto() and OPENSSL_init_ssl() and should not be used.

Reviewed by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40065

16 months agoLinuxKPI: 802.11: fix IEEE80211_TX_INFO_DRIVER_DATA_SIZE
Bjoern A. Zeeb [Thu, 11 May 2023 21:35:11 +0000 (21:35 +0000)]
LinuxKPI: 802.11: fix IEEE80211_TX_INFO_DRIVER_DATA_SIZE

Fix the sizing of IEEE80211_TX_INFO_DRIVER_DATA_SIZE so that it
also works on 32bit platforms.  Otherwise it triggers a compile-time
assertion in ath10k for i386.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

16 months agozil: Don't expect zio_shrink() to succeed.
Alexander Motin [Thu, 11 May 2023 21:27:12 +0000 (17:27 -0400)]
zil: Don't expect zio_shrink() to succeed.

At least for RAIDZ zio_shrink() does not reduce zio size, but reduced
wsz in that case likely results in writing uninitialized memory.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by:   iXsystems, Inc.
Closes #14853

16 months agorc.conf.5: document name_cpuset, introduced in rev 0661f93892a2
Ceri Davies [Thu, 11 May 2023 21:06:56 +0000 (22:06 +0100)]
rc.conf.5: document name_cpuset, introduced in rev 0661f93892a2

16 months agostand/efi: Retire i386 support
Warner Losh [Thu, 11 May 2023 20:04:12 +0000 (14:04 -0600)]
stand/efi: Retire i386 support

Remove the i386 ifdefs and files. It never worked.

Sponsored by: Netflix
Reviewed by: manu, tsoome, kevans
Differential Revision: https://reviews.freebsd.org/D40012

16 months agoefi: mark as broken on i386
Warner Losh [Thu, 11 May 2023 20:04:05 +0000 (14:04 -0600)]
efi: mark as broken on i386

We're never going to support EFI booting on i386 (32-bit). Start to
decommission it, since it's never worked.

Sponsored by: Netflix
Reviewed by: tsoome, emaste
Differential Revision: https://reviews.freebsd.org/D40011

16 months agostand: eficom: Only set baudrate when it changes
Warner Losh [Thu, 11 May 2023 20:04:00 +0000 (14:04 -0600)]
stand: eficom: Only set baudrate when it changes

Only set the baudrate when it is different than what the device has
reported. In addition, pass in the args to effect no change to the other
parameters to the serial port. Some EFI firmware gets cranky when you
set them to the same value, so avoid doing so (we likely can remove the
HyperV workaround with this fix, but I kept it in place). Add comments
to the code for why we do this too.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D40010

16 months agostand: eficom: Don't preemtively assume flow control
Warner Losh [Thu, 11 May 2023 20:03:51 +0000 (14:03 -0600)]
stand: eficom: Don't preemtively assume flow control

Remove rtsdtr_off. It's basically unused. Expand its meaning, but put
changing flow control to under an ifdef. We shouldn't set it unless
we're sure we need to do so. UEFI normally initializes the device
correctly, and we should avoid needless changes that aren't user
requested.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D40009

16 months agostand: eficom : remove unused ignore_cd
Warner Losh [Thu, 11 May 2023 20:03:47 +0000 (14:03 -0600)]
stand: eficom : remove unused ignore_cd

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D40008

16 months agostand: Move eficom to libefi
Warner Losh [Thu, 11 May 2023 20:03:42 +0000 (14:03 -0600)]
stand: Move eficom to libefi

Rename efiserialc to eficom.c and move it to libefi. Remove
loader.efi.h, since it's not needed. It's architecture independent
(though how we use it might vary). Drivers also belong in libfoo
in the boot loader: all the BIOS drivers are in i386/libi386 and
the console driver is in efi/libefi.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D40007

16 months agostand: Make non-matching console names OKer
Warner Losh [Thu, 11 May 2023 20:03:37 +0000 (14:03 -0600)]
stand: Make non-matching console names OKer

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39984

16 months agostand: add comconsole backwards compatibility shim for aarch64
Warner Losh [Thu, 11 May 2023 20:03:30 +0000 (14:03 -0600)]
stand: add comconsole backwards compatibility shim for aarch64

Add a compat shim for the "comconsole" name so that people with a
"console=comconsole" in their loader.conf on aarch64 will continue to
work (though with a warning).

This is only aarch64: it will never be there for amd64 (where comconsole
always means talk to the hardware directly). To do that is too hard.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39983

16 months agostand: efi create eficom console device.
Warner Losh [Thu, 11 May 2023 20:03:17 +0000 (14:03 -0600)]
stand: efi create eficom console device.

Fix the 'renaming kludge' that we absolutely cannot do going forward
(it's cost us days of engineering time).

console=comconsole talks to the hardware directly. This is available
only on amd64. It is not available anywhere else (and so requires
changes for people doing comconsole on aarch64)

console=eficom talks to the console via EFI protocols.  It's available
on amd64, aarch64 and riscv64. It's the first port that we find, though
it can be overriden by efi_com_port (which should be set to the UID of
the serial port, not the I/O port, despite the name). devinfo -v
will give the UID to uartX mapping.

This is an incompatible change for HYPER-V on amd64. It only works with
eficom console, so you'll need to change your configuration in
loader.conf. No compatibility hack will ever be provided for this (since
it requires renamig, which the loader cannot reliably do).

It's also an incompatible change for aarch64. comconsole will need to
change to eficom. There might be a comconsole "shim" for this.

All the interlock to keep only eficom and comconsole from both attaching
have been removed.

RelNotes: Yes
Sponsored by: Netflix
Discussed with: kevans
Differential Revision: https://reviews.freebsd.org/D39982

16 months agoarm64: add swapueword8/32
Kyle Evans [Thu, 11 May 2023 18:23:03 +0000 (13:23 -0500)]
arm64: add swapueword8/32

Much like casueword*, except just a plain old swap.  Maintains a similar
interface to casu(9)- return value -1 (fault), 0 (success), or 1 (fail),
and also both ll/sc and LSE variants are implemented.

These will be used to implement 32-bit swp/swpb emulation on aarch64.

Reveiwed by: andrew
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D39837

16 months agoCirrus-CI: hide manual tasks from official runs
Ed Maste [Thu, 11 May 2023 15:16:51 +0000 (11:16 -0400)]
Cirrus-CI: hide manual tasks from official runs

Sponsored by: The FreeBSD Foundation

16 months agofbt/x86: update FBT_AFRAMES to match the trap handlers
Chuck Silvers [Thu, 11 May 2023 01:22:15 +0000 (18:22 -0700)]
fbt/x86: update FBT_AFRAMES to match the trap handlers

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D40054

16 months agodpaa2: Simplify addresses translation with PHYS_TO_DMAP
Dmitry Salychev [Tue, 2 May 2023 12:17:04 +0000 (14:17 +0200)]
dpaa2: Simplify addresses translation with PHYS_TO_DMAP

Approved by: bz (mentor)
Reviewed by: bz (mentor), mhorne
Differential Revision: https://reviews.freebsd.org/D39946
MFC after: 3 weeks

16 months agoktls_test: specify OpenSSL 1.1 API
Pierre Pronchery [Thu, 11 May 2023 03:49:44 +0000 (05:49 +0200)]
ktls_test: specify OpenSSL 1.1 API

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation

16 months agobhyve: make passthru sel public available
Corvin Köhne [Wed, 10 May 2023 10:19:49 +0000 (12:19 +0200)]
bhyve: make passthru sel public available

The GVT-d emulation requires access to this selector to read from the
device.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40035

16 months agobhyve: add cmdline option for user defined fw_cfg items
Corvin Köhne [Wed, 8 Sep 2021 09:31:21 +0000 (11:31 +0200)]
bhyve: add cmdline option for user defined fw_cfg items

Some guest allow to configure themself by fw_cfg. E.g. Fedora CoreOs can
be provisioned by adding a JSON file as fw_cfg item.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38338

16 months agoComplete removing twe(4)
Li-Wen Hsu [Thu, 11 May 2023 08:28:23 +0000 (16:28 +0800)]
Complete removing twe(4)

Fixes: 062a7b918fac twe: Remove driver

16 months agoe1000: fix VLAN 0
Kristof Provost [Wed, 10 May 2023 16:26:29 +0000 (18:26 +0200)]
e1000: fix VLAN 0

VLAN 0 essentially means "Treat as untagged, but with priority bits",
and is used by some ISPs.

On igb/em interfaces we did not receive packets with VLAN tag 0 unless
vlanhwfilter was disabled.

This can be fixed by explicitly listing VLAN 0 in the hardware VLAN
filter (VFTA). Do this from em_setup_vlan_hw_support(), where we already
(re-)write the VFTA.

Reviewed by: kbowling
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40046

16 months agomd5: Add missing <errno.h>.
Dag-Erling Smørgrav [Thu, 11 May 2023 06:23:56 +0000 (06:23 +0000)]
md5: Add missing <errno.h>.

Sponsored by: Klara, Inc.
Reviewed by: yuripv
Differential Revision: https://reviews.freebsd.org/D40051

16 months agorc.subr(8): run `trailing-whitespace-fixer`
Enji Cooper [Thu, 11 May 2023 05:39:32 +0000 (22:39 -0700)]
rc.subr(8): run `trailing-whitespace-fixer`

This change deletes benign trailing whitespace from rc.subr, making
future non-stylistic changes easier to spot.

MFC after: 1 week

16 months agorc: add support for cpuset(1)
Miroslav Lachman [Thu, 11 May 2023 04:38:23 +0000 (23:38 -0500)]
rc: add support for cpuset(1)

If ${name}_cpuset is specified (and /usr is mounted), cpuset(1) will be
run to limit the service to the configured cpuset.

PR: 142434
Reviewed by: kevans

16 months agotwe: Remove driver
Warner Losh [Thu, 11 May 2023 04:24:12 +0000 (22:24 -0600)]
twe: Remove driver

Sponsored by: Netflix

16 months agolualoader: add support for .lua configuration files
Kyle Evans [Thu, 11 May 2023 04:10:53 +0000 (23:10 -0500)]
lualoader: add support for .lua configuration files

If a file is specified in loader_conf_files that ends in '.lua', lualoader
will now load and execute that file. These may be used in place of a
traditional loader.conf to use more complicated logic, where some values
may be set based on others or based on the environment that the C bits has
left us with.

Lua scripts are run in a limited environment. In particular, it does not get
access to any modules or, in-fact, anything except environment variable.

A config.buildenv hook has been added so that a local module can add
whatever it may need to to the environment.

When a global var is set in the lua script, it does not immediately alter
the loader environment. Instead, the script's environment is initially
empty and processed only if the whole script executes successfully.
Effectively, a lua configuration file either takes effect or it does not,
an error will not leave it in a half-baked state.

Reviewed by: bcr (manpages), imp
Differential Revision: https://reviews.freebsd.org/D28450

16 months agonet/pfkeyv2.h: fix typo, meNber
Konstantin Belousov [Wed, 10 May 2023 23:52:39 +0000 (02:52 +0300)]
net/pfkeyv2.h: fix typo, meNber

Sponsored by: NVidia networking
MFC after: 3 days

16 months agoInstall spleen vt(4) fonts
Ed Maste [Tue, 4 Jun 2019 20:31:00 +0000 (16:31 -0400)]
Install spleen vt(4) fonts

From https://github.com/fcambus/spleen, imported into contrib in
0d66206fff44.

Reviewed by: Frederic Cambus
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20654

16 months agotsort: Add unit tests.
Dag-Erling Smørgrav [Wed, 10 May 2023 13:45:44 +0000 (15:45 +0200)]
tsort: Add unit tests.

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

16 months agotsort: Replace bcopy() with memcpy().
Dag-Erling Smørgrav [Wed, 10 May 2023 13:45:38 +0000 (15:45 +0200)]
tsort: Replace bcopy() with memcpy().

Also fix an indentation error I introduced in the previous commit.

Fixes: cb46f47c7969
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40042

16 months agomd5: Add missing references to sha384.
Dag-Erling Smørgrav [Wed, 10 May 2023 13:45:11 +0000 (15:45 +0200)]
md5: Add missing references to sha384.

Fixes: 4849767cb16a
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D40032

16 months agohier(7): fix a couple mandoc warnings
Mitchell Horne [Wed, 10 May 2023 13:26:35 +0000 (10:26 -0300)]
hier(7): fix a couple mandoc warnings

These references are rendered correctly without the zero-width space.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

16 months agohier(7): document /home/ and /usr/home/
Mitchell Horne [Wed, 10 May 2023 12:53:56 +0000 (09:53 -0300)]
hier(7): document /home/ and /usr/home/

Reviewed by: imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40002

16 months agohier(7): drop list of /usr/share/doc subdirectories
Mitchell Horne [Wed, 10 May 2023 12:53:40 +0000 (09:53 -0300)]
hier(7): drop list of /usr/share/doc subdirectories

Several entries are outdated, several new ones are missing. I do not
think there is much value added in maintaining this.

Reviewed by: imp, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40001

16 months agohier(7): drop list of /usr/include subdirectories
Mitchell Horne [Wed, 10 May 2023 12:52:47 +0000 (09:52 -0300)]
hier(7): drop list of /usr/include subdirectories

It is nice to have, however, the location of this information means that
it will naturally be missed by developers adding or removing directories
to the layout, so it trends out-of-date and it is out-of-date.

The target audience for hier(7) is users and administrators. It is not
expected to be a place that programmers should go to learn about the
purposes of the different C headers provided by FreeBSD.

Program authors needing FreeBSD-specific interfaces or libraries
(#include <sys/queue.h>, for instance) will either be following a more
detailed man page, or consulting the header contents directly. Folks
targeting standardized headers (#include <sys/time.h>) will not need
hier(7) to tell them where those headers are under /usr/include.

In other words, this is more detail than necessary for this document.
I'd go as far as to say that many of the existing entries in this list
do little more than parrot the name of the directory.

With all this in mind, let's drop the maintenance burden.

Reviewed by: imp, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40000

16 months agoifconfig: fix family selection after 982cd5ae8ef6
Alexander V. Chernikov [Wed, 10 May 2023 12:40:51 +0000 (12:40 +0000)]
ifconfig: fix family selection after 982cd5ae8ef6

16 months agoifconfig: fix interface selection after 982cd5ae8ef6.
Alexander V. Chernikov [Wed, 10 May 2023 12:06:10 +0000 (12:06 +0000)]
ifconfig: fix interface selection after 982cd5ae8ef6.

16 months agoarm64: fix stack unwinding past exception handlers
Zachary Leaf [Tue, 9 May 2023 16:04:44 +0000 (17:04 +0100)]
arm64: fix stack unwinding past exception handlers

Commit 281402e0a563 ("arm64: Shave off two instructions in exceptions")
removed the instruction that set the frame pointer (x29) as it appeared
to be unused.

The frame pointer is used in arm64/db_trace.c:db_stack_trace_cmd() when
unwinding state, and hence still needs to be set.

Add back the instruction to save_registers to properly update frame
pointer.

Reported by: andrew
Sponsored by: Arm Ltd

16 months agoifconfig: split argument parsing and actual execution logic
Alexander V. Chernikov [Wed, 10 May 2023 09:58:56 +0000 (09:58 +0000)]
ifconfig: split argument parsing and actual execution logic

Reduce the amount of global variables by creating the dedicated
 ifconfig_args structure and use it as a context-passing variable.
Simplify the code by moving all argument preparation code a
 separate function.

Reviewed by: kp (previous version)
Differential Revision: https://reviews.freebsd.org/D39932
MFC after: 2 weeks

16 months agonetlink: provide original interface lladdr in the interface dump.
Alexander V. Chernikov [Wed, 10 May 2023 09:49:34 +0000 (09:49 +0000)]
netlink: provide original interface lladdr in the interface dump.

* Store lladdr in the FreeBSD-specific IFLAF_ORIG_HWADDR attr
* Do not export empty IFLA_ADDRESS for interfaces w/o lladdrs.

MFC after: 2 weeks

16 months agonetlink: export more IPv6 ifa info
Alexander V. Chernikov [Wed, 10 May 2023 08:52:31 +0000 (08:52 +0000)]
netlink: export more IPv6 ifa info

* Fill in IFA_CACHEINFO with prefix lifetime data
* Map IPv6 IN6_IFF_ flags to Netlink IFA_F_ flags
* Store original ia6_flags in the FreeBSD-specific IFAF_FLAGS field

MFC after: 2 weeks

16 months agonetlink: export carp VHID when dumping interface addresses.
Alexander V. Chernikov [Wed, 10 May 2023 08:44:47 +0000 (08:44 +0000)]
netlink: export carp VHID when dumping interface addresses.

MFC after: 2 weeks

16 months agomd5: Don't increment a bool.
Dag-Erling Smørgrav [Tue, 9 May 2023 17:59:27 +0000 (17:59 +0000)]
md5: Don't increment a bool.

Fixes: 4849767cb16a
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D40020

16 months agomd5: Include <osreldate.h> for __FreeBSD_version.
Dag-Erling Smørgrav [Tue, 9 May 2023 17:59:19 +0000 (17:59 +0000)]
md5: Include <osreldate.h> for __FreeBSD_version.

It is usually provided by <sys/param.h>, but not when bootstrapping.

Fixes: 4849767cb16a
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: yuripv, kevans
Differential Revision: https://reviews.freebsd.org/D40018

16 months agomd5: Fix input error check.
Dag-Erling Smørgrav [Tue, 9 May 2023 17:59:13 +0000 (17:59 +0000)]
md5: Fix input error check.

Fixes: 4849767cb16a
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: tsoome, kevans, lwhsu
Differential Revision: https://reviews.freebsd.org/D40017

16 months agopkgbase: report error if files are installed multiple times
Ed Maste [Fri, 5 May 2023 17:44:39 +0000 (13:44 -0400)]
pkgbase: report error if files are installed multiple times

Files installed by `make installworld` should be installed only once.

PR: 244596
Sponsored by: The FreeBSD Foundation

16 months agoincludes: avoid installing if_wg.h twice
Ed Maste [Wed, 10 May 2023 00:28:44 +0000 (20:28 -0400)]
includes: avoid installing if_wg.h twice

if_wg.h was installed via dev/wg in LSUBDIRS and also explicitly.  We
want to install only wg/if_wg.h not the other headers, so add dev/wg to
the skip list in the copies and symlinks targets.

PR: 271266
Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40031

16 months agoPrevent panic during concurrent snapshot rollback and zvol read
Ameer Hamza [Wed, 10 May 2023 00:56:35 +0000 (05:56 +0500)]
Prevent panic during concurrent snapshot rollback and zvol read

Protect zvol_cdev_read with zv_suspend_lock to prevent concurrent
release of the dnode, avoiding panic when a snapshot is rolled back
in parallel during ongoing zvol read operation.

Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #14839