]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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 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 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 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 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 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 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 agopms: handle maximum size IO with any alignment
Ryan Libby [Wed, 20 Jan 2021 21:59:49 +0000 (13:59 -0800)]
pms: handle maximum size IO with any alignment

Define the maximum numbers of segments to allow for non-page alignment
at the beginning and end of a maxphys size transfer.  Also set
ccb_pathinq.maxio consistent with maxphys.

Reviewed by: imp
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D28043

(cherry picked from commit e54a1d5751805714bf6ea5e2e99887388110f9f0)

3 years agoreadelf: return error in case of invalid file
Ed Maste [Mon, 5 Apr 2021 01:01:28 +0000 (21:01 -0400)]
readelf: return error in case of invalid file

GNU readelf exits with an error for a number of invalid file cases.
Previously ELF Tool Chain readelf always exited with 0.  Now we exit 1
upon detecting an error with one or more input files, but in any case
all of them are processed.

This should catch common failure cases.  We still do not report an error
for some types of malformed ELF files, but this is consistent with GNU
readelf.

PR: 252727
Reviewed by: jkoshy, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29377

(cherry picked from commit ea444392bb5b351c930f28a02a4e68f51b25ba69)

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 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 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.

PR: 254560
(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 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

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 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 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 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 agonet: fixing a memory leak in if_deregister_com_alloc()
Tai-hwa Liang [Sat, 6 Mar 2021 14:36:35 +0000 (14:36 +0000)]
net: fixing a memory leak in if_deregister_com_alloc()

Drain the callbacks upon if_deregister_com_alloc() such that the
if_com_free[type] won't be nullified before if_destroy().

Taking fwip(4) as an example, before this fix, kldunload if_fwip will
go through the following:

  1. fwip_detach()
  2. if_free() -> schedule if_destroy() through NET_EPOCH_CALL
  3. fwip_detach() returns
  4. firewire_modevent(MOD_UNLOAD) -> if_deregister_com_alloc()
  5. kernel complains about:
Warning: memory type fw_com leaked memory on destroy (1 allocations, 64 bytes leaked).
  6. EPOCH runs if_destroy() -> if_free_internal()

By this time, if_com_free[if_alloctype] is NULL since it's already
nullified by if_deregister_com_alloc(); hence, firewire_free() won't
have a chance to release the allocated fw_com.

Reviewed by: hselasky, glebius
MFC after: 2 weeks

(cherry picked from commit 092f3f081265c68cd8de0234ba8e46560ccc061e)

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)

3 years agovfs: honor error code returned by mac_vnode_check_rename_from
Mateusz Guzik [Wed, 29 Jul 2020 17:04:33 +0000 (17:04 +0000)]
vfs: honor error code returned by mac_vnode_check_rename_from

(cherry picked from commit fd8c6a48abe0ad2ba64b611fe044830f89b30138)

3 years agonullfs: protect against user creating inconsistent state
Konstantin Belousov [Thu, 1 Apr 2021 17:42:14 +0000 (20:42 +0300)]
nullfs: protect against user creating inconsistent state

PR: 253593

(cherry picked from commit 76b1b5ce6d81f66b09be8a20aecd064b65fd6b50)

3 years agoStyle
Konstantin Belousov [Sun, 4 Apr 2021 16:27:42 +0000 (19:27 +0300)]
Style

(cherry picked from commit 51a7be5f6036ebd47c8b3f704d52e7ec3f837114)

3 years agombuf: add a way to mark flowid as calculated from the internal headers
Konstantin Belousov [Fri, 12 Feb 2021 13:38:07 +0000 (15:38 +0200)]
mbuf: add a way to mark flowid as calculated from the internal headers

(cherry picked from commit e243367b644562c9410b39f8d78dafdb7e785d85)

3 years agoMFC jail: fix jail(8) synposis and usage message to match reality.
Jamie Gritton [Sun, 4 Apr 2021 17:49:38 +0000 (10:49 -0700)]
MFC jail: fix jail(8) synposis and usage message to match reality.

Reported by: yuri
PR: 254741

(cherry picked from commit 8c1d956ffa0355ece3b63ea8587938176f87f072)

3 years agoFix the build after 5061d5a0cfaf68a6891db82f6bd26ad3e72e87b1
Alan Somers [Thu, 8 Apr 2021 23:11:00 +0000 (23:11 +0000)]
Fix the build after 5061d5a0cfaf68a6891db82f6bd26ad3e72e87b1

A merge conflict in the MFC broke the build.  Direct commit to stable/12
because main and stable/13 are unaffected.

3 years agompsutil.8: fix typos in the man page
Alan Somers [Thu, 25 Mar 2021 14:43:40 +0000 (08:43 -0600)]
mpsutil.8: fix typos in the man page

Sponsored by: Axcient

(cherry picked from commit f073ab8712a032faecf1fb94c4491fd555461ad8)

3 years agofusefs: fix two bugs regarding fcntl file locks
Alan Somers [Thu, 18 Mar 2021 20:27:27 +0000 (14:27 -0600)]
fusefs: fix two bugs regarding fcntl file locks

1) F_SETLKW (blocking) operations would be sent to the FUSE server as
   F_SETLK (non-blocking).

