]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agopfctl: Fix clearing rules counters
Kristof Provost [Mon, 12 Apr 2021 15:23:33 +0000 (17:23 +0200)]
pfctl: Fix clearing rules counters

After the migration to libpfctl for rule retrieval we accidentally lost
support for clearing the rules counters.

Introduce a get_clear variant of pfctl_get_rule() which allows rules
counters to be cleared.

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

(cherry picked from commit 4eabfe468b6e80a0823523d83dc908c27ec823c7)

3 years agopfctl, libpfctl: introduce pfctl_pool
Kurosawa Takahiro [Mon, 12 Apr 2021 14:03:40 +0000 (16:03 +0200)]
pfctl, libpfctl: introduce pfctl_pool

Introduce pfctl_pool to be able to extend the pool part of the pf rule
without breaking the ABI.

Reviewed by: kp
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D29721

(cherry picked from commit 600bd6ce0639c84b763516477250df5964e8edf6)

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")

(cherry picked from commit 5e98cae661f3a7e85df7f277660765b823454073)

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")

(cherry picked from commit 15ca66220874c177602c13a114b2f3d17773b788)

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

(cherry picked from commit ab5707a5cf86ed66dbd11e03ad9676766da9a47b)

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

(cherry picked from commit e9eb09414a8de8f3329f51b48c90a5e5ac8f09cf)

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

(cherry picked from commit a9b338b260be39cc74dddb599d6c95b8794ca98b)

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

(cherry picked from commit 956e7d232549ce4b17f5b1a079e5b51229479dda)

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

(cherry picked from commit 95be9288f01f30a50440ea56d11468a2c6e18fed)

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

(cherry picked from commit 0d71f9f36e6c1849fdaf6c1edc1178be07357034)

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

(cherry picked from commit 0dd13c77432ade1ae94c9661cbad5537e3e6ab1d)

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

(cherry picked from commit 0d6c8174ef2f3d8d6fb02ec97753a0937796a5c6)

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

(cherry picked from commit d710367d1159423ed4da6628b7ab042d3e44f900)

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

(cherry picked from commit 5c11c5a3655842a176124ef2334fcdf830422c8a)

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

(cherry picked from commit 5c62eded5a11ebdb1d57134d923596e2b04e9466)

3 years agopf: Remove unused variable rt_listid from struct pf_krule
Kristof Provost [Thu, 8 Apr 2021 09:08:33 +0000 (11:08 +0200)]
pf: Remove unused variable rt_listid from struct pf_krule

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

(cherry picked from commit 4967f672ef3095300fe74a9d1ae873d0897cc0a5)

3 years agoioccom: define ioctl cmd value that can never be valid
Konstantin Belousov [Thu, 22 Apr 2021 19:40:08 +0000 (22:40 +0300)]
ioccom: define ioctl cmd value that can never be valid

(cherry picked from commit 619fe095861274576a2cb45628076968051b1585)

3 years agoarp(8): fixing the deletion failure of IEEE1394 associated addresses
Tai-hwa Liang [Mon, 12 Apr 2021 06:27:03 +0000 (06:27 +0000)]
arp(8): fixing the deletion failure of IEEE1394 associated addresses

Without this, 'arp -d ${IEEE1394_ADDRESS}' gives the following error:

arp: delete: cannot locate 10.0.0.71

Reviewed by: glebius
MFC after: 2 weeks

(cherry picked from commit a0d6d0d0b9aba6d4c025b2f2807e7c4b4c4b2415)

3 years agoif_firewire: fixing panic upon packet reception for VNET build
Tai-hwa Liang [Sat, 10 Apr 2021 15:32:27 +0000 (15:32 +0000)]
if_firewire: fixing panic upon packet reception for VNET build

netisr_dispatch_src() needs a valid VNET pointer or firewire_input() will panic
when receiving a packet.

Reviewed by: glebius
MFC after: 2 weeks

(cherry picked from commit d9b61e7153c64b141436b4d9619b166c6d35a0a6)

3 years agopipe: Avoid calling selrecord() on a closing pipe
Mark Johnston [Wed, 28 Apr 2021 14:42:59 +0000 (10:42 -0400)]
pipe: Avoid calling selrecord() on a closing pipe

pipe_poll() may add the calling thread to the selinfo lists of both ends
of a pipe.  It is ok to do this for the local end, since we know we hold
a reference on the file and so the local end is not closed.  It is not
ok to do this for the remote end, which may already be closed and have
called seldrain().  In this scenario, when the polling thread wakes up,
it may end up referencing a freed selinfo.

Guard the selrecord() call appropriately.

Reviewed by: kib
Reported by: syzkaller+KASAN
Differential Revision: https://reviews.freebsd.org/D30016

