]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agokinst: test lock in kinst_trampoline_dealloc_locked()
Christos Margiolis [Mon, 1 May 2023 15:22:37 +0000 (15:22 +0000)]
kinst: test lock in kinst_trampoline_dealloc_locked()

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

14 months agofbt: get rid of redundant defines
Christos Margiolis [Mon, 1 May 2023 15:20:34 +0000 (15:20 +0000)]
fbt: get rid of redundant defines

No functional change intended.

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

14 months agohwpmc: Fix a typo
Mark Johnston [Mon, 1 May 2023 15:19:25 +0000 (11:19 -0400)]
hwpmc: Fix a typo

MFC after: 1 week

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

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

14 months agomfi(4): Refer to mrsas(4)
Tom Hukins [Wed, 19 Apr 2023 20:03:09 +0000 (21:03 +0100)]
mfi(4): Refer to mrsas(4)

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

14 months agonetlink: whitespace fix in netlink_message_writer.h.
Alexander V. Chernikov [Mon, 1 May 2023 14:45:45 +0000 (14:45 +0000)]
netlink: whitespace fix in netlink_message_writer.h.

Reported by: garga
MFC after: 2 weeks

14 months agowlan(4): Add more related drivers to "See also"
Tom Hukins [Wed, 19 Apr 2023 19:47:24 +0000 (20:47 +0100)]
wlan(4): Add more related drivers to "See also"

Pull Request: https://github.com/freebsd/freebsd-src/pull/721

14 months agopf: Fix a spelling mistake in a comment
Tom Hukins [Wed, 29 Mar 2023 14:00:00 +0000 (15:00 +0100)]
pf: Fix a spelling mistake in a comment

Pull Request: https://github.com/freebsd/freebsd-src/pull/704

14 months agolibc: Fix a documentation spelling mistake
Tom Hukins [Wed, 29 Mar 2023 13:38:12 +0000 (14:38 +0100)]
libc: Fix a documentation spelling mistake

Pull Request: https://github.com/freebsd/freebsd-src/pull/704

14 months agopf: reduce number of hashing operations when handling source nodes
Kajetan Staszkiewicz [Mon, 1 May 2023 14:07:42 +0000 (16:07 +0200)]
pf: reduce number of hashing operations when handling source nodes

Reduce number of hashing operations when handling source nodes by always
having a pointer to the hash row mutex in the source node. Provide
macros for handling and asserting the mutex. Calculate the hash only
once in pf_find_src_node() and then use this hash in subsequent
operations.

Cherry-picked from development of D39880

Reviewed by: kp, mjg
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D39888

14 months agonetlink: always zero provided header buffers.
Alexander V. Chernikov [Mon, 1 May 2023 14:07:33 +0000 (14:07 +0000)]
netlink: always zero provided header buffers.

Reported by: KMSAN
MFC after: 3 days

14 months agolibmlx5: Add more ConnectX-6/7/8 HCA IDs to hca_table.
Hans Petter Selasky [Mon, 1 May 2023 11:48:20 +0000 (13:48 +0200)]
libmlx5: Add more ConnectX-6/7/8 HCA IDs to hca_table.

To allow userspace utilities to use these devices.

MFC after: 1 week
Sponsored by: NVIDIA Networking

14 months agoopensm: Fix build with -Werror and -Wdate-time.
Mina Galić [Mon, 1 May 2023 09:13:30 +0000 (11:13 +0200)]
opensm: Fix build with -Werror and -Wdate-time.

This fixes builds WITH_OFED_EXTRA=YES .

PR: 270776
Pull Request: https://github.com/freebsd/freebsd-src/pull/715
MFC after: 1 week
Sponsored by: NVIDIA Networking

14 months agostress2: Added a temporary fix for the UFS+SU "out of inodes" issue
Peter Holm [Mon, 1 May 2023 10:52:42 +0000 (12:52 +0200)]
stress2: Added a temporary fix for the UFS+SU "out of inodes" issue

14 months agofwget: Introduce new utility
Emmanuel Vadot [Wed, 26 Apr 2023 05:46:20 +0000 (07:46 +0200)]
fwget: Introduce new utility

This script's goal is to check the system for peripherals that needs
firmware and install the needed packages for them.
For now it only support pci subsystem and only video classes for AMD
and Intel GPUs.

Reviewed by: bapt
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39825

14 months agoarmv7: release: Stop installing BBB u-boot
Emmanuel Vadot [Thu, 27 Apr 2023 06:21:47 +0000 (08:21 +0200)]
armv7: release: Stop installing BBB u-boot

BBB code was removed from GENERIC kernel as it's not functional.
Stop installing u-boot for a platform that we don't boot on.

Reviewed by: imp, gjb
Approved by: re@ (gjb)
MFC after: never
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39844

14 months agoarm: Remove TI code from GENERIC
Emmanuel Vadot [Thu, 27 Apr 2023 06:19:07 +0000 (08:19 +0200)]
arm: Remove TI code from GENERIC

TI support is in a sad state for years.
We haven't been able to keep up with all the breaking changes that
upstream do in the DTS. This requires a lot of new drivers to handle the
new buses that they create and all the new clocks that they expose.
Keep the code for now in case somebody is interested in reviving this
platform but stop bloating GENERIC with code that don't work.