2) Release operations, F_SETLK with lk_type = F_UNLCK, would simply
   return EINVAL.

PR: 253500
Reported by: John Millikin <jmillikin@gmail.com>

(cherry picked from commit 929acdb19acb67cc0e6ee5439df98e28a84d4772)

fusefs: fix a dead store in fuse_vnop_advlock

kevans actually caught this in the original review and I fixed it, but
then I committed an older copy of the branch.  Whoops.

Reported by: kevans
Differential Revision: https://reviews.freebsd.org/D29031

(cherry picked from commit 9c5aac8f2e84ca4bbdf82514302c08c0453ec59b)

3 years agoModernize geom_stats_snapshot_get
Alan Somers [Wed, 3 Mar 2021 20:06:38 +0000 (13:06 -0700)]
Modernize geom_stats_snapshot_get

* A logically useless memset() is used to fault in some memory pages.
  Change it to explicit_bzero so the compiler won't eliminate it.

* Eliminate the second memset.  It made sense in the days of the Big
  Kernel Lock, but not in the days of fine-grained SMP and especially
  not in the days of VDSO.

Sponsored by: Axcient
Reviewed by: phk
Differential Revision: https://reviews.freebsd.org/D29047

(cherry picked from commit f05b724ecb310fb91da1947ae6c68647f58f5f12)

3 years ago[skip ci] fix a typo in a comment in mdconfig.c
Alan Somers [Sat, 27 Feb 2021 16:04:10 +0000 (09:04 -0700)]
[skip ci] fix a typo in a comment in mdconfig.c

Sponsored by: Axcient
Reviewed by:    mav, imp
Differential Revision:  https://reviews.freebsd.org/D28968

(cherry picked from commit d977417d74a704930b5952cbd653638ccd25eaa7)

3 years agoSpeed up geom_stats_resync in the presence of many devices
Alan Somers [Sat, 27 Feb 2021 15:59:40 +0000 (08:59 -0700)]
Speed up geom_stats_resync in the presence of many devices

The old code had a O(n) loop, where n is the size of /dev/devstat.
Multiply that by another O(n) loop in devstat_mmap for a total of
O(n^2).

This change adds DIOCGMEDIASIZE support to /dev/devstat so userland can
quickly determine the right amount of memory to map, eliminating the
O(n) loop in userland.

This change decreases the time to run "gstat -bI0.001" with 16,384 md
devices from 29.7s to 4.2s.

Also, fix a memory leak first reported as PR 203097.

Sponsored by: Axcient
Reviewed by: mav, imp
Differential Revision: https://reviews.freebsd.org/D28968

(cherry picked from commit ab63da3564e8ab0907f9d8eb565774848ffdadeb)

3 years agofortune: add a tip about gstat
Alan Somers [Fri, 26 Feb 2021 15:06:07 +0000 (08:06 -0700)]
fortune: add a tip about gstat

(cherry picked from commit 60a632f047cdb6e5314711f593a4d3b1f1d8dde9)

3 years agofusefs: set d_off during VOP_READDIR
Alan Somers [Fri, 12 Feb 2021 01:01:10 +0000 (18:01 -0700)]
fusefs: set d_off during VOP_READDIR

This allows d_off to be used with lseek to position the file so that
getdirentries(2) will return the next entry.  It is not used by
readdir(3).

PR: 253411
Reported by: John Millikin <jmillikin@gmail.com>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D28605

(cherry picked from commit 71befc35061b3c9d8cc07e34c5dce622c848fcdb)

3 years agomount_nullfs: rename a local variable
Alan Somers [Fri, 12 Feb 2021 18:30:52 +0000 (11:30 -0700)]
mount_nullfs: rename a local variable

The "source" variable was introduced in r26072, probably as the
traditional counterpart to "target".  But the "source"/"target" names
suggest the opposite of their actual meaning.  With ln, for example, the
source is the real file and the target is the newly created link.  In
mount_nullfs the meaning is the opposite: the target is the existing
file system and the source is the newly created mountpoint.  Better to
use "target"/"mountpoint" terminology, which matches the man page.

Sponsored by: Axcient

(cherry picked from commit f540cb27a23719d88b7e5143be6e62f75dd25f08)

3 years agonetmap: pkt-gen: allow -Z and -z to be used together
Vincenzo Maffione [Tue, 30 Mar 2021 06:13:07 +0000 (06:13 +0000)]
netmap: pkt-gen: allow -Z and -z to be used together

These options are used for generating random source/destination
IP/ports within transmitted packets.

MFC after: 1 week

3 years agonetmap: bridge: fix transmission in busy-wait mode
Vincenzo Maffione [Tue, 30 Mar 2021 06:24:56 +0000 (06:24 +0000)]
netmap: bridge: fix transmission in busy-wait mode

In busy-wait mode (BUSYWAIT defined), NIOCTXSYNC should be
performed after packets have been moved to the TX ring
(rather than before).
Before the change, moved packets may stall for an indefinite
time in the TX ring.

MFC after: 1 week

(cherry picked from commit 51cc31088bf4d23a6ad0bfe8851adaa049d750fc)

3 years agodummynet: Move timekeeping information into dn_cfg
Kristof Provost [Tue, 9 Mar 2021 15:44:26 +0000 (16:44 +0100)]
dummynet: Move timekeeping information into dn_cfg

