]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agosystat.1: Fix synopsis
Mateusz Piotrowski [Wed, 10 Feb 2021 17:02:14 +0000 (18:02 +0100)]
systat.1: Fix synopsis

systat does not have a "-display" flag. Use Ar to indicate that
"display" is meant to be substituted with an actual display command.

(cherry picked from commit e6f59be239aa17f80b44ded4779e29f5d5352b28)

3 years agoossl(4): Install the man page also for arm64
Gordon Bergling [Wed, 14 Apr 2021 16:32:56 +0000 (18:32 +0200)]
ossl(4): Install the man page also for arm64

In 22bd0c9731d7 ossl(4) was ported to arm64. The manual page was
adapted, but never installed since the ossl(4) manual page was
i386 / amd64 only.

Reviewed by: mhorne
Differential Revision: https://reviews.freebsd.org/D29762

(cherry picked from commit b1ab802ce4908b6af93e3a3b4328377003735357)

3 years agotcp: Use jenkins_hash32() in hostcache
Richard Scheffenegger [Thu, 8 Apr 2021 18:28:43 +0000 (20:28 +0200)]
tcp: Use jenkins_hash32() in hostcache

As other parts of the base tcp stack (eg.
tcp fastopen) already use jenkins_hash32,
and the properties appear reasonably good,
switching to use that.

Reviewed By: tuexen, #transport, ae
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29515

(cherry picked from commit b878ec024bbee063f4181c9be08476a864fa6a7b)

3 years agotcp: Use sbuf_drain unconditionally
Richard Scheffenegger [Fri, 2 Apr 2021 18:26:48 +0000 (20:26 +0200)]
tcp: Use sbuf_drain unconditionally

After making sbuf_drain safe for external use,
there is no need to protect the call.

MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29545

(cherry picked from commit 38ea2bd0698e434ec531b97fa94b24db24e16629)
(cherry picked from commit a04906f0273fa6d80eb3ebf22b9b84e53e6b21e0)

3 years agotcp: Shouldn't drain empty sbuf
Richard Scheffenegger [Thu, 1 Apr 2021 15:18:04 +0000 (17:18 +0200)]
tcp: Shouldn't drain empty sbuf

MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29524

(cherry picked from commit 9aef4e7c2bd4371e526e4e3feb26064d361ad8ce)

3 years agotcp: Add hash histogram output and validate bucket length accounting
Richard Scheffenegger [Thu, 1 Apr 2021 12:44:05 +0000 (14:44 +0200)]
tcp: Add hash histogram output and validate bucket length accounting

Provide a histogram output to check, if the hashsize or
bucketlimit could be optimized. Also add some basic sanity
checks around the accounting of the hash utilization.

MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29506

(cherry picked from commit 02f26e98c7f4d43d6bd077421286da455e069146)

3 years agotcp: For hostcache performance, use atomics instead of counters
Richard Scheffenegger [Thu, 1 Apr 2021 08:00:32 +0000 (10:00 +0200)]
tcp: For hostcache performance, use atomics instead of counters

As accessing the tcp hostcache happens frequently on some
classes of servers, it was recommended to use atomic_add/subtract
rather than (per-CPU distributed) counters, which have to be
summed up at high cost to cache efficiency in a hot codepath.

PR: 254333
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Reviewed By: #transport, tuexen, jtl
Differential Revision: https://reviews.freebsd.org/D29522

(cherry picked from commit 529a2a0f2765f6c57c50a5af6be242c03bf714e3)

3 years agotcp: Make hostcache.cache_count MPSAFE by using a counter_u64_t
Richard Scheffenegger [Wed, 31 Mar 2021 17:30:20 +0000 (19:30 +0200)]
tcp: Make hostcache.cache_count MPSAFE  by using a counter_u64_t

Addressing the underlying root cause for cache_count to
show unexpectedly high  values, by protecting all arithmetic on
that global variable by using counter(9).

PR: 254333
Reviewed By: tuexen, #transport
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29510

(cherry picked from commit 95e56d31e348594973affd0ea81d8f8383bc3031)

3 years agotcp: drain tcp_hostcache_list in between per-bucket locks
Richard Scheffenegger [Wed, 31 Mar 2021 17:24:01 +0000 (19:24 +0200)]
tcp: drain tcp_hostcache_list in between per-bucket locks

Explicitly drain the sbuf after completing each hash bucket
to minimize the work performed while holding the hash
bucket lock.

PR: 254333
MFC after: 2 weeks
Reviewed By: tuexen, jhb, #transport
Sponsored by:  NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29483

(cherry picked from commit 869880463cc2ce64e2e6599eaec880a981f3ced6)

3 years agotcp: reduce memory footprint when listing tcp hostcache
Richard Scheffenegger [Sun, 28 Mar 2021 21:12:03 +0000 (23:12 +0200)]
tcp: reduce memory footprint when listing tcp hostcache

In tcp_hostcache_list, the sbuf used would need a large (~2MB)
blocking allocation of memory (M_WAITOK), when listing a
full hostcache. This may stall the requestor for an indeterminate
time.

A further optimization is to return the expected userspace
buffersize right away, rather than preparing the output of
each current entry of the hostcase, provided by: @tuexen.

This makes use of the ready-made functions of sbuf to work
with sysctl, and repeatedly drain the much smaller buffer.

PR: 254333
MFC after: 2 weeks
Reviewed By: #transport, tuexen
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29471

(cherry picked from commit cb0dd7e122b8936ad61a141e65ef8ef874bfebe5)

3 years agoMake sbuf_drain safe for external use
Richard Scheffenegger [Fri, 2 Apr 2021 18:11:45 +0000 (20:11 +0200)]
Make sbuf_drain safe for external use

While sbuf_drain was an internal function, two
KASSERTS checked the sanity of it being called.
However, an external caller may be ignorant if
there is any data to drain, or if an error has
already accumulated. Be nice and return immediately
with the accumulated error.

MFC after: 2 weeks
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29544

(cherry picked from commit cad4fd0365a5e3235e715e072e6ee9dffaa7a3ab)

3 years agoExport sbuf_drain to orchestrate lock and drain action
Richard Scheffenegger [Wed, 31 Mar 2021 16:25:53 +0000 (18:25 +0200)]
Export sbuf_drain to orchestrate lock and drain action

While exporting large amounts of data to a sysctl
request, datastructures may need to be locked.

Exporting the sbuf_drain function allows the
coordination between drain events and held
locks, to avoid stalls.

PR: 254333
Reviewed By: jhb
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29481

(cherry picked from commit c804c8f2c58ba42d476de07fbceff9ac4dd95f0e)

3 years agoed(1): Add two references in the SEE ALSO section
Gordon Bergling [Fri, 9 Apr 2021 07:43:49 +0000 (09:43 +0200)]
ed(1): Add two references in the SEE ALSO section

Obtained from: OpenBSD

