]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agops: Fix synopsis
Mateusz Piotrowski [Tue, 25 Apr 2023 11:38:10 +0000 (13:38 +0200)]
ps: Fix synopsis

In the -L mode, the -L flag is not optional.

MFC after: 3 days
Sponsored by: Klara Inc.

14 months agozfs: fix up bogus checksums with blake3 in face of cpu migration
Mateusz Guzik [Tue, 25 Apr 2023 15:20:19 +0000 (15:20 +0000)]
zfs: fix up bogus checksums with blake3 in face of cpu migration

This is a temporary measure until a better fix is sorted out.

Upstream report: https://github.com/openzfs/zfs/issues/14785
Reported by: Evgeniy Khramtsov
Sponsored by: Rubicon Communications, LLC ("Netgate")

14 months agonetlink: remove now-unused rtnl_iface_find_cloner_locked().
Alexander V. Chernikov [Tue, 25 Apr 2023 15:04:11 +0000 (15:04 +0000)]
netlink: remove now-unused rtnl_iface_find_cloner_locked().

14 months agonetlink: fix powerpc build.
Alexander V. Chernikov [Tue, 25 Apr 2023 14:59:04 +0000 (14:59 +0000)]
netlink: fix powerpc build.

14 months agondp: fix signed/unsigned compariosn in the netlink code.
Alexander V. Chernikov [Tue, 25 Apr 2023 14:55:56 +0000 (14:55 +0000)]
ndp: fix signed/unsigned compariosn in the netlink code.

14 months agodtrace: Sync dis_tables.c with illumos
Mark Johnston [Tue, 21 Mar 2023 13:36:58 +0000 (09:36 -0400)]
dtrace: Sync dis_tables.c with illumos

This brings in the following commits:

    commit 584b574a3b16c6772c8204ec1d1c957c56f22a87
    12174 i86pc: variable may be used uninitialized
    Author: Toomas Soome <tsoome@me.com>
    Reviewed by: John Levon <john.levon@joyent.com>
    Reviewed by: Andrew Stormont <astormont@racktopsystems.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit a25e615d76804404e5fc63897a9196d4f92c3f5e
    12371 dis x86 EVEX prefix mishandled
    12372 dis EVEX encoding SIB mishandled
    12373 dis support for EVEX vaes instructions
    12374 dis support for EVEX vpclmulqdq instructions
    12375 dis support for gfni instructions
    Author: Robert Mustacchi <rm@fingolfin.org>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Approved by: Joshua M. Clulow <josh@sysmgr.org>

    commit c1e9bf00765d7ac9cf1986575e4489dd8710d9b1
    12369 dis WBNOINVD support
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit e4f6ce7088a7dd335b9edf4774325f888692e5fb
    10893 Need support for new Cascade Lake Instructions
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Dan McDonald <danmcd@joyent.com>
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Approved by: Gordon Ross <gwr@nexenta.com>

    commit cff040f3ef42d16ae655969398f5a5e6e700b85e
    10226 Need support for new EPYC ISA extensions
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: Jason King <jason.king@joyent.com>
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Approved by: Dan McDonald <danmcd@joyent.com>

    commit d242cdf5288b86d9070d88791c8ee696612becdc
    8492 AVX512 dis - legacy logical instructions
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit 81b505b772ab015c588c56bb116239ee549b6eee
    8384 AVX512 dis - EVEX prefix support
    8385 32-bit avx dis test mishandles EVEX prefix
    8386 32-bit bound dis is incorrect
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit 92381362ae635a3bea638d87b7119f1623b6212e
    8319 dis support for new xsave instructions
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

    commit a4e73d5d60e566669c550027fae2b1d87b4be2b4
    8240 AVX512 dis - opmask instruction support
    Author: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

    959b2dfd39979fe8a9a315a52741d009eb168822
    7825 want avx dis tests
    7826 PCLMULQDQ psuedo-ops aren't properly described in dis
    7827 dis tests for f16c, movbe, cpuid, msr, tsc, fence instrs
    7828 sysenter and sysexit dis should be allowed in 64-bit x86
    Author: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

MFC after: 2 weeks

14 months agocapsicum: Verify that openat("/", "..") fails with ENOTCAPABLE
Mark Johnston [Tue, 25 Apr 2023 13:54:47 +0000 (09:54 -0400)]
capsicum: Verify that openat("/", "..") fails with ENOTCAPABLE

