]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoRename struct device to struct _device
Mark Johnston [Mon, 12 Apr 2021 13:32:30 +0000 (09:32 -0400)]
Rename struct device to struct _device

types.h defines device_t as a typedef of struct device *.  struct device
is defined in subr_bus.c and almost all of the kernel uses device_t.
The LinuxKPI also defines a struct device, so type confusion can occur.

This causes bugs and ambiguity for debugging tools.  Rename the FreeBSD
struct device to struct _device.

Reviewed by: gbe (man pages)
Reviewed by: rpokala, imp, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29676

3 years agolinuxkpi: Fix pcie_set_readrq()
Mark Johnston [Mon, 12 Apr 2021 13:32:21 +0000 (09:32 -0400)]
linuxkpi: Fix pcie_set_readrq()

We were passing a LinuxKPI struct device * to a pci(4) function that
expects a device_t.

Reviewed by: manu, hselasky, bz
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29675

3 years agoqlnxr: Properly initialize the Linux device structure
Mark Johnston [Mon, 12 Apr 2021 13:32:08 +0000 (09:32 -0400)]
qlnxr: Properly initialize the Linux device structure

The driver needs to provide a LinuxKPI device structure to register
itself with the IB subsystem.  It was erroneously using a copy of its
FreeBSD device structure for this purpose.

Use linux_pci_attach_device() instead, following the example of the
Chelsio iwarp driver.  Also ensure that we don't leak the faked device
during detach.

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

3 years agocxgb: Use device_t in preference to struct device *
Mark Johnston [Mon, 12 Apr 2021 13:32:04 +0000 (09:32 -0400)]
cxgb: Use device_t in preference to struct device *

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoal_eth: Use device_t in preference to struct device *
Mark Johnston [Mon, 12 Apr 2021 13:32:02 +0000 (09:32 -0400)]
al_eth: Use device_t in preference to struct device *

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agogenet: Use device_t in preference to struct device *
Mark Johnston [Mon, 12 Apr 2021 13:31:58 +0000 (09:31 -0400)]
genet: Use device_t in preference to struct device *

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agopf: Ensure that we don't use kif passed to pfi_kkif_attach()
Kristof Provost [Mon, 12 Apr 2021 09:45:48 +0000 (11:45 +0200)]
pf: Ensure that we don't use kif passed to pfi_kkif_attach()

Once a kif is passed to pfi_kkif_attach() we must ensure we never re-use
it for anything else.
Set the kif to NULL afterwards to guarantee this.

Reported-by: syzbot+be5d4f4a7a4c295e659a@syzkaller.appspotmail.com
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoRemove versatile support
Andrew Turner [Sun, 11 Apr 2021 13:26:50 +0000 (13:26 +0000)]
Remove versatile support

It was used for testing armv6 under QEMU, however since then we added
support for the QEMU virt platform.

Reviewed by: imp, manu
Differential Revision: https://reviews.freebsd.org/D29707

3 years agoCreate VM_MEMATTR_DEVICE on all architectures
Andrew Turner [Sat, 10 Apr 2021 07:59:29 +0000 (07:59 +0000)]
Create VM_MEMATTR_DEVICE on all architectures

This is intended to be used with memory mapped IO, e.g. from
bus_space_map with no flags, or pmap_mapdev.

Use this new memory type in the map request configured by
resource_init_map_request, and in pciconf.

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

3 years agocxgbe/tom: Fix potential leak in t4_aiotx_process_job.
Navdeep Parhar [Sun, 4 Apr 2021 22:04:31 +0000 (15:04 -0700)]
cxgbe/tom: Fix potential leak in t4_aiotx_process_job.

The mbuf allocated could be a chain and must be freed with m_freem.

Reviewed by: jhb@
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29579

3 years agonfsd: cut the Linux NFSv4.1/4.2 some slack w.r.t. RFC5661
Rick Macklem [Sun, 11 Apr 2021 23:51:25 +0000 (16:51 -0700)]
nfsd: cut the Linux NFSv4.1/4.2 some slack w.r.t. RFC5661

Recent testing of network partitioning a FreeBSD NFSv4.1
server from a Linux NFSv4.1 client identified problems
with both the FreeBSD server and Linux client.

