]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agobridge tests: Basic span test
Kristof Provost [Mon, 16 Mar 2020 08:44:46 +0000 (08:44 +0000)]
bridge tests: Basic span test

Reviewed by: philip, emaste (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23961

(cherry picked from commit bb490fcf195450d9cbbac00e6338b352aac32c5c)

3 years agobridge test: adding and removing static addresses
Kristof Provost [Tue, 10 Mar 2020 06:29:59 +0000 (06:29 +0000)]
bridge test: adding and removing static addresses

Reviewed by: philip
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23960

(cherry picked from commit d99bb677c1cf43b22e91d54c49a8b7f0592e6fce)

3 years agobridge test: spanning tree
Kristof Provost [Tue, 10 Mar 2020 06:28:45 +0000 (06:28 +0000)]
bridge test: spanning tree

Basic test case where we create a bridge loop, verify that we really are
looping and then enable spanning tree to resolve the loop.

Reviewed by: philip
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23959

(cherry picked from commit 6f0a65b080aac1b3144c7489b020b26b345d1a1b)

3 years agobridge tests: Remove unneeded 'All rights reserved.'
Kristof Provost [Wed, 19 Feb 2020 16:44:16 +0000 (16:44 +0000)]
bridge tests: Remove unneeded 'All rights reserved.'

The FreeBSD foundation no longer requires this, as per
https://lists.freebsd.org/pipermail/svn-src-all/2019-February/177215.html and
private communications.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit e3c73f3d74c77b2c168519b10bdb6910a84287ef)

3 years agobridge: Basic test case
Kristof Provost [Sun, 16 Feb 2020 13:16:40 +0000 (13:16 +0000)]
bridge: Basic test case

Very basic bridge test: Set up two jails and test that they can pass IPv4
traffic over the bridge.

Reviewed by: melifaro, philip
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23697

(cherry picked from commit 095aabf7dc814ae96d83bc5327a4b1f2e23be419)

3 years agobridge/stp: Ensure we enter NET_EPOCH whenever we can send traffic
Kristof Provost [Sun, 21 Feb 2021 20:18:46 +0000 (21:18 +0100)]
bridge/stp: Ensure we enter NET_EPOCH whenever we can send traffic

Reviewed by: donner@
MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28858

(cherry picked from commit 89fa9c34d76bbf85cd7cda60c1868f5e3dba4ec7)

3 years agoarp/nd: Cope with late calls to iflladdr_event
Kristof Provost [Mon, 22 Feb 2021 07:19:43 +0000 (08:19 +0100)]
arp/nd: Cope with late calls to iflladdr_event

When tearing down vnet jails we can move an if_bridge out (as
part of the normal vnet_if_return()). This can, when it's clearing out
its list of member interfaces, change its link layer address.
That sends an iflladdr_event, but at that point we've already freed the
AF_INET/AF_INET6 if_afdata pointers.

In other words: when the iflladdr_event callbacks fire we can't assume
that ifp->if_afdata[AF_INET] will be set.

Reviewed by: donner@, melifaro@
MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28860

(cherry picked from commit c139b3c19b52abe3b5ba23a8175e58e70c7a528d)

3 years agobridge: Remove members when assigned to a new vnet
Kristof Provost [Sun, 21 Feb 2021 20:20:32 +0000 (21:20 +0100)]
bridge: Remove members when assigned to a new vnet

When the bridge is moved to a different vnet we must remove all of its
member interfaces (and span interfaces), because we don't know if those
will be moved along with it. We don't want to hold references to
interfaces not in our vnet.

Reviewed by: donner@
MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28859

(cherry picked from commit 38c0951386d82f4c51cf4e245253cdef18d2254a)

3 years agobridge: Support STP on VLAN devices
Kristof Provost [Sat, 20 Feb 2021 09:11:30 +0000 (10:11 +0100)]
bridge: Support STP on VLAN devices

VLAN devices have type IFT_L2VLAN, so the STP code mistakenly believed
they couldn't be used for STP. That's not the case, so add the
ITF_L2VLAN to the check.

Reviewed by: donner@
MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D28857

(cherry picked from commit 711ed156b94562c3dcb2ee9c1b3f240f960a75d2)

3 years agoBump CTL block backend threads from 14 to 32 per LUN.
Alexander Motin [Tue, 23 Feb 2021 15:58:56 +0000 (10:58 -0500)]
Bump CTL block backend threads from 14 to 32 per LUN.

This makes random read benchmarks look better on a wide ZFS pools.
I am not sure where the original value goes from, but it is there
for too long now.

MFC after: 1 week

(cherry picked from commit 7d4c444374d53e54ce197138df64bf40c1fb05a3)

3 years agopmap: Fix largemap restart checks in the kernel_maps sysctl handler
Mark Johnston [Thu, 25 Feb 2021 23:49:47 +0000 (18:49 -0500)]
pmap: Fix largemap restart checks in the kernel_maps sysctl handler

The purpose of these checks is to ensure that the address of the
next-level page table page is valid, since nothing is synchronizing with
a concurrent update of the large map and large map PTPs are freed to the
system.  However, if PG_PS is set, there is no next level.

Reported by: rpokala
Reviewed by: kib
Tested by: rpokala
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28922

(cherry picked from commit aac25e222525780db8939d07a594d3e090c0a148)

3 years agopf: Fix incorrect fragment handling
Kristof Provost [Thu, 25 Feb 2021 07:07:36 +0000 (08:07 +0100)]
pf: Fix incorrect fragment handling

A sequence of overlapping IPv4 fragments could crash the kernel in
pf due to an assertion.

Reported by: Alexander Bluhm
Obtained from: OpenBSD
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5f1b1f184b7f12330cf4a027e3db7c6700c67640)

3 years agopf: Fix build if INVARIANTS is not set
Kristof Provost [Fri, 2 Nov 2018 19:23:50 +0000 (19:23 +0000)]
pf: Fix build if INVARIANTS is not set

r340061 included a number of assertions pf_frent_remove(), but these assertions
were the only use of the 'prev' variable. As a result builds without
INVARIANTS had an unused variable, and failed.

Reported by: vangyzen@

(cherry picked from commit 58ef854f8b05508f41aff3bdaf1564c8dd4c1d4f)

3 years agopf: Limit the fragment entry queue length to 64 per bucket.
Kristof Provost [Fri, 2 Nov 2018 15:32:04 +0000 (15:32 +0000)]
pf: Limit the fragment entry queue length to 64 per bucket.

So we have a global limit of 1024 fragments, but it is fine grained to
the region of the packet.  Smaller packets may have less fragments.
This costs another 16 bytes of memory per reassembly and devides the
worst case for searching by 8.

Obtained from: OpenBSD
Differential Revision: https://reviews.freebsd.org/D17734

(cherry picked from commit 790194cd472b1d17e08940e9f839322abcf14ec9)

3 years agopf: Split the fragment reassembly queue into smaller parts
Kristof Provost [Fri, 2 Nov 2018 15:26:51 +0000 (15:26 +0000)]
pf: Split the fragment reassembly queue into smaller parts

Remember 16 entry points based on the fragment offset.  Instead of
a worst case of 8196 list traversals we now check a maximum of 512
list entries or 16 array elements.

Obtained from: OpenBSD
Differential Revision: https://reviews.freebsd.org/D17733

(cherry picked from commit fd2ea405e601bd5e240153c5de0f7c264946ce6f)

3 years agopf: Count holes rather than fragments for reassembly
Kristof Provost [Fri, 2 Nov 2018 15:23:57 +0000 (15:23 +0000)]
pf: Count holes rather than fragments for reassembly

