]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agopf: getstates: avoid taking the hashrow lock if the row is empty
Kristof Provost [Tue, 29 Jun 2021 09:34:49 +0000 (11:34 +0200)]
pf: getstates: avoid taking the hashrow lock if the row is empty

Reviewed by: mjg
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30946

(cherry picked from commit a19ff8ce9b58548a5f965db2c46eb03c38b15edb)

2 years agopf: Reduce the data returned in DIOCGETSTATESNV
Kristof Provost [Tue, 29 Jun 2021 08:26:40 +0000 (10:26 +0200)]
pf: Reduce the data returned in DIOCGETSTATESNV

This call is particularly slow due to the large amount of data it
returns. Remove all fields pfctl does not use. There is no functional
impact to pfctl, but it somewhat speeds up the call.

It might affect other (i.e. non-FreeBSD) code that uses the new
interface, but this call is very new, so there's unlikely to be any. No
releases contained the previous version, so we choose to live with the
ABI modification.

Reviewed by: donner
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30944

(cherry picked from commit 34285eefddc99c994c3e5374ba7836cc7cfc8e2e)

2 years agopf tests: Stress state retrieval
Kristof Provost [Mon, 28 Jun 2021 10:48:20 +0000 (12:48 +0200)]
pf tests: Stress state retrieval

Create and retrieve 20.000 states. There have been issues with nvlists
causing very slow state retrieval. We don't impose a specific limit on
the time required to retrieve the states, but do log it. In excessive
cases the Kyua timeout will fail this test.

Reviewed by: donner
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30943

(cherry picked from commit d8d43b2de1fa679179f7089cb3c31e6780ec82af)

2 years agoAllow sleepq_signal() to drop the lock.
Alexander Motin [Fri, 25 Jun 2021 17:52:58 +0000 (13:52 -0400)]
Allow sleepq_signal() to drop the lock.

Introduce SLEEPQ_DROP sleepq_signal() flag, allowing one to drop the
sleep queue chain lock before returning.  Reduced lock scope allows
significantly reduce lock contention inside taskqueue_enqueue() for
ZFS worker threads doing ~350K disk reads/s on 40-thread system.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

(cherry picked from commit 6df35af4d85c6311d8e762521580e7176b69394e)

2 years agodevmatch: improve naming of devmatch config variable
Ceri Davies [Fri, 18 Jun 2021 12:17:30 +0000 (13:17 +0100)]
devmatch: improve naming of devmatch config variable

Accept the old rc.conf variable if the new one is not present for
compatability.

Approved by: imp
Differential Revision: https://reviews.freebsd.org/D30806

(cherry picked from commit c43b0081faab742eb93c3d064b552b65f926b86e)

2 years agopf tests: ftp-proxy test
Kristof Provost [Thu, 1 Jul 2021 15:15:36 +0000 (17:15 +0200)]
pf tests: ftp-proxy test

Basic test case for ftp-proxy

PR: 256917
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit dd82fd3543022017b84007ac1a0d45fc683f9850)

2 years agoftp-proxy: Revert incorrect migration to libpfctl
Kristof Provost [Thu, 1 Jul 2021 15:16:10 +0000 (17:16 +0200)]
ftp-proxy: Revert incorrect migration to libpfctl

libpfctl supports creating rules, but not (yet) adding addresses to a
pool. Adding addresses certainly does not work through adding a rule.

PR: 256917
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 8923ea6c867fd75b08b76883ec122c429a4018f9)

2 years agodummynet: fix sysctls
Kristof Provost [Thu, 1 Jul 2021 07:42:34 +0000 (09:42 +0200)]
dummynet: fix sysctls

The sysctl nodes which use V_dn_cfg must be marked as CTLFLAG_VNET so
that we use the correct per-vnet offset

PR: 256819
Reviewed by: donner
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30974

(cherry picked from commit 8f76eebce424de064f65fec5cdd105446a2de3bd)

2 years agoarm: Make sure we can handle a thumb entry point.
Olivier Houchard [Wed, 30 Jun 2021 20:56:50 +0000 (22:56 +0200)]
arm: Make sure we can handle a thumb entry point.

Similarly to what's been done on arm64 with commit
712c060c94fd447c91b0e6218c12a431206b487a, when executing a binary, if the
entry point is a thumb symbol, then make sure we set the PSL_T flag, otherwise
the CPU will interpret it in ARM mode, and that will likely leads to an
undefined instruction.

PR: 256899
MFC after:  1 week

(cherry picked from commit 8c3bd133dd52824e427e350c65eae1fd9eb5a3cd)
Signed-off-by: Olivier Houchard <cognet@FreeBSD.org>
2 years agoarm64: Make sure COMPAT_FREEBSD32 handles thumb entry point.
Olivier Houchard [Wed, 30 Jun 2021 12:50:47 +0000 (14:50 +0200)]
arm64: Make sure COMPAT_FREEBSD32 handles thumb entry point.

If the entry point for the binary executed is a thumb 2 entry point, make
sure we set the PSR_T bit, or the CPU will interpret it as arm32 code and
bad things will happen.

PR: 256899
MFC after: 1 week

(cherry picked from commit 712c060c94fd447c91b0e6218c12a431206b487a)
Signed-off-by: Olivier Houchard <cognet@FreeBSD.org>
2 years agot_getgroups: No longer expected to fail
Warner Losh [Wed, 2 Jun 2021 18:02:56 +0000 (12:02 -0600)]
t_getgroups: No longer expected to fail

Sponsored by: Netflix

(cherry picked from commit bf26ea77553931c22e72ddf1f9df6fb51fcbadfe)

2 years agokern: fail getgroup and setgroup with negative int
Moritz Buhl [Tue, 9 Jul 2019 15:03:37 +0000 (17:03 +0200)]
kern: fail getgroup and setgroup with negative int

Found using
https://github.com/NetBSD/src/blob/trunk/tests/lib/libc/sys/t_getgroups.c

getgroups/setgroups want an int and therefore casting it to u_int
resulted in `getgroups(-1, ...)` not returning -1 / errno = EINVAL.

imp@ updated syscall.master and made changes markj@ suggested

PR: 189941
Tested by: imp@
Reviewed by: markj@
Pull Request: https://github.com/freebsd/freebsd-src/pull/407
Differential Revision: https://reviews.freebsd.org/D30617

(cherry picked from commit 4bc2174a1b489c36195ccc8cfc15e0775b817c69)

