Commit Graph

253694 Commits

Author SHA1 Message Date
Rick Macklem
2ffad162f3 Modify mountd.c so that it does not always malloc 4K for the map credentials.
r362163 upgraded mountd so that it could handle MAX_NGROUPS
groups for the anonymous user credentials (the ones provided by
-maproot and -mapall exports options).
The problem is that this resulted in every export structure growing by
about 4Kbytes, because the cr_groups field went from 16->MAX_NGROUPS.

This patch fixes this by only including a small 32 element cr_groups in the
structure and then malloc()'ng cr_groups when a larger one is needed.
The value of SMALLNGROUPS is arbitrarily set to 32, assuming most users
used by -maproot or -mapall will be in <= 32 groups.

Reviewed by:	kib, freqlabs
Differential Revision:	https://reviews.freebsd.org/D26521
2020-10-10 00:01:40 +00:00
Bryan Drewery
c2c6fb90e0 Use unlocked page lookup for inmem() to avoid object lock contention
Reviewed By:	kib, markj
Submitted by:	mlaier
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D26653
2020-10-09 23:49:42 +00:00
Navdeep Parhar
31deb3cc76 cxgbe(4): More fixes for the T6 FCS error counter.
r365732 was the first attempt to get an accurate count but it was
writing to some read-only registers to clear them and that obviously
didn't work.  Instead, note the counter's value when it is supposed to
be cleared and subtract it from future readings.

dev.<port>.stats.rx_fcs_error should not be serviced from the MPS
register for T6.

The stats.* sysctls should all use T5_PORT_REG for T5 and above.  This
must have been missed in the initial T5 support years ago.  Fix it while
here.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2020-10-09 22:23:39 +00:00
Mateusz Guzik
deb1339f3f vfs: fix a panic when truncating comming from copy_file_range
Truncating requires an exclusive lock, but it was not taken if the
filesystem indicates support for shared writes. This only concerns
ZFS.

In particular fixes cp of files which have trailing holes.

Reported by:	bdrewery
2020-10-09 20:31:42 +00:00
John Baldwin
7e8bd70cff Don't invoke semunload() if seminit() fails during MOD_LOAD.
The module handler code invokes a MOD_UNLOAD event immediately if
MOD_LOAD fails.  The result was that if seminit() failed, semunload()
was invoked twice.  semunload() is not idempotent however and would
try to remove it's process_exit eventhandler twice resulting in a
panic.

Reviewed by:	kib, markj
Obtained from:	CheriBSD
MFC after:	1 month
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26696
2020-10-09 20:20:42 +00:00
Gordon Bergling
3d265fce43 Fix a few mandoc issues
- skipping paragraph macro: Pp after Sh
- sections out of conventional order: Sh EXAMPLES
- whitespace at end of input line
- normalizing date format
2020-10-09 19:12:44 +00:00
Mateusz Guzik
eb88fed446 cache: fix vexec panic when racing against vgone
Use of dead_vnodeops would result in a panic instead of returning the intended
EOPNOTSUPP error.

While here make sure to abort, not just try to return a partial result.
The former allows the regular lookup to restart from scratch, while the latter
makes it stuck with an unusable vnode.

Reported by:	kevans
2020-10-09 19:10:00 +00:00
Gordon Bergling
b56d7f9663 bpf(4): Update the man page to reflect reality
PR:		131918
Submitted by:	guy at alum dot mit dot edu
Reviewed by:	gnn, gbe
Approved by:	gnn
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25993
2020-10-09 15:50:50 +00:00
Warner Losh
6f6f0f286b Remove gratuitous use of '' around arguments
There's no need to use ' here, so remove it. This use causes no
problems, but is a bad example.
2020-10-09 15:45:34 +00:00
Warner Losh
df9e12ca3d Avoid using single quotes in arguments to logger.
Single quotes interfere with the workaround put in with r335753 and
aren't necessary in this case. I believe that all the underling issues
with r335753 have been corrected, but need to do more extensive
followup before reverting it as a bad idea.

