]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoRevert "Vendor import of Gavin D. Howard's bc version 4.0.2"
Stefan Eßer [Wed, 12 May 2021 05:22:37 +0000 (07:22 +0200)]
Revert "Vendor import of Gavin D. Howard's bc version 4.0.2"

The update had been performed on a check-out of the vendor branch,
but the final push lacked the target designation vendor/bc.

3 years agoVendor import of Gavin D. Howard's bc version 4.0.2
Stefan Eßer [Wed, 12 May 2021 05:15:24 +0000 (07:15 +0200)]
Vendor import of Gavin D. Howard's bc version 4.0.2

3 years agoAdd support for adding default routes for other FIBs
Andrew Fengler [Wed, 12 May 2021 01:59:10 +0000 (01:59 +0000)]
Add support for adding default routes for other FIBs

Make rc.d/routing read defaultrouter_fibN and ipv6_defaultrouter_fibN, and
set it as the default gateway for FIB N, where N is from 1 to (net.fibs - 1)
This allows adding gateways for multiple FIBs in the same format as the main
gateway. (FIB 0)

Reviewed by: olivier, rgrimes, bcr (man page)
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D22706

3 years agolibvmm: explicitly save and restore errno in vm_open()
Robert Wing [Thu, 11 Mar 2021 19:27:43 +0000 (10:27 -0900)]
libvmm: explicitly save and restore errno in vm_open()

In commit 6bb140e3ca895a14, vm_destroy() was replaced with free() to
preserve errno. However, it's possible that free() may change the errno
as well. Keep the free() call, but explicitly save and restore errno.

Noted by: jhb
Fixes: 6bb140e3ca895a14
3 years agoSixteen bit I2c addresses are always little endian.
Poul-Henning Kamp [Tue, 11 May 2021 23:07:06 +0000 (23:07 +0000)]
Sixteen bit I2c addresses are always little endian.

3 years agoPolish source to WARNS=6
Poul-Henning Kamp [Tue, 11 May 2021 22:59:23 +0000 (22:59 +0000)]
Polish source to WARNS=6

3 years agoRemove a write-only variable.
John Baldwin [Tue, 11 May 2021 21:56:23 +0000 (14:56 -0700)]
Remove a write-only variable.

While refactoring an earlier series of changes during review, the
'saved_data' variable stopped being used at the bottom of if_ioctl().

Suggested by: brooks
Reviewed by: brooks, imp, kib
Fixes: d17e0940f79f Rework compat shims in ifioctl().
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D30197

3 years agoEnsure that files with no allocated blocks are trimmed to zero length.
Kirk McKusick [Tue, 11 May 2021 21:51:06 +0000 (14:51 -0700)]
Ensure that files with no allocated blocks are trimmed to zero length.

UFS does not allow files to end with a hole; it requires that the
last block of a file be allocated. As fsck_ffs(8) initially scans
each allocated inode, it tracks the last allocated block in the
inode. It then checks that the inode's size falls in the last
allocated block. If the last allocated block falls before the size,
a `file size beyond end of allocated file' warning is issued and
the file is shortened to reference the last allocated block (to avoid
having it reference a hole at its end). If the last allocated block
falls after the size, a `partially truncated file' warning is issued
and all blocks following the block referenced by the size are freed.

Because of an incorrect unsigned comparison, this test was failing
to handle files with no allocated blocks but non-zero size (which
should have had their size reset to zero). Once that was fixed the
test started incorrectly complaining about short symbolic links
that place the link path in the inode rather than in a disk block.
Because these symbolic links have a non-zero size, but no allocated
blocks, fsck_ffs wanted to zero out their size. This patch has to
detect and avoid changing the size of such symbolic links.

Reported by:  Chuck Silvers
Tested by:    Chuck Silvers
MFC after:    1 week
Sponsored by: Netflix

3 years agocryptodev: Fix some input validation bugs
Mark Johnston [Tue, 11 May 2021 21:36:12 +0000 (17:36 -0400)]
cryptodev: Fix some input validation bugs

- When we do not have a separate IV, make sure that the IV length
  specified by the session is not larger than the payload size.
- Disallow AEAD requests without a separate IV.  crp_sanity() asserts
  that CRYPTO_F_IV_SEPARATE is set for AEAD requests, and some (but not
  all) drivers require it.
- Return EINVAL for AEAD requests if an IV is specified but the
  transform does not expect one.

Reported by: syzbot+c9e8f6ff5cb7fa6a1250@syzkaller.appspotmail.com
Reported by: syzbot+007341439ae295cee74f@syzkaller.appspotmail.com
Reported by: syzbot+46e0cc42a428b3b0a40d@syzkaller.appspotmail.com
Reported by: syzbot+2c4d670173b8bdb947df@syzkaller.appspotmail.com
Reported by: syzbot+220faa5eeb4d47b23877@syzkaller.appspotmail.com
Reported by: syzbot+e83434b40f05843722f7@syzkaller.appspotmail.com
Reviewed by: jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30154

3 years agoImplement cdev_device_add() and cdev_device_del() in the LinuxKPI.
Hans Petter Selasky [Tue, 11 May 2021 18:51:59 +0000 (20:51 +0200)]
Implement cdev_device_add() and cdev_device_del() in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agocdev_del() should only put it's kernel object in the LinuxKPI.
Hans Petter Selasky [Tue, 11 May 2021 18:51:35 +0000 (20:51 +0200)]
cdev_del() should only put it's kernel object in the LinuxKPI.

