]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
15 months agousb: add new scsi_huawei eject3 & eject4 quirks
Michael Paepcke [Thu, 16 Feb 2023 16:58:30 +0000 (09:58 -0700)]
usb: add new scsi_huawei eject3 & eject4 quirks

Add new scsi_huawei eject3 & eject4 mode driver to usb quirks

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/633
Approved by: re (cperciva)

(cherry picked from commit 64fd867f8cdbad24d7af678ee17bd3893832b905)
(cherry picked from commit 1d31c745cfe60d7a81fd91efdcfecd0405888af2)

15 months agousb: Add Huawei 4G Modem devices (2022) to usbdevs
Michael Paepcke [Thu, 16 Feb 2023 16:58:29 +0000 (09:58 -0700)]
usb: Add Huawei 4G Modem devices (2022) to usbdevs

ADD [sys/dev/usb/usbdevs]
- add new Huawei 4G E3372_NCM  0x1505
- add new Huawei 4G E3372v153_NCM 0x155f
- add new Huawei 4G E5573Cs322_NCM 0x155e
- add new Huawei 4G E5573Cs322_ECM 0x14db
- add new Huawei 4G E5573Cs322_ACM 0x1442

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/633
Approved by: re (cperciva)

(cherry picked from commit 2c6b88da7174b02c98b87cd4b7251ccf9d7acbae)
(cherry picked from commit 7324f2b89f2cacecb0ce73e06297205891e7929a)

15 months ago13.2: update to BETA2
Colin Percival [Fri, 17 Feb 2023 00:07:46 +0000 (16:07 -0800)]
13.2: update to BETA2

Approved by: re (implicit)
Sponsored by: https://www.patreon.com/cperciva

15 months ago13.2: Enable REPRODUCIBLE_BUILD by default
Colin Percival [Fri, 17 Feb 2023 00:10:54 +0000 (16:10 -0800)]
13.2: Enable REPRODUCIBLE_BUILD by default

Move it from "default no" options to "default yes" options.

Approved by: re (gjb)
Sponsored by: https://www.patreon.com/cperciva

15 months agoChange "ctlstat -P"'s schema
Alan Somers [Wed, 25 Jan 2023 18:00:49 +0000 (11:00 -0700)]
Change "ctlstat -P"'s schema

It now reports stats separately for both ports and luns.

Also, prohibit using both "-p" and "-P" at the same time.

Sponsored by: Axcient
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D38500
Approved by: re (cperciva)

(cherry picked from commit 4c163a5480809d0dc8b68dd00bf2ba7d882450f9)

15 months agotop: fix sorting by pid (-o pid)
Kyle Evans [Mon, 13 Feb 2023 06:39:04 +0000 (00:39 -0600)]
top: fix sorting by pid (-o pid)

The 'pid' order was added, but the equivalent comparator was not back in
8b800d3af2d8c ("Add the PID column to the list of sort keys.").
`ordernames` indices need to match `compares` indices in order for this
to work.

A future commit will restructure all of this to make it less error prone
going forward (see D37083).

Reviewed by: pstef (D37083)
Approved by: re (cperciva)

(cherry picked from commit deb63adf945d446ed91a9d84124c71f15ae571d1)
(cherry picked from commit cfd3bd04c245889d339c4f7cb1e45c955537e3eb)

15 months agomd5: fix *sum -c with missing files
Kyle Evans [Mon, 13 Feb 2023 06:32:38 +0000 (00:32 -0600)]
md5: fix *sum -c with missing files

If we fail to open one of the files in the file listing, we still need
to advance `rec` along with `argv` so that the checksum we're checking
against lines up with the file we're hashing.

Tests added both for the -c flag, as well as the -b and -t modes of
the *sum programs.

PR: 267722
Reviewed by: emaste (earlier version)
Approved by: re (cperciva)

(cherry picked from commit 8d78a0d331ec2c168efe6cb85bbc2da86e9a6124)
(cherry picked from commit 9eb694146a19bd0ee7439f6cab030a8d5c273977)

15 months agonetlink: add headers installation
Alexander V. Chernikov [Sat, 1 Oct 2022 16:31:58 +0000 (16:31 +0000)]
netlink: add headers installation

Approved by: re(cperciva)

(cherry picked from commit 11ca01e9aa479559da240ceba17fdcdf2d1e97c3)
(cherry picked from commit acaed6b1e2859cb6726e35e8c937b192c16a95c8)

15 months agonetlink: do not require elevated privileges when reading arp/ndp state.
Alexander V. Chernikov [Thu, 9 Feb 2023 14:12:33 +0000 (14:12 +0000)]
netlink: do not require elevated privileges when reading arp/ndp state.

MFC after: 1 day
Approved by: re(cperciva)

(cherry picked from commit 5a5436eb5d960b9e243f8196147c6a51ca4f9dee)
(cherry picked from commit aff2a514adb691938a5302975dc337ee01c6c721)

15 months agonetlink: allow to override sb_max for netlink sockets.
Alexander V. Chernikov [Fri, 10 Feb 2023 16:07:17 +0000 (16:07 +0000)]
netlink: allow to override sb_max for netlink sockets.

Netlink sockets sometimes require larger buffers than other sockets.
For example, full-view IPv4 dump sent via netlink may consume 50+ megabytes.
The desired buffer may be bigger than the system maximum `sb_max`.
FreeBSD HEAD has a mechanism for overriding protocol `setsockopt()` handler,
 which netlink  uses to permit buffer reservations beyond `sb_max`.
 This behaviour is handy as it doesn't require system administrator to lift
 the limits for other sockets.
Stable/13 lack such muchanism, so a different approach has to be used.
This diff is a direct commit to stable/13 and it simply copies the logic from
 Netlink in -HEAD for checking if the larger buffer size should be permitted.

Differential Revision: https://reviews.freebsd.org/D38472
Approved by: re(cperciva)

(cherry picked from commit c3d3f3594fdf653392936594b75ec330af12d7fa)

15 months agolocal-unbound-setup: Use default root certificates
Tijl Coosemans [Thu, 19 Jan 2023 17:13:35 +0000 (18:13 +0100)]
local-unbound-setup: Use default root certificates

Don't force /etc/ssl/cert.pem.  It does not exist by default, only if
security/ca_root_nss is installed.  Just use the default OpenSSL search
locations which are /etc/ssl/cert.pem and /etc/ssl/certs/.

The tls-system-cert option was added in Unbound 1.16.0.

Reviewed by: zlei
Approved by: re (cperciva)
Differential Revision: https://reviews.freebsd.org/D38243

(cherry picked from commit 8932f7ce1783a10e9ba79c61d54077aa7693552e)
(cherry picked from commit 412d15f7268e0662909822b1aef71536a2b285e5)

15 months agoahci: increase timout
Mariusz Zaborski [Fri, 10 Feb 2023 15:56:04 +0000 (16:56 +0100)]
ahci: increase timout

For some devices, like Marvell 88SE9230, it takes more time
to connect to the device. This patch introduces a special flag
that extends the timeout from around 100ms to around 500ms.

This change is based on the work of: Peter Eriksson <pen@lysator.liu.se>

Approved by: re (cperciva)
PR: 243401
Reviewed by: imp
Tested by: dch
MFC after: 3 days
Sponsored by: Equinix
Sponsored by: SkunkWerks, GmbH
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38413

(cherry picked from commit f08ac4cb14c1c0740346a4363f82e1e1367c2bad)
(cherry picked from commit 65bab39e140f97cace92a2923e50c6b654b02e22)