(cherry picked from commit 3ce579325e424ce9297546553fb453a4ec62c20b)

3 years agoconfig(8): Mention the authors of a paper in the SEE ALSO section
Gordon Bergling [Fri, 9 Apr 2021 09:20:49 +0000 (11:20 +0200)]
config(8): Mention the authors of a paper in the SEE ALSO section

Obtained from: OpenBSD

(cherry picked from commit 2b59392cb0da804e825c63469beb1934ec4267db)

3 years agolpd(8): Mention the author of a paper in the SEE ALSO section
Gordon Bergling [Fri, 9 Apr 2021 09:29:18 +0000 (11:29 +0200)]
lpd(8): Mention the author of a paper in the SEE ALSO section

Obtained from: OpenBSD

(cherry picked from commit c07aa0a5878f55ef22b8d0ba5f66a728b1407427)

3 years agoarm64: adjust comments in dbg_monitor_exit()
Mitchell Horne [Tue, 13 Apr 2021 17:34:58 +0000 (14:34 -0300)]
arm64: adjust comments in dbg_monitor_exit()

These comments were copied from dbg_monitor_enter(), but the intended
modifications weren't made. Update them to reflect what this code
actually does.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5742f2d89c03311e8b2d92422c0e2e4063cb2e1d)

3 years agoarm64: clear debug registers after execve(2)
Mitchell Horne [Fri, 9 Apr 2021 14:13:21 +0000 (11:13 -0300)]
arm64: clear debug registers after execve(2)

This is both intuitive and required, as any previous breakpoint settings
may not be applicable to the new process.

Reported by: arichardson
Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit a2a8b582bdc1c8c1f4da3ae727349327f5fc9dd8)

3 years agormlock(9): add an RM_DUPOK flag
Mitchell Horne [Thu, 8 Apr 2021 17:41:19 +0000 (14:41 -0300)]
rmlock(9): add an RM_DUPOK flag

Allows for duplicate locks to be acquired without witness complaining.
Similar flags exists already for rwlock(9) and sx(9).

Reviewed by: markj
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.

(cherry picked from commit 2816bd8442bc323d50434d0e64cb4b7c10a195e8)

3 years agoarm64: clear debug register state on fork
Mitchell Horne [Wed, 7 Apr 2021 19:23:46 +0000 (16:23 -0300)]
arm64: clear debug register state on fork

Following the analogous change for amd64 and i386 in 8223717ce62c,
ensure that new processes start with these registers inactive.

PR: 254661
Reported by: Michał Górny
Reviewed by: kib, emaste
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1fd001db9c330f133708f3c04c8852f8b07cfed9)

3 years agoPartially revert r248770.
Dmitry Chagin [Fri, 2 Apr 2021 08:43:17 +0000 (11:43 +0300)]
Partially revert r248770.

Under geom(4) nvme_ns_bio_process() is on the path where sleep
is prohibited as g_io_shedule_down() calls THREAD_NO_SLEEPNG()
before geom->start().

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D29539

(cherry picked from commit a78109d5db87b08785a822770e2e4fdb15f921b6)

3 years agoRemoved the reference to the deprecated splx API from ifnet(9).
Dmitry Chagin [Fri, 9 Apr 2021 14:22:12 +0000 (17:22 +0300)]
Removed the reference to the deprecated splx API from ifnet(9).

Reviewed by: emaste, markj
PR: 254880
Differential Revision: https://reviews.freebsd.org/D29666

(cherry picked from commit f2400e6e832d42ca72b0d04ecd070598f4a81eb7)

3 years agoAdd a new mode to the scripted partition editor for variant disk names.
Nathan Whitehorn [Fri, 26 Mar 2021 15:39:12 +0000 (11:39 -0400)]
Add a new mode to the scripted partition editor for variant disk names.

If the disk parameter "DEFAULT" is set in place of an actual device name,
or no disk is specified for the PARTITIONS parameter, the installer will
follow the logic used in the automatic-partitioning mode, in which it
will either provide a selection dialog for one of several disks if
several are present or automatically select it if there is only one. This
simplifies the creation of fully-automatic installation media for
hardware or VMs with varying disk names.

Suggested by: Egoitz Aurrekoetxea <egoitz@sarenet.es>
MFC after: 3 weeks
Relnotes: yes

(cherry picked from commit 5140034cc077c416690b4fdb79a96744fe0af0e6)

3 years agoifconfig: Reuse media state in ifmedia_getstate
Ryan Moeller [Fri, 16 Apr 2021 02:32:25 +0000 (22:32 -0400)]
ifconfig: Reuse media state in ifmedia_getstate

This restores behavior lost in code cleanup, fixing a regression after
2803fa471e77dc8f227fe00bbf075de7feb10022 where changing media options
only applies some of the changes, not all.

Reported by: np
Reviewed by: donner
Differential Revision: https://reviews.freebsd.org/D29741

(cherry picked from commit 407fb44c920a580a30dfe7d1add796a7b35a5ac7)

3 years agofbt: Remove some handling for multiple CTF containers
Mark Johnston [Fri, 2 Apr 2021 21:42:26 +0000 (17:42 -0400)]
fbt: Remove some handling for multiple CTF containers

This was ported from illumos but not completely done.  Currently we do
not perform type deduplication between KLDs and the kernel, i.e., kernel
modules have a complete type graph.  So, remove it for now since it's
not functional and complicates the task of modifying various CTF type
definitions, and we are hitting some limits in the current format which
necessitate an update.

No functional change intended.

(cherry picked from commit 4d221f59b851a9c844c84701bab7f4edb7026bd4)

3 years agosys/ck.h: Add an include guard
Kevin Bowling [Sun, 21 Mar 2021 18:50:30 +0000 (11:50 -0700)]
sys/ck.h: Add an include guard

Approved by: cognet
MFC after: 1 week
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D29357

(cherry picked from commit 2595d78f3df2ca389aae259a291f93eb06ecad43)

3 years agonfsv4 client: factor loop contents out into a separate function
Rick Macklem [Thu, 1 Apr 2021 22:36:37 +0000 (15:36 -0700)]
nfsv4 client: factor loop contents out into a separate function

Commit fdc9b2d50fe9 replaced a couple of while loops with LIST_FOREACH()
loops.  This patch factors the body of that loop out into a separate
function called nfscl_checkown().
This prepares the code for future changes to use a hash table of
lists for open searches via file handle.

This patch should not result in a semantics change.

(cherry picked from commit 4e6c2a1ee9af05bf42187e8201af1d03a617834f)

3 years agonfsd: silence rpcb_unset noise for NFSv4 only servers
Rick Macklem [Thu, 1 Apr 2021 22:09:03 +0000 (15:09 -0700)]
nfsd: silence rpcb_unset noise for NFSv4 only servers

An NFSv4 only configuration does not register with
rpcbind(). Without this patch a failure to rpcb_unset()
is reported when the daemon is terminated for this case.