The destructor takes care of the rest.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoImplement read-only VM_SHARED flag in the LinuxKPI.
Hans Petter Selasky [Tue, 11 May 2021 18:49:13 +0000 (20:49 +0200)]
Implement read-only VM_SHARED flag in the LinuxKPI.

For use by mmap(2) callbacks.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoipfw.8: Fix table example
Lutz Donnerhacke [Mon, 10 May 2021 18:31:52 +0000 (20:31 +0200)]
ipfw.8: Fix table example

Fix some erronous lines in the example section.

PR: 248943
Submitted by: Jose Luis Duran
MFC after: 2 weeks
Reviewers: ae, manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D30191

3 years agonetinet6 tests: Fix Python warning
Kristof Provost [Tue, 11 May 2021 13:47:45 +0000 (15:47 +0200)]
netinet6 tests: Fix Python warning

Python 3.8 warns about line 112:
    'SyntaxWarning: "is" with a literal. Did you mean "=="?'

Use '==' as Python suggests.

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

3 years agoxen/blkback: fix reconnection of backend
Roger Pau Monné [Tue, 11 May 2021 10:19:29 +0000 (12:19 +0200)]
xen/blkback: fix reconnection of backend

The hotplug script will be executed only once for each backend,
regardless of the frontend triggering reconnections. Fix blkback to
deal with the hotplug script being executed only once, so that
reconnections don't stall waiting for a hotplug script execution
that will never happen.

As a result of the fix move the initialization of dev_mode, dev_type
and dev_name to the watch callback, as they should be set only once
the first time the backend connects.

This fix is specially relevant for guests wanting to use UEFI OVMF
firmware, because OVMF will use Xen PV block devices and disconnect
afterwards, thus allowing them to be used by the guest OS. Without
this change the guest OS will stall waiting for the block backed to
attach.

Fixes: de0bad00010c ('blkback: add support for hotplug scripts')
MFC after: 1 week
Sponsored by: Citrix Systems R&D

3 years agotcp: In rack, we must only convert restored rtt when the hostcache does restore them.
Randall Stewart [Tue, 11 May 2021 12:15:05 +0000 (08:15 -0400)]
tcp: In rack, we must only convert restored rtt when the hostcache does restore them.

Rack now after the previous commit is very careful to translate any
value in the hostcache for srtt/rttvar into its proper format. However
there is a snafu here in that if tp->srtt is 0 is the only time that
the HC will actually restore the srtt. We need to then only convert
the srtt restored when it is actually restored. We do this by making
sure it was zero before the call to cc_conn_init and it is non-zero
afterwards.

Reviewed by: Michael Tuexen
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30213

3 years agomrouter: do not loopback packets unconditionally
Wojciech Macek [Fri, 23 Apr 2021 06:49:27 +0000 (08:49 +0200)]
mrouter: do not loopback packets unconditionally

Looping back router multicast traffic signifficantly
stresses network stack. Add possibility to disable or enable
loopbacked based on sysctl value.

Reported by:    Daniel Deville
Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D29947

3 years agomroute: fix race condition during mrouter shutting down
Wojciech Macek [Fri, 23 Apr 2021 03:57:03 +0000 (05:57 +0200)]
mroute: fix race condition during mrouter shutting down

    There is a race condition between V_ip_mrouter de-init
    and ip_mforward handling. It might happen that mrouted
    is cleaned up after V_ip_mrouter check and before
    processing packet in ip_mforward.
    Use epoch call aproach, similar to IPSec which also handles
    such case.

Reported by:    Damien Deville
Obtained from: Stormshield
Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D29946

3 years agotruss: Add missing underscore to compat_prefix for FreeBSD32
Alex Richardson [Tue, 11 May 2021 09:52:56 +0000 (10:52 +0100)]
truss: Add missing underscore to compat_prefix for FreeBSD32

I accidentally dropped this in the final version of D27625, so it didn't
actually work as intended. I found this while testing the MFC to stable/13.

MFC after: immediately
Fixes: 7daca4e2043f ("truss: improved support for decoding compat32 arguments")

3 years agosbin/ipfw: Allow tablearg as hostname
Lutz Donnerhacke [Tue, 11 May 2021 08:22:16 +0000 (10:22 +0200)]
sbin/ipfw: Allow tablearg as hostname

Hostnames starting with "tablearg" are considered as a functional
argument instead of a literal.

Reported by: ae
Reviewers: ae
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30208

3 years agoClean up copyright messages.
Kirk McKusick [Tue, 11 May 2021 06:01:58 +0000 (23:01 -0700)]
Clean up copyright messages.

Reported by:  Yoshihiro Ota
MFC after:    3 days
Differential Revision: https://reviews.freebsd.org/D29354

3 years agocache: fix lockless absolute symlink traversal to non-fp mounts
Mateusz Guzik [Tue, 11 May 2021 03:48:08 +0000 (05:48 +0200)]
cache: fix lockless absolute symlink traversal to non-fp mounts

Said lookups would incorrectly fail with EOPNOTSUP.

Reported by: kib

3 years agopowerpc/radix pmap: Convert stat counters from ulongs to counters
Justin Hibbits [Tue, 11 May 2021 02:23:14 +0000 (21:23 -0500)]
powerpc/radix pmap: Convert stat counters from ulongs to counters

This should help performance a hair, for concurrent stat updates, by
reducing contention on cache lines.