15 months agossh: update to OpenSSH 9.2p1
Ed Maste [Mon, 6 Feb 2023 21:54:56 +0000 (16:54 -0500)]
ssh: update to OpenSSH 9.2p1

Release notes are available at https://www.openssh.com/txt/release-9.2

OpenSSH 9.2 contains fixes for two security problems and a memory safety
problem.  The memory safety problem is not believed to be exploitable.
These fixes have already been committed to OpenSSH 9.1 in FreeBSD.

Some other notable items from the release notes:

 * ssh(1): add a new EnableEscapeCommandline ssh_config(5) option that
   controls whether the client-side ~C escape sequence that provides a
   command-line is available. Among other things, the ~C command-line
   could be used to add additional port-forwards at runtime.

 * sshd(8): add support for channel inactivity timeouts via a new
   sshd_config(5) ChannelTimeout directive. This allows channels that
   have not seen traffic in a configurable interval to be
   automatically closed. Different timeouts may be applied to session,
   X11, agent and TCP forwarding channels.

 * sshd(8): add a sshd_config UnusedConnectionTimeout option to
   terminate client connections that have no open channels for a
   length of time. This complements the ChannelTimeout option above.

 * sshd(8): add a -V (version) option to sshd like the ssh client has.

 * scp(1), sftp(1): add a -X option to both scp(1) and sftp(1) to
   allow control over some SFTP protocol parameters: the copy buffer
   length and the number of in-flight requests, both of which are used
   during upload/download. Previously these could be controlled in
   sftp(1) only. This makes them available in both SFTP protocol
   clients using the same option character sequence.

 * ssh-keyscan(1): allow scanning of complete CIDR address ranges,
   e.g.  "ssh-keyscan 192.168.0.0/24". If a CIDR range is passed, then
   it will be expanded to all possible addresses in the range
   including the all-0s and all-1s addresses. bz#976

 * ssh(1): support dynamic remote port forwarding in escape
   command-line's -R processing. bz#3499

Approved by: re (cperciva)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f374ba41f55c1a127303d92d830dd58eef2f5243)
(cherry picked from commit 2f43f145825d0d8468f583b1686262b0f40c1fe5)

15 months agossh: fix SIZEOF_TIME_T #define on i386
Ed Maste [Wed, 8 Feb 2023 18:31:44 +0000 (13:31 -0500)]
ssh: fix SIZEOF_TIME_T #define on i386

Reported by: imp
Reviewed by: imp
Approved by: re (cperciva)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38443

(cherry picked from commit 1aa9a35f6361cc898e2323e1f2823771eb4161da)
(cherry picked from commit 59ab4b95129dd5d64a52e0822b4fb5621bf65e9c)

15 months agotzcode: Resurrect tzsetwall(3) with a deprecation warning.
Dag-Erling Smørgrav [Thu, 9 Feb 2023 18:35:34 +0000 (19:35 +0100)]
tzcode: Resurrect tzsetwall(3) with a deprecation warning.

This function has been around since 4.4BSD but was dropped upstream in 2020.  This went unnoticed when tzcode was updated.  Bring it back, but prepare for removing it before 14.0 is released.

PR: 269445
MFC after: 3 days
Reported by: val@packett.cool
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38445
Approved by: re (cperciva)

(cherry picked from commit 71e0c8906e1a4ff774f8ae810aeb94af039eedb7)
(cherry picked from commit eab9ed3d48e0842f3114d8582a4c2868a354190b)

15 months ago13.2: create releng/13.2 branch
Colin Percival [Fri, 10 Feb 2023 00:35:56 +0000 (16:35 -0800)]
13.2: create releng/13.2 branch

Update from PRERELEASE to BETA1
Switch pkg(8) configuration to use the quarterly repository
Bump __FreeBSD_version

Approved by: re (implicit)
Sponsored by: https://www.patreon.com/cperciva

15 months agousr.sbin/kbdcontrol.c: Add backwards compatibility functions
Stefan Eßer [Mon, 6 Feb 2023 22:56:44 +0000 (23:56 +0100)]
usr.sbin/kbdcontrol.c: Add backwards compatibility functions

This commit allows a kbdcontrol binary built with a version of kbio.h
that supports Unicode characters in dead key maps to load and display
keymaps including the dead key tables on a kernel built with a
previous version of kbio.h (that only supported 8 bit characters in
the dead key map).

This commit is meant as a temporary compatibility shim that will be
reverted when it can be assumed that all relevant systems have been
upgraded to a kernel that uses the updated kbio.h.

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38388

(cherry picked from commit b92f8e5c0dccd52ea194cabe835b7af0b5e91f09)

15 months agoSupport Unicode characters in keymap dead key tables
Stefan Eßer [Mon, 6 Feb 2023 22:48:47 +0000 (23:48 +0100)]
Support Unicode characters in keymap dead key tables

Support for Unicode characters had been added to the keyboard code,
but there are keymaps that have accented characters accessed via dead
key combinations, and those were still restricted to 8 bit codes.

This update to kbd.c adds support for Unicode characters and
compatibility code that allows a kbdcontrol command built from kbio.h
without these patches to work on a new kernel.

Compatibility code that allows a new kbdcontrol binary running on an
old kernel to load and display the dead key map will be committed in a
separate commit.

Reviewed by: imp, brooks
Approved by: brooks
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38381

(cherry picked from commit 4972fb9276389fb87a790b415b1161cff395884c)

15 months agocontrib/bc: update to version 6.2.4
Stefan Eßer [Mon, 6 Feb 2023 21:33:56 +0000 (22:33 +0100)]
contrib/bc: update to version 6.2.4

This update contains only documentation changes (new main repository
URL and changed mail address of the program author) and changes to
the build system that do not affect the FreeBSD base system build.

MFC after: 3 days

(cherry picked from commit 4fca8e0f65a8bbbd1242c1f7d8e33b77c479f5de)

15 months agoipfilter: Fix use after free on packet with broken lengths
Cy Schubert [Thu, 2 Feb 2023 00:49:08 +0000 (16:49 -0800)]
ipfilter: Fix use after free on packet with broken lengths

Under the scenario with a packet with length of 67 bytes, a header length
using the default of 20 bytes and a TCP data offset (th_off) of 48 will
cause m_pullup() to fail to make sure bytes are arragned contiguously.
m_pullup() will free the mbuf chain and return a null. ipfilter stores
the resultant mbuf address (or the resulting NULL) in its fr_info_t
structure. Unfortuntely the eroneous packet is not flagged for drop.
This results in a kernel page fault at line 410 of sys/netinet/ip_fastfwd.c
as it tries to use a now previously freed, by m_pullup(), mbuf.

PR: 266442
Reported by: Robert Morris <rtm@lcs.mit.edu>

(cherry picked from commit 79f7745c098a766d34a4e072cdd1a06e6d0829d5)

15 months agoipfilter: Correctly type ipf_pullup()
Cy Schubert [Tue, 31 Jan 2023 19:09:00 +0000 (11:09 -0800)]
ipfilter: Correctly type ipf_pullup()

ipf_pullup() outputs a pointer to ip_t. Though returning a pointer to
void does work, it is imprecise and not completely correct.

(cherry picked from commit c941e8c65d9df878136dc5d51d70256d33f7769f)

15 months agosqlite3: Vendor import of sqlite3 3.40.1
Cy Schubert [Fri, 6 Jan 2023 17:10:14 +0000 (09:10 -0800)]
sqlite3: Vendor import of sqlite3 3.40.1

Release notes at https://www.sqlite.org/releaselog/3_40_1.html.

Obtained from:  https://www.sqlite.org/2022/sqlite-autoconf-3400100.tar.gz