(cherry picked from commit d1e9441583fd85c7de5f48197d80c287f1a9494b)

3 years agoFix build post a0409676120c1e558d0ade943019934e0f15118d.
Cy Schubert [Mon, 22 Mar 2021 15:42:18 +0000 (08:42 -0700)]
Fix build post a0409676120c1e558d0ade943019934e0f15118d.

(cherry picked from commit 048488c0c4e47aa2aac9709b18d7da14b06f78cd)

3 years agopkg(7): replace usage of sbuf(9) with open_memstream(3)
Baptiste Daroussin [Tue, 27 Apr 2021 02:38:55 +0000 (04:38 +0200)]
pkg(7): replace usage of sbuf(9) with open_memstream(3)

open_memstream(3) is a standard way to obtain the same feature we do get
by using sbuf(9) (aka dynamic size buffer), switching to using it makes
pkg(7) more portable, and reduces its number of dependencies.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D30005

(cherry picked from commit cc9a8a116d19daf224222506441e91a3d329160e)

3 years agopkg(7): indentation fixes
Baptiste Daroussin [Tue, 27 Apr 2021 02:07:05 +0000 (04:07 +0200)]
pkg(7): indentation fixes

Non functional changes

(cherry picked from commit f648d757b76d70d58bbda7c3ed3ff79261d24d0f)

3 years agopkg(7): when bootstrapping first search for pkg.pkg file then pkg.
Baptiste Daroussin [Fri, 12 Mar 2021 17:36:30 +0000 (18:36 +0100)]
pkg(7): when bootstrapping first search for pkg.pkg file then pkg.

The package extension is going to be changed to .pkg to be among other
things resilient to the change of compression format used and reduce
the impact of all third party tool of that change.

Ensure the bootstrap knows about it

Reviewed by: manu
Differential revision: https://reviews.freebsd.org/D29232

(cherry picked from commit a2aac2f5e5642740507a3cadb98046f3dd434ce4)
(cherry picked from commit c244b1d8a38731041d0f3ff4191192a85dd8608b)

3 years agopkg(7): add an -r reponame option for bootstrap and add
Kyle Evans [Fri, 12 Feb 2021 00:58:26 +0000 (18:58 -0600)]
pkg(7): add an -r reponame option for bootstrap and add

This is limited to bootstrap/add because some real pkg(8) commands
have -r flags with an incompatible meaning/usage, e.g., pkg-audit.
pkg(7) will still commence the search as it has, but it will ignore any
repo objects without the given name so that overrides and whatnot still
work as expected.

The use of it for add is noted in the manpage; notably, that the
signature config for that repository will be used over global config if
it's specified. i.e., pkg(7) should assume that the given pkg did come
from that repository and treat it appropriately.

Reviewed by: bapt, manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28524

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

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

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

3 years agopkg(7): rework the arguments handling
Baptiste Daroussin [Wed, 6 Jan 2021 10:35:22 +0000 (11:35 +0100)]
pkg(7): rework the arguments handling

Rework the arguments handling around using getopt_long:
* add long option support
* add -4 and -6 support to enforce ipv4 or ipv6

While here fix a regression which occured between FreeBSD 12.1 and
FreeBSD 12.2 where pkg bootstrap -y stopped working

PR: 252270
Submitted by: evilham <contact@evilham.com>
Differential Revision: https://reviews.freebsd.org/D27860

(cherry picked from commit ae994fdc5bd2ccc0ac0b8745fd1f1be67ad6e071)

3 years agoUse asprintf instead of sbuf
Baptiste Daroussin [Mon, 19 Oct 2020 07:26:42 +0000 (07:26 +0000)]
Use asprintf instead of sbuf

3 years agofix up docs, if signature checking is enabled, the file MUST exist...
John-Mark Gurney [Fri, 6 Nov 2020 22:11:05 +0000 (22:11 +0000)]
fix up docs, if signature checking is enabled, the file MUST exist...

(cherry picked from commit e771d590741ea39be83558bda72854c65e1084ae)

3 years agopw(8): use open_memstream(3) instead of sbuf(9)
Baptiste Daroussin [Tue, 27 Apr 2021 03:05:13 +0000 (05:05 +0200)]
pw(8): use open_memstream(3) instead of sbuf(9)

open_memstream(3) is a standard function that brings here the same
functionnality what we were doing with sbuf(9).

(cherry picked from commit 0cd4b781a6fa1ed4ca04a7b642f41652e25bbc9b)

3 years agolibedit: vendor import libedit 2021-03-28
Baptiste Daroussin [Mon, 22 Mar 2021 14:34:14 +0000 (15:34 +0100)]
libedit: vendor import libedit 2021-03-28

