Commit Graph

266784 Commits

Author SHA1 Message Date
Warner Losh
445b5554bf nvmecontrol: document power command
The description of the power command is missing. While the synopsis is
present, there's no explanation. Add one.

Reviewed by:		mav, chuck
PR:			237866
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31122
2021-07-10 10:53:34 -06:00
David Chisnall
3a522ba1bc Pass the syscall number to capsicum permission-denied signals
The syscall number is stored in the same register as the syscall return
on amd64 (and possibly other architectures) and so it is impossible to
recover in the signal handler after the call has returned.  This small
tweak delivers it in the `si_value` field of the signal, which is
sufficient to catch capability violations and emulate them with a call
to a more-privileged process in the signal handler.

Approved by:	markj (mentor)

Reviewed by:	kib, bcr (manpages)

Differential Revision: https://reviews.freebsd.org/D29185
2021-07-10 17:19:52 +01:00
Martin Matuska
476ef25d32 zfs: update zfs_config.h to match current OpenZFS version (bdd11cbb9)
TBD: build with fetch(3) support for keylocation=http(s)://
2021-07-10 17:43:16 +02:00
Konstantin Belousov
fdc71fa112 amd64 pmap: unexpand the NBPDR macro definition
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-07-10 14:46:54 +03:00
Konstantin Belousov
71463a34ab amd64 mpboot.S: fix typo in comment
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-07-10 14:46:54 +03:00
Konstantin Belousov
63664df720 amd64 locore.S: add FF copyright for LA57 work
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-07-10 14:46:53 +03:00
Konstantin Belousov
9dc715230c amd64 locore.S: trim .globl list from symbols gone for long time
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-07-10 14:46:53 +03:00
Konstantin Belousov
55e63ed307 x86: use ANSI C definition style for trap_fatal
PR:	257062
Submitted by:	Vijay Sharma <vijaysh312@gmail.com>
MFC after:	1 week
2021-07-10 14:46:53 +03:00
Stefan Eßer
58080fbca0 libalias: fix divide by zero causing panic
The packet_limit can fall to 0, leading to a divide by zero abort in
the "packets % packet_limit".

An possible solution would be to apply a lower limit of 1 after the
calculation of packet_limit, but since any number modulo 1 gives 0,
the more efficient solution is to skip the modulo operation for
packet_limit <= 1.

Since this is a fix for a panic observed in stable/12, merging this
fix to stable/12 and stable/13 before expiry of the 3 day waiting
period might be justified, if it works for the reporter of the issue.

Reported by:	Karl Denninger <karl@denninger.net>
MFC after:	3 days
2021-07-10 13:08:18 +02:00
Alexander Motin
63ca9ea4f3 Use sleepq_signal(SLEEPQ_DROP) in cv_signal().
Same as wakeup_one()/wakeup_any() commit before it reduces the lock
hold time and so contention.

MFC after:	1 week
2021-07-09 20:57:58 -04:00
Mark Johnston
588c7a06df KASAN: Implement __asan_unregister_globals()
It will be called during KLD unload to unpoison the redzones following
global variables.  Otherwise, virtual address ranges previously used for
a KLD may be left tainted, triggering false positives when they are
recycled.

Reported by:	pho
Sponsored by:	The FreeBSD Foundation
2021-07-09 20:38:50 -04:00
Mark Johnston
b0dfc48684 uma: Fix a few problems with KASAN integration
- Ensure that all items returned by UMA are aligned to
  KASAN_SHADOW_SCALE (8).  This was true in practice since smaller
  alignments are not used by any consumers, but we should enforce it
  anyway.
- Use a non-zero code for marking redzones that appear naturally in
  items that are not a multiple of the scale factor in size.  Currently
  we do not modify keg layouts to force the creation of redzones.
- Use a non-zero code for marking freed per-CPU items, otherwise
  accesses of freed per-CPU items are not detected by the runtime.

Sponsored by:	The FreeBSD Foundation
2021-07-09 20:38:50 -04:00
Mark Johnston
36226163fa x86: Mark the trapframe as initialized in ipi_bitmap_handler()
Otherwise KASAN may generate false positives if the trapframe was
written into a poisoned region of the stack.

Reported by:	pho
Reported by:	syzbot+ee60455cd58e6eed20c9@syzkaller.appspotmail.com
Reported by:	syzbot+be5f9df26426ace3a00c@syzkaller.appspotmail.com
Sponsored by:	The FreeBSD Foundation
2021-07-09 20:38:50 -04:00
Mark Johnston
5d243d41b1 hwpmc: Disable KASAN in pmc_save_kernel_callchain()
As in commit 831850d8b0, this routine can trigger false positives, so
exclude it from instrumentation.