Merge commit 'c728c97f5c838c9a873516c4499e4e1a41788ce7' into main

(cherry picked from commit 5ae830e9bacf120c5ab95d515814e2b815e839a6)

15 months agosockbufs: add sbreserve_locked_limit() with custom maxsockbuf limit.
Alexander V. Chernikov [Tue, 27 Sep 2022 13:52:11 +0000 (13:52 +0000)]
sockbufs: add sbreserve_locked_limit() with custom maxsockbuf limit.

Protocols such as netlink may need a large socket receive buffer,
 measured in tens of megabytes. This change allows netlink to
 set larger socket buffers (given the privs are in place), without
 requiring user to manuall bump maxsockbuf.

Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D36747

(cherry picked from commit 7b660faa9e30c15d3be9b2c44c3ca046a33331f4)

15 months agolibmd / md5: Add SHA-512/224.
Dag-Erling Smørgrav [Mon, 6 Feb 2023 16:57:36 +0000 (17:57 +0100)]
libmd / md5: Add SHA-512/224.

While there, remove .Tn from man pages.

Also remove an obsolete comment about the 80386.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans, allanjude
Differential Revision: https://reviews.freebsd.org/D38373

(cherry picked from commit 2768d7056727c414241ebc4b9d26e62dd5460760)

15 months agosha512_224: Fix SHA512_224_Final() on little-endian machines.
Sebastian Huber [Mon, 6 Feb 2023 16:57:28 +0000 (17:57 +0100)]
sha512_224: Fix SHA512_224_Final() on little-endian machines.

PR: 266863
MFC after: 1 week
Reviewed by: allanjude, cperciva, des
Differential Revision: https://reviews.freebsd.org/D38372

(cherry picked from commit 6680cfe8e0eec4427716ab50d73ab8231dd9ab28)

15 months agocp: Add tests involving sparse files.
Dag-Erling Smørgrav [Wed, 1 Feb 2023 20:06:24 +0000 (21:06 +0100)]
cp: Add tests involving sparse files.

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

(cherry picked from commit 822fa7ae1e3e7ed277e47e6de355387e524c6ee4)

cp: Simplify the common case.

* The allocated buffer is only used in the fallback case, so move it
  there.  The argument for passing it in from the caller was that if
  malloc(3) were to fail, we'd want it to fail before we started
  copying anything, but firstly, it was already not in the right place
  to ensure that, and secondly, malloc(3) never fails (except in very
  contrived circumstances, such as an unreasonable RLIMIT_AS or
  RLIMIT_DATA).

* Remove the mmap(2) option.  It is almost never beneficial,
  especially when the alternative is copy_file_range(2), and it adds
  needless complexity and indentation.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: rmacklem, mav
Differential Revision: https://reviews.freebsd.org/D38291

(cherry picked from commit 6c85042afcbbf4cd0fb7e7c03226c7249081e690)

cp: Minor code cleanup.

* Fix includes in utils.c, cf. style(9).
* Fix type mismatch: readlink(2) returns ssize_t, not int.
* It is not necessary to set errno to 0 as fts_read(3) already does it.

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

(cherry picked from commit cb96a0ef0040fa7968245ab203ab70a7ed2d275d)

cp: Adjust the sparse file tests.

* The sparsity check was ineffective: it compared the apparent size in bytes to the actual size in blocks.  Instead, write a tool that reliably detects sparseness.
* Some of the seq commands were missing an argument.
* Based on empirical evidence, 1 MB holes are not necessarily large enough to be preserved by the underlying filesystem.  Increase the hole size to 16 MB.

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

(cherry picked from commit 8b418c83d175fde3b1f65210509ddcf2ac248d9f)

15 months agolibc: Add tests for strchrnul(3).
Dag-Erling Smørgrav [Wed, 1 Feb 2023 20:06:20 +0000 (21:06 +0100)]
libc: Add tests for strchrnul(3).

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

(cherry picked from commit 606d0e4a9a862a7b4e3469a084834ca0e888afa4)

15 months agocmp: Print a summary on SIGINFO.
Dag-Erling Smørgrav [Tue, 31 Jan 2023 00:28:47 +0000 (01:28 +0100)]
cmp: Print a summary on SIGINFO.

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

(cherry picked from commit 6673a5476d029cd5b47b2eed27032211a14f52bd)

cmp: Increase buffer size for non-mmap case.

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

(cherry picked from commit 134841a7f3e5516a83732d40a4d42268c901a492)

15 months agow: Complete libxo transition.
Dag-Erling Smørgrav [Wed, 25 Jan 2023 06:21:13 +0000 (07:21 +0100)]
w: Complete libxo transition.

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

(cherry picked from commit d90ff31ae5cd9ba073fbd6a7b2367b5209ea534e)

w: Unlike err(3), xo_err(3) won't accept a null format string.

MFC after: 1 week
X-MFC-with: d90ff31ae5cd
Sponsored by: Klara, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D38192

(cherry picked from commit 6fc1bbbf62bda2f1b5be3a4be3d36bc964490ebe)

15 months agofind: Logic nit in man page.
Dag-Erling Smørgrav [Tue, 24 Jan 2023 08:53:35 +0000 (09:53 +0100)]
find: Logic nit in man page.

Arguments follow primaries, not the other way around.

MFC after: 1 week
Sponsored by: Klara, Inc.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38173

(cherry picked from commit 14ebab25e1231decd80a64194e9028a9ada8d6e6)

15 months agodf: Return non-zero status on write failure.
Dag-Erling Smørgrav [Tue, 17 Jan 2023 13:40:05 +0000 (14:40 +0100)]
df: Return non-zero status on write failure.

While here, complete the libxo conversion and switch return value to standard constants.

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

(cherry picked from commit c968598479917f52022b86d0089a9835ddcf2799)

15 months agosbin/md5.c: fix -q -c for BSD style versions
Stefan Eßer [Tue, 26 Jul 2022 21:04:57 +0000 (23:04 +0200)]
sbin/md5.c: fix -q -c for BSD style versions

The BSD style commands (with names not ending in "sum") ignored the -c
options and the passed digest value when invoked with -q.

The man page stated that -q causes only the calculated digest to be
printed, but did not consider the case of both the -q and -c being
used in combination.

Since there is no warning that -c will be ignored when the -q option
is used, users night (and did) expect that the exit code would reflect
the matching of the calculated digest and the argument passed with -c.

This update implements and documents this expected behavior.

PR: 265461
Reported by: Dmitrij <bugs.freebsd@1fff.net>
MFC after: 2 weeks

(cherry picked from commit 9f3aa538e307743b2b5048d38f87b7fd32d0c596)

15 months agoupdate external URLs
Wolfram Schneider [Sat, 5 Feb 2022 08:19:56 +0000 (08:19 +0000)]
update external URLs

(cherry picked from commit 6981ec8bdff0f57833ab58747815e6e160eceaa2)

15 months agosockets: add MSG_TRUNC flag handling for recvfrom()/recvmsg().
Alexander V. Chernikov [Mon, 25 Jul 2022 19:46:40 +0000 (19:46 +0000)]
sockets: add MSG_TRUNC flag handling for recvfrom()/recvmsg().

Implement Linux-variant of MSG_TRUNC input flag used in recv(), recvfrom() and recvmsg().
Posix defines MSG_TRUNC as an output flag, indicating packet/datagram truncation.
Linux extended it a while (~15+ years) ago to act as input flag,
resulting in returning the full packet size regarless of the input
buffer size.
It's a (relatively) popular pattern to do recvmsg( MSG_PEEK | MSG_TRUNC) to get the
packet size, allocate the buffer and issue another call to fetch the packet.
In particular, it's popular in userland netlink code, which is the primary driving factor of this change.