Sometimes, after some Linux NFSv4.1/4.2 clients establish
a new TCP connection, they will advance the sequence number
for a session slot by 2 instead of 1.
RFC5661 specifies that a server should reply
NFS4ERR_SEQ_MISORDERED for this case.
This might result in a system call error in the client and
seems to disable future use of the slot by the client.
Since advancing the sequence number by 2 seems harmless,
allow this case if vfs.nfs.linuxseqsesshack is non-zero.

Note that, if the order of RPCs is actually reversed,
a subsequent RPC with a smaller sequence number value
for the slot will be received.  This will result in
a NFS4ERR_SEQ_MISORDERED reply.
This has not been observed during testing.
Setting vfs.nfs.linuxseqsesshack to 0 will provide
RFC5661 compliant behaviour.

This fix affects the fairly rare case where a NFSv4
Linux client does a TCP reconnect and then apparently
erroneously increments the sequence number for the
session slot twice during the reconnect cycle.

PR: 254816
MFC after: 2 weeks

3 years agohv_kbd: Fix leaked $FreeBSD$ expansion
Vladimir Kondratyev [Sun, 11 Apr 2021 23:16:22 +0000 (02:16 +0300)]
hv_kbd: Fix leaked $FreeBSD$ expansion

MFC with: c2a159286c76

3 years agohv_kbd: Add support for K_XLATE and K_CODE modes for gen 2 VMs
Vladimir Kondratyev [Sun, 11 Apr 2021 23:08:36 +0000 (02:08 +0300)]
hv_kbd: Add support for K_XLATE and K_CODE modes for gen 2 VMs

That fixes disabled keyboard input after Xorg server has been stopped.

Reviewed by: whu
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D28171

3 years agohv_kbd: Add evdev protocol support for gen 2 VMs
Vladimir Kondratyev [Sun, 11 Apr 2021 23:07:35 +0000 (02:07 +0300)]
hv_kbd: Add evdev protocol support for gen 2 VMs

Reviewed by: whu
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D28170

3 years agoAdd a note to indicate "don't run the nfscbd(8) without this patch.
Rick Macklem [Sun, 11 Apr 2021 22:14:47 +0000 (15:14 -0700)]
Add a note to indicate "don't run the nfscbd(8) without this patch.

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

3 years agoAdd an UPDATING entry for commit 7763814fc9c2
Rick Macklem [Sun, 11 Apr 2021 21:59:11 +0000 (14:59 -0700)]
Add an UPDATING entry for commit 7763814fc9c2

3 years agoparam.h: bump __FreeBSD_version for commit 7763814fc9c2
Rick Macklem [Sun, 11 Apr 2021 21:47:36 +0000 (14:47 -0700)]
param.h: bump __FreeBSD_version for commit 7763814fc9c2

Commit 7763814fc9c2 changed the internal KAPI between the krpc
and NFS.  As such, the krpc, nfscommon and nfscl modules must
all be rebuilt from sources.

3 years agoee: restore the stdin/stdout terminal check
Yuri Pankov [Sun, 11 Apr 2021 21:44:29 +0000 (00:44 +0300)]
ee: restore the stdin/stdout terminal check

This seems to have been lost during updates from upstream, and
was reported (on IRC) as a nice feature to have (again).

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D28689

3 years agonfsv4 client: do the BindConnectionToSession as required
Rick Macklem [Sun, 11 Apr 2021 21:34:57 +0000 (14:34 -0700)]
nfsv4 client: do the BindConnectionToSession as required

During a recent testing event, it was reported that the NFSv4.1/4.2
server erroneously bound the back channel to a new TCP connection.
RFC5661 specifies that the fore channel is implicitly bound to a
new TCP connection when an RPC with Sequence (almost any of them)
is done on it.  For the back channel to be bound to the new TCP
connection, an explicit BindConnectionToSession must be done as
the first RPC on the new connection.

Since new TCP connections are created by the "reconnect" layer
(sys/rpc/clnt_rc.c) of the krpc, this patch adds an optional
upcall done by the krpc whenever a new connection is created.
The patch also adds the specific upcall function that does a
BindConnectionToSession and configures the krpc to call it
when required.

This is necessary for correct interoperability with NFSv4.1/NFSv4.2
servers when the nfscbd daemon is running.

If doing NFSv4.1/NFSv4.2 mounts without this patch, it is
recommended that the nfscbd daemon not be running and that
the "pnfs" mount option not be specified.

PR: 254840
Comments by: asomers
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29475