Just like with the packet counters move the timekeeping information into
dn_cfg. This reduces the global name space use for dummynet and will
make subsequent work to add vnet support and re-use in pf easier.

Reviewed by: donner
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Different Revision: https://reviews.freebsd.org/D29246

(cherry picked from commit 320bed3c007be1c2ff1f4b0d00d64d541d807fed)

3 years agodummynet: Move packet counters into dn_cfg
Kristof Provost [Tue, 9 Mar 2021 15:27:31 +0000 (16:27 +0100)]
dummynet: Move packet counters into dn_cfg

Move the packets counters into the dn_cfg struct. This reduces the
global name space use for dummynet and will make future work for things
like vnet support and re-use in pf easier.

Reviewed by: donner
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29245

(cherry picked from commit cd5671efc0190ba0f9eb41bba42e703277af20c3)

3 years agoMove time math out of disabled interrupts sections.
Alexander Motin [Wed, 10 Mar 2021 18:39:15 +0000 (13:39 -0500)]
Move time math out of disabled interrupts sections.

We don't need the result before next sleep time, so no reason to
additionally increase interrupt latency.

While there, remove extra PM ticks to microseconds conversion, making
C2/C3 sleep times look 4 times smaller than really.  The conversion
is already done by AcpiGetTimerDuration().  Now I see reported sleep
times up to 0.5s, just as expected for planned 2 wakeups per second.

MFC after: 1 month

(cherry picked from commit 2cee045b4d62568d065b838a6cf129fed2424709)

3 years agoDo not read timer extra time when MWAIT is used.
Alexander Motin [Mon, 8 Mar 2021 23:43:47 +0000 (18:43 -0500)]
Do not read timer extra time when MWAIT is used.

When we enter C2+ state via memory read, it may take chipset some
time to stop CPU.  Extra register read covers that time.  But MWAIT
makes CPU stop immediately, so we don't need to waste time after
wakeup with interrupts still disabled, increasing latency.

On my system it reduces ping localhost latency, waking up all CPUs
once a second, from 277us to 242us.

MFC after: 1 month

(cherry picked from commit 075e4807df3e6b0d9196d56e4dbc33765d57e1f8)

3 years agoChange mwait_bm_avoidance use to match Linux.
Alexander Motin [Mon, 8 Mar 2021 22:57:46 +0000 (17:57 -0500)]
Change mwait_bm_avoidance use to match Linux.

Even though the information is very limited, it seems the intent of
this flag is to control ACPI_BITREG_BUS_MASTER_STATUS use for C3,
not force ACPI_BITREG_ARB_DISABLE manipulations for C2, where it was
never needed, and which register not really doing anything for years.
It wasted lots of CPU time on congested global ACPI hardware lock
when many CPU cores were trying to enter/exit deep C-states same time.

On idle 80-core system it pushed ping localhost latency up to 20ms,
since badport_bandlim() via counter_ratecheck() wakes up all CPUs
same time once a second just to synchronously reset the counters.
Now enabling C-states increases the latency from 0.1 to just 0.25ms.

Discussed with: kib
MFC after: 1 month

(cherry picked from commit 455219675dbd61010e180cacdfed51e7e34111e1)

3 years agomount: Disallow mounting over a jail root
Mark Johnston [Tue, 6 Apr 2021 18:57:57 +0000 (14:57 -0400)]
mount: Disallow mounting over a jail root

Discussed with: jamie
Approved by: so
Security: CVE-2020-25584
Security: FreeBSD-SA-21:10.jail_mount

3 years agovm_fault: Shoot down multiply mapped COW source page mappings
Mark Johnston [Tue, 6 Apr 2021 18:56:37 +0000 (14:56 -0400)]
vm_fault: Shoot down multiply mapped COW source page mappings

Reviewed by: kib, rlibby
Discussed with: alc
Approved by: so
Security: CVE-2021-29626
Security: FreeBSD-SA-21:08.vm

3 years agoLock busdma operations and serialize detach against open/close
Marcel Moolenaar [Thu, 4 Jul 2019 02:51:34 +0000 (02:51 +0000)]
Lock busdma operations and serialize detach against open/close

Use sx to allow M_WAITOK allocations (suggested by markj).

admbugs: 782
Reviewed by: markj

(cherry picked from commit 9f011bca829751ed3552ac94fe7c865d75fabfc4)

3 years agoReduce chance of RCU deadlock in the LinuxKPI by implementing the section
Hans Petter Selasky [Sun, 28 Mar 2021 07:36:48 +0000 (09:36 +0200)]
Reduce chance of RCU deadlock in the LinuxKPI by implementing the section
feature of the concurrency kit, CK.

Differential Revision: https://reviews.freebsd.org/D29467
Reviewed by: kib@ and markj@
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 177772088060ab0f41bcdbdd81c4712e7f1c7621)

3 years agoipdivert: check that PCB is still valid after taking INPCB_RLOCK.
Andrey V. Elsukov [Tue, 30 Mar 2021 09:31:09 +0000 (12:31 +0300)]
ipdivert: check that PCB is still valid after taking INPCB_RLOCK.