Avoid traversing the list of fragment entris to check whether the
pf(4) reassembly is complete.  Instead count the holes that are
created when inserting a fragment.  If there are no holes left, the
fragments are continuous.

Obtained from: OpenBSD
Differential Revision: https://reviews.freebsd.org/D17732

(cherry picked from commit 2b1c354ee6fb075953d2c3e81c8221f4115ce981)

3 years agoRevert "pf: Limit the maximum number of fragments per packet"
Kristof Provost [Fri, 2 Nov 2018 15:01:59 +0000 (15:01 +0000)]
Revert "pf: Limit the maximum number of fragments per packet"

This reverts commit r337969.
We'll handle this the OpenBSD way, in upcoming commits.

(cherry picked from commit 19a22ae31328d9a960732a0904116c1b5566351b)

3 years agopwrite(2): add a BUGS section
Guangyuan Yang [Sat, 20 Feb 2021 08:03:15 +0000 (08:03 +0000)]
pwrite(2): add a BUGS section

Add a BUGS section about using pwrite(2) when O_APPEND is set on the fd.

Submitted by: Ka Ho Ng <khng300@gmail.com>
Reviewed by: gbe, yuripv
Differential Revision: https://reviews.freebsd.org/D28372

(cherry picked from commit 504e64af32ba6c62fdcc894a3b1da76061c64796)

3 years agonetgraph/ng_car: Add color marking code
Lutz Donnerhacke [Wed, 27 Jan 2021 20:19:14 +0000 (21:19 +0100)]
netgraph/ng_car: Add color marking code

Chained policing should be able to reuse the classification of
traffic.  A new mbuf_tag type is defined to handle gereral QoS
marking.  A new subtype is defined to track the color marking.

Reviewed by: manpages (bcr), melifaro, kp
Sponsored by: IKS Service GmbH
Differential Revision: https://reviews.freebsd.org/D22110

(cherry picked from commit d0d2e523bafb74180f8bebb90788790f0d2f0290)

3 years agoautomount(8): fix absolute path when creating a mountpoint
Robert Wing [Wed, 17 Feb 2021 09:22:23 +0000 (00:22 -0900)]
automount(8): fix absolute path when creating a mountpoint

When executing automount(8), it will attempt to create the directory where an
autofs filesystem is to be mounted. Explicity set the root path for this
directory to "/".

This fixes the issue where the directory being created was being treated as a
relative path instead of an absolute path (as expected).

PR:     224601
Reported by:    kusumi.tomohiro@gmail.com
Reviewed by:    trasz
Differential Revision:  https://reviews.freebsd.org/D27832

(cherry picked from commit 63640b2f552c0476f50484635eb9888eafcd22dc)

3 years agoSkip the vm.pmap.kernel_maps sysctl by default.
John Baldwin [Fri, 18 Dec 2020 20:41:23 +0000 (20:41 +0000)]
Skip the vm.pmap.kernel_maps sysctl by default.

This sysctl node can generate very verbose output, so don't trigger it
for sysctl -a or sysctl vm.pmap.

Reviewed by: markj, kib
Differential Revision: https://reviews.freebsd.org/D27504

(cherry picked from commit 1dce7d9e7eefead038610df6a8d6c86a0fdbebb8)

3 years agonetgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support
Neel Chauhan [Sun, 24 Jan 2021 19:23:39 +0000 (20:23 +0100)]
netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support

This extends upon the RFC 6598 support to libalias/ipfw in r357092.

Reviewed By: manpages (bcr), donner, adrian, kp
Differential Revision: https://reviews.freebsd.org/D23461

(cherry picked from commit 5fe433a6e4d8cab6b64284698301afc0c55a9db2)

3 years agonetgraph/ng_bridge: Add counters for the first link, too
Lutz Donnerhacke [Wed, 10 Feb 2021 10:47:38 +0000 (11:47 +0100)]
netgraph/ng_bridge: Add counters for the first link, too

For broadcast, multicast and unknown unicast, the replication loop
sends a copy of the packet to each link, beside the first one. This
special path is handled later, but the counters are not updated.
Factor out the common send and count actions as a function.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D28537

(cherry picked from commit 3c958f5fdfc01b7579ea0fbfc3f15f8a85bebee9)

3 years agonetgraph/ng_bridge: Document staleness in multithreaded operation
Lutz Donnerhacke [Tue, 9 Feb 2021 11:32:46 +0000 (12:32 +0100)]
netgraph/ng_bridge: Document staleness in multithreaded operation

In the data path of ng_bridge(4), the only value of the host struct,
which needs to be modified, is the staleness, which is reset every
time a frame is received.  It's save to leave the code as it is.

This patch is part of a series to make ng_bridge(4) multithreaded.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D28546

(cherry picked from commit 011b7317dbb5038a95b9b4fca050325a62f3991e)

3 years agonetgraph/ng_bridge: Merge internal structures
Lutz Donnerhacke [Thu, 25 Feb 2021 09:59:45 +0000 (10:59 +0100)]
netgraph/ng_bridge: Merge internal structures

In a earlier version of ng_bridge(4) the exernal visible host entry
structure was a strict subset of the internal one.  So internal view
was a direct annotation of the external structure.  This strict
inheritance was lost many versions ago.  There is no need to
encapsulate a part of the internal represntation as a separate
structure.

This patch is a preparation to make the internal structure read only
in the data path in order to make ng_bridge(4) multithreaded.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D28545

(cherry picked from commit ccf4cd2e7830394467d5f6cf546ab453f9657b69)

3 years agonetgraph/ng_bridge: Make simple internal functions read-only
Lutz Donnerhacke [Wed, 13 Jan 2021 22:18:55 +0000 (23:18 +0100)]
netgraph/ng_bridge: Make simple internal functions read-only

The data path in netgraph is designed to work on an read only state of
the whole netgraph network.  Currently this is achived by convention,
there is no technical enforcment.  In the case of NETGRAPH_DEBUG all
nodes can be annotated for debugging purposes, so the strict
enforcment needs to be lifted for this purpose.

This patch is part of a series to make ng_bridge multithreaded, which
is done by rewrite the data path to operate on const.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D28141

(cherry picked from commit 6117aa58fa4f5891badf58b13c759976983f4f04)

3 years agonetgraph/ng_bridge: switch stats to counter framework
Lutz Donnerhacke [Wed, 13 Jan 2021 06:16:34 +0000 (07:16 +0100)]
netgraph/ng_bridge: switch stats to counter framework

This is the first patch of a series of necessary steps
to make ng_bridge(4) multithreaded.

Reviewed by: melifaro (network), afedorov
Differential Revision: https://reviews.freebsd.org/D28125

(cherry picked from commit 66c72859f66dc6c852234589f3508ce5d36d0336)

3 years agonetgraph/ng_bridge: Derive forwarding mode from first attached hook
Lutz Donnerhacke [Sat, 6 Feb 2021 10:25:04 +0000 (11:25 +0100)]
netgraph/ng_bridge: Derive forwarding mode from first attached hook

Handling of unknown MACs on an bridge with incomplete learning
capabilites (aka uplink ports) can be defined in different ways.

The classical approach is to broadcast unicast frames send to an
unknown MAC, because the unknown devices can be everywhere. This mode
is default for ng_bridge(4).

In the case of dedicated uplink ports, which prohibit learning of MAC
addresses in order to save memory and CPU cycles, the broadcast
approach is dangerous. All traffic to the uplink port is broadcasted
to every downlink port, too. In this case, it's better to restrict the
distribution of frames to unknown MAC to the uplink ports only.

In order to keep the chance small and the handling as natural as
possible, the first attached link is used to determine the behaviour
of the bridge: If it is an "uplink" port, then the bridge switch from
classical mode to restricted mode.

