]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
21 months agocontrib/tzdata: import tzdata 2022b
Philip Paeps [Thu, 11 Aug 2022 02:48:24 +0000 (10:48 +0800)]
contrib/tzdata: import tzdata 2022b

Changes: https://github.com/eggert/tz/blob/2022b/NEWS

MFC after: 3 days

21 months agoImport tzdata 2022b
Philip Paeps [Thu, 11 Aug 2022 02:23:48 +0000 (10:23 +0800)]
Import tzdata 2022b

21 months agoacpi: mark INVARIANTS variables as __diagused
Ed Maste [Wed, 10 Aug 2022 00:39:28 +0000 (20:39 -0400)]
acpi: mark INVARIANTS variables as __diagused

Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

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

21 months agorouting: fix build without ROUTE_MPATH
Alexander V. Chernikov [Wed, 10 Aug 2022 20:44:43 +0000 (20:44 +0000)]
routing: fix build without ROUTE_MPATH

MFC after: 1 month

21 months agosdio: Add CCCR speed defines
Emmanuel Vadot [Wed, 14 Jul 2021 15:25:36 +0000 (17:25 +0200)]
sdio: Add CCCR speed defines

Those are the defines needed to change speed on a SDIO card.

21 months agosdio: Do not allow setting a block size if function doesn't support it
Emmanuel Vadot [Wed, 26 May 2021 11:15:58 +0000 (13:15 +0200)]
sdio: Do not allow setting a block size if function doesn't support it

21 months agosdio: Always use increment address for read/write_4
Emmanuel Vadot [Fri, 21 May 2021 11:33:34 +0000 (13:33 +0200)]
sdio: Always use increment address for read/write_4

SDIO CMD53 (RW Extented) can either write to the same address (useful for FIFO)
or auto increment the destination address (to write to multiple registers).
It is more logical to have read/write_4 to use incremental mode and make other
helper function for writing to a FIFO destination especially since most FIFO
write/read will be 8bits based and not 32bits based.

21 months agosdio: Change the sdio helper name and arg order
Emmanuel Vadot [Fri, 21 May 2021 09:56:39 +0000 (11:56 +0200)]
sdio: Change the sdio helper name and arg order

Do not use b/l but _1/_4 also address comes first and then data.
This makes them closer to something like bus_space_{read,write}
We have no users in the tree.

21 months agoopencrypto: mark INVARIANTS variables as __diagused
Ed Maste [Tue, 9 Aug 2022 23:23:19 +0000 (19:23 -0400)]
opencrypto: mark INVARIANTS variables as __diagused

Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

21 months agodevd: move all devd notification logic to a separate file.
Alexander V. Chernikov [Tue, 9 Aug 2022 15:55:23 +0000 (15:55 +0000)]
devd: move all devd notification logic to a separate file.

Currently, subr_bus.c shares logic for (a) maintaining all HW devices
 (e.g. discovery/attach/detach logic) and (b) generic devctl notification
 layer for devices/PMU/GEOM/interfaces/etc).
These two subsystems share really tiny interaction interface, composed of 3
 notification functions. With that in mind, move devctl layer to a
 separate file, establishing a clear notification interface between the
 sub.c bus layer and the provider (devctl).

The primary driver of this change is netlink implementation (D36002).
The idea is to propagate device-level events to netlink as well, so all
 netlink customers can subscribe to these changes.
The long-term goal is to deprecate devctl and to use netlink as the
 kernel<> userland transport provided netlink gets enough traction.

Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D36091
MFC after: 1 month

21 months agorouting: move rtentry and subscription code out of route_ctl.c
Alexander V. Chernikov [Mon, 8 Aug 2022 13:54:17 +0000 (13:54 +0000)]
routing: move rtentry and subscription code out of route_ctl.c

route_ctl.c size has grown considerably since initial introduction.
Factor out non-relevant parts:
* all rtentry logic, such as creation/destruction and accessors
 goes to net/route/route_rtentry.c
* all rtable subscription logic goes to net/route/route_subscription.c

Differential Revision: https://reviews.freebsd.org/D36074
MFC after: 1 month

21 months agorouting: add rib_<add|del>_route_px() functions operating with nexthops.
Alexander V. Chernikov [Thu, 4 Aug 2022 14:55:30 +0000 (14:55 +0000)]
routing: add rib_<add|del>_route_px() functions operating with nexthops.

This change adds public KPI to work with routes using pre-created
 nexthops, instead of using data from addrinfo structures. These
 functions will be later used for adding/deleting kernel-originated
 routes and upcoming netlink protocol.

As a part of providing this KPI, low-level route addition code has been
 reworked to provide more control over route creation or change.
 Specifically, a number of operation flags
 (RTM_F_<CREATE|EXCL|REPLACE|APPEND>) have been added, defining the
 desired behaviour the the route already exists (or not exists). This
 change required some changes in the multipath addition code, resulting
 in moving this code to route_ctl.c, rendering mpath_ctl.c empty.

Differential Revision: https://reviews.freebsd.org/D36073
MFC after: 1 month

21 months agorouting: split nexthop creation and rtentry creation.
Alexander V. Chernikov [Thu, 4 Aug 2022 12:35:31 +0000 (12:35 +0000)]
routing: split nexthop creation and rtentry creation.

This change is required for the upcoming introduction of the next
 nexhop-based operations KPI, as it will create rtentry and nexthops
 at different stages of route table modification.

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