This commit implements the MSG_TRUNC support for SOCK_DGRAM sockets (udp, unix and all soreceive_generic() users).

PR: kern/176322
Reviewed by: pauamma(doc)
Differential Revision: https://reviews.freebsd.org/D35909
MFC after: 1 month

(cherry picked from commit be1f485d7d6bebc53b055cc165a11ada0ab5fb17)

15 months agomd5/tests: extend md5 test
Stefan Eßer [Mon, 6 Feb 2023 20:11:51 +0000 (21:11 +0100)]
md5/tests: extend md5 test

The testloop function is called with various parameters, but those
were ignored in the coreutils-c-test script. This was an oversight
and is fixed by passing the option to all invocations of the hash
functions in this test script.

Reported by: des
MFC after: 3 days

(cherry picked from commit d804497068c16bcb05383d7227d899f4ba59f706)

15 months agonetlink: allow path weight manipulations for single-path routes.
Alexander V. Chernikov [Sun, 29 Jan 2023 15:53:34 +0000 (15:53 +0000)]
netlink: allow path weight manipulations for single-path routes.

Add support for the scenario when user adds/deletes paths for a single
 prefix one-by-one, all with different weights.
This change adds a new FreeBSD-specific RTA attribute, NL_RTA_WEIGHT.
When dumping non-multipath routes, this attribute is added if the
 route weight is not RT_DEFAULT_WEIGHT.
When adding a new route, this attribute is parsed as a relative path
 weight.

MFC after: 2 weeks

(cherry picked from commit 3ebccb20d56455f4bef1366f942680d1b60828f6)

15 months agonetlink: export nextop group kernel index when dumping multipath route.
Alexander V. Chernikov [Sat, 28 Jan 2023 15:37:58 +0000 (15:37 +0000)]
netlink: export nextop group kernel index when dumping multipath route.

MFC after: 2 weeks

(cherry picked from commit 95b47ba6299401b487f29a05ac859629ee7d4f0b)

15 months agocarp: turn net.inet.carp.allow into a RW tunable
Boris Lytochkin [Sun, 29 Jan 2023 16:42:40 +0000 (16:42 +0000)]
carp: turn net.inet.carp.allow into a RW tunable

Currently CARP starts announcing its state when initialised, regardless
of the state of the other services provided by the server.
As a result, the device can become master while still loading the
firewall ruleset or initialising long-starting service.

This change adds the way to request delayed CARP start by setting the
  net.inet.carp.allow=0 in the loader.conf.

Differential Revision: https://reviews.freebsd.org/D38167
MFC after: 2 weeks

(cherry picked from commit ee49c5d33d93a6b10222f64a0dc16590ac2048a0)

15 months agonetlink: add "netlink" to the list of kernel features
Alexander V. Chernikov [Mon, 30 Jan 2023 11:13:51 +0000 (11:13 +0000)]
netlink: add "netlink" to the list of kernel features

Reduce the amount of debug messages on module init/detach.

MFC after: 1 week

(cherry picked from commit 7fc9cfa57ccd4ee8ee71f8edfacfc26afab9cd2e)

15 months agonetlink: add NETLINK to GENERIC.
Alexander V. Chernikov [Tue, 31 Jan 2023 14:22:11 +0000 (14:22 +0000)]
netlink: add NETLINK to GENERIC.

This is a followup of 692e19cf5195 (add netlink to GENERIC@amd64).

Netlink is a communication protocol defined in RFC 3549. It is async,
TLV-based protocol, providing 1-1 and 1-many communications between kernel
and userland. Netlink is currently used in Linux kernel to modify, read and
subscribe for nearly all networking states. Interface state, addresses, routes,
firewall, rules, fibs, etc, are controlled via Netlink.

Netlink support was added in D36002. It has got a number of improvements and
first customers since then:
* net/bird2 got netlink support, enabling route multipath in FreeBSD
* netlink-based devd notifications are being worked on ( D37574 ).
* linux(4) fully supports and depends on Netlink

Enabling Netlink in GENERIC targets two goals.
The first one is to provide stability for the third-party userland applications,
so they can rely on the fact that netlink always exists since 14.0 and potentially 13.2.
Loadable module makes life of the app delepers harder. For example, `net/bird2` can be
either build with netlink or rtsock support, but not both.

The second goal is to enable gradual conversion of the base userland tools
to use netlink(4) interfaces. Converting tools like netstat (D36529), route,
ifconfig one-by-one simplifies testing and addressing the feedback.
Othewise, switching all base to use netlink at once may be too big of a leap.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37783

(cherry picked from commit e80699a809a079c4e673940544d6ddd944e8d08e)

15 months agopytest: delete interfaces from inside the jail.
Alexander V. Chernikov [Wed, 25 Jan 2023 16:32:52 +0000 (16:32 +0000)]
pytest: delete interfaces from inside the jail.

This change follows the approach used in 80fc25025ffc, to
 minimise the impact of the delayed interface migration.

MFC after: 2 weeks

(cherry picked from commit 20ea7f26e41375828a390fba613b86acfe366add)

15 months agopytest: add an example test fetching test directory and ATF vars.
Alexander V. Chernikov [Wed, 25 Jan 2023 13:55:33 +0000 (13:55 +0000)]
pytest: add an example test fetching test directory and ATF vars.

MFC after: 2 weeks

(cherry picked from commit 864ea9abfb98493a157dc17be17c428080843bdd)

15 months agonetinet6: honor blackhole/unreach routes in the non-fastforwading code.
Alexander V. Chernikov [Sun, 22 Jan 2023 16:57:36 +0000 (16:57 +0000)]
netinet6: honor blackhole/unreach routes in the non-fastforwading code.

Currently, under the conditions specified below, IPv6 ingress packet
 processing can ignore blackhole/reject flag on the prefix. The packet
 will instead be looped locally till TTL expiration and a single ICMPv6
 unreachable message will be send to the source even in case of
 RTF_BLACKHOLE.
The following conditions needs hold to make the scenario happen:
* IPv6 forwarding is enabled
* Packet is not fast-forwarded
* Destination prefix has either RTF_BLACKHOLE or RTF_REJECT flag
Fix this behavior by checking for the blackhole/reject flags in
ip6_forward().

Reported by: Dmitriy Smirnov <fox@sage.su>
Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D38164
MFC after: 3 days

(cherry picked from commit 30dd227cff75bdabaac2002a2b17095f3392a485)

15 months agoatf_pytest_wrapper: fix pytest output truncation
Jose Luis Duran [Wed, 28 Dec 2022 17:28:59 +0000 (17:28 +0000)]
atf_pytest_wrapper: fix pytest output truncation

Pass `-vv` to pytest in order to always get the full output.
While here, enforce the modeline.

Differential Revision: https://reviews.freebsd.org/D37894
MFC after: 2 weeks

(cherry picked from commit 058ac3e8063366dafa634d9107642e12b038bf09)

15 months agopytest: silence deprecation warning in the pytest atf wrapper
Jose Luis Duran [Wed, 28 Dec 2022 15:51:18 +0000 (15:51 +0000)]
pytest: silence deprecation warning in the pytest atf wrapper

Convert `pytest.mark` decorator to the `pytest.hookimpl()` one,
 as suggested by the
 https://docs.pytest.org/en/latest/deprecations.html#configuring-hook-specs-impls-using-markers

Differential Revision: https://reviews.freebsd.org/D37884
MFC after: 2 weeks

(cherry picked from commit eaeebfcb38599c94e89bbba3e9c7aeb821c84d71)