Reviewed By: kp
Differential Revision: https://reviews.freebsd.org/D28487

(cherry picked from commit c869d905baa4e329dfd6793e7487b5985248ddb6)

3 years agonetgraph/ng_bridge: Introduce "uplink" ports without MAC learning
Lutz Donnerhacke [Sat, 6 Feb 2021 10:08:24 +0000 (11:08 +0100)]
netgraph/ng_bridge: Introduce "uplink" ports without MAC learning

The ng_bridge(4) node is designed to work in moderately small
environments. Connecting such a node to a larger network rapidly fills
the MAC table for no reason. It even become complicated to obtain data
from the gettable message, because the result is too large to
transmit.

This patch introduces, two new functionality bits on the hooks:
  - Allow or disallow MAC address learning for incoming patckets.
  - Allow or disallow sending unknown MACs through this hook.

Uplinks are characterized by denied learning while sending out
unknowns. Normal links are charaterized by allowed learning and
sending out unknowns.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D23963

(cherry picked from commit f961caf2184c94d6f59c8d522207156b3533d977)

3 years agonetgraph/ng_vlan_rotate: IEEE 802.1ad VLAN manipulation netgraph type
Lutz Donnerhacke [Tue, 26 Jan 2021 15:50:04 +0000 (16:50 +0100)]
netgraph/ng_vlan_rotate: IEEE 802.1ad VLAN manipulation netgraph type

This node is part of an A10-NSP (L2-BSA) development.

Carrier networks tend to stack three or more tags for internal
purposes and therefore hiding the service tags deep inside of the
stack. When decomposing such an access network frame, the processing
order is typically reversed: First distinguish by service, than by
other means.

This new netgragh node allows to bring the relevant VLAN in front (to
the out-most position). This way other netgraph nodes (like ng_vlan)
can operate on this specific type.

Reviewed by: manpages (gbe), brueffer (manpages), kp
Relnotes: yes
Sponsored by: IKS Service GmbH
Differential Revision: https://reviews.freebsd.org/D22076

(cherry picked from commit cfd6422a5217410fbd66f7a7a8a64d9d85e61229)

3 years agoether: add older ethertype definitions for QinQ
Philip Paeps [Thu, 17 Oct 2019 00:34:53 +0000 (00:34 +0000)]
ether: add older ethertype definitions for QinQ

Older network equipment used the ethertypes 0x9100, 0x9200, and 0x9300 for
outer VLANs, before standardisation introduced 0x88a8.

Submitted by:  Lutz Donnerhacke <lutz_donnerhacke.de>
Differential Revision: https://reviews.freebsd.org/D21846

(cherry picked from commit 579b70db8922b1debf3bd99bb2b822d60b95575d)

3 years agocxgb(4): Rework my commit 9dc7c250.
Alexander Motin [Mon, 22 Feb 2021 22:21:05 +0000 (17:21 -0500)]
cxgb(4): Rework my commit 9dc7c250.

The previous implementation was reported to try to coalesce packets
in situations when it should not, that resulted in assertion later.
This implementation better checks the first packet of the chain for
the coallescing elligibility.

(cherry picked from commit d510bf133d045d6c83742aeda6949bec150f6cbf)

3 years agoFix possibly unitialized variables in __cxa_demangle_gnu3()
Dimitry Andric [Mon, 22 Feb 2021 20:01:09 +0000 (21:01 +0100)]
Fix possibly unitialized variables in __cxa_demangle_gnu3()

After 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 where I imported a more
recent libcxxrt snapshot, the variables 'rtn' and 'has_ret' could in
some cases be used while still uninitialized. Most obviously this would
lead to a jemalloc complaint about a bad free(), aborting the program.

Fix this by initializing a bunch variables in their declarations. This
change has also been sent upstream, with some additional changes to be
used in their testing framework.

PR: 253226

(cherry picked from commit d149877758f162f0c777e7760164bf2c1f7a1bc1)

3 years ago504ebd612ec: kern: sonewconn: set so_options before pru_attach()
Kyle Evans [Wed, 20 Jan 2021 17:53:05 +0000 (11:53 -0600)]
504ebd612ec: kern: sonewconn: set so_options before pru_attach()

Protocol attachment has historically been able to observe and modify
so->so_options as needed, and it still can for newly created sockets.
779f106aa169 moved this to after pru_attach() when we re-acquire the
lock on the listening socket.

Restore the historical behavior so that pru_attach implementations can
consistently use it. Note that some pru_attach() do currently rely on
this, though that may change in the future. D28265 contains a change to
remove the use in TCP and IB/SDP bits, as resetting the requested linger
time on incoming connections seems questionable at best.

This does move the assignment out from under the head's listen lock, but
glebius notes that head won't be going away and applications cannot
assume any specific ordering with a race between a connection coming in
and the application changing socket options anyways.

4c0bef07be0: kern: net: remove TCP_LINGERTIME

TCP_LINGERTIME can be traced back to BSD 4.4 Lite and perhaps beyond, in
exactly the same form that it appears here modulo slightly different
context.  It used to be the case that there was a single pr_usrreq
method with requests dispatched to it; these exact two lines appeared in
tcp_usrreq's PRU_ATTACH handling.

The only purpose of this that I can find is to cause surprising behavior
on accepted connections. Newly-created sockets will never hit these
paths as one cannot set SO_LINGER prior to socket(2). If SO_LINGER is
set on a listening socket and inherited, one would expect the timeout to
be inherited rather than changed arbitrarily like this -- noting that
SO_LINGER is nonsense on a listening socket beyond inheritance, since
they cannot be 'connected' by definition.

Neither Illumos nor Linux reset the timer like this based on testing and
inspection of Illumos, and testing of Linux.

(cherry picked from commit 504ebd612ec61165bb949cfce3a348b0d6f37008)
(cherry picked from commit 4c0bef07be071a1633ebc86a653f9bd59d40796e)

3 years agopam_login_access: Fix negative entry matching logic
Mark Johnston [Tue, 23 Feb 2021 22:01:29 +0000 (17:01 -0500)]
pam_login_access: Fix negative entry matching logic

PR: 252194
Approved by: so
Security: CVE-2020-25580
Security: FreeBSD-SA-21:03.pam_login_access

(cherry picked from commit 6ab923cbca8759503a08683a5978b9ebf5efd607)

3 years agoFix divide-by-zero panic when ASLR is enabled and superpages disabled
Jason A. Harmening [Mon, 15 Feb 2021 02:47:22 +0000 (18:47 -0800)]
Fix divide-by-zero panic when ASLR is enabled and superpages disabled

When locating the anonymous memory region for a vm_map with ASLR
enabled, we try to keep the slid base address aligned on a superpage
boundary to minimize pagetable fragmentation and maximize the potential
usage of superpage mappings.  We can't (portably) do this if superpages
have been disabled by loader tunable and pagesizes[1] is 0, and it
would be less beneficial in that case anyway.

PR: 253511

(cherry picked from commit 41032835dc2d489ec7841d7529f74f6389329cd3)

3 years agoukbd: Fix handling of keyboard ErrorRollOver reports
Vladimir Kondratyev [Sat, 13 Feb 2021 18:12:56 +0000 (21:12 +0300)]
ukbd: Fix handling of keyboard ErrorRollOver reports

Ignore fantom keyboard state reports entirelly rather than ignore
RollOver states for each key separatelly.  Latter results in spurious
release/push pairs of events on each fantom keyboard state report.

Reported by: Jan Martin Mikkelsen <janm_AT_transactionware_DOT_com>
Submitted by: Jan Martin Mikkelsen (initial version)
PR: 253249
MFC after: 1 week