21 months agorouting: refactor #2
Alexander V. Chernikov [Wed, 3 Aug 2022 08:20:40 +0000 (08:20 +0000)]
routing: refactor #2

* Use same filter func (rib_filter_f_t) for nexhtop groups to
 simplify callbacks.
* simplify conditional route deletion & remove the need to pass
 rt_addrinfo to the low-level deletion functions
* speedup rib_walk_del() by removing an additional per-prefix lookup

Differential Revision: https://reviews.freebsd.org/D36071
MFC after: 1 month

21 months agorouting: refactor control cmds #1
Alexander V. Chernikov [Tue, 2 Aug 2022 12:44:20 +0000 (12:44 +0000)]
routing: refactor control cmds #1

This and the follow-up routing-related changes target to remove or
 reduce `struct rt_addrinfo` usage and use recently-landed nhop(9)
 KPI instead.
Traditionally `rt_addrinfo` structure has been used to propagate all necessary
information between the protocol/rtsock and a routing layer. Many
functions inside routing subsystem uses it internally. However, using
this structure became somewhat complicated, as there are too many ways
of specifying a single state and verifying data consistency is hard.
For example, arerouting flgs consistent with mask/gateway sockaddr pointers?
Is mask really a host mask? Are sockaddr "valid" (e.g. properly zeroed, masked,
have proper length)? Are they mutable? Is the suggested interface specified
 by the interface index embedded into the sockadd_dl gateway, or passed
 as RTAX_IFP parameter, or directly provided by rti_ifp or it needs to
 be derived from the ifa?
These (and other similar) questions have to be considered every time when
 a function has `rt_addrinfo` pointer as an argument.

The new approach is to bring more control back to the protocols and
construct the desired routing objects themselves - in the end, it's the
protocol/subsystem who knows the desired outcome.

This specific diff changes the following:
* add explicit basic low-level radix operations:
 add_route() (renamed from add_route_nhop())
 delete_route() (factored from change_route_nhop())
 change_route() (renamed from change_route_nhop)
* remove "info" parameter from change_route_conditional() as a part
 of reducing rt_addrinfo usage in the internal KPIs
* add lookup_prefix_rt() wrapper for doing re-lookups after
 RIB lock/unlock

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

21 months agotcp: utilize new solisten_clone() and solisten_enqueue()
Gleb Smirnoff [Wed, 10 Aug 2022 18:09:34 +0000 (11:09 -0700)]
tcp: utilize new solisten_clone() and solisten_enqueue()

This streamlines cloning of a socket from a listener.  Now we do not
drop the inpcb lock during creation of a new socket, do not do useless
state transitions, and put a fully initialized socket+inpcb+tcpcb into
the listen queue.

Before this change, first we would allocate the socket and inpcb+tcpcb via
tcp_usr_attach() as TCPS_CLOSED, link them into global list of pcbs, unlock
pcb and put this onto incomplete queue (see 6f3caa6d815).  Then, after
sonewconn() we would lock it again, transition into TCPS_SYN_RECEIVED,
insert into inpcb hash, finalize initialization of tcpcb.  And then, in
call into tcp_do_segment() and upon transition to TCPS_ESTABLISHED call
soisconnected().  This call would lock the listening socket once again
with a LOR protection sequence and then we would relocate the socket onto
the complete queue and only now it is ready for accept(2).

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D36064

21 months agosockets: provide solisten_clone(), solisten_enqueue()
Gleb Smirnoff [Wed, 10 Aug 2022 18:09:34 +0000 (11:09 -0700)]
sockets: provide solisten_clone(), solisten_enqueue()

as alternative KPI to sonewconn().  The latter has three stages:
- check the listening socket queue limits
- allocate a new socket
- call into protocol attach method
- link the new socket into the listen queue of the listening socket

The attach method, originally designed for a creation of socket by the
socket(2) syscall has slightly different semantics than attach of a socket
cloned by listener.  Make it possible for protocols to call into the
first stage, then perform a different attach, and then call into the
final stage.  The first stage, that checks limits and clones a socket
is called solisten_clone(), and the function that enqueues the socket
is solisten_enqueue().

Reviewed by: tuexen
Differential revision: https://reviews.freebsd.org/D36063

21 months agoinpcb: gather v4/v6 handling code into in_pcballoc() from protocols
Gleb Smirnoff [Wed, 10 Aug 2022 18:09:34 +0000 (11:09 -0700)]
inpcb: gather v4/v6 handling code into in_pcballoc() from protocols

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D36062

21 months agomodules: if_awg: Add miibus_if.h to the source
Emmanuel Vadot [Sun, 14 Nov 2021 19:53:10 +0000 (20:53 +0100)]
modules: if_awg: Add miibus_if.h to the source

Needed by the module.

21 months agomodules: aw_mmc: Add mmc_pwrseq_if to the source
Emmanuel Vadot [Sun, 14 Nov 2021 19:52:44 +0000 (20:52 +0100)]
modules: aw_mmc: Add mmc_pwrseq_if to the source

Needed by the module.

21 months agoarm64: rockchip: rk_gpio: Improve mode switching
Emmanuel Vadot [Wed, 22 Sep 2021 14:55:54 +0000 (16:55 +0200)]
arm64: rockchip: rk_gpio: Improve mode switching