We are inspecting PCBs of divert sockets under NET_EPOCH section,
but PCB could be already detached and we should check INP_FREED flag
when we took INP_RLOCK.

PR: 254478
Differential Revision: https://reviews.freebsd.org/D29420

(cherry picked from commit c80a4b76ceacc5aab322e7ac1407eea8c90cb3b1)

3 years agonetmap: iflib: add nm_config callback
Vincenzo Maffione [Mon, 29 Mar 2021 09:26:12 +0000 (11:26 +0200)]
netmap: iflib: add nm_config callback

This per-driver callback is invoked by netmap when it wants
to align the number of TX/RX netmap rings and/or the number of
TX/RX netmap slots to the actual state configured in the hardware.
The alignment happens when netmap mode is switched on (with no
active netmap file descriptors for that netmap port), or when
collecting netmap port information.

MFC after: 1 week

(cherry picked from commit 21d0c01226eb979556d6d792ec58eb54012fbc24)

3 years agonfsv4 client: fix forced dismount when sleeping on nfsv4lck
Rick Macklem [Fri, 19 Mar 2021 21:09:33 +0000 (14:09 -0700)]
nfsv4 client: fix forced dismount when sleeping on nfsv4lck

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 first of two patches that is hoped to fix the renew thread
so that it will terminate when "umount -N" is done on the mount.

nfsv4_lock() checks for forced dismount, but only after it wakes up
from msleep().  Without this patch, a wakeup() call was required.
This patch adds a 1second timeout on the msleep(), so that it will
wake up and see the forced dismount flag.  Normally a wakeup()
will occur in less than 1second, but if a premature return from
msleep() does occur, it will simply loop around and msleep() again.

While here, replace the nfsmsleep() wrapper that was used for portability
with the actual msleep() call and make the same change for nfsv4_getref().

(cherry picked from commit 5f742d3879deb1f46f2d151d5ef84f49e8d6afe6)

3 years agonfsv4 pnfs client: fix updating of the layout stateid.seqid
Rick Macklem [Thu, 18 Mar 2021 19:20:25 +0000 (12:20 -0700)]
nfsv4 pnfs client: fix updating of the layout stateid.seqid

During a recent NFSv4 testing event a test server was replying
NFSERR_OLDSTATEID for layout stateids presented to the server
for LayoutReturn operations.  Upon rereading RFC5661, it was
apparent that the FreeBSD NFSv4.1/4.2 pNFS client did not
maintain the seqid field of the layout stateid correctly.

This patch is believed to correct the problem.  Tested against
a FreeBSD pNFS server with diagnostics added to check the stateid's
seqid did not indicate problems.  Unfortunately, testing aginst
this server will not happen in the near future, so the fix may
not be correct yet.

(cherry picked from commit fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc)

3 years agoinit: use explicit_bzero() for clearing passwords
Kyle Evans [Wed, 3 Mar 2021 03:38:37 +0000 (21:38 -0600)]
init: use explicit_bzero() for clearing passwords

This is a nop in practice, because it cannot be proven that this
particular bzero() is not significant.  Make it explicit anyways, rather
than relying on an implementation detail of how the password is
collected.

Discussed with: Andrew Gierth <andrew tao146 riddles org uk>

(cherry picked from commit 852f70b24043885f0e438e8fecedd482a9a96d5e)

3 years agoMFC 874b1a35486b570513680c3d456b062ba097e1d9:
Cy Schubert [Tue, 23 Mar 2021 03:11:58 +0000 (20:11 -0700)]
MFC 874b1a35486b570513680c3d456b062ba097e1d9:

ipfilter: simplify ipf_proxy_check() return codes

ipf_proxy_check() returns -1 for an error and 0 or 1 for success.
ipf_proxy_check()'s callers check for error and if the return code
is 0, they change it to 1 prior to returning to their callers. Simply
by returning -1 or 1 we reduce complexity and cycles burned changing
0 to 1.

(cherry picked from commit 874b1a35486b570513680c3d456b062ba097e1d9)

3 years agoMFC 4e38478c595a:
Hans Petter Selasky [Thu, 25 Mar 2021 15:55:02 +0000 (16:55 +0100)]
MFC 4e38478c595a:
ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value.

The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback
to mbuf clusters when jumbo frames are not available and it also doesn't
account for the packet header and trailer mbuf.

This causes a memory overwrite situation when IPOIB_CM is configured.

While at it add a kernel assert to ensure the mapping array is not overwritten.

PR: 254474
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 4e38478c595a9e6225b525890d7ee269a203c200)

3 years agoMFC 31070b5bc77a:
Hans Petter Selasky [Tue, 9 Mar 2021 16:41:18 +0000 (17:41 +0100)]
MFC 31070b5bc77a:
Set default alternate setting when USB audio devices are not in use,
to activate power save features.

Differential Revision:  https://reviews.freebsd.org/D28032
Suggested by: Shichun_Ma@Dell.com
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 31070b5bc77a499009a835650eb9d4bf2eceaa15)

3 years agoFix warning about signed comparison and drop WARNS for ktrdump(8).
Dmitry Chagin [Wed, 24 Mar 2021 07:51:25 +0000 (10:51 +0300)]
Fix warning about signed comparison and drop WARNS for ktrdump(8).

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

