freebsd.git
16 months agoRemove unnecessary sys/cdefs.h includes.
Ganbold Tsagaankhuu [Sat, 7 Jan 2023 06:05:52 +0000 (06:05 +0000)]
Remove unnecessary sys/cdefs.h includes.

16 months agostand: Allow stand.h to be included in C++ programs
Warner Losh [Sat, 7 Jan 2023 01:39:09 +0000 (18:39 -0700)]
stand: Allow stand.h to be included in C++ programs

Allow stand.h to be included in C++ programs. This is little more than
using our stylized __BEGIN_DECL / __END_DECL around the entire
file. There's no run-time support for C++, so the C++ that can be used
is quite limited. It is enough for libunwind, though.

Sponsored by: Netflix
Reviewed by: jrtc27, kevans
Differential Revision: https://reviews.freebsd.org/D37946

16 months agostand: Add inttype.h
Warner Losh [Sat, 7 Jan 2023 01:37:56 +0000 (18:37 -0700)]
stand: Add inttype.h

libunwind files need inttype.h. It's safe so add it to the safe list.

Sponsored by: Netflix
Reviewed by: jrtc27, kevans
Differential Revision: https://reviews.freebsd.org/D37947

16 months agofsx: more consistent debug output with -[RWU]
Alan Somers [Sat, 7 Jan 2023 04:49:28 +0000 (21:49 -0700)]
fsx: more consistent debug output with -[RWU]

MFC after: 2 weeks

16 months agocopyright: chase my name and email change
Val Packett [Fri, 6 Jan 2023 15:33:07 +0000 (10:33 -0500)]
copyright: chase my name and email change

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

16 months agotests: add test for ipfw fwd localaddr,port
Gleb Smirnoff [Fri, 6 Jan 2023 20:17:41 +0000 (12:17 -0800)]
tests: add test for ipfw fwd localaddr,port

Checks basic forward to local address, also with presence of
a listener that matches original port (see aab8c844b91). Based
on non-ATF test case written by Pavel Polyakov.

Reviewed by: kp, melifaro
Differential revision: https://reviews.freebsd.org/D37960

16 months agonetlink: fix ifaddr reporting.
Alexander V. Chernikov [Fri, 6 Jan 2023 19:13:42 +0000 (19:13 +0000)]
netlink: fix ifaddr reporting.

Output the proper attributes for IPv4/IPvv6 ifaddrs:
* IFA_ADDRESS contains local address in every case except p2p,
   in that case it contains the peer address
* IFA_LOCAL contains local address. It is always present in IPv4,
   or in IPv6/p2p.
* IFA_BROADCAST contains the network broadcast address (if any)

Reported by: Adam Wood <aswood@gmail.com>
Tested by: Adam Wood <aswood@gmail.com>

16 months agoasmc: Add support for MacBook5,5
Michael Gmelin [Thu, 29 Dec 2022 15:59:08 +0000 (16:59 +0100)]
asmc: Add support for MacBook5,5

This is a slightly refined version of a patch[0] by FreeBSD Forums
user "tmcclean".

[0]https://forums.freebsd.org/threads/success-installing-freebsd-13-0-on-macbook-pro-5-5.80458/

Reviewed by: adrian, emaste, imp
Differential Revision: https://reviews.freebsd.org/D37900
MFC after: 1 month

16 months agoi386: print trampoline disposition value for verbose boot
Konstantin Belousov [Fri, 6 Jan 2023 18:18:51 +0000 (20:18 +0200)]
i386: print trampoline disposition value for verbose boot

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

16 months agofsx: bounds check the inputs
Alan Somers [Sat, 7 Jan 2023 01:54:23 +0000 (18:54 -0700)]
fsx: bounds check the inputs

In particular, don't allow the user to specify a file size that can't be
expressed as an int, since fsx's random-number generator only has a 32
bit range.

MFC after: 2 weeks

16 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

16 months agosqlite3: Vendor import of sqlite3 3.40.0
Cy Schubert [Fri, 6 Jan 2023 17:03:38 +0000 (09:03 -0800)]
sqlite3: Vendor import of sqlite3 3.40.0

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

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

16 months agodma: dma.conf.5 as MLINK to dma.8
Ed Maste [Wed, 4 Jan 2023 18:47:26 +0000 (13:47 -0500)]
dma: dma.conf.5 as MLINK to dma.8

There's no separate man page for dma.conf, but the format is documented
in dma.8.

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

16 months agoMissed skey(4), a copy of opie(4).
Dag-Erling Smørgrav [Fri, 6 Jan 2023 10:12:40 +0000 (11:12 +0100)]
Missed skey(4), a copy of opie(4).

16 months agoUse BSD-2-Clause for the SPDX license id as -FreeBSD variant has been deprecated.
Ganbold Tsagaankhuu [Fri, 6 Jan 2023 08:15:44 +0000 (08:15 +0000)]
Use BSD-2-Clause for the SPDX license id as  -FreeBSD variant has been deprecated.