Changing mode on a pin (input/output/pullup/pulldown) is a bit slow.
Improve this by caching what we can.
We need to check if the pin is in gpio mode, do that the first time
that we have a request for this pin and cache the result. We can't do
that at attach as we are a child of rk_pinctrl and it didn't finished
its attach then.
Cache also the flags specific to the pinctrl (pullup or pulldown) if the
pin is in input mode.
Cache the registers that deals with input/output mode and output value. Also
remove some register reads when we change the direction of a pin or when we
change the output value since the bit changed in the registers only affect output
pins.

21 months agoSimplify setting a non-4k PAGE_SIZE on arm64
Andrew Turner [Tue, 9 Aug 2022 15:15:56 +0000 (16:15 +0100)]
Simplify setting a non-4k PAGE_SIZE on arm64

Define PAGE_SIZE and PAGE_MASK based on PAGE_SHIFT. With this we only
need to set one value to change one value to change the page size.

While here remove the unused PAGE_MASK_* macros.

Sponsored by: The FreeBSD Foundation

21 months agogpio: mark INVARIANTS variables as __diagused
Ed Maste [Tue, 9 Aug 2022 23:30:13 +0000 (19:30 -0400)]
gpio: mark INVARIANTS variables as __diagused

Fixes INVARIANTS build with Clang 15, which previously failed due to
set-but-not-used variable warnings.

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

21 months agotcp: address a wire level race with 2 ACKs at the end of TCP handshake
Gleb Smirnoff [Wed, 10 Aug 2022 14:32:37 +0000 (07:32 -0700)]
tcp: address a wire level race with 2 ACKs at the end of TCP handshake

Imagine we are in SYN-RCVD state and two ACKs arrive at the same time,
both valid, e.g. coming from the same host and with valid sequence.

First packet would locate the listening socket in the inpcb database,
write-lock it and start expanding the syncache entry into a socket.
Meanwhile second packet would wait on the write lock of the listening
socket.  First packet will create a new ESTABLISHED socket, free the
syncache entry and unlock the listening socket.  Second packet would
call into syncache_expand(), but this time it will fail as there
is no syncache entry.  Second packet would generate RST, effectively
resetting the remote connection.

It seems to me, that it is impossible to solve this problem with
just rearranging locks, as the race happens at a wire level.

To solve the problem, for an ACK packet arrived on a listening socket,
that failed syncache lookup, perform a second non-wildcard lookup right
away.  That lookup may find the new born socket.  Otherwise, we indeed
send RST.

Tested by: kp
Reviewed by: tuexen, rrs
PR: 265154
Differential revision: https://reviews.freebsd.org/D36066

21 months agonetinet6: allow ND entries creation for all directly-reachable
Alexander V. Chernikov [Wed, 10 Aug 2022 11:51:58 +0000 (11:51 +0000)]
netinet6: allow ND entries creation for all directly-reachable
destinations.

The current assumption is that kernel-handled rtadv prefixes along with
 the interface address prefixes are the only prefixes considered in
 the ND neighbor eligibility code.
Change this by allowing any non-gatewaye routes to be eligible. This
 will allow DHCPv6-controlled routes to be correctly handled by
 the ND code.
Refactor nd6_is_new_addr_neighbor() to enable more deterministic
 performance in "found" case and remove non-needed
 V_rt_add_addr_allfibs handling logic.

Reviewed By: kbowling
Differential Revision: https://reviews.freebsd.org/D23695
MFC after: 1 month

21 months agoarm64: rockchip: pinctrl: Do not rely on the node name
Emmanuel Vadot [Wed, 10 Aug 2022 13:47:22 +0000 (15:47 +0200)]
arm64: rockchip: pinctrl: Do not rely on the node name

Node names for gpio bank were made generic in Linux 5.16 so stop
using them to map the gpio controller to the pin controller bank unit.

Sponsored by: Beckhoff Automation GmbH & Co. KG

21 months agoImport device-tree files from Linux 5.18
Emmanuel Vadot [Wed, 10 Aug 2022 12:32:46 +0000 (14:32 +0200)]
Import device-tree files from Linux 5.18

Sponsored by:   Beckhoff Automation GmbH & Co. KG

21 months agoImport device-tree files from Linux 5.18
Emmanuel Vadot [Wed, 10 Aug 2022 12:31:09 +0000 (14:31 +0200)]
Import device-tree files from Linux 5.18

21 months agoImport device-tree files from Linux 5.17
Emmanuel Vadot [Wed, 10 Aug 2022 12:29:43 +0000 (14:29 +0200)]
Import device-tree files from Linux 5.17

Sponsored by:   Beckhoff Automation GmbH & Co. KG

21 months agoImport device-tree files from Linux 5.17
Emmanuel Vadot [Wed, 10 Aug 2022 12:28:38 +0000 (14:28 +0200)]
Import device-tree files from Linux 5.17

21 months agoImport device-tree files from Linux 5.16
Emmanuel Vadot [Wed, 10 Aug 2022 12:27:16 +0000 (14:27 +0200)]
Import device-tree files from Linux 5.16

Sponsored by:   Beckhoff Automation GmbH & Co. KG

21 months agoImport device-tree files from Linux 5.16
Emmanuel Vadot [Wed, 10 Aug 2022 12:25:35 +0000 (14:25 +0200)]
Import device-tree files from Linux 5.16

