Commit Graph

259121 Commits

Author SHA1 Message Date
Dmitry Chagin
9e07ae7a09 Regen for ('99b6f430698fa00a33184dd61591d8b6518ed9d3') Linux
clock_gettime64 system call.

MFC after:	2 weeks
2021-06-07 05:08:11 +03:00
Dmitry Chagin
99b6f43069 linux(4): Implement clock_gettime64 system call.
MFC after:	2 weeks
2021-06-07 05:04:42 +03:00
Dmitry Chagin
ea7fa5583c Regen for ('e4bffb80bbc6a2e4b3be89aefcbd5bb2c2fc0ba0') Linux
utimensat_time64 syscall.

MFC after:	2 weeks
2021-06-07 04:56:58 +03:00
Dmitry Chagin
e4bffb80bb linux(4): Implement utimensat_time64 system call.
MFC after:	2 weeks
2021-06-07 04:54:30 +03:00
Dmitry Chagin
bfcce1a9f6 linux(4): add struct timespec64 definition and conversion routine for
future use.

MFC after:		2 weeks
2021-06-07 04:47:12 +03:00
Justin Hibbits
d7bfb412a7 powerpc64le/pmap: Fix superpage promotions
The page table is always big endian.  Without byte swapping on LE, the
promotion ability checks were invalid, and superpage promotions always
failed.
2021-06-05 21:49:42 -05:00
Jason A. Harmening
59409cb90f Add a generic mechanism for preventing forced unmount
This is aimed at preventing stacked filesystems like nullfs and unionfs
from "losing" their lower mounts due to forced unmount.  Otherwise,
VFS operations that are passed through to the lower filesystem(s) may
crash or otherwise cause unpredictable behavior.

Introduce two new functions: vfs_pin_from_vp() and vfs_unpin().
which are intended to be called on the lower mount(s) when the stacked
filesystem is mounted and unmounted, respectively.
Much as registration in the mnt_uppers list previously did, pinning
will prevent even forced unmount of the lower FS and will allow the
stacked FS to freely operate on the lower mount either by direct
use of the struct mount* or indirect use through a properly-referenced
vnode's v_mount field.

vfs_pin_from_vp() is modeled after vfs_ref_from_vp() in that it uses
the mount interlock coupled with re-checking vp->v_mount to ensure
that it will fail in the face of a pending unmount request, even if
the concurrent unmount fully completes.

Adopt these new functions in both nullfs and unionfs.

Reviewed By:	kib, markj
Differential Revision: https://reviews.freebsd.org/D30401
2021-06-05 18:20:36 -07:00
Rick Macklem
a5df139ec6 nfsd: Fix when NFSERR_WRONGSEC may be replied to NFSv4 clients
Commit d224f05fcf pre-parsed the next operation number for
the put file handle operations.  This patch uses this next
operation number, plus the type of the file handle being set by
the put file handle operation, to implement the rules in RFC5661
Sec. 2.6 with respect to replying NFSERR_WRONGSEC.

This patch also adds a check to see if NFSERR_WRONGSEC should be
replied when about to perform Lookup, Lookupp or Open with a file
name component, so that the NFSERR_WRONGSEC reply is done for
these operations, as required by RFC5661 Sec. 2.6.

This patch does not have any practical effect for the FreeBSD NFSv4
client and I believe that the same is true for the Linux client,
since NFSERR_WRONGSEC is considered a fatal error at this time.

MFC after:	2 weeks
2021-06-05 16:53:07 -07:00
Bjoern A. Zeeb
002cbc89c3 arm64/rk805: remove RTC Set logging
When ntpd is synchronizing the system time, it also periodically (30m)
syncs the the RTC time.  Remove printf in rk805_settime which triggers
every 30m, as settime_task_func() will log errors under bootverbose.
We leave the RTC Read logging, which should happen only once at boot.

Commit message by:	imp
Reviewed by:		manu, imp
MFC after:		2 weeks
Differential Revision: https://reviews.freebsd.org/D30361
2021-06-05 17:07:56 +00:00
Bjoern A. Zeeb
b5d37e5a20 net80211/LinuxKPI: add more radiotap definitions
Add more raditap definitions based on "names" found in actual drivers
and based on documentation from radiotap.org (where avail).

Leave one specific "duplicate" in the LinuxKPI implementation but
otherwise manage it all in net80211.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	hselasky, adrian, sam
Differential Revision: https://reviews.freebsd.org/D30641
2021-06-05 16:21:49 +00:00
Bjoern A. Zeeb
57af163c8e arm64/rk_pcie_phy: handle assigned-clock*
Nanopi4 based SoCs (NanoPC-T4, NanoPi M4*, and NanoPi Neo4) have
assigned-clock* in the pcie_phy node.  Handle them but only fail
in case clk_set_assigned() returns an error other than
"no assigned-clock*" (as it would for all other SoCs).