16 months agoAdd SPDX-License-Identifier.
Ganbold Tsagaankhuu [Fri, 6 Jan 2023 04:14:49 +0000 (04:14 +0000)]
Add SPDX-License-Identifier.

16 months agoRemove unnecessary $Id string from license.
Ganbold Tsagaankhuu [Fri, 6 Jan 2023 04:10:09 +0000 (04:10 +0000)]
Remove unnecessary $Id string from license.

While there add SPDX-License-Identifier.

16 months agoAdd Naneng combo PHY support for RK3568 SoC.
Søren Schmidt [Fri, 6 Jan 2023 03:00:18 +0000 (03:00 +0000)]
Add Naneng combo PHY support for RK3568 SoC.

It can be used as pcie-phy, usb3-phy, sata-phy or sgmii-phy.

16 months agogrowfs(7): clarify assumptions and limitations
Mike Karels [Thu, 5 Jan 2023 13:15:21 +0000 (07:15 -0600)]
growfs(7): clarify assumptions and limitations

Document that the growfs(7) script works only if the root file system
is in the last partition and free space immediately follows it.
Don't imply that /usr can be a separate partition, as that would
likely mean that root is not last.

Reported by: marklmi at yahoo dot com

16 months agoamd64 pmap.h: make it easier to use the header for other consumers
Konstantin Belousov [Wed, 4 Jan 2023 10:31:16 +0000 (12:31 +0200)]
amd64 pmap.h: make it easier to use the header for other consumers

Guard pmap_invlpg() definition with checks that only provide it when
both sys/pcpu.h and machine/cpufunc.h were already included.

Requested by: Elliott Mitchell
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

16 months agoamd64: be more precise when enabling the AlderLake small core PCID workaround
Konstantin Belousov [Tue, 3 Jan 2023 10:13:07 +0000 (12:13 +0200)]
amd64: be more precise when enabling the AlderLake small core PCID workaround

In particular, do not enable the workaround if INVPCID is not supported
by the core.

Reported by: "Chen, Alvin W" <Weike.Chen@Dell.com>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37940

16 months agopkgbase: Do record dependency on non-existent libelftc package
Emmanuel Vadot [Thu, 5 Jan 2023 22:38:14 +0000 (23:38 +0100)]
pkgbase: Do record dependency on non-existent libelftc package

libelftc is an internal lib so it's never installed.
When building with WITH_MANSPLITPKG=yes the libelftc-man package
will have a dependecy on a non-existent libelftc package.

Sponsored by: Beckhoff Automation GmbH & Co. KG

16 months agopkgbase: Do not record dependency on non-existent libcompat package
Emmanuel Vadot [Thu, 5 Jan 2023 22:27:22 +0000 (23:27 +0100)]
pkgbase: Do not record dependency on non-existent libcompat package

libcompat only provides a .a which is put in the -dev package.
Add a special record for it so we do not require a dependency on the
non-existent package FreeBSD-libcompat.

Sponsored by: Beckhoff Automation GmbH & Co. KG

16 months agotcp/ipfw: fix "ipfw fwd localaddr,port"
Gleb Smirnoff [Thu, 5 Jan 2023 22:34:50 +0000 (14:34 -0800)]
tcp/ipfw: fix "ipfw fwd localaddr,port"

The ipfw(4) feature of forwarding to local address without modifying
a packet was broken.  The first lookup needs always be a non-wildcard
one, cause its goal is to find an already existing socket.  Otherwise
a local wildcard listener with the same port number may match resulting
in the connection being forwared to wrong port.

Reported by: Pavel Polyakov <bsd kobyla.org>
Fixes: d88eb4654f372d0451139a1dbf525a8f2cad1cf8

16 months agobsd-family-tree: add DragonFly 6.4.0
Sergey A. Osokin [Thu, 5 Jan 2023 21:36:57 +0000 (16:36 -0500)]
bsd-family-tree: add DragonFly 6.4.0

MFC after: 3 days

16 months agorack and bbr not loading if TCP_RATELIMIT is not configured.
Randall Stewart [Thu, 5 Jan 2023 16:59:21 +0000 (11:59 -0500)]
rack and bbr not loading if TCP_RATELIMIT is not configured.

So it turns out that rack and bbr still will not load without TCP_RATELIMIT. This needs
to be fixed and lets also at the same time bring tcp_ratelimit up to date where we allow
the transports to set a divisor (though still having a default path with the default
divisor of 1000) for setting the burst size.

Reviewed by: tuexen, gallatin
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D37954

16 months agoloader.efi: make sure kernel image is executable
Robert Clausecker [Mon, 2 Jan 2023 21:12:50 +0000 (22:12 +0100)]
loader.efi: make sure kernel image is executable

The Windows Dev Kit 2023 (Volterra) has an UEFI implementation that maps
EfiLoaderData pages as non-executable.  Map the kernel as EfiLoaderCode
to ensure that it can be executed.