(cherry picked from commit 032d3153877ef1767c121bbdf8e00f4f93b30a5d)

3 years agoxen-blkback: fix leak of grant maps on ring setup failure
Roger Pau Monné [Wed, 20 Jan 2021 18:40:51 +0000 (19:40 +0100)]
xen-blkback: fix leak of grant maps on ring setup failure

Multi page rings are mapped using a single hypercall that gets passed
an array of grants to map. One of the grants in the array failing to
map would lead to the failure of the whole ring setup operation, but
there was no cleanup of the rest of the grant maps in the array that
could have likely been created as a result of the hypercall.

Add proper cleanup on the failure path during ring setup to unmap any
grants that could have been created.

This is part of XSA-361.

Sponsored by: Citrix Systems R&D

(cherry picked from commit 808d4aad1022a2a33d222663b0c9badde30b9d45)

3 years agoExclude reserved iSCSI Initiator Task Tag.
Alexander Motin [Sun, 24 Jan 2021 19:23:04 +0000 (14:23 -0500)]
Exclude reserved iSCSI Initiator Task Tag.

RFC 7143 (11.2.1.8):
   An ITT value of 0xffffffff is reserved and MUST NOT be assigned for a
   task by the initiator.  The only instance in which it may be seen on
   the wire is in a target-initiated NOP-In PDU (Section 11.19) and in
   the initiator response to that PDU, if necessary.

MFC after: 1 month

3 years agoExclude reserved iSCSI Target Transfer Tag.
Alexander Motin [Sun, 24 Jan 2021 18:58:29 +0000 (13:58 -0500)]
Exclude reserved iSCSI Target Transfer Tag.

RFC 7143 (11.7.4):
   The Target Transfer Tag values are not specified by this protocol,
   except that the value 0xffffffff is reserved and means that the
   Target Transfer Tag is not supplied.

MFC after: 1 month

3 years agocxgbe(4): Save proper zone index on low memory in refill_fl().
Alexander Motin [Wed, 17 Feb 2021 02:15:28 +0000 (21:15 -0500)]
cxgbe(4): Save proper zone index on low memory in refill_fl().

When refill_fl() fails to allocate large (9/16KB) mbuf cluster, it
falls back to safe (4KB) ones.  But it still saved into sd->zidx
the original fl->zidx instead of fl->safe_zidx.  It caused problems
with the later use of that cluster, including memory and/or data
corruption.

While there, make refill_fl() to use the safe zone for all following
clusters for the call, since it is unlikely that large succeed.

MFC after: 3 days
Sponsored by: iXsystems, Inc.
Reviewed by: np, jhb
Differential Revision: https://reviews.freebsd.org/D28716

(cherry picked from commit 294e62bebf36f873fd083d2fe8edd78919dda4e8)

3 years agoMFC 1c808fcd859f: Allocate BAR for ENA MSIx vector table
Michal Krawczyk [Thu, 18 Feb 2021 09:00:58 +0000 (10:00 +0100)]
MFC 1c808fcd859f: Allocate BAR for ENA MSIx vector table

In the new ENA-based instances like c6gn, the vector table moved to a
new PCIe bar - BAR1. Previously it was always located on the BAR0, so
the resources were already allocated together with the registers.

As the FreeBSD isn't doing any resource allocation behind the scenes,
the driver is responsible to allocate them explicitly, before other
parts of the OS (like the PCI code allocating MSIx) will be able to
access them.

To determine dynamically BAR on which the MSIx vector table is present
the pci_msix_table_bar() is being used and the new BAR is allocated if
needed.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc

(cherry picked from commit 1c808fcd859f5ce24132a903a4c7c9996e0513b1)

3 years agoMFC jail: Change both root and working directories in jail_attach(2)
Jamie Gritton [Fri, 19 Feb 2021 22:13:35 +0000 (14:13 -0800)]
MFC jail: Change both root and working directories in jail_attach(2)

jail_attach(2) performs an internal chroot operation, leaving it up to
the calling process to assure the working directory is inside the jail.

Add a matching internal chdir operation to the jail's root.  Also
ignore kern.chroot_allow_open_directories, and always disallow the
operation if there are any directory descriptors open.

Reported by:    mjg
Approved by:    markj, kib

(cherry picked from commit d4380c0cdd0517dc038403dd5c99242ce78bdeb5)

3 years agolibpmc: fix linking with C programs
Alan Somers [Sun, 21 Feb 2021 20:56:57 +0000 (20:56 +0000)]
libpmc: fix linking with C programs

Revision r334749 Added some C++ code to libpmc.  It didn't change the ABI,
but it did introduce a dependency on libc++.  Nobody noticed because every
program that in the base system that uses libpmc is also C++.

Reported-by: Dom Dwyer <dom@itsallbroken.com>
Reviewed By: vangyzen
Differential Revision: https://reviews.freebsd.org/D28550

(cherry picked from commit 04e34c0202ea50cea67d5779f54bc612c74e6532)

3 years agoMerge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456
Dimitry Andric [Thu, 18 Feb 2021 21:30:27 +0000 (22:30 +0100)]
Merge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456

Interesting fixes:
b3c73ba libelftc_dem_gnu3: Sync with elftoolchain r3877
7b2335c Mostly fix __cxa_demangle after #3

Reported by: arichardson
PR: 253226

(cherry picked from commit 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368)

Revert 3c4fd2463bb2 since upstream libcxxrt fixed it in another way

In 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 I imported a more recent
libcxxrt snapshot, which includes an upstream fix for the padding of
struct _Unwind_Exception:

https://github.com/libcxxrt/libcxxrt/commit/e458560b7e22fff59af643dba363544b393bd8db

However, we also had a similar fix in our tree as:
https://cgit.freebsd.org/src/commit/?id=3c4fd2463bb29f65ef1404011fcb31e508cdf2e2

Since having both fixes makes the struct too large again, it leads to
SIGBUSes when throwing exceptions on amd64 (or other LP64 arches). This
is most easily tested by running kyua without any arguments.

It looks like our fix is no longer needed now, so revert it to reduce
diffs against upstream.

PR: 253226
Reviewed by: arichardson, kp
Differential Revision: https://reviews.freebsd.org/D28799

(cherry picked from commit d2b3fadf2db56131376a71b0597876b591a6aee4)

3 years agopf: Fix osfp configuration
Kristof Provost [Thu, 18 Feb 2021 07:36:46 +0000 (08:36 +0100)]
pf: Fix osfp configuration

pf_rule_to_krule() incorrectly converted the rule osfp configuration to
the krule structure.

Reported by: delphij@
MFC after: 3 days

(cherry picked from commit 2ed689a674c380e48245933d5326da4dda65f94d)

3 years agoprocstat: distinguish vm map guards in procstat vm output.
Konstantin Belousov [Sun, 14 Feb 2021 00:37:24 +0000 (02:37 +0200)]
procstat: distinguish vm map guards in procstat vm output.

(cherry picked from commit 25c6318c7906f6f4e0c66ce16f81bdb830ba2e3b)

3 years agonvdimm(4): Export NVDIMM health flags via sysctl
Ravi Pokala [Tue, 16 Feb 2021 08:03:32 +0000 (00:03 -0800)]
nvdimm(4): Export NVDIMM health flags via sysctl