3 years agonetmap: don't use linux type struct device *
Vincenzo Maffione [Sun, 11 Apr 2021 21:06:43 +0000 (21:06 +0000)]
netmap: don't use linux type struct device *

Such type cannot be used in code that is in common between
FreeBSD and Linux. Use the FreeBSD type instead.

MFC after: 3 days
Reported by: markj
Differential Revision: https://reviews.freebsd.org/D29677

3 years agoObsoleteFiles.inc: Add comment regarding optional files
Stefan Eßer [Sun, 11 Apr 2021 21:00:39 +0000 (23:00 +0200)]
ObsoleteFiles.inc: Add comment regarding optional files

I had added entries that depended on some build option to this file
and have been informed, that those go into a different file in another
directory.

Mentioning /usr/src/tools/build/mk/OptionalObsoleteFiles.inc in this
file should help other committers (and me) to not repeat that mistake.

MFC after: 1 week

3 years agoacpi(4): mention NONE as possible setting for hw.acpi.power_button_state
Yuri Pankov [Sun, 11 Apr 2021 20:17:06 +0000 (23:17 +0300)]
acpi(4): mention NONE as possible setting for hw.acpi.power_button_state

Reviewed by: manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D29577

3 years agoif_smsc: Add the ability to disable "turbo_mode", also called RX frame batching,
Hans Petter Selasky [Sun, 11 Apr 2021 18:24:41 +0000 (20:24 +0200)]
if_smsc: Add the ability to disable "turbo_mode", also called RX frame batching,
similarly to the Linux driver, by a tunable read only sysctl.

Submitted by: Oleg Sidorkin <osidorkin@gmail.com>
PR: 254884
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

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

3 years agoMake 20201030 a separate entry (insert forgotten newline).
Jens Schweikhardt [Sun, 11 Apr 2021 16:41:59 +0000 (18:41 +0200)]
Make 20201030 a separate entry (insert forgotten newline).

3 years agocam: make sure to clear even more CCBs allocated on the stack
Edward Tomasz Napierala [Sat, 10 Apr 2021 10:25:22 +0000 (11:25 +0100)]
cam: make sure to clear even more CCBs allocated on the stack

This is my second pass, this time over all of CAM except
for the SCSI target bits.  There should be no functional
changes.

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D29549

3 years agorc: kldxref needs mountcritlocal, not root
Edward Tomasz Napierala [Sun, 11 Apr 2021 14:19:33 +0000 (15:19 +0100)]
rc: kldxref needs mountcritlocal, not root

As pointed out by tijl@, kldxref(8) is in /usr/sbin, thus requires
/usr to be mounted.

Fixes: 44f3b1aa980
Sponsored By: EPSRC

3 years agoUse if ... else when printing memory attributes
Andrew Turner [Sun, 11 Apr 2021 09:00:00 +0000 (09:00 +0000)]
Use if ... else when printing memory attributes

In vmstat there is a switch statement that converts these attributes to
a string. As some values can be duplicate we have to hide these from
userspace.

Replace this switch statement with an if ... else macro that lets us
repeat values without a compiler error.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D29703

3 years agoptrace: restructure comments around reparenting on PT_DETACH
Konstantin Belousov [Sun, 11 Apr 2021 09:06:21 +0000 (12:06 +0300)]
ptrace: restructure comments around reparenting on PT_DETACH

style code, and use {} for both branches.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoptrace: remove dead call to FIX_SSTEP()
Konstantin Belousov [Sun, 11 Apr 2021 09:02:34 +0000 (12:02 +0300)]
ptrace: remove dead call to FIX_SSTEP()

It was an alias for procfs_fix_sstep() long time ago.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agogetdirentries.2: remove unnecessary space
Piotr Pawel Stefaniak [Sun, 11 Apr 2021 09:17:01 +0000 (11:17 +0200)]
getdirentries.2: remove unnecessary space

3 years agoBalance parentheses in sysctl descriptions
Piotr Pawel Stefaniak [Sun, 11 Apr 2021 08:29:34 +0000 (10:29 +0200)]
Balance parentheses in sysctl descriptions

3 years agortld_lock.h: add some comments about versioning of struct RtldLockInfo
Konstantin Belousov [Sun, 11 Apr 2021 08:12:48 +0000 (11:12 +0300)]
rtld_lock.h: add some comments about versioning of struct RtldLockInfo