2 years agoAdd deprecation notice for WITH_PROFILE option
Ed Maste [Sun, 27 Jun 2021 17:21:26 +0000 (13:21 -0400)]
Add deprecation notice for WITH_PROFILE option

As discussed on freebsd-current [1] and freebsd-arch [2] and review
D30833, FreeBSD 14 will ship without the _p.a libraries built with -pg.
Both upstream and base system (in commit b762974cf4b9) Clang have been
modified to remove the special case for linking against these libraries.

Clang's -pg support and mcount() remain, so building with -pg can still
be used on code that the user builds; we just do not provide prebuilt
libraries compiled with -pg.  A similar change is still needed for GCC.

[1]  https://lists.freebsd.org/pipermail/freebsd-current/2020-January/075105.html
[2] https://lists.freebsd.org/archives/freebsd-arch/2021-June/000016.html

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 175841285e289edebb6603da39f02549521ce950)

Clarify notice for profiled libraries in FreeBSD 14

Reported by: kevans
Fixes: 175841285e28 ("Add deprecation notice for...")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f94360971e649fa684ef3b7e72839b59c7242bdb)

2 years agoffs_softdep: force sync if journal is low in journal_check_space
Konstantin Belousov [Tue, 15 Jun 2021 10:27:37 +0000 (13:27 +0300)]
ffs_softdep: force sync if journal is low in journal_check_space

(cherry picked from commit 50acaaef54b4d7811393eb8c05a398d7a1882418)

2 years agoffs_softdep.c: add journal_check_space() helper
Konstantin Belousov [Tue, 15 Jun 2021 10:23:44 +0000 (13:23 +0300)]
ffs_softdep.c: add journal_check_space() helper

(cherry picked from commit 2126f103e0434db6ca34f0a5167bf5f03d4f02ad)

2 years agosoftdep_prelink(): only do sync if other thread changed the vnode metadata since...
Konstantin Belousov [Sat, 1 May 2021 21:53:21 +0000 (00:53 +0300)]
softdep_prelink(): only do sync if other thread changed the vnode metadata since previous prelink

FreeBSD_version is bumped due to struct namei size change

(cherry picked from commit 64b494a1050ae2cf2412edc19b57dc80f49eeda1)

2 years agoufs_rename(): only do softdep_prerename() when other thread changed a vnode
Konstantin Belousov [Thu, 29 Apr 2021 22:39:57 +0000 (01:39 +0300)]
ufs_rename(): only do softdep_prerename() when other thread changed a vnode

(cherry picked from commit f7565466622a411a50522f23528faeb1e57d4571)

2 years agoffs: mark block (re-)allocations as seqc writes
Konstantin Belousov [Fri, 21 May 2021 14:12:08 +0000 (17:12 +0300)]
ffs: mark block (re-)allocations as seqc writes

(cherry picked from commit d4d289cd51078de9e82c9d83977cfa614032cd06)

2 years agoufs_rename(): softdep_prerename() does something only for SU+J
Konstantin Belousov [Thu, 29 Apr 2021 22:23:38 +0000 (01:23 +0300)]
ufs_rename(): softdep_prerename() does something only for SU+J

(cherry picked from commit 5eacde3eb83de6ef1e0b126c019c759bf411e36a)

2 years agoffs: reduce number of dvp relocks in softdep_prelink()
Konstantin Belousov [Thu, 29 Apr 2021 22:21:33 +0000 (01:21 +0300)]
ffs: reduce number of dvp relocks in softdep_prelink()

(cherry picked from commit d0929a990c80b78bc84326234cf54cd4382d42fd)

2 years agoufs_vnops.c: style
Konstantin Belousov [Sat, 1 May 2021 21:40:50 +0000 (00:40 +0300)]
ufs_vnops.c: style

(cherry picked from commit b2b40b28b1784fb153f8aefb4f86e085a149e91e)

2 years agounionfs: do not use bare struct componentname
Konstantin Belousov [Mon, 14 Jun 2021 18:45:23 +0000 (21:45 +0300)]
unionfs: do not use bare struct componentname

(cherry picked from commit 190110f2eba1551793f290a9f01e52ffe015a5da)

2 years agonamei: add NDPREINIT() macro
Konstantin Belousov [Mon, 14 Jun 2021 19:03:41 +0000 (22:03 +0300)]
namei: add NDPREINIT() macro

(cherry picked from commit 802cf4ab0ee9cae7af523cfcf1221febd2143210)

2 years agoseqc: add symbolic name for in-modify bit
Konstantin Belousov [Thu, 29 Apr 2021 22:39:23 +0000 (01:39 +0300)]
seqc: add symbolic name for in-modify bit

(cherry picked from commit 71faea93070e6df371bf73ed12e2a1da27dc8e2d)

2 years agolibnv: optimize nvlist size calculation
Mariusz Zaborski [Fri, 11 Jun 2021 15:35:36 +0000 (17:35 +0200)]
libnv: optimize nvlist size calculation

If we had a multiple nvlist, during nvlist_pack, we calculated the size
of every nvlist separately. For example, if we had a nvlist with three
nodes each containing another (A contains B, and B contains C), we first
calculated the size of nvlist A (which contains B, C), then we calculate
the size of B (which contains C, notice that we already did the
calculation of B, when we calculate A), and finally C. This means that
this calculation was O(N!). This was done because each time we pack
nvlist, we have to put its size in the header
(the separate header for A, B, and C).

To not break the ABI and to reduce the complexity of nvlist_size,
instead of calculating the nvlist size when requested,
we track the size of each nvlist.

Reported by: pjd, kp
Tested by: kp

(cherry picked from commit 89d5cbb82294c8624e66f920d50353057ccab14b)

2 years agolibnv: fix revert
Mariusz Zaborski [Sun, 17 Feb 2019 18:32:19 +0000 (18:32 +0000)]
libnv: fix revert

Reported by: jenkins

(cherry picked from commit 3bea7b5b05f200df4cabee12e405b8feade16f0e)

2 years agolibnv: fix double free
Mariusz Zaborski [Sun, 17 Feb 2019 18:26:27 +0000 (18:26 +0000)]
libnv: fix double free

In r343986 we introduced a double free. The structure was already
freed fixed in the r302966. This problem was introduced
because the GitHub version was out of sync with the FreeBSD one.

Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org>
MFC with: r343986

(cherry picked from commit d97753b5c8f1d32fbcdcbb0d129b49f808245865)

2 years agolibnv: fix memory leaks
Mariusz Zaborski [Sun, 10 Feb 2019 23:28:55 +0000 (23:28 +0000)]
libnv: fix memory leaks