(cherry picked from commit f9a159da2a292968cd5c37b56a6c43b6af8c5eed)
(cherry picked from commit 19318a62d7f8cfe2f0f5c24178fa33e8844ae5d1)

3 years agolibucl: vendor import snapshort 20210314
Baptiste Daroussin [Mon, 22 Mar 2021 14:13:02 +0000 (15:13 +0100)]
libucl: vendor import snapshort 20210314

(cherry picked from commit a0409676120c1e558d0ade943019934e0f15118d)

3 years agoMake pkg(7) use environment variables specified in pkg.conf
Moritz Schmitt [Tue, 27 Apr 2021 01:59:12 +0000 (03:59 +0200)]
Make pkg(7) use environment variables specified in pkg.conf

Modify /usr/sbin/pkg to use environment variables specified in pkg.conf.
This allows control over underlying libraries like fetch(3), which can
be configured by setting HTTP_PROXY.

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

(cherry picked from commit e869d3c60147bbb226b5ad97d2ef73391aeebafa)

3 years agosh: improve emacs mode
Baptiste Daroussin [Tue, 30 Mar 2021 09:37:29 +0000 (11:37 +0200)]
sh: improve emacs mode

In emacs mode, force ^R to backware search the history
This behaviour is the default in emacs mode for most of the other shells

Note: Note that this can still be overridden via $EDITRC, ~/.editrc or a
bind command after set -o emacs.

Approved by: jilles
Reviewed by: jilles, arichardson, pstef
Differential Revision: https://reviews.freebsd.org/D29494

(cherry picked from commit 660045fb5360d328da199ae78c89d5cc15b6d1ca)

3 years agoarcmsr(4): Fix SCSI command timeout on ARC-1886.
Xin LI [Wed, 21 Apr 2021 08:03:54 +0000 (01:03 -0700)]
arcmsr(4): Fix SCSI command timeout on ARC-1886.

Many thanks to Areca for continuing to support FreeBSD.

Submitted by: 黃清隆 <ching2048 areca com tw>

(cherry picked from commit 438b5532070f7c52e88f514380ee8662de1f600b)

3 years agoSet PCIe device's Max_Payload_Size to match PCIe root's.
Alexander Motin [Mon, 5 Apr 2021 14:34:40 +0000 (10:34 -0400)]
Set PCIe device's Max_Payload_Size to match PCIe root's.

Usually on boot the MPS is already configured by BIOS.  But we've
found that on hot-plug it is not true at least for our Supermicro
X11 boards.  As result, mismatch between root's configuration of
256 bytes and device's default of 128 bytes cause problems for some
devices, while others seem to work fine.

MFC after: 1 month
Sponsored by: iXsystems, Inc.

(cherry picked from commit 5a898b2b78ce04d608bbaaa0813424b11f921ae7)

3 years agopf tests: Test using '<ifgroup>:network' in tables
Kristof Provost [Sun, 25 Apr 2021 10:18:48 +0000 (12:18 +0200)]
pf tests: Test using '<ifgroup>:network' in tables

MFC after: 1 week

(cherry picked from commit daa5350d0e0c5fbe42c5a057dd37b9d22df91bb7)

3 years agopfctl: Revert "pfctl: Another set skip <group> fix"
Kristof Provost [Mon, 26 Apr 2021 08:07:07 +0000 (10:07 +0200)]
pfctl: Revert "pfctl: Another set skip <group> fix"

This reverts commit 0c156a3c32cd0d9168570da5686ddc96abcbbc5a.
This fix broke using '<ifgroup>:network' in tables.

MFC after: 1 week

(cherry picked from commit d5b08e13dd6beb3436e181ff1f3e034cc8186584)

3 years agonfscommon: fix function name in comment
Rick Macklem [Tue, 20 Apr 2021 03:09:46 +0000 (20:09 -0700)]
nfscommon: fix function name in comment

(cherry picked from commit 78ffcb86d98fc9c27ac7a723c65621667036c42d)

3 years agonfsd: fix stripe size reply for the File Layout pNFS server
Rick Macklem [Tue, 20 Apr 2021 00:51:07 +0000 (17:51 -0700)]
nfsd: fix stripe size reply for the File Layout pNFS server

At a recent testing event I found out that I had misinterpreted
RFC5661 where it describes the stripe size in the File Layout's
nfl_util field. This patch fixes the pNFS File Layout server
so that it returns the correct value to the NFSv4.1/4.2 pNFS
enabled client.

This affects almost no one, since pNFS server configurations
are rare and the extant pNFS aware NFS clients seemed to
function correctly despite the erroneous stripe size.
It *might* be needed for correct behaviour if a recent
Linux client mounts a FreeBSD pNFS server configuration
that is using File Layout (non-mirrored configuration).