21 months agoImport device-tree files from Linux 5.15
Emmanuel Vadot [Wed, 10 Aug 2022 12:21:52 +0000 (14:21 +0200)]
Import device-tree files from Linux 5.15

Sponsored by: Beckhoff Automation GmbH & Co. KG

21 months agoImport device-tree files from Linux 5.15
Emmanuel Vadot [Wed, 10 Aug 2022 12:20:33 +0000 (14:20 +0200)]
Import device-tree files from Linux 5.15

21 months agoImport device-tree files from Linux 5.14
Emmanuel Vadot [Wed, 10 Aug 2022 12:11:47 +0000 (14:11 +0200)]
Import device-tree files from Linux 5.14

21 months agoImport device-tree files from Linux 5.14
Emmanuel Vadot [Wed, 10 Aug 2022 12:05:33 +0000 (14:05 +0200)]
Import device-tree files from Linux 5.14

21 months agotcp: improve BBLog for output events when using the FreeBSD stack
Michael Tuexen [Mon, 8 Aug 2022 11:07:10 +0000 (13:07 +0200)]
tcp: improve BBLog for output events when using the FreeBSD stack

Put the return value of ip_output()/ip6_output in the output event
instead of adding another one in case of an error. This improves
consistency with other similar places.

Reviewed by: rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D36085

21 months agosctp: improve handling of send() calls with no user data`
Michael Tuexen [Mon, 8 Aug 2022 10:53:42 +0000 (12:53 +0200)]
sctp: improve handling of send() calls with no user data`

In particular, don't report EAGAIN on send() calls with no user
data, which might trigger a KASSERT in asyc IO.

Reported by: syzbot+3b4dc5d1d63e9bd01eda@syzkaller.appspotmail.com
MFC after: 1 week

21 months agoarc4random(3): Reduce diff with OpenBSD.
Xin LI [Wed, 10 Aug 2022 00:27:54 +0000 (17:27 -0700)]
arc4random(3): Reduce diff with OpenBSD.

The main change was v1.57 by djm@:

  Randomise the rekey interval a little. Previously, the chacha20
  instance would be rekeyed every 1.6MB. This makes it happen at a
  random point somewhere in the 1-2MB range.

Reviewed by: csprng (markm, cem)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36088

21 months agotests: Add more shared shadow regression tests
Mark Johnston [Tue, 9 Aug 2022 20:17:56 +0000 (16:17 -0400)]
tests: Add more shared shadow regression tests

The new tests exercise simulated COW that occurs when the protections on
a wired, copy-on-write mapping are changed from read-only to read-write.

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

21 months agoatomic: Add plain atomic_load/store_bool()
Mark Johnston [Tue, 9 Aug 2022 20:08:29 +0000 (16:08 -0400)]
atomic: Add plain atomic_load/store_bool()

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

21 months agodtrace/amd64: Implement emulation of call instructions
Mark Johnston [Tue, 9 Aug 2022 20:08:13 +0000 (16:08 -0400)]
dtrace/amd64: Implement emulation of call instructions

Here, the provider is responsible for updating the trapframe to redirect
control flow and for computing the return address.  Once software-saved
registers are restored, the emulation shifts the remaining context down
on the stack to make space for the return address, then copies the
address provided by the invop handler.  dtrace_invop() is modified to
allocate temporary storage space on the stack for use by the provider to
return the return address.

This is to support a new provider for amd64 which can instrument
arbitrary instructions, not just function entry and exit instructions as
FBT does.

In collaboration with: christos
Sponsored by: Google, Inc. (GSoC 2022)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

21 months agofbt/x86: Extract arg1 for return probes from the trapframe
Mark Johnston [Tue, 9 Aug 2022 20:08:09 +0000 (16:08 -0400)]
fbt/x86: Extract arg1 for return probes from the trapframe

dtrace invop handlers have access to the whole trapframe, just use that
to extract %rax/%eax for return probes instead of relying on an
additional parameter to the handler.  No functional change intended.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

21 months agorelease: Include an etcupdate tree in -DNO_ROOT release image builds
Jessica Clarke [Tue, 9 Aug 2022 21:58:01 +0000 (22:58 +0100)]
release: Include an etcupdate tree in -DNO_ROOT release image builds

This makes use of the new -N etcupdate flag and merges the resulting
METALOG into base.meta re-rooted to /var/db/etcupdate/current.

Reviewed by: gjb
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35858

21 months agoetcupdate: Add a -N flag to perform a NO_ROOT build
Jessica Clarke [Tue, 9 Aug 2022 21:57:47 +0000 (22:57 +0100)]
etcupdate: Add a -N flag to perform a NO_ROOT build

This is in preparation for including an etcupdate tree when performing a
-DNO_ROOT release image build. Although -DNO_ROOT can be passed via -M,
to be useful we need to mangle the resulting METALOG to mirror the
various cleanups to the tree that are done after the build (removing
generated files, empty files and empty directories), so etcupdate needs
its own flag.

Reviewed by: jhb, pauamma
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35857

21 months agoetcupdate: Prefer POSIX -depth to BSD -d
Jessica Clarke [Tue, 9 Aug 2022 21:57:22 +0000 (22:57 +0100)]
etcupdate: Prefer POSIX -depth to BSD -d