nvpair_create_stringv: free the temporary string; this fix affects
nvlist_add_stringf() and nvlist_add_stringv().

nvpair_remove_nvlist_array (NV_TYPE_NVLIST_ARRAY case): free the chain
of nvpairs (as resetting it prevents nvlist_destroy() from freeing it).
Note: freeing the chain in nvlist_destroy() is not sufficient, because
it would still leak through nvlist_take_nvlist_array().  This affects
all nvlist_*_nvlist_array() use

Submitted by: Mindaugas Rasiukevicius <rmind@netbsd.org>
Reported by: clang/gcc ASAN
MFC after: 2 weeks

(cherry picked from commit b5d787d93b3d83f28e87e1f8cc740cb160f8f0ac)

2 years agobsdinstall: Avoid double-mounting /dev
Ryan Moeller [Wed, 23 Jun 2021 13:42:43 +0000 (13:42 +0000)]
bsdinstall: Avoid double-mounting /dev

After 34766aa8cb514472c571f8b0e90e833833acef51 we are mounting and
unmounting devfs elsewhere already.

Reviewed by: nwhitehorn
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D30877

(cherry picked from commit b50db44f021c12283a2e140063a6b6fcc30295e5)

2 years agomd5: Improve compatibility with coreutils and format fix
Stefan Eßer [Tue, 29 Jun 2021 07:01:13 +0000 (09:01 +0200)]
md5: Improve compatibility with coreutils and format fix

The previous changes that added support for the coreutils -c option
modified the output generated by passing -r to match that of the
coreutils versions. The difference is that coreutils separates the
hash from the file name by two blanks "  " (or a blank followed by
an asterisk " *" with the -b option denoting).

While most scripts or users will not notice the difference, it might
be considered a violation of POLA and this commit reverts the change
for the non-sum programs. These will print a single blank " " as the
separator, as they die before the previous commit.

In order to still generate output that is identical to that of the
coreutils programs, this commit generates the "  " or " *" separator
used by them for the -sum versions, depending on the presence of the
-b option.

(cherry picked from commit b33d1898c1b0e6d76b52eb48078260588802dc95)

2 years agolibalias: Switch to SPLAY trees
Lutz Donnerhacke [Thu, 27 May 2021 21:42:54 +0000 (23:42 +0200)]
libalias: Switch to SPLAY trees

Current data structure is using a hash of unordered lists.  Those
unordered lists are quite efficient, because the least recently
inserted entries are most likely to be used again.  In order to avoid
long search times in other cases, the lists are hashed into many
buckets.  Unfortunatly a search for a miss needs an exhaustive
inspection and a careful definition of the hash.