With this change and another in review, FreeBSD boots to the mountroot
prompt if hw.pac.enable = 0 is set in loader.conf(5).

Reviewed by: andrew, imp, tsoome
Sponsored by: Berliner Linux User Group e.V.
Sponsored by: spline / FU-Berlin
Differential Revision: https://reviews.freebsd.org/D37931

16 months agopwd_mkdb(8): Don't copy comments from /etc/master.passwd to /etc/passwd.
Andre Albsmeier [Thu, 11 Mar 2010 10:53:47 +0000 (11:53 +0100)]
pwd_mkdb(8): Don't copy comments from /etc/passwd to /etc/passwd.

The intention of /etc/passwd was to support legacy applications that are
not yet converted to use modern API like getpwent(3). Comments are not
defined in the legacy format, so copying them could break these
applications. Plus, it could leak sensitive information (e.g. encrypted
form of password of an user that was commented out instead of deleted
or disabled).

PR: bin/144652
MFC after: 1 month

16 months agoAdd PCIe driver for RK3568 SoC.
Søren Schmidt [Thu, 5 Jan 2023 04:15:56 +0000 (04:15 +0000)]
Add PCIe driver for RK3568 SoC.

PCIe3 ports work, however PCIe2x1 is not working yet in this case as it depends on Naneng Combo Phy driver.

17 months agortld: Revert "When loading dso without PT_GNU_STACK phdr, only call"
John Baldwin [Wed, 4 Jan 2023 22:55:00 +0000 (14:55 -0800)]
rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call"

After the removal of ia64 and sparc64, all current architectures
support executable stacks at an architectural level.

This reverts commit 1290d38ac50b3afa7e5781d9d97346a1042c736c.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D37904

17 months agoifnet: Expose if_t to userspace
Justin Hibbits [Wed, 4 Jan 2023 20:56:31 +0000 (15:56 -0500)]
ifnet: Expose if_t to userspace

<net/if_var.h> should be a kernel-only header, but it's included
elsewhere.  Until that's addressed expose if_t to userspace to fix the
build.

Fixes: be4315dcbb8
Sponsored by: Juniper Networks, Inc.

17 months agoifnet/DrvAPI: Move if_t typedef to a better place
Justin Hibbits [Wed, 21 Dec 2022 21:15:09 +0000 (16:15 -0500)]
ifnet/DrvAPI: Move if_t typedef to a better place

Summary:
<net/if_var.h> should really be used by the netstack only, not by
drivers.  Eventually all the accessors will be moved to <net/if.h> as
well, but for now just move the typedef while the KPI gets sorted and
drivers get converted.

Sponsored by: Juniper Networks, Inc.
Reviewed By: melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D37784

17 months agoifnet/DrvAPI: Implement if_setoutputfn() accessor
Justin Hibbits [Wed, 21 Dec 2022 21:42:42 +0000 (16:42 -0500)]
ifnet/DrvAPI: Implement if_setoutputfn() accessor

Fixes: eb1da3e5258238e1c0555c6a006a341df0821d8e
Sponsored by: Juniper Networks, Inc.

17 months agogrowfs script: fix config-dependent errors
Mike Karels [Wed, 4 Jan 2023 18:25:54 +0000 (12:25 -0600)]
growfs script: fix config-dependent errors

- awk sometimes formatted swapbase as floating point, which gpart
  does not accept; force int.

- Fix typo in code for checking vm.max_swap_pages.

- While here, do not set kernel env if "gpart add" fails.

- Add "gpart show" before modification to verbose output.

Reported by: marklmi at yahoo dot com
Tested by: marklmi at yahoo dot com

17 months agoAdd Windows Dev Kit 2023 support to if_ure
Andrew Turner [Wed, 4 Jan 2023 13:23:59 +0000 (13:23 +0000)]
Add Windows Dev Kit 2023 support to if_ure

The Windows Dev Kit 2023 has an if_ure NIC with custom vendor and
procuct IDs. Add them to the driver.

Tested by: Robert Clausecker <fuz@fuz.su>
Obtained from: OpenBSD
Sponsored by: Arm Ltd

17 months agoCheck for more XHCI ACPI IDs
Andrew Turner [Wed, 4 Jan 2023 12:33:08 +0000 (12:33 +0000)]
Check for more XHCI ACPI IDs

The Windows Dev Kit 2023 uses the XHCI-compliant USB controller without
standard debug ID in its ACPI tables. Check for both ID values found
on [1] in the XHCI ACPI attachment.

[1] https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/device-management-namespace-objects

Tested by: Robert Clausecker <fuz@fuz.su>
Sponsored by: Arm Ltd

17 months agoatomic: Make atomic_san.h self-contained
Mark Johnston [Wed, 4 Jan 2023 02:47:52 +0000 (10:47 +0800)]
atomic: Make atomic_san.h self-contained

This file assumes that uint*_t and __typeof() are defined, so ensure
that consumers don't have to pull in the requisite includes themselves.
This is consistent with sys/atomic_common.h.

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