PR: 240411
MFC After: 2 days (to give it time to get into 12.2)
2020-10-09 15:29:05 +00:00
Mark Johnston
6b43126f81 col(1): Fix a couple of bugs
- When flushing extra lines after all input has been processed, make
  sure that local state is reinitialized correctly.
- When -f is specified, make sure to end output with a full newline.
- Fix some style issues and update comments.
- Add some regression tests.

PR:		249308
Submitted by:	Yang Zhong <yzhong@freebsdfoundation.org>
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D26536
2020-10-09 15:27:37 +00:00
Mark Johnston
b0eefff78b syslogd: Avoid trimming host names in RFC 5424 mode
RFC 5424 says that implementations should log hostnames in FQDN
format.  Only trim host names in RFC 3164 mode.

PR:		250014
Submitted by:	Dmitry Wagin <dmitry.wagin@ya.ru>
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D26644
2020-10-09 15:19:29 +00:00
Gordon Bergling
812b09037d Fix a few mandoc issues
- whitespace at end of input line
- skipping paragraph macro: Pp at the end of Sh
- new sentence, new line
- consider using OS macro: Fx
- AUTHORS section without An macro
- skipping paragraph macro: Pp before Ss
2020-10-09 15:14:19 +00:00
Mitchell Horne
eff4c46e28 RISC-V LINT kernel config
Create the RISC-V NOTES and LINT files. As of r366559, LINT configs are
no longer generated but checked in to the tree.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D26502
2020-10-09 14:45:41 +00:00
Richard Scheffenegger
bfabdade5c Add DSCP support for network QoS to iscsi initiator.
Allow the DSCP codepoint also to be configurable
for the traffic in the direction from the initiator
to the target, such that writes and any requests
are also treated in the appropriate QoS class.

Reviewed by:	mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26714
2020-10-09 14:33:09 +00:00
Gordon Bergling
6d6d6c3603 Fix a few mandoc issues
- no blank before trailing delimiter
- whitespace at end of input line
- sections out of conventional order
- normalizing date format
- AUTHORS section without An macro
2020-10-09 14:03:45 +00:00
Ruslan Bukin
72479f6bf9 Add iommu_get_dev_ctx() helper that allows to instantiate an iommu context
for a given device_t.

Submitted by:	andrew
Reviewed by:	kib
Sponsored by:	DARPA, AFRL
2020-10-09 13:11:14 +00:00
Richard Scheffenegger
4b72ae16ed Stop sending tiny new data segments during SACK recovery
Consider the currently in-use TCP options when
calculating the amount of new data to be injected during
SACK loss recovery. That addresses the effect that very small
(new) segments could be injected on partial ACKs while
still performing a SACK loss recovery.

Reported by:	Liang Tian
Reviewed by:	tuexen, chengc_netapp.com
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26446
2020-10-09 12:44:56 +00:00
Richard Scheffenegger
868aabb470 Add IP(V6)_VLAN_PCP to set 802.1 priority per-flow.
This adds a new IP_PROTO / IPV6_PROTO setsockopt (getsockopt)
option IP(V6)_VLAN_PCP, which can be set to -1 (interface
default), or explicitly to any priority between 0 and 7.

Note that for untagged traffic, explicitly adding a
priority will insert a special 801.1Q vlan header with
vlan ID = 0 to carry the priority setting

Reviewed by:	gallatin, rrs
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26409
2020-10-09 12:06:43 +00:00
Andrey V. Elsukov
39aff95fe2 Fix EINVAL message when CPU binding information is requested for IRQ.
`cpuset -g -x N` along with requested information always prints
message `cpuset: getdomain: Invalid argument'. The EINVAL is returned
from kern_cpuset_getdomain(), since it doesn't expect CPU_LEVEL_WHICH
and CPU_WHICH_IRQ parameters.

To fix the error, do not call cpuset_getdomain() when `-x' is specified.

MFC after:	1 week
2020-10-09 11:24:19 +00:00
Richard Scheffenegger
5432120028 Extend netstat to display TCP stack and detailed congestion state (2)
Extend netstat to display TCP stack and detailed congestion state