Splay trees offer a similar feature - almost O(1) for access of the
least recently used entries), and amortized O(ln(n) - for almost all
other cases.  Get rid of the hash.

Now the data structure should able to quickly react to external
packets without eating CPU cycles for breakfast, preventing a DoS.

PR: 192888
Discussed with: Dimitry Luhtionov
Differential Revision: https://reviews.freebsd.org/D30516
Differential Revision: https://reviews.freebsd.org/D30536
Differential Revision: https://reviews.freebsd.org/D30844

(cherry picked from commit 935fc93af157dee352eb4b6c83f8a2a9e7fd9a4e)
(cherry picked from commit d261e57deacb0d00d9e827447f235df83dda3e3a)
(cherry picked from commit f70c98a2f5d993dc518efd606aa341eda99400ef)
(cherry picked from commit 25392fac9488bcae5c451500df2e2945430484a6)
(cherry picked from commit 2f4d91f9cb22fc65eb65407e8118b433a5d71976)
(cherry picked from commit 4060e77f49d1b9fd2254f3f4da94fd64fce83f72)

2 years agolibalias: Restructure
Lutz Donnerhacke [Tue, 25 May 2021 13:03:34 +0000 (15:03 +0200)]
libalias: Restructure

Clean up the database handling in order to switch to more efficient
data structures.  The development of this patch was artificially split
in to many small steps to ease reviewing.

- Common search terms
- Separate fully qualified search
- Separate table for partial links
- Cleanup _FindLinkIn
- Factor out the outgoing search function
- Factor out a common idiom to return found links
- Reorder incoming links by grouping of common search terms
- Remove LSNAT from outgoing search
- Group internal structure semantically
- Separate table for PPTP
- Use AliasRange instead of PORT_BASE
- Remove temporary state deleteAllLinks from global struct
- Avoid uninitialized expiration

Discussed with: Dimitry Luhtionov
Differential Revision: https://reviews.freebsd.org/D30568
Differential Revision: https://reviews.freebsd.org/D30569
Differential Revision: https://reviews.freebsd.org/D30570
Differential Revision: https://reviews.freebsd.org/D30571
Differential Revision: https://reviews.freebsd.org/D30572
Differential Revision: https://reviews.freebsd.org/D30573
Differential Revision: https://reviews.freebsd.org/D30574
Differential Revision: https://reviews.freebsd.org/D30575
Differential Revision: https://reviews.freebsd.org/D30580
Differential Revision: https://reviews.freebsd.org/D30581
Differential Revision: https://reviews.freebsd.org/D30604
Differential Revision: https://reviews.freebsd.org/D30582

(cherry picked from commit d41044ddfdbc2a026570cae11d5fc2e18f5e4b92)
(cherry picked from commit 32f9c2ceb3ec8266e48ec0f6d1556fd98ef12db6)
(cherry picked from commit cac129e6030095c33e95c5ce1cdcb9c5c21efce9)
(cherry picked from commit 19dcc4f2250b3850991366e3058ca8a64b2f135d)
(cherry picked from commit d5419034381d0e8e8c99f0f678118b197144bfff)
(cherry picked from commit d4ab07d2aeb13b1aae9ad5d73e5fe77131f2350c)
(cherry picked from commit 492d3b7109b45ff30fd199b7eeed797447746e42)
(cherry picked from commit 7b44ff4c52ce9e7a89e772566a249e5481fe0ac4)
(cherry picked from commit 1178dda53d10b096e0b99e356d15b7c24390e099)
(cherry picked from commit 9efcad61d8309ecad3c15392b277fd329a1e45e4)
(cherry picked from commit fe83900f9fa931e3d0942ec9c0709896b887c3d7)
(cherry picked from commit d989935b5bcd880353f0de89eda958c45e7e3342)
(cherry picked from commit b50a4dce185481bebf8096c27588ae04a4a2fd7c)
(cherry picked from commit f28455344483310cfd1aa5c0bdd4d014810c0e32)

2 years agolibalias: Promote per instance global variable timeStamp
Lutz Donnerhacke [Tue, 25 May 2021 07:07:21 +0000 (09:07 +0200)]
libalias: Promote per instance global variable timeStamp

Summary:
- Use LibAliasTime as a real global variable for central timekeeping.
- Reduce number of syscalls in user space considerably.
- Dynamically adjust the packet counters to match the second resolution.
- Only check the first few packets after a time increase for expiry.

Discussed with: hselasky
Differential Revision: https://reviews.freebsd.org/D30566

(cherry picked from commit ef828d39be8e4b6d922db080ed41611702dec56d)

2 years agolibalias: Stats are unsigned
Lutz Donnerhacke [Mon, 31 May 2021 22:08:24 +0000 (00:08 +0200)]
libalias: Stats are unsigned

Stats counters are used as unsigned valued (i.e. printf("%u")) but are
defined as signed int.  This causes trouble later, so fix it early.

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

(cherry picked from commit 3fd20a79e7b55d135bbc5fa197980fe0e9ee0f14)

2 years agolibalias: tidy up housekeeping
Lutz Donnerhacke [Sat, 15 May 2021 15:35:36 +0000 (17:35 +0200)]
libalias: tidy up housekeeping

Replace current expensive, but sparsly called housekeeping
by a single, repetive action.

This is part of a larger restructure of libalias in order to switch to
more efficient data structures.  The whole restructure process is
split into 15 reviews to ease reviewing.  All those steps will be
squashed into a single commit for MFC in order to hide the
intermediate states from production systems.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30277

(cherry picked from commit 294799c6b081faece556a5010a4f51552e131c2f)

2 years agogenet: pullup minimum header amount for IPv4
Mike Karels [Sun, 20 Jun 2021 17:50:31 +0000 (12:50 -0500)]
genet: pullup minimum header amount for IPv4

The genet driver (RPi4 Ethernet) had code to pull headers into the
first mbuf if there was only an Ethernet header there.  This was
originally needed for ICMPv6 replies, then for forwarded IPv6/TCP.
Now a situation has been found where it is needed for IPv4, when
using NAT with IPFW.  Generalize to do this for all protocols.
Rather than using an IPv6-related definition for the length, move
the length to a variable that can be set with sysctl
(hw.genet.tx_hdr_min).  Move an old tunable to a new RDTUN variable
with a better name.

PR: 25607
Reviewers: emaste
Differential Revision: https://reviews.freebsd.org/D30831

(cherry picked from commit 184291b0a56a68f2c0dc4388419b0f7d85a08cf4)

2 years agogenet: Fix potential crash during attach
Mike Karels [Sun, 20 Jun 2021 16:10:26 +0000 (11:10 -0500)]
genet: Fix potential crash during attach

As pointed out in the bug, the genet driver (RPi4 Ethernet) was
attaching the interrupts before the data structures were fully
initialized, causing a crash if an interrupt came in during the
attach.  Fix by reordering code blocks.

PR: 256334
Reported by: < ghuckriede at blackberry.com >
Reviewed by: < ghuckriede at blackberry.com > (informally)

(cherry picked from commit 13604fb0fd43c85e6bb3a0ad6400a684f150bdea)

2 years agoktls: switch bare zone_mbuf use to m_free_raw
Mateusz Guzik [Wed, 30 Jun 2021 13:02:45 +0000 (15:02 +0200)]
ktls: switch bare zone_mbuf use to m_free_raw

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

(cherry picked from commit 904a08f3427c8ae42b667c1f5dc3e441b48a8e84)

2 years agoiflib: switch bare zone_mbuf use to m_free_raw
Mateusz Guzik [Wed, 30 Jun 2021 14:17:29 +0000 (16:17 +0200)]
iflib: switch bare zone_mbuf use to m_free_raw

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

(cherry picked from commit bad5f0b6c2944453db2d70a982e8abf203f21669)

2 years agombuf: add m_free_raw to be used instead of directly calling uma_zfree
Mateusz Guzik [Wed, 30 Jun 2021 14:15:25 +0000 (16:15 +0200)]
mbuf: add m_free_raw to be used instead of directly calling uma_zfree

The intent is to remove all direct zone_mbuf consumers so that ctor/dtor
from that zone can be reimplemented as wrappers around uma, avoiding an
indirect function call.

Reviewed by: kbowling
Discussed with: gallatin
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30959

(cherry picked from commit 05462babd424124762375dca186802d7355af566)

2 years agopf: make DIOCGETSTATESNV iterations killable
Mateusz Guzik [Fri, 2 Jul 2021 07:28:48 +0000 (09:28 +0200)]
pf: make DIOCGETSTATESNV iterations killable

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

(cherry picked from commit 48d5b86364fa8e86318805d0078ccf9066e94ae8)

2 years agopfctl: cache getprotobynumber results
Mateusz Guzik [Thu, 1 Jul 2021 19:25:43 +0000 (21:25 +0200)]
pfctl: cache getprotobynumber results

As for example pfctl -ss keeps calling it, it saves a lot of overhead
from elided parsing of /etc/nsswitch.conf and /etc/protocols.

Sample result when running a pre-nvlist binary with nfs root and dumping
7 mln states:
before: 24.817u 62.993s 1:28.52 99.1%
after: 8.064u 1.117s 0:18.87 48.5%

Idea by Jim Thompson

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

(cherry picked from commit 858937bea4599d254a97ee6321683f8629604e15)

2 years agomac: cheaper check for ifnet_create_mbuf and ifnet_check_transmit
Mateusz Guzik [Tue, 29 Jun 2021 12:56:19 +0000 (14:56 +0200)]
mac: cheaper check for ifnet_create_mbuf and ifnet_check_transmit

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

(cherry picked from commit f77697dd9f31df85cd86370888606c81833f7c8a)

2 years agopf: revert: Use counter(9) for pf_state byte/packet tracking
Mateusz Guzik [Mon, 28 Jun 2021 18:50:56 +0000 (20:50 +0200)]
pf: revert: Use counter(9) for pf_state byte/packet tracking

stats are not shared and consequently per-CPU counters only waste
memory.

No slowdown was measured when passing over 20M pps.

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

(cherry picked from commit 55cc305dfcad0ad7c4f528fa47f7473927e8223a)

2 years agopf: make sure the dtrace probe has safe access to state
Mateusz Guzik [Mon, 28 Jun 2021 19:32:20 +0000 (21:32 +0200)]
pf: make sure the dtrace probe has safe access to state

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

(cherry picked from commit d26ef5c7ac830812f07a02787f25fed5d6f8609e)

2 years agopf: deduplicate V_pf_state_z handling with pfsync
Mateusz Guzik [Mon, 28 Jun 2021 18:18:26 +0000 (20:18 +0200)]
pf: deduplicate V_pf_state_z handling with pfsync

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

(cherry picked from commit 803dfe3da0e30520227a791ba5c2b93da16e1cf5)

2 years agopf: fix error-case leaks in pf_create_state
Mateusz Guzik [Mon, 28 Jun 2021 18:29:58 +0000 (20:29 +0200)]
pf: fix error-case leaks in pf_create_state

The hand-rolled clean up failed to free counters.

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

(cherry picked from commit 7f025db57c7879bfa43ac74ecd95903439fdd1d0)

2 years agopf: assert that sizeof(struct pf_state) <= 312
Mateusz Guzik [Mon, 28 Jun 2021 12:49:40 +0000 (14:49 +0200)]
pf: assert that sizeof(struct pf_state) <= 312

To prevent accidentally going over a threshold which makes UMA fit only
12 objects per page instead of 13.

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

(cherry picked from commit e6dd0e2e8d4f59275fb576a9ccb9d356d36457bb)

2 years agopf: factor out state allocation into pf_alloc_state
Mateusz Guzik [Mon, 28 Jun 2021 12:22:31 +0000 (14:22 +0200)]
pf: factor out state allocation into pf_alloc_state

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

(cherry picked from commit ccb17a21041e9206b80fa9f64b6ec20233df6403)

2 years agopf: add pf_release_staten and use it in pf_unlink_state
Mateusz Guzik [Mon, 28 Jun 2021 12:18:43 +0000 (14:18 +0200)]
pf: add pf_release_staten and use it in pf_unlink_state

Saves one atomic op.

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

(cherry picked from commit d09388d013300fc4aa1ee1a6bc24260cd400aff3)

2 years agortld-elf: Check the return value of obj_enforce_relro()
Alex Richardson [Tue, 22 Jun 2021 08:09:44 +0000 (09:09 +0100)]
rtld-elf: Check the return value of obj_enforce_relro()

The mprotect() call was failing on CheriBSD when changing rtld's relro
page permissions due to missing CHERI capability permissions on the
mprotect() argument but did not report an error since the return value
was being ignored. It should never fail on any supported FreeBSD
architecture, but checking the return value seems like a good
sanity check to me.

Reviewed By: kib, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30820

(cherry picked from commit e3be51b2bc7cb41eb9a238cced2ee650d9bb2d41)

2 years agotruss: minor cleanup and pedantic warning fixes
Alex Richardson [Wed, 16 Jun 2021 15:35:55 +0000 (16:35 +0100)]
truss: minor cleanup and pedantic warning fixes

Noticed while porting the recent truss compat32 changes to CheriBSD.
This also fixes i386 tracing by zero-extending user addresses instead
of sign-extending them.

Reviewed By: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30211

(cherry picked from commit 31dddc6a19042bad303cb3d3aa8f52a2cb22dd77)

2 years agotruss: fix handling of 64-bit arguments/return values for compat32
Alex Richardson [Wed, 16 Jun 2021 15:29:57 +0000 (16:29 +0100)]
truss: fix handling of 64-bit arguments/return values for compat32

Deciding whether to combine two values to a 64-bit one should be based on
the process ABI, and not dependent on whether truss is compiled for an
LP64 ABI. This is a follow-up cleanup for D27625. I found this while
looking for uses of the `__LP64__` macro (since using this is wrong for
CHERI systems).

Test Plan: truss still works. Since I tested on AMD64 and all syscalls
in the trace have their quad argument last there was no difference
in the output. Should fix output for compat32 on MIPS64 though.

Reviewed By: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D27637

(cherry picked from commit 8ba2e89e987c7ae171c5f099e59d599294d626b7)

2 years agokdump: use VIS_NOLOCALE when printing output
Alex Richardson [Wed, 16 Jun 2021 15:28:27 +0000 (16:28 +0100)]
kdump: use VIS_NOLOCALE when printing output

Attempting to parse the output as UTF-8 exposed an out-of-bounds read
in vis(3) (see https://reviews.freebsd.org/D30771). However, I don't
think it makes much sense to decode this output at all. Additionally,
passing one byte at a time will almost certainly result in incorrect
output for multi-byte characters.

Reviewed By: brooks
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30772

(cherry picked from commit 1a3a57d74590bb44e96629aec35897b475bd69fa)

2 years agovis(3): avoid out-of-bounds stack buffer reads
Alex Richardson [Wed, 16 Jun 2021 15:27:13 +0000 (16:27 +0100)]
vis(3): avoid out-of-bounds stack buffer reads

I found this while running kdump(1) on a CheriBSD system due to a
capability length violation when printing the /etc/libmap.conf read()
system call: it crashed immediately after printing the first line.

Found by: CHERI
Reviewed By: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30771

(cherry picked from commit 1a2f06d0f2905c9a18340b377cbbe772f2ca6844)

2 years agoExpose clang's alignment builtins and use them for roundup2/rounddown2
Alex Richardson [Wed, 3 Feb 2021 15:27:17 +0000 (15:27 +0000)]
Expose clang's alignment builtins and use them for roundup2/rounddown2

This makes roundup2/rounddown2 type- and const-preserving and allows
using it on pointer types without casting to uintptr_t first. Not
performing pointer-to-integer conversions also helps the compiler's
optimization passes and can therefore result in better code generation.
When using it with integer values there should be no change other than
the compiler checking that the alignment value is a valid power-of-two.

I originally implemented these builtins for CHERI a few years ago and
they have been very useful for CheriBSD. However, they are also useful
for non-CHERI code so I was able to upstream them for Clang 10.0.

Rationale from the clang documentation:
Clang provides builtins to support checking and adjusting alignment
of pointers and integers. These builtins can be used to avoid relying
on implementation-defined behavior of arithmetic on integers derived
from pointers. Additionally, these builtins retain type information
and, unlike bitwise arithmetic, they can perform semantic checking on
the alignment value.

There is also a feature request for GCC, so GCC may also support it in
the future: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641

Reviewed By: brooks, jhb, imp
Differential Revision: https://reviews.freebsd.org/D28332

(cherry picked from commit 8fa6abb6f4f64f4f23e2920e2aea7996566851a4)

2 years agofwohci: Cast bitfield to uint32_t before passing it to roundup2().
John Baldwin [Wed, 17 Feb 2021 21:12:06 +0000 (13:12 -0800)]
fwohci: Cast bitfield to uint32_t before passing it to roundup2().

The fallback for __align_up() used by roundup2() uses __typeof__()
which doesn't work for bitfields.  This fixes the build on GCC which
uses the fallback.

Reviewed by: arichardson, markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D28599

(cherry picked from commit 50a61f8db532676d7dc37410540fff7209b7c072)

2 years agoif_vtnet: Fix pointer-sign and used parameter warnings
Alex Richardson [Mon, 22 Feb 2021 17:26:21 +0000 (17:26 +0000)]
if_vtnet: Fix pointer-sign and used parameter warnings

Reviewed By: grehan
Differential Revision: https://reviews.freebsd.org/D28726

(cherry picked from commit c1b554c868195ed10ac1eb25fa9ca4a5baae4638)

2 years agousr.sbin/pkg: Don't re-define roundup2
Alex Richardson [Thu, 28 Jan 2021 17:25:50 +0000 (17:25 +0000)]
usr.sbin/pkg: Don't re-define roundup2

The file already includes sys/param.h and should use that definition.
I found this while testing D28332.

Reviewed By: bapt
Differential Revision: https://reviews.freebsd.org/D28331

(cherry picked from commit 9a0a48b12d3d85f0f00b99439e6a8779f5f1abb6)

2 years agotests/libalias: Bugfix in used variables
Lutz Donnerhacke [Fri, 2 Jul 2021 21:58:16 +0000 (23:58 +0200)]
tests/libalias: Bugfix in used variables

Fix two copy and waste errors (referencing the wrong variable).

(cherry picked from commit b3dc6f137b8d626c4415a5fa9c9874ac4ca78658)

3 years agoperiodic: by default, skip 221.backup-gpart in jails
Alan Somers [Fri, 18 Jun 2021 14:33:08 +0000 (08:33 -0600)]
periodic: by default, skip 221.backup-gpart in jails

It can still be enabled as usual in /etc/periodic.conf

PR: 256253
Reported by: delphij
Submitted by: Miroslav Lachman <000.fbsd@quip.cz>

(cherry picked from commit fcf2227a557552e45646bbcf2422a98baab5c8a8)

3 years agofusefs: ensure that FUSE ops' headers' unique values are actually unique
Alan Somers [Fri, 18 Jun 2021 00:04:59 +0000 (18:04 -0600)]
fusefs: ensure that FUSE ops' headers' unique values are actually unique

Every FUSE operation has a unique value in its header.  As the name
implies, these values are supposed to be unique among all outstanding
operations.  And since FUSE_INTERRUPT is asynchronous and racy, it is
desirable that the unique values be unique among all operations that are
"close in time".

Ensure that they are actually unique by incrementing them whenever we
reuse a fuse_dispatcher object, for example during fsync, write, and
listextattr.

PR: 244686
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D30810

(cherry picked from commit 5403f2c163f7e3d1adb9431d216f88d57cf9d74b)

3 years agofusefs: also debug INIT operations in the test suite
Alan Somers [Thu, 17 Jun 2021 22:06:43 +0000 (16:06 -0600)]
fusefs: also debug INIT operations in the test suite

Reviewed by: pfg

(cherry picked from commit 77b040c993ba9d4844e36f1f5b057066a5b4015a)

3 years agofusefs: delete dead code
Alan Somers [Fri, 18 Jun 2021 00:14:57 +0000 (18:14 -0600)]
fusefs: delete dead code

It was always dead, accidentally included in SVN r345876.

Reviewed by: pfg

(cherry picked from commit b97c7abc1a1cee72ef62109add860c1e8e618efd)

3 years agofusefs: support EVFILT_WRITE on /dev/fuse
Alan Somers [Tue, 15 Jun 2021 23:17:28 +0000 (17:17 -0600)]
fusefs: support EVFILT_WRITE on /dev/fuse

/dev/fuse is always ready for writing, so it's kind of dumb to poll it.
But some applications do it anyway.  Better to return ready than EINVAL.

Reviewed by: emaste, pfg
Differential Revision: https://reviews.freebsd.org/D30784

(cherry picked from commit 7b8622fa220b9c08041102f638f848c48e022644)

Simplify fuse_device_filt_write

It always returns 1, so why bother having a variable.

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

(cherry picked from commit 9b876fbd504e5c718d8d0275b32d806ab14558c8)

3 years agofusefs: improve warnings about buggy FUSE servers
Alan Somers [Tue, 15 Jun 2021 20:24:05 +0000 (14:24 -0600)]
fusefs: improve warnings about buggy FUSE servers

The fusefs driver will print warning messages about FUSE servers that
commit protocol violations.  Previously it would print those warnings on
every violation, but that could spam the console.  Now it will print
each warning no more than once per lifetime of the mount.  There is also
now a dtrace probe for each violation.

Sponsored by: Axcient
Reviewed by: emaste, pfg
Differential Revision: https://reviews.freebsd.org/D30780

(cherry picked from commit 0b9a5c6fa1733e600dcdb3b9df3b3d0ad5996920)

3 years agofusefs: delete dead code
Alan Somers [Tue, 15 Jun 2021 19:34:01 +0000 (13:34 -0600)]
fusefs: delete dead code

Delete two fields in the per-mountpoint struct that have never been
used.

Sponsored by: Axcient

(cherry picked from commit d63e6bc256016c7f5223ff5541671e5a96c4c6c4)

3 years agovn_fullpath.9: update args after rev 364633
Alan Somers [Tue, 15 Jun 2021 20:21:05 +0000 (14:21 -0600)]
vn_fullpath.9: update args after rev 364633

Sponsored by: Axcient
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D30779

(cherry picked from commit fcb5a0a2add19ab070944483a04dc4272f118721)

3 years agoid: sanitize arguments better
Alan Somers [Fri, 11 Jun 2021 16:38:07 +0000 (10:38 -0600)]
id: sanitize arguments better

The -[AMc] flags ignore the user argument.  Better if id rejects
invocations that include a user argument along with any of those flags.

PR: 256554
Reviewed by: trasz
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D30734

(cherry picked from commit 4a06e9377398b34922f8a67d7cb3ea980b95bde8)

3 years agoFix build with WITHOUT_AUDIT=yes in src.conf
Emmanuel Vadot [Thu, 15 Apr 2021 12:11:13 +0000 (14:11 +0200)]
Fix build with WITHOUT_AUDIT=yes in src.conf

Always install the audit related includes are some part of the source
always requires them.

Reported by: many
Fixes: 8c3eaf244a417a4

(cherry picked from commit f41efc453ab5563cde214cb19273d87e6e4aa2d4)

3 years agoshared shadow vm object invalidation regression test
Ryan Libby [Wed, 7 Apr 2021 19:39:05 +0000 (12:39 -0700)]
shared shadow vm object invalidation regression test

Add a regression test for a scenario where a shadow vm object is shared
by multiple mappings.  If a page COW occurs through one of the mappings,
then the virtual-to-physical mapping may become invalidated.

This tests the scenario from CVE-2021-29626 which was fixed by
982693bb729badac4e65ecd59772979f2849a2b2.

Reviewed by: markj
Sponsored by: Dell EMC Isilon

(cherry picked from commit 13d4f96130b64b42f74dfc484305b08c4da54669)

3 years agoddb: reliably fail with ambiguous commands
Ryan Libby [Wed, 24 Feb 2021 23:56:16 +0000 (15:56 -0800)]
ddb: reliably fail with ambiguous commands

db_cmd_match had an even/odd bug, where if a third command was partially
matched (or any odd number greater than one) the search result would be
set back from CMD_AMBIGUOUS to CMD_FOUND, causing the last command in
the list to be executed instead of failing the match.

Reported by: mlaier
Reviewed by: markj, mlaier, vangyzen
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D28659

(cherry picked from commit d85c9cef1380f4f135aee95ad8c1f4d3eca74c5b)

3 years agoofed: quiet gcc -Wint-in-bool-context
Ryan Libby [Wed, 24 Feb 2021 23:56:16 +0000 (15:56 -0800)]
ofed: quiet gcc -Wint-in-bool-context

The int in the argument to the ternary triggered -Wint-in-bool-context
from gcc.  Upstream linux has a larger and more entangled patch,
12f727721eee61b3d19dedb95cb893b2baa9fe41, which doesn't apply cleanly.
When we eventually sync that, we can just drop this change.

Reviewed by: hselasky, imp, kib
MFC after: 3 days
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D28762

(cherry picked from commit bf667f282a7b98e7456d11e1cb46d9707ab8e774)

3 years agobhyvectl: print a better error message when vm_open() fails
Marko [Sun, 7 Mar 2021 06:19:30 +0000 (21:19 -0900)]
bhyvectl: print a better error message when vm_open() fails

libvmm: explicitly save and restore errno in vm_open()

Use errno to print a more descriptive error message when vm_open() fails

PR:             250671
Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D29109

(cherry picked from commit 6bb140e3ca895a148f32c93d50f93619bf735f73)
(cherry picked from commit a7f81b488df2d4a5dcd785b4112e04ffb6ca0442)

3 years agorpc.lockd: Use libc strnlen() instead of reimplementing it
Mark Johnston [Wed, 23 Jun 2021 14:06:57 +0000 (10:06 -0400)]
rpc.lockd: Use libc strnlen() instead of reimplementing it

No functional change intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2bbeada0f75a78c24ef9eaeb97c24a672425791d)

3 years agomdconfig tests: Correct a copy-pasted test description
Mark Johnston [Wed, 23 Jun 2021 14:37:40 +0000 (10:37 -0400)]
mdconfig tests: Correct a copy-pasted test description

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4420bb6a8642e3a24f30c2917dc994cf5800ea6f)