15 months agotests: Add an IPv4 loopback address of 127.0.0.1/8 to the lo0
Jose Luis Duran [Wed, 11 Jan 2023 14:33:58 +0000 (14:33 +0000)]
tests: Add an IPv4 loopback address of 127.0.0.1/8 to the lo0
 interface by default when creating VNETSs using pytest.

Reviewed By: asomers
Differential Revision: https://reviews.freebsd.org/D38021

(cherry picked from commit 4856aeaaed17726a1dfa5dd6c736e5b0851255b6)

15 months agoRead the arm64 far early in el0 exceptions
Andrew Turner [Wed, 25 Jan 2023 17:47:39 +0000 (17:47 +0000)]
Read the arm64 far early in el0 exceptions

When handling userspace exceptions on arm64 we need to dereference the
current thread pointer. If this is being promoted/demoted there is a
small window where it will cause another exception to be hit. As this
second exception will set the fault address register we will read the
incorrect value in the userspace exception handler.

Fix this be always reading the fault address before dereferencing the
current thread pointer.

Reported by: olivier@
Reviewed by: markj
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D38196

(cherry picked from commit f29942229d24ebb8b98f8c5d02f3c8632648007e)

15 months agolinux(4): Attach netlink on i386.
Dmitry Chagin [Mon, 6 Feb 2023 14:00:44 +0000 (17:00 +0300)]
linux(4): Attach netlink on i386.

Discussed with: melifaro
MFC after: 3 days

(cherry picked from commit 07db1f36848c008efb7ab6b37e199212560833ae)

15 months agolinux(4): Microoptimize linux_ipc code to unindent else blocks.
Dmitry Chagin [Fri, 3 Feb 2023 16:17:34 +0000 (19:17 +0300)]
linux(4): Microoptimize linux_ipc code to unindent else blocks.

No functional change.

MFC after: 1 week

(cherry picked from commit eb08932156dc5801418924cf0bf9f167b15f7bf0)

15 months agolinux(4): Use designated initializers.
Dmitry Chagin [Fri, 3 Feb 2023 16:17:15 +0000 (19:17 +0300)]
linux(4): Use designated initializers.

MFC after: 1 week

(cherry picked from commit 3e0c56a717d6af3b680463b25388c7acd7cb8844)

15 months agolinux(4): Remove stale comment that no longer applies.
Dmitry Chagin [Thu, 2 Feb 2023 17:21:37 +0000 (20:21 +0300)]
linux(4): Remove stale comment that no longer applies.

MFC after: 1 week

(cherry picked from commit ce20c00e858f209f42d404eca597553e461e0892)

15 months agolinux(4): Microoptimize rt_sendsig() on amd64.
Dmitry Chagin [Thu, 2 Feb 2023 17:21:37 +0000 (20:21 +0300)]
linux(4): Microoptimize rt_sendsig() on amd64.

Drop proc lock earlier, before copying user stuff.

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

(cherry picked from commit 6ad07a4b2bdf0856545ff8495a7b3396695814fa)

15 months agolinux(4): Preserve fpu fxsave state across signal delivery on amd64.
Dmitry Chagin [Thu, 2 Feb 2023 17:21:37 +0000 (20:21 +0300)]
linux(4): Preserve fpu fxsave state across signal delivery on amd64.

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

(cherry picked from commit a95cb95e12e537dbe70f9de18cc0fe98e4a5ebf5)

15 months agolinux(4): Deduplicate linux_trans_osrel().
Dmitry Chagin [Thu, 2 Feb 2023 14:58:07 +0000 (17:58 +0300)]
linux(4): Deduplicate linux_trans_osrel().

MFC after: 1 week

(cherry picked from commit 95b8603427d5759c5d6090ffaacfaf7f3b8fb926)

15 months agolinux(4): Deduplicate linux_copyout_strings().
Dmitry Chagin [Thu, 2 Feb 2023 14:58:07 +0000 (17:58 +0300)]
linux(4): Deduplicate linux_copyout_strings().

It is still present in the 32-bit Linuxulator on amd64.

MFC after: 1 week

(cherry picked from commit 6039e966ff276ff6bcb57f2f70e7d8ff376b24fd)

15 months agolinux(4): Deduplicate linux_fixup_elf().
Dmitry Chagin [Thu, 2 Feb 2023 14:58:07 +0000 (17:58 +0300)]
linux(4): Deduplicate linux_fixup_elf().

Use native routines to fixup initial process stack. On Arm64 linux_elf_fixup() is
noop, as it do the stack fixup (room for argc) in the linux_copyout_strings().

MFC after: 1 week

(cherry picked from commit 9e550625f867a23ea3d87a77aa3c216b79ecd790)

15 months agolinux(4): Add coredump support to i386.
Dmitry Chagin [Thu, 2 Feb 2023 14:58:06 +0000 (17:58 +0300)]
linux(4): Add coredump support to i386.

MFC after: 1 week

(cherry picked from commit cc1b0f7d9626bbd116429014444cbf61edf708a2)

15 months agolinux(4): Use COMPAT_LINUX32 enstead of __ELF_WORD_SIZE.
Dmitry Chagin [Thu, 2 Feb 2023 14:58:06 +0000 (17:58 +0300)]
linux(4): Use COMPAT_LINUX32 enstead of __ELF_WORD_SIZE.

COMPAT_LINUX32 option is defined for case when building 32-bit Linuxulator
for the 64-bit host. Usage of __ELF_WORD_SIZE is wrong here as it is equal to 32
on i386 too.

MFC after: 1 week

(cherry picked from commit 6f8439db241c7409275d77f5376e8505967bef67)

15 months agolinux(4): Microoptimize linux_elf.h for future use.
Dmitry Chagin [Thu, 2 Feb 2023 14:58:06 +0000 (17:58 +0300)]
linux(4): Microoptimize linux_elf.h for future use.

In order to reduce code duplication move coredump support definitions
into the appropriate header and hide private definitions.

MFC after: 1 week

(cherry picked from commit 7446514533a40b376eaeb349ea33531ce9c711c2)

15 months agolinux(4): Deduplicate MI futex structures.
Dmitry Chagin [Wed, 1 Feb 2023 18:57:04 +0000 (21:57 +0300)]
linux(4): Deduplicate MI futex structures.

MFC after: 1 week

(cherry picked from commit 575e48f1c4eb05fe8df6aaeb5f55e17c63a02639)

15 months agoamd64: Eliminate write only cpu_fxsr.
Dmitry Chagin [Wed, 1 Feb 2023 15:17:06 +0000 (18:17 +0300)]
amd64: Eliminate write only cpu_fxsr.

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

(cherry picked from commit 5c32146723ef88b07506c081653898cd2f293a52)

15 months agoUnstaticize {get,set}_fpcontext() on amd64
Edward Tomasz Napierala [Tue, 4 Jan 2022 13:25:12 +0000 (13:25 +0000)]
Unstaticize {get,set}_fpcontext() on amd64

This will be used to fix Linux signal delivery.

Discussed With: kib
Sponsored By: EPSRC

(cherry picked from commit 562bc0a943d1fad1a9b551557609d2941a851b4d)

15 months agoiommu_gas: initialize start_gap as first node
Doug Moore [Wed, 8 Feb 2023 17:04:13 +0000 (11:04 -0600)]
iommu_gas: initialize start_gap as first node

In iommu_gas.c, domain->start_gap points to one of the nodes on either
side of the first free, unallocated range. In iommu_gas_init_domain,
it is initialized to point to the node after the single free
range. Change it to point to the node before that free range, so that,
when 'lowaddr' is within the initial free range, the first allocation
search for free space below 'lowaddr' does not begin and end at an
address above 'lowaddr'. This fixes problems on a machine with Intel
DMAR enabled.