Reviewed by:	manu
MFC After:	2 weeks
Differential Revision: https://reviews.freebsd.org/D30363
2021-06-05 16:16:29 +00:00
Bjoern A. Zeeb
65a226b41d dtb: rockchip: Add NanoPC-T4 to the build. 2021-06-05 15:19:26 +00:00
Konstantin Belousov
fe7d7ac408 hyperv: register intr handler as usermode-mapped if loaded as module
Normally raw interrupt handler is provided by the kernel text.  But
vmbus module registers its own handler that needs to be mapped into
userspace mapping on PTI kernels.

Reported and reviewed by:	whu
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30310
2021-06-05 18:03:18 +03:00
Allan Jude
c6a311678d nextboot: Improve the shell code used to figure out the zpool name
Reported by:	imp
Reviewed by:	imp, tsoome
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D30650
2021-06-05 14:32:18 +00:00
Ryan Moeller
c5a2d8c5f5 sockstat: Use libcasper to capsicumize
Drop rights we do not need. This has to be done after jail_attach.

Reviewed by:	oshogbo
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D26958
2021-06-05 08:36:55 -04:00
Ryan Moeller
94dc571595 libcasper: Create a minimal cap_netdb service
Create a casper service for netdb functions.
Initially only cap_getprotobyname is implemented.

This is needed for capsicumizing sockstat.

Reviewed by:	oshogbo, bcr (manpages)
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D24832
2021-06-05 08:36:53 -04:00
Jung-uk Kim
1970d69303 Import ACPICA 20210604
(cherry picked from commit 395770967c3664ec744e63fa47acc19670d32f47)
2021-06-05 01:58:00 -04:00
Ganbold Tsagaankhuu
295855e80f dtb: rockchip: Add NanoPI-R2S to the build 2021-06-05 12:40:34 +08:00
Rick Macklem
56e9d8e38e nfsd: Fix NFSv4.1/4.2 Secinfo_no_name when security flavors empty
Commit 947bd2479b added support for the Secinfo_no_name operation.
When a non-exported file system is being traversed, the list of
security flavors is empty.  It turns out that the Linux client
mount attempt fails when the security flavors list in the
Secinfo_no_name reply is empty.

This patch modifies Secinfo/Secinfo_no_name so that it replies
with all four security flavors when the list is empty.
This fixes Linux NFSv4.1/4.2 mounts when the file system at
the NFSv4 root (as specified on a V4: exports(5) line) is
not exported.

MFC after:	2 weeks
2021-06-04 20:31:20 -07:00
Warner Losh
1b5bc3a54b usbdump: style: Sort case statements alphabetically
Switch case statement for getopt args should be sorted alphabetically.

Sponsored by:		Netflix
2021-06-04 16:47:28 -06:00
Navdeep Parhar
f13d72fd0b cxgb(4): Report proper TSO limits.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2021-06-04 13:30:28 -07:00
Navdeep Parhar
bb877c0620 cxgbe(4): Empty the clib_db before trying to destroy it.
This fixes a panic on driver unload.

Reported by:	Jithesh Arakkan @ Chelsio
MFC after:	1 week
Sponsored by:	Chelsio Communications
2021-06-04 12:01:14 -07:00
Ryan Stone
2290dfb40f Enter the net epoch before calling ip6_setpktopts
ip6_setpktopts() can look up ifnets via ifnet_by_index(), which
is only safe in the net epoch.  Ensure that callers are in the net
epoch before calling this function.

Sponsored by: Dell EMC Isilon
MFC after: 4 weeks
Reviewed by: donner, kp
Differential Revision: https://reviews.freebsd.org/D30630
2021-06-04 13:18:11 -04:00
Hans Petter Selasky
dab84426a6 Narrow down the probe range for if_ure(4) compatible devices
to only match the first vendor specific interface, if any.

PR:		253374
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-06-04 15:51:01 +02:00
Lutz Donnerhacke
24ea1dbf25 tests/netgraph: Inital framework for testing libnetgraph
Provide a framework of functions to test various netgraph modules.
Tests contain:
 - creating, renaming, and destroying nodes
 - connecting and removing hooks
 - sending and receiving data
 - sending ASCII messages
 - errors can be passed for indiviual inspection or fail the test