Adding the "-c" option used to show detailed per-connection
congestion control state for TCP sessions.

This is one summary patch, which adds the relevant variables into
xtcpcb. As previous "spare" space is used, these changes are ABI
compatible.

Reviewed by:	tuexen
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26518
2020-10-09 10:55:19 +00:00
Richard Scheffenegger
0e5e35e322 Extend netstat to display TCP stack and detailed congestion state
Adding the "-c" option used to show detailed per-connection
congestion control state for TCP sessions.

This is one summary patch, which adds the relevant variables into
xtcpcb. As previous "spare" space is used, these changes are ABI
compatible.

Reviewed by:	tuexen
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26518
2020-10-09 10:07:41 +00:00
Jung-uk Kim
f15e9afb1f MFV: r366539
Merge ACPICA 20200925.
2020-10-09 05:27:02 +00:00
Li-Wen Hsu
0d948bff71 Correct the primary to find(1)
Sponsored by:	The FreeBSD Foundation
2020-10-09 04:03:57 +00:00
Warner Losh
3ae49a035a Remove now-unused files
makeLINT.mk isn't needed or used anymore, remove it and all the files
it uses.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540
2020-10-09 01:48:21 +00:00
Warner Losh
7e46dafa58 Create in-tree LINT files
Now that config(8) has supported include for 19 years, transition to
including the NOTES files. include support didn't exist at the time,
nor did the envvar stuff recently added. Now that it does, eliminate
the building of LINT files by just including everything you need.

Note: This may cause conflicts with updating in some cases.
	find sys -name LINT\* -rm
is suggested across this commit to remove the generated LINT
files.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540
2020-10-09 01:48:14 +00:00
Rick Macklem
19fe23fa2b Make vn_generic_copy_file_range() interruptible via a signal.
Without this patch, when vn_generic_copy_file_range() is
doing a large copy, it will remain in the function for a
considerable amount of time, delaying handling of any
outstanding signals until the copy completes.

This patch adds checks for signals that need to be
processed after each successful data copy cycle.
When sig_intr() returns non-zero, vn_generic_copy_file_range()
will return.
The check "if (len < savlen)" ensures that some data
has been copied, so that progress will be made.

Note that, since copy_file_range(2) is allowed to
return fewer bytes copied than requested, it
will never return EINTR/ERESTART when sig_intr()
returns non-zero.

Reviewed by:	kib, asomers
Differential Revision:	https://reviews.freebsd.org/D26620
2020-10-09 01:04:28 +00:00
Warner Losh
a21d9b36a1 Stop ignoring makeLINT generated files
We're going to check these files in shortly since we don't need to
generate them anymore. Generated files cause issues for different work
flows anyway.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540
2020-10-09 00:27:45 +00:00
Warner Losh
bf0cf8dfba Eliminate building LINT makefiles
LINT config files are about to be checked in directly. Eliminate
building them by hand here from NOTES files.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D26540
2020-10-09 00:27:40 +00:00
Warner Losh
c6d56081c9 Initial support for implementing the bootXXX.efi workaround
Too many version of UEFI firmware (so far only confirmed on amd64)
don't really support efibootmgr selection of boot. That's the most
reliable, when it works, since there's no guesswork. However, many do
not save, unmolested, the variables that efibootmgr sets, so as a
fallback we also install loader.efi as bootXXX.efi (where XXX is
either aa64 or x64) if it doesn't already exist in /efi/boot on the
ESP. The standard only defines this for removable devices, but it's
almost ubiquitously used as a fallback. Many BIOSes implement a drive
selection feature that takes over the efibootmgr protocol, rendinering
it useless (either generally, or for those vendors not on the short
list). bootxxx.efi works around this. However, we don't install it
unconditionally there, as that breaks some popular multi-boot setups.

MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D26428
2020-10-09 00:16:26 +00:00
Konstantin Belousov
42f96162c3 vm_page_dump_index_to_pa(): Add braces to the expression involving + and &.
The precedence of the '&' operator is less than of '+'.  Added braces
do change the order of evaluation into the natural one, in my opinion.
On the other hand, the value of the expression should not change since
all elements should have page-aligned values.