Sponsored by: The FreeBSD Foundation
MFC after: 6 days

3 years agosh: fix debug build
Piotr Pawel Stefaniak [Sun, 11 Apr 2021 07:09:28 +0000 (09:09 +0200)]
sh: fix debug build

Approved by: jilles

3 years agovnode_pager_setsize.9: Some clarifications on the manpage
Ka Ho Ng [Sun, 11 Apr 2021 06:45:37 +0000 (14:45 +0800)]
vnode_pager_setsize.9: Some clarifications on the manpage

A number of changes:
- Clarifies the locking rules when calling the routine.
- Correct the description regarding the content range to be purged.
- Document the effects on page fault handler.

MFC after: 3 days
MFC with: 86a52e262a6f
Sponsored by: The FreeBSD Foundation
Reviewed by: bcr, kib
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D29637

3 years agozfs: avoid memory allocation in arc_prune_async
Mateusz Guzik [Sun, 11 Apr 2021 05:15:41 +0000 (07:15 +0200)]
zfs: avoid memory allocation in arc_prune_async

3 years agozfs: make vnlru_free_vfsops use conditional on version
Mateusz Guzik [Sun, 11 Apr 2021 04:49:24 +0000 (06:49 +0200)]
zfs: make vnlru_free_vfsops use conditional on version

Diff reduction against upstream.

3 years agonfsd: fix replies from session cache for multiple retries
Rick Macklem [Sat, 10 Apr 2021 22:50:25 +0000 (15:50 -0700)]
nfsd: fix replies from session cache for multiple retries

Recent testing of network partitioning a FreeBSD NFSv4.1
server from a Linux NFSv4.1 client identified problems
with both the FreeBSD server and Linux client.

Commit 05a39c2c1c18 fixed replying with the cached reply in
in the session slot if same session slot sequence#.
However, the code uses the reply and, as such,
will fail for a subsequent retry of the RPC.
A subsequent retry would be an extremely rare event,
but this patch fixes this, so long as m_copym(..M_NOWAIT)
does not fail, which should also be a rare event.

This fix affects the exceedingly rare case where a NFSv4
client retries a non-idempotent RPC, such as a lock
operation, multiple times.  Note that retries only occur
after the client has needed to create a new TCP connection,
with a new TCP connection for each retry.

MFC after: 2 weeks

3 years agozfs: change format string in zio_fini to get rid of the cast
Mateusz Guzik [Sat, 10 Apr 2021 19:12:00 +0000 (19:12 +0000)]
zfs: change format string in zio_fini to get rid of the cast

3 years agoFix direct route installation with net/bird.
Alexander V. Chernikov [Sat, 10 Apr 2021 15:25:24 +0000 (16:25 +0100)]
Fix direct route installation with net/bird.