Add a regression test for a718431c30a5 ("lookup(): ensure that
openat("/", "..", O_RESOLVE_BENEATH) fails").

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

14 months agotests: Add ATF_REQUIRE_SYSCTL_BOOL
Mark Johnston [Tue, 25 Apr 2023 13:54:23 +0000 (09:54 -0400)]
tests: Add ATF_REQUIRE_SYSCTL_BOOL

Modify a capability mode test to use it for kern.trap_enotcap, to avoid
false positives.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

14 months agoipfw: add [fw]mark implementation for ipfw
Boris Lytochkin [Tue, 25 Apr 2023 12:38:36 +0000 (12:38 +0000)]
ipfw: add [fw]mark implementation for ipfw

Packet Mark is an analogue to ipfw tags with O(1) lookup from mbuf while
regular tags require a single-linked list traversal.
Mark is a 32-bit number that can be looked up in a table
[with 'number' table-type], matched or compared with a number with optional
mask applied before comparison.
Having generic nature, Mark can be used in a variety of needs.
For example, it could be used as a security group: mark will hold a security
group id and represent a group of packet flows that shares same access
control policy.

Reviewed By: pauamma_gundo.com
Differential Revision: https://reviews.freebsd.org/D39555
MFC after: 1 month

14 months agonetlink: add netlink interfaces to if_clone
Alexander V. Chernikov [Wed, 19 Apr 2023 12:35:02 +0000 (12:35 +0000)]
netlink: add netlink interfaces to if_clone

This change adds netlink create/modify/dump interfaces to the `if_clone.c`.
The previous attempt with storing the logic inside `netlink/route/iface_drivers.c`
 did not quite work, as, for example, dumping interface-specific state
 (like vlan id or vlan parent) required some peeking into the private interfaces.

The new interfaces are added in a compatible way - callers don't have to do anything
unless they are extended with Netlink.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D39032
MFC after: 1 month

14 months agondp: convert ndp(8) to netlink.
Alexander V. Chernikov [Tue, 25 Apr 2023 12:30:39 +0000 (12:30 +0000)]
ndp: convert ndp(8) to netlink.

The change is intended to be fully transparent to the users.
Similarly to route(8) and netstat(8), ndp can be build without
  netlink by defining WITHOUT_NETLINK in make.conf.

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

14 months agoarp: remove forgotten debug message.
Alexander V. Chernikov [Tue, 25 Apr 2023 12:29:34 +0000 (12:29 +0000)]
arp: remove forgotten debug message.

14 months agonetlink: require proper privileges when adding neighbor.
Alexander V. Chernikov [Tue, 25 Apr 2023 12:28:22 +0000 (12:28 +0000)]
netlink: require proper privileges when adding neighbor.

MFC after: 3 days

14 months agonetlink: fix neighbour deleting for IPv6.
Alexander V. Chernikov [Tue, 25 Apr 2023 12:27:02 +0000 (12:27 +0000)]
netlink: fix neighbour deleting for IPv6.

MFC after: 2 weeks

14 months agoarp: convert arp(8) to netlink.
Alexander V. Chernikov [Tue, 25 Apr 2023 11:24:42 +0000 (11:24 +0000)]
arp: convert arp(8) to netlink.

The change is intended to be fully transparent to the users.
Similarly to route(8) and netstat(8), arp can be build without
 netlink by defining WITHOUT_NETLINK in make.conf.

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

14 months agonetlink: enable extended error reporting in snl(3).
Alexander V. Chernikov [Tue, 25 Apr 2023 11:20:35 +0000 (11:20 +0000)]
netlink: enable extended error reporting in snl(3).

MFC after: 2 weeks

14 months agoipfw.8: improve description for interface matching
Eugene Grosbein [Tue, 25 Apr 2023 11:12:11 +0000 (18:12 +0700)]
ipfw.8: improve description for interface matching

The manual describes "if*" form only while kernel uses fnmatch(3)
and allows use for more versatile shell-like patterns.
Note that explicitly and provide an example.

MFC after: 3 days

14 months agonetlink: add snl(3) support for dumping nexthops and neighbors
Alexander V. Chernikov [Tue, 25 Apr 2023 11:14:12 +0000 (11:14 +0000)]
netlink: add snl(3) support for dumping nexthops and neighbors

MFC after: 2 weeks

14 months agonetlink: add support for dumping kernel nexthops.
Alexander V. Chernikov [Tue, 25 Apr 2023 11:12:18 +0000 (11:12 +0000)]
netlink: add support for dumping kernel nexthops.

MFC after: 2 weeks

14 months agonetlink: allow creation of temporary lle entries.
Alexander V. Chernikov [Tue, 25 Apr 2023 11:08:47 +0000 (11:08 +0000)]
netlink: allow creation of temporary lle entries.

MFC after: 2 weeks

14 months agolltable: properly set expire time to 0 for static IPv4 entries.
Alexander V. Chernikov [Tue, 25 Apr 2023 10:59:50 +0000 (10:59 +0000)]
lltable: properly set expire time to 0 for static IPv4 entries.

MFC after: 2 weeks

14 months agonetlink: fix parameters in snl_attr_get_flag()
Alexander V. Chernikov [Tue, 25 Apr 2023 10:57:59 +0000 (10:57 +0000)]
netlink: fix parameters in snl_attr_get_flag()

MFC after: 2 weeks

14 months agonetlink: add nlattr_get_uint8() function to pack u8 attributes.
Alexander V. Chernikov [Tue, 25 Apr 2023 10:56:42 +0000 (10:56 +0000)]
netlink: add nlattr_get_uint8() function to pack u8 attributes.

MFC after: 2 weeks

14 months agorouting: add iterator-based nhop traversal KPI.
Alexander V. Chernikov [Tue, 25 Apr 2023 10:55:16 +0000 (10:55 +0000)]
routing: add iterator-based nhop traversal KPI.

MFC after: 2 weeks

14 months agorouting: add rt_tables_get_rnh_safe() that doesn't panic when af/fib is
Alexander V. Chernikov [Tue, 25 Apr 2023 10:53:51 +0000 (10:53 +0000)]
routing: add rt_tables_get_rnh_safe() that doesn't panic when af/fib is
  incorrect.

MFC after: 2 weeks

14 months agoelf.5: Fix conjugation of holds
Zhenlei Huang [Tue, 25 Apr 2023 10:21:52 +0000 (18:21 +0800)]
elf.5: Fix conjugation of holds

MFC after: 1 week

14 months agostress2: Update the exclude list
Peter Holm [Tue, 25 Apr 2023 09:42:04 +0000 (11:42 +0200)]
stress2: Update the exclude list

14 months agoAdd padding for future use on arm64
Andrew Turner [Mon, 24 Apr 2023 16:18:47 +0000 (17:18 +0100)]
Add padding for future use on arm64

Allow new features to be supported without changing the size of
existing structures.

Reviewed by: kib
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39777

14 months agobcm5974(4): Make Magic Trackpad 2 support endian-safe.
Vladimir Kondratyev [Tue, 25 Apr 2023 09:20:53 +0000 (12:20 +0300)]
bcm5974(4): Make Magic Trackpad 2 support endian-safe.

While here make touch orientation event matching with Linux

MFC after: 1 month

14 months agobcm5974(4): add Magic Trackpad 2 (USB only) support
Val Packett [Tue, 25 Apr 2023 09:20:53 +0000 (12:20 +0300)]
bcm5974(4): add Magic Trackpad 2 (USB only) support

The MT2 uses a compact report format, but otherwise is similar in many
ways to the internal trackpads, it even uses the same mode switching
commands.

Reviewed by: wulf
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D34437

14 months agosys/fs: do not report blocks allocated for synthetic file systems
Stefan Eßer [Tue, 25 Apr 2023 07:40:05 +0000 (09:40 +0200)]
sys/fs: do not report blocks allocated for synthetic file systems

The pseudo file systems (devfs, fdescfs, procfs, etc.) report total
and available blocks and inodes despite being synthetic with no
underlying storage device to which those values could be applied.

The current code of these file systems tends to report a fixed number
of total blocks but no free blocks, and in the case of procfs,
libprocfs, linsysfs also no free inodes.

This can be irritating in e.g. the "df" output, since 100% of the
resources seem to be in use, but it can also create warnings in
monitoring tools used for capacity management.

This patch makes these file systems return the same value for the
total and free parameters, leading to 0% in use being displayed by
"df". Since there is no resource that can be exhausted, this appears
to be a sensible result.

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

14 months agofs/msdosfs: Fix potential panic and size calculations
Stefan Eßer [Tue, 25 Apr 2023 06:35:16 +0000 (08:35 +0200)]
fs/msdosfs: Fix potential panic and size calculations

Some combinations of FAT12 file system parameters could cause a kernel
panic due to an unmapped access if the size of the FAT was larger than
the CPU page size. The reason is that FAT12 uses 3 bytes to store
2 FAT pointers, leading to partial FAT pointers at the end of buffers
of a size that is not a multiple of 3.

With a typical page size of 4 KB, this caused the FAT entry at byte
offsets 4095 and 4096 to cross the page boundary, with only the first
page mapped. This was fixed by adjusting the mapping to always cover
both bytes of each FAT entry.

Testing revealed 2 other inconsistencies that are fixed by this commit:

1) The calculation of the size of the data area did not take into
   account the fact that the first two data block numbers are reserved
   and that the data area starts with block 2. This could cause a
   FAT12 file system created with the maximum supported number of
   blocks to be incorrectly identified as FAT16.