3 years agopowerpc/mmu: Actually use the Radix pmap_align_superpage function
Justin Hibbits [Tue, 11 May 2021 02:23:04 +0000 (21:23 -0500)]
powerpc/mmu: Actually use the Radix pmap_align_superpage function

This was missed in the conversion to ifuncs.  It might help improve
promotion rates.

3 years agonfscl: Delete unneeded redundant MODULE_DEPEND() calls
Rick Macklem [Tue, 11 May 2021 00:34:29 +0000 (17:34 -0700)]
nfscl: Delete unneeded redundant MODULE_DEPEND() calls

There are two module declarations in the nfscl.ko module for "nfscl"
and "nfs".  Both of these declarations had MODULE_DEPEND() calls.
This patch deletes the MODULE_DEPEND() calls for "nfs" to avoid
confusion with respect to what modules this module is dependent upon.

The patch also adds comments explaining why there are two module
declarations within the module.

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

3 years agovfs: Fix error handling in vn_fullpath_hardlink()
Mark Johnston [Tue, 11 May 2021 00:18:00 +0000 (20:18 -0400)]
vfs: Fix error handling in vn_fullpath_hardlink()

vn_fullpath_any_smr() will return a positive error number if the
caller-supplied buffer isn't big enough.  In this case the error must be
propagated up, otherwise we may copy out uninitialized bytes.

Reported by: syzkaller+KMSAN
Reviewed by: mjg, kib
MFC aftr: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30198

3 years agortld: preserve the 'seen' state of the dlerror message in errmsg_save()
Konstantin Belousov [Mon, 10 May 2021 19:02:19 +0000 (22:02 +0300)]
rtld: preserve the 'seen' state of the dlerror message in errmsg_save()

rtld preserves its current error message around calls to user init/fini
lists, to not override original error with potential secondary errors
caused by user code recursing into rtld.  After 4d9128da54f8f8e2a29190,
the preservation of the string itself is not enough, the 'seen'
indicator must be preserved as well.  Otherwise, since new code does not
clear string (it cannot), call to _rtld_error() from errmsg_restore()
revived whatever message was consumed last.

Change errmsg_save() to return structure recording both 'seen' indicator
and the message, if any.

PR: 255698
Reported by: Eugene M. Kim <astralblue@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoopenat(2): add O_EMPTY_PATH
Konstantin Belousov [Thu, 6 May 2021 17:16:53 +0000 (20:16 +0300)]
openat(2): add O_EMPTY_PATH

It reopens the passed file descriptor, checking the file backing vnode'
current access rights against open mode. In particular, this flag allows
to convert file descriptor opened with O_PATH, into operable file
descriptor, assuming permissions allow that.

Reviewed by: markj
Tested by: Andrew Walker <awalker@ixsystems.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30148

3 years agonetstat: fix typo from 0471a8c73402
Richard Scheffenegger [Mon, 10 May 2021 18:49:19 +0000 (20:49 +0200)]
netstat: fix typo from 0471a8c73402

3 years agotcp: SACK Lost Retransmission Detection (LRD)
Richard Scheffenegger [Mon, 10 May 2021 16:47:47 +0000 (18:47 +0200)]
tcp: SACK Lost Retransmission Detection (LRD)

Recover from excessive losses without reverting to a
retransmission timeout (RTO). Disabled by default, enable
with sysctl net.inet.tcp.do_lrd=1

Reviewed By: #transport, rrs, tuexen, #manpages
Sponsored by: Netapp, Inc.
Differential Revision: https://reviews.freebsd.org/D28931

3 years agosh: implement persistent history storage
Baptiste Daroussin [Tue, 30 Mar 2021 08:28:08 +0000 (10:28 +0200)]
sh: implement persistent history storage

Implement persistent history storage:
the strategy is simple at start: loads the existing .sh_history file
at exit dump it.

The implementation respects the HISTFILE variable and its POSIX
definition: ~/.sh_history is used if HISTFILE is not set.

to avoid sh to create the history file, set HISTSIZE to 0 or HISTFILE to
en empty value

Co-authored-by: pstef
Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D29493

3 years agotcp:Host cache and rack ending up with incorrect values.
Randall Stewart [Mon, 10 May 2021 15:25:51 +0000 (11:25 -0400)]
tcp:Host cache and rack ending up with incorrect values.

The hostcache up to now as been updated in the discard callback
but without checking if we are all done (the race where there are
more than one calls and the counter has not yet reached zero). This
means that when the race occurs, we end up calling the hc_upate
more than once. Also alternate stacks can keep there srtt/rttvar
in different formats (example rack keeps its values in microseconds).
Since we call the hc_update *before* the stack fini() then the
values will be in the wrong format.

Rack on the other hand, needs to convert items pulled from the
hostcache into its internal format else it may end up with
very much incorrect values from the hostcache. In the process
lets commonize the update mechanism for srtt/rttvar since we
now have more than one place that needs to call it.

Reviewed by: Michael Tuexen
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30172

3 years agoin6_mcast: Return EADDRINUSE when we've already joined the group
Kristof Provost [Tue, 4 May 2021 17:23:15 +0000 (19:23 +0200)]
in6_mcast: Return EADDRINUSE when we've already joined the group

Distinguish between truly invalid requests and those that fail because
we've already joined the group. Both cases fail, but differentiating
them allows userspace to make more informed decisions about what the
error means.

For example. radvd tries to join the all-routers group on every SIGHUP.
This fails, because it's already joined it, but this failure should be
ignored (rather than treated as a sign that the interface's multicast is
broken).