This is harmless noise, but this patch avoids calling
rpcb_unset() for the NFSv4 only case, avoiding the noise.

When called with "-d", it still does the rpcb_unset(),
assuming that the configuration might have been
changed to NFSv4 only and unregistering with
rpcbind() might still be needed.

(cherry picked from commit b43fe9eb4b3365156016ae3477747a46fc094bb8)

3 years agosetclassenvironment: trim leading spaces in variable names
Yuri Pankov [Sun, 11 Apr 2021 22:02:12 +0000 (01:02 +0300)]
setclassenvironment: trim leading spaces in variable names

Trim leading spaces in variable names when the list is e.g.
pretty-formatted in /etc/login.conf or ~/.login_conf.

PR: 247947
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D25649

(cherry picked from commit eeaf9d562fe137e0c52b8c346742dccfc8bde015)

3 years agoAvoid raising unexpected floating point exceptions in libm
Dimitry Andric [Fri, 9 Apr 2021 23:07:54 +0000 (01:07 +0200)]
Avoid raising unexpected floating point exceptions in libm

When using clang with x86_64 CPUs that support AVX, some floating point
transformations may raise exceptions that would not have been raised by
the original code. To avoid this, use the -fp-exception-behavior=maytrap
flag, introduced in clang 10.0.0.

In particular, this fixes a number of test failures with ctanhf(3) and
ctanf(3), when libm is compiled with -mavx. An unexpected FE_INVALID
exception is then raised, because clang emits vdivps instructions to
perform certain divides. (The vdivps instruction operates on multiple
single-precision float operands simultaneously, but the exceptions may
be influenced by unused parts of the XMM registers. In this particular
case, it was calculating 0 / 0, which results in FE_INVALID.)

If -fp-exception-behavior=maytrap is specified however, clang uses
vdivss instructions instead, which work on one operand, and should not
raise unexpected exceptions.

Reported by: olivier
Reviewed by: arichardson
PR: 254911
Differential Revision: https://reviews.freebsd.org/D29686

(cherry picked from commit 3b00222f156dca5700c839d73e36daf479fa640c)

Only use -fp-exception-behavior=maytrap on x86, for now

After 3b00222f156d, it turns out that clang only supports strict
floating point semantics for SystemZ and x86 at the moment, while for
other architectures it is still experimental.

Therefore, only use -fp-exception-behavior=maytrap on x86 for now,
otherwise this option results in "error: overriding currently
unsupported use of floating point exceptions on this target
[-Werror,-Wunsupported-floating-point-opt]" on other architectures.

Fixes: 3b00222f156d
PR: 254911

(cherry picked from commit bae9fd0b33462e9506c3ac3400089c6dbc4aee8f)

3 years agoAvoid -pedantic warnings about using _Generic in __fp_type_select
Dimitry Andric [Thu, 8 Apr 2021 11:13:15 +0000 (13:13 +0200)]
Avoid -pedantic warnings about using _Generic in __fp_type_select

When compiling parts of math.h with clang using a C standard before C11,
and using -pedantic, it will result in warnings similar to:

bug254714.c:5:11: warning: '_Generic' is a C11 extension [-Wc11-extensions]
  return !isfinite(1.0);
          ^
/usr/include/math.h:111:21: note: expanded from macro 'isfinite'
                    ^
/usr/include/math.h:82:39: note: expanded from macro '__fp_type_select'
                                      ^

This is because the block that enables use of _Generic is conditional
not only on C11, but also on whether the compiler advertises support for
C generic selections via __has_extension(c_generic_selections).

To work around the warning without having to pessimize the code, use the
__extension__ keyword, which is supported by both clang and gcc. While
here, remove the check for __clang__, as _Generic has been supported for
a long time by gcc too now.

Reported by: yuri
PR: 254714

3 years agopowernv: Include NUMA locality information in the CPU topology
Mark Johnston [Thu, 1 Apr 2021 14:25:57 +0000 (10:25 -0400)]
powernv: Include NUMA locality information in the CPU topology

ULE uses this topology to try and preserve locality when migrating
threads between CPUs and when performing work stealing.  Ensure that on
NUMA systems it will at least take the NUMA topology into account.

Reviewed by: bdragon, jhibbits (previous version)
Tested by: bdragon
Differential Revision: https://reviews.freebsd.org/D28580

(cherry picked from commit cb5f8694a522ab9a80f9f0bd321d8f3ed818dd9b)

3 years agoAdd GPT PREP-boot type to mkimg(1) from geom_gpt.
Nathan Whitehorn [Wed, 24 Feb 2021 15:31:44 +0000 (10:31 -0500)]
Add GPT PREP-boot type to mkimg(1) from geom_gpt.

This partition type can be used to boot some PowerKVM VMs. We don't
support it well because of some limitations in SLOF, but it's worth at
least have feature parity in geom and mkimg.

(cherry picked from commit f7aebfbe5c0ab63dbb3d134d143ccff2c2b278bb)

3 years agoDelete memstick images for PowerPC.
Nathan Whitehorn [Wed, 24 Feb 2021 03:17:20 +0000 (22:17 -0500)]
Delete memstick images for PowerPC.

These images only ever worked on Apple Powermacs, which are now a very
old platform, and did so only for a very loose definition of "worked"
(they booted on a small subset of supported machines). Moreover, all
the machines they *did* boot on also would boot from a memstick made
by dd'ing an CD image to a flash drive. Since a flash drive prepared
in this way would also boot all the newer systems we support, the
memstick images were strictly less functional than the CD images, even
for booting from memory sticks.
Reviewed by: jhibbits
MFC after: 1 week

(cherry picked from commit 1af48800c20fadb07acca2ab930bb3bccd363edb)

3 years agom4(1): Add a SEE ALSO section and reference an AT&T manual
Gordon Bergling [Thu, 8 Apr 2021 19:16:54 +0000 (21:16 +0200)]
m4(1): Add a SEE ALSO section and reference an AT&T manual

Obtained from: OpenBSD

(cherry picked from commit 97fa288a663dfae192c471ec5cbfdf0d2f45367e)

3 years agosed(1): Add a reference for a 4.4BSD manual document
Gordon Bergling [Thu, 8 Apr 2021 18:57:14 +0000 (20:57 +0200)]
sed(1): Add a reference for a 4.4BSD manual document

Obtained from: OpenBSD

(cherry picked from commit 9048d9a933f57991ee042618ab89dd49d8cbad89)

3 years agoRemove more remnants of sio(4)
Mark Johnston [Wed, 7 Apr 2021 18:21:07 +0000 (14:21 -0400)]
Remove more remnants of sio(4)

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29626

(cherry picked from commit 0f07c234ca1d3ccce158bb68c03829a266942c6e)

