Commit Graph

258308 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
77651151f3 linux: make ptrace(2) return EIO when trying to peek invalid address
Previously we've returned the error from native ptrace(2), ENOMEM.
This confused Linux strace(2).

Reviewed By:	emaste
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D29925
2021-04-24 11:37:50 +01:00
Hans Petter Selasky
a9b66dbd91 Allow the tcp_lro_flush_all() function to be called when the control
structure is zeroed, by setting the VNET after checking the mbuf count
for zero. It appears there are some cases with early interrupts on some
network devices which still trigger page-faults on accessing a NULL "ifp"
pointer before the TCP LRO control structure has been initialized.
This basically preserves the old behaviour, prior to
9ca874cf74 .

No functional change.

Reported by:	rscheff@
Differential Revision:	https://reviews.freebsd.org/D29564
MFC after:	2 weeks
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-04-24 12:23:42 +02:00
Alexander Motin
b99419aee4 mpr/mps(4): Make device mapping some more robust.
Allow new enclosure to replace previously existing one if there is
no completely unused table entry, same as it is done for devices.

If we can not process DPM due to corruption -- wipe it and restart
from scratch.  Otherwise I don't see a way to recover persistence if
something go wrong and there is no BIOS to recover it for us.

Together this solves a problem that appeared when 9300-8i firmware
update to 16.00.10.00 somehow switched its mapping mode from Device
Persistence to Enclosure/Slot without wiping the DPM table.  It made
HBA completely unusable, since overflowed and conflicting mapping
table was unable to map any of enclosures and so devices.

Also while there make some enclosure mapping errors more informative.

MFC after:	1 month
Sponsored by:	iXsystems, Inc.
2021-04-23 23:36:51 -04:00
Tai-hwa Liang
2acbe67787 sound(4): fixing panic for INVARIANTS kernel
3e7bae0821 turns the BUS_READ_IVAR() failure from a warning into a
KASSERT.  For certain PCI audio devices such like snd_csa(4) and
snd_emu10kx(4), the ac97_create() keeps the device handler generated
by device_add_child(pci_dev, "pcm"), which is not really a PCI device
handler.  This in turn causes the subsequent pci_get_subdevice()
inside ac97_initmixer() triggering a panic.

This patch tries to put a bandaid for the aforementioned pcm device
children such that they can use the correct PCI handler(from parent)
to avoid a KASSERT panic in the INVARIANTS kernel.

Tested with:	snd_csa(4), snd_ich(4), snd_emu10kx(4)
Reviewed by:	imp
MFC after:	1 month
2021-04-24 03:27:43 +00:00
Rick Macklem
4281bfec36 nfsd: fix session slot handling for failed callbacks
When the NFSv4.1/4.2 server does a callback to a client
on the back channel, it will use a session slot in the
back channel session. If the back channel has failed,
the callback will fail and, without this patch, the
session slot will not be released.
As more callbacks are attempted, all session slots
can become busy and then the nfsd thread gets stuck
waiting for a back channel session slot.

This patch frees the session slot upon callback
failure to avoid this problem.

Without this patch, the problem can be avoided by leaving
delegations disabled in the NFS server.

MFC after:	2 weeks
2021-04-23 15:24:47 -07:00
Ed Maste
576b477ba4 openssh: add a note about pushing vendor updates
Sponsored by:	The FreeBSD Foundation
2021-04-23 15:36:42 -04:00
Navdeep Parhar
50f5d13eeb cxgbe(4): hw.cxgbe.panic_on_fatal_err can be changed any time.
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2021-04-23 12:17:54 -07:00
John Baldwin
b0df36580d etcupdate: Remove the old pre-world tree when rotating for -p.
This fixes a bug in an earlier change to move tree rotation to
the end of the update where the step to make room for the new
preworld tree was deleting the old "current" tree instead of
the old "preworld" tree.