Reviewed by: imp, mmel
MFC after: never
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39843

14 months agolisten(2): improve administrator control over logging
Eugene Grosbein [Sun, 30 Apr 2023 20:14:30 +0000 (03:14 +0700)]
listen(2): improve administrator control over logging

As documented in listen.2 manual page, the kernel emits a LOG_DEBUG
syslog message if a socket listen queue overflows. For some appliances,
it may be desirable to change the priority to some higher value
like LOG_INFO while keeping other debugging suppressed.

OTOH there are cases when such overflows are normal and expected.
Then it may be desirable to suppress overflow logging altogether,
so that dmesg buffer is not flooded over long run.

In addition to existing sysctl kern.ipc.sooverinterval,
introduce new sysctl kern.ipc.sooverprio that defaults to 7 (LOG_DEBUG)
to preserve current behavior. It may be changed to any value
in a range of 0..7 for corresponding priority or to -1 to suppress logging.
Document it in the listen.2 manual page.

MFC after: 1 month

14 months agocontrib/bc: import version 6.5.0
Stefan Eßer [Sun, 30 Apr 2023 17:53:26 +0000 (19:53 +0200)]
contrib/bc: import version 6.5.0

This release that fixes an infinite loop bug in the (non-standard)
extended math library functions root() and cbrt(), fixes a bug with
BC_LINE_LENGTH=0, and adds the fib() function to the extended math
library to calculate Fibonacci numbers.

(cherry picked from commit 438a1101dc1f687928cdbe02cd7817a88a24f42f)

MFC after:      3 days

14 months agolibifconfig: fix carp key configuration
Kristof Provost [Fri, 28 Apr 2023 16:18:55 +0000 (18:18 +0200)]
libifconfig: fix carp key configuration

There were two issues with the carp key configuration in the new netlink
code.

The first is that userspace failed to actually pass the CARP_NL_KEY
attribute to the kernel, so a key was never set.

The second issue is that snl_attr_get_string() returns a pointer to the
string inside the netlink message. It does not copy the string to the
target buffer. That's somewhat inconvenient to work with in libifconfig
where we have a static buffer for the key.
Introduce snl_attr_copy_string() which can copy a string to a target
buffer and uses the 'arg' parameter to pass the buffer size, so it
doesn't accidentally exceed the available space.

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

14 months agonewfs: fix up 32-bit compile
Mateusz Guzik [Sun, 30 Apr 2023 18:00:20 +0000 (18:00 +0000)]
newfs: fix up 32-bit compile

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

14 months agosctp: improve handling of stale cookie error causes
Michael Tuexen [Sun, 30 Apr 2023 09:39:32 +0000 (11:39 +0200)]
sctp: improve handling of stale cookie error causes

* If a measure of staleness of 0 is reported, use the RTT instead.
* Ensure that we always send a cookie preservative parameter by
  rounding up during the calculation.
* If allowed, perform a round trip time measurement.
* Clear the overall error counter, since the error cause also
  acts like an ACK.

MFC after: 1 week

14 months agoYet another try to fix printf format conflict.
Kirk McKusick [Sun, 30 Apr 2023 06:59:45 +0000 (23:59 -0700)]
Yet another try to fix printf format conflict.

I find it very annoying that there is no FreeBSD infrastructure to
determine failures across architectures other than to check in
changes and then have Jenkins find them.

Suggested by: Jessica Clarke
MFC after:    1 week

14 months agofreebsd-update: Mention 13.2-RELEASE in usage.
Poul-Henning Kamp [Sun, 30 Apr 2023 05:06:56 +0000 (05:06 +0000)]
freebsd-update:  Mention 13.2-RELEASE in usage.

14 months agoFix printf format conflict
Kirk McKusick [Sun, 30 Apr 2023 00:55:15 +0000 (17:55 -0700)]
Fix printf format conflict

MFC after:   1 week

14 months agoAdditional validity checking in newfs(8).
Kirk McKusick [Sat, 29 Apr 2023 19:49:50 +0000 (12:49 -0700)]
Additional validity checking in newfs(8).

A check in the superblock validity code verifies that the computed
size of the filesystem cylinder groups (CGSIZE macro) does not
exceed the filesystem block size (fs_bsize).

A report was received that a filesystem had been flagged as failing
this check. We were unable to determine how the reported filesystem
could have been created. This commit adds a check at the end of the
newfs(8) command to verify that the the cylinder group size is valid.
If an oversize cylinder group is found newfs(8) prints a diagnostic
output and rebuilds the filesystem to make it compiliant.

MFC after:   1 week

14 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Sat, 29 Apr 2023 18:52:27 +0000 (11:52 -0700)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

Check for an uninitialed (zero valued) fs_maxbsize and set it
to its minimum valid size (fs_bsize). Uninitialed fs_maxbsize
were left by older versions of makefs(8) and the superblock
integrity checks fail when they are found.

No legitimate superblocks should fail as a result of these changes.

MFC after:    1 week
Sponsored by: The FreeBSD Foundation

14 months agoAdditional output from dumpfs(8).
Kirk McKusick [Sat, 29 Apr 2023 18:41:23 +0000 (11:41 -0700)]
Additional output from dumpfs(8).