3 years agolibnv: Allow use in non-sleepable contexts
Kristof Provost [Thu, 25 Mar 2021 12:59:14 +0000 (13:59 +0100)]
libnv: Allow use in non-sleepable contexts

44c125c4cebc2fd87c6260b90eddae11201f5232 switched the nvlist allocations
to be M_WAITOK, but this precludes the use in non-sleepable contexts.
(E.g. with a nonsleepable lock held).

All callers for these allocation functions already cope with memory
alloation failures, so there's no reason to allow sleeping during
allocations.

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

(cherry picked from commit ab8d25880ebc9ddca1ae6af938680036349edf3f)

3 years agopf tests: make synproxy and nat work correctly even if inetd is running
Kurosawa Takahiro [Wed, 7 Apr 2021 06:17:51 +0000 (08:17 +0200)]
pf tests: make synproxy and nat work correctly even if inetd is running

tests/sys/netfil/pf/synproxy fails if inetd has been running
outside of the jail because pidfile_open() fails with EEXIST.
tests/sys/netfil/pf/nat has the same problem but the test succeeds
because whether inetd is running is not so important.

Fix the problem by changing the pidfile path from the default
location.

Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29622

(cherry picked from commit 5a5623397c73e46b206289d32d1d6b9de420da9c)

3 years agoAdd IDs for ASMedia ASM116x PCIe 3.0 AHCI controllers.
Alexander Motin [Wed, 7 Apr 2021 19:03:36 +0000 (15:03 -0400)]
Add IDs for ASMedia ASM116x PCIe 3.0 AHCI controllers.

MFC after: 1 week

(cherry picked from commit 5a8d32b53b919d82d6a3aa9f155bd2a00fb51dc2)

3 years agofreebsd-update: improve mandoc db generation
Ed Maste [Sun, 4 Apr 2021 00:57:26 +0000 (20:57 -0400)]
freebsd-update: improve mandoc db generation

freebsd-update compares the dates on man pages with mandoc.db, and if
any newer pages are found it regenerates mandoc.db.

Previously, if mandoc.db did not already exist the check failed and
freebsd-update then failed to create one.  Now, check that mandoc.db
exists before performing the check for newer pages.

Reported by: bdrewery (in D10482)
Reviewed by: gordon
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29575

(cherry picked from commit 741223a65cd1752360c44341b762295f633e21cf)

3 years agousr.sbin/services_mkdb: plug memory leak when line was blank.
Xin LI [Tue, 30 Mar 2021 22:21:37 +0000 (15:21 -0700)]
usr.sbin/services_mkdb: plug memory leak when line was blank.

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

(cherry picked from commit 18f3c5fe9207fbd19360b8ddb23ba10a5ad3df68)

3 years agosysctl.conf(5): Mention sysctl.conf.local in the sysctl.conf(5) manual page
Gordon Bergling [Fri, 9 Apr 2021 15:28:18 +0000 (17:28 +0200)]
sysctl.conf(5): Mention sysctl.conf.local in the sysctl.conf(5) manual page

The possibility of using a sysctl.conf.local on a machine that has a shared
sysctl.conf(5) isn't documented. So mention the sysctl.conf.local in the
manual page.

PR: 254901
Submitted by: Jose Luis Duran <jlduran at gmail dot com>
Reported by: Jose Luis Duran <jlduran at gmail dot com>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D29673

(cherry picked from commit 46c99528078ad478f50910110a933abef0b89cde)

3 years agoFix vlan creation for the older ifconfig(8) binaries.
Alexander V. Chernikov [Sun, 11 Apr 2021 16:47:03 +0000 (17:47 +0100)]
Fix vlan creation for the older ifconfig(8) binaries.

Reported by: allanjude
MFC after: immediately

(cherry picked from commit afbb64f1d85b7d8c2938031c3567946b5d10da4f)

3 years agoTweak language involving ZFS installation; no content changes.
Nathan Whitehorn [Mon, 5 Apr 2021 14:23:00 +0000 (10:23 -0400)]
Tweak language involving ZFS installation; no content changes.

(cherry picked from commit b8639a1098a70e8ca8ec5880d2337fed04e4243a)

3 years agoAdd some general notes about scripted installations.
Nathan Whitehorn [Mon, 5 Apr 2021 14:10:34 +0000 (10:10 -0400)]
Add some general notes about scripted installations.

(cherry picked from commit 3b20b988e0f14740eb135ad5d56520b8cb94f429)

3 years agoInclude examples of how to build script-install media.
Nathan Whitehorn [Mon, 22 Mar 2021 14:20:29 +0000 (10:20 -0400)]
Include examples of how to build script-install media.

(cherry picked from commit c8923d191dd3e56b8e1113b4a94da3193600c110)
(cherry picked from commit 9f88bee14659c9e5920372c53106e666b502b3cd)

3 years agoImprove example install scripts, making them simpler and more robust.
Nathan Whitehorn [Mon, 22 Mar 2021 14:08:55 +0000 (10:08 -0400)]
Improve example install scripts, making them simpler and more robust.

In particular:
- There is no need to do anything with gpart (the installer does that
  for you).
- There is no need to specify the network interface, since we have
  an option for defaults.

(cherry picked from commit f91026bf462f9a636735cafafd29a1232b2a525b)

3 years agoClarify that scripted installations don't require specification of boot
Nathan Whitehorn [Fri, 19 Mar 2021 13:44:30 +0000 (09:44 -0400)]
Clarify that scripted installations don't require specification of boot
partitions, as there seems to be widespread confusion on this point.

MFC after: 1 day

(cherry picked from commit e8b4c5a6226b6bde304380de51c347851680b7ed)

3 years agolibc: Fix the WITH_HESIOD build
Mark Johnston [Mon, 5 Apr 2021 20:23:18 +0000 (16:23 -0400)]
libc: Fix the WITH_HESIOD build

Reported by: Daniel Braniss <danny@cs.huji.ac.il>

(cherry picked from commit 3b666932d409ad79c527c026abacd4d327df5b46)

3 years agoqat: Make prototypes consistent with the implementation
Mark Johnston [Mon, 5 Apr 2021 20:23:22 +0000 (16:23 -0400)]
qat: Make prototypes consistent with the implementation

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 843d16436d3388c1b46d37fca4e86885612d0e64)

3 years agonfsv4 client: replace while loops with LIST_FOREACH() loops
Rick Macklem [Mon, 29 Mar 2021 21:14:51 +0000 (14:14 -0700)]
nfsv4 client: replace while loops with LIST_FOREACH() loops

This patch replaces a couple of while() loops with LIST_FOREACH() loops.
While here, declare a couple of variables "bool".
I think LIST_FOREACH() is preferred and makes the code more readable.
This also prepares the code for future changes to use a hash table of
lists for open searches via file handle.

This patch should not result in a semantics change.

(cherry picked from commit fdc9b2d50fe905b54afd773a2fc7fb9947508ddf)