Reviewed by:	kp
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30629
2021-06-04 15:17:54 +02:00
Lutz Donnerhacke
c8250c5ada ipfw.8: synopsis misses nat show form
Document the existing behavior, which is currently only available by
reading third party documentation or the source code itself.

PR:		254617
Submitted by:	Oliver Kiddle
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D30189
2021-06-04 12:55:59 +02:00
Randall Stewart
4747500dea tcp: A better fix for the previously attempted fix of the ack-war issue with tcp.
So it turns out that my fix before was not correct. It ended with us failing
some of the "improved" SYN tests, since we are not in the correct states.
With more digging I have figured out the root of the problem is that when
we receive a SYN|FIN the reassembly code made it so we create a segq entry
to hold the FIN. In the established state where we were not in order this
would be correct i.e. a 0 len with a FIN would need to be accepted. But
if you are in a front state we need to strip the FIN so we correctly handle
the ACK but ignore the FIN. This gets us into the proper states
and avoids the previous ack war.

I back out some of the previous changes but then add a new change
here in tcp_reass() that fixes the root cause of the issue. We still
leave the rack panic fixes in place however.

Reviewed by: mtuexen
Sponsored by: Netflix Inc
Differential Revision:	https://reviews.freebsd.org/D30627
2021-06-04 05:26:43 -04:00
Lutz Donnerhacke
0345fd891f netgraph/ng_base: Renaming a node to the same name is a noop
Detailed analysis in https://github.com/genneko/freebsd-vimage-jails/issues/2
brought the problem down to a double call of ng_node_name() before and
after a vnet move.  Because the name of the node is already known
(occupied by itself), the second call fails.

PR:		241954
Reported by:	Paul Armstrong
MFC:		1 week
Differential Revision: https://reviews.freebsd.org/D30110
2021-06-04 11:20:19 +02:00
Ka Ho Ng
9b236631b1 gitignore: Add .clangd and .ccls-cache
Add residues of clangd and ccls to prevent them from being accidentally
included in a commit.

clangd and ccls are two C/C++ Language Server implementations listed in
https://microsoft.github.io/language-server-protocol/implementors/servers/ .

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	philip
Differential Revision:	https://reviews.freebsd.org/D26555
2021-06-04 16:56:08 +08:00
Hans Petter Selasky
d4cf41a99b Add support for RTL8153B, RTL8156 and RTL8156B to if_ure(4).
Submitted by:	fbbz@synack.eu
PR:		253374
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-06-04 10:29:55 +02:00
Ka Ho Ng
73570795e7 gitignore: Add compile_commands.json
The purpose of this change is to make sure no one would accidentally
include their own workspace leftover into a commit.

compile_commands.json is a generated file which contains build commands.
The file is consumed by Language Servers such as clangd and ccls.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	lwhsu
Differential Revision:	https://reviews.freebsd.org/D26514
2021-06-04 16:06:32 +08:00
Cy Schubert
6815008894 wpa: Fix GCC 6 build
GCC 6 searches serially to resolve external references.

MFC after:	2 months
X-MFC with:	25ecdc7d52
2021-06-03 21:13:00 -07:00
Rick Macklem
d224f05fcf nfsd: Pre-parse the next NFSv4 operation number for put FH operations
RFC5661 Sec. 2.6 specifies when a NFSERR_WRONGSEC error reply can be done.
For the four operations PutFH, PutrootFH, PutpublicFH and RestoreFH,
NFSERR_WRONGSEC can or cannot be replied, depending upon what operation
follows one of these operations in the compound.

This patch modifies nfsrvd_compound() so that it parses the next operation
number before executing any of the above four operations, storing it in
"nextop".

A future commit will implement use of "nextop" to decide if NFSERR_WRONGSEC
can be replied for the above four operations.

This commit should not change the semantics of performing the compound RPC.

MFC after:	2 weeks
2021-06-03 20:48:26 -07:00
Konstantin Belousov
f9b1e711f0 fdescfs: add an option to return underlying file vnode on lookup
The 'nodup' option forces fdescfs to return real vnode behind file
descriptor instead of the fdescfs fd vnode, on lookup. The end result
is that e.g. stat("/dev/fd/3") returns the stat data for the underlying
vnode, if any.  Similarly, fchdir(2) works in the expected way.

For open(2), if applied over file descriptor opened with O_PATH, it
effectively re-open that vnode into normal file descriptor which has the
specified access mode, assuming the current vnode permissions allow it.

If the file descriptor does not reference vnode, the behavior is unchanged.