Provide an additional line of output for the superblock giving the
computed size of the cylinder group (CGSIZE macro) along with the
details needed to calculate it.

MFC after:   1 week

14 months agowg: change module name to if_wg
Kristof Provost [Thu, 27 Apr 2023 15:35:12 +0000 (17:35 +0200)]
wg: change module name to if_wg

Other virtual interface drivers (e.g. if_gif, if_stf, if_ovpn) all start
with if_. The wireguard file is also named if_wg, but the module name
was 'wg'.

Fix this inconsistency.

Reported by: Christian McDonald <cmcdonald@netgate.com>
Reviewed by: zlei, kevans
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39853

14 months agoReported by: vvd
Vladimir Druzenko [Sat, 29 Apr 2023 12:38:54 +0000 (15:38 +0300)]
Reported by: vvd
Approved by: tcberner (mentor)
Differential Revision: https://reviews.freebsd.org/D39859

Add records about new ports committer (vvd).
Update Mentor and Mentee Information to follow step 5 of the Committers
Guide.

14 months agosetfacl.1: correct reference to a trailing comma, should read "colon"
Ceri Davies [Sat, 29 Apr 2023 11:22:52 +0000 (12:22 +0100)]
setfacl.1: correct reference to a trailing comma, should read "colon"
PR: 271063
Reported by: rdd@rdd.nu

14 months agocross-build: Add common compatibility headers after OS-specific ones
Alex Richardson [Fri, 21 Apr 2023 22:06:51 +0000 (15:06 -0700)]
cross-build: Add common compatibility headers after OS-specific ones

The current order is rather counter-intuitive and it appears to work fine
if we swap the order.

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

14 months agomrsas(4) switch from PTRIN define to include sys/abi_compat.h
Doug Ambrisko [Fri, 28 Apr 2023 20:51:20 +0000 (13:51 -0700)]
mrsas(4) switch from PTRIN define to include sys/abi_compat.h

Suggested by: dchagin

14 months agomrsas(4) fix build on targets that don't define PTRIN.
Doug Ambrisko [Fri, 28 Apr 2023 20:12:32 +0000 (13:12 -0700)]
mrsas(4) fix build on targets that don't define PTRIN.

14 months agoarmv7: Fix BeagleBone Black panic on system start
Konrad Sewiłło-Jopek [Fri, 28 Apr 2023 20:03:38 +0000 (22:03 +0200)]
armv7: Fix BeagleBone Black panic on system start

There is now assertion which requires all memory allocations of positive size.
Negative and zero-sized allocations lead to panic, so plug them off.

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

14 months agovfs: Rename vfs_emptydir() to vn_dir_check_empty()
Olivier Certner [Fri, 28 Apr 2023 09:00:11 +0000 (11:00 +0200)]
vfs: Rename vfs_emptydir() to vn_dir_check_empty()

No functional change.  While here, adapt comments to style(9).

Reviewed by:    kib
MFC after:      1 week

14 months agovfs: vn_dir_next_dirent(): Adapt comments to style(9)
Olivier Certner [Fri, 28 Apr 2023 09:04:16 +0000 (11:04 +0200)]
vfs: vn_dir_next_dirent(): Adapt comments to style(9)

No functional change.

Reviewed by:    kib
MFC after: 1 week

14 months agosrc.conf.5: regen after 4f6a5e1d6ce3, NETLINK_SUPPORT default change
Ed Maste [Fri, 28 Apr 2023 18:15:07 +0000 (14:15 -0400)]
src.conf.5: regen after 4f6a5e1d6ce3, NETLINK_SUPPORT default change

Sponsored by: The FreeBSD Foundation

14 months agojedec_dimm(4): Refactor offset adjustment and page0 reset
Ravi Pokala [Thu, 27 Apr 2023 05:03:48 +0000 (22:03 -0700)]
jedec_dimm(4): Refactor offset adjustment and page0 reset

Offsets greater than 255 bytes reside on page1 of the SPD device.
Accessing them requires switching to page1, and adjusting the absolute
offset to be relative to the start of page1. After the access, the page
must be set back to page0. These operations are performed in several
places, so break them out into their own functions.

Also, replace a pair of default cases, which should be impossible due to
earlier checks, with __assert_unreachable().

Reviewed by: imp
MFC after: 1 week
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D39842

14 months agojedec_dimm(4): Add manufacturing year and week.
Ravi Pokala [Tue, 25 Apr 2023 06:07:39 +0000 (23:07 -0700)]
jedec_dimm(4): Add manufacturing year and week.

DDR3 and DDR4 encode the week and year that the DIMM was manufactured,
as a pair of two-digit binary-coded decimal values. Read the values, and
report them as (uint8_t)s.

Reviewed by: imp, jhb
MFC after: 1 week
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D39795

14 months agoAdd the mfi(4) ioctl support to mrsas(4)
Doug Ambrisko [Wed, 24 Aug 2022 22:27:03 +0000 (15:27 -0700)]
Add the mfi(4) ioctl support to mrsas(4)