This puts us in line with OpenBSD, NetBSD and Linux.

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

3 years agoRevert "getty: push assignment to inner block."
Xin LI [Sun, 9 May 2021 16:05:52 +0000 (09:05 -0700)]
Revert "getty: push assignment to inner block."

This reverts commit c7b8bc367f18210d233b0e2185b5ce0d55c9ccaa.

Pointed out by: trasz

3 years agofull(4): Use correct section name for AUTHORS
Gordon Bergling [Sun, 9 May 2021 15:31:52 +0000 (17:31 +0200)]
full(4): Use correct section name for AUTHORS

PR: 255715
Reported by: Christos Margiolis <christos at christosmarg dot xyz>
MFC after: 3 days

3 years agorpi_ft5406: Recognize raspberrypi,firmware-ts touchscreen
Juraj Lutter [Fri, 7 May 2021 21:48:21 +0000 (23:48 +0200)]
rpi_ft5406: Recognize raspberrypi,firmware-ts touchscreen

- Recognize raspberrypi,firmware-ts touchscreen
- Move the driver from ofwbus to simplebus

Reviewed by: manu
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30169

3 years agogetty: push assignment to inner block.
Xin LI [Sun, 9 May 2021 04:53:58 +0000 (21:53 -0700)]
getty: push assignment to inner block.

No functional change.

MFC after: 2 weeks

3 years agogetty: const'ify search pointer.
Xin LI [Sun, 9 May 2021 04:52:41 +0000 (21:52 -0700)]
getty: const'ify search pointer.

No functional change.

MFC after: 2 weeks

3 years agosbin/ipfw: Fix parsing error in table based forward
Lutz Donnerhacke [Fri, 7 May 2021 18:59:34 +0000 (20:59 +0200)]
sbin/ipfw: Fix parsing error in table based forward

The argument parser does not recognise the optional port for an
"tablearg" argument.  Fix simplifies the code by make the internal
representation expicit for the parser.

PR: 252744
MFC: 1 week
Reported by: <bugs.freebsd.org@mx.zzux.com>
Approved by: nc
Tested by: <bugs.freebsd.org@mx.zzux.com>
Differential Revision: https://reviews.freebsd.org/D30164

3 years agoofw: support for a single 'port' DTS property.
Ruslan Bukin [Sat, 8 May 2021 14:41:57 +0000 (15:41 +0100)]
ofw: support for a single 'port' DTS property.

On rk3399 the VOP-little node has a single 'port' property (not a
collection of 'ports' or indexed ports).

Reviewed by: manu
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D30165

3 years agostress2: Added two new syzkaller reproducers. Update the exclude list
Peter Holm [Sat, 8 May 2021 06:24:42 +0000 (08:24 +0200)]
stress2: Added two new syzkaller reproducers. Update the exclude list

3 years agoMake encode/decode extra time functions inline.
Fedor Uporov [Sat, 8 May 2021 03:42:20 +0000 (06:42 +0300)]
Make encode/decode extra time functions inline.

Mentioned by:   pfg
MFC after:      2 weeks

3 years agonfscl: Add support for va_birthtime to NFSv4
Rick Macklem [Sat, 8 May 2021 00:30:56 +0000 (17:30 -0700)]
nfscl: Add support for va_birthtime to NFSv4

There is a NFSv4 file attribute called TimeCreate
that can be used for va_birthtime.
r362175 added some support for use of TimeCreate.
This patch completes support of va_birthtime by adding
support for setting this attribute to the server.
It also eanbles the client to
acquire and set the attribute for a NFSv4
server that supports the attribute.

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

3 years agoThis takes Warners suggested approach to making it so that
Randall Stewart [Fri, 7 May 2021 21:32:32 +0000 (17:32 -0400)]
This takes Warners suggested approach to making it so that
platforms that for whatever reason cannot include the RATELIMIT option
can still work with rack. It adds two dummy functions that rack will
call and find out that the highest hw supported b/w is 0 (which
kinda makes sense and rack is already prepared to handle).

Reviewed by: Michael Tuexen, Warner Losh
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30163

3 years agoFix panic when trying to delete non-existent gateway in multipath route.
Alexander V. Chernikov [Fri, 7 May 2021 20:36:50 +0000 (20:36 +0000)]
Fix panic when trying to delete non-existent gateway in multipath route.

IF non-existend gateway was specified, the code responsible for calculating
 an updated nexthop group, returned the same already-used nexthop group.
After the route table update, the operation result contained the same
 old & new nexthop groups. Thus, the code responsible for decomposing
 the notification to the list of simple nexthop-level notifications,
 was not able to find any differences. As a result, it hasn't updated any
  of the "simple" notification fields, resulting in empty rtentry pointer.
This empty pointer was the direct reason of a panic.

Fix the problem by returning ESRCH when the new nexthop group is the same
 as the old one after applying gateway filter.

Reported by: Michael <michael.adm at gmail.com>
PR: 255665
MFC after: 3 days

3 years agopf tests: Test killing matching states
Kristof Provost [Mon, 3 May 2021 13:31:03 +0000 (15:31 +0200)]
pf tests: Test killing matching states

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

3 years agopf: Support killing 'matching' states
Kristof Provost [Mon, 3 May 2021 13:35:50 +0000 (15:35 +0200)]
pf: Support killing 'matching' states

Optionally also kill states that match (i.e. are the NATed state or
opposite direction state entry for) the state we're killing.

See also https://redmine.pfsense.org/issues/8555