Reported by: jah
Reviewed by: dougm
Tested by: jah
Obtained from: jah
Fixes: commit db151ca0c343531256b8839f938a4ecbd8b4fd7e iommu_gas: start space search from 1st free space
MFC after: 1 day

(cherry picked from commit 87d405eab91169e0b650a7dd2e5097c0b990fac5)

15 months agoatrtc: expose power loss as sysctl
Corvin Köhne [Thu, 8 Dec 2022 07:28:42 +0000 (08:28 +0100)]
atrtc: expose power loss as sysctl

Exposing the a power loss of the rtc as an sysctl makes it easier to
detect an empty cmos battery.

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

(cherry picked from commit 55f1ca209d37d7b5a6faf57b23c7341cb7f84ee6)

15 months agossh: Be more paranoid with host/domain names coming from the
Ed Maste [Mon, 6 Feb 2023 16:45:52 +0000 (11:45 -0500)]
ssh: Be more paranoid with host/domain names coming from the

never write a name with bad characters to a known_hosts file.

replace recently-added valid_domain() check for hostnames going to
known_hosts with a more relaxed check for bad characters.

Obtained from: OpenSSH-portable commit 445363433ba2
Obtained from: OpenSSH-portable commit 3cae9f92a318
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2e828220579e3ada74ed0613871ec6ec61d669ba)

15 months agossh: fix bug in PermitRemoteOpen which caused it to ignore...
Ed Maste [Mon, 6 Feb 2023 16:33:38 +0000 (11:33 -0500)]
ssh: fix bug in PermitRemoteOpen which caused it to ignore...

its first argument unless it was one of the special keywords "any" or
"none".

Obtained from: OpenSSH-portable commit b3daa8dc5823
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 94e21add45344f0669f910ea77db499e8c892c90)

15 months agossh: fix double-free caused by compat_kex_proposal()
Ed Maste [Mon, 6 Feb 2023 16:26:08 +0000 (11:26 -0500)]
ssh: fix double-free caused by compat_kex_proposal()

Security: CVE-2023-25136
Obtained from: OpenSSH-portable commit 12da78233364
Sponsored by: The FreeBSD Foundation

(cherry picked from commit fe1371e8f3d7336748d291a7360b2aacce943fb1)

15 months agoblacklistd: diff reduction against upstream
Ed Maste [Mon, 23 Jan 2023 16:19:46 +0000 (11:19 -0500)]
blacklistd: diff reduction against upstream

Add `conf_` prefix, maching https://github.com/zoulasc/blocklist

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8089749d38781946c008372f4016d69eee549f1c)

15 months agogeli: split the initalization of HMAC
Mariusz Zaborski [Wed, 8 Feb 2023 16:41:06 +0000 (08:41 -0800)]
geli: split the initalization of HMAC

GELI allows to read a user key from a standard input.
However if user initialize multiple providers at once, the standard
input will be empty for the second and next providers.
This caused GELI to encrypt a master key with an empty key file.

This commits initialize the HMAC with the key file, and then reuse the
finalized structure to generate different encryption keys for different
providers.

Reported by: Nathan Dorfman
Tested by: philip
Security: FreeBSD-SA-23:01.geli
Security: CVE-2023-0751

(cherry picked from commit 5fff09660e06a66bed6482da9c70df328e16bbb6)

15 months agovmm: avoid spurious rendezvous
Corvin Köhne [Tue, 15 Nov 2022 10:53:49 +0000 (11:53 +0100)]
vmm: avoid spurious rendezvous

A vcpu only checks if a rendezvous is in progress or not to decide if it
should handle a rendezvous. This could lead to spurios rendezvous where
a vcpu tries a handle a rendezvous it isn't part of. This situation is
properly handled by vm_handle_rendezvous but it could potentially
degrade the performance. Avoid that by an early check if the vcpu is
part of the rendezvous or not.

At the moment, rendezvous are only used to spin up application
processors and to send ioapic interrupts. Spinning up application
processors is done in the guest boot phase by sending INIT SIPI
sequences to single vcpus. This is known to cause spurious rendezvous
and only occurs in the boot phase. Sending ioapic interrupts is rare
because modern guest will use msi and the rendezvous is always send to
all vcpus.

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

(cherry picked from commit 892feec2211d0dbd58252a34d78dbcb2d5dd7593)

15 months agolibthr pshared: correct a bug in allocation
Konstantin Belousov [Wed, 1 Feb 2023 20:12:45 +0000 (22:12 +0200)]
libthr pshared: correct a bug in allocation

PR: 269277

(cherry picked from commit 25c862ae503a1c99458f4e055fd50c878fadbea3)

15 months agolibthr: add pshared_destroy() helper
Konstantin Belousov [Wed, 1 Feb 2023 21:06:04 +0000 (23:06 +0200)]
libthr: add pshared_destroy() helper

(cherry picked from commit 3cf37d1251bf71b2171e67af8f2ca43cbe3d874d)

15 months agoirdma(4): remove 14-current specific code
Bartosz Sobczak [Fri, 20 Jan 2023 08:28:36 +0000 (09:28 +0100)]
irdma(4): remove 14-current specific code

This is a direct commit to the stable/13 branch.

Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
15 months agoirdma(4): Add code for compilation on stable/13 branch
Bartosz Sobczak [Mon, 6 Feb 2023 22:37:39 +0000 (14:37 -0800)]
irdma(4): Add code for compilation on stable/13 branch

Current content of the irdma(4) driver consists only of code that is
compilable on current 14-CURRENT branch which makes it impossible to
merge into stable/13 branch because of missing dependencies in the ofed
tree.

This patch adds missing code that allows for merging into stable branch.
Once it is there, code relating only to version 14 or higher should be
removed.

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

(cherry picked from commit a527c18cd7ba5d4afacbfb85817ca7b8b2487b52)

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

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

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

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

(cherry picked from commit 777e472cd86b9394d07bf96c19dbafc2e1ff4fdc)

15 months agoirdma(4): hide tasklet-related definitions to avoid redefines
Bartosz Sobczak [Mon, 23 Jan 2023 10:17:53 +0000 (11:17 +0100)]
irdma(4): hide tasklet-related definitions to avoid redefines

checking if either from_tasklet or tasklet_setup
exists before defining irdma's own version.

This is a result of changes introduced in:
f2978460c7fd ("LinuxKPI: tasklet add (*callback) support", 2022-11-08)

The code should be kept until the from_timer and
tasklet_setup is defined in linuxkpi's interrupt.h

This is a direct commit to the stable/13 branch.

Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
15 months agoibcore: The use of IN_LOOPBACK() now requires a valid VNET context.
Hans Petter Selasky [Wed, 31 Aug 2022 10:37:28 +0000 (12:37 +0200)]
ibcore: The use of IN_LOOPBACK() now requires a valid VNET context.

Make sure the VNET is set before using this macro.

Fixes: efe58855f3ea2cfc24cb705aabce3bc0fe1fb6d5
PR: 266054
Sponsored by: NVIDIA Networking

(cherry picked from commit f50274674ebf3a51a77708f569d38a238cbad6ec)

15 months agoAdjust irdma_prep_for_unregister() definition to avoid clang 15 warning
Dimitry Andric [Sun, 24 Jul 2022 21:27:24 +0000 (23:27 +0200)]
Adjust irdma_prep_for_unregister() definition to avoid clang 15 warning

With clang 15, the following -Werror warning is produced:

    sys/dev/irdma/icrdma.c:621:26: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    irdma_prep_for_unregister()
                             ^
                              void