3 years agozfs: merge openzfs/zfs@508fff0e4 (zfs-2.1-release) into stable/13
Martin Matuska [Wed, 30 Jun 2021 08:55:27 +0000 (10:55 +0200)]
zfs: merge openzfs/zfs@508fff0e4 (zfs-2.1-release) into stable/13

Notable upstream pull request merges:
  #12253 module/zfs: simplify ddt_stat_add() loop
  #12280 Help compiller optimize out abd_verify()
  #12288 Avoid 64bit division in multilist index functions

Obtained from: OpenZFS
OpenZFS commit: 508fff0e4b0653744fd6ae7857cc860e4d0d80af
OpenZFS tag: zfs-2.1.0-rc8

3 years agoUPDATING: Add a note for pkgbase user for commit 632e3f2f3a66
Emmanuel Vadot [Wed, 30 Jun 2021 07:27:03 +0000 (09:27 +0200)]
UPDATING: Add a note for pkgbase user for commit 632e3f2f3a66

3 years agopkgbase: Put the last sendmail files in the sendmail package
Emmanuel Vadot [Sat, 19 Jun 2021 15:50:11 +0000 (17:50 +0200)]
pkgbase: Put the last sendmail files in the sendmail package

Differential Revision: https://reviews.freebsd.org/D30757
Sponsored by: Diablotin Systems