17 months agogrep: properly switch EOL indicator with -z
Kyle Evans [Wed, 4 Jan 2023 05:21:10 +0000 (23:21 -0600)]
grep: properly switch EOL indicator with -z

-z is supposed to use only the NUL byte as EOL, but we were
inadvertently using both newline and NUL due to REG_NEWLINE in cflags.

The odds of anyone relying on this bsdgrep-specific bug are quite low,
so let's just fix it.  At least one port in the wild has been reported
to expect the intended behavior.

Reported by: Hill Ma <maahiuzeon@gmail.com>
Triaged by: the self-proclaimed peanut gallery on Discord

17 months agowdatwd: fix i386 build breakage.
Takanori Watanabe [Tue, 3 Jan 2023 23:30:32 +0000 (08:30 +0900)]
wdatwd: fix i386 build breakage.

Formatting string for uint64_t has portablity issue and
lead bulid breakage, so fix it.

Reviewed by hrs
Differential Revision: https://reviews.freebsd.org/D37937

17 months agoCirrus-CI: add `gpart show` to setup script
Ed Maste [Sun, 1 Jan 2023 18:58:56 +0000 (13:58 -0500)]
Cirrus-CI: add `gpart show` to setup script

GCP instances have stopped resizing the UFS root filesystem.  The 14.x
snapshot image built from b1ef176eb528 works while c89209c674f2 fails.
Discovered via testing a WIP branch in Cirrus-CI that uses
`image: family/freebsd-14-0-snap`.

Add `gpart show` to the setup script to confirm that the partition
size (as set by Cirrus config / GCP) took effect and to help when
investigating any similar issue in the future.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

17 months agowdatwd: Add support for ACPI WDAT based watchdog timer.
Takanori Watanabe [Tue, 3 Jan 2023 15:16:36 +0000 (00:16 +0900)]
wdatwd: Add support for ACPI WDAT based watchdog timer.

Simply said, WDAT is an abstraction for the real WDT hardware. For
instance, to add a newer generation WDT to ichwd(4), one must know the
detailed hardware registers, etc..

With WDAT, the necessary IO accesses to operate the WDT are comprehensively
described in it and no hardware knowledge is required.

With this driver, the WDT on Advantech ARK-1124C, Dell R210 and Dell R240 are
detected and operated flawlessly.
* While R210 is also supported by ichwd(4), others are not supported yet.

The unfortunate thing is that not all systems have WDAT defined.

Submitted by: t_uemura at macome.co.jp
Reviewed by: hrs
Differential Revision: https://reviews.freebsd.org/D37493

17 months agobeinstall.sh: Check correct exit status
Joseph Mingrone [Mon, 19 Dec 2022 04:07:11 +0000 (00:07 -0400)]
beinstall.sh: Check correct exit status

When retrieving the timestamp of the last commit using git-show(1), do
not pipe the output to head(1), otherwise the return value in $? will be
for head(1) and not git-show(1).

Approved by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37742

17 months agoifcapnv: fix IFCAP2 usage
Konstantin Belousov [Fri, 23 Dec 2022 17:30:11 +0000 (19:30 +0200)]
ifcapnv: fix IFCAP2 usage

IFCAP2_XXX constants are integers, they do not need shift for the
definition.  But their usage as bitmask for if_capenable2 does require
shift.  Add convenience macro IFCAP2_BIT() for consumers.

Fix the only existing consumer, mlx5(4) RXTLS enable bits.

Reported by: jhb
Reviewed by: jhb, jhibbits, hselasky
Coverity CID: 1501659
Sponsored by: NVIDIA networking
Differential revision: https://reviews.freebsd.org/D37862

17 months agostress2: Added a regression test
Peter Holm [Tue, 3 Jan 2023 09:34:00 +0000 (10:34 +0100)]
stress2: Added a regression test

17 months agoextres/phy: Add mode setting function.
Michal Meloun [Wed, 3 Feb 2021 08:51:45 +0000 (09:51 +0100)]
extres/phy: Add mode setting function.

Modern multi-protocol phys are capable of supporting multiple different
protocols. Add a method for mode (and/or its variants) setting.

Discused with: ganbold, manu, andrew
MFC after: 3 weeks

17 months agosyslog: fix PID of forking process
Eugene Grosbein [Tue, 3 Jan 2023 08:53:47 +0000 (15:53 +0700)]
syslog: fix PID of forking process

Do not cache PID for a process that does not fabricate it,
calls openlog() before forking and does not call exec() thereafter.

PR: 268666
Fixes: e9ae9fa93745669b7dd0341d333257ad6cfe8e37
Tested by: kp
MFC after: 3 days

17 months agolinuxkpi: Define `lockdep_assert_none_held_once()`
Jean-Sébastien Pédron [Fri, 30 Dec 2022 09:50:02 +0000 (10:50 +0100)]
linuxkpi: Define `lockdep_assert_none_held_once()`