The hardware supported by mfi(4) and mrsas(4) use the same dcmd's.
mfiutil(8) in theory could run on controlled attached to mrsas(4).
It can't since mrsas(4) doesn't have support for the FreeBSD mfi(4)
ioctl.  Porting the ioctl from mfi(4) to mrsas(4) would be the first
step in making mrsasutil(8) which is an additional name for mfiutil(8)
but opens /dev/mrsasX instead of /dev/mfiX

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265794
Reviewed by: jhb
Differential revision: https://reviews.freebsd.org/D36342
Tested by: Dan Mahoney <freebsd@gushi.org>

14 months agonetlink: fix debug message on 32-bit archs
Alexander V. Chernikov [Fri, 28 Apr 2023 15:47:11 +0000 (15:47 +0000)]
netlink: fix debug message on 32-bit archs

14 months agonetlink: add forgotten opt_netlink header
Alexander V. Chernikov [Fri, 28 Apr 2023 15:44:01 +0000 (15:44 +0000)]
netlink: add forgotten opt_netlink header

14 months agokinst: do not use DPCPU_ID_GET if we already have the trampoline
Christos Margiolis [Fri, 28 Apr 2023 15:11:10 +0000 (15:11 +0000)]
kinst: do not use DPCPU_ID_GET if we already have the trampoline

No functional change intended.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39870

14 months agobusdma: Update KMSAN shadow maps later in bounce_bus_dmamap_sync()
Mark Johnston [Fri, 28 Apr 2023 14:49:25 +0000 (10:49 -0400)]
busdma: Update KMSAN shadow maps later in bounce_bus_dmamap_sync()

Otherwise POSTREAD syncs may re-invalidate the shadow of the data buffer
when copying from bounce pages, resulting in false-positive KMSAN
reports.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

14 months agoApply clang fix for assertion building emulators/rpcs3
Dimitry Andric [Fri, 28 Apr 2023 14:08:42 +0000 (16:08 +0200)]
Apply clang fix for assertion building emulators/rpcs3

Merge commit a5e1a93ea10f from llvm-project (by Mariya Podchishchaeva):

  [clang] Fix crash when handling nested immediate invocations

  Before this patch it was expected that if there was several immediate
  invocations they all belong to the same expression evaluation context.
  During parsing of non local variable initializer a new evaluation context is
  pushed, so code like this
  ```
  namespace scope {
  struct channel {
      consteval channel(const char* name) noexcept { }
  };
  consteval const char* make_channel_name(const char* name) { return name;}

  channel rsx_log(make_channel_name("rsx_log"));
  }
  ```
  produced a nested immediate invocation whose subexpressions are attached
  to different expression evaluation contexts. The constructor call
  belongs to TU context and `make_channel_name` call to context of
  variable initializer.

  This patch removes this assumption and adds tracking of previously
  failed immediate invocations, so it is possible when handling an
  immediate invocation th check that its subexpressions from possibly another
  evaluation context contains errors and not produce duplicate
  diagnostics.

  Fixes https://github.com/llvm/llvm-project/issues/58207

  Reviewed By: aaron.ballman, shafik

  Differential Revision: https://reviews.llvm.org/D146234

PR: 269489
MFC after: 3 days

14 months agonetlink: properly zero all fields in the ndmsg header.
Alexander V. Chernikov [Fri, 28 Apr 2023 14:04:47 +0000 (14:04 +0000)]
netlink: properly zero all fields in the ndmsg header.

MFC after: 3 days

14 months agoroute: show originator PID in netlink monitor
Alexander V. Chernikov [Fri, 28 Apr 2023 12:44:04 +0000 (12:44 +0000)]
route: show originator PID in netlink monitor

Replacing rtsock with netlink also means providing similar tracing facilities,
rtsock provides `route -n monitor` interface, where each message can be traced
to the originating PID.
This diff closes the feature gap between rtsock and netlink in that regard.

Netlink works slightly differently from rtsock, as it is a generic message
"broker". It calls some kernel KPIs and returns the result to the caller.
Other Netlink consumers gets notified on the changed kernel state using the
relevant subsystem callbacks. Typically, it is close to impossible to pass
some data through these KPIs to enhance the notification.

This diff approaches the problem by using osd(9) to assign the relevant
socket pointer (`'nlp`) to the per-socket taskqueue execution thread.
This change allows to recover the pointer in the aforementioned notification
callbacks and extract some additional data.
Using `osd(9)` (and adding additional metadata) to the notification receiver
comes with some additional cost attached, so this interface needs to be
enabled explicitly by using a newly-created `NETLINK_MSG_INFO` `SOL_NETLINK`
socket option.

The actual medatadata (which includes the originator PID) is provided via
control messages. To enable extensibility, the control message data is
encoded in the standard netlink(TLV-based) fashion. The list of the
currently-provided properties can be found in `nlmsginfo_attrs`.
snl(3) is extended to enable decoding of netlink messages with metadata
(`snl_read_message_dbg()` stores the parsed structure in the provided buffer).

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

14 months agonetlink: fix netlink interface operations when netlink is loaded as a module.
Alexander V. Chernikov [Fri, 28 Apr 2023 13:30:36 +0000 (13:30 +0000)]
netlink: fix netlink interface operations when netlink is loaded as a module.