(cherry picked from commit 5a89498d19863d0c4cb074f9b93862a70040bf1b)

3 years agogpioc_detach: fix freeing of wrong pointers
Andriy Gapon [Tue, 23 Mar 2021 10:45:18 +0000 (12:45 +0200)]
gpioc_detach: fix freeing of wrong pointers

MFC after: 1 week

(cherry picked from commit 3c6b59567f61277ed487320aa9ad130c6894ad7a)

3 years agoimgact_elf: Ensure that the return value in parse_notes is initialized
Mark Johnston [Mon, 26 Apr 2021 18:53:16 +0000 (14:53 -0400)]
imgact_elf: Ensure that the return value in parse_notes is initialized

parse_notes relies on the caller-supplied callback to initialize "res".
Two callbacks are used in practice, brandnote_cb and note_fctl_cb, and
the latter fails to initialize res.  Fix it.

In the worst case, the bug would cause the inner loop of check_note to
examine more program headers than necessary, and the note header usually
comes last anyway.

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

(cherry picked from commit 409ab7e109c692014e3484a74af248dd7a4746e8)

3 years agoe1000: Fix register name in reg_dump sysctl
Kevin Bowling [Mon, 26 Apr 2021 16:30:54 +0000 (09:30 -0700)]
e1000: Fix register name in reg_dump sysctl

The correct name of this register is CTRL_EXT.

Approved by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29967

(cherry picked from commit ba7b31b3e967a57c0269330d4e5aacf541d1b479)

3 years agoe1000: Add support for [Tiger, Alder, Meteor] Lake
Kevin Bowling [Mon, 19 Apr 2021 02:11:27 +0000 (19:11 -0700)]
e1000: Add support for [Tiger, Alder, Meteor] Lake

Add support for current and future client platform PCI IDs. These are
all I219 variants and have no known driver changes versus previous
generation client platform I219 variants.

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29801

(cherry picked from commit 59690eab572dde1176886bff7ed0c506df974e5e)

3 years agoconnectat(2): clarify that the s argument is socket
Konstantin Belousov [Wed, 28 Apr 2021 15:47:31 +0000 (18:47 +0300)]
connectat(2): clarify that the s argument is socket

(cherry picked from commit 07f229d20c0cd6285c5ddf1df45eb69bbea4445b)

3 years agoFix mismerge in 00f85e3f264d665b30f0ce2a.
Konstantin Belousov [Sat, 1 May 2021 13:42:27 +0000 (16:42 +0300)]
Fix mismerge in 00f85e3f264d665b30f0ce2a.

nfslock is still needed on stable/12.
This is the direct commit to the stable/12 branch.

Noted by: rmacklem
Sponsored by: The FreeBSD Foundation

3 years agonfs client: depend on xdr
Konstantin Belousov [Tue, 13 Apr 2021 11:47:20 +0000 (14:47 +0300)]
nfs client: depend on xdr

(cherry picked from commit 8cca7b7f28feaf0c5e2dfedb985ae334a4013ef6)

3 years agoStyle.
Konstantin Belousov [Thu, 18 Mar 2021 10:40:20 +0000 (12:40 +0200)]
Style.

(cherry picked from commit 42be0a7b10b14113ba9c4e4a738e8f20e235b736)

3 years agovn_open_vnode(): handle error when fp == NULL
Konstantin Belousov [Mon, 19 Apr 2021 10:25:30 +0000 (13:25 +0300)]
vn_open_vnode(): handle error when fp == NULL

PR: 255119

(cherry picked from commit 54f98c4dbf9b1203a4e3e1b13fd0738441226991)

3 years agoAT_RESOLVE_BENEATH is bsd-specific
Konstantin Belousov [Thu, 11 Mar 2021 15:07:02 +0000 (17:07 +0200)]
AT_RESOLVE_BENEATH is bsd-specific

(cherry picked from commit d51b4b0aac43d9d25f7eb3f17b2d3034a5c851d8)

3 years agob_vflags update requries bufobj lock
Konstantin Belousov [Tue, 13 Apr 2021 10:22:56 +0000 (13:22 +0300)]
b_vflags update requries bufobj lock

(cherry picked from commit e3d675958539eee899d42438f5b46a26f3c64902)

3 years agopseudofs: limit writes to 1M
Konstantin Belousov [Tue, 13 Apr 2021 19:48:44 +0000 (22:48 +0300)]
pseudofs: limit writes to 1M

(cherry picked from commit 5edf7227ec339f651c7328e63df323f6ef10345f)