3 years agonfsv4.1/4.2 client: fix handling of delegations for "oneopenown" mnt option
Rick Macklem [Mon, 29 Mar 2021 19:09:19 +0000 (12:09 -0700)]
nfsv4.1/4.2 client: fix handling of delegations for "oneopenown" mnt option

If a delegation for a file has been acquired, the "oneopenown" option
was ignored when the local open was issued. This could result in multiple
openowners/opens for a file, that would be transferred to the server
when the delegation was recalled.
This would not be serious, but could result in more than one openowner.
Since the Amazon/EFS does not issue delegations, this probably never
occurs in practice.
Spotted during code inspection.

This small patch fixes the code so that it checks for "oneopenown"
when doing client local opens on a delegation.

(cherry picked from commit e61b29ab5d2d9afd41d9fa06bb1f4cad4e9d0650)

3 years agonfsd: do not implicitly bind the back channel for NFSv4.1/4.2 mounts
Rick Macklem [Tue, 30 Mar 2021 21:31:05 +0000 (14:31 -0700)]
nfsd: do not implicitly bind the back channel for NFSv4.1/4.2 mounts

The NFSv4.1 (and 4.2 on 13) server incorrectly binds
a new TCP connection to the back channel when first
used by an RPC with a Sequence op in it (almost all of them).
RFC5661 specifies that only the fore channel should be bound.

This was done because early clients (including FreeBSD)
did not do the required BindConnectionToSession RPC.

Unfortunately, this breaks the Linux client when the
"nconnects" mount option is used, since the server
may do a callback on the incorrect TCP connection.

This patch converts the server behaviour to that
required by the RFC.  It also makes the server test/indicate
failure of the back channel more aggressively.

Until this patch is applied to the server, the
"nconnects" mount option is not recommended for a Linux
NFSv4.1/4.2 client mount to the FreeBSD server.

(cherry picked from commit 01ae8969a9eed652fbd894faa5b31b1593079ed8)

3 years agonfsv4 client: fix forced dismount when sleeping in the renew thread
Rick Macklem [Tue, 23 Mar 2021 20:04:37 +0000 (13:04 -0700)]
nfsv4 client: fix forced dismount when sleeping in the renew thread

During a recent NFSv4 testing event a test server caused a hang
where "umount -N" failed.  The renew thread was sleeping on "nfsv4lck"
and the "umount" was sleeping, waiting for the renew thread to
terminate.

This is the second of two patches that is hoped to fix the renew thread
so that it will terminate when "umount -N" is done on the mount.

This patch adds a 5second timeout on the msleep()s and checks for
the forced dismount flag so that the renew thread will
wake up and see the forced dismount flag.  Normally a wakeup()
will occur in less than 5seconds, but if a premature return from
msleep() does occur, it will simply loop around and msleep() again.
The patch also adds the "mp" argument to nfsv4_lock() so that it
will return when the forced dismount flag is set.

While here, replace the nfsmsleep() wrapper that was used for portability
with the actual msleep() call.

(cherry picked from commit 82ee386c2afb42388804c1189751b83048953433)

3 years agohid: add opt_hid.h to modules that use HID_DEBUG
Vladimir Kondratyev [Wed, 3 Mar 2021 22:21:15 +0000 (01:21 +0300)]
hid: add opt_hid.h to modules that use HID_DEBUG

Submitted by: Greg V <greg_AT_unrelenting_DOT_technology>
Reviewed by: imp, wulf
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D28995

(cherry picked from commit 6241b57131a60bc2bd0eda41c145aa9659c2886b)

3 years agoig4: Add PCI IDs for Intel Gemini Lake I2C controller.
Vladimir Kondratyev [Tue, 23 Feb 2021 22:20:36 +0000 (01:20 +0300)]
ig4: Add PCI IDs for Intel Gemini Lake I2C controller.

Submitted by: Dmitry Luhtionov
MFC after: 2 weeks

(cherry picked from commit bbacb7ce72956a41c0daeefe875e5209d87c11ba)

3 years agoepoll: Store epoll_event udata member in ext member of kevent.
Vladimir Kondratyev [Sun, 7 Feb 2021 23:46:14 +0000 (02:46 +0300)]
epoll: Store epoll_event udata member in ext member of kevent.

Current epoll implementation stores udata fields of epoll_event
structure in special dynamically-sized table rather than in udata field
of backing kevent structure because of 2 reasons:
1. Kevent's udata size is smaller than epoll's on 32-bit archs.
2. Kevent's udata can be clobbered on execution EPOLL_CTL_ADD as kqueue
   modifies existing event while epoll returns error in this case.

After r320043 has introduced four new 64bit user data members (ext[]),
we can store epoll udata in one of them and drop aforementioned table.
According to kqueue_register() source code ext members are not updated
when existing kevent is modified that fixes p.2.

As a side effect the patch fixes PR/252582.

Reviewed by: trasz
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D28169

(cherry picked from commit b3c6fe663bb90240f8bda6b5ba9c6a761f09f078)

3 years agoRemove tmpfs size and properly format generated fstab for arm
Daniel Engerg [Wed, 17 Mar 2021 14:00:57 +0000 (15:00 +0100)]
Remove tmpfs size and properly format generated fstab for arm

Remove tmpfs size limitation, this breaks make installworld and installation of some packages
Format generated fstab using tabs to make it consistent and readable

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

(cherry picked from commit 5bffdafd6c5f2a8279a57172ab760ea66ed3d7d5)

3 years ago[PowerPC] Fix NUMA checking for powernv
Brandon Bergren [Sun, 28 Mar 2021 01:41:45 +0000 (20:41 -0500)]
[PowerPC] Fix NUMA checking for powernv

At this point in startup, vm_ndomains has not been initialized. Switch
to checking kenv instead.

Fixes incorrect NUMA information being set on multi-domain systems like
Talos II.

Submitted by: jhibbits

(cherry picked from commit bd94c8ab29c3162bbb43973ee77ce245fe157fef)

3 years ago[tcp] Fix ECN on finalizing sessions.
Richard Scheffenegger [Thu, 8 Apr 2021 12:50:34 +0000 (14:50 +0200)]
[tcp] Fix ECN on finalizing sessions.

A subtle oversight would subtly change new data packets
sent after a shutdown() or close() call, while the send
buffer is still draining.

MFC after: 3 days
Reviewed By: #transport, tuexen
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29616

(cherry picked from commit 9f2eeb02623d6a847a90da68a5892c25b14ce2d4)

3 years agostruct mount uppers: correct locking annotations
Konstantin Belousov [Thu, 8 Apr 2021 22:03:06 +0000 (01:03 +0300)]
struct mount uppers: correct locking annotations

(cherry picked from commit 5af1131de7fc18c795ed28e69d9393f78875d3e5)

3 years agoAdd sysctl debug.uma_reclaim
Konstantin Belousov [Sun, 4 Apr 2021 16:28:14 +0000 (19:28 +0300)]
Add sysctl debug.uma_reclaim