3 years agopkgbase: Put the mibs and defs in the bnsmp package
Emmanuel Vadot [Sat, 19 Jun 2021 15:50:03 +0000 (17:50 +0200)]
pkgbase: Put the mibs and defs in the bnsmp package

Differential Revision: https://reviews.freebsd.org/D30756
Sponsored by: Diablotin Systems

3 years agopkgbase: Move ctld/ctladm to iscsi package
Emmanuel Vadot [Sat, 19 Jun 2021 15:49:57 +0000 (17:49 +0200)]
pkgbase: Move ctld/ctladm to iscsi package

While here only compile both of them if WITH_ISCSI is set (this is the default).

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D30755
Sponsored by: Diablotin Systems

3 years agopkgbase: Create a FreeBSD-nfs package
Emmanuel Vadot [Sat, 19 Jun 2021 15:49:50 +0000 (17:49 +0200)]
pkgbase: Create a FreeBSD-nfs package

And move all the nfs related commands there.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D30754
Sponsored by: Diablotin Systems

3 years agopkgbase: Put chio in utilities
Emmanuel Vadot [Sat, 19 Jun 2021 15:49:44 +0000 (17:49 +0200)]
pkgbase: Put chio in utilities

No need to bloat runtime with this utility.

Differential Revision: https://reviews.freebsd.org/D30753
Sponsored by: Diablotin Systems