This change completes 089104e0e01f.

MFC after: 2 weeks

14 months agonetlink: enable NETLINK_SUPPORT by default on all architectures.
Alexander V. Chernikov [Thu, 27 Apr 2023 14:38:08 +0000 (14:38 +0000)]
netlink: enable NETLINK_SUPPORT by default on all architectures.

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

14 months agolibifconfig: fix incorrect carp output
Kristof Provost [Fri, 28 Apr 2023 11:24:44 +0000 (13:24 +0200)]
libifconfig: fix incorrect carp output

If one interface has a carp address configured on it ifconfig would show
this information on all interfaces.

That's because the kernel does (as one would expect) not return any carp
data for interface without carp configuration. However, this wound up
not overwriting the data passed in by the caller, and leaving the (now
stale) information in pace. As a result the caller thought carp was
configured on the interface.

Zero out the input structure before making the call to the kernel, so
that we correctly return 0 if there is no carp configuration on the
queried interface.

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

14 months agoSplit out pmap_map_delete on arm64
Andrew Turner [Fri, 28 Apr 2023 10:54:19 +0000 (11:54 +0100)]
Split out pmap_map_delete on arm64

This will be used when supporting some extensions, e.g. Branch Target
Identification (BTI).

Sponsored by: Arm Ltd

14 months agomrsas: Fix a typo in a source code comment
Zhenlei Huang [Fri, 28 Apr 2023 10:01:58 +0000 (18:01 +0800)]
mrsas: Fix a typo in a source code comment

- s/feild/field/

MFC after: 3 days

14 months agomps: Fix a typo in a source code comment
Zhenlei Huang [Fri, 28 Apr 2023 10:01:58 +0000 (18:01 +0800)]
mps: Fix a typo in a source code comment

- s/feild/field/

MFC after: 3 days

14 months agoixgbe: Fix typos in source code comments
Ian Moffett [Fri, 28 Apr 2023 10:01:58 +0000 (18:01 +0800)]
ixgbe: Fix typos in source code comments

- s/feilds/fields/

Reviewed by: zlei
MFC after: 3 days
Pull Request: https://github.com/freebsd/freebsd-src/pull/707

14 months agolinux(4): Uniformly dev_t arguments translation
Dmitry Chagin [Fri, 28 Apr 2023 08:55:05 +0000 (11:55 +0300)]
linux(4): Uniformly dev_t arguments translation

The two main uses of dev_t are in struct stat and as a parameter of the
mknod system calls.
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit quantity
with 12 bits set asaid for the major number and 20 for the minor number.
The in-kernel dev_t encoded as MMMmmmmm, where M is a hex digit of the
major number and m is a hex digit of the minor number.
The user-space dev_t encoded as mmmM MMmm, where M and m is the major
and minor numbers accordingly. This is downward compatible with legacy
systems where dev_t is 16 bits wide, encoded as MMmm.
In glibc dev_t is a 64-bit quantity, with 32-bit major and minor numbers,
encoded as MMMM Mmmm mmmM MMmm. This is downward compatible with the Linux
kernel and with legacy systems where dev_t is 16 bits wide.
In the FreeBSD dev_t is a 64-bit quantity. The major and minor numbers
are encoded as MMMmmmMm, therefore conversion of the device numbers between
Linux user-space and FreeBSD kernel required.

14 months agolinux(4): Add a dedicated fstat() implementation
Dmitry Chagin [Fri, 28 Apr 2023 08:55:04 +0000 (11:55 +0300)]
linux(4): Add a dedicated fstat() implementation

In between kern_fstat() and translate_fd_major_minor(), another process
having the same filedesc could modify or close fd.

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

14 months agolinux(4): Add a dedicated statat() implementation
Dmitry Chagin [Fri, 28 Apr 2023 08:55:04 +0000 (11:55 +0300)]
linux(4): Add a dedicated statat() implementation

Get rid of calling Linux stat translation hook and specific to Linux
handling of non-vnode dirfd from kern_statat(),

Reviewed by: kib, mjg
Differential revision: https://reviews.freebsd.org/D35474

14 months agolinux(4): Make struct stat64 to match Linux actual one
Dmitry Chagin [Fri, 28 Apr 2023 08:55:04 +0000 (11:55 +0300)]
linux(4): Make struct stat64 to match Linux actual one

14 months agolinux(4): Regen for mknod syscall changes
Dmitry Chagin [Fri, 28 Apr 2023 08:55:04 +0000 (11:55 +0300)]
linux(4): Regen for mknod syscall changes

14 months agolinux(4): Use Linux dev_t type for mknod syscalls dev argument
Dmitry Chagin [Fri, 28 Apr 2023 08:55:02 +0000 (11:55 +0300)]
linux(4): Use Linux dev_t type for mknod syscalls dev argument

As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer
on all platforms. Prior the 2.6 kernel dev_t type was an unsigned short.
However, since the firs commit of the Linuxulator, mknod syscall get int dev
argument.
Also, there is some confusion here, while the kernel declares a dev_t type
as a 32-bit sized, the user-space dev_t type can be size of 64 bits, e.g.,
in the Glibc library.
To avoid confusion and to help porting of the Linuxulator to other platforms
use explicit l_dev_t for dev argument of mknod syscalls.