Submitted by: Steven Brown
Reviewed by: bcr (man page)
Obtained from: https://github.com/pfsense/FreeBSD-src/pull/11/
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30092

3 years agopf tests: Test killing states by gateway
Kristof Provost [Fri, 30 Apr 2021 15:07:23 +0000 (17:07 +0200)]
pf tests: Test killing states by gateway

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

3 years agopf: Allow states to by killed per 'gateway'
Kristof Provost [Fri, 30 Apr 2021 13:15:05 +0000 (15:15 +0200)]
pf: Allow states to by killed per 'gateway'

This allows us to kill states created from a rule with route-to/reply-to
set.  This is particularly useful in multi-wan setups, where one of the
WAN links goes down.

Submitted by: Steven Brown
Obtained from: https://github.com/pfsense/FreeBSD-src/pull/11/
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30058

3 years agoauthpf: Start using libpfctl
Kristof Provost [Fri, 30 Apr 2021 08:26:52 +0000 (10:26 +0200)]
authpf: Start using libpfctl

Use pfctl_kill_states() rather than the DIOCKILLSTATES ioctl directly.

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

3 years agopfctl: Start using DIOCKILLSTATESNV
Kristof Provost [Thu, 29 Apr 2021 19:24:56 +0000 (21:24 +0200)]
pfctl: Start using DIOCKILLSTATESNV

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

3 years agopf: Introduce DIOCKILLSTATESNV
Kristof Provost [Thu, 29 Apr 2021 15:20:36 +0000 (17:20 +0200)]
pf: Introduce DIOCKILLSTATESNV

Introduce an nvlist based alternative to DIOCKILLSTATES.

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

3 years agopfctl: Start using DIOCCLRSTATESNV
Kristof Provost [Thu, 29 Apr 2021 13:10:50 +0000 (15:10 +0200)]
pfctl: Start using DIOCCLRSTATESNV

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

3 years agopf: Introduce DIOCCLRSTATESNV
Kristof Provost [Thu, 29 Apr 2021 09:07:02 +0000 (11:07 +0200)]
pf: Introduce DIOCCLRSTATESNV

Introduce an nvlist variant of DIOCCLRSTATES.

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

3 years agopfctl: Optionally show gateway information for states
Kristof Provost [Wed, 28 Apr 2021 16:17:40 +0000 (18:17 +0200)]
pfctl: Optionally show gateway information for states

When showing the states, in very verbose mode, also display the gateway
(i.e. the target for route-to/reply-to).

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

3 years agoReleases history update
Maxim Konovalov [Fri, 7 May 2021 19:50:10 +0000 (19:50 +0000)]
Releases history update

Add DragonFly 5.8.1, OpenBSD 6.7, FreeBSD 11.4, DragonFly 5.8.2,
DragonFly 5.8.3, OpenBSD 6.8, NetBSD 9.1, FreeBSD 13.0, OpenBSD 6.9.

3 years agodivert: Fix mbuf ownership confusion in div_output()
Mark Johnston [Fri, 7 May 2021 18:27:58 +0000 (14:27 -0400)]
divert: Fix mbuf ownership confusion in div_output()

div_output_outbound() and div_output_inbound() relied on the caller to
free the mbuf if an error occurred.  However, this is contrary to the
semantics of their callees, ip_output(), ip6_output() and
netisr_queue_src(), which always consume the mbuf.  So, if one of these
functions returned an error, that would get propagated up to
div_output(), resulting in a double free.

Fix the problem by making div_output_outbound() and div_output_inbound()
responsible for freeing the mbuf in all cases.

Reported by: Michael Schmiedgen <schmiedgen@gmx.net>
Tested by: Michael Schmiedgen
Reviewed by: donner
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30129

3 years agostack(9): Disable KASAN in stack_capture()
Mark Johnston [Fri, 7 May 2021 18:20:53 +0000 (14:20 -0400)]
stack(9): Disable KASAN in stack_capture()

When unwinding the stack, we may encounter a stack frame in a poisoned
region of the stack, triggering a false positive.

Reviewed by: andrew, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30126

3 years agocdefs: Make __nosanitizeaddress work for KASAN as well
Mark Johnston [Fri, 7 May 2021 18:26:28 +0000 (14:26 -0400)]
cdefs: Make __nosanitizeaddress work for KASAN as well

Add __nosanitizememory while I'm here.

Reviewed by: andrew, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30126

3 years agolinker_set: Disable ASAN only in userspace
Mark Johnston [Fri, 7 May 2021 18:24:37 +0000 (14:24 -0400)]
linker_set: Disable ASAN only in userspace

KASAN does not insert redzones around global variables and so is not
susceptible to the problem that led to us disabling ASAN for linker set
elements in the first place (see commit fe3d8086fb6f).

Reviewed by: andrew, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30126

3 years agodevd.conf: Remove support for coldsync
Ceri Davies [Fri, 7 May 2021 18:19:34 +0000 (14:19 -0400)]
devd.conf: Remove support for coldsync

The coldsync port was removed in 2012.  The last stable release of
coldsync was issued in 2002.  Let's get rid of it.

PR: 255051
Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30100

3 years agodevd.conf: Typo
Ceri Davies [Fri, 7 May 2021 18:31:02 +0000 (14:31 -0400)]
devd.conf: Typo

PR: 255051
MFC after: 3 days