3 years agopkgbase: Put dtrace in its own package
Emmanuel Vadot [Sat, 19 Jun 2021 15:49:31 +0000 (17:49 +0200)]
pkgbase: Put dtrace in its own package

While dtrace is usefull some people might not want it.

Differential Revision: https://reviews.freebsd.org/D30752
Sponsored by: Diablotin Systems

3 years agopkgbase: Put openssl in its own package
Emmanuel Vadot [Sun, 2 May 2021 15:46:17 +0000 (17:46 +0200)]
pkgbase: Put openssl in its own package

This is useful for upgrade and also to make tiny jail so they won't
depend on FreeBSD-utilities (where openssl was packaged before).

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

3 years agopkgbase: Move librt to clibs
Emmanuel Vadot [Mon, 3 May 2021 08:12:26 +0000 (10:12 +0200)]
pkgbase: Move librt to clibs

librt implement the POSIX realtime extension library.
Move it to clibs instead of utilities as a number of ports uses it
so avoid a dependancy on FreeBSD-utilities.

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

3 years agoConvert libs with pc files to use PCFILES
Emmanuel Vadot [Tue, 16 Mar 2021 06:13:07 +0000 (07:13 +0100)]
Convert libs with pc files to use PCFILES

Now the .pc ends up in the correct package (-dev)