Reported by:	olivier, dhw
Fixes:		0611aec3cf
MFC after:	2 weeks
2021-04-23 09:44:18 -07:00
Mark Johnston
d500a85e64 dtrace tests: Fix tst.system.d after ping/ping6 unification
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-04-23 10:28:09 -04:00
Mark Johnston
8e8f1cc9bb Re-enable network ioctls in capability mode
This reverts a portion of 274579831b ("capsicum: Limit socket
operations in capability mode") as at least rtsol and dhcpcd rely on
being able to configure network interfaces while in capability mode.

Reported by:	bapt, Greg V
Sponsored by:	The FreeBSD Foundation
2021-04-23 09:22:49 -04:00
Alex Richardson
694407528f Correctly skip rtsock_l3 test when if_epair is not available
This logic was accidentally changed in 67f2f67fc8

Reported By:	olivier
X-MFC-With:	67f2f67fc8
Tested By:	kp
Reviewed By:	kp, melifaro
Fixes:		67f2f67fc8 ("Update rtsock_l3 test after 2fe5a79425c7")
Differential Revision: https://reviews.freebsd.org/D29944
2021-04-23 11:28:26 +01:00
Andrew Gallatin
3183d0b680 iflib: initialize LRO unconditionally
Changes to the LRO code have exposed a bug in iflib where devices
which are not capable of doing LRO are still calling
tcp_lro_flush_all(), even when they have not initialized the LRO
context. This used to be mostly harmless, but the LRO code now sets
the VNET based on the ifp in the lro context and will try to access it
through a NULL ifp resulting in a panic at boot.

To fix this, we unconditionally initializes LRO so that we have a
valid LRO context when calling tcp_lro_flush_all(). One alternative is
to check the device capabilities before calling tcp_lro_flush_all() or
adding a new state flag in the ctx. However, it seems unwise to add an
extra, mostly useless test for higher performance devices when we can
just initialize LRO for all devices.

Reviewed by: erj, hselasky, markj, olivier
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29928
2021-04-23 05:55:20 -04:00
Navdeep Parhar
5f00292fe3 cxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function.
It can be called to (re)apply the settings in the driver softc to the
hardware.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2021-04-23 00:26:47 -07:00
Navdeep Parhar
b47b28e5b2 cxgbe(4): Add flag to reliably stop the driver from accessing hw stats.
There are two kinds of routines in the driver that read statistics from
the hardware: the cxgbe_* variants read the per-port MPS/MAC registers
and the vi_* variants read the per-VI registers.  They can be called
from the 1Hz callout or if_get_counter.  All stats collection now takes
place under the callout lock and there is a new flag to indicate that
these routines should not access any hardware register.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2021-04-22 17:45:52 -07:00
Ed Maste
3cfd08c1c7 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
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29896
2021-04-22 19:32:34 -04:00
Navdeep Parhar
dc77e79296 cxgbe(4): Fix minor nit in the display of MPS TCAM entries.
MFC after:	3 days
2021-04-22 15:36:51 -07:00
Navdeep Parhar
8f1bc78ef7 cxgbe(4): make the logging helpers a little more robust.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2021-04-22 15:28:43 -07:00
Vladimir Kondratyev
55eb41bb1f hv_kbd: Fix build with EVDEV_SUPPORT kernel option disabled.
Reported by:	olivier
MFC with:	e4643aa4c4
2021-04-23 01:13:25 +03:00
Navdeep Parhar
557c4521bb cxgbe/t4_tom: Implement tod_pmtu_update.
tod_pmtu_update was added to the kernel in 01d74fe1ff.

Sponsored by:	Chelsio Communications
2021-04-22 14:48:57 -07:00
Warner Losh
2183bfcce4 newvers.sh: better regexp for the FreeBSD_version line
Tested with:		cirrus-ci https://cirrus-ci.com/build/6012323274948608
Reviewed by:		emaste@, rgrimes@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D29869
2021-04-22 11:45:12 -06:00
Fernando Apesteguía
2e5929a756 stats.7: Add dwatch(1) to the list
PR:	255303
Approved by: 0mp (mentor)
Differential Revision: https://reviews.freebsd.org/D29924
2021-04-22 19:33:12 +02:00
Warner Losh
9a5a5c1576 pvscsi: Advertise maxio of 256k.
While the PV SCSI SG list can handle 512k of SG entries, it can only do
so for I/O that's aligned to 4k or better. newfs_msdos does unaligned
I/O, so triggers too long for host errors in cam when a 512k I/O is
attempted. Prefer power of 2 256k to the absolute maximum 508k, though
that can be revisited should the latter show to give significant
performance improvement.

MFC After:		3 days
Tested by:		darius on discord (508k version of patch)
Sponsored by:		Netflix
2021-04-22 11:23:29 -06:00
Ryan Moeller
89c3c32647 bhyve: Gracefully handle virtio-scsi with no conf
Fixes segfault with the command `bhyve -s 0,virtio-scsi`, which is used
by some third party software to probe bhyve for virtio-scsi support.

Reviewed by:	jhb
MFC after:	1 day
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D29926
2021-04-22 12:06:08 -04:00
Mateusz Guzik
7ea3223c78 zfs: use vn_seqc_read_notmodify for racing .. lookups
Catching an in-flight unlocked vnode is fine here.

Reported by;	pho
2021-04-22 13:18:39 +00:00
Ram Kishore Vegesna
fc620f9782 ocs_fc: Fix memory leak in ocs_scsi_io_alloc()
PR: 254690
Approved by: mav(mentor)
MFC after: 2 weeks
2021-04-22 17:48:37 +05:30
Hans Petter Selasky
47bc8fc9ae Add more USB quirks for Kingston devices.
PR:		253855
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-04-22 12:40:29 +02:00
Hans Petter Selasky
28af0c4814 Add more USB quirks for Garmin devices.
Sort the Garmin products while at it.

PR:		254664
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-04-22 12:35:07 +02:00
Hans Petter Selasky
d2c8714064 Remove USB device ID added by SVN r150701 in the CDC USB ethernet driver.
Since then, the FreeBSD USB stack has got proper USB RNDIS support.

PR:		254345
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-04-22 12:23:36 +02:00
Ka Ho Ng
7c707c7c25 __FreeBSD_version: update the references to the doc tree
Update the reference of which file to update in the doc tree when
bumping __FreeBSD_version.

This change is to catch up with commit f8fed61b80 in the doc repository.

MFC after:	3 days
Approved by:	lwhsu (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29920
2021-04-22 17:36:22 +08:00
Alexander V. Chernikov
4044af03a4 Fix vtnet TCP lro panic
Differential Revision: https://reviews.freebsd.org/D29900
Reviewed by:	hps, kp
2021-04-19 17:06:34 +01:00
Warner Losh
df456a1fcf newbus: style nit (align comments)
Sponsored by:		Netflix
2021-04-21 15:37:24 -06:00
Warner Losh
1eebd6158c newbus: Optimize/Simplify kobj_class_compile_common a little
"i" is not used in this loop at all. There's no need to initialize and
increment it.

Reviewed by:		markj@
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D29898
2021-04-21 15:37:24 -06:00
John Baldwin
6a3a6fe34b riscv: Assert that SUM is not set in SSTATUS for exceptions.
Reviewed by:	mhorne
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D29764
2021-04-21 13:57:20 -07:00
John Baldwin
753bcca440 riscv: Clear SUM in SSTATUS for supervisor mode exceptions.
Previously, a page fault taken during copyin/out and related functions
would run the entire fault handler while permitting direct access to
user addresses.  This could also leak across context switches (e.g. if
the page fault handler was preempted by an interrupt or slept for disk
I/O).

To fix, clear SUM in assembly after saving the original version of
SSTATUS in the supervisor mode trapframe.

Reviewed by:	mhorne, jrtc27
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D29763
2021-04-21 13:57:04 -07:00
Mitchell Horne
c4473add1d pmcstat: fix the usage message for -t
A slight mix-up of the flags means this case isn't triggered when it
should be. Now, `pmcstat -s event -t 1234` will print the correct
error message.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-04-21 17:44:52 -03:00
Mitchell Horne
edcf9e59c3 pmcstat: set initial counter value to zero
For an infrequent event, pmcstat may report (u_long)-1 for CPUs where
the counter was never incremented. Just set this to zero, instead.

ev->ev_count is passed as the 'count' argument to pmc_allocate(3), but
this wasn't always the case.

Reviewed by:	gnn
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29887
2021-04-21 17:35:03 -03:00
Mitchell Horne
50f6c13997 pmc_allocate(3): document the count argument
This was added in b2ca2e50b9, and serves to provide an initial value
to the PMC, eliminating the need for a second syscall via pmc_set(3).

Reviewed by:	gnn, 0mp (manpages)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29885
2021-04-21 17:35:03 -03:00
Navdeep Parhar
01d74fe1ff Path MTU discovery hooks for offloaded TCP connections.
Notify the TOE driver when when an ICMP type 3 code 4 (Fragmentation
needed and DF set) message is received for an offloaded connection.
This gives the driver an opportunity to lower the path MTU for the
connection and resume transmission, much like what the kernel does for
the connections that it handles.

Reviewed by:	glebius@
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29755
2021-04-21 13:00:16 -07:00
Mark Johnston
652908599b Add required checks for unmapped mbufs in ipdivert and ipfw
Also add an M_ASSERTMAPPED() macro to verify that all mbufs in the chain
are mapped.  Use it in ipfw_nat, which operates on a chain returned by
m_megapullup().

PR:		255164
Reviewed by:	ae, gallatin
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29838
2021-04-21 15:47:05 -04:00
Michael Reifenberger
6648383803 systat: Handle SIGWINCH to properly window resizing and adjust
-swap disk stat based on new size.

Display corrupts after resizing a window.
Process SIGWINCH to redraw all window.

Submitted by:   Yoshihiro Ota ota@j.email.ne.jp
Differential Revision:  https://reviews.freebsd.org/D29337
2021-04-21 20:31:58 +02:00
Michael Reifenberger
dcc2fb3707 systat: Avoid incorrect reallocation in pigs.c
Stop free() even if kvm_getprocs as we can come back but set nprocs = 0.
Check nprocs in showpigs() to ensure not try displaying with kvm_getprocs failed.
Current code can have pt with non-null after kvm_getprocs() failure.

Replace to realloc for simpler operations.

Submitted by:	Yoshihiro Ota ota@j.email.ne.jp
Reviewed by:	mckusick@
Differential Revision:	https://reviews.freebsd.org/D29303
2021-04-21 20:09:21 +02:00
Mateusz Guzik
9c651561a2 zfs: damage control racing .. lookups in face of mkdir/rmdir
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D29769
2021-04-21 15:25:32 +00:00
Konstantin Belousov
54f98c4dbf vn_open_vnode(): handle error when fp == NULL
If VOP_ADD_WRITECOUNT() or adv locking failed, so VOP_CLOSE() needs to
be called, we cannot use fp fo_close() when there is no fp.  This occurs
when e.g. kernel code directly calls vn_open() instead of the open(2)
syscall.

In this case, VOP_CLOSE() can be called directly, after possible lock
upgrade.

Reported by:	nvass@gmx.com
PR:	255119
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D29830
2021-04-21 18:06:51 +03:00
Edward Tomasz Napierala
45aec46246 rc: make the 'linux' script explicitly load filesystem modules
This removes a minor annoyance with Linux jails, where you often
want linux_mounts_enable="NO", yet you want those filesystems
available for mounting in jails; normally mount(8) would result
in kernel automatically loading the KLD, but this doesn't work
inside jails or chroots.

PR:		242955
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D29725
2021-04-21 12:54:37 +01:00
Toomas Soome
4ba91fa073 loader: do not output empty menu title
As we output spaces around the menu title, we should also check,
if the title is actually empty string.

PR:		255299
Submitted by:	Jose Luis Duran
Reported by:	Jose Luis Duran
MFC after:	1 week
2021-04-21 14:50:23 +03:00
Michael Reifenberger
b563ff5d4f Append Keyboard Layout specified option for using VNC.
Part one: supporting QEMU Extended Keyboard Event Message

PR:             246121
Submitted by:   koinec@yahoo.co.jp
Differential Revision: https://reviews.freebsd.org/D29430
2021-04-21 12:40:44 +02:00
Alex Richardson
67f2f67fc8 Update rtsock_l3 test after 2fe5a79425
Two of these tests now pass. Looking at Jenkins to find the first commit
where this behaviour changed indicates that
2fe5a79425 is the most likely cause.

Reviewed By:	melifaro
Differential Revision: https://reviews.freebsd.org/D28886
2021-04-21 10:58:34 +01:00
Alex Richardson
f8e57f89f3 tools/build/bootstrap-m4: regenerate after d37f81e35b
Reviewed by:	jkim
2021-04-21 10:57:51 +01:00
Alex Richardson
c6e66cbfbb usr.bin/lex: regenerate bootstrap files after d37f81e35b
Reviewed by:	jkim
2021-04-21 10:56:29 +01:00
Alex Richardson
d37f81e35b contrib/flex: Drop local __dead2 patch
Upstream flex has added a yynoreturn macro, so this diff is no longer
needed. Partially reverts r181269.

Reviewed By:	jkim
Differential Revision: https://reviews.freebsd.org/D29679
2021-04-21 10:54:59 +01:00