14 months agolinux(4): Move dev_t type declaration under /compat/linux
Dmitry Chagin [Fri, 28 Apr 2023 08:55:02 +0000 (11:55 +0300)]
linux(4): Move dev_t type declaration under /compat/linux

As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer
on all platforms. Move it into the MI linux.h under /compat/linux.

14 months agolinux(4): Make struct newstat to match actual Linux one
Dmitry Chagin [Fri, 28 Apr 2023 08:55:01 +0000 (11:55 +0300)]
linux(4): Make struct newstat to match actual Linux one

In the struct stat the st_dev, st_rdev are unsigned long.

14 months agolinux(4): Regen for struct l_old_stat changes
Dmitry Chagin [Fri, 28 Apr 2023 08:55:01 +0000 (11:55 +0300)]
linux(4): Regen for struct l_old_stat changes

14 months agolinux(4): Update syscalls.master to reflect struct l_old_stat
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Update syscalls.master to reflect struct l_old_stat

14 months agolinux(4): Mark old fstat syscal as unimplemented
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Mark old fstat syscal as unimplemented

It looks like the old fstat system call never been implemented.

14 months agolinux(4): Rename obsolete old struct l_stat to struct l_old_stat
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Rename obsolete old struct l_stat to struct l_old_stat

14 months agolinux(4): Move statx_copyout() close to linux_statx()
Dmitry Chagin [Fri, 28 Apr 2023 08:54:59 +0000 (11:54 +0300)]
linux(4): Move statx_copyout() close to linux_statx()

Just for future changes of the conditional Linuxulator build. We need
a small refactoring of the MI code to help porting Linuxulator to other
platforms.

14 months agolinux(4): Move translate_vnhook_major_minor() into the Linux common module
Dmitry Chagin [Fri, 28 Apr 2023 08:54:58 +0000 (11:54 +0300)]
linux(4): Move translate_vnhook_major_minor() into the Linux common module

14 months agolinux(4): Sort includes in the linux_stats.c
Dmitry Chagin [Fri, 28 Apr 2023 08:54:58 +0000 (11:54 +0300)]
linux(4): Sort includes in the linux_stats.c

14 months agobhyve: enable capsicum for snapshot code
Vitaliy Gusev [Fri, 28 Apr 2023 07:02:51 +0000 (09:02 +0200)]
bhyve: enable capsicum for snapshot code

Reviewed by: corvink
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38860

14 months agobhyve: use directory file descriptor for checkpoint
Vitaliy Gusev [Fri, 28 Apr 2023 07:00:48 +0000 (09:00 +0200)]
bhyve: use directory file descriptor for checkpoint

This is required to enable capsicum for the snapshot code.

Reviewed by: corvink
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38858

14 months agoefiwake(8): style
Konstantin Belousov [Fri, 28 Apr 2023 02:58:01 +0000 (05:58 +0300)]
efiwake(8): style

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

14 months agoAdd efiwake tool
Johannes Totz [Wed, 26 Apr 2023 16:16:55 +0000 (17:16 +0100)]
Add efiwake tool

Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D36714

14 months agoExpose EFI wake time API
Johannes Totz [Wed, 26 Apr 2023 16:15:31 +0000 (17:15 +0100)]
Expose EFI wake time API

Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D36714

14 months agovfs: Fix "emptydir" mount option
Olivier Certner [Sat, 22 Apr 2023 16:07:07 +0000 (18:07 +0200)]
vfs: Fix "emptydir" mount option

Fix vfs_emptydir(). It would consider directories containing directories
with name of the form 'X.' (X being any authorized byte) as empty. Also,
it would cause VOP_READDIR() to return an error on directories
containing enough whiteouts. While here, use a more decently sized
buffer as done elsewhere.

Remove ad-hoc iteration on the directory's content and instead use the
newly exported vn_dir_next_dirent() function (this is what fixes the
second problem mentioned above).

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

14 months agovfs: vn_dir_next_dirent(): Simplify interface and harden
Olivier Certner [Mon, 24 Apr 2023 08:25:15 +0000 (10:25 +0200)]
vfs: vn_dir_next_dirent(): Simplify interface and harden

Simplify the old interface (one less argument, simpler termination test)
and add documentation about it. Add more sanity checks (mostly under
INVARIANTS, but also in the general case to prevent infinite
loops). Drop the explicit test on minimum directory entry size (without
INVARIANTS).

Deal with the impacts in callers (dirent_exists() and vop_stdvptocnp()).
dirent_exists() has been simplified a bit, preserving the exact same
semantics but for the return code whose meaning has been reversed (0 now
means the entry exists, ENOENT that it doesn't and other values are
genuine errors). While here, suppress gratuitous casts of malloc return
values.

vn_dir_next_dirent() has been tested by a 'make -j4 buildkernel' with a
temporary modification to the VFS cache causing vn_vptocnp() to always
call VOP_VPTOCNP() and finally vop_stdvptocnp() (observed with temporary
debug counters).

Export new _GENERIC_MINDIRSIZ and _GENERIC_MAXDIRSIZ on __BSD_VISIBLE,
and GENERIC_MINDIRSIZ and GENERIC_MAXDIRSIZ on _KERNEL.

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