Reviewed by: bapt, emaste
Differential Revision: https://reviews.freebsd.org/D29172
MFC after:      2 weeks

3 years agobsd.lib.mk: Add a install target for .pc files
Emmanuel Vadot [Tue, 16 Mar 2021 06:13:03 +0000 (07:13 +0100)]
bsd.lib.mk: Add a install target for .pc files

That way the files are correctly taggued for pkgbase

Reviewed by: bapt, emaste (both earlier version)
Differential Revision: https://reviews.freebsd.org/D29171
MFC after:      2 weeks

3 years agopkgbase: Remove case for runtime and jail package ucl generation
Emmanuel Vadot [Tue, 16 Mar 2021 06:12:56 +0000 (07:12 +0100)]
pkgbase: Remove case for runtime and jail package ucl generation

They aren't needed and produce wrong package comments :
We use to have "runtime-dev package" instead of
"FreeBSD Base System (Development Files)" for example

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29168
MFC after:      2 weeks

3 years agopkgbase: Install all cam includes with INCS
Emmanuel Vadot [Tue, 16 Mar 2021 06:12:49 +0000 (07:12 +0100)]
pkgbase: Install all cam includes with INCS

Now they are correctly taggued and put into the -dev package

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29166
MFC after:      2 weeks

3 years agopkgbase: Install all BSM includes with INCS
Emmanuel Vadot [Tue, 16 Mar 2021 06:12:46 +0000 (07:12 +0100)]
pkgbase: Install all BSM includes with INCS

Now they are correctly taggued and put them into the libbsm package

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29165
MFC after:      2 weeks

3 years agopkgbase: Move libicp in utilities
Emmanuel Vadot [Tue, 16 Mar 2021 06:12:40 +0000 (07:12 +0100)]
pkgbase: Move libicp in utilities

libicp is used by zdb zhack zinject zstream ztest libzpool.so.2 which
are all in FreeBSD-utilities.

Reviewed by: bapt, emaste
Differential Revision: https://reviews.freebsd.org/D29164
MFC after: 2 weeks

3 years agoamd64: do not touch BIOS reset flag halfword, unless we boot through BIOS
Konstantin Belousov [Sun, 20 Jun 2021 14:58:11 +0000 (17:58 +0300)]
amd64: do not touch BIOS reset flag halfword, unless we boot through BIOS

(cherry picked from commit 33e1287b6a54672860d6646111ef0e544a00c569)

3 years agovdso: lower precision of vdso implementation of CLOCK_MONOTONIC_FAST and CLOCK_UPTIME...
Konstantin Belousov [Tue, 22 Jun 2021 23:24:08 +0000 (02:24 +0300)]
vdso: lower precision of vdso implementation of CLOCK_MONOTONIC_FAST and CLOCK_UPTIME_FAST

(cherry picked from commit 60b0ad10dd0fc7ff6892ecc7ba3458482fcc064c)

3 years agovdso gettimeofday: minor restructuring
Konstantin Belousov [Tue, 22 Jun 2021 23:58:32 +0000 (02:58 +0300)]
vdso gettimeofday: minor restructuring

(cherry picked from commit e912fbe1675714aab0179999923c171615e78c07)

3 years agonfscl: Make NFSv4.0 client acquisition NFSv4.1/4.2 compatible
Rick Macklem [Wed, 16 Jun 2021 00:42:13 +0000 (17:42 -0700)]
nfscl: Make NFSv4.0 client acquisition NFSv4.1/4.2 compatible

When the NFSv4.0 client was implemented, acquisition of a clientid
via SetClientID/SetClientIDConfirm was done upon the first Open,
since that was when it was needed.  NFSv4.1/4.2 acquires the clientid
during mount (via ExchangeID/CreateSession), since the associated
session is required during mount.

This patch modifies the NFSv4.0 mount so that it acquires the
clientid during mount.  This simplifies the code and makes it
easy to implement "find the highest minor version supported by
the NFSv4 server", which will be done for the default minorversion
in a future commit.
The "start_renewthread" argument for nfscl_getcl() is replaced
by "tryminvers", which will be used by the aforementioned
future commit.

(cherry picked from commit aed98fa5acb1a62bb79fc0e182b2151b239d6239)

3 years agoTag 2.1.0-rc8
Brian Behlendorf [Thu, 24 Jun 2021 21:43:02 +0000 (14:43 -0700)]
Tag 2.1.0-rc8

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
3 years agoLinux 5.13 compat: META
Brian Behlendorf [Tue, 29 Jun 2021 20:16:38 +0000 (13:16 -0700)]
Linux 5.13 compat: META

Increase the Linux-Maximum version in the META file to 5.13.
All of the required compatibility patches have been merged
and the 5.13 kernel has been officially released.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
3 years agozed: fix sending emails (#12292)
Laurențiu Nicola [Tue, 29 Jun 2021 19:33:49 +0000 (22:33 +0300)]
zed: fix sending emails (#12292)

Commit 6fc3099 broke the quoting when invoking the mail program, revert
that change.

Signed-off-by: Laurențiu Nicola <lnicola@dend.ro>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
3 years agoAvoid 64bit division in multilist index functions
Alexander Motin [Tue, 29 Jun 2021 12:59:14 +0000 (08:59 -0400)]
Avoid 64bit division in multilist index functions

The number of sublists in a multilist is relatively small. We dont need
64 bits to calculate an index. 32 bits is sufficient and makes the
code more efficient.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12288