(cherry picked from commit 9e5aeba51b431256adfd18b087ee61b09bfd6a79)

3 years agoamd64: Make KPDPphys local to pmap.c
Mark Johnston [Wed, 24 Mar 2021 13:55:22 +0000 (09:55 -0400)]
amd64: Make KPDPphys local to pmap.c

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7ae2e703366e5ac56373509ececae53ecaa5bc59)

3 years agoFix several dev_clone callbacks to avoid out-of-bounds reads
Mark Johnston [Sun, 28 Mar 2021 15:08:36 +0000 (11:08 -0400)]
Fix several dev_clone callbacks to avoid out-of-bounds reads

Use strncmp() instead of bcmp(), so that we don't have to find the
minimum of the string lengths before comparing.

Reviewed by: kib
Reported by: KASAN
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29463

(cherry picked from commit 3428b6c050d102ba7f95514b29f4f5685d76b645)

3 years agopf tests: pfsync bulk update test
Kristof Provost [Mon, 15 Mar 2021 13:10:55 +0000 (14:10 +0100)]
pf tests: pfsync bulk update test

Test that pfsync works as expected with bulk updates. That is, create
some state before setting up the second firewall. Let that firewall
request a bulk update so it can catch up, and check that it got the
state which was created before it enable pfsync.

PR: 254236
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29272

(cherry picked from commit 8ad7d25dfc808ca00300f7553a9b28dfc0e99c18)

3 years agopfsync: Unconditionally push packets when requesting state updates
Thomas Kurschel [Mon, 15 Mar 2021 13:28:52 +0000 (14:28 +0100)]
pfsync: Unconditionally push packets when requesting state updates

When we request a bulk sync we need to ensure we actually send out that
request, not just buffer it until we have enough data to send a full
packet.

PR: 254236
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29271

(cherry picked from commit 9f2e5184173f6af70306678b018270df9a9600f2)

3 years agorpc.lockd: Unconditionally close fds as daemon
Caleb St. John [Fri, 26 Mar 2021 18:00:14 +0000 (14:00 -0400)]
rpc.lockd: Unconditionally close fds as daemon

When lockd is configured with a debug level of > 0 and foreground == 0,
the process is daemonized with a truth noclose argument to daemon().
This doesn't seem to be the desired behavior because that prevents
stdout and stderr from being closed, however, stdout and stderr aren't
used anywhere else. Furthermore, the man pages state that with a higher
debug level it will use the syslog facilities to do so.

Submitted by: Caleb St. John
Discussed with: rmacklem
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D29415

(cherry picked from commit badcfbacf3840a4097bb79192054481c7674e7d2)

3 years agoalign nfsdumpstate column output
Caleb St. John [Wed, 24 Mar 2021 20:33:41 +0000 (16:33 -0400)]
align nfsdumpstate column output

There are scenarios where an NFS client will mount an NFSv4 export
without specifying a callback address.

When running nfsdumpstate under this circumstance, the column output is
shifted incorrectly which places the "ClientID" value underneath the
"Clientaddr" column.

This diff is a small cosmetic change that prints a blank in the
"Clientaddr" column and ensures the data for the columns are aligned
appropriately.

Submitted by: Caleb St. John
Reviewed by: sef (previous version)
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D18958

(cherry picked from commit efad9c8ba3cec7f6e39b128b90afab70701fd8d9)

3 years agoHyper-V: hn: Initialize the internal field of per packet info on tx path
Wei Hu [Mon, 15 Mar 2021 10:20:52 +0000 (10:20 +0000)]
Hyper-V: hn: Initialize the internal field of per packet info on tx path

The RSC support feature introduced a bit field "rm_internal" in
struct rndis_pktinfo with total size unchanged.

The guest does not use this field in the tx path. However we need to
initialize it to zero in case older hosts which are not aware of this
field.

Fixes: a491581f ("Hyper-V: hn: Enable vSwitch RSC support")
MFC after: 2 weeks
Sponsored by: Microsoft

(cherry picked from commit 805dbff6c36a6cd84491aa53a02315fa025734cc)

3 years agoHyper-V: hn: Enable vSwitch RSC support in hn netvsc driver
Wei Hu [Fri, 12 Mar 2021 04:35:16 +0000 (04:35 +0000)]
Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver

Receive Segment Coalescing (RSC) in the vSwitch is a feature available in
Windows Server 2019 hosts and later. It reduces the per packet processing
overhead by coalescing multiple TCP segments when possible. This happens
mostly when TCP traffics are among different guests on same host.
This patch adds netvsc driver support for this feature.

The patch also updates NVS version to 6.1 as needed for RSC
enablement.

MFC after: 2 weeks
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D29075

(cherry picked from commit a491581f3f8df07cdff0236bd556895205929af4)

3 years agoHyper-V: hn: Store host hash value in flowid
Wei Hu [Wed, 24 Feb 2021 05:07:46 +0000 (05:07 +0000)]
Hyper-V: hn: Store host hash value in flowid

When rx packet contains hash value sent from host, store it in
the mbuf's flowid field so when the same mbuf is on the tx path,
the hash value can be used by the host to determine the outgoing
network queue.

MFC after: 2 weeks
Sponsored by: Microsoft

(cherry picked from commit 80f39bd95f22322152709ea5fae3a3c546044c9c)