3 years agoBump pseudofs size limit from 128kB to 1MB.
Edward Tomasz Napierala [Fri, 16 Oct 2020 09:58:10 +0000 (09:58 +0000)]
Bump pseudofs size limit from 128kB to 1MB.

PR: 237883

(cherry picked from commit ce764cbd1c725c54966315949fe93eb3994c1b5e)

3 years agosbuf_uionew(): sbuf_new() takes int as length
Konstantin Belousov [Tue, 13 Apr 2021 19:12:19 +0000 (22:12 +0300)]
sbuf_uionew(): sbuf_new() takes int as length

(cherry picked from commit 116f26f947b8bbf868dcd85d79226406029a45ee)

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

(cherry picked from commit 290b0d123ae2136ad84b268cd1884b1624d1d37f)

3 years agox86: clear %db registers in new process
Konstantin Belousov [Tue, 30 Mar 2021 15:40:02 +0000 (18:40 +0300)]
x86: clear %db registers in new process

(cherry picked from commit 8223717ce62c1ad0becc34ce69fe2d1771f3ba05)

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()

(cherry picked from commit 2f1588474768f61f3a983af207e753bd0340a9e7)

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

(cherry picked from commit d50adfec9ee73e88e8d365525f1acef2c1db798a)

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

(cherry picked from commit 94172affa43af15fe3b50293a96c292eca30c386)

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

(cherry picked from commit a8b75a57c9b2cb3388746f097a55086a0f8c5d38)

3 years agolink(2): correct descriptor name in AT_RESOLVE_BENEATH description
Konstantin Belousov [Tue, 30 Mar 2021 21:56:28 +0000 (00:56 +0300)]
link(2): correct descriptor name in AT_RESOLVE_BENEATH description

(cherry picked from commit c78e124535febc6c0bc7c0756b42d6b845428d2e)

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

(cherry picked from commit a091c353235e0ee97d2531e80d9d64e1648350f4)

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()

(cherry picked from commit 9d7e450b64f1e605c718fba0f357d49541c8147b)

3 years agolinuxkpi: remove erronously committed diff save file
Konstantin Belousov [Tue, 6 Apr 2021 00:42:13 +0000 (03:42 +0300)]
linuxkpi: remove erronously committed diff save file

(cherry picked from commit 5b3b19db7305f8255f021d6f8d94d17ab778660f)

3 years agolinuxkpi: drop single-use variable
Konstantin Belousov [Tue, 30 Mar 2021 08:46:42 +0000 (11:46 +0300)]
linuxkpi: drop single-use variable

(cherry picked from commit 8011fb795baa59ba14371d6db5ab661a5db77615)

3 years agolinuxkpi: avoid counting per-thread use for the embedded linux cdevs
Konstantin Belousov [Tue, 30 Mar 2021 08:45:24 +0000 (11:45 +0300)]
linuxkpi: avoid counting per-thread use for the embedded linux cdevs

(cherry picked from commit f6b108837e7df7d7bfb35ec447f7cb62afa79441)

3 years agolinuxkpi: do not destroy/free embedded linux cdevs
Konstantin Belousov [Tue, 30 Mar 2021 08:44:19 +0000 (11:44 +0300)]
linuxkpi: do not destroy/free embedded linux cdevs

(cherry picked from commit 7f9867f8c65b1b3e590dba4dc432a4bc8cf01f68)

3 years agolinuxkpi: rename cdev to ldev
Konstantin Belousov [Tue, 30 Mar 2021 08:43:21 +0000 (11:43 +0300)]
linuxkpi: rename cdev to ldev

(cherry picked from commit 28b482e2baf43cdd30e8b9bd090e6d9f405cf4b3)

3 years agolinuxkpi: copy ldev into local to test and free the same pointer
Konstantin Belousov [Tue, 30 Mar 2021 08:41:00 +0000 (11:41 +0300)]
linuxkpi: copy ldev into local to test and free the same pointer

(cherry picked from commit 7b0125cbec1579a0a1bf38f7abe583b5f6fd79e7)

3 years agoUPDATING: add an entry for commit 0a1fdb867c72
Rick Macklem [Fri, 30 Apr 2021 23:35:39 +0000 (16:35 -0700)]
UPDATING: add an entry for commit 0a1fdb867c72

3 years agoparam.h: bump __FreeBSD_version to 1202506 for commit 0a1fdb867c72
Rick Macklem [Fri, 30 Apr 2021 23:28:46 +0000 (16:28 -0700)]
param.h: bump __FreeBSD_version to 1202506 for commit 0a1fdb867c72

Commit 0a1fdb867c72 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 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
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
servers when the nfscbd daemon is running.

If doing NFSv4.1 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

(cherry picked from commit 7763814fc9c27a98fefcbf582d7a936ea43af23a)