2) The root directory does not take up space in the data area of a
   FAT12 or FAT16 file system, since it is placed into a reserved
   area outside of that data area. This commits makes stat() report
   the logical size of the root directory, but with 0 blocks allocated
   from the data area.

PR: 270587
Reviewed by: mckusick
Differential Revision: https://reviews.freebsd.org/D39386

14 months agoSet MK_host_egacy=yes earlier
Simon J. Gerraty [Tue, 25 Apr 2023 07:26:35 +0000 (00:26 -0700)]
Set MK_host_egacy=yes earlier

If we need to set MK_host_egacy=yes we might need to check it
in local.toolchain.mk so set it earlier in local.meta.sys.env.mk

Leave the default MK_host_egacy?=no in local.sys.mk so it can
be tested in Makefiles without concern for build mode.

14 months agonetipsec/key.c: use designated initializers for arrays
Konstantin Belousov [Tue, 3 Aug 2021 01:02:04 +0000 (04:02 +0300)]
netipsec/key.c: use designated initializers for arrays

Also de-expand nitems() use in related asserts, and fix maxsize array
name in the assert message.

Sponsored by: NVidia networking

14 months agonetipsec: some style
Konstantin Belousov [Sat, 31 Jul 2021 01:46:17 +0000 (04:46 +0300)]
netipsec: some style

Sponsored by: NVidia networking

14 months agobhyve: make use of qemus acpi table loader
Corvin Köhne [Wed, 6 Apr 2022 09:10:37 +0000 (11:10 +0200)]
bhyve: make use of qemus acpi table loader

Add all acpi tables to qemus acpi table loader. This passes the acpi
tables by fwcfg to the guest.

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

14 months agobhyve: add helper struct for qemus acpi table loader
Corvin Köhne [Wed, 6 Apr 2022 09:10:36 +0000 (11:10 +0200)]
bhyve: add helper struct for qemus acpi table loader

The hypervisor is aware of all system properties. For the guest bios
it's hard and complex to detect all system properties. For that reason,
it would be better if the hypervisor creates acpi tables instead of the
guest. Therefore, the hypervisor has to send the acpi tables to the
guest. At the moment, bhyve just copies the acpi tables into the guest
memory. This approach has some restrictions. You have to keep sure that
the guest doesn't overwrite them accidentally. Additionally, the size of
acpi tables is limited.