Slighly relax the gateway validation rules imposed by the
 2fe5a79425c7, by requiring only first 8 bytes (everyhing
 before sdl_data to be present in the AF_LINK gateway.

Reported by: olivier

3 years agortld: make dlerror() thread-local
Konstantin Belousov [Wed, 7 Apr 2021 22:02:33 +0000 (01:02 +0300)]
rtld: make dlerror() thread-local

PR: 95339
Discussed with: arichardson
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29633

3 years agortld: workaround for broken ABI
Konstantin Belousov [Sat, 10 Apr 2021 12:32:24 +0000 (15:32 +0300)]
rtld: workaround for broken ABI

Right now, libthr does not initialize RtldLockInfo.rtli_version when calling
_rtld_thread_init(), which makes versioning the interface troublesome.

Add a workaround: if the calling object of _rtld_thread_init() exports
the "_pli_rtli_version" symbol, then consider rtli_version initialized.
Otherwise, forcibly set it to RTLI_VERSION_ONE, currently defined as
RTLI_VERSION.

Export "_pli_rtli_version" from libthr and properly initialize rtli_version.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29633

3 years agortld: unstaticise lockinfo and obj_from_addr()
Konstantin Belousov [Sat, 10 Apr 2021 12:30:59 +0000 (15:30 +0300)]
rtld: unstaticise lockinfo and obj_from_addr()

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29633

3 years agoOnly use -fp-exception-behavior=maytrap on x86, for now
Dimitry Andric [Sat, 10 Apr 2021 14:02:49 +0000 (16:02 +0200)]
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
MFC after: 1 week

3 years agoAppease -Wsign-compare in radix.c
Alexander V. Chernikov [Sat, 10 Apr 2021 13:48:25 +0000 (13:48 +0000)]
Appease -Wsign-compare in radix.c

Differential Revision: https://reviews.freebsd.org/D29661
Submitted by: zec
MFC after 2 weeks

3 years agoAllow to specify debugnet fib in sysctl/tunable.
Alexander V. Chernikov [Mon, 5 Apr 2021 19:48:07 +0000 (19:48 +0000)]
Allow to specify debugnet fib in sysctl/tunable.

Differential Revision: https://reviews.freebsd.org/D29593
Reviewed by: donner
MFC after: 2 weeks

3 years agoAlways use inp fib in the inp_lookup_mcast_ifp().
Alexander V. Chernikov [Mon, 5 Apr 2021 19:58:57 +0000 (19:58 +0000)]
Always use inp fib in the inp_lookup_mcast_ifp().

inp_lookup_mcast_ifp() is static and is only used in the inp_join_group().
The latter function is also static, and is only used in the inp_setmoptions(),
 which relies on inp being non-NULL.

As a result, in the current code, inp_lookup_mcast_ifp() is always called
 with non-NULL inp. Eliminate unused RT_DEFAULT_FIB condition and always
 use inp fib instead.

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

3 years agolibnv: Use PICFLAG rather than -fPIC
Kristof Provost [Sat, 10 Apr 2021 09:23:57 +0000 (11:23 +0200)]
libnv: Use PICFLAG rather than -fPIC

Suggested by: andrew
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")

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
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29686

3 years agoAdjust .arcconfig to land onto 'main' by default
Dimitry Andric [Sat, 10 Apr 2021 11:51:16 +0000 (13:51 +0200)]
Adjust .arcconfig to land onto 'main' by default

Otherwise, commands like "arc land" will default to 'master' instead.

MFC after: immediately

3 years agolibpfctl: Fix u_* counters
Kristof Provost [Thu, 8 Apr 2021 08:36:18 +0000 (10:36 +0200)]
libpfctl: Fix u_* counters

struct pf_rule had a few counter_u64_t counters. Those couldn't be
usefully comminicated with userspace, so the fields were doubled up in
uint64_t u_* versions.

Now that we use struct pfctl_rule (i.e. a fully userspace version) we
can safely change the structure and remove this wart.

Reviewed by: glebius
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29645

3 years agolibpfctl: Switch to pfctl_rule
Kristof Provost [Thu, 8 Apr 2021 08:31:46 +0000 (10:31 +0200)]
libpfctl: Switch to pfctl_rule

Stop using the kernel's struct pf_rule, switch to libpfctl's pfctl_rule.
Now that we use nvlists to communicate with the kernel these structures
can be fully decoupled.

Reviewed by: glebius
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29644

3 years agopf: Move prototypes for userspace functions to userspace header
Kristof Provost [Wed, 7 Apr 2021 17:49:51 +0000 (19:49 +0200)]
pf: Move prototypes for userspace functions to userspace header

These functions no longer exist in the kernel, so there's no reason to
keep the prototypes in a kernel header. Move them to pfctl where they're
actually implemented.

Reviewed by: glebius
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29643

3 years agobsnmp: Use libpfctl
Kristof Provost [Mon, 29 Mar 2021 15:43:25 +0000 (17:43 +0200)]
bsnmp: Use libpfctl

Reviewed by: glebius
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29642

3 years ago(t)ftp-proxy: use libpfctl
Kristof Provost [Mon, 29 Mar 2021 12:03:39 +0000 (14:03 +0200)]
(t)ftp-proxy: use libpfctl

Reviewed by: glebius
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29641

3 years agopfctl: Move ioctl abstraction functions into libpfctl
Kristof Provost [Fri, 26 Mar 2021 10:38:58 +0000 (11:38 +0100)]
pfctl: Move ioctl abstraction functions into libpfctl

Introduce a library to wrap the pf ioctl interface.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29562

3 years agolibnv: Build PIC
Kristof Provost [Fri, 2 Apr 2021 15:06:02 +0000 (17:06 +0200)]
libnv: Build PIC

Build libnv as position independent code so we can use it from shared
libraries.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29561

3 years agopfctl: Use the new DIOCGETRULENV ioctl
Kristof Provost [Fri, 26 Mar 2021 10:22:15 +0000 (11:22 +0100)]
pfctl: Use the new DIOCGETRULENV ioctl

Create wrapper functions to handle the parsing of the nvlist and move
that code into pfctl_ioctl.c.
At some point this should be moved into a libpfctl.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29560

3 years agopf: Implement nvlist variant of DIOCGETRULE
Kristof Provost [Thu, 25 Mar 2021 09:39:14 +0000 (10:39 +0100)]
pf: Implement nvlist variant of DIOCGETRULE

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29559

3 years agopfctl: Move to DIOCADDRULENV
Kristof Provost [Fri, 12 Mar 2021 17:03:14 +0000 (18:03 +0100)]
pfctl: Move to DIOCADDRULENV

Start using the new nvlist based ioctl to add rules.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29558

3 years agopf: Introduce nvlist variant of DIOCADDRULE
Kristof Provost [Thu, 11 Mar 2021 15:21:23 +0000 (16:21 +0100)]
pf: Introduce nvlist variant of DIOCADDRULE

This will make future extensions of the API much easier.
The intent is to remove support for DIOCADDRULE in FreeBSD 14.

Reviewed by: markj (previous version), glebius (previous version)
MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29557

3 years agoCross-reference camcontrol(8) and zonectl(8) man pages.
Edward Tomasz Napierala [Sat, 10 Apr 2021 09:13:29 +0000 (10:13 +0100)]
Cross-reference camcontrol(8) and zonectl(8) man pages.

3 years agorc: kldxref only needs to depend on rootfs, not FILESYSTEMS
Edward Tomasz Napierala [Sat, 10 Apr 2021 08:19:25 +0000 (09:19 +0100)]
rc: kldxref only needs to depend on rootfs, not FILESYSTEMS

This makes it run a bit earlier in the startup, which will
be useful for the linux rc script later on.

Reviewed By: imp (earlier version)
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29589

3 years agoRegen src.conf.5 after 9d178c925fb9
Ed Maste [Sat, 10 Apr 2021 02:22:05 +0000 (22:22 -0400)]
Regen src.conf.5 after 9d178c925fb9

3 years agoDrop 'Set to' from most src.conf(5) knobs
Ed Maste [Sat, 10 Apr 2021 02:23:03 +0000 (22:23 -0400)]
Drop 'Set to' from most src.conf(5) knobs

The description is clearly what effect the knob has when set, so the
additional text was unnecessary.

Reviewed by: jhb, se
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29583

3 years agoamd64: clear debug registers on execing 32bit Linux binary
Konstantin Belousov [Fri, 9 Apr 2021 23:25:06 +0000 (02:25 +0300)]
amd64: clear debug registers on execing 32bit Linux binary

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

3 years agoamd64: clear debug registers on execing 32bit native binary
Konstantin Belousov [Fri, 9 Apr 2021 23:23:54 +0000 (02:23 +0300)]
amd64: clear debug registers on execing 32bit native binary

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

3 years agoamd64 linux64: use x86_clear_dbregs()
Konstantin Belousov [Fri, 9 Apr 2021 23:22:48 +0000 (02:22 +0300)]
amd64 linux64: use x86_clear_dbregs()

instead of manually inlining it

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

3 years agox86: use x86_clear_dbregs() on fork
Konstantin Belousov [Fri, 9 Apr 2021 23:20:55 +0000 (02:20 +0300)]
x86: use x86_clear_dbregs() on fork

instead of manual zeroing of the debug registers file in pcb.
This centralizes the cleaning code, but the practical difference is
that PCB_DBREGS flag is cleared, saving some operations on context
switching.

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

3 years agox86: add x86_clear_dbregs() helper
Konstantin Belousov [Fri, 9 Apr 2021 23:19:23 +0000 (02:19 +0300)]
x86: add x86_clear_dbregs() helper

Move the code from exec_setregs() to reset debug registers state on exec,
to the x86_clear_dbregs() helper

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

3 years agoFix a typo in a comment: frame -> framework.
John Baldwin [Tue, 16 Mar 2021 22:33:20 +0000 (15:33 -0700)]
Fix a typo in a comment: frame -> framework.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agonlmrsa: Remove this deprecated driver.
John Baldwin [Tue, 16 Mar 2021 21:48:02 +0000 (14:48 -0700)]
nlmrsa: Remove this deprecated driver.

Relnotes: yes
Sponsored by: Chelsio Communications

3 years agoefivar: use bool for booleans
Warner Losh [Fri, 9 Apr 2021 22:35:50 +0000 (16:35 -0600)]
efivar: use bool for booleans

Rather than int flags we ++, use booleans for all command line args.
No functional change intended.

Reviewed by: markj@
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29621

3 years agoefivar: Attempt to fix setting/printing/deleting EFI vars with '-' in their name
Warner Losh [Fri, 9 Apr 2021 22:35:17 +0000 (16:35 -0600)]
efivar: Attempt to fix setting/printing/deleting EFI vars with '-' in their name

Due to how we're parsing UUIDs, we were disallowing setting, printing or
deleting any UEFI variable with a '-' in it when you attempted to do that
operation with the exact name (wildcard reporting was unaffected). Fix the
parser to loop over all the dashes in the name and only give up when all
possible matches are exhausted.

Reviewed by: markj@
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29620

3 years agoefivar: Add --quiet to not report errors
Warner Losh [Fri, 9 Apr 2021 22:35:08 +0000 (16:35 -0600)]
efivar: Add --quiet to not report errors

Add -q/--quiet flag to the command line. With it, errors are not reported at
all. Instead nothing is printed and the exit code is non-zero.

Reviewed by: markj
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29619

3 years agotcp_hostcache: make THC_LOCK/UNLOCK macros to work with hash head pointer.
Gleb Smirnoff [Fri, 9 Apr 2021 15:39:40 +0000 (08:39 -0700)]
tcp_hostcache: make THC_LOCK/UNLOCK macros to work with hash head pointer.
Not a functional change.

3 years agotcp_hostcache: style(9)
Gleb Smirnoff [Thu, 8 Apr 2021 21:23:23 +0000 (14:23 -0700)]
tcp_hostcache: style(9)

Reviewed by: rscheff

3 years agotcp_hostcache: remove extraneous check.
Gleb Smirnoff [Thu, 8 Apr 2021 21:17:39 +0000 (14:17 -0700)]
tcp_hostcache: remove extraneous check.
All paths leading here already checked this setting.

Reviewed by: rscheff

3 years agotcp_hostcache: implement tcp_hc_updatemtu() via tcp_hc_update.
Gleb Smirnoff [Thu, 8 Apr 2021 21:15:42 +0000 (14:15 -0700)]
tcp_hostcache: implement tcp_hc_updatemtu() via tcp_hc_update.
Locking changes are planned here, and without this change too
much copy-and-paste would be between these two functions.

Reviewed by: rscheff

3 years agortld: use _get_tp() in __tls_get_addr()
Konstantin Belousov [Wed, 7 Apr 2021 03:49:28 +0000 (06:49 +0300)]
rtld: use _get_tp() in __tls_get_addr()

This eliminates some non-trivial amount of code duplication, where done.
Only x86 and mips are handled right now.

Tested by:      bdragon (powerpc), mhorne (riscv)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agortld: avoid recursing on rtld_bind_lock for write
Konstantin Belousov [Tue, 6 Apr 2021 19:02:23 +0000 (22:02 +0300)]
rtld: avoid recursing on rtld_bind_lock for write

This fixes a regression in d36d6816151705907393889, where the call to
__tls_get_address() was performed under rtld_bind_lock write-locked.
Instead use tls_get_addr_slow() directly, with locked = true.

Reported by: jkim, many others
Tested by: jkim, bdragon (powerpc), mhorne (riscv)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agortld: allow to use tls_get_addr_slow() from context where rtld_bind_lock is locked
Konstantin Belousov [Tue, 6 Apr 2021 18:56:58 +0000 (21:56 +0300)]
rtld: allow to use tls_get_addr_slow() from context where rtld_bind_lock is locked

Explicit locked parameter is added

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agortld: style tls_get_addr_slow
Konstantin Belousov [Tue, 6 Apr 2021 18:55:10 +0000 (21:55 +0300)]
rtld: style tls_get_addr_slow

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agolibc dl_iterate_phdr(): dlpi_tls_data is wrong
Konstantin Belousov [Mon, 5 Apr 2021 03:38:07 +0000 (06:38 +0300)]
libc dl_iterate_phdr(): dlpi_tls_data is wrong

This is the same change as d36d681615170590, but for libc static implementaion
of dl_iterate_phdr().

Reported by: emacsray@gmail.com
PR: 254774
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agolibc: implement __tls_get_addr() for static binaries
Konstantin Belousov [Mon, 5 Apr 2021 03:29:47 +0000 (06:29 +0300)]
libc: implement __tls_get_addr() for static binaries

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agolibc: add _get_tp() private function
Konstantin Belousov [Mon, 5 Apr 2021 03:30:35 +0000 (06:30 +0300)]
libc: add _get_tp() private function

which returns pointer to tcb

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agortld: define TLS_DTV_OFFSET on all architectures
Konstantin Belousov [Wed, 7 Apr 2021 06:25:34 +0000 (09:25 +0300)]
rtld: define TLS_DTV_OFFSET on all architectures

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agolibc: include rtld.h into static implementations of rtld interface
Konstantin Belousov [Mon, 5 Apr 2021 03:41:46 +0000 (06:41 +0300)]
libc: include rtld.h into static implementations of rtld interface

and resolve naming conficts

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agolibc: constify dummy error message string for dlfcn
Konstantin Belousov [Mon, 5 Apr 2021 04:14:39 +0000 (07:14 +0300)]
libc: constify dummy error message string for dlfcn

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agortld_lock.h: Expand scope for IN_RTLD to avoid some conflicts with libc
Konstantin Belousov [Mon, 5 Apr 2021 04:12:22 +0000 (07:12 +0300)]
rtld_lock.h: Expand scope for IN_RTLD to avoid some conflicts with libc

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agortld/x86/reloc.c: style
Konstantin Belousov [Wed, 7 Apr 2021 06:12:10 +0000 (09:12 +0300)]
rtld/x86/reloc.c: style

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agortld_lock.h: remove tautological extern's
Konstantin Belousov [Mon, 5 Apr 2021 04:11:49 +0000 (07:11 +0300)]
rtld_lock.h: remove tautological extern's

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

3 years agoStop arming kqueue timers on knote owner suspend or terminate
Konstantin Belousov [Fri, 5 Mar 2021 23:29:08 +0000 (01:29 +0200)]
Stop arming kqueue timers on knote owner suspend or terminate

This way, even if the process specified very tight reschedule
intervals, it should be stoppable/killable.

Reported and reviewed by: markj
Tested by: markj, pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29106

3 years agoAdd helper for kqueue timers callout scheduling
Konstantin Belousov [Fri, 5 Mar 2021 23:31:20 +0000 (01:31 +0200)]
Add helper for kqueue timers callout scheduling

Reviewed by: markj
Tested by: markj, pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29106

3 years agoStop arming realtime posix process timers on suspend or terminate
Konstantin Belousov [Thu, 11 Mar 2021 08:16:51 +0000 (10:16 +0200)]
Stop arming realtime posix process timers on suspend or terminate

Reported and reviewed by: markj
Tested by: markj, pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29106

3 years agoStop arming periodic process timers on suspend or terminate
Konstantin Belousov [Fri, 5 Mar 2021 21:19:35 +0000 (23:19 +0200)]
Stop arming periodic process timers on suspend or terminate

Reported and reviewed by: markj
Tested by: markj, pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29106

3 years agoImplement better rebuild-delay fib algo policy.
Alexander V. Chernikov [Fri, 9 Apr 2021 20:25:47 +0000 (21:25 +0100)]
Implement better rebuild-delay fib algo policy.

The intent is to better handle time intervals with large amount of RIB
updates (e.g. BGP peer going up or down), while still keeping low sync
delay for the rest scenarios.

The implementation is the following: updates are bucketed into the
buckets of size 50ms. If the number of updates within a current bucket
 exceeds the threshold of 500 routes/sec (e.g. 10 updates per bucket
interval), the update is delayed for another 50ms. This can be repeated
 until the maximum update delay (1 sec) is reached.

All 3 variables are runtime tunables:

* net.route.algo.fib_max_sync_delay_ms: 1000
* net.route.algo.bucket_change_threshold_rate: 500
* net.route.algo.bucket_time_ms: 50

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

3 years agonetmap: vtnet: remove unused variable
Vincenzo Maffione [Fri, 9 Apr 2021 19:26:23 +0000 (19:26 +0000)]
netmap: vtnet: remove unused variable

Reported by: bdragon

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
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29673