14 months agovfs: Export get_next_dirent() as vn_dir_next_dirent()
Olivier Certner [Sun, 23 Apr 2023 07:47:58 +0000 (09:47 +0200)]
vfs: Export get_next_dirent() as vn_dir_next_dirent()

Move internal-to-'vfs_default.c' get_next_dirent() to 'vfs_vnops.c' and
export it for use by other parts of the VFS. This is a preparatory
change for using it in vfs_emptydir().

No functional change.

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

14 months agoCONTRIBUTING: add intro describing the ways we accept contributions
Ed Maste [Thu, 27 Apr 2023 16:13:04 +0000 (12:13 -0400)]
CONTRIBUTING: add intro describing the ways we accept contributions

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

14 months agoAdditions to targets/pseudo/host-tools
Simon J. Gerraty [Thu, 27 Apr 2023 21:16:49 +0000 (14:16 -0700)]
Additions to targets/pseudo/host-tools

More tools needed to be built for Linux.
These are the ones that "just work".

14 months agojobs.mk report JOB_ARGS log and JOB_LOG_START
Simon J. Gerraty [Thu, 27 Apr 2023 20:40:44 +0000 (13:40 -0700)]
jobs.mk report JOB_ARGS log and JOB_LOG_START

At the start of a job include info such as JOB_ARGS the log location
and anything in JOB_LOG_START (eg TARGET_SPEC=${TARGET_SPEC})

14 months agotzsetup: appease checkstyle9
Yuri Pankov [Thu, 27 Apr 2023 18:26:16 +0000 (20:26 +0200)]
tzsetup: appease checkstyle9

14 months agotzsetup: adopt zone1970.tab changes
Yuri Pankov [Thu, 27 Apr 2023 17:31:48 +0000 (19:31 +0200)]
tzsetup: adopt zone1970.tab changes

- assumption that single-zone countries do not have description
  is no longer correct; do not try to optimize this case as it's
  only going to make the code more confusing and we now have menus
  with a single zone selection because of this
- remove the single-country continent short cut, it also only serves
  to confuse users as we now have such a continent
- instead add a single-zone contry short cut (see above), now all
  single-zone countries fall here
- use the #@ continent overrides that zone1970.tab introduces (this is
  visible at least fixing Iceland being currently listed under Africa)
- add Arctic Ocean "continent" coming only from the overrides at the
  moment
- update baseline with the changes

Reviewed by: bapt, philip
Differential Revision: https://reviews.freebsd.org/D39606

14 months agosockbuf: Add KMSAN checks to sbappend*()
Mark Johnston [Thu, 27 Apr 2023 16:58:56 +0000 (12:58 -0400)]
sockbuf: Add KMSAN checks to sbappend*()

Otherwise KMSAN only detects uninitialized memory when the contents of
the buffer are copied out to userspace or transmitted to a network
interface.  At that point the KMSAN violation will be far removed from
its origin, so let's try to make debugging such problems a bit easier.

Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38101

14 months agologger(1): fix timestamps in case of long run
Eugene Grosbein [Thu, 27 Apr 2023 16:43:16 +0000 (23:43 +0700)]
logger(1): fix timestamps in case of long run

An example:

( echo test; sleep 2; echo test2 ) | logger -h /var/run/log

Before fix, logger assigned same timestamp to both records.

Fixes: 65547fb33db901a9f352aacb0ed45ce68b0bd275
Reported by: Vadim Goncharov
MFC after: 1 week

14 months agocap_net tests: Skip tests if there is no connectivity
Mark Johnston [Thu, 27 Apr 2023 13:42:36 +0000 (09:42 -0400)]
cap_net tests: Skip tests if there is no connectivity

When testing cap_connect() and name/addr lookup functions, skip tests if
we fail and the error is not ENOTCAPABLE.  This makes the tests amenable
to running in CI without Internet connectivity.

Reviewed by: oshogbo
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39242

14 months agobhyve: Add DEBUG_HDA_FILE define to specify location of debug output
Guido Falsi [Thu, 27 Apr 2023 07:49:01 +0000 (09:49 +0200)]
bhyve: Add DEBUG_HDA_FILE define to specify location of debug output

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

14 months agobhyve: Disable bhyve HDA debug by default.
Guido Falsi [Mon, 3 Apr 2023 10:45:11 +0000 (12:45 +0200)]
bhyve: Disable bhyve HDA debug by default.

Adapt hda_print_cmd_ctl_data() to not generate compiler warnings
when DEBUG_HDA is off.

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

14 months agoopenzfs: re-enable FPU usage on aarch64
Kyle Evans [Thu, 27 Apr 2023 00:47:14 +0000 (19:47 -0500)]
openzfs: re-enable FPU usage on aarch64

The BLAKE3 generated assembly files have now been updated to avoid
clobbering x18, we can safely re-enable FPU usage on aarch64.

14 months agoFix BLAKE3 aarch64 assembly for FreeBSD and macOS
Tino Reichardt [Wed, 26 Apr 2023 19:40:26 +0000 (21:40 +0200)]
Fix BLAKE3 aarch64 assembly for FreeBSD and macOS