Providing a plain copy of all acpi tables by fwcfg isn't possible. Acpi
tables have to point to each other. So, if the guest copies the acpi
tables into memory by it's own, it has to patch the tables. Due to
different layouts for different acpi tables, there's no generic way to
do that.  For that reason, qemu created a table loader interface. It
contains commands for the guest for loading specific blobs into guest
memory and patching those blobs.

This commit adds a qemu_loader class which handles the creation of qemu
loader commands. At the moment, the WRITE_POINTER command isn't
implement. It won't be required by bhyve's acpi table generation yet.

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

14 months agobmake does not need libegacy
Simon J. Gerraty [Mon, 24 Apr 2023 23:55:45 +0000 (16:55 -0700)]
bmake does not need libegacy

14 months agoMerge bmake-20230414
Simon J. Gerraty [Mon, 24 Apr 2023 23:46:44 +0000 (16:46 -0700)]
Merge bmake-20230414

Merge commit '51d8a8b4ac1dd7265e891149e470a803906de2a7'

14 months agoImport bmake-20230414
Simon J. Gerraty [Mon, 24 Apr 2023 23:44:30 +0000 (16:44 -0700)]
Import bmake-20230414

Relevant/interesting changes:

* make.1: document seemingly unexplained Error code 6.
o compat.c: CompatDeleteTarget skip .PHONY targets to be
consistent with JobDeleteTarget.
o job.c: fix memory leak in handling sysv :from=to modifiers
o unit tests for .MAKE.META.IGNORE_{FILTER,PATHS,PATTERNS}
o var.c: fix parsing of unevaluated subexpressions with
unbalanced '{}'
o cond.c: reduce complexity of evaluating expressions

14 months agoRemove unused fields in siftr_stats. Thus, update the man page as well.
Cheng Cui [Mon, 24 Apr 2023 07:45:47 +0000 (03:45 -0400)]
Remove unused fields in siftr_stats. Thus, update the man page as well.

Summary: Remove unused fields in siftr_stats. Thus, update the man page as well.

Test Plan: Tested in Emulab testbed.

Reviewers: rscheff, tuexen
Approved by: rscheff, tuexen
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D39776

14 months agoCorrect the value of macro TF2_TCP_ACCOUNTING.
Cheng Cui [Thu, 20 Apr 2023 07:43:47 +0000 (03:43 -0400)]
Correct the value of macro TF2_TCP_ACCOUNTING.

Summary: Make sure the values are in order.

Reviewers: rscheff, tuexen, #transport!
Approved by: rscheff, tuexen, glebius
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D39716

14 months agovn_open_vnode(): fix locking around VOP_CLOSE() on advisory lock error
Olivier Certner [Mon, 24 Apr 2023 09:36:09 +0000 (11:36 +0200)]
vn_open_vnode(): fix locking around VOP_CLOSE() on advisory lock error

In the case of a FIFO or if trying to open a file for writing, an
exclusive lock is necessary.

Reviewed by: kib
MFC after: 1 week

14 months agosys/dirent.h: comment update, 'd_off' is offset of next entry
Olivier Certner [Sun, 23 Apr 2023 08:05:06 +0000 (10:05 +0200)]
sys/dirent.h: comment update, 'd_off' is offset of next entry

This is the historical (and still current) behavior, as well as that of
NetBSD, OpenBSD, illumos and Linux (getdents()/getdents64()).

Reviewed by: kib
MFC after: 3 days

14 months agolookup(): ensure that openat("/", "..", O_RESOLVE_BENEATH) fails
Konstantin Belousov [Sun, 23 Apr 2023 23:21:42 +0000 (02:21 +0300)]
lookup(): ensure that openat("/", "..", O_RESOLVE_BENEATH) fails

PR: 269780
Reported by: Dan Gohman <dev@sunfishcode.online>
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39773

14 months agodepend-cleanup.sh: Handle kqueue1() becoming a wrapper around kqueuex().
John Baldwin [Mon, 24 Apr 2023 21:05:18 +0000 (14:05 -0700)]
depend-cleanup.sh: Handle kqueue1() becoming a wrapper around kqueuex().

For a brief period kqueue1() was a system call and stale dependencies
cause it to not be re-built.

14 months agoWe do not need readpassphrase from openssh
Simon J. Gerraty [Mon, 24 Apr 2023 20:50:18 +0000 (13:50 -0700)]
We do not need readpassphrase from openssh

When building tar for linux, just disable HAVE_READPASSPHRASE
in config_freebsd.h and libarchive will provide for readpassphrase
Otherwise the two conflict.

14 months agoshare/misc/committers-doc.dot: dru: 2020, not 202
Graham Perrin [Mon, 24 Apr 2023 19:00:45 +0000 (20:00 +0100)]
share/misc/committers-doc.dot: dru: 2020, not 202

Dru Lavigne's doc commit bit was taken in 2020-05-05

https://cgit.freebsd.org/doc/commit/access?h=refs/internal/admin&id=fb28136a81580786a66ab2494da40b01f4b7a75b

Fixes: 52f576459855 committers-doc.dot: bring file up to date
14 months agoEnable building tar for non-FreeBSD host
Simon J. Gerraty [Mon, 24 Apr 2023 17:20:17 +0000 (10:20 -0700)]
Enable building tar for non-FreeBSD host

For DIRDEPS_BUILD we need Makefile.depend.options to
force libegacy to be built on older FreeBSD and non-FreeBSD hosts.

Add readpassphrase to libegacy to avoid the need for libbsd on Linux