3 years agoFix a UDP tunneling issue with rack. Basically there are two
Randall Stewart [Fri, 7 May 2021 18:06:43 +0000 (14:06 -0400)]
Fix a UDP tunneling issue with rack. Basically there are two
issues.
A) Not enough hdrlen was being calculated when a UDP tunnel is
   in place.
and
B) Not enough memory is allocated in racks fsb. We need to
   overbook the fsb to include a udphdr just in case.

Submitted by: Peter Lei
Reviewed by: Michael Tuexen
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30157

3 years agoqat.4: the Authors section prettification
Maxim Konovalov [Fri, 7 May 2021 15:33:01 +0000 (15:33 +0000)]
qat.4: the Authors section prettification

Rewording the Authors section in way that allows to
remove a hard break before Mark's name.

Reviewed by: markj

3 years agoConstify vm_pager-related virtual tables.
Konstantin Belousov [Mon, 3 May 2021 21:58:07 +0000 (00:58 +0300)]
Constify vm_pager-related virtual tables.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agoAdd OBJT_SWAP_TMPFS pager
Konstantin Belousov [Sat, 1 May 2021 01:18:00 +0000 (04:18 +0300)]
Add OBJT_SWAP_TMPFS pager

This is OBJT_SWAP pager, specialized for tmpfs.  Right now, both swap pager
and generic vm code have to explicitly handle swap objects which are tmpfs
vnode v_object, in the special ways.  Replace (almost) all such places with
proper methods.

Since VM still needs a notion of the 'swap object', regardless of its
use, add yet another type-classification flag OBJ_SWAP. Set it in
vm_object_allocate() where other type-class flags are set.

This change almost completely eliminates the knowledge of tmpfs from VM,
and opens a way to make OBJT_SWAP_TMPFS loadable from tmpfs.ko.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agopagertab: use designated initializers
Konstantin Belousov [Sat, 1 May 2021 17:20:36 +0000 (20:20 +0300)]
pagertab: use designated initializers

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agoStyle enum obj_type
Konstantin Belousov [Sat, 1 May 2021 01:14:24 +0000 (04:14 +0300)]
Style enum obj_type

Put each type into dedicated line, which makes addition of new
types cleaner.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agoImplement vm_object_vnode() using vm_pager_getvp()
Konstantin Belousov [Sat, 1 May 2021 01:08:28 +0000 (04:08 +0300)]
Implement vm_object_vnode() using vm_pager_getvp()

Allow vp_heldp argument to be NULL, in which case the returned vnode
is not held for tmpfs swap objects.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agoAdd pgo_freespace method
Konstantin Belousov [Sat, 1 May 2021 17:12:32 +0000 (20:12 +0300)]
Add pgo_freespace method

Makes the code in vm_object collapse/page_remove cleaner

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agoAdd pgo_getvp method
Konstantin Belousov [Sat, 1 May 2021 01:04:04 +0000 (04:04 +0300)]
Add pgo_getvp method

This eliminates the staircase of conditions in vm_map_entry_set_vnode_text().

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agoAdd pgo_mightbedirty method
Konstantin Belousov [Sat, 1 May 2021 00:43:08 +0000 (03:43 +0300)]
Add pgo_mightbedirty method

Used to implement vm_object_mightbedirty()

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agovm_pager: add pgo_set_writeable_dirty method
Konstantin Belousov [Sat, 1 May 2021 00:14:48 +0000 (03:14 +0300)]
vm_pager: add pgo_set_writeable_dirty method

specialized for swap and vnode pagers, and used to implement
vm_object_set_writeable_dirty().

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agovm_pager: style some wrappers
Konstantin Belousov [Sat, 1 May 2021 00:28:39 +0000 (03:28 +0300)]
vm_pager: style some wrappers

Fill lines with the function definitions.
Use local var to shorten repeated extra-long expressions.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agoswappagerops: slightly more style-compliant formatting
Konstantin Belousov [Fri, 30 Apr 2021 23:54:17 +0000 (02:54 +0300)]
swappagerops: slightly more style-compliant formatting

Remove excess spaces from comments.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D30070

3 years agompsutil: extend show adapter information, add NCQ control
Daniel Austin [Fri, 7 May 2021 11:41:53 +0000 (14:41 +0300)]
mpsutil: extend show adapter information, add NCQ control

'show adapter' now shows PCIe width and speed, IOC Speed, and the
temperature of the controller.

A new command, 'set ncq', is added.
It enables or disables SATA NCQ in the NVRAM of the card.
Its current setting is added to 'show adapter' as well.

PR: 254841
MFC after: 2 weeks
Relnotes: perhaps

3 years agonvmecontrol: fix typo (s/Managment/Management/)
Edward Tomasz Napierala [Fri, 7 May 2021 12:12:30 +0000 (13:12 +0100)]
nvmecontrol: fix typo (s/Managment/Management/)

Reported By: pstef

3 years agoMake inode extra time fields updating logic more closer to linux.
Fedor Uporov [Fri, 7 May 2021 07:46:55 +0000 (10:46 +0300)]
Make inode extra time fields updating logic more closer to linux.

Found using pjdfstest:
pjdfstest/tests/utimensat/09.t

Reviewed by:    pfg
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D29933

3 years agoInvalidate inode extents cache on truncation.
Fedor Uporov [Thu, 18 Feb 2021 08:00:07 +0000 (11:00 +0300)]
Invalidate inode extents cache on truncation.

It is needed to invalidate cache in case of inode space removal
to avoid situation, when extents cache returns not exist extent.

Reviewed by:    pfg
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D29931