3 years agoUPDATING: dereference portupgrade(8)
Glen Barber [Fri, 9 Apr 2021 00:26:41 +0000 (20:26 -0400)]
UPDATING: dereference portupgrade(8)

Make the UPDATING file less tool-specific regarding upgrading
third-party software.

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

(cherry picked from commit 6dadf78f115cbdcb17dff8974a2044dd5129f7dc)

3 years agoMerge commit 'bd136720030ebb0b31e6d5a2236b9d0ddac71b94'
Stefan Eßer [Sun, 25 Apr 2021 06:42:31 +0000 (08:42 +0200)]
Merge commit 'bd136720030ebb0b31e6d5a2236b9d0ddac71b94'

usr.bin/bc: update to version 4.0.1

This update adds a flush() of the output buffer to the bc print command.

(cherry picked from commit 8ea9013512494c9f035afa1ffa1e199b44c7904f)

This commit included a change to .gitattributes for an already
checked-in file, which caused an inconsistency in the repository.

This was fixed by Michael Gmelin with a follow-up commit:

Synch index of contrib/bc with what is in workdir after cloning.

From a workdir perspective this should be a no-op.

See also:
https://lists.freebsd.org/pipermail/freebsd-current/2021-April/079569.html

(cherry picked from commit a0358e3d5184950b4316f105eb292cbafdea208b)

3 years agoe1000: Restore VF interface random MAC
Kevin Bowling [Thu, 15 Apr 2021 18:45:02 +0000 (11:45 -0700)]
e1000: Restore VF interface random MAC

Restore 525e07418c77 after the iflib conversion of igb(4). This
reenables random MAC address generation when attaching to a VF with a
zeroed MAC.

PR: 253535
Reported by: Balaev PA <mail@void.so>
Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29785

(cherry picked from commit 68a46f11eadab48a1da9e3d3900569a6a1ce142e)

3 years agolibfetch: Retry with proxy auth when server returns 407
Renato Botelho [Thu, 1 Apr 2021 21:02:57 +0000 (18:02 -0300)]
libfetch: Retry with proxy auth when server returns 407

PR: 220468
Submitted by: Egil Hasting <egil.hasting@higen.org> (based on)
Reviewed by: kevans, kp
Approved by: kp
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29533

(cherry picked from commit 345c30a94f6425954163f1e0b075a75f603d27cd)

3 years agoA few more cases where strcasecmp() is no longer required.
Dag-Erling Smørgrav [Tue, 27 Nov 2018 11:22:19 +0000 (11:22 +0000)]
A few more cases where strcasecmp() is no longer required.

MFC after: 1 week
Approved by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit ceedec4bce2161062ffcacf7f07e364c8cfe09bc)

3 years agoImprove URL parsing. In particular, convert scheme and host to lowercase.
Dag-Erling Smørgrav [Tue, 27 Nov 2018 10:45:14 +0000 (10:45 +0000)]
Improve URL parsing.  In particular, convert scheme and host to lowercase.

MFC after: 1 week
Approved by:▸   kp
Sponsored by:▸  Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 8d9de5b10a24bd2d79ed99f139c0ac28c09b15ca)

3 years agoSupport proxying FTP over HTTPS, not just HTTP.
Dag-Erling Smørgrav [Tue, 27 Nov 2018 10:06:41 +0000 (10:06 +0000)]
Support proxying FTP over HTTPS, not just HTTP.

There is probably a PR for this, but I can't find this, or remember who
submitted it.  The patch got lost in the noise of another that wasn't
ready to commit.

MFC after: 3 days
Approved by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit b68815f0886031fcccb426b85484b18a282d1b8c)

3 years agopf tests: Test cases for the 'kill state(s)' feature
Kristof Provost [Fri, 16 Apr 2021 15:33:17 +0000 (17:33 +0200)]
pf tests: Test cases for the 'kill state(s)' feature

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

(cherry picked from commit 065b5c7fb26eb4239e9bd513dde5a55ef78e45c4)

3 years agopf: Refactor state killing
Kristof Provost [Fri, 16 Apr 2021 14:34:21 +0000 (16:34 +0200)]
pf: Refactor state killing

Extract the state killing code from pfioctl() and rephrase the filtering
conditions for readability.

No functional change intended.

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

(cherry picked from commit 586aab9e0aa6c811758c19fb03831fc1e7305252)

3 years agoipfw: do not use sleepable malloc in callout context.
Andrey V. Elsukov [Fri, 16 Apr 2021 07:22:44 +0000 (10:22 +0300)]
ipfw: do not use sleepable malloc in callout context.

Use M_NOWAIT flag when hash growing is called from callout.

PR:             255041
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D29772