Reported by:	pho
Sponsored by:	The FreeBSD Foundation
2021-07-09 20:38:50 -04:00
Mark Johnston
f08f0ae524 amd64: Mark the trapframe as initialized in trap()
Otherwise KASAN may generate false positives if the trapframe was
written into a poisoned region of the stack.

Reported by:	pho
Sponsored by:	The FreeBSD Foundation
2021-07-09 20:38:50 -04:00
Michael Tuexen
105b68b42d sctp: Fix errno in case of association setup failures
Do not report always ETIMEDOUT, but only when appropriate. In
other cases report ECONNABORTED.

MFC after:	3 days
2021-07-09 23:19:25 +02:00
Vladimir Kondratyev
82626fef62 iichid(4): Perform bus_teardown_intr/bus_setup_intr to disable interrupts
during suspend/resume cycle. Previously used bus_generic_suspend_intr and
bus_generic_resume_intr may cause interrupt storm because of missed
interrupt acknowledges caused by blocking of intr handler.

Reported by:	J.R. Oldroyd <jr_AT_opal_DOT_com>
MFC after:	1 week
2021-07-09 22:32:59 +03:00
Gordon Bergling
c5cbef2f85 math(3): Use the .Fa macro for function arguments
.Fa is the suitable macro for functions in comparsion to the
.Ar macro, which should be used for commandline arguments.

While here, fix some mandoc warnings.

Reviewed by:	imp (earlier version)
Obtained from:	OpenBSD (in partial)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D31090
2021-07-09 19:51:44 +02:00
MIHIRA Sanpei Yoshiro
9e3761d126 arm: remove fslsdma from GENERIC
The fslsdma device requires sdma_fw, but that's not included in
GENERIC. That firmware is not in the FreeBSD tree at the moment, but
could easily be.

The license for the firmware can be found in the linux firmware repo:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=3123d78e09d2f815de4d94aa35c07b3c0469c80e
and looks to be a BSD license + no reverse engineer.

We can add this back after the firmware is imported, made a port, or
whose automatic loading can be made to happen.

Reviewed by:		imp (with ian finding the license)
PR:			237466
MFC after:		1 week
2021-07-09 11:21:40 -06:00
Warner Losh
72821668b0 stand/kmem_zalloc: panic when a M_WAITOK allocation fails
Malloc() might return NULL, in which case we will panic with a NULL
pointer deref. Make it panic when the allocation fails to preserve the
postcondtion that we never return a non-NULL value.

Reviewed by:		tsoome
PR:			249859
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31106
2021-07-09 11:21:18 -06:00
Andrew Turner
1472117a1e Support fixed size, variable location acpi resources
These have been found in some Arm ACPI tables generated by edk2, e.g.
when describing the pl011 uart on the Arm AEMv8 model.

Reviewed by:	imp, jkim
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31110
2021-07-09 01:31:19 +00:00
Michael Tuexen
ce64352a70 sctp: provide consistent stream information in case of early errors
While there, make sure the function is called correctly.

MFC after:	3 days
2021-07-09 14:16:59 +02:00
Mariusz Zaborski
24c681a7f6 grep: fix combination of quite and count flag
When the quite (-q) flag is provided, we don't expect any output.
Currently, the behavior is broken:
$ grep -cq flag util.c
1

$ grep -cs flag util.c
55

First of all, we print a number to stdout. Secondly, it just returns
0 or 1 (which is unexpected). GNU grep with c and q flags doesn't
print anything.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31108
2021-07-09 14:09:14 +02:00
Michael Tuexen
84992a3251 sctp: provide sac_error also for ABORT chunk being sent
Thanks to Florent Castelli for bringing this issue up for the
userland stack and providing an initial patch.

MFC:		3 days
2021-07-09 13:46:27 +02:00
Kristof Provost
3fc12ae042 pf: bound DIOCGETSTATESV2 memory use
Rather than allocating however much memory userspace asks for we only
allocate enough for a handful of states, and copy to userspace for each
completed row.
We start out with enough space for 16 states (per row), but grow that as
required. In most configurations we expect at most a handful of states
per row (more than that would have other negative effects on packet
processing performance).

Reviewed by:	mjg
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31111
2021-07-09 10:30:02 +02:00
Kristof Provost
be70c7a50d libpfctl: migrate to DIOCGETSTATESV2
Stop using the *NV version to retrieve states, as its performance is
unacceptably bad.

For 1,000,000 states the nvlist version needed ~100 seconds to retrieve
the states, the new version needs ~3 seconds.