This is in preparation for building an etcupdate tree on non-FreeBSD
when building release images. The -d option is documented as a
BSD-specific equivalent to the POSIX -depth primary. Whilst GNU find
sort of accepts it in an attempt to be compatible, it still doesn't
permit it coming before the paths, unlike BSD find, and prints a
deprecation warning either way. Thus, use the equivalent POSIX -depth to
ensure it works correctly and without warning everywhere.

Reviewed by: jhb
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35856

21 months agorelease: Forward ${MAKE} to etcupdate via the new -m flag
Jessica Clarke [Tue, 9 Aug 2022 21:57:01 +0000 (22:57 +0100)]
release: Forward ${MAKE} to etcupdate via the new -m flag

This is in preparation for non-FreeBSD builds where make is GNU make and
so etcupdate needs to know the name of or path to the bmake binary to
use for its own builds.

Reviewed by: gjb
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35855

21 months agoetcupdate: Add a -m flag to change the make binary that's run
Jessica Clarke [Tue, 9 Aug 2022 21:56:19 +0000 (22:56 +0100)]
etcupdate: Add a -m flag to change the make binary that's run

This will allow release/Makefile to forward on ${MAKE} to allow building
on non-FreeBSD systems where ${MAKE} is something other than make, as
make is typically GNU make in such situations.

Reviewed by: jhb, pauamma
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35854

21 months agorelease: Use in-tree etcupdate for build
Jessica Clarke [Tue, 9 Aug 2022 21:52:47 +0000 (22:52 +0100)]
release: Use in-tree etcupdate for build

This is in preparation for non-FreeBSD and -DNO_ROOT builds. On
non-FreeBSD there is no host etcupdate to use, and -DNO_ROOT will
require additional flags that may not be supported by the host's
etcupdate when building on FreeBSD. Moreover, there's no guarantee
anyway that the host's etcupdate is quite right for the current tree;
upgrading from source only requires that the host's is good enough for
-p which just manually copies master.passwd and group, the rest of the
upgrade is done post-installworld. For example, should a new set of
autogenerated files be added that etcupdate is taught about, the host
won't know about them and so the bootstrapped current tree will
incorrectly contain them, leading to spurious diffs on the installed
system.

Reviewed by: gjb, delphij
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D35853

21 months agovm_fault: Shoot down shared mappings in vm_fault_copy_entry()
Mark Johnston [Mon, 25 Jul 2022 20:53:21 +0000 (16:53 -0400)]
vm_fault: Shoot down shared mappings in vm_fault_copy_entry()

As in vm_fault_cow(), it's possible, albeit rare, for multiple vm_maps
to share a shadow object.  When copying a page from a backing object
into the shadow, all mappings of the source page must therefore be
removed.  Otherwise, future operations on the object tree may detect
that the source page is fully shadowed and thus can be freed.

Approved by: so
Security: FreeBSD-SA-22:11.vm
Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35635

21 months agoelf_note_prpsinfo: handle more failures from proc_getargv()
Konstantin Belousov [Fri, 3 Jun 2022 08:21:23 +0000 (11:21 +0300)]
elf_note_prpsinfo: handle more failures from proc_getargv()

Resulting sbuf_len() from proc_getargv() might return 0 if user mangled
ps_strings enough. Also, sbuf_len() API contract is to return -1 if the
buffer overflowed. The later should not occur because get_ps_strings()
checks for catenated length, but check for this subtle detail explicitly
as well to be more resilent.

The end result is that p_comm is used in this situations.

Approved by: so
Security: FreeBSD-SA-22:09.elf
Reported by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: delphij, markj
admbugs: 988
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35391

21 months agorelease: ensure enforce_chs sysctl is 0
Ed Maste [Tue, 19 Jul 2022 20:47:49 +0000 (16:47 -0400)]
release: ensure enforce_chs sysctl is 0

We do not want CHS-based alignment for VM or SD card release images.

(Other images use makefs/mkimg, not kernel gpart and so do not depend
on this sysctl.)

Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
MFC after: 1 week

21 months agoAdd "heard" to the dictionary
Ed Maste [Mon, 8 Aug 2022 18:57:32 +0000 (14:57 -0400)]
Add "heard" to the dictionary

PR: 265671
Reported by: J.R. Oldroyd
MFC after: 3 days

21 months agoAdd the PHY driver for the Marvell 88E1512.
Luiz Souza [Fri, 29 Jul 2022 15:43:56 +0000 (17:43 +0200)]
Add the PHY driver for the Marvell 88E1512.

This driver supports the auto negotiation mode between the copper and fiber
ports.

This PHY has two independent PHYs (one for copper and other for fiber) but in
this case the functionality is presented as a single PHY for easy management.

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

21 months agoif_ovpn tests: remote access test case
Kristof Provost [Thu, 28 Jul 2022 09:55:53 +0000 (11:55 +0200)]
if_ovpn tests: remote access test case

Add a (multi-client) test case where we route traffic beyond the ovpn
server, onto a shared LAN.

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

21 months agonetinet tests: Add test for IPv6 mapped-v4 bind problem
Mike Karels [Tue, 9 Aug 2022 12:08:09 +0000 (07:08 -0500)]
netinet tests: Add test for IPv6 mapped-v4 bind problem

Test fix in 637f317c6d9c, verifying that when ports run out, we get
an EADDRNOTAVAIL error from bind() rather than an EADDRINUSE error
from connect().  Use small port range to exhaust ports and see which
error happens.