The x18 register isn't useable within FreeBSD kernel space, so we
have to fix the BLAKE3 aarch64 assembly for not using it.

The source files are here: https://github.com/mcmilk/BLAKE3-tests

Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes #14728

14 months agosiftr: remove barely used hash generation per record
Cheng Cui [Wed, 26 Apr 2023 11:18:01 +0000 (07:18 -0400)]
siftr: remove barely used hash generation per record

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

14 months agonetmap: pkt-gen: sync with upstream
Vincenzo Maffione [Wed, 26 Apr 2023 20:32:24 +0000 (20:32 +0000)]
netmap: pkt-gen: sync with upstream

Keep in sync with the recent upstream changes:

Fix compilation on 32-bit architectures
Update IP length, UDP length/checksum when size changes
Man page fixes

Submitted by: jlduran@gmail.com
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D39760

14 months agoarp/ndp: Use valid prototypes for function declarations with no arguments.
John Baldwin [Wed, 26 Apr 2023 20:18:53 +0000 (13:18 -0700)]
arp/ndp: Use valid prototypes for function declarations with no arguments.

14 months agoarm: remove passing trapframe to intr_ipi_dispatch()
Elliott Mitchell [Wed, 14 Dec 2022 21:59:17 +0000 (13:59 -0800)]
arm: remove passing trapframe to intr_ipi_dispatch()

This was needed before INTRNG was in place and handling the push of
curthread->td_intr_frame.  Since INTRNG now handles this, there is no
longer and need for playing around with the frame inside IPI interrupts.

14 months agoarm: remove interrupt nesting by ipi_preempt()/ipi_hardclock()
Elliott Mitchell [Wed, 14 Dec 2022 20:36:47 +0000 (12:36 -0800)]
arm: remove interrupt nesting by ipi_preempt()/ipi_hardclock()

This was needed when intr_ipi_dispatch() was called by hardware-specific
IPI interrupt routines which didn't save the trap frame.  Now all ARM
interrupts pass through INTRNG which will have already saved the trap
frame and disabled preemption.

Remove the conditional trapframe/argument passing to the handlers.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D37938

14 months agozfs: Fix positive ABD size assertion in abd_verify().
Mateusz Guzik [Wed, 26 Apr 2023 17:59:24 +0000 (17:59 +0000)]
zfs: Fix positive ABD size assertion in abd_verify().

This cherry-picks upstream:
commit bba7cbf0a481ab16f9a9a4874b7dbd5682e4d3a4
Author: Alexander Motin <mav@FreeBSD.org>
Date:   Wed Apr 26 12:20:43 2023 -0400

    Fix positive ABD size assertion in abd_verify().

    Gang ABDs without childred are legal, and they do have zero size.
    For other ABD types zero size doesn't have much sense and likely
    not working correctly now.

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

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

14 months agoipv6: disable RFC 4620 nodeinfo by default
Ed Maste [Mon, 24 Apr 2023 19:41:45 +0000 (15:41 -0400)]
ipv6: disable RFC 4620 nodeinfo by default

RFC 4620 is an experimental RFC that can be used to request information
about a host, including:

- the fully-qualified or single-component name
- some set of the Responder's IPv6 unicast addresses
- some set of the Responder's IPv4 unicast addresses

This is not something that should be made available by default.

PR: 257709
Submitted by: ruben@verweg.com
Reviewed by: melifaro
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39778

14 months agoopenzfs: arm64: implement kfpu_begin/kfpu_end
Kyle Evans [Wed, 26 Apr 2023 17:23:48 +0000 (12:23 -0500)]
openzfs: arm64: implement kfpu_begin/kfpu_end

This is part one of a fix for booting with ZFS on arm64 using
accelerated checksum implementations.  Checksum benchmarking will
attempt to use the FPU, so we currently panic quickly on boot.  BLAKE3
is still broken, as it clobbers x18 and we promptly discover that fact
as soon as we attempt to fetch curthread in kfpu_end().

Note that _STANDALONE is special-cased here, but ideally we wouldn't be
building the code that uses kfpu_begin()/kfpu_end() at all in the loader
environment.

Discussed with: imp (a bit)
Differential Revision: https://reviews.freebsd.org/D39448

14 months agocallout: Remove an unneeded MTX_NEW
Mark Johnston [Wed, 26 Apr 2023 15:15:56 +0000 (11:15 -0400)]
callout: Remove an unneeded MTX_NEW

Reported by: hselasky
Fixes: 78cfa762ebf2 ("callout: Move per-CPU callout state into the dpcpu region")

14 months agopf: clear PF_TAG_ROUTE_TO for dummynet fast path
Kristof Provost [Wed, 26 Apr 2023 13:12:30 +0000 (15:12 +0200)]
pf: clear PF_TAG_ROUTE_TO for dummynet fast path

Similar to the PF_TAG_DUMMYNET we must also clear the route tag if
dummynet didn't keep the packet. In that case we'd continue immediately
and there'd be no need for the route tag. Keeping it could lead to
unexpected routing of traffic.

See also: 27407a6adc793bdfaef8a86ece32fb1b461429f0
See also: https://redmine.pfsense.org/issues/14055
Sponsored by: Rubicon Communications, LLC ("Netgate")