Reviewed by:	mjg
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31098
2021-07-09 10:29:57 +02:00
Kristof Provost
c6bf20a2a4 pf: add DIOCGETSTATESV2
Add a new version of the DIOCGETSTATES call, which extends the struct to
include the original interface information.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31097
2021-07-09 10:29:53 +02:00
Warner Losh
a65fe39d54 UPDATING: fix typo
The correct version is 20210215, not 20120215 :(

Reported by:		Yasuhiro Kimura
Fixes:			3f7b23177f
Sponsored by:		Netflix
2021-07-08 23:42:15 -06:00
Warner Losh
3f7b23177f UPDATING: Note awk upgraded to upstream one-true-awk 20210215.
The updating entry can be used for release notes. I'll merge this to
stable/12 and stable/13 to make sure it gets into thier release notes.

Relnotes:		yes
Sponsored by:		Netflix
2021-07-08 23:16:06 -06:00
Warner Losh
f68a53dba9 awk: Reduce diffs with upstream to almost nothing.
In the merge of 20210215, I left two merge conflicts #if 0'd by mistake
to check later rather than resolve them as part of the merge.  This code
turns out to be from the original one-true-awk import and not FreeBSD
specific, so remove them.

Remove a extra definition of HAT.

Remove a stylistic change that also appears to be a mismerge along the
way.

Remove FREEBSD-upgrade. Nobody has updated it since the original 2007
cvs import. It talks about old CVS branches that never made it into svn,
let alone git. New imports will follow the standard practices now, so
there's nothing left to document.

Move README to README.md and copy the README.md from upstream over.

This leaves just the $FreeBSD$ lines (which remain for the stable/12
merge) and the strcoll part of ru@'s r201989/d98dd8e5f94c as the only
diffs with upstream. FreeBSD also still has its own man page, which I
don't plan on changing. Once this commit is merged to stable/12, I plan
no further merges to stable/12. Sometime after that I'll remove the
$FreeBSD$ lines to reduce the diffs even more (though i want to make
sure plans won't change first). I also plan to talk to upstream about
this change...

MFC After:		2 weeks
Sponsored by:		Netflix
2021-07-08 23:05:13 -06:00
Rick Macklem
bd597b8149 UPDATING: Add an entry for commit 1e0a518d65 2021-07-08 18:30:24 -07:00
Rick Macklem
1e0a518d65 nfscl: Add a Linux compatible "nconnect" mount option
Linux has had an "nconnect" NFS mount option for some time.
It specifies that N (up to 16) TCP connections are to created for a mount,
instead of just one TCP connection.

A discussion on freebsd-net@ indicated that this could improve
client<-->server network bandwidth, if either the client or server
have one of the following:
- multiple network ports aggregated to-gether with lagg/lacp.
- a fast NIC that is using multiple queues
It does result in using more IP port#s and might increase server
peak load for a client.

One difference from the Linux implementation is that this implementation
uses the first TCP connection for all RPCs composed of small messages
and uses the additional TCP connections for RPCs that normally have
large messages (Read/Readdir/Write).  The Linux implementation spreads
all RPCs across all TCP connections in a round robin fashion, whereas
this implementation spreads Read/Readdir/Write across the additional
TCP connections in a round robin fashion.

Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30970
2021-07-08 17:39:04 -07:00
Warner Losh
25a66f1fb1 nanobsd: remove sparc64 embedded example
Remove the qemu sparc64 example. It was only ever compile tested since
qemu had issues booting FreeBSD/sparc64. Also remove obsolete info about
armv5 configs removed long ago.

Sponsored by:		Netflix
2021-07-08 17:56:54 -06:00
Warner Losh
5549c6a62f devmatch: don't announce autoloading so much
devmatch rc script would announce it was loading a module multiple
times. It used kldload -n so it really wasn't loading it that many
times, but the message is confusing. Use kldstat to see if we need to
load the module before saying we do. This fixes the vast majority of the
problems. It may be possible to race devmatch with a user invocation and
devd, though quite hard. In that case we'll announce things twice, but
still only load it once. No attempt is made to fix this.

PR:			232782
MFC After:		2 weeks
Sponsored by:		Netflix
2021-07-08 15:22:22 -06:00
Warner Losh
b29ebb9c65 devmatch: Be tolerant of .ko being present.
We document that we did not need .ko on the module names in
devmatch_blocklist, but we really needed them. Keep the documentation
the same, but strip the .ko when we need to use the names so you can
specify either.

PR:			256240
MFC After:		2 weeks
Sponsored by:		Netflix
2021-07-08 15:22:22 -06:00
Bjoern A. Zeeb
bf3a385217 fan53555: attach to build and switch from syr827
Rather than extending syr827 for syr828 (as initially done in D31103)
switch to the Fairchild Semiconductor Corporation fan53555 implementation
which is in-tree but was not attached to the build.  The fan53555
implementation also supports syr827/syr8278 already. [1]
Update NOTES and the arm64 GENERIC configuration for the switch.
syr827 for now stays in the tree but is not used by any
kernel configuration.

Suggested by:	mmel [1]
Reviewed by:	mmel, manu
Differential Revision: https://reviews.freebsd.org/D31112
2021-07-08 20:17:45 +00:00
Luiz Otavio O Souza
c5dd8bac0b dummynet: reduce console spam
Only print this warning when boot verbose is enabled.
This can get pretty annoying (and useless) in some systems.

Reviewed by:	kp
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-08 20:25:05 +02:00
Kristof Provost
3464105282 pf: pf_killstates() never fails, so remove the return value
Suggested by:	mjg
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-08 18:56:29 +02:00
Alan Somers
61631b24a1 iostat: fix rounding errors in iostat -x
Better to round numbers instead of flooring them.

MFC after:	3 weeks
Sponsored by:	Axcient
2021-07-08 10:16:32 -06:00
Thomas Steen Rasmussen
28f47a199c pf: fallback if $pf_rules fails to load
Support loading a default pf ruleset in case of invalid pf.conf.

If no pf rules are loaded pf will pass/allow all traffic, assuming the
kernel is compiled without PF_DEFAULT_TO_DROP, as is the case in
GENERIC.

In other words: if there's a typo in the main pf_rules we would allow
all traffic. The new default rules minimise the impact of this.

If $pf_program (i.e. pfctl) fails to set $pf_fules and
$pf_fallback_rules_enable is YES we will load $pf_fallback_rules_file if
set, or $pf_fallback_rules.

$pf_fallback_rules can include multiple rules, for example to permit
traffic on a management interface.

$pf_fallback_rules_enable defaults to "NO", preserving historic behaviour.

man page changes by ceri@.

PR:		256410
Reviewed by:	donner, kp
Sponsored by:	semaphor.dk
Differential Revision:	https://reviews.freebsd.org/D30791
2021-07-08 14:22:04 +02:00
Mateusz Guzik
19d6e29b87 pf: add pf_find_state_all_exists
Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-08 14:00:55 +00:00
Mateusz Guzik
1e67e3109d setkey: drop an unused argument from postproc 2021-07-08 14:00:55 +00:00
Mateusz Guzik
b29817874d setkey: fix several warnings popping up when compiling without WARNS=1 2021-07-08 14:00:55 +00:00
Mateusz Guzik
e0c0612d9b setkey: ansify 2021-07-08 14:00:55 +00:00
Andrew Turner
c0edde3021 Fix the name of the arm64 SCTLR_E0E register
The character between the E's was the letter O, however in the Arm
Documentation and XML the character is the number 0 (zero).

Sponsored by:	The FreeBSD Foundation
2021-07-07 23:18:04 +00:00
Randall Stewart
7312e4e5cf tcp: Fix 32 bit platform breakage
This fixes the incorrect use of a sysctl add to u64. It
was for a useconds time, but on 32 bit platforms its
not a u64. Instead use the long directive.

Reviewed by: tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D31107
2021-07-08 08:16:45 -04:00
Kristof Provost
fa96701c8a pf: Handle errors returned by pf_killstates()
Happily this wasn't a real bug, because pf_killstates() never fails, but
we should check the return value anyway, in case it does ever start
returning errors.

Reported by:	clang --analyze
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-08 10:32:42 +02:00
Kristof Provost
8cceacc0f1 pf: Remove unneeded NULL check
pidx is never NULL, and is used unconditionally later on in the
function.
Add an assertion, as documentation for the requirement to provide an idx
pointer.

Reported by:	clang --analyze
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-08 10:32:33 +02:00
Kristof Provost
211cddf9e3 pf: rename pf_state to pf_kstate
Indicate that this is a kernel-only structure, and make it easier to
distinguish from others used to communicate with userspace.

Reviewed by:	mjg
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31096
2021-07-08 10:31:43 +02:00
Michal Meloun
e88c3b1b02 intrng: remove now redundant shadow variable.
Should not be a functional change.

Submitted by: 	ehem_freebsd@m5p.com
Discussed in:	https://reviews.freebsd.org/D29310
MFC after:	4 weeks
2021-07-08 08:46:41 +02:00