This is because irdma_prep_for_unregister() is declared with a (void)
argument list, but defined with an empty argument list. Make the
definition match the declaration.

(cherry picked from commit ee6c09ac73b5eab848c66e539f8b3293a5abd7f8)

15 months agoirdma: Add RDMA driver for Intel(R) Ethernet Controller E810
Bartosz Sobczak [Mon, 23 May 2022 23:39:27 +0000 (16:39 -0700)]
irdma: Add RDMA driver for Intel(R) Ethernet Controller E810

This is an initial commit for RDMA FreeBSD driver for Intel(R) Ethernet
Controller E810, called irdma.  Supporting both RoCEv2 and iWARP
protocols in per-PF manner, RoCEv2 being the default.

Testing has been done using krping tool, perftest, ucmatose, rping,
ud_pingpong, rc_pingpong and others.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: #manpages (pauamma_gundo.com) [documentation]
Relnotes: yes
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D34690

(cherry picked from commit cdcd52d41e246ba1c0fcfad0769bd691487355ef)
(cherry picked from commit e602a30bb9fc7ee041a0e629d0fd2db7933ffa32)
(cherry picked from commit a6e275af46644af1de365a1edf19742bfa28bb69)

15 months agoOpenSSL: Regen manual pages for OpenSSL 1.1.1t
Jung-uk Kim [Tue, 7 Feb 2023 19:01:15 +0000 (14:01 -0500)]
OpenSSL: Regen manual pages for OpenSSL 1.1.1t

(cherry picked from commit eb9b98fb5aea1b20d71b0be948454f472b024da7)

15 months agoOpenSSL: Regen assembly files for OpenSSL 1.1.1t
Jung-uk Kim [Tue, 7 Feb 2023 18:55:17 +0000 (13:55 -0500)]
OpenSSL: Regen assembly files for OpenSSL 1.1.1t

(cherry picked from commit f1cf49002dbb0b1976ef1ebd8e689a7825e3e06f)

15 months agoOpenSSL: Merge OpenSSL 1.1.1t
Jung-uk Kim [Tue, 7 Feb 2023 18:54:16 +0000 (13:54 -0500)]
OpenSSL: Merge OpenSSL 1.1.1t

(cherry picked from commit fb3134558138e52322ebcdf66fee8288ee308d78)

15 months agoOpenSSL: Merge OpenSSL 1.1.1t
Jung-uk Kim [Tue, 7 Feb 2023 18:51:38 +0000 (13:51 -0500)]
OpenSSL: Merge OpenSSL 1.1.1t

(cherry picked from commit 640242a5915761ce63205bdb0542fa3c1473c0ff)

15 months agotimeout: Move from /usr/bin to /bin
Mateusz Piotrowski [Wed, 1 Feb 2023 15:24:59 +0000 (16:24 +0100)]
timeout: Move from /usr/bin to /bin

timeout(1) is used by /etc/rc.d/zfskeys. Unfortunately, having
timeout(1) installed in /usr/bin causes problems when /usr is an
encrypted ZFS partition.

Implementing timeout(1) in sh(1) is not trivial. A more elegant solution
is to move timeout(1) to /bin so that it is available to early services
in the boot process.

PR: 265221
Reviewed by: allanjude, des, imp
Approved by: allanjude, des, imp
Reported by: Ivan <r4@sovserv.ru>
Fixes: 33ff39796ffe Add zfskeys rc.d script for auto-loading encryption keys
Relnotes: yes
Sponsored by: Modirum MDPay
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D38344

(cherry picked from commit e7ab133648a168c4bf7c11da840663c5581771d8)

15 months agocontrib/bc: update to version 6.2.2
Stefan Eßer [Mon, 7 Mar 2022 22:23:56 +0000 (23:23 +0100)]
contrib/bc: update to version 6.2.2

This is a squashed commit that updates bc from version 5.2.2 to
version 6.2.2:

contrib/bc: update to version 5.2.3

This version fixes a parse error when passing a file to bc using -f
if that file has a multiline comment or string in it.

Merge commit '3673adf1ee311d6f83176d3e43cf0efb314764e4'

(cherry picked from commit 23210c9f42af94dc6bcdae3996d8a3d010dd6bfe)

contrib/bc: include assert.h when building with C11 or newer

This chunk should have been committed with the MFV commit
23210c9f42af94dc but was missing for an unknown reasn.

(cherry picked from commit b66d67d97aa58d0f239056917bbdbab26f41446a)

contrib/bc: import version 5.2.4

This update fixes an issue in input line editing: when going left to
the start of the line, the cursor would jump to the end of the line
instead.

Merge commit 'bc75dcc4ce682562390fa32e7cd63c08160e21b9'

(cherry picked from commit b85b9c88eb02298ea7fa3885619f54ac0e930ba4)

vendor/bc: import of version 5.2.5

This is a production release that fixes this bc's behavior on ^D to
match GNU bc.

(cherry picked from commit ed0603704174b01c25b49efc08c82e1532dc5622)
(cherry picked from commit f4ff1c300ef4081696bdd6ad34547be9242e419c)

usr.bin/bc: update to version 5.3.1

This version adds support for command line editing and history using
the libedit or readline libraries in addition to the line editing
features available in previous versions.

The version in the base system is configured to use libedit.

This allows to choose between emacs and vi line editing commands and
to use command overrides via a ~/.editrc file.

Merge commit 'bd54318046bfee055b140705a5cfd4148e78da07'

(cherry picked from commit 78bc019d220e05abb5b12f678f9b4a847019bbcc)

contrib/bc: merge from vendor release 5.3.3

This update fixes a build issue of release 5.3.2 on the FreeBSD base
system.

Merge commit '3f739b0595b7d6ac4bac9aaa1cae0910f11f92e2'

(cherry picked from commit f53b5fe7865f4e4240e40ba0f6345f81d337a823)

vendor/bc: update to upstream commit ca53adf83b7a

The filter_text function in scripts/functions.sh in version 5.3.3 had
commented out a "rm" command, probably for debugging purposes. This
caused temporary files to persist in /tmp when the bc program had been
built.

This commit fixes the build process with no change of the resulting
artefacts.

(cherry picked from commit 1576f66712876ee8b0fcc8b35fb062e1813b4fc0)
(cherry picked from commit f6ed05f1233043eb30a7e5a1efcb7247ad2add90)

contrib/bc: merge from vendor release 6.2.2

This update fixes a few issues in history editing and the processing
of the "quit" function. The "quit" function will no longer cause bc
to exit when encountered in a script file (before any command from
the script has been executed).

New functions is_number(), is_string return 1 if the passed argument
is a number resp. a string. The asciify() function has been extended
to support the conversion of an array of numbers into a string.

Merge commit '1a63323d17fedb05b6962853e821c9d7c6b9853e'

(cherry picked from commit d101cdd6edd782f6ec56eef63ed91abd77a8b317)

15 months agoiflib: Add null check to iflib_stop()
Przemyslaw Lewandowski [Tue, 24 Jan 2023 23:41:15 +0000 (15:41 -0800)]
iflib: Add null check to iflib_stop()

Ever since gtaskqueue_drain() was added to iflib_stop(), a kernel panic
occurs when the ice(4) driver is in recovery mode. Queues are not
initialized in this mode, so gt_taskqueue is not initialized, and
gtaskqueue_drain() will panic.

Fix this by only doing a drain if an RX queue's gt_taskqueue is
initialized.

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

(cherry picked from commit 9147969bc277b389a62373c6a5050a2ebfd39071)