(cherry picked from commit 9bacbf1ae243de43d642c3ac0b7318ae0e5c5235)

3 years agolibkiconv: address memory leak in not-found cases
Ed Maste [Wed, 21 Apr 2021 17:45:27 +0000 (13:45 -0400)]
libkiconv: address memory leak in not-found cases

Found in "Understanding and Detecting Disordered Error Handling with
Precise Function Pairing" by Qiushi Wu et al.

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

(cherry picked from commit 3cfd08c1c74058451a02bac35307bf7fa509c617)

3 years agoaesni: Avoid modifying session keys in hmac_update()
Mark Johnston [Tue, 27 Apr 2021 00:04:25 +0000 (20:04 -0400)]
aesni: Avoid modifying session keys in hmac_update()

Otherwise aesni_process() is not thread-safe for AES+SHA-HMAC
transforms, since hmac_update() updates the caller-supplied key directly
to create the derived key.  Use a buffer on the stack to store a copy of
the key used for computing inner and outer digests.

This is a direct commit to stable/12 as the bug is not present in later
branches.

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

3 years agowlanstats: fix build
Sofian Brabez [Tue, 20 Apr 2021 18:31:48 +0000 (18:31 +0000)]
wlanstats: fix build

Add -Wno-cast-align to the CFLAGS to fix the build of wlanstats

Approved by: adrian
MFC after: 1 week

(cherry picked from commit b8be8094958a01255f5430bd6a36ff936bdd53c3)

3 years agoiwnstats: fix build with clang and allow install under /usr/local/sbin
Sofian Brabez [Tue, 20 Apr 2021 17:58:46 +0000 (17:58 +0000)]
iwnstats: fix build with clang and allow install under /usr/local/sbin

iwnstats was not compiling because of some issues raised by the clang
compiler due to -Werror. As a tool it is not connected to world build.

Add missing field "barker_mrc" initialization in struct
iwn_sensitivity_limits for -Wmissing-field-initializers, remove unused
pointer *is on iwn_stats_*_print functions and unused variables for
-Wunused-parameter and -Wunused-variable.

The value for field "barker_mrc" of struct iwn2030_sensitivity_limits
was obtained from linux 3.2 wireless/iwlwifi driver code (iwl-2000.c:115
.barker_corr_th_min_mrc = 390).

Also set BINDIR in Makefile to make it possible to install under
/usr/local/sbin/iwnstats as it require super user.

Reviewed by: adrian
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29800

(cherry picked from commit 561d34d70596b455c6a513431f8ad007076f90c5)

3 years agoFix race in case of device destruction.
Alexander Motin [Tue, 13 Apr 2021 15:19:10 +0000 (11:19 -0400)]
Fix race in case of device destruction.

During device destruction it is possible that open() succeed, but
fdevname() return NULL, that can't be assigned to string variable.
Fix that by adding explicit NULL check.

Also while there switch from fdevname() to fdevname_r().

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

(cherry picked from commit e49d3eb40324eaffaa13b93f2c4173dfa04dfa34)

3 years agoFix zgrep --version
Mateusz Piotrowski [Tue, 13 Apr 2021 10:12:53 +0000 (12:12 +0200)]
Fix zgrep --version

"zgrep --version" is expected to print the version information in the
same way as "zgrep -V". However, the case handling the --version flag
is never reached, so "zgrep --version" prints:
    zgrep: missing pattern
instead of:
    grep (BSD grep, GNU compatible) 2.6.0-FreeBSD

Reviewed by: yuripv
Approved by: yuripv (src)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29813

(cherry picked from commit 16e0391f8e2124eb85af984204548cf841648db5)

3 years agoixgbe: Clarify index name in ixgbe_mc_filter_apply
Kevin Bowling [Sat, 17 Apr 2021 01:17:43 +0000 (18:17 -0700)]
ixgbe: Clarify index name in ixgbe_mc_filter_apply

"It looks like it would be less confusing to rename 'count' to
something like 'idx', since that's what it's used for in this
function."

Reviewed by: erj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29798

(cherry picked from commit 21afed4b1d18578aa8c9fa31e9e677971f8b4300)

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.

PR: 254816

(cherry picked from commit 22cefe3d8378f58adcdbb2c7589b9f30c2a38315)

3 years agompt(4): Remove incorrect S/G segments limits.
Alexander Motin [Sat, 17 Apr 2021 14:41:35 +0000 (10:41 -0400)]
mpt(4): Remove incorrect S/G segments limits.

First, two of those four checks are unreachable.
Second, I don't believe there should be ">=" instead of ">".
Third, bus_dma(9) already returns the same EFBIG if ">".

This fixes false I/O errors in worst S/G cases with maxphys >= 2MB.