(cherry picked from commit 89619b747bcff379dca98e975a98865a45366417)

3 years ago[bc] Update to version 4.0.0
Stefan Eßer [Tue, 6 Apr 2021 08:44:52 +0000 (10:44 +0200)]
[bc] Update to version 4.0.0

This version fixes an issue (missing pop of top-of-stack value in the
"P" command of the dc program).

This issue did not affect the bc program, since it does not use dc as
an back-end to actually perform the calculations as was the case with
the traditional bc and dc programs.

The major number has been bumped due to Windows support that has been
added to this version. It does not correspond to a major change that
might affect FreeBSD.

(cherry picked from commit b55a927bc884d7780d65a508572023b0dc2dede9)

3 years agocache: temporarily drop the assert that dvp != vp when adding an entry
Mateusz Guzik [Sat, 27 Feb 2021 22:23:23 +0000 (22:23 +0000)]
cache: temporarily drop the assert that dvp != vp when adding an entry

Historically it was allowed for any names, but arguably should never be
even attempted. Allow it again since there is a release pending and
allowing it is bug-compatible with previous behavior.

Reported by: otis

(cherry picked from commit 1239a722214c245e642733fdea2b1348101598af)

3 years agoamd64: import asm strlen into libc
Mateusz Guzik [Sun, 21 Feb 2021 21:20:04 +0000 (21:20 +0000)]
amd64: import asm strlen into libc

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

(cherry picked from commit 7f06b217c53c3f5e4ac81eb11125adfb71359ac6)

3 years agoamd64: implement strlen in assembly, take 2
Mateusz Guzik [Sat, 10 Apr 2021 13:52:49 +0000 (13:52 +0000)]
amd64: implement strlen in assembly, take 2

Tested with glibc test suite.

The C variant in libkern performs excessive branching to find the zero
byte instead of using the bsfq instruction. The same code patched to use
it is still slower than the routine implemented here as the compiler
keeps neglecting to perform certain optimizations (like using leaq).

On top of that the routine can be used as a starting point for copyinstr
which operates on words intead of bytes.

The previous attempt had an instance of swapped operands to andq when
dealing with fully aligned case, which had a side effect of breaking the
code for certain corner cases. Noted by jrtc27.

Sample results:

$(perl -e "print 'A' x 3"):
stock:  211198039
patched:338626619
asm:    465609618

$(perl -e "print 'A' x 100"):
stock:   83151997
patched: 98285919
asm:    120719888

Reviewed by: jhb, kib
Differential Revision: https://reviews.freebsd.org/D28779

(cherry picked from commit 5fa12fe0cd203efcbb2ac21e7c3e3fb9b2f801ae)

3 years agoifconfig: fix UBSan signed shift error
Alex Richardson [Tue, 19 Jan 2021 11:35:21 +0000 (11:35 +0000)]
ifconfig: fix UBSan signed shift error

Use 1u since UBSan complains about 1 << 31.

(cherry picked from commit 94ac312a71683a3a1a928c6adfe927d6bb45044f)

3 years agolibarchive: Make test_read_append_filter_wrong_program pass again
Alex Richardson [Wed, 7 Apr 2021 10:35:10 +0000 (11:35 +0100)]
libarchive: Make test_read_append_filter_wrong_program pass again

libarchive: Apply upstream commit a1b7bf8013fb7a11a486794247daae592db6f5ae

This fixes the failing test_read_append_filter_wrong_program test in CI
which has been failing since 01-Dec-2020.

Commit message from https://github.com/libarchive/libarchive/commit/a1b7bf8013fb7a11a486794247daae592db6f5ae

    Silence stderr in test_read_append_filter_program

    When the FreeBSD testsuite runs the libarchive tests it checks that stderr
    is empty. Since #1382 this is no longer the case. This change restores
    the behaviour of silencing bunzip2 stderr but doesn't bring back the
    output text check.

    Partially reverts 2e7aa5d9

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

(cherry picked from commit 2bca8aa7a79ad2b6683e8f5a5c373de81c5baca2)

3 years agotests/sys/net/routing: XFAIL the two failing tests
Alex Richardson [Wed, 7 Apr 2021 09:33:21 +0000 (10:33 +0100)]
tests/sys/net/routing: XFAIL the two failing tests

They have been failing for 1.5 months and the patch to fix them is stuck
in review so mark them as XFAIL for now to get Jenkins back to green.

To be reverted when https://reviews.freebsd.org/D28886 (or similar) is
commited.

Reviewed By: kp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29528

(cherry picked from commit 83532eb68cd06a3517bb7b5e5a34afcf798de914)

3 years agoresolv_test: Fix racy exit check, remove mutexes, and reduce output
Alex Richardson [Tue, 30 Mar 2021 14:00:16 +0000 (15:00 +0100)]
resolv_test: Fix racy exit check, remove mutexes, and reduce output

Instead of polling nleft[i] (without appropriate memory barriers!) and
using sleep() to detect the exit just call pthread_join() on all threads.

Also replace the use of a mutex that guarding the increments with atomic
fetch_add. This should reduce the runtime of this test on SMP systems.

Finally, remove all the debug printfs unless DEBUG_OUTPUT is set in
the environment.

Test Plan: still fails sometimes on qemu (but maybe less often?)
Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D29390

(cherry picked from commit 85425bdc5a80c948f99aa046f9c48512466806dd)

3 years agosys/dev/md: Drop unncessary __GLOBL(mfs_root)
Alex Richardson [Tue, 30 Mar 2021 13:53:41 +0000 (14:53 +0100)]
sys/dev/md: Drop unncessary __GLOBL(mfs_root)

LLVM12 complains if you change the symbol binding:
error: mfs_root_end changed binding to STB_WEAK [-Werror,-Winline-asm]
error: mfs_root changed binding to STB_WEAK [-Werror,-Winline-asm]

(cherry picked from commit 69e18c9b7b12e7fd97a740d8748d8718021a1e34)

3 years agolibsa: Remove conflicting .global/.weak directive
Alex Richardson [Tue, 30 Mar 2021 13:52:31 +0000 (14:52 +0100)]
libsa: Remove conflicting .global/.weak directive

LLVM12 complains if you change the symbol binding:
`error: _longjmp changed binding to STB_GLOBAL`
In this case LLVM actually ignored the weak directive and used the
later .global, but GNU as would mark the symbol as weak.
None of the other architectures mark the libsa _setjmp as weak so
just drop this directive.

(cherry picked from commit 59b2caef0537661397caf2ce1398cf802cb864b4)

3 years agolib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotations
Alex Richardson [Thu, 25 Mar 2021 11:22:10 +0000 (11:22 +0000)]
lib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotations

The error cases (goto fin) of _nsdispatch were missing the unlock.