This is done by a mount option, because permission check on open(2) breaks
established fdescfs open semantic of dup(2)-ing the descriptor.  So it
is not suitable for /dev/fd mount.

Tested by:	Andrew Walker <awalker@ixsystems.com>
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30140
2021-06-04 03:30:12 +03:00
Warner Losh
eae2ef5a01 smartpqi: Remove stray declaration
pqisrc_is_firmware_feature_enabled shouldn't be declared inline in a
header, and then static inline in the .c function. Remove this stray
declartion from the header. gcc6 complains, but clang does not.

Sponsored by:		Netflix
2021-06-03 17:45:27 -06:00
Kenneth Camann
5deb350025 uefisign: fix SizeOfHeaders sanity check.
This check was too aggressive: it is fine if SizeOfHeaders is exactly
equal to the size of the DOS stub + PE header + section table. Despite
being wrong this code typically worked for most EFI binaries because
SizeOfHeaders is rounded up to a multiple of FileAlignment, which is
often large (e.g., 512 bytes for the FreeBSD loader) so most binaries
made it through.

Reviewed by:	imp@
Sponsored by:	Netflix
Pull Request:	https://github.com/freebsd/freebsd-src/pull/445
2021-06-03 15:22:14 -06:00
Konstantin Belousov
37f780d3e0 Disable x2APIC for SandyBridge laptops with Samsung BIOS
From the PR:
Almost always, my Samsung RF511 laptop could not boot with
x2APIC enabled in the kernel. It froze during SMP initialization,
shortly after "ACPI APIC Table: <SECCSD LH43STAR>" was printed
to the console. When the kernel is instructed not to use x2APIC,
the system boots correctly.

PR:	256389
Submitted by:	David Sebek <dasebek@gmail.com>
Reviewed by:	markj
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30624
2021-06-03 22:47:31 +03:00
Konstantin Belousov
e9e00cc0c9 madt_setup_local: extract special case checks into a helper
Reviewed by:	markj
Tested by:	David Sebek <dasebek@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30624
2021-06-03 22:47:31 +03:00
Konstantin Belousov
92adf00d05 madt_setup_local: convert series of strcmp to iteration over the array
to prepare for one more addition

Reviewed by:	markj
Tested by:	David Sebek <dasebek@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30624
2021-06-03 22:47:31 +03:00
Konstantin Belousov
a603d41aca madt_setup_local: skip further checks if ACPI DMAR table already disabled x2APIC
Reviewed by:	markj
Tested by:	David Sebek <dasebek@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D30624
2021-06-03 22:47:31 +03:00
Warner Losh
33755dbb20 mpr/mps: Minor state machine fix
When a DMA chain can't be loaded, set the state to STATE_INQUEUE so that
the mp[rs]_complete_command can properly fail the command.

Sponsored by:		Netflix
2021-06-03 13:46:19 -06:00
Kenneth D. Merry
175ad3d003 Fix mpr(4) and mps(4) state transitions and a use-after-free panic.
When the mpr(4) and mps(4) drivers probe a SATA device, they issue an
ATA Identify command (via mp{s,r}sas_get_sata_identify()) before the
target is fully setup in the driver.  The drivers wait for completion of
the identify command, and have a 5 second timeout.  If the timeout
fires, the command is marked with the SATA_ID_TIMEOUT flag so it can be
freed later.

That is where the use-after-free problem comes in.  Once the ATA
Identify times out, the driver sends a target reset, and then frees any
identify commands that have timed out.  But, once the target reset
completes, commands that were queued to the drive are returned to the
driver by the controller.

At that point, the driver (in mp{s,r}_intr_locked()) looks up the
command descriptor for that particular SMID, marks it CM_STATE_BUSY and
sends it on for completion handling.

The problem at this stage is that the command has already been freed,
and put on the free queue, so its state is CM_STATE_FREE.  If INVARIANTS
are turned on, we get a panic as soon as this command is allocated,
because its state is no longer CM_STATE_FREE, but rather CM_STATE_BUSY.

So, the solution is to not free ATA Identify commands that get stuck
until they actually return from the controller.  Hopefully this works
correctly on older firmware versions.  If not, it could result in
commands hanging around indefinitely.  But, the alternative is a
use-after-free panic or assertion (in the INVARIANTS case).

This also tightens up the state transitions between CM_STATE_FREE,
CM_STATE_BUSY and CM_STATE_INQUEUE, so that the state transitions happen
once, and we have assertions to make sure that commands are in the
correct state before transitioning to the next state.  Also, for each
state assertion, we print out the current state of the command if it is
incorrect.