The ACPI NFIT specification defines a set of "NVDIMM State Flags". These
flags are already reported by `acpidump -t', but this change makes them
available on a per-device basis, in a format that is more easily parsed.

To simplify this, introduce acpi_nfit_get_memory_maps_by_dimm(), which
locates the (ACPI_NFIT_MEMORY_MAP)s associated with a given
(nfit_handle_t).

Reviewed by: mav, cem
Tested by: mav, rpokala (version for stable/12)
MFC after: 3 days
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D28700

(cherry picked from commit bdde49b7c7232c6936525f84ffb90856a7cd8e74)

3 years agoRevert "Revert 3c4fd2463bb2 since upstream libcxxrt fixed it in another way"
Dimitry Andric [Sat, 20 Feb 2021 20:40:41 +0000 (21:40 +0100)]
Revert "Revert 3c4fd2463bb2 since upstream libcxxrt fixed it in another way"

This reverts commit 9e86d16697654c58ae65fd13e2a35fc755ecf73a, since I
messed up and didn't merge the earlier libcxxrt changes first.

3 years agoRevert 3c4fd2463bb2 since upstream libcxxrt fixed it in another way
Dimitry Andric [Fri, 19 Feb 2021 18:18:22 +0000 (19:18 +0100)]
Revert 3c4fd2463bb2 since upstream libcxxrt fixed it in another way

In 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 I imported a more recent
libcxxrt snapshot, which includes an upstream fix for the padding of
struct _Unwind_Exception:

https://github.com/libcxxrt/libcxxrt/commit/e458560b7e22fff59af643dba363544b393bd8db

However, we also had a similar fix in our tree as:
https://cgit.freebsd.org/src/commit/?id=3c4fd2463bb29f65ef1404011fcb31e508cdf2e2

Since having both fixes makes the struct too large again, it leads to
SIGBUSes when throwing exceptions on amd64 (or other LP64 arches). This
is most easily tested by running kyua without any arguments.

It looks like our fix is no longer needed now, so revert it to reduce
diffs against upstream.

PR: 253226
Reviewed by: arichardson, kp
Differential Revision: https://reviews.freebsd.org/D28799

(cherry picked from commit d2b3fadf2db56131376a71b0597876b591a6aee4)

3 years agopkg(7): address minor nits (mostly clang-analyze complaints)
Kyle Evans [Fri, 12 Feb 2021 00:58:27 +0000 (18:58 -0600)]
pkg(7): address minor nits (mostly clang-analyze complaints)

- One (1) spurious whitespace.
- One (1) occurrence of "random(3) bad, arc4random(3)" good.
- Three (3) writes that will never be seen.

The latter two points are complaints from clang-analyze. Switching to
arc4random(3) is decidedly a good idea because we weren't doing any kind
of PRNG seeding anyways. The discarded assignments are arguably good
for future-proofing, but it's better to improve the S/N ratio from
clang-analyze.

(cherry picked from commit b2c4ca8d2872bc4410626f2b1ceafa49de5828ce)

3 years agousr.sbin/praudit: Fix tests after 5619d49e07
Alex Richardson [Wed, 3 Feb 2021 15:26:19 +0000 (15:26 +0000)]
usr.sbin/praudit: Fix tests after 5619d49e07

Commit 5619d49e07 made the getgrgid() call inside bsm work as
intended so we now print "wheel" instead of a numeric 0 in the rgid field.

Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D28462

(cherry picked from commit 7791ecf04b48a0c365b003447f479ec890115dfc)

3 years agolibcasper/cap_grp tests: Reset the group database handle
Mark Johnston [Thu, 21 Jan 2021 19:30:19 +0000 (14:30 -0500)]
libcasper/cap_grp tests: Reset the group database handle

Some tests verify that the capgrp capability does not permit calls to
setgrent(3), but all tests need to ensure that they reset the
capability's group database handle, otherwise the local process and
casper process will be out of sync.

The cap_pwd tests already handle this.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1a05d9519de62cc0f7719a995fded0926d8b2747)

3 years agolibc/nss: Ensure that setgroupent(3) actually works as advertised
Mark Johnston [Thu, 21 Jan 2021 19:30:19 +0000 (14:30 -0500)]
libc/nss: Ensure that setgroupent(3) actually works as advertised

Because the "files" and "compat" implementations failed to set the
"stayopen", keyed lookups would close the database handle, contrary to
the purpose of setgroupent(3).  setpassent(3)'s implementation does not
have this bug.

PR: 165527
Submitted by: Andrey Simonenko

(cherry picked from commit 48a186863431ec7a23c6174bc376cafa59dd5fbf)

3 years agolibc/nss tests: Add regression tests for commit 55444c823e1f
Mark Johnston [Thu, 21 Jan 2021 19:30:19 +0000 (14:30 -0500)]
libc/nss tests: Add regression tests for commit 55444c823e1f

PR: 252094
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6e411d8b14ec5402b7551073e2f9edc4d680dd49)

3 years agolibc/nss: Restore iterator state when doing passwd/group lookups
Mark Johnston [Thu, 21 Jan 2021 19:30:19 +0000 (14:30 -0500)]
libc/nss: Restore iterator state when doing passwd/group lookups

The getpwent(3) and getgrent(3) implementations maintain some internal
iterator state.  Interleaved calls to functions which do passwd/group
lookups using a key, such as getpwnam(3), would in some cases clobber
this state, causing a subsequent getpwent() or getgrent() call to
restart iteration from the beginning of the database or to terminate
early.  This is particularly troublesome in programming environments
where execution of green threads is interleaved within a single OS
thread.

Take care to restore any iterator state following a keyed lookup.  The
"files" provider for the passwd database was already handling this
correctly, but "compat" was not, and both providers had this problem
when accessing the group database.

PR: 252094
Submitted by: Viktor Dukhovni <ietf-dane@dukhovni.org>

(cherry picked from commit 5619d49e07d3942e438f3d06269f3c1c466cf5b7)

3 years agolibc/nss tests: Fix getpw and getgr single-pass tests
Mark Johnston [Thu, 21 Jan 2021 19:30:19 +0000 (14:30 -0500)]
libc/nss tests: Fix getpw and getgr single-pass tests

Some NSS regression tests for getgrent(3) and getpwent(3) were not
testing anything because the test incorrectly requested creation of a
database snapshot.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7abc10098b3d9c23d611294714b3058e8048aec0)

3 years agolibc/nss tests: Style
Mark Johnston [Thu, 21 Jan 2021 19:30:18 +0000 (14:30 -0500)]
libc/nss tests: Style

Sponsored by: The FreeBSD Foundation

(cherry picked from commit ed14c69d5679b9a6b86722be698b3060d4b74946)

3 years agoRevert "libpmc: fix linking with C programs"
Alan Somers [Sat, 20 Feb 2021 03:25:15 +0000 (20:25 -0700)]
Revert "libpmc: fix linking with C programs"

This reverts commit 418d29545e0b98b269c346adc6931359065ffbdb.  It causes
build failures on GCC platforms in stable/12, even though it doesn't in
13 and later.

3 years agolibpmc: fix linking with C programs
Alan Somers [Mon, 15 Feb 2021 22:51:31 +0000 (15:51 -0700)]
libpmc: fix linking with C programs

Revision r334749 Added some C++ code to libpmc.  It didn't change the ABI,
but it did introduce a dependency on libc++.  Nobody noticed because every
program that in the base system that uses libpmc is also C++.

Reported-by: Dom Dwyer <dom@itsallbroken.com>
Reviewed By: vangyzen
Differential Revision: https://reviews.freebsd.org/D28550

(cherry picked from commit 04e34c0202ea50cea67d5779f54bc612c74e6532)

3 years agoMFC jail: Handle a possible race between jail_remove(2) and fork(2)
Jamie Gritton [Tue, 16 Feb 2021 19:19:13 +0000 (11:19 -0800)]
MFC jail: Handle a possible race between jail_remove(2) and fork(2)

jail_remove(2) includes a loop that sends SIGKILL to all processes
in a jail, but skips processes in PRS_NEW state.  Thus it is possible
the a process in mid-fork(2) during jail removal can survive the jail
being removed.

Add a prison flag PR_REMOVE, which is checked before the new process
returns.  If the jail is being removed, the process will then exit.
Also check this flag in jail_attach(2) which has a similar issue.

Reported by:    trasz
Approved by:    kib

(cherry picked from commit cc7b73065302005ebc4a19503188c8d6d5eb923d)

3 years agoUse iflib_if_init_locked() during media change instead of iflib_init_locked().
Allan Jude [Sun, 14 Feb 2021 18:39:09 +0000 (18:39 +0000)]
Use iflib_if_init_locked() during media change instead of iflib_init_locked().

iflib_init_locked() assumes that iflib_stop() has been called, however,
it is not called for media changes.
iflib_if_init_locked() calls stop then init, so fixes the problem.

PR: 253473
Sponsored by: Juniper Networks, Inc., Klara, Inc.

(cherry picked from commit 922cf8ac43adc9983f9a9e05cfd838306c1ef483)

3 years agoFree microcode memory later.
Konstantin Belousov [Fri, 17 May 2019 17:11:01 +0000 (17:11 +0000)]
Free microcode memory later.

(cherry picked from commit 8f7f38457f940798c149ae40b73e0d20672812de)

3 years agoffs_vnops.c: Move opt_*.h includes to the top.
Konstantin Belousov [Thu, 28 Jan 2021 18:30:35 +0000 (20:30 +0200)]
ffs_vnops.c: Move opt_*.h includes to the top.

(cherry picked from commit 0281f88e5dbc8d6f819bf3f22dd11239ff5374ea)

3 years agoIgnore generated LINT files
Ravi Pokala [Fri, 19 Feb 2021 00:12:22 +0000 (16:12 -0800)]
Ignore generated LINT files

3 years agoUpdate Subversion to 1.14.1 LTS. See contrib/subversion/CHANGES for a
Dimitry Andric [Sat, 13 Feb 2021 13:38:51 +0000 (14:38 +0100)]
Update Subversion to 1.14.1 LTS. See contrib/subversion/CHANGES for a
summary of changes, or for a more thorough overview:

https://subversion.apache.org/docs/release-notes/1.14

NOTE 1: There is no need to dump and reload repositories, and the
working copy format is still the same as Subversion 1.8 through 1.13.

NOTE 2: The upstream release also contains a fix for a security issue in
mod_dav_svn (CVE-2020-17525), but since we do not build or use any
Apache modules, it is not an issue for the FreeBSD base system.

Relnotes: yes

(cherry-picked from 0ff1014944897f4f3ffa4462406cdee920b53400)

3 years agoarch.7: update 11.x to 11.4 as the last FreeBSD 11 release
Ed Maste [Thu, 28 Jan 2021 20:02:24 +0000 (15:02 -0500)]
arch.7: update 11.x to 11.4 as the last FreeBSD 11 release

armeb and pc98 were both discontinued after FreeBSD 11.  FreeBSD 11.4
is now known to be the final 11.x release, so update to the specific
version.

(cherry picked from commit 4f9548640dd1c7e9602f0d01647b112e51792224)

3 years agoFix incorrect hypotl(3) result with subnormal numbers
Dimitry Andric [Wed, 10 Feb 2021 22:28:43 +0000 (23:28 +0100)]
Fix incorrect hypotl(3) result with subnormal numbers

This adjusts the factor used to scale the subnormal numbers, so it
becomes the right value after adjusting its exponent. Thanks to Steve
Kargl for finding the most elegant fix.

Also enable the hypot tests, and add a test case for this bug.

PR:             253313

(cherry picked from commit d3338f3355a612cf385632291f46c5777bba8d18)

Fix lib/msun/test builds on platforms without 80-bit long doubles

After d3338f3355a612cf385632291f46c5777bba8d18, the lib/msun test case
'hypotl_near_underflow' would fail to compile on platforms where long
doubles weren't 80 bit, like on x86. Disable this particular test on
such platforms for now.

PR:             253313

(cherry picked from commit 25120662284466ecef976df8f86e97bafdedf991)

3 years agoMFC 12148d4300db:
Hans Petter Selasky [Sun, 14 Feb 2021 19:29:16 +0000 (20:29 +0100)]
MFC 12148d4300db:
Fix for locking order reversal in USB audio driver, when using mmap().

Locking the second lock which causes the LOR, can be skipped because
the code updating the shared variables is always executing from the
same USB thread.

lock order reversal:
  1st 0xfffff80005cc3840 pcm7:play:dsp7.p0 (pcm play channel, sleep mutex)
@ usb_transfer.c:2342
  2nd 0xfffff80005cc3860 pcm7:record:dsp7.r0 (pcm record channel, sleep mutex)
@ uaudio.c:2317

lock order pcm record channel -> pcm play channel established at:
witness_checkorder+0x461
__mtx_lock_flags+0x98
dsp_mmap_single+0x151
vm_mmap_cdev+0x65
devfs_mmap_f+0x143
kern_mmap_req+0x594
sys_mmap+0x46
amd64_syscall+0x12e
fast_syscall_common+0xf8

lock order pcm play channel -> pcm record channel attempted at:
witness_checkorder+0xd82
__mtx_lock_flags+0x98
uaudio_chan_play_callback+0xeb
usbd_callback_wrapper+0x7ec
usb_command_wrapper+0x7e
usb_callback_proc+0x8e
usb_process+0xf3
fork_exit+0x80
fork_trampoline+0xe

Found by: Stefan Ehmann <shoesoft@gmx.net>
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 12148d4300dbbd93260bf2801cdb9eda8b3b05a4)

3 years agoGiant: move back Giant removal until 14
Warner Losh [Wed, 17 Feb 2021 16:28:41 +0000 (09:28 -0700)]
Giant: move back Giant removal until 14

Update the Giant Lock warning message to FreeBSD 14. It's growing increasling
clear that this won't be done before 13.0.

MFC: Insta (re@'s request)
Approved by: re@ (gjb for 13.0 release cycle)
(cherry picked from commit 00065c7630c25850298dd3ba6919c2d3628e8ad9)

3 years agomount_nfs: update man page description for oneopenown
Rick Macklem [Mon, 18 Jan 2021 03:00:41 +0000 (19:00 -0800)]
mount_nfs: update man page description for oneopenown

A recent email discussion indicated that a large
accumulation of NFSv4 Opens was occurring on
a mount. This appears to have been caused by a
shared library within the mount being used by
several processes, such that there is always at
least one of these processes running.
A new Open was created by each process and
were not closed, since all the Opens were never
closed. This is alleviated by using the
"oneopenown" mount option.

This man page update attempts to indicate the
use of "oneopenown" for this case.

This is a content change.

(cherry picked from commit 448de00de556753575ec0a2e705712e7c606e680)

3 years agossh: remove unused variable
Ed Maste [Fri, 12 Feb 2021 03:21:40 +0000 (22:21 -0500)]
ssh: remove unused variable

This was introduced in 03f6c5cd93ec, which added use of
sysctl net.inet.ip.portrange.reservedhigh instead of IPPORT_RESERVED,
but it appears the rest of that change was lost in some subsequent
update.

The change should probably be restored, but until then there is no
reason to leave an unused variable around.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 9e14b918f956c532d0b81c945160bd9bc85c5604)

3 years agossh: remove ssh-hpn leftovers
Ed Maste [Fri, 12 Feb 2021 14:09:00 +0000 (09:09 -0500)]
ssh: remove ssh-hpn leftovers

This was introduced in 8998619212f3a, and left behind when the hpn-ssh
patches were removed in 60c59fad8806.  Although Being able to log
SO_RCVBUF in debug mode might have some small value on its own, it's
not worth carrying an extra diff against upstream.

Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28610

(cherry picked from commit a62dc346f6171ef1bd52bb8795eaf2d64394ac24)

3 years agossh: diff reduction against OpenBSD, remove unused includes
Ed Maste [Fri, 12 Feb 2021 01:41:02 +0000 (20:41 -0500)]
ssh: diff reduction against OpenBSD, remove unused includes

These appear to be leftovers from ca86bcf2531c7 and f7167e0ea0bf5

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 154adbbeb8fc2a0d183ec3a4db32cd13668205e8)

3 years agosshd: allow UseBlocklist alias for UseBlacklist
Ed Maste [Wed, 29 Jul 2020 00:34:24 +0000 (00:34 +0000)]
sshd: allow UseBlocklist alias for UseBlacklist

blacklistd has been renamed to blocklistd upstream, and a future
import into FreeBSD will follow that change.  Support the new name
as an alias in config files.

Reviewed by: bz, delphij
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25865

(cherry picked from commit e426c74375ef7cb3afda3c8e3010a7ea2dbd69d0)

3 years agoopenssh: refer to OpenSSL not SSLeay
Ed Maste [Wed, 15 Jul 2020 15:35:26 +0000 (15:35 +0000)]
openssh: refer to OpenSSL not SSLeay

This change was made upstream between 7.9p1 and 8.0p1.  We've made local
changes in the same places for handling the version_addendum; apply the
SSLeay_version to OpenSSL_version change in advance of importing 8.0p1.

Obtained from: OpenSSH-portable a65784c9f9c5
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6471c6bd75af57acde7dc39f5202d9a7adf4130a)

openssh: refer to OpenSSL not SSLeay, part 2

(cherry picked from commit ea64ebd08c80e4c0a7b8ed207caba45e9374908e)

3 years agoUpdate version in openssh FREEBSD-vendor metadata
Ed Maste [Fri, 14 Feb 2020 22:32:33 +0000 (22:32 +0000)]
Update version in openssh FREEBSD-vendor metadata

It appears that FREEBSD-vendor is an idea that never really took off
and we should probably just remove it, but until then we might as well
record the correct version.

(cherry picked from commit 23f6a81e4930c69f1fdcbb90de30ce03561bb4cf)

3 years agoAllow setting alias port ranges in libalias and ipfw.
Neel Chauhan [Tue, 2 Feb 2021 21:24:17 +0000 (13:24 -0800)]
Allow setting alias port ranges in libalias and ipfw.

This will allow a system to be a true RFC 6598 NAT444 setup, where each
network segment (e.g. user, subnet) can have their own dedicated port
aliasing ranges.

Reviewed by: donner, kp
Approved by: 0mp (mentor), donner, kp
Differential Revision: https://reviews.freebsd.org/D23450

(cherry picked from commit a08cdb6cfb1c84b80b5337d46c574b55d0e15c63)

3 years agokenv: avoid sleepable alloc for integer tunables
Jason A. Harmening [Fri, 14 Aug 2020 21:37:38 +0000 (21:37 +0000)]
kenv: avoid sleepable alloc for integer tunables

Avoid performing a potentially-blocking malloc for kenv lookups that will only
perform non-destructive integer conversions on the returned buffer. Instead,
perform the strtoq() in-place with the kenv lock held.

While here, factor the logic around kenv_lock acquire and release into
kenv_acquire() and kenv_release(), and use these functions for some light
cleanup. Collapse getenv_string_buffer() into kern_getenv(), as the former
no longer has any other callers and the only additional task performed by
the latter is a WITNESS check that hasn't been useful since r362231.

PR: 248250
Reported by: gbe
Reviewed by: mjg
Tested by: gbe
Differential Revision: https://reviews.freebsd.org/D26010

3 years agoWiden ifnet_detach_sxlock coverage
Kristof Provost [Mon, 8 Feb 2021 09:04:27 +0000 (10:04 +0100)]
Widen ifnet_detach_sxlock coverage

Widen the ifnet_detach_sxlock to cover the entire vnet sysuninit code.
This ensures that we can't end up having the vnet_sysuninit free the UDP
pcb while the detach code is running and trying to purge the UDP pcb.

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

(cherry picked from commit 6d2a10d96fb5d4ee42fd67b0b07a6d098db5d55a)

3 years agopf: Slightly relax pf_rule_addr validation
Kristof Provost [Sat, 13 Feb 2021 15:31:52 +0000 (16:31 +0100)]
pf: Slightly relax pf_rule_addr validation

Ensure we don't reject no-route / urpf-failed addresses.

PR: 253479
Reported by: michal AT microwave.sk
Revied by: donner@
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28650

(cherry picked from commit 5e42cb139fc17f165c9c93ac97069dc7770490e2)

3 years agoOpenSSL: Regen assembly files and manual pages for OpenSSL 1.1.1j
Jung-uk Kim [Wed, 17 Feb 2021 05:07:24 +0000 (00:07 -0500)]
OpenSSL: Regen assembly files and manual pages for OpenSSL 1.1.1j

3 years agoOpenSSL: Merge OpenSSL 1.1.1j
Jung-uk Kim [Wed, 17 Feb 2021 04:38:21 +0000 (23:38 -0500)]
OpenSSL: Merge OpenSSL 1.1.1j

Merge commit '4f55bd5321b72491d4eff396e4928e9ab0706735' into stable/12

3 years agocxgbe(4): Fixes to tx coalescing.
Navdeep Parhar [Mon, 1 Feb 2021 11:00:09 +0000 (03:00 -0800)]
cxgbe(4): Fixes to tx coalescing.

- The behavior implemented in r362905 resulted in delayed transmission
  of packets in some cases, causing performance issues.  Use a different
  heuristic to predict tx requests.

- Add a tunable/sysctl (hw.cxgbe.tx_coalesce) to disable tx coalescing
  entirely.  It can be changed at any time.  There is no change in
  default behavior.

(cherry picked from commit 3447df8bc5b342bd88d565641435284ff620ee2a)

3 years agocxgbe(4): Check for descriptors before writing a TLS or raw work request.
Navdeep Parhar [Mon, 31 Aug 2020 22:44:59 +0000 (22:44 +0000)]
cxgbe(4): Check for descriptors before writing a TLS or raw work request.

(cherry picked from commit 565b8fce23e6250b673a956ce753e37b201a5847)

3 years agoImport OpenSSL 1.1.1j.
Jung-uk Kim [Tue, 16 Feb 2021 19:54:02 +0000 (14:54 -0500)]
Import OpenSSL 1.1.1j.

3 years agonetgraph/ng_source: Allow ng_source to inject into any netgraph network
Lutz Donnerhacke [Sun, 17 Jan 2021 20:35:28 +0000 (21:35 +0100)]
netgraph/ng_source: Allow ng_source to inject into any netgraph network

PR: 240530
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D21968

(cherry picked from commit 75e7ef74dfc12e01b1ef4706110d238639e04543)

3 years agoinetd: fix unix sockaddr's length assignment
Kyle Evans [Fri, 12 Feb 2021 19:19:43 +0000 (13:19 -0600)]
inetd: fix unix sockaddr's length assignment

unsz was always exactly '1' here due to an unfortunate mispositioning
of closing parenthesis. While it's generally irrelevant because bind(2)
is passed the (accurate) sep->se_ctrladdr_size instead, it's not very
helpful for anything locally that wants to use it rather than assuming
that sep->se_ctrladdr_size perfectly fits the end of sun_path.

Just drop unsz entirely and use the result of SUN_LEN() for it.

(cherry picked from commit 1253835121cb38fd93478849e32a4a4c13436fb2)

3 years agofmtree: add a deprecation notice to the manpage
Kyle Evans [Wed, 10 Feb 2021 15:10:52 +0000 (09:10 -0600)]
fmtree: add a deprecation notice to the manpage

Note that this mtree(8) is actually installed as fmtree(8), while
mtree(8) is located in ^/contrib/mtree -- thus, the reference to
mtree(8) makes a lot more sense in the context in which folks would
actually notice it. Shout-out to Ravi for pointing out that this may
not be an obvious fact.

Relnotes: yes

(cherry picked from commit 6fea22cebe5cb1e51e98c894a738bea910b7bc2f)

3 years agoMFC 57785538c6e0d7e8ca0f161ab95bae10fd304047 and
Cy Schubert [Sun, 7 Feb 2021 03:22:52 +0000 (19:22 -0800)]
MFC 57785538c6e0d7e8ca0f161ab95bae10fd304047 and
    1e811efbc591699b872bea42b9de419c373199df:

57785538c6e0d7e8ca0f161ab95bae10fd304047:

Simplify the FreeBSD check using __FreeBSD__ compiler macro.

Rather than rely on __FreeBSD_version, defined in sys/param.h, use
__FreeBSD__ defined by the compiler.

Reported by: emaste
MFC after: 1 week

(cherry picked from commit 57785538c6e0d7e8ca0f161ab95bae10fd304047)

1e811efbc591699b872bea42b9de419c373199df:

Fix non-IPv6 build post 57785538c6e0d7e8ca0f161ab95bae10fd304047.

57785538c6e0d7e8ca0f161ab95bae10fd304047 change the test for FreeBSD
from __FreeBSD_version to __FreeBSD__. However this test was performed
before sys/param.h was included, therefore __FreeBSD_version was never
defined. As the test was never true opt_random_ip_id.h was never included.

Submitted by: bdragon
Reported by: bdragon

(cherry picked from commit 1e811efbc591699b872bea42b9de419c373199df)

3 years agoMFC d20f7a5a3da1aa5bccdabb89c181ca0c49385ecd:
Cy Schubert [Sun, 7 Feb 2021 03:15:27 +0000 (19:15 -0800)]
MFC d20f7a5a3da1aa5bccdabb89c181ca0c49385ecd:

Simply FreeBSD check using __FreeBSD__ and remove OpenBSD

(cherry picked from commit d20f7a5a3da1aa5bccdabb89c181ca0c49385ecd)

3 years agoMFC 344f1083e128d8d41ca31853dac513ca3efd9d1f:
Cy Schubert [Fri, 5 Feb 2021 14:26:04 +0000 (06:26 -0800)]
MFC 344f1083e128d8d41ca31853dac513ca3efd9d1f:

ipfilter: Use the softn (NAT softc) host map size in ip_nat6 calculation.

The ipfilter NAT table host map size is a tunable that defaults to
a macro value defined at build time. HOSTMAP_SIZE is saved in softn
(the ipnat softc) at initialization. It can be tuned (changed) at runtime
using the ipf -T command. If the hostmap_size tunable is adjusted the
calculation to determine where to put new entries in the table was
incorrect. Use the tunable in the NAT softc instead of the static build
time value.

(cherry picked from commit 344f1083e128d8d41ca31853dac513ca3efd9d1f)

3 years agoMFC 10990cb46027b4cc4339540b1217117863b2cd15:
Cy Schubert [Wed, 3 Feb 2021 03:24:05 +0000 (19:24 -0800)]
MFC 10990cb46027b4cc4339540b1217117863b2cd15:

Simplify FreeBSD check.

(cherry picked from commit 10990cb46027b4cc4339540b1217117863b2cd15)

3 years agoMFC commit e673debe7db8ba95e4ee3b549d2570e71d19b596:
Cy Schubert [Wed, 3 Feb 2021 03:18:48 +0000 (19:18 -0800)]
MFC commit e673debe7db8ba95e4ee3b549d2570e71d19b596:

Simplify BSD macro tests.

All FreeBSD and NetBSD are BSD >= 199306 and have been for a long time.

(cherry picked from commit e673debe7db8ba95e4ee3b549d2570e71d19b596)

3 years agoMFC 0f34c80f376345b98a972940dd4757e58d7beb06:
Cy Schubert [Thu, 28 Jan 2021 05:50:04 +0000 (21:50 -0800)]
MFC 0f34c80f376345b98a972940dd4757e58d7beb06:

Replace the redundant MENTAT macro with SOLARIS.

MENTAT and SOLARIS are synonymous. Remove the extraneous duplicate
macro.

(cherry picked from commit 0f34c80f376345b98a972940dd4757e58d7beb06)

3 years agoCirrus-CI: use FreeBSD 12.2 image
Ed Maste [Mon, 15 Feb 2021 22:04:42 +0000 (17:04 -0500)]
Cirrus-CI: use FreeBSD 12.2 image

Direct commit to stable/12 as main has other changes here, using the
llvm package to avoid building the toolchain.

3 years agomca: Handle inconsistent CMCI capability reporting
Mark Johnston [Mon, 8 Feb 2021 19:42:54 +0000 (14:42 -0500)]
mca: Handle inconsistent CMCI capability reporting

A BIOS bug may apparently cause the BSP to report that it does not
implement CMCI, with some APs reporting that they do.  In this scenario,
avoid a NULL pointer dereference that occurs in cmci_monitor() because
cmc_state was not allocated by the BSP.

PR: 253272
Reported by: asomers, mmacy
Reviewed by: kib (previous version)

(cherry picked from commit b5770470276268acef21368b3e77a325df883500)

3 years agoFix incorrect powf(3) result with x near 1 and |y| much larger than 1
Steve Kargl [Mon, 8 Feb 2021 19:45:30 +0000 (20:45 +0100)]
Fix incorrect powf(3) result with x near 1 and |y| much larger than 1

This adjusts the check to trigger overflow/underflow to a slightly lower
value.

Before: powf(9.999995e-01, -1.342177e+08) -> inf
After:  powf(9.999995e-01, -1.342177e+08) -> 1.858724e+31

(cherry picked from commit 93fc67896550548f91b307dbe3053f11db5d4a8a)

Add test case for 93fc67896550 (incorrect powf(3) result)

This adds the test case to contrib/netbsd-tests/lib/libm/t_pow.c, as it
is currently the only place testing pow(3) and friends.

(cherry picked from commit 51af03328755c9095e94d20858a8d10acfe412ae)

3 years agousleep(3): replace 'process' with 'calling thread'
Konstantin Belousov [Thu, 11 Feb 2021 03:49:25 +0000 (05:49 +0200)]
usleep(3): replace 'process' with 'calling thread'

PR: 253395

(cherry picked from commit 4956af2a8f0d7723cb09c98e7f5295b156136f70)

3 years agotest_inf_inputs: Use atf_tc_expect_fail() instead of atf_tc_skip()
Alex Richardson [Fri, 29 Jan 2021 09:28:40 +0000 (09:28 +0000)]
test_inf_inputs: Use atf_tc_expect_fail() instead of atf_tc_skip()

Reviewed By: lwhsu
Differential Revision: https://reviews.freebsd.org/D28396

(cherry picked from commit 4d2edf3af1dbd8a3e7cf1b22343a1ecfc2dd41ba)

Fix lib/msun's ctrig_test/test_inf_inputs test case with clang >= 10

This sprinkles a few strategic volatiles in an attempt to defeat clang's
optimization interfering with the expected floating-point exception
flags.

Reported by: lwhsu
PR: 244732

(cherry picked from commit ac76bc1145dd7f4476e5d982ce8f355f71015713)