This is defined as a no-op even when INVARIANTS is defined. I admit I
don't know how to implement that in FreeBSD and didn't search
thoroughly.

Reviewed by: bz
Approved by: bz
Differential Revision: https://reviews.freebsd.org/D37911

17 months agolinuxkpi: Include `errno.h` from `acpi/video.h`
Jean-Sébastien Pédron [Fri, 30 Dec 2022 09:48:01 +0000 (10:48 +0100)]
linuxkpi: Include `errno.h` from `acpi/video.h`

This defines `ENODEV` used in this header. This fixes a build failure in
the DRM drivers.

Reviewed by: bz
Approved by: bz
Differential Revision: https://reviews.freebsd.org/D37909

17 months agonetwork.subr: Fix infinite loop
Cy Schubert [Wed, 14 Dec 2022 21:41:10 +0000 (13:41 -0800)]
network.subr: Fix infinite loop

When setting up carp tunnel, using a password consisting of only the
characters used as hexadecimal characters, i.e. abc-def, there will be
an infinite loop in the shell function ifalias_af_common_handler().
To circumvent this we test for " pass ".

PR: 268378
Reported by: jyoung15@gmail.com
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37748

17 months agonetwork.subr: Add missing brace
Cy Schubert [Wed, 14 Dec 2022 21:36:23 +0000 (13:36 -0800)]
network.subr: Add missing brace

PR: 268378
Submitted by: jyoung15@gmail.com
Reported by: jyoung15@gmail.com
MFC after: 3 days

17 months agonetwork.subr: Replace "\ " with "[[:space:]]"
Cy Schubert [Wed, 21 Dec 2022 16:06:02 +0000 (08:06 -0800)]
network.subr: Replace "\ " with "[[:space:]]"

"[[:space:]]" is easier to read than "\ " and is conisitent with
clone_up().

Reported by: eugen
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D37748

17 months agounzip: Document optional member list
Yoshihiro Takahashi [Mon, 2 Jan 2023 04:17:27 +0000 (13:17 +0900)]
unzip: Document optional member list

Submitted by: Pat Maddox (man page)
PR: 267426
MFC after: 2 weeks

17 months agoFix vop_readdir's ncookies handling in UFS and EXT2.
Kirk McKusick [Mon, 2 Jan 2023 03:29:43 +0000 (19:29 -0800)]
Fix vop_readdir's ncookies handling in UFS and EXT2.

Submitted by: Kusumi Tomohiro
PR:           267706
MFC after:    1 week

17 months agoping(8): man page cleanup
Jose Luis Duran [Sun, 20 Nov 2022 02:56:49 +0000 (23:56 -0300)]
ping(8): man page cleanup

* Appease mandoc -T lint and igor

* Use example.com for documentation

* Update the IPv4 TTL section.
  Update the IPv4 TTL section specifically for FreeBSD.
  FreeBSD changed the default TTL to 64 in
  5639e86bdd7ea151958776264bf5a67e60a54d68.  NetBSD and OpenBSD still
  use 255.  Remove some references of extinct operating systems.

Reviewed by: gbe (manpages), asomers
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/630

17 months agomp[rs].4: correct spelling error, and expand "man page"
Ceri Davies [Sun, 1 Jan 2023 16:49:51 +0000 (16:49 +0000)]
mp[rs].4: correct spelling error, and expand "man page"
PR: 262957
Reported by: Trond Endrestol
Reviewed by: pauamma

17 months agompt.4: correct spelling error
Ceri Davies [Sun, 1 Jan 2023 16:49:22 +0000 (16:49 +0000)]
mpt.4: correct spelling error

17 months agotesting: add python test examples
Alexander V. Chernikov [Sun, 1 Jan 2023 14:35:41 +0000 (14:35 +0000)]
testing: add python test examples

Simplify the adoption of python tests by proving some examples,
 utilising commonly-used patterns.

Differential Revision: https://reviews.freebsd.org/D37902
Reviewed by: asomers
MFC after: 2 weeks

17 months agotesting: fix tests without cleanup in pytest.
Alexander V. Chernikov [Sun, 1 Jan 2023 14:11:18 +0000 (14:11 +0000)]
testing: fix tests without cleanup in pytest.

It was broken by 89ffac3b01fb3f6749799ac67b7d94056a36778e,
which added "cleanup" method to the base test class,
 resulting in reporting cleanup for all of the tests.

17 months agoUpdate the SPDX header to preferred BSD-2-Clause
Li-Wen Hsu [Sun, 1 Jan 2023 10:33:40 +0000 (18:33 +0800)]
Update the SPDX header to preferred BSD-2-Clause

Discussed with: imp, bcr

17 months agosyslog(3): expand a commentary adding a reference to RFC 3164.
Eugene Grosbein [Sun, 1 Jan 2023 08:26:30 +0000 (15:26 +0700)]
syslog(3): expand a commentary adding a reference to RFC 3164.