3 years agoImprove extents verification logic.
Fedor Uporov [Thu, 18 Feb 2021 07:48:10 +0000 (10:48 +0300)]
Improve extents verification logic.

It is possible to walk thru inode extents if EXT2FS_PRINT_EXTENTS
macro is defined. The extents headers magics and physical blocks
ranges are checked during extents walk.

Reviewed by:    pfg
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D29932

3 years agostorvsc: fix auto-sense reporting
Andriy Gapon [Fri, 7 May 2021 07:17:57 +0000 (10:17 +0300)]
storvsc: fix auto-sense reporting

I saw a situation where the driver set CAM_AUTOSNS_VALID on a failed ccb
even though SRB_STATUS_AUTOSENSE_VALID was not set in the status.
The actual sense data remained all zeros.
The problem seems to be that create_storvsc_request() always sets
hv_storvsc_request::sense_info_len, so checking for sense_info_len != 0
is not enough to determine if any auto-sense data is actually available.

Reviewed by: whu, imp
MFC after: 2 weeks
Sponsored by: CyberSecure
Differential Revision: https://reviews.freebsd.org/D30124

3 years agoAdd chr/blk devices support.
Fedor Uporov [Thu, 18 Feb 2021 08:26:50 +0000 (11:26 +0300)]
Add chr/blk devices support.

The dev field is placed into the inode structure.
The major/minor numbers conversion to/from linux compatile
format happen during on-disk inodes writing/reading.

Reviewed by:    pfg
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D29930

3 years agoFix inode birthtime updating logic.
Fedor Uporov [Thu, 18 Feb 2021 08:40:18 +0000 (11:40 +0300)]
Fix inode birthtime updating logic.

The birthtime field of struct vattr does not checked
for VNOVAL in case of ext2_setattr() and produce incorrect
inode birthtime values.

Found using pjdfstest:
    pjdfstest/tests/utimensat/03.t

Reviewed by:    pfg
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D29929

3 years agovirtio-modern: fix PCI common read/write functions on big endian targets
Alfredo Dal'Ava Junior [Fri, 7 May 2021 05:40:35 +0000 (02:40 -0300)]
virtio-modern: fix PCI common read/write functions on big endian targets

Virtio modern has the common data organized in little endian, but
on powerpc64 BE it was reading and writing in the wrong endian.

Submitted by: Leonardo Bianconi <leonardo.bianconi@eldorado.org.br>
Reviewed by: bryanv, alfredo
Sponsored by: Eldorado Research Institute (eldorado.org.br)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28947

3 years agosdhci_fsl_fdt: specify base clk divisor per SoC
Marcin Wojtas [Fri, 7 May 2021 01:45:22 +0000 (03:45 +0200)]
sdhci_fsl_fdt: specify base clk divisor per SoC

Only LS1046A and LS1028A require the base clk to be divided by 2.
Implement that by moving the divider to a SoC specific data.
This commit fixes base clk setup for the entire SoC family,
including the already suported LS2160A.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30120

3 years agoAdd LS1028A clockgen driver
Marcin Wojtas [Fri, 7 May 2021 01:33:04 +0000 (03:33 +0200)]
Add LS1028A clockgen driver

The new driver provides probe and attach functions for the NXP LS1028A
clockgen and passes configuration information to QorIQ clockgen class.

Submitted by: Lukasz Hajec <lha@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30125

3 years agosqlite3: import sqlite3 3.35.5
Cy Schubert [Fri, 7 May 2021 01:01:44 +0000 (18:01 -0700)]
sqlite3: import sqlite3 3.35.5

Merge commit '0511e356f5e2106928ee352ee974d1470c860a9a' into new_merge

Changes at https://www.sqlite.org/releaselog/3_35_5.html.

MFC after:      1 month

3 years agocdefs.h: Remove __GNUCLIKE___OFFSETOF, it's unused
Warner Losh [Thu, 6 May 2021 22:34:55 +0000 (16:34 -0600)]
cdefs.h: Remove __GNUCLIKE___OFFSETOF, it's unused

__GNUCLIKE___OFFSETOF is unreferenced in the tree, remove it as long
obsolete.

Sponsored by: Netflix

3 years agoheaders: Implement _ISOC11_SOURCES macro when __POSIX_C_SOURCE defined
Warner Losh [Thu, 6 May 2021 22:20:19 +0000 (16:20 -0600)]
headers: Implement _ISOC11_SOURCES macro when __POSIX_C_SOURCE defined

When _ISOC11_SOURCES is defined for glibc at the same time
__POSIX_C_SOURCE is defined, it extends the __POSIX_C_SOURCE definition
by exaclty what C11 adds to the spec for each system header.  We follow
both OpenBSD's and glibc's convention by also C11 or higher compliation
mode is selected.

The Open Group is working on issuing a new version of the POSIX standard
that will realign the standard from C99 to a newer version of C. This
commit is a stop-gap measure for greater compatibility until that
environment has been standardized.

Reviewed by: brooks@, arichards@, Olivier Certne
(comments tweaked before commit)
PR: 255290
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29902

3 years agonvmecontrol: update copyright on passthru command
Warner Losh [Thu, 6 May 2021 22:05:42 +0000 (16:05 -0600)]
nvmecontrol: update copyright on passthru command

I wrote this code, not Intel, so put my copyright on this. I mistakenly
copied it for the initial commit.

Sponsored by: Netflix

3 years agonvmecontrol: Report status from passthru commands
Warner Losh [Thu, 25 Mar 2021 07:41:53 +0000 (01:41 -0600)]
nvmecontrol: Report status from passthru commands