mp{s,r}.c:      Add a new sysctl variable, dump_reqs_alltypes,
                that controls the behavior of the dump_reqs sysctl.
                If dump_reqs_alltypes is non-zero, it will dump
                all commands, not just the commands that are in the
                CM_STATE_INQUEUE state.  (You can see the commands
                that are in the queue by using mp{s,r}util debug
                dumpreqs.)

                Make sure that the INQUEUE -> BUSY state transition
                happens in one place, the mp{s,r}_complete_command
                routine.

mp{s,r}_sas.c:  Make sure we print the current command type in
                command state assertions.

mp{s,r}_sas_lsi.c:
                Add a new completion handler,
                mp{s,r}sas_ata_id_complete.  This completion
                handler will free data allocated for an ATA
                Identify command and free the command structure.

                In mp{s,r}_ata_id_timeout, do not set the command
                state to CM_STATE_BUSY.  The command is still in
                queue in the controller.  Since we were blocking
                waiting for this command to complete, there was
                no completion handler previously.  Set the
                completion handler, so that whenever the command
                does come back, it will get freed properly.

                Do not free ATA Identify commands that have timed
                out in mp{s,r}sas_add_device().  Wait for them
                to actually come back from the controller.

mp{s,r}var.h:   Add a dump_reqs_alltypes variable for the new
                dump_reqs_alltypes sysctl.

                Make sure we print the current state for state
                transition asserts.

This was tested in the Spectra Logic test bed (as described in the
review), as well Netflix's Open Connect fleet (where panics dropped from
a dozen or two a month to zero).

Reviewed by:		imp@ (who is handling the commit with ken's OK)
Sponsored by:		Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D25476
2021-06-03 13:46:11 -06:00
Warner Losh
cc384c67ce cam: prefer cam_sim_softc() over accessing cam_sim structure directly.
Use the accessor function to get the softc for this sim. This also drops
an unneeded cast.

Sponsored by:		Netflix
Reviewed by:		mav@, hselasky@
Differential Revision:	https://reviews.freebsd.org/D30360
2021-06-03 13:08:29 -06:00
Dimitry Andric
95aa617e4b Add C++ headers <barrier> <concepts> <execution> <latch> <numbers> <semaphore>
I missed adding these to the libc++ Makefile, when importing
llvm-project 11.0.0-rc1, even though they were supplied by upstream.

While here, update OptionalObsoleteFiles.inc to add these new headers,
and cleanup old cruft.

Reported by:	yuri
Submitted by:	jkim (Makefile diff)
PR:		255374
MFC after:	3 days
2021-06-03 20:53:18 +02:00
Warner Losh
ce0a9d7c12 axgbe: Don't dereference NULL pointers
if (sb == NULL) { ... sb->s_error } is going to be a bad time. Return
ENOMEM when we cannot allocate an sbuf for the sysctl rather than
dereferencing the NULL pointer just returned.

Reviewed by:		manu@, allanjude@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30373
2021-06-03 12:03:45 -06:00
Warner Losh
ef65f7bdf2 mmc:: Undo my conversion of (bool) to !!.
The need for !! over (bool) pre-dates gcc 4.2, so go with the patch
as-submitted because the kernel tends to prefer that.

Suggested by:		emaste@
Sponsored by:		Netflix
2021-06-03 11:29:04 -06:00
Robert Wing
0e6549c874 bectl(8): don't allow creation of boot environments with spaces
Boot environment datasets that contain spaces are not bootable.

When a user attempts to create a boot environment with a space, abort
the creation and print an error message.

PR:             254441
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D30194
2021-06-03 08:36:11 -08:00
Maksym Stetsyuk
5c447fe677 usb: reduce verbosity of logging about unsuccessful port reset
Reviewed by:		imp@,hselasny@
Pull Request:		https://github.com/freebsd/freebsd-src/pull/385
Differential Revision:	https://reviews.freebsd.org/D30621
2021-06-03 09:52:52 -06:00
Kristof Provost
70dd30d49c pf tests: Make killstate:match more robust
The killstate:match test starts nc as a background process. There was no
guarantee that the nc process would have connected by the time we check
for states, so this test occasionally failed without good reason.

Teach the test to wait for at least some states to turn up before
executing the critical checks.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-06-03 15:22:19 +02:00
Kristof Provost
ea3eca5cb6 netpfil tests: Basic dummynet pipe test
Test dummynet pipes (i.e. bandwidth limitation) with ipfw. This is put
in the common tests because we hope to add dummynet support to pf in the
near future.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30380
2021-06-03 09:02:58 +02:00