17 months agoHappy New Year 2023!
Li-Wen Hsu [Sun, 1 Jan 2023 05:44:43 +0000 (13:44 +0800)]
Happy New Year 2023!

Sponsored by: The FreeBSD Foundation

17 months agoMFV: xz 5.4.0
Xin LI [Sun, 1 Jan 2023 04:25:17 +0000 (20:25 -0800)]
MFV: xz 5.4.0

MFC after: 2 weeks

17 months agoVendor import of xz 5.4.0 (trimmed)
Xin LI [Sun, 1 Jan 2023 04:23:22 +0000 (20:23 -0800)]
Vendor import of xz 5.4.0 (trimmed)

17 months agoMove INVLPG to pmap_quick_enter_page() from pmap_quick_remove_page().
Konstantin Belousov [Thu, 29 Dec 2022 20:48:51 +0000 (22:48 +0200)]
Move INVLPG to pmap_quick_enter_page() from pmap_quick_remove_page().

If processor prefetches neighboring TLB entries to the one being accessed
(as some have been reported to do), then the spin lock does not prevent
the situation described in the "AMD64 Architecture Programmer's Manual
Volume 2: System Programming" rev. 3.23, "7.3.1 Special Coherency
Considerations".

Reported and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37770

17 months agoamd64: for small cores, use (big hammer) INVPCID_CTXGLOB instead of INVLPG
Konstantin Belousov [Mon, 10 Oct 2022 23:08:55 +0000 (02:08 +0300)]
amd64: for small cores, use (big hammer) INVPCID_CTXGLOB instead of INVLPG

A hypothetical CPU bug makes invalidation of global PTEs using INVLPG
in pcid mode unreliable, it seems.  The workaround is applied for all
CPUs with small cores, since we do not know the scope of the issue, and
the right fix.

Reviewed by: alc (previous version)
Discussed with: emaste, markj
Tested by: karels
PR: 261169, 266145
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37770

17 months agoamd64: identify small cores
Konstantin Belousov [Wed, 21 Dec 2022 11:04:14 +0000 (13:04 +0200)]
amd64: identify small cores

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

17 months agotesting: allow custom test cleanup handlers in pytest
Alexander V. Chernikov [Sat, 31 Dec 2022 16:22:30 +0000 (16:22 +0000)]
testing: allow custom test cleanup handlers in pytest

In order to provide more flexibility for the test writers,
add per-test-method cleanups in addition to the per-class cleanups.

Now the test 'test_one' can perform cleanup by either defining
per-class 'cleanup' method (typically used in VNET classes) and
per-test method 'cleanup_test_one'. The latter has preference.
In order to handle paramatrization, testid is passed as a single
 argument to both of the methods.

MFC after: 2 weeks

17 months agonetmap: bridge: fix -Wdate-time compilation issue
Vincenzo Maffione [Sat, 31 Dec 2022 14:56:02 +0000 (14:56 +0000)]
netmap: bridge: fix -Wdate-time compilation issue

MFC after: 3 days

17 months agoLinuxKPI: pm.h add pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS
Bjoern A. Zeeb [Mon, 28 Nov 2022 22:31:28 +0000 (22:31 +0000)]
LinuxKPI: pm.h add pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS

Extend pm.h by pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS().
For the moment this duplicates some parts (as can be seen in the earlier
review I tried to simplify bits but given our implementation this
was easier in the end).

While here and cleanup the SIMPLE_DEV_PM_OPS() bits (white-space only).

MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D37527

17 months agoLinuxKPI: add simplified vesion of page_frag_cache
Bjoern A. Zeeb [Sat, 3 Dec 2022 00:33:34 +0000 (00:33 +0000)]
LinuxKPI: add simplified vesion of page_frag_cache

For the moment and the currently only consumer (mt76) add a simplified
version of the page_frag_cache.  We will only accept fragement sizes up
to 1 PAGE_SIZE (KASSERT) and we will always return a full page.
Should we add more consumers or small (or large) objects would become a
problem we can always add a more elaborate version.

Discussed with: markj
Reviewed by: markj (,hselasky commented as well)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37595

17 months agoLinuxKPI: 802.11: move ieee80211_{unregister,restart}_hw out of header
Bjoern A. Zeeb [Sat, 31 Dec 2022 02:24:23 +0000 (02:24 +0000)]
LinuxKPI: 802.11: move ieee80211_{unregister,restart}_hw out of header

Migrate the two functions from the header into the implementation file
in order to have access to more facilities and not to run into possible
allocation/locking/... problems in the future.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

17 months agoLinuxKPI; 802.11: update mac80211.h structures and fields
Bjoern A. Zeeb [Sat, 31 Dec 2022 02:15:28 +0000 (02:15 +0000)]
LinuxKPI; 802.11: update mac80211.h structures and fields

Cleanup some fields and structures and add new ones.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