This fixes a gcc warning reported.

Reported by:	adrian
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2020-10-08 22:46:15 +00:00
Konstantin Belousov
e1ef4c29a3 Do not leak B_BARRIER.
Normally when a buffer with B_BARRIER is written, the flag is cleared
by g_vfs_strategy() when creating bio.  But in some cases FFS buffer
might not reach g_vfs_strategy(), for instance when copy-on-write
reports an error like ENOSPC.  In this case buffer is returned to
dirty queue and might be written later by other means.  Among then
bdwrite() reasonably asserts that B_BARRIER is not set.

In fact, the only current use of B_BARRIER is for lazy inode block
initialization, where write of the new inode block is fenced against
cylinder group write to mark inode as used.  The situation could be
seen that we break dependency by updating cg without written out
inode.  Practically since CoW was not able to find space for a copy of
inode block, for the same reason cg group block write should fail.

Reported by:	pho
Discussed with:	chs, imp, mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D26511
2020-10-08 22:41:02 +00:00
Konstantin Belousov
203dda8a63 sig_intr(9): return early if AST is not scheduled.
Check td_flags for relevant AST requests lock-less.  This opens the
race slightly wider where sig_intr() returns false negative, but might
be it is worth it.

Requested by:	mjg
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2020-10-08 22:34:34 +00:00
Konstantin Belousov
4ea4966009 Do not allow to use O_BENEATH as an oracle.
Specifically, if lookup() returned any error and the topping directory
was not latched, which means that (non-existent) path did not returned
to the topping location, give ENOTCAPABLE a priority over the lookup()
error.

PR:	249960
Reviewed by:	emaste, ngie
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D26695
2020-10-08 22:31:11 +00:00
Alfredo Dal'Ava Junior
9470013f5a [PowerPC] add machdep.uprintf_signal sysctl
Add support for sysctl 'machdep.uprintf_signal' that prints debugging
information on trap signal.