3 years agoaccept_filter: Fix filter parameter handling
Mark Johnston [Thu, 25 Mar 2021 21:55:20 +0000 (17:55 -0400)]
accept_filter: Fix filter parameter handling

For filters which implement accf_create, the setsockopt(2) handler
caches the filter name in the socket, but it also incorrectly frees the
buffer containing the copy, leaving a dangling pointer.  Note that no
accept filters provided in the base system are susceptible to this, as
they don't implement accf_create.

Reported by: Alexey Kulaev <alex.qart@gmail.com>
Discussed with: emaste
Security: kernel use-after-free
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 653a437c04440495cd8e7712c7cf39444f26f1ee)

3 years agomountd(8): generate a syslog message when the "V4:" line is missing
Rick Macklem [Tue, 9 Mar 2021 00:08:02 +0000 (16:08 -0800)]
mountd(8): generate a syslog message when the "V4:" line is missing

Daniel reported that NFSv4 mounts were not working despite having
set "nfsv4_server_enable=YES" in /etc/rc.conf.  Mountd was logging a
message that there was no /etc/exports file.
He noted that creating a /etc/exports file with a "V4:" line in it
was needed make NFSv4 mounts work.
At least one "V4:" line in one of the exports(5) file(s) is needed to
make NFSv4 mounts work. This patch fixes mountd.c so that it logs a
message indicting that there is no "V4:" line in any exports(5)
file when NFSv4 mounts are enabled.
To avoid this message being generated erroneously, /etc/rc.d/mountd
is updated to make sure vfs.nfsd.server_max_nfsvers is properly set
before mountd(8) is started.

PR: 253901

(cherry picked from commit 09673fc0f36dd1cca74940a240a9ed0f62228084)

3 years agoOpenSSL: Regen manual pages for 1.1.1k
Jung-uk Kim [Thu, 25 Mar 2021 16:17:52 +0000 (12:17 -0400)]
OpenSSL: Regen manual pages for 1.1.1k

(cherry picked from commit 7595394130a163b7ff53d9ef3f28fcb87f629d17)

3 years agoOpenSSL: Merge OpenSSL 1.1.1k
Jung-uk Kim [Thu, 25 Mar 2021 15:45:19 +0000 (11:45 -0400)]
OpenSSL: Merge OpenSSL 1.1.1k

Merge commit '94fa08a4bcdfbb3434b025d67d014af3b18e5380'

(cherry picked from commit b6c1fdcdf5033d20c61cc77d66f58f31cc65e2ba)

3 years agortsold: Fix validation of RDNSS options
Mark Johnston [Sun, 21 Mar 2021 18:18:10 +0000 (14:18 -0400)]
rtsold: Fix validation of RDNSS options

The header specifies the size of the option in multiples of eight bytes.
The option consists of an eight-byte header followed by one or more IPv6
addresses, so the option is invalid if the size is not equal to 1+2n for
some n>0.  Check this.

The bug can cause random stack data to be formatted as an IPv6 address
and passed to resolvconf(8), but a host able to trigger the bug may also
specify arbitrary addresses this way.

Reported by: Q C <cq674350529@gmail.com>
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1af332a7d8f86b6fcc1f0f575fe5b06021b54f4c)

3 years agoMFC eeb26cf52c4c51e1571253d57684c442aa79a98d:
Cy Schubert [Wed, 17 Mar 2021 00:06:17 +0000 (17:06 -0700)]
MFC eeb26cf52c4c51e1571253d57684c442aa79a98d:

wpa: import fix for P2P provision discovery processing vulnerability

Latest version available from: https://w1.fi/security/2021-1/

Vulnerability

A vulnerability was discovered in how wpa_supplicant processes P2P
(Wi-Fi Direct) provision discovery requests. Under a corner case
condition, an invalid Provision Discovery Request frame could end up
reaching a state where the oldest peer entry needs to be removed. With
a suitably constructed invalid frame, this could result in use
(read+write) of freed memory. This can result in an attacker within
radio range of the device running P2P discovery being able to cause
unexpected behavior, including termination of the wpa_supplicant process
and potentially code execution.

Vulnerable versions/configurations

wpa_supplicant v1.0-v2.9 with CONFIG_P2P build option enabled

An attacker (or a system controlled by the attacker) needs to be within
radio range of the vulnerable system to send a set of suitably
constructed management frames that trigger the corner case to be reached
in the management of the P2P peer table.

Note: FreeBSD base does not enable P2P.
(cherry picked from commit eeb26cf52c4c51e1571253d57684c442aa79a98d)

3 years agoImplement pci_get_relaxed_ordering_enabled() helper function.
Hans Petter Selasky [Tue, 16 Mar 2021 15:06:42 +0000 (16:06 +0100)]
Implement pci_get_relaxed_ordering_enabled() helper function.

Discussed with: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 1acf24a044aaa0391c61af4abe7e018c3bf8a37c)

3 years agonvme: Replace potentially long DELAY() with pause().
Alexander Motin [Wed, 17 Mar 2021 14:30:40 +0000 (10:30 -0400)]
nvme: Replace potentially long DELAY() with pause().

In some cases like broken hardware nvme(4) may wait minutes for
controller response before timeout.  Doing so in a tight spin loop
made whole system unresponsive.

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