17 months agoLinuxKPI: 802.11: implement ieee80211_get_hdrlen_from_skb()
Bjoern A. Zeeb [Sat, 31 Dec 2022 02:02:01 +0000 (02:02 +0000)]
LinuxKPI: 802.11: implement ieee80211_get_hdrlen_from_skb()

Implement ieee80211_get_hdrlen_from_skb() doing basic sanity checks
on lengths (minimal length or skb data length vs. header length).

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

17 months agoLinuxKPI: 802.11: implement cfg80211_get_ies_channel_number()
Bjoern A. Zeeb [Sat, 31 Dec 2022 01:59:20 +0000 (01:59 +0000)]
LinuxKPI: 802.11: implement cfg80211_get_ies_channel_number()

Using the previous changes implement cfg80211_get_ies_channel_number()
either based on DSPARMS (or for the future HTINFO).

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

17 months agoLinuxKPI: 802.11: implement some *eleme/ie* lookup functions
Bjoern A. Zeeb [Sat, 31 Dec 2022 01:33:28 +0000 (01:33 +0000)]
LinuxKPI: 802.11: implement some *eleme/ie* lookup functions

Implement cfg80211_find_elem(), ieee80211_bss_get_elem(),
ieee80211_bss_get_ie(), and cfg80211_find_vendor_ie() with the last
one having a short cut always also checking oui_type in the pattern.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

17 months agoLinuxKPI: 802.11: implement cfg80211_{get,put}_bss
Bjoern A. Zeeb [Sat, 31 Dec 2022 01:18:16 +0000 (01:18 +0000)]
LinuxKPI: 802.11: implement cfg80211_{get,put}_bss

Implement cfg80211_{get,put}_bss currently doing malloc/free bits,
so hopefully the drivers get the calls right.

cfg80211_get_bss() sets up a lookup structure which may also take a
result (first hit wins) and calls ieee80211_scan_iterate() comparing
the various values in the iterator funcion.  Some of the checks are
partially pointless (as it seems the drivers are not interested in
these parts [ANY] but we keep them for documentation purposes should
futher values arise in the future).

We currently only iterate over the first VAP which will do for now.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

17 months agoLinuxKPI: 802.11: set sta supported legacy rates
Bjoern A. Zeeb [Sat, 31 Dec 2022 00:33:34 +0000 (00:33 +0000)]
LinuxKPI: 802.11: set sta supported legacy rates

When initializing the sta set the per-band supported legacy rates
as some drivers take the information from there.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

17 months agorouting: add missed RIB_WUNLOCK in the add_route_flags().
Alexander V. Chernikov [Fri, 30 Dec 2022 15:54:06 +0000 (15:54 +0000)]
routing: add missed RIB_WUNLOCK in the add_route_flags().

MFC after: 2 weeks

17 months agohidraw(4): Drop unneeded usb kernel module dependency
Vladimir Kondratyev [Fri, 30 Dec 2022 15:04:24 +0000 (18:04 +0300)]
hidraw(4): Drop unneeded usb kernel module dependency

HID is not a part of usb subsystem for a while.

MFC after: 2 weeks

17 months agoUFSSUSPEND: unbusy mp in EDADLK case
Konstantin Belousov [Thu, 29 Dec 2022 22:09:57 +0000 (00:09 +0200)]
UFSSUSPEND: unbusy mp in EDADLK case

Reported and tested by: pho
Fixes: 701b36961cbd2084c36eb828402d0ef89211d929
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

17 months agoufs/suspend: deny suspension if the calling process has a file from mp opened for...
Konstantin Belousov [Wed, 28 Dec 2022 18:14:52 +0000 (20:14 +0200)]
ufs/suspend: deny suspension if the calling process has a file from mp opened for write

Also deny suspension if we cannot check the above condition race-free
because there is more than one thread in the calling process.

PR: 267628, 267630
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37896

17 months agoffs_suspend.c: clean up includes
Konstantin Belousov [Wed, 28 Dec 2022 18:17:53 +0000 (20:17 +0200)]
ffs_suspend.c: clean up includes

Order includes alphabetically.
Remove unneeded sys/param.h, it is already included by sys/systm.h.

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

17 months agoAdd descrip_check_write_mp() helper
Konstantin Belousov [Wed, 28 Dec 2022 18:13:01 +0000 (20:13 +0200)]
Add descrip_check_write_mp() helper

... which verifies that given file table does not have file descriptors
referencing vnodes on the specified mount point.  It is up to the caller
to ensure that the check is not racy.

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

17 months agoFollow the standard object definition from RFC2578
Shteryana Shopova [Thu, 29 Dec 2022 19:52:46 +0000 (21:52 +0200)]
Follow the standard object definition from RFC2578
Use mib-2 throughout the files where applicable

PR: 254231
Reported by: Michael Proto
Reviewed by: bz (at) FreeBSD (dot) org

17 months agotesting: improve python vnet wrapper.
Alexander V. Chernikov [Thu, 29 Dec 2022 19:07:34 +0000 (19:07 +0000)]
testing: improve python vnet wrapper.