Reviewed by: tuexen, glebius, melifaro
Differential Revision: https://reviews.freebsd.org/D36056
MFC after: 3 days (with 637f317c6d9c)

21 months agolibpathconv: bump man page dates
Gordon Bergling [Tue, 9 Aug 2022 08:05:31 +0000 (10:05 +0200)]
libpathconv: bump man page dates

- bump the man page dates to the date of mandoc fixes

Reported by: rpokala
X-MFC with: 094517119c62c23369d545a7475ae982d86330a3

21 months agox86: Remove redundant parentheses
Emmanuel Vadot [Tue, 9 Aug 2022 07:46:50 +0000 (09:46 +0200)]
x86: Remove redundant parentheses

Reported by: avg
Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 1 week
MFC-With: b223c1f1a0ac ("x86: Add another cpuid for Apollo Lake errata APL30")

21 months agox86: Add another cpuid for Apollo Lake errata APL30
Corvin Köhne [Tue, 9 Aug 2022 07:07:59 +0000 (09:07 +0200)]
x86: Add another cpuid for Apollo Lake errata APL30

Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 1 week

21 months agosyslog(3): unbreak log generation using fabricated PID
Eugene Grosbein [Mon, 8 Aug 2022 22:21:02 +0000 (05:21 +0700)]
syslog(3): unbreak log generation using fabricated PID

Recover application ability to supply fabricated PID
embedded into ident that was lost when libc switched
to generation of RFC 5424 log messages, for example:

logger -t "ident[$$]" -p user.notice "test"

It is essential for long running scripts.
Also, this change unbreaks matching resulted entries
by ident in syslog.conf:

!ident
*.* /var/log/ident.log

Without the fix, the log (and matching) was broken:

Aug  1 07:36:58 hostname ident[123][86483]: test

Now it works as expected and worked before breakage:

Aug  1 07:39:40 hostname ident[123]: test

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

21 months agotests/socket: add accept_filter(9) test
Gleb Smirnoff [Mon, 8 Aug 2022 21:10:18 +0000 (14:10 -0700)]
tests/socket: add accept_filter(9) test

Test basic functionality of accf_data(9) and accf_http(9)

21 months agoapply: clean up error handling.
Dag-Erling Smørgrav [Mon, 8 Aug 2022 19:06:35 +0000 (19:06 +0000)]
apply: clean up error handling.

Sponsored by: Klara, Inc.

21 months agolinuxkpi: io.h: Only exclude armv6 and armv7 for asm/set_memory.h
Emmanuel Vadot [Mon, 8 Aug 2022 18:21:08 +0000 (20:21 +0200)]
linuxkpi: io.h: Only exclude armv6 and armv7 for asm/set_memory.h

Other arches like powerpc* needs it.

Fixes: d387a1b4b1996 ("linuxkpi: io.h: Do not include asm/set_memory.h for armv6 and armv7")
Fixes: 789dbdbb48574 ("linuxkpi: Add arch_io_{reserve,free}_memtype_wc")
Sponsored by: Beckhoff Automation GmbH & Co. KG

21 months agoktls_test: Add a require_toe option similar to require_ifnet.
John Baldwin [Mon, 8 Aug 2022 18:21:54 +0000 (11:21 -0700)]
ktls_test: Add a require_toe option similar to require_ifnet.

This skips tests that send and receive records that do not use TOE TLS.

Sponsored by: Chelsio Communications

21 months agocxgbe TOE TLS: Fix handling of unusual record types.
John Baldwin [Mon, 8 Aug 2022 18:21:54 +0000 (11:21 -0700)]
cxgbe TOE TLS: Fix handling of unusual record types.

This doesn't matter for real traffic but fixes failures in the KTLS
unit tests that use unusual record types.

Sponsored by: Chelsio Communications

21 months agocxgbe TOE TLS: Simplify a few routines.
John Baldwin [Mon, 8 Aug 2022 18:21:54 +0000 (11:21 -0700)]
cxgbe TOE TLS: Simplify a few routines.

Remove a few more remnants from the old pre-KTLS support and instead
assume that each work request sends a single TLS record.

Sponsored by: Chelsio Communications

21 months agocxgbe: Handle requests for TLS key allocations with no TLS key storage.
John Baldwin [Mon, 8 Aug 2022 18:21:54 +0000 (11:21 -0700)]
cxgbe: Handle requests for TLS key allocations with no TLS key storage.

If an adapter advertises support for TLS keys but an empty TLS key
storage area in on-board memory, fail the request rather than invoking
vmem_alloc on an uninitialized vmem.

Sponsored by: Chelsio Communications

21 months agocxgbe: Rename t4_kern_tls.c to t6_kern_tls.c.
John Baldwin [Mon, 8 Aug 2022 18:21:53 +0000 (11:21 -0700)]
cxgbe: Rename t4_kern_tls.c to t6_kern_tls.c.

This implementation of NIC TLS is specific to T6 adapters.

Sponsored by: Chelsio Communications

21 months agozlib: Fix extra field processing bug that dereferences NULL state->head.
Mark Adler [Mon, 8 Aug 2022 17:50:09 +0000 (10:50 -0700)]
zlib: Fix extra field processing bug that dereferences NULL state->head.

The recent commit to fix a gzip header extra field processing bug
introduced the new bug fixed here.