Reviewed by:	jhibbits, luporl, bdragon
Sponsored by:	Eldorado Research Institute (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D26004
2020-10-08 22:00:31 +00:00
Warner Losh
8e82f10172 timer_restore is now unused, remove it
apm was the only consumer of timer_restore. Now that it's gone, this
can be removed.
2020-10-08 20:56:11 +00:00
Warner Losh
8c576a279e Remove APM BIOS support
APM BIOS was relevant only to early laptops (approximately P166 or
P200 and slower). These have not been relevant for a long time, and
this code has been untested for a long time (as far as I can
tell). The APM compat code in ACPI and the apm(8) command is not being
retired. Both of these items are still in use (apm(8) is more
scriptable than the replacement acpiconf, for the most part). This has
been commented out of i386 GENERIC since 2002. This code is not
relevant to any other port.

Discussed on: arch@
2020-10-08 20:56:06 +00:00
Warner Losh
28942db891 Remove apm screen saver.
APM BIOS support is about to be removed. Remove the apm screen saver
and its module. They are about to be irrelevant.
2020-10-08 20:56:00 +00:00
Warner Losh
1a6947fb00 Remove apm module
The apm code is about to be removed. Remove the module since it's
about to be useless.
2020-10-08 20:55:55 +00:00
Mitchell Horne
841dad02e9 Fix a loop condition
The correct way to identify the end of the metadata is two adjacent
entries set to zero/MODINFO_END. I made a typo and this was checking the
first entry twice.

Reported by:	rpokala
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
2020-10-08 18:29:17 +00:00
Mitchell Horne
22e6a67086 Add a routine to dump boot metadata
The boot metadata (also referred to as modinfo, or preload metadata)
provides information about the size and location of the kernel,
pre-loaded modules, and other metadata (e.g. the EFI framebuffer) to be
consumed during by the kernel during early boot. It is encoded as a
series of type-length-value entries and is usually constructed by
loader(8) and passed to the kernel. It is also faked on some
architectures when booted by other means.

Although much of the module information is available via kldstat(8),
there is no easy way to debug the metadata in its entirety. Add some
routines to parse this data and allow it to be printed to the console
during early boot or output via a sysctl.

Since the output can be lengthly, printing to the console is gated
behind the debug.dump_modinfo_at_boot kenv variable as well as the
BOOTVERBOSE flag. The sysctl to print the metadata is named
debug.dump_modinfo.

Reviewed by:	tsoome
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26687
2020-10-08 18:02:05 +00:00
Warner Losh
7eb9f7558c Race in 32-bit fixed
Use install insteald of install.sh for 32-bit builds to fight races there.

Reviewed by: markj
2020-10-08 17:30:05 +00:00
Jung-uk Kim
e09636e66f Import ACPICA 20200925. 2020-10-08 16:44:28 +00:00
Pawel Biernacki
9ef9175912 [pf] /etc/rc.d/pf should REQUIRE routing
When a system with pf_enable="YES" in /etc/rc.conf uses hostnames in
/etc/pf.conf, these hostnames cannot be resolved via external nameservers
because the default route is not yet set. This results in an empty
(all open) ruleset.

Since r195026 already put netif back to REQUIRE, this change does not affect
the issue that the firewall should rather have been setup before any
network traffic can occur.

PR:		211928
Submitted by:	Robert Schulze
Reported by:	Robert Schulze
Tested by:	Mateusz Kwiatkowski
No objections from:	kp
MFC after:	3 days
2020-10-08 11:45:10 +00:00
Hans Petter Selasky
c3a38d6c91 Try a bit harder to get the USB device descriptor in case the initial read fails.
MFC after:		1 week
Sponsored by:		Mellanox Technologies // NVIDIA Networking
2020-10-08 11:30:22 +00:00
Hans Petter Selasky
eccb214897 The ethernet header structure is read-only. Add const keyword.
(This is a diff reduction towards D26254)

MFC after:		1 week
Sponsored by:		Mellanox Technologies // NVIDIA Networking
2020-10-08 11:25:19 +00:00
Edward Tomasz Napierala
5319fa1b3e Remove yet another useless assignment, adding a KASSERT just in case.
Reviewed by:	kp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26698
2020-10-08 11:04:32 +00:00
Hans Petter Selasky
d6dbbdea20 Allow evdev's rcpt_mask and sysmouse_t_axis parameters to be specified in
/boot/loader.conf .

MFC after:		1 week
Sponsored by:		Mellanox Technologies // NVIDIA Networking
2020-10-08 10:59:49 +00:00
Navdeep Parhar
77af2b2c85 cxgbe(4): knobs to drop various kinds of undesirable frames on ingress.
These kind of drops come for free in the sense that they do not use the
filter TCAM or any other resource that wouldn't normally be used during
rx.  Frames dropped by the hardware get counted in the MAC's rx stats
but are not delivered to the driver.

hw.cxgbe.attack_filter
Set to 1 to enable the "attack filter".  Default is 0.  The attack
filter will drop an incoming frame if any of these conditions is true:
src ip/ip6 == dst ip/ip6; tcp and src/dst ip is not unicast; src/dst ip
is loopback (127.x.y.z); src ip6 is not unicast; src/dst ip6 is loopback
(::1/128) or unspecified (::/128); tcp and src/dst ip6 is mcast
(ff00::/8).

hw.cxgbe.drop_ip_fragments
Set to 1 to drop all incoming IP fragments.  Default is 0.  Note that
this drops valid frames.

hw.cxgbe.drop_pkts_with_l2_errors
Set to 1 to drop incoming frames with Layer 2 length or checksum errors.
Default is 1.

hw.cxgbe.drop_pkts_with_l3_errors
Set to 1 to drop incoming frames with IP version, length, or checksum
errors.  Default is 0.

hw.cxgbe.drop_pkts_with_l4_errors
Set to 1 to drop incoming frames with Layer 4 length, checksum, or other
errors.  Default is 0.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2020-10-08 10:00:13 +00:00
Philip Paeps
12a899b632 Import tzdata 2020b
Changes: https://github.com/eggert/tz/blob/2020b/NEWS

MFC after:	3 days
2020-10-08 00:35:36 +00:00