Report status from dword0 for passthru commands. Many commands report
some status or information here, so reporting it can help know what's
going on.

Sponsored by: Netflix

3 years agosqlite3: Vendor import of sqlite3 3.35.5
Cy Schubert [Thu, 6 May 2021 20:14:13 +0000 (13:14 -0700)]
sqlite3: Vendor import of sqlite3 3.35.5

Changes at https://www.sqlite.org/releaselog/3_35_5.html.

3 years agoRevert "sqlite3: Vendor import of sqlite3 3.35.5"
Cy Schubert [Thu, 6 May 2021 20:08:52 +0000 (13:08 -0700)]
Revert "sqlite3: Vendor import of sqlite3 3.35.5"

The source to be used should be sqlite-autoconf-3350500.tar.gz
instead of the souce sqlite-amalgamation-3350500.zip used by
the port.

This reverts commit eccd5a4d3926c0716dd11bdf3242da56116f68c6.

3 years agoboot: fix OBJS to not include BTX's crt0.o
Warner Losh [Thu, 6 May 2021 19:05:09 +0000 (13:05 -0600)]
boot: fix OBJS to not include BTX's crt0.o

According to comments in the Makefile, to make pxeboot work we need to
have crt0.o first. This is needed because the simplified loader in
pxeboot assumes that the startup code is at offset 0 in this binary. In
normal booting, the start address can be obtained from headers of the
binary, but since pxeboot encodes this as a pure binary, it has no way
of knowing where that is and assumes 0. Added comments to that effect
in the Makefile.

We've done this by adding it to OBJS before all the other .o's are
added. However, there's a problem. This also adds it to the CLEANFILES
variable, which causes it to be removed from multiple places. The
dependencies may also cause it to be re-built at a time that's after
boot2 is built. This causes installs to fail because at install time
boot2 is considered to be out of date and the programs to rebuild it are
no longer in the path.

Cope with this problem by just adding it to LDFLAGS instead.

Glanced at by: kevans ("I thought that went in ages ago")
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D28876

3 years agoPCI hot-plug: use dedicated taskqueue for device attach / detach
Andriy Gapon [Thu, 6 May 2021 18:49:37 +0000 (21:49 +0300)]
PCI hot-plug: use dedicated taskqueue for device attach / detach

Attaching and detaching devices can be heavy-weight and detaching can
sleep waiting for events.  For that reason using the system-wide
single-threaded taskqueue_thread is not really appropriate.
There is even a possibility for a deadlock if taskqueue_thread is used
for detaching.

In fact, there is an easy to reproduce deadlock involving nvme, pass
and a sudden removal of an NVMe device.
A pass peripheral would not release a reference on an nvme sim until
pass_shutdown_kqueue() is executed via taskqueue_thread.  But the
taskqueue's thread is blocked in nvme_detach() -> ... -> cam_sim_free()
because of the outstanding reference.

MFC after: 10 days
Sponsored by: CyberSecure
Reviewed by: mav, imp
Differential Revision: https://reviews.freebsd.org/D30144

3 years agogmultipath: make physpath distinct from the underlying providers'
Alan Somers [Thu, 22 Apr 2021 21:09:03 +0000 (15:09 -0600)]
gmultipath: make physpath distinct from the underlying providers'

zfsd uses a device's physical path attribute to automatically replace a
missing ZFS disk when a blank disk is inserted into the same physical
slot.  Currently gmultipath passes through its underlying providers'
physical path attribute.  That may cause zfsd to replace a missing
gmultipath provider with a newly arrived, single-path disk.  That would
be bad.

This commit fixes that problem by simply appending "/mp" to the
underlying providers' physical path, in a manner similar to what geli
already does.

Sponsored by: Axcient
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D29941

3 years agotcp_twcheck(): use correct unlock macro.
Gleb Smirnoff [Thu, 6 May 2021 17:19:21 +0000 (10:19 -0700)]
tcp_twcheck(): use correct unlock macro.

This crippled in due to conflict between two last commits 1db08fbe3ff
and 9e644c23000.

Submitted by: Peter Lei

3 years agoThis brings into sync FreeBSD with the netflix versions of rack and bbr.
Randall Stewart [Thu, 6 May 2021 15:22:26 +0000 (11:22 -0400)]
This brings into sync FreeBSD with the netflix versions of rack and bbr.
This fixes several breakages (panics) since the tcp_lro code was
committed that have been reported. Quite a few new features are
now in rack (prefecting of DGP -- Dynamic Goodput Pacing among the
largest). There is also support for ack-war prevention. Documents
comming soon on rack..

Sponsored by:           Netflix
Reviewed by: rscheff, mtuexen
Differential Revision: https://reviews.freebsd.org/D30036

3 years agoUse '.arch_extension crc' in the arm64 crc32 code
Andrew Turner [Thu, 6 May 2021 07:37:47 +0000 (07:37 +0000)]
Use '.arch_extension crc' in the arm64 crc32 code

We don't care about the base architecture here, just that the crc
extension is enabled.

Sponsored by: Innovate UK

3 years agolinux(4): make arch_prctl(2) support GET_CET_STATUS, report unknown codes
Edward Tomasz Napierala [Thu, 6 May 2021 08:33:35 +0000 (09:33 +0100)]
linux(4): make arch_prctl(2) support GET_CET_STATUS, report unknown codes

This is largely a no-op, to make future debugging slightly easier.

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30035