(cherry picked from zlib commit 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d)

21 months agolinuxkpi: io.h: Do not include asm/set_memory.h for armv6 and armv7
Emmanuel Vadot [Mon, 8 Aug 2022 16:54:23 +0000 (18:54 +0200)]
linuxkpi: io.h: Do not include asm/set_memory.h for armv6 and armv7

They do not have the same pmap api and this cannot work for those arch.

Fixes: 789dbdbb48574 ("linuxkpi: Add arch_io_{reserve,free}_memtype_wc")
Sponsored by: Beckhoff Automation GmbH & Co. KG

21 months agoMerge libcxxrt commit 5d8a15823a103bbc27f1bfdcf2b5aa008fab57dd
Mark Johnston [Mon, 8 Aug 2022 16:30:56 +0000 (12:30 -0400)]
Merge libcxxrt commit 5d8a15823a103bbc27f1bfdcf2b5aa008fab57dd

  Fix two bugs in __cxa_end_cleanup()

  Per the EHABI32 specification, __cxa_end_cleanup must take care to
  preserve registers before calling _Unwind_Resume().  So, libcxxrt uses
  an assembly stub which preserves caller-saved registers around the call
  to __cxa_get_cleanup().  But:
  - it failed to restore them properly,
  - it did not preserve the link register.

  Fix both of these problems.  This is needed to fix exception unwinding
  on FreeBSD with LLVM 14.  Note that r4 is callee-saved but is pushed
  onto the stack to preserve stack pointer alignment.

Sponsored-by: The FreeBSD Foundation
MFC after: 1 week

21 months agolib9p: Remove potential buffer overwrite in l9p_puqids()
Konrad Sewiłło-Jopek [Mon, 8 Aug 2022 16:25:48 +0000 (12:25 -0400)]
lib9p: Remove potential buffer overwrite in l9p_puqids()

Structure l9p_f_wralk reserves at most L9P_MAX_WELEM entries
and that number actually set the maximum we can safely use.

PR: 265385
Reviewed by: markj
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D35907

21 months agothread_create(): call cpu_copy_thread() after td_pflags is zeroed
Konstantin Belousov [Sun, 7 Aug 2022 17:00:02 +0000 (20:00 +0300)]
thread_create(): call cpu_copy_thread() after td_pflags is zeroed

By calling the function too early we might still have the td_pflags
value cached from the previous struct thread use. cpu_copy_thread()
depends on correct value for TDP_KTHREAD at least on x86.

Reported, bisected, and tested by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D36069

21 months agopf: stop resolving hosts as dns that use ":" modifier
Franco Fichtner [Mon, 8 Aug 2022 16:31:02 +0000 (18:31 +0200)]
pf: stop resolving hosts as dns that use ":" modifier

When the interface does not exist avoid passing host with special pf
modifiers to DNS resolution as they come up empty anyway.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35429

21 months agorelease: fix alignment for arm SoCs
Glen Barber [Mon, 8 Aug 2022 14:59:29 +0000 (10:59 -0400)]
release: fix alignment for arm SoCs

MFC after: 3 days
Submitted by: Mark Millard
Sponsored by: Rubicon Communications, LLC ("Netgate")

21 months agoBump __FreeBSD_version after linuxkpi changes.
Emmanuel Vadot [Mon, 8 Aug 2022 13:22:11 +0000 (15:22 +0200)]
Bump __FreeBSD_version after linuxkpi changes.

21 months agolinuxkpi: pm: Add more defines and includes
Emmanuel Vadot [Tue, 2 Aug 2022 08:49:13 +0000 (10:49 +0200)]
linuxkpi: pm: Add more defines and includes

Needed by drm-kmod.

Reviewed By: emaste, hselasky
Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36024

21 months agolinuxkpi: Include highmem.h in pagemap.h
Emmanuel Vadot [Tue, 2 Aug 2022 08:42:46 +0000 (10:42 +0200)]
linuxkpi: Include highmem.h in pagemap.h

Linux does the same.

Reviewed by: bz, emaste, hselasky
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36023

21 months agolinuxkpi: Add arch_io_{reserve,free}_memtype_wc
Emmanuel Vadot [Tue, 2 Aug 2022 08:27:00 +0000 (10:27 +0200)]
linuxkpi: Add arch_io_{reserve,free}_memtype_wc

Reviewed by: hselasky
Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36022

21 months agolinuxkpi: Add dev_info_once
Emmanuel Vadot [Tue, 2 Aug 2022 08:22:59 +0000 (10:22 +0200)]
linuxkpi: Add dev_info_once

Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36021

21 months agolinuxkpi: Add smp_mb__before/after_atomic
Emmanuel Vadot [Tue, 2 Aug 2022 08:08:33 +0000 (10:08 +0200)]
linuxkpi: Add smp_mb__before/after_atomic

Reviewed by: hselasky
Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36020

21 months agolinuxkpi: Add trylock_page and unlock_page
Emmanuel Vadot [Tue, 2 Aug 2022 07:33:47 +0000 (09:33 +0200)]
linuxkpi: Add trylock_page and unlock_page

Simple wrapper around vm_page_trylock and vm_page_unlock.

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

21 months agolinuxkpi: Add more notifier defines
Emmanuel Vadot [Wed, 27 Jul 2022 07:55:06 +0000 (09:55 +0200)]
linuxkpi: Add more notifier defines