(cherry picked from commit 4fbbe523653b6d2a0186aca38224efcab941deaa)

3 years agonetmap: fix issues in nm_os_extmem_create()
Vincenzo Maffione [Sat, 20 Mar 2021 17:15:50 +0000 (17:15 +0000)]
netmap: fix issues in nm_os_extmem_create()

- Call vm_object_reference() before vm_map_lookup_done().
- Use vm_mmap_to_errno() to convert vm_map_* return values to errno.
- Fix memory leak of e->obj.

Reported by: markj
Reviewed by: markj
MFC after: 1 week

(cherry picked from commit ee7ffaa2e6e08b63efb4673610875d40964d5058)

3 years agopf: pool/kpool conversion code
Kristof Provost [Thu, 11 Mar 2021 10:37:05 +0000 (11:37 +0100)]
pf: pool/kpool conversion code

stuct pf_pool and struct pf_kpool are different. We should not simply
bcopy() them.

Happily it turns out that their differences were all pointers, and the
userspace provided pointers were overwritten by the kernel, so this did
actually work correctly, but we should fix it anyway.

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

(cherry picked from commit 15b82e00a1640d1b9a1d720c95f65e580be30187)

3 years agoMFC dfb33cb0ef48:
Hans Petter Selasky [Wed, 10 Mar 2021 12:26:09 +0000 (13:26 +0100)]
MFC dfb33cb0ef48:
Allocating the LinuxKPI current structure from a software interrupt thread
must be done using the M_NOWAIT flag after 1ae20f7c70ea .

Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit dfb33cb0ef48084da84072244e8ca486dfcf3a96)

3 years agoMFC d1cbe7908986:
Hans Petter Selasky [Wed, 10 Mar 2021 09:50:01 +0000 (10:50 +0100)]
MFC d1cbe7908986:
Allocating the LinuxKPI current structure from an interrupt thread must be
done using the M_NOWAIT flag after 1ae20f7c70ea .

Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit d1cbe79089868226625c12ef49f51214d79aa427)

3 years agoMFC 6eb60f5b7f7d:
Hans Petter Selasky [Wed, 10 Mar 2021 11:21:01 +0000 (12:21 +0100)]
MFC 6eb60f5b7f7d:
Use the word "LinuxKPI" instead of "Linux compatibility", to not confuse with
user-space Linux compatibility support. No functional change.

Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 6eb60f5b7f7df1a59de139260aebfa0aa5f6d79e)

3 years agoMFC ebe5cf355dca:
Hans Petter Selasky [Fri, 5 Mar 2021 11:44:06 +0000 (12:44 +0100)]
MFC ebe5cf355dca:
Implement basic support for allocating memory from a specific numa node
in the LinuxKPI.

Differential Revision: https://reviews.freebsd.org/D29077
Reviewed by: markj@ and kib@
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit ebe5cf355dca1d7827a70b99a9d9c4f97f78691d)

3 years agoMFC c743a6bd4fc0:
Hans Petter Selasky [Sat, 6 Mar 2021 10:25:12 +0000 (11:25 +0100)]
MFC c743a6bd4fc0:
Implement mallocarray_domainset(9) variant of mallocarray(9).

Reviewed by: kib @
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit c743a6bd4fc0d1be30f9bc9996333ac0ba079563)

3 years agoDrop EFI_STAGING_SIZE back down to 64M
Warner Losh [Thu, 17 Dec 2020 17:02:09 +0000 (17:02 +0000)]
Drop EFI_STAGING_SIZE back down to 64M

vmware can't cope with anything larger than 64MB. Drop this back to
64MB everywhere but arm.

PR: 251866
MFC After: 1 week

(cherry picked from commit 4d6047edb675e52b8fad57135ab3ded8e66d0dac)

3 years agoO_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path
Konstantin Belousov [Sun, 28 Feb 2021 23:59:12 +0000 (01:59 +0200)]
O_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path

Tested by: pho

(cherry picked from commit 28cd3a673e0e32b009fd573764956b280d1affe1)

3 years agonameicap_check_dotdot: trim tracker on check
Konstantin Belousov [Sun, 28 Feb 2021 00:15:21 +0000 (02:15 +0200)]
nameicap_check_dotdot: trim tracker on check

Tested by: pho

(cherry picked from commit 49c98a4bf3a87ace0df99056fa683805c1645e61)

3 years agoAdd nameicap_cleanup_from(), to clean tracker list starting from some element
Konstantin Belousov [Sun, 28 Feb 2021 00:14:43 +0000 (02:14 +0200)]
Add nameicap_cleanup_from(), to clean tracker list starting from some element

Tested by: pho

(cherry picked from commit e8a2862aa0384c75603f801625e309a3dae0ed05)

3 years agonameicap_tracker_add: avoid duplicates in the tracker list
Konstantin Belousov [Sun, 28 Feb 2021 00:13:19 +0000 (02:13 +0200)]
nameicap_tracker_add: avoid duplicates in the tracker list

Tested by: pho

(cherry picked from commit 2388ad7c293fbc89ee239a1adcb87fd158c4e8e9)