MFC after: 1 week

(cherry picked from commit 0f29396e493bd87ffa6a63fcb602b12e79d21a1e)

3 years agoFix leak in libc NFSv4 ACL flags parsing
Andrew Walker [Tue, 20 Apr 2021 19:34:44 +0000 (15:34 -0400)]
Fix leak in libc NFSv4 ACL flags parsing

Free memory allocated by strdup() in parse_flags_verbose().

Submitted by: Andrew Walker <walker.aj325_gmail.com>
Reported by: valgrind
Reviewed by: allanjude, freqlabs, rpokala
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D29871

(cherry picked from commit dd559118ab3f065ae230b324c3fe4bb1c9b7ca56)

3 years agopms(4): Limit maximum I/O size to 256KB instead of 1MB.
Alexander Motin [Fri, 16 Apr 2021 19:39:01 +0000 (15:39 -0400)]
pms(4): Limit maximum I/O size to 256KB instead of 1MB.

There is a weird limit of AGTIAPI_MAX_DMA_SEGS (128) S/G segments per
I/O since the initial driver import.  I don't know why it was added,
can only guess some hardware limitation, but in worst case it means
maximum I/O size of 508KB.  Respect it to be safe, rounding to 256KB.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

(cherry picked from commit 3e347834200b5d91a33384e696793e4ac20a44d4)

3 years agopms(4): Do not return CAM_REQ_CMP on errors.
Alexander Motin [Fri, 16 Apr 2021 19:16:09 +0000 (15:16 -0400)]
pms(4): Do not return CAM_REQ_CMP on errors.

It is a direct request for data corruptions, one report of which we
have received.  I am very surprised that only one.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

(cherry picked from commit 8434a65ce49bd6bc6779f0e57b0ce0f4bc46f48e)

3 years agoRevert "stats.7: Add dwatch(1) to the list"
Fernando Apesteguía [Thu, 22 Apr 2021 17:55:01 +0000 (19:55 +0200)]
Revert "stats.7: Add dwatch(1) to the list"

As gbe@ notes, the stats(7) framework is not present in stable/12

This reverts commit 76b02b5cea1dc548d30b2ec5e95ce5a27deb16e3.

3 years agostats.7: Add dwatch(1) to the list
Fernando Apesteguía [Thu, 22 Apr 2021 13:54:45 +0000 (15:54 +0200)]
stats.7: Add dwatch(1) to the list

PR: 255303
Approved by: 0mp (mentor)
Differential Revision: https://reviews.freebsd.org/D29924

(cherry picked from commit 2e5929a75634504d388cc04d24e6a558840e18cb)

3 years agonfsd: fix replies from session cache for retried RPCs
Rick Macklem [Thu, 8 Apr 2021 21:04:22 +0000 (14:04 -0700)]
nfsd: fix replies from session cache for retried RPCs

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.

The FreeBSD server failec to reply using the cached
reply in the session slot when an RPC was retried on
the session slot, as indicated by same slot sequence#.

This patch fixes this.  It should also fix a similar
failure for NFSv4.0 mounts, when the sequence# in
the open/lock_owner requires a reply be done from
an entry locked into the DRC.

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

(cherry picked from commit 05a39c2c1c18cd0c4382a4f58e0952d3f77e7dfa)

3 years agoImprove size readability.
Michael Reifenberger [Mon, 15 Feb 2021 19:23:32 +0000 (20:23 +0100)]
Improve size readability.
Preserve more space for swap devise names.
Prevent line overflow with long devise name.
Don't draw a bar when swap is not used at all.
Simplify and optimize code.
Change the label to end at end of 100%.
PR: 251655
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27496

(cherry picked from commit 8d06c3e7a40831ac139d83b85b282206229b426f)

3 years agosafexcel: Fix the SHA-HMAC digest computation when AAD is present
Mark Johnston [Wed, 21 Apr 2021 18:50:48 +0000 (14:50 -0400)]
safexcel: Fix the SHA-HMAC digest computation when AAD is present

The driver would fail to include the AAD in the input stream, resulting
in incorrect digests for requests combining SHA-HMAC with AES-CBC or
-CTR.  Ensure that the AAD is included in the processor's input stream,
and fix the corresponding instruction sequence to include the AAD as
input to the digest computation.

This is a direct commit to stable/12 since the bug was introduced while
merging there and is not present in later branches.

3 years agospigen.4: Fix typos
Mateusz Piotrowski [Sun, 18 Apr 2021 07:45:18 +0000 (09:45 +0200)]
spigen.4: Fix typos

MFC after: 3 days

(cherry picked from commit 40277af7f23405c276edf02c3ddc8e770a06e3f6)