Needded by drm-kmod.

Reviewed by: bz, emaste, hselasky
Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36018

21 months agolinuxkpi: errno: Add EHWPOISON
Emmanuel Vadot [Wed, 27 Jul 2022 07:50:25 +0000 (09:50 +0200)]
linuxkpi: errno: Add EHWPOISON

Needed by drm-kmod.

Reviewed by: bz, hselasky
Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36017

21 months agolinuxkpi: Add compat_ptr and ptr_to_compat
Emmanuel Vadot [Wed, 27 Jul 2022 07:48:32 +0000 (09:48 +0200)]
linuxkpi: Add compat_ptr and ptr_to_compat

Needed by drm-kmod.

Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36016

21 months agolinuxkpi: Add try_cmpxchg and atomic_try_cmpxchg
Emmanuel Vadot [Wed, 27 Jul 2022 07:41:04 +0000 (09:41 +0200)]
linuxkpi: Add try_cmpxchg and atomic_try_cmpxchg

Needed by drm-kmod

Obtain from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36015

21 months agolinuxkpi: Add some memset functions
Emmanuel Vadot [Tue, 26 Jul 2022 09:28:11 +0000 (11:28 +0200)]
linuxkpi: Add some memset functions

Needed by drm-kmod

Obtained from: OpenBSD
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35943

21 months agolinuxkpi: Add io.h
Emmanuel Vadot [Tue, 26 Jul 2022 08:15:45 +0000 (10:15 +0200)]
linuxkpi: Add io.h

out* arguments are different on Linux and the i915 driver uses them.

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

21 months agolinuxkpi: Add pagevec implementation
Emmanuel Vadot [Tue, 26 Jul 2022 08:15:12 +0000 (10:15 +0200)]
linuxkpi: Add pagevec implementation

Needed by drm-kmod.

Reviewed by: hselasky
Obtained from: OpenBSD
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35941

21 months agolinuxkpi: Add linux/nospec.h
Emmanuel Vadot [Tue, 26 Jul 2022 08:13:49 +0000 (10:13 +0200)]
linuxkpi: Add linux/nospec.h

Needed by drm-kmod.

Reviewed by: hselasky
Obtained from: OpenBSD
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35940

21 months agolinuxkpi: Add mapping_clear_unevictable stub
Emmanuel Vadot [Tue, 26 Jul 2022 08:13:16 +0000 (10:13 +0200)]
linuxkpi: Add mapping_clear_unevictable stub

Reviewed by: hselasky
Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35939

21 months agolinuxkpi: pci: Add more functions needed by drm
Emmanuel Vadot [Tue, 26 Jul 2022 08:07:39 +0000 (10:07 +0200)]
linuxkpi: pci: Add more functions needed by drm

Mostly stubs to satisfy building

Reviewed by: hselasky
Obtained from: drm-kmod
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35938

21 months agolinuxkpi: math.h: Add mul_u64_u32_div and mul_u64_u32_shr
Emmanuel Vadot [Tue, 26 Jul 2022 08:06:56 +0000 (10:06 +0200)]
linuxkpi: math.h: Add mul_u64_u32_div and mul_u64_u32_shr

Needed by drm-kmod.

Reviewed by: hselasky
Obtained from: OpenBSD
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35937

21 months agolinuxkpi: atomic: Add atomic_fetch_inc
Emmanuel Vadot [Tue, 26 Jul 2022 08:00:42 +0000 (10:00 +0200)]
linuxkpi: atomic: Add atomic_fetch_inc

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

21 months agopfctl tests: test case for the POM_STICKYADDRESS fix
Kristof Provost [Mon, 8 Aug 2022 07:30:42 +0000 (09:30 +0200)]
pfctl tests: test case for the POM_STICKYADDRESS fix

In 1e73fbd8b we fixed an issue with POM_STICKYADDRESS being checked in
the wrong struct.
Add a basic test case for this fix.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

21 months agoAdd drive strength setting for RK3568 pinctrl driver.
Ganbold Tsagaankhuu [Mon, 8 Aug 2022 04:42:22 +0000 (04:42 +0000)]
Add drive strength setting for RK3568 pinctrl driver.
Partially from https://reviews.freebsd.org/D36027

Submitted by: sos

21 months agortw88: correct a typo in man page
Andres Ramirez [Sun, 7 Aug 2022 23:06:28 +0000 (23:06 +0000)]
rtw88: correct a typo in man page

s/mmeory/memory/

MFC after: 1 week

21 months agoXHCI: remove a self-assignment
Bjoern A. Zeeb [Sun, 7 Aug 2022 22:46:55 +0000 (22:46 +0000)]
XHCI: remove a self-assignment

x = x is an unneeded operation, remove it.
The value is read and assigned above for real.

MFC after: 4 weeks

21 months agotests: add routing tests for switching between same prefixes
Alexander V. Chernikov [Sat, 6 Aug 2022 10:36:12 +0000 (10:36 +0000)]
tests: add routing tests for switching between same prefixes

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

21 months agotree.3: explain RB_FIND() and RB_NFIND()
Konstantin Belousov [Mon, 1 Aug 2022 09:43:10 +0000 (12:43 +0300)]
tree.3: explain RB_FIND() and RB_NFIND()

In collaboration with: dougm
Reviewed by: alc
Sponsored by: The FreeBSD Foundation (kib)
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D36001