* Derive jail name from class name and method name, instead of just
method name. This change reduces the chances of different tests
clashing.
 Old: 'jail_test_one'. New: 'pytest:TestExampleSimplest:test_one'
* Simplify vnetX_handler() method signature by skipping obj_map (unused)
 and pipe. The latter can be accessed as the vnet property.
* Add `send_object()` method as a pair to the `wait_object` inside the
 VnetTestTemplate class.
* Add `test_id` property to the BaseTest method. Previously it was
 provided only for the VnetTestTemplate class. This change makes
 the identifier easily accessible for all users.

MFC after: 2 weeks

17 months agoccr: Retire ccr_softc member in struct adapter.
John Baldwin [Thu, 29 Dec 2022 19:39:28 +0000 (11:39 -0800)]
ccr: Retire ccr_softc member in struct adapter.

Prior to Conrad's changes to replace session integer IDs with a
pointer to the driver-specific state in commit 1b0909d51a8aa, the
driver had to find the softc pointer from the adapter before it could
locate the ccr_session structure for a completed request.  Since
Conrad's changes, the ccr_session pointer can now be obtained directly
from the crp.  Add a backpoint from ccr_session back to ccr_softc and
use this in place of the ccr_softc member in cxgbe's struct adapter.

Sponsored by: Chelsio Communications

17 months agonewsyslog.conf: Minor formatting fix
David E. O'Brien [Thu, 29 Dec 2022 00:26:51 +0000 (16:26 -0800)]
newsyslog.conf: Minor formatting fix

17 months agonewsyslog.conf: Sort paths
David E. O'Brien [Thu, 29 Dec 2022 00:23:41 +0000 (16:23 -0800)]
newsyslog.conf: Sort paths

17 months agorc.subr: Minor formatting fix for ac102a2a6
David E. O'Brien [Thu, 29 Dec 2022 00:00:56 +0000 (16:00 -0800)]
rc.subr: Minor formatting fix for ac102a2a6

17 months agoRestricting xargs to '-n1' is much slower and isn't needed for file(1)
David E. O'Brien [Wed, 28 Dec 2022 23:49:21 +0000 (15:49 -0800)]
Restricting xargs to '-n1' is much slower and isn't needed for file(1)

Also note that libc.so.6 is an older version of libc (thus why you'd
want to find files linked against it).

17 months agovfs: add vn_getsize
Mateusz Guzik [Thu, 22 Sep 2022 13:55:49 +0000 (13:55 +0000)]
vfs: add vn_getsize

getattr is very expensive and in important cases only gets called to get
the size. This can be optimized with a dedicated routine which obtains
that statistic.

As a step towards that goal make size-only consumers use a dedicated
routine.

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

17 months agoAdd site.{autodep,gendirdeps}.mk
Simon J. Gerraty [Wed, 28 Dec 2022 20:39:08 +0000 (12:39 -0800)]
Add site.{autodep,gendirdeps}.mk

Allow for site customization to minimize churn in share/mk

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

17 months agoh_resolv: Fix a buffer overflow in load().
John Baldwin [Wed, 28 Dec 2022 17:39:18 +0000 (09:39 -0800)]
h_resolv: Fix a buffer overflow in load().

fgetln() returns a pointer to an array of characters that is 'len'
characters long, not 'len + 1'.  While here, overwriting the contents
of the buffer returned by fgetln isn't really safe, so switch to using
getline() instead.

Note that these fixes are a subset of those applied to a
near-identical copy of this function in libc's resolv_test.c in commit
2afeaad315ac19450389b8f2befdbe7c91c37818.

Reviewed by: ngie
Reported by: CHERI (buffer overflow)
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D37886

17 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

17 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

17 months agoGEOM: Remove redundant NULL pointer check before g_free()
Zhenlei Huang [Wed, 28 Dec 2022 15:34:09 +0000 (23:34 +0800)]
GEOM: Remove redundant NULL pointer check before g_free()

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

17 months agowg: Use NET_EPOCH_DRAIN_CALLBACKS macro
Zhenlei Huang [Wed, 28 Dec 2022 15:28:15 +0000 (23:28 +0800)]
wg: Use NET_EPOCH_DRAIN_CALLBACKS macro

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

17 months agoImprove and make it more general Rockchip USB2PHY driver.
Søren Schmidt [Wed, 28 Dec 2022 03:48:48 +0000 (03:48 +0000)]
Improve and make it more general Rockchip USB2PHY driver.

Add support for Rockchip RK3568.

17 months agoSet RK3568 specific pin mux for GMAC1.
Søren Schmidt [Wed, 28 Dec 2022 03:00:19 +0000 (03:00 +0000)]
Set RK3568 specific pin mux for GMAC1.

17 months agoAdd eqos device to Rockchip specific config.
Ganbold Tsagaankhuu [Wed, 28 Dec 2022 02:32:06 +0000 (02:32 +0000)]
Add eqos device to Rockchip specific config.