This change also drops the checks for __isthreaded since the pthread stubs
are already no-ops if threads are not being used. Dropping those conditionals
allows clang's thread safety analysis to deal with the file and also makes
the code a bit more readable. While touching the file also add a few more
assertions in debug mode that the right locks are held.

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

(cherry picked from commit 5245bf7b92b74e556527b4916a8deba386fe5772)

3 years agoRISC-V: Fix feenableexcept return value
Alex Richardson [Thu, 25 Mar 2021 11:15:41 +0000 (11:15 +0000)]
RISC-V: Fix feenableexcept return value

The man page says "The feenableexcept(), fedisableexcept(), and
fegetexcept() functions return a bitmap of the exceptions that were
unmasked prior to the call.", so we should return zero not -1.

Reviewed By: mhorne
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29386

(cherry picked from commit dd5ed53a2f93a5a54efe96bed6bbd0f18b6bdbe2)

3 years agong_macfilter_test: Skip rather than fail if there is no network
Alex Richardson [Thu, 25 Mar 2021 11:14:46 +0000 (11:14 +0000)]
ng_macfilter_test: Skip rather than fail if there is no network

This should bring the number of Jenkins failures from 4 down to 3.
Locally kyua now prints `skipped: could not find a valid interface  [0.115s]`
when I run it in QEMU without a network device.

Reviewed By: lwhsu
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29414

(cherry picked from commit 6f30d1c851467d1f504f469a1b3a75a043ff070f)

3 years agoAllow using sanitizers for ssp tests with out-of-tree compiler
Alex Richardson [Fri, 12 Mar 2021 17:15:00 +0000 (17:15 +0000)]
Allow using sanitizers for ssp tests with out-of-tree compiler

With an out-of-tree Clang, we can use the -resource-dir flag when linking
to point it at the runtime libraries from the current SYSROOT.
This moves the path to the clang-internal library directory to a separate
.mk file that can be used by Makefiles that want to find the sanitizer
libraries. I intend to re-use this .mk file for my upcoming changes that
allow building the entire base system with ASAN/UBSAN/MSAN.

Reviewed By: dim
Differential Revision: https://reviews.freebsd.org/D28852

(cherry picked from commit fe525d3f916602ddac3286641dab8f5e274daa44)

3 years agoAlways build the sanitizer runtimes when compiling with clang
Alex Richardson [Wed, 10 Feb 2021 15:25:14 +0000 (15:25 +0000)]
Always build the sanitizer runtimes when compiling with clang

This allows instrumenting e.g. test binaries even when compiling with an
external clang (e.g. CROSS_TOOLCHAIN=llvm11). I have some upcoming patches
that allow building the entire base system with ASan/UBSan/etc.
instrumentation and this is required in preparation for this.

Reviewed By: dim, emaste
Differential Revision: https://reviews.freebsd.org/D28532

(cherry picked from commit 7676b388adbc81a2ad46b43852cd9bc7ac7fad7e)

3 years agotools/build/make.py: Avoid calling brew --prefix on macOS unnecessarily
Alex Richardson [Fri, 5 Mar 2021 10:21:12 +0000 (10:21 +0000)]
tools/build/make.py: Avoid calling brew --prefix on macOS unnecessarily

If all the require variables (XCC/XCXX/XCPP/XLD) are already set in the
environment, we don't have to infer a default value for the cross toolchain
path. This avoids an additional `brew --prefix` call when building with
cheribuild (since it already sets all these variables).

(cherry picked from commit 2b181156c893843266c2825098360db2364dbd23)

3 years agotools/build/make.py: Don't call brew --prefix if --cross-bindir is set
Alex Richardson [Fri, 26 Feb 2021 17:49:03 +0000 (17:49 +0000)]
tools/build/make.py: Don't call brew --prefix if --cross-bindir is set

Also updated the logic to use subprocess.run() instead of the old
subprocess.getoutput() which also includes stderr and therefore
can trigger an exception inside Path().exists().

Reported by: gnn

(cherry picked from commit a26ace4db6d974215a4d882948da80eae2b3b0d4)

3 years agotools/build/make.py: drop workaround for cc --version not being parsed
Alex Richardson [Sat, 13 Feb 2021 13:54:20 +0000 (13:54 +0000)]
tools/build/make.py: drop workaround for cc --version not being parsed

Previously bsd.compiler.mk was not able to detect the compiler type for
Ubuntu's /usr/bin/cc unless we were invoking the /usr/bin/gcc symlink.
This problem has been fixed by 9c6954329a9285547881ddd60e393b7c55ed30c4
so we can drop the workaround from make.py.

Reviewed By: jrtc27
Differential Revision: https://reviews.freebsd.org/D28323

(cherry picked from commit 88db1cc9f197a376817ce27ba269348666bbd4b7)

3 years agobsd.compiler.mk: Detect distribution-provided GCC when executed as cc
Jessica Clarke [Tue, 9 Feb 2021 21:40:24 +0000 (21:40 +0000)]
bsd.compiler.mk: Detect distribution-provided GCC when executed as cc