src.opts.mk disable TESTS for host if MK_host_egacy is yes

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

14 months agocp: Revert "If copy_file_range(2) fails with EXDEV, use fall-back."
Mateusz Guzik [Mon, 24 Apr 2023 16:04:53 +0000 (16:04 +0000)]
cp: Revert "If copy_file_range(2) fails with EXDEV, use fall-back."

This reverts commit 64333654908153cd8e2dcb408c57cc3e3c4f29af.

The error is not valid per api contract, it showed up as a regression
after 15f0b8c309dea1dcb14d3e374686576ff68ac43f

15f0b8c309dea1dc ("zfs: merge openzfs/zfs@9cd71c860 (master)") and was
subsequently in d012836fb6165494 ("zfs: fix up EXDEV handling for
clone_range").

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

14 months agopowerpc: Use valid prototypes for function declarations with no arguments.
John Baldwin [Mon, 24 Apr 2023 15:53:50 +0000 (08:53 -0700)]
powerpc: Use valid prototypes for function declarations with no arguments.

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

14 months agonetstat: Use valid prototypes for function declarations with no arguments.
John Baldwin [Mon, 24 Apr 2023 15:53:50 +0000 (08:53 -0700)]
netstat: Use valid prototypes for function declarations with no arguments.

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

14 months agoppp: Use valid prototypes for function declarations with no arguments.
John Baldwin [Mon, 24 Apr 2023 15:53:49 +0000 (08:53 -0700)]
ppp: Use valid prototypes for function declarations with no arguments.

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

14 months agondp: Use valid prototypes for function declarations with no arguments.
John Baldwin [Mon, 24 Apr 2023 15:53:49 +0000 (08:53 -0700)]
ndp: Use valid prototypes for function declarations with no arguments.

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

14 months agorpc.umntall: Use valid prototype for function declaration with no arguments.
John Baldwin [Mon, 24 Apr 2023 15:53:49 +0000 (08:53 -0700)]
rpc.umntall: Use valid prototype for function declaration with no arguments.

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

14 months agorpc.lockd: Use valid prototypes for function declarations with no arguments.
John Baldwin [Mon, 24 Apr 2023 15:53:49 +0000 (08:53 -0700)]
rpc.lockd: Use valid prototypes for function declarations with no arguments.

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

14 months agofdisk: Use valid prototypes for function declarations with no arguments.
John Baldwin [Mon, 24 Apr 2023 15:53:49 +0000 (08:53 -0700)]
fdisk: Use valid prototypes for function declarations with no arguments.

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

14 months agolibsmdb: Silence -Wstrict-prototype warnings.
John Baldwin [Mon, 24 Apr 2023 15:53:49 +0000 (08:53 -0700)]
libsmdb: Silence -Wstrict-prototype warnings.

Presumably upstream will fix this eventually.

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

14 months agozlib: Silence -Wstrict-prototype warnings.
John Baldwin [Mon, 24 Apr 2023 15:53:49 +0000 (08:53 -0700)]
zlib: Silence -Wstrict-prototype warnings.

Presumably upstream will fix this eventually.

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

14 months agoClean up PCI DEN0115 driver probing
Andrew Turner [Mon, 24 Apr 2023 14:35:56 +0000 (15:35 +0100)]
Clean up PCI DEN0115 driver probing

Rather than checking for the SMCCC version check if the PCI_VERSION
call returns a valid version.

Sponsored by: Arm Ltd

14 months agopowerpc: syscalls.c is standard
Warner Losh [Mon, 24 Apr 2023 15:25:42 +0000 (09:25 -0600)]
powerpc: syscalls.c is standard

No need to add it here, much less make it optional on ktr.

Sponsored by: Netflix

14 months agoMechanically convert Xen netfront/netback(4) to IfAPI
Justin Hibbits [Tue, 1 Mar 2022 17:52:45 +0000 (11:52 -0600)]
Mechanically convert Xen netfront/netback(4) to IfAPI

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

14 months agoIfAPI: Hide the macros that touch ifnet members
Justin Hibbits [Fri, 7 Apr 2023 19:13:53 +0000 (15:13 -0400)]
IfAPI: Hide the macros that touch ifnet members

Nothing should be directly touching the ifnet members, which are hidden
in <net/if_private.h>, so hide them in the same header to avoid errors
from users.

Sponsored by: Juniper Networks, Inc.

14 months agolinuxkpi: Migrate to IfAPI
Justin Hibbits [Mon, 3 Apr 2023 14:48:28 +0000 (10:48 -0400)]
linuxkpi: Migrate to IfAPI

Summary:
Trivial changes for LinuxKPI to use IfAPI.  The 'bsdifp' looks unused,
so removed it instead of converting it to a pointer.

Bump __FreeBSD_version for change to struct net_device.

Reviewed by: bz, hselasky
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39491

14 months agoRemove unneeded SMMU macros
Andrew Turner [Mon, 24 Apr 2023 11:48:01 +0000 (12:48 +0100)]
Remove unneeded SMMU macros

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39186

14 months agoRemove virtual addresses from smmu_pmap_remove_pages
Andrew Turner [Mon, 24 Apr 2023 11:47:55 +0000 (12:47 +0100)]
Remove virtual addresses from smmu_pmap_remove_pages

This function needs to unmap all memory in a given SMMU context. Have
it iterate over all page table entries to find what has been mapped
rather than looking at virtual addresses.

While here use SMMU specific macros.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39185

14 months agoMove to a SMMU specific struct for the smmu pmap
Andrew Turner [Mon, 24 Apr 2023 11:47:50 +0000 (12:47 +0100)]
Move to a SMMU specific struct for the smmu pmap

This is not managed through the VM subsystem so only needs to hold the
data the SMMU driver needs.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39184

14 months agoCreate a common function to get the SMMU sid
Andrew Turner [Mon, 24 Apr 2023 11:47:44 +0000 (12:47 +0100)]
Create a common function to get the SMMU sid

Now the PCI drivers have a common interface to read the IOMMU xref
and SID create a common function to read it. This fixes an issue where
we will call into an ACPI specific function when booting with FDT when
both are enabled.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39183

14 months agoAdd PCI_ID_OFW_IOMMU to the pci ecam ACPI driver
Andrew Turner [Mon, 24 Apr 2023 11:47:38 +0000 (12:47 +0100)]
Add PCI_ID_OFW_IOMMU to the pci ecam ACPI driver

Teach the pci host generic ACPI attachment about PCI_ID_OFW_IOMMU. This
will be used by the arm64 smmu IOMMU driver to read the xref and ID
this interface provides in a bus-agnostic way.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39182

14 months agoarm64: Clean up smmu fdt xref handling
Andrew Turner [Mon, 24 Apr 2023 11:47:31 +0000 (12:47 +0100)]
arm64: Clean up smmu fdt xref handling

Use the xref from OF_xref_from_node for the smmu xref. We already have
a valid xref ID, there is no need to convert this to a memory address.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39181

14 months agoRemove redundant data from pci host generic
Andrew Turner [Mon, 24 Apr 2023 11:11:29 +0000 (12:11 +0100)]
Remove redundant data from pci host generic

The bus tag and handle fields are already stored in the resource. Use
this with the bus_read/bus_write helper macros.

Sponsored by: Arm Ltd

14 months agoUse a uint64_t to store the arm64 mpidr
Andrew Turner [Mon, 24 Apr 2023 10:24:13 +0000 (11:24 +0100)]
Use a uint64_t to store the arm64 mpidr

Use a single uint64_t to hole the mpidr register as we can break the
KBI on 14. Keep the macro so code can still be MFCd to 13.

Sponsored by: Arm Ltd

14 months agoAdd a PCI driver that follows the Arm DEN0115 spec
Andrew Turner [Sat, 4 Jun 2022 11:02:47 +0000 (12:02 +0100)]
Add a PCI driver that follows the Arm DEN0115 spec

Add a n attachment to the pci_host_generic driver for the Arm DEN0115
PCI Configuration Space Access Firmware Interface [1]. This can be used
when PCI controllers need to implement quirks in the PCI root bus.
To handle this the firmware implements a SMCCC interface the driver can
use to read and write the configuration register.

This has been tested on a Raspberry Pi 4 booting with EDK2.

[1] https://developer.arm.com/documentation/den0115/latest

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39228

14 months agoAllow pci_host_generic attachments to manage registers
Andrew Turner [Sat, 4 Jun 2022 10:59:46 +0000 (11:59 +0100)]
Allow pci_host_generic attachments to manage registers

To allow for attachments that don't use memory mapped registers add
a flag they can set when the base driver shouldn't map them.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39227

14 months agoMake arm64 pcb padding explicit
Andrew Turner [Mon, 24 Apr 2023 09:57:06 +0000 (10:57 +0100)]
Make arm64 pcb padding explicit

There is padding between some fields. Mark those I have found so they
can be reused later if needed.

Sponsored by: Arm Ltd

14 months agoRemove unneeded masks from the arm64 KASAN shadow
Andrew Turner [Fri, 21 Apr 2023 15:28:36 +0000 (16:28 +0100)]
Remove unneeded masks from the arm64 KASAN shadow

When mapping the arm64 KASAN shadow map we use Ln_TABLE_MASK to align
physical addresses, however these should already be aligned either
by rounding to a greater alignment, or the VM subsystem is giving us
a correctly aligned page.

Remove these extra alignment masks.

Reviewed by: kevans
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39752

14 months agohid: fix typo in hid_is_collection
Hu Shunchao [Mon, 24 Apr 2023 11:17:51 +0000 (14:17 +0300)]
hid: fix typo in hid_is_collection

hid_input is equal to 0. It is leftover from NetBSD code.

Reviewed by: hselasky, wulf
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D28149

14 months agobcm5974: fix wellspring9 pressure settings to handle force sensitivity
Val Packett [Mon, 24 Apr 2023 09:41:52 +0000 (12:41 +0300)]
bcm5974: fix wellspring9 pressure settings to handle force sensitivity

Reviewed by: wulf
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D34435

14 months agointelspi: add PCI attachment (Lynx/Wildcat/Sunrise Point)
Val Packett [Mon, 24 Apr 2023 09:41:52 +0000 (12:41 +0300)]
intelspi: add PCI attachment (Lynx/Wildcat/Sunrise Point)

Also adds fixups and cleanups:

- apply the child's mode/speed
- implement suspend/resume support
- use RF_SHAREABLE interrupts
- use bus_delayed_attach_children since the transfer can use interrupts
- add support for newly added spibus features (cs_delay and flags)

Operation tested on Broadwell (Wildcat Point) MacBookPro12,1.
Attachment also tested on Kaby Lake (Sunrise Point) Pixelbook.

Reviewed by: wulf
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D29249

14 months agospibus: extend API: add cs_delay ivar, KEEP_CS and NO_SLEEP flags
Val Packett [Mon, 24 Apr 2023 09:41:52 +0000 (12:41 +0300)]
spibus: extend API: add cs_delay ivar, KEEP_CS and NO_SLEEP flags

These feature are required for an upcoming Apple MacBook topcase
(HID over SPI) driver:

A delay after toggling CS is required to avoid anomalies like an extra
junk byte in front of the message. Keeping CS asserted is required to
be able to read a status report after writing a command. (The device
won't return the status if CS was deasserted.)

Sleep is not allowed in the interrupt context where the Apple input
driver runs its transactions. Use a flag to tell the SPI driver to
avoid mtx_sleep.

Reviewed by: manu (ok to SPI part of larger patch)
MFC afret: 1 month
Differential revision: https://reviews.freebsd.org/D29534

14 months agoext2fs: extract crc16 into sys/crc16.h
Val Packett [Mon, 24 Apr 2023 09:41:52 +0000 (12:41 +0300)]
ext2fs: extract crc16 into sys/crc16.h

deduplicate this as it might be needed for other drivers (e.g. Apple SPI-HID)

Sponsored by: https://www.patreon.com/valpackett
Reviewed by: chuck, imp
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D32879

14 months agoshowconfig - ignore options that do not start with A-Z
Simon J. Gerraty [Sun, 23 Apr 2023 23:52:12 +0000 (16:52 -0700)]
showconfig - ignore options that do not start with A-Z

When building on various hosts it can be handy to create pseudo
options like MK_host_egacy - building on a host that needs libegacy.

Such options should be ignored by showconfig

Reviewed by: emaste

14 months agoposixshmcontrol(1): silently ignore inaccessible segments when listing
Konstantin Belousov [Sun, 23 Apr 2023 23:30:58 +0000 (02:30 +0300)]
posixshmcontrol(1): silently ignore inaccessible segments when listing

PR: 271038
Reported by: rau8344@gmail.com
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

14 months agoath10k: add man page
Bjoern A. Zeeb [Sun, 23 Apr 2023 21:22:01 +0000 (21:22 +0000)]
ath10k: add man page

Add initial man page for ath10k.4.

MFC after: 2 months

14 months agoath10k: import ath10k driver
Bjoern A. Zeeb [Wed, 19 Apr 2023 13:16:17 +0000 (13:16 +0000)]
ath10k: import ath10k driver

Import ISC-licensed ath10k driver assumed to be
based on Linux kvalo/ath.git master at
6bae9de622d3ef4805aba40e763eb4b0975c4f6d.

Import support to redirect fwlogs to kernel messages
from https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/389075

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.

Any other native driver using BUS_PROBE_DEFAULT will attach
ignoring this one by default given bsd_probe_return is set
to a lower priority.

Add the module build framework.

We only support PCI parts.

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

Given the lack of full license texts on most files this is
imported under the draft policy for handling SPDX files (D29226). [1]

Approved by: core (emaste, 2022-04-08) [1]
MFC after: 2 months

14 months agoathk: import common code for ath1?k drivers
Bjoern A. Zeeb [Wed, 19 Apr 2023 12:48:08 +0000 (12:48 +0000)]
athk: import common code for ath1?k drivers

Import common ISC-licensed athk parts assumed to be
based on Linux kvalo/ath.git master at
6bae9de622d3ef4805aba40e763eb4b0975c4f6d.

The only modification should be for FreeBSD module
handling in main.c.

Add the module build framework unconnected to the
build for now.

These files will be shared by ath1?k drivers.

MFC after: 2 months

14 months agoath10k: ath11k: add specific LinuxKPI support
Bjoern A. Zeeb [Tue, 18 Apr 2023 20:21:37 +0000 (20:21 +0000)]
ath10k: ath11k: add specific LinuxKPI support

Add files needed by ath1?k drivers to linuxkpi/linuxkpi_wlan.
This contain (skeleton) implementations of what is needed to
compile but specifically mhi/qmi/qrtr will need more work for
ath11k.

MFC after: 2 months

14 months agoath10k: ath11k: ammend devd.conf regex
Bjoern A. Zeeb [Tue, 18 Apr 2023 20:13:24 +0000 (20:13 +0000)]
ath10k: ath11k: ammend devd.conf regex

In order to match these drivers, and in expectiation of ath12k
happening add ath[0-9]+k to the regex pattern for wlan devices.

MFC after: 2 months

14 months agomt76: devd: add support for mt79* wireless drivers to devd.conf
Bjoern A. Zeeb [Tue, 18 Apr 2023 14:31:41 +0000 (14:31 +0000)]
mt76: devd: add support for mt79* wireless drivers to devd.conf

Add the "mt79" to the regex for wireless drivers in devd.conf so
that they get handled as expected.

MFC after: 2 months

14 months agomt76: add module build framework and man pages
Bjoern A. Zeeb [Tue, 18 Apr 2023 14:30:20 +0000 (14:30 +0000)]
mt76: add module build framework and man pages

Add framework to build if_mt7915 and if_mt7921 with LinuxKPI
as well as initial man pages for the two mt76 chipset drivers.

MFC after: 2 months

14 months agomt76: import mediatek/mt76 driver
Bjoern A. Zeeb [Tue, 18 Apr 2023 14:26:38 +0000 (14:26 +0000)]
mt76: import mediatek/mt76 driver

Import ISC-licensed driver parts of mediatek/mt76
assumed to be based on Linux wireless-testing at
a02411a5b98612c12be99349836d99f07db12a77 (tag: wt-2022-11-23).

Complement the driver and LinuxKPI with our own (dummy)
implementations of missing parts (util.h and soc/mediatek/)
as well as changes to make compile on FreeBSD with changes
covered by #ifdef (__FreeBSD__) conditions.
Further select updates were applied since the initial import
in order to keep compiling along with other LinuxKPI based
drivers.

For the moment we only target the mt7915 and mt7921 PCI parts.
More may follow in the future.

Firmware is provided by port net/wifi-firmware-mt76-kmod.

Given the lack of full license texts on non-local files this is
imported under the draft policy for handling SPDX files (D29226). [1]

Approved by: core (emaste, 2022-04-08) [1]
MFC after: 2 months

14 months agoSet UPDATE_DEPDFILE=NO for showconfig
Simon J. Gerraty [Sun, 23 Apr 2023 20:43:45 +0000 (13:43 -0700)]
Set UPDATE_DEPDFILE=NO for showconfig

Exporting UPDATE_DEPDFILE=NO from makeman didn't work,
back to setting it in local.meta.sys.env.mk

14 months agokcsan: add __tsan_mem(cpy|move|set) aliases for clang >= 16
Dimitry Andric [Sun, 23 Apr 2023 18:11:34 +0000 (20:11 +0200)]
kcsan: add __tsan_mem(cpy|move|set) aliases for clang >= 16

Summary:
After https://github.com/llvm/llvm-project/commit/b4257d3bf58c ("[tsan]
Replace mem intrinsics with calls to interceptors") intrinsic calls to
memcpy, memmove or memset will directly call sanitizer interceptors,
e.g. __tsan_memcpy, __tsan_memmove or __tsan_memset.

Building GENERIC-KCSAN with clang >= 16 would thus result in link errors
similar to:

  ld: error: undefined symbol: __tsan_memcpy
  >>> referenced by cam_compat.c:150 (/usr/src/sys/cam/cam_compat.c:150)
  >>>               cam_compat.o:(cam_compat_handle_0x17)
  >>> referenced by cam_compat.c:151 (/usr/src/sys/cam/cam_compat.c:151)
  >>>               cam_compat.o:(cam_compat_handle_0x17)
  >>> referenced by cam_compat.c:152 (/usr/src/sys/cam/cam_compat.c:152)
  >>>               cam_compat.o:(cam_compat_handle_0x17)
  >>> referenced 1692 more times

Similar to subr_msan.c, add aliases from the existing kcsan_* versions
of these functions to __tsan_* names.

Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39772

14 months agoarm64: Disable PAC when booting on a Windows Dev Kit 2023
Mark Johnston [Sun, 23 Apr 2023 17:32:45 +0000 (13:32 -0400)]
arm64: Disable PAC when booting on a Windows Dev Kit 2023

It appears that PAC registers are configured to trap upon access, but
since the kernel starts in EL1 on this platform it has no ability to
inspect or modify this configuration.  Simply disable PAC on this
platform for now, since the kernel otherwise hangs during boot.

PR: 270472
Reviewed by: andrew, emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39748

14 months agoriscv: Implement bus_describe_intr() for nexus
Mark Johnston [Sun, 23 Apr 2023 17:31:01 +0000 (13:31 -0400)]
riscv: Implement bus_describe_intr() for nexus

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

14 months agoarm64: Implement bus_describe_intr() for nexus
Mark Johnston [Sun, 23 Apr 2023 17:30:44 +0000 (13:30 -0400)]
arm64: Implement bus_describe_intr() for nexus

Prompted by a compiler warning introduced by
e582d4a2b09e ("arm64: nexus code tidy-up").

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

14 months agoinpcb: Fix some bugs in _in_pcbinshash_wild()
Mark Johnston [Sun, 23 Apr 2023 14:36:24 +0000 (10:36 -0400)]
inpcb: Fix some bugs in _in_pcbinshash_wild()

- In _in_pcbinshash_wild(), we should avoid returning v6 sockets unless
  no other matches are available.  This preserves pre-existing
  semantics.
- Fix an inverted test: when inserting a non-jailed PCB, we want to
  search for the first non-jailed PCB in the hash chain.
- Test the right PCB when searching for a non-jailed PCB.

While here, add a required locking assertion.

Fixes: 7b92493ab1d4 ("inpcb: Avoid inp_cred dereferences in SMR-protected lookup")

14 months agosctp: use constants from RFC 8260 to improve compliance
Michael Tuexen [Sun, 23 Apr 2023 15:48:05 +0000 (17:48 +0200)]
sctp: use constants from RFC 8260 to improve compliance

Keep the old constants for backwards compatibility.

MFC after: 1 week

14 months agometa.sys.mk: downgrade missing Filemon error to warning
Ed Maste [Sun, 23 Apr 2023 14:48:22 +0000 (10:48 -0400)]
meta.sys.mk: downgrade missing Filemon error to warning

Cirrus-CI was red because `make makeman` failed with a spurious "filemon
is not loaded" error.  For now just make it a warning.

14 months agoLinuxKPI: pci.h: always initialize return value
Bjoern A. Zeeb [Thu, 20 Apr 2023 15:59:33 +0000 (15:59 +0000)]
LinuxKPI: pci.h: always initialize return value

In pcie_capability_read_*() always initialize the return value to
avoid warnings of uninitialized values in callers.

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