3 years agoDo not call nameicap_tracker_add() for dotdot case.
Konstantin Belousov [Sun, 28 Feb 2021 00:12:43 +0000 (02:12 +0200)]
Do not call nameicap_tracker_add() for dotdot case.

Tested by: pho

(cherry picked from commit 59e749428111c029116a4302a544c7cc18b33772)

3 years agoopen(2): Remove O_BENEATH and AT_BENEATH
Konstantin Belousov [Tue, 16 Feb 2021 03:31:40 +0000 (05:31 +0200)]
open(2): Remove O_BENEATH and AT_BENEATH

Discussed with: emaste, re
Tested by: pho

(cherry picked from commit 20e91ca36a56b8db1e6677f577ad011b66dd6eb3)

3 years agobc: Upgrade to version 3.2.4
Stefan Eßer [Sun, 27 Dec 2020 20:53:09 +0000 (21:53 +0100)]
bc: Upgrade to version 3.2.4

This update changes the behavior of "-e" or "-f" in BC_ENV_ARGS:

Use of these options on the command line makes bc exit after executing
the given commands. These options will not cause bc to exit when
passed via the environment (but EOF in STDIN or -e or -f on the
command line will make bc exit as before).

The same applies to DC_ENV_ARGS with regard to the dc program.

Make length(0) and length(0.0) return 1 for compatibility with GNU bc
and the traditional FreeBSD bc.

Fix a potential division by zero error in a non-standard (extended)
math library function.

(cherry picked from commit e458944cf9deec51d03ec751050a58ddf43e796f)
(cherry picked from commit 9a995fe186257315e7b3d01e24c55d86bb18fd32)
(cherry picked from commit 4aa71da8dc004aa5027836259433e5bff3cd9104)
(cherry picked from commit 028616d0dd69a3da7a30cb94d35f040bf2ced6b9)
(cherry picked from commit f165641df4da1752f8bb1f55c1e602cdb657fba4)
(cherry picked from commit 893ecb52db5ed47d6c1e8698334d34e0df651612)

3 years agoUse C11 anonymous unions.
Dmitry Chagin [Mon, 10 Jun 2019 05:28:03 +0000 (05:28 +0000)]
Use C11 anonymous unions.

PR: 215202
Reported by: glebius

(cherry picked from commit a5ec4a9dba5629dfe146ae9534e91e5e957747eb)

3 years agolinux: make timerfd_settime(2) set expirations count to zero
shu [Wed, 3 Feb 2021 16:51:45 +0000 (16:51 +0000)]
linux: make timerfd_settime(2) set expirations count to zero

On Linux, read(2) from a timerfd file descriptor returns an unsigned
8-byte integer (uint64_t) containing the number of expirations
that have occurred, if the timer has already expired one or more
times since its settings were last modified using timerfd_settime(),
or since the last successful read(2).  That's to say, once we do
a read or call timerfd_settime(), timer fd's expiration count should
be zero.  Some Linux applications create timerfd and add it to epoll
with LT mode, when event comes, they do timerfd_settime instead
of read to stop event source from trigger.  On FreeBSD,
timerfd_settime(2) didn't set the count to zero, which caused high
CPU utilization.

PR: 252820
Submitted by: ankohuu_outlook.com (Shunchao Hu)
Differential Revision: https://reviews.freebsd.org/D28231

(cherry picked from commit ae71b794cbed19e5e25effc3438720ad452ab87c)

3 years agoMerge tcsh 6.22.03-ceccc7f
Dmitry Chagin [Sun, 14 Mar 2021 16:33:13 +0000 (19:33 +0300)]
Merge tcsh 6.22.03-ceccc7f

PR: 252663

(cherry picked from commit 5224c2a3bc95b431f729f3692f264395248d8acc)

3 years agoRemove wrong inline keyword.
Dmitry Chagin [Thu, 30 May 2019 16:11:20 +0000 (16:11 +0000)]
Remove wrong inline keyword.

Reported by: markj
MFC after: 1 week

(cherry picked from commit c8124e20e5493651b5adca11c0c796cdcf5b2696)

3 years agoComplete LOCAL_PEERCRED support. Cache pid of the remote process in the
Dmitry Chagin [Thu, 30 May 2019 14:24:26 +0000 (14:24 +0000)]
Complete LOCAL_PEERCRED support. Cache pid of the remote process in the
struct xucred. Do not bump XUCRED_VERSION as struct layout is not changed.

PR: 215202
Differential Revision: https://reviews.freebsd.org/D20415

(cherry picked from commit c5afec6e895a11c64f58eb99e493adb8ad5dc361)

3 years agoAdd warning to the Linuxulator makefiles that building it outside of a
Dmitry Chagin [Mon, 13 May 2019 18:28:40 +0000 (18:28 +0000)]
Add warning to the Linuxulator makefiles that building it outside of a
kernel does not make sence.

PR: 222861
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20179

(cherry picked from commit 6e4cf32e95841b4c3ef0caeb80802bf528a35cd0)

3 years agopf tests: Fix unsupported ping6 argument
Kristof Provost [Sat, 20 Mar 2021 14:47:50 +0000 (15:47 +0100)]
pf tests: Fix unsupported ping6 argument

ping6 (in stable/12) does not support '-t'. Change it to '-X'.

Direct commit to stable/12.

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