Clang always prints "clang $VERSION" regardless of the name used to
execute it, whereas GCC prints "$progname $VERSION", meaning if CC is
set to cc and cc is GCC it will print "cc $VERSION". We are able to
detect some of those cases since it then prints "($PKGVERSION)", where
the default is "GCC", but many distributions override that to print
their name and the package version number (e.g. "Debian 10.2.1-6"), so
nothing tells us it's GCC other than the fact that it's not Clang (and
that there's an FSF copyright disclaimer).

However, GCC's -v option will always print "gcc version $VERSION", so
fall back on using that to detect GCC. Whilst Clang also supports this
option, we should never get here, so Clang handling is not added.

Reviewed by: brooks, emaste, arichardson
Differential Revision: https://reviews.freebsd.org/D28315

(cherry picked from commit 9c6954329a9285547881ddd60e393b7c55ed30c4)

3 years agotests/sys/netgraph: Further CI fixes
Alex Richardson [Fri, 19 Mar 2021 18:34:29 +0000 (18:34 +0000)]
tests/sys/netgraph: Further CI fixes

I was trying to debug why this test is working locally but failing in CI.
While doing so I made some small changes to allow running it with set -e.

It turns out the problem is that find_iface does not return anything in
Jenkins, so all following tests fail with obscure error messages.
To handle this case exit early if $eth is empty.

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

(cherry picked from commit 7dd1f932c1f51bfe10da7bc8875879cdcdd40821)

3 years agoSilence unused parameter warnings in the RISC-V fenv.h
Alex Richardson [Mon, 22 Mar 2021 17:47:50 +0000 (17:47 +0000)]
Silence unused parameter warnings in the RISC-V fenv.h

After increasing the lib/msun/tests WARNS to 6, this triggers a
compilation error for RISC-V.

Fixes: 87d65c747a43 ("lib/msun: Allow building tests with WARNS=6")
Reported by: Jenkins

(cherry picked from commit 15211f19509282d9c9a418d4e5b6ac75d9d1fc85)

3 years agoUnbreak MSG_CMSG_CLOEXEC
Alex Richardson [Thu, 18 Mar 2021 20:52:20 +0000 (20:52 +0000)]
Unbreak MSG_CMSG_CLOEXEC

MSG_CMSG_CLOEXEC has not been working since 2015 (SVN r284380) because
_finstall expects O_CLOEXEC and not UF_EXCLOSE as the flags argument.
This was probably not noticed because we don't have a test for this flag
so this commit adds one. I found this problem because one of the
libwayland tests was failing.

Fixes: ea31808c3b07 ("fd: move out actual fp installation to _finstall")
MFC after: 3 days
Reviewed By: mjg, kib
Differential Revision: https://reviews.freebsd.org/D29328

(cherry picked from commit 6ceacebdf5221133943ab3b6b56751c8b51c3e2b)

3 years agoloader: we should support pools without features
Toomas Soome [Fri, 2 Apr 2021 23:40:51 +0000 (02:40 +0300)]
loader: we should support pools without features

nvlist_check_features_for_read() does return error when there
are no features for read.

Reported by: yuripv

(cherry picked from commit d36341f7b8ddc2457a1e9e4a721d27d2e66cb39a)

3 years agovfs: replace vfs_smr_quiesce with vfs_smr_synchronize
Mateusz Guzik [Thu, 8 Apr 2021 07:08:41 +0000 (07:08 +0000)]
vfs: replace vfs_smr_quiesce with vfs_smr_synchronize

This ends up using a smr specific method.

Suggested by: markj
Tested by: pho

(cherry picked from commit 72b3b5a941927f7a79611131f144eeb2dc9143c9)

3 years agocache: update an assert on CACHE_FPL_STATUS_ABORTED
Mateusz Guzik [Tue, 6 Apr 2021 20:31:48 +0000 (22:31 +0200)]
cache: update an assert on CACHE_FPL_STATUS_ABORTED

Since symlink support it can get upgraded to CACHE_FPL_STATUS_DESTROYED.

Reported by: bdrewery

(cherry picked from commit 13b3862ee874db0b5efae484934de9b20da864e4)

3 years agocache: add high level overview
Mateusz Guzik [Thu, 11 Feb 2021 15:39:28 +0000 (16:39 +0100)]
cache: add high level overview

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

(cherry picked from commit f79bd71def7a03b3a1b043cae7b908b36a05f41c)

3 years agocache: fix resizing in face of lockless lookup
Mateusz Guzik [Mon, 29 Mar 2021 19:17:57 +0000 (21:17 +0200)]
cache: fix resizing in face of lockless lookup

Reported by: pho
Tested by: pho

(cherry picked from commit dc532884d582db6da833d598e4bb37ad1880947c)

3 years agovfs: add vfs_smr_quiesce
Mateusz Guzik [Tue, 30 Mar 2021 14:44:10 +0000 (16:44 +0200)]
vfs: add vfs_smr_quiesce

This can be used to observe all CPUs not executing while within
vfs_smr_enter.

(cherry picked from commit 3f56bc79860ec20f0e53de42dab1c117ee68e37b)

3 years agovfs: employ vfs_ref_from_vp in statfs and fstatfs
Mateusz Guzik [Mon, 15 Feb 2021 22:08:20 +0000 (23:08 +0100)]
vfs: employ vfs_ref_from_vp in statfs and fstatfs

Avoids locking and unlocking the vnode.

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

(cherry picked from commit 81174cd8e24aa2bb27f6a8b41032abf59add479f)

3 years agovfs: add vfs_ref_from_vp
Mateusz Guzik [Mon, 15 Feb 2021 22:08:40 +0000 (23:08 +0100)]
vfs: add vfs_ref_from_vp

This generalizes what vop_stdgetwritemount used to be doing.

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

(cherry picked from commit a15f787adb4429b83fa911dcb60f69121aaee1ba)

3 years agocache: assorted comment fixups
Mateusz Guzik [Tue, 9 Feb 2021 16:06:27 +0000 (17:06 +0100)]
cache: assorted comment fixups

(cherry picked from commit 39e0c3f686387605591f8f646ceec53613619525)

3 years agodevfs: fix use count leak when using TIOCSCTTY
Mateusz Guzik [Mon, 8 Feb 2021 22:10:57 +0000 (23:10 +0100)]
devfs: fix use count leak when using TIOCSCTTY

by matching devfs_ctty_ref

Fixes: 3b44443626603f65 ("devfs: rework si_usecount to track opens")
(cherry picked from commit 3bc17248d31794519ba95b2c6b9ff8a0d31dba81)

3 years agolibkern: use compiler builtins for strcpy, strcmp and strlen
Mateusz Guzik [Sun, 7 Feb 2021 19:50:25 +0000 (19:50 +0000)]
libkern: use compiler builtins for strcpy, strcmp and strlen

(cherry picked from commit 81e074d57dfcd86f152e2848dc44b77087ee7a2d)

3 years agocache: remove the largely obsolete general description
Mateusz Guzik [Fri, 5 Feb 2021 23:16:55 +0000 (00:16 +0100)]
cache: remove the largely obsolete general description

Examples of inconsistencies with the current state:
- references LRU of all entries, removed years ago
- references a non-existent lock (neglist)
- claims negative entries have a NULL target

It will be replaced with a more accurate and more informative
description.

In the meantime take it out so it stops misleading.

(cherry picked from commit 2f8a844635312b0f25028a87459fdd2d2a1cbfd6)

3 years agocache: fix vfs:namecache:lookup:miss probe call sites
Mateusz Guzik [Fri, 5 Feb 2021 22:58:27 +0000 (23:58 +0100)]
cache: fix vfs:namecache:lookup:miss probe call sites

(cherry picked from commit 0e1594e60e5e0b1fddc33225171f1d1c6a421ed4)

3 years agocache: drop spurious arg from panic in cache_validate
Mateusz Guzik [Fri, 5 Feb 2021 22:49:59 +0000 (23:49 +0100)]
cache: drop spurious arg from panic in cache_validate

vp is already reported when noting mismatch

(cherry picked from commit 2e96132a7d8bbb2347a3b4776806324f984aa49f)

3 years agocache: comment on FNV
Mateusz Guzik [Wed, 3 Feb 2021 20:44:54 +0000 (21:44 +0100)]
cache: comment on FNV

(cherry picked from commit b54ed778fe45d482bd1e2009df802fda26f94495)

3 years agoffsinfo: Update example to avoid to-be-deprecated vinum
Ed Maste [Mon, 29 Mar 2021 00:04:29 +0000 (20:04 -0400)]
ffsinfo: Update example to avoid to-be-deprecated vinum

Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29478

(cherry picked from commit a64096aa63ea1303ae8d20d4147b3b097071072f)