15 months agoFix for getmntpoint(3) when checking for NFS mount points.
Kirk McKusick [Sun, 29 Jan 2023 23:12:48 +0000 (15:12 -0800)]
Fix for getmntpoint(3) when checking for NFS mount points.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907

(cherry picked from commit ad055467bec35885dc3eff2f4dd765f5b2f53259)

15 months agoRewrite to avoid Coverity false positive.
Kirk McKusick [Thu, 26 Jan 2023 00:57:26 +0000 (16:57 -0800)]
Rewrite to avoid Coverity false positive.

Reported by:  Coverity (CID 1502669)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907

(cherry picked from commit 0bd4c448ec1dfdc2300a6cacca42e1fc7c4d8f14)

15 months agoDocument the mntopts(3) functions.
Kirk McKusick [Sun, 15 Jan 2023 18:20:48 +0000 (10:20 -0800)]
Document the mntopts(3) functions.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907

(cherry picked from commit 906c312bbf7493ccbcce883936d67e5c66a9c3c2)

15 months agovtd: Increase DRHD_MAX_UNITS
Eric Joyner [Mon, 30 Jan 2023 21:34:03 +0000 (13:34 -0800)]
vtd: Increase DRHD_MAX_UNITS

Observed on a couple Ice Lake-SP platforms (Intel Coyote Pass, Dell
R750), there are more than 8 DRHD sections enumerated in the DMAR ACPI
section.  Since the previous limit was 8, this resulted in some of these
not being parsed by vtd when the iommu is initialized; in this case when
PCI devices are being passthru'd to a bhyve VM.

This omission later causes a kernel panic later in initialization when
devices could not be found in a valid DRHD scope because the DHRD
containing the device's scope was not added to vtd.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
PR: 268486
Sponsored by: Intel Corporation
Reviewed by: rew@, corvink@
Differential Revision: https://reviews.freebsd.org/D38285

(cherry picked from commit 53545967642d850eee4f2dd9fa27cae52ae981b9)

15 months agosctp: improve delivery of stream reset notifications
Michael Tuexen [Thu, 2 Feb 2023 13:46:10 +0000 (14:46 +0100)]
sctp: improve delivery of stream reset notifications

Two functions are not called via sctp_ulp_notify() and therefore
need additional checks when being called.

Reported by: syzbot+eb888d3a5a6c54413de5@syzkaller.appspotmail.com

(cherry picked from commit 7b2f1a7fe9445ea318f34bd3db971076b61ef831)

15 months agotcp: improve error handling of net.inet.tcp.udp_tunneling_port
Michael Tuexen [Thu, 26 Jan 2023 21:55:22 +0000 (22:55 +0100)]
tcp: improve error handling of net.inet.tcp.udp_tunneling_port

In case the new port can't be set, set the port to 0.

Sponsored by: Netflix, Inc.

(cherry picked from commit e2d14a04c5fc49ad1aab280e3c2e7283bbacc948)

15 months agoelftoolchain: update the list of riscv relocations
Mitchell Horne [Sat, 28 Jan 2023 18:19:26 +0000 (14:19 -0400)]
elftoolchain: update the list of riscv relocations

A few have been added, a couple removed.

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

(cherry picked from commit 537c166b767879398338370701fa60f67acec112)

15 months agoelf_common.h: remove obsolete riscv relocations
Mitchell Horne [Sat, 28 Jan 2023 18:19:44 +0000 (14:19 -0400)]
elf_common.h: remove obsolete riscv relocations

These were specified at one time, but later removed.

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

(cherry picked from commit 7738bb89a3cc70dc83ed4e80ee5160c18a7721f3)

15 months agoddb: have 'reset' command use normal reboot path
Mitchell Horne [Sat, 7 Jan 2023 18:09:28 +0000 (14:09 -0400)]
ddb: have 'reset' command use normal reboot path

This conditionally gives all registered shutdown handlers a chance to
perform the reboot, with cpu_reset() being the fallback. The '\s'
modifier can be used with the command to get the previous behaviour.

The motivation is that some platforms may not be able do anything
meaningful via cpu_reset(), due to a lack of standardized reset
mechanism and/or firmware shortcomings. However, they may have a
separate device driver attached that normally performs the reboot. Such
is the case for some versions of the Raspberry Pi, where reset via PSCI
fails, but the BCM2835 watchdog driver has a shutdown hook.

Reported by: bz
Reviewed by: markj (slightly earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37981

(cherry picked from commit 5644850620aead7c257a4e3040e20201b510f499)

15 months agokern_reboot: unconditionally call shutdown_reset()
Mitchell Horne [Mon, 23 Jan 2023 18:47:11 +0000 (14:47 -0400)]
kern_reboot: unconditionally call shutdown_reset()

Currently shutdown_reset() is registered as the final entry of the
shutdown_final event handler. However, if a panic occurs early in boot
before the event is registered (SI_SUB_INTRINSIC), we may end up
spinning in the subsequent infinite for loop and failing to reset
altogether. Instead we can simply call this function unconditionally.

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37981

(cherry picked from commit 627ca221c311b5d9c4132e03664a96f390ff5c0d)

15 months agocpuset: Handle CPU_WHICH_TIDPID wherever cpuset_which() is called.
Dmitry Chagin [Mon, 30 Jan 2023 16:28:54 +0000 (19:28 +0300)]
cpuset: Handle CPU_WHICH_TIDPID wherever cpuset_which() is called.

cpuset_which() resolves the argument pair which and id and returns references
to an appropriate resources. To avoid leaking resources or accessing unresolved
references to a resources handle new which CPU_WHICH_TIDPID wherever
cpuset_which() is called.
To avoid code duplication cpuset_which2() has been added.

Reported by: syzbot+331e8402e0f7347f0f2a@syzkaller.appspotmail.com
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D38272
MFC after: 2 weeks

(cherry picked from commit 2058f075b4afc543b8735599bea7278e37b2e9f9)

15 months agomp_x86: Trim trailing whitespaces.
Dmitry Chagin [Sun, 29 Jan 2023 13:18:39 +0000 (16:18 +0300)]
mp_x86: Trim trailing whitespaces.

MFC after: 1 week

(cherry picked from commit 290afc5d55fa370338cb837c7aaabf40670628a8)

15 months agosubr_smp: Trim trailing whitespaces.
Dmitry Chagin [Sun, 29 Jan 2023 13:18:17 +0000 (16:18 +0300)]
subr_smp: Trim trailing whitespaces.

MFC after: 1 week

(cherry picked from commit e4754c80366dcbc28e625efab5cfe84057784c19)

15 months agocpuset: Fix sched_[g|s]etaffinity() for better compatibility with Linux.
Dmitry Chagin [Sun, 29 Jan 2023 13:17:33 +0000 (16:17 +0300)]
cpuset: Fix sched_[g|s]etaffinity() for better compatibility with Linux.

Under Linux to sched_[g|s]etaffinity() functions the value returned from a call
to gettid(2) (thread id) can be passed in the argument pid. Specifying pid as 0
will set the attribute for the calling thread, and passing the value returned
from a call to getpid(2) (process id) will set the attribute for the main thread
of the thread group.

Native cpuset(2) family of system calls has "which" argument to determine how
the value of id argument is interpreted, i.e., CPU_WHICH_TID is used to pass
a thread id and CPU_WHICH_PID - to pass a process id.

For now native sched_[g|s]etaffinity() implementation is wrong as uses "which"
CPU_WHICH_PID to pass both (process and thread id) to the kernel. To fix this
adding a new "which" CPU_WHICH_TIDPID intended to handle both id's.

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

(cherry picked from commit c21b080f3dc2f5e91ada608d4385b7ed6538ba9b)