]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoRevert "Pass the syscall number to capsicum permission-denied signals"
David Chisnall [Sat, 10 Jul 2021 19:25:38 +0000 (20:25 +0100)]
Revert "Pass the syscall number to capsicum permission-denied signals"

This broke the i386 build.

This reverts commit 3a522ba1bc852c3d4660a4fa32e4a94999d09a47.

2 years agoFactor out repeated code in the USB controller drivers to avoid bugs
Hans Petter Selasky [Sat, 10 Jul 2021 16:17:51 +0000 (18:17 +0200)]
Factor out repeated code in the USB controller drivers to avoid bugs
computing the same isochronous start frame number over and over again.

PR: 257082
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoMake sure the avr32dci_odevd structure is used.
Hans Petter Selasky [Sat, 10 Jul 2021 16:13:21 +0000 (18:13 +0200)]
Make sure the avr32dci_odevd structure is used.
This fixes a compilation error.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoMake sure the XHCI driver obeys the isochronous scheduling threshold value
Hans Petter Selasky [Sat, 10 Jul 2021 16:09:56 +0000 (18:09 +0200)]
Make sure the XHCI driver obeys the isochronous scheduling threshold value
as given by the XHCI hardware parameters to avoid scheduling isochronous
transfers too early.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoLet the xhci_hw_root structure span exactly XHCI_PAGE_SIZE bytes by increasing
Hans Petter Selasky [Sat, 10 Jul 2021 12:14:11 +0000 (14:14 +0200)]
Let the xhci_hw_root structure span exactly XHCI_PAGE_SIZE bytes by increasing
the number of completion event TRBs. This avoids wasting memory.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agomk: LZMA_SUPPORT is unused
Warner Losh [Sat, 10 Jul 2021 16:52:12 +0000 (10:52 -0600)]
mk: LZMA_SUPPORT is unused

Retire LZMA_SUPPORT. It's unused since r332995.

Reviewed by: delphij
PR: 244302
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31088

2 years agonvmecontrol: document power command
Warner Losh [Sat, 10 Jul 2021 16:51:15 +0000 (10:51 -0600)]
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

2 years agoPass the syscall number to capsicum permission-denied signals
David Chisnall [Sat, 10 Jul 2021 16:19:52 +0000 (17:19 +0100)]
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

2 years agozfs: update zfs_config.h to match current OpenZFS version (bdd11cbb9)
Martin Matuska [Sat, 10 Jul 2021 14:46:21 +0000 (16:46 +0200)]
zfs: update zfs_config.h to match current OpenZFS version (bdd11cbb9)

TBD: build with fetch(3) support for keylocation=http(s)://

2 years agoamd64 pmap: unexpand the NBPDR macro definition
Konstantin Belousov [Sat, 10 Jul 2021 11:07:41 +0000 (14:07 +0300)]
amd64 pmap: unexpand the NBPDR macro definition

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoamd64 mpboot.S: fix typo in comment
Konstantin Belousov [Sat, 10 Jul 2021 11:06:44 +0000 (14:06 +0300)]
amd64 mpboot.S: fix typo in comment

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoamd64 locore.S: add FF copyright for LA57 work
Konstantin Belousov [Sat, 10 Jul 2021 11:05:19 +0000 (14:05 +0300)]
amd64 locore.S: add FF copyright for LA57 work

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoamd64 locore.S: trim .globl list from symbols gone for long time
Konstantin Belousov [Sat, 10 Jul 2021 11:04:31 +0000 (14:04 +0300)]
amd64 locore.S: trim .globl list from symbols gone for long time

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agox86: use ANSI C definition style for trap_fatal
Konstantin Belousov [Sat, 10 Jul 2021 10:59:32 +0000 (13:59 +0300)]
x86: use ANSI C definition style for trap_fatal

PR: 257062
Submitted by: Vijay Sharma <vijaysh312@gmail.com>
MFC after: 1 week

2 years agolibalias: fix divide by zero causing panic
Stefan Eßer [Sat, 10 Jul 2021 11:00:56 +0000 (13:00 +0200)]
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

2 years agoUse sleepq_signal(SLEEPQ_DROP) in cv_signal().
Alexander Motin [Sat, 10 Jul 2021 00:52:40 +0000 (20:52 -0400)]
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

2 years agoKASAN: Implement __asan_unregister_globals()
Mark Johnston [Sat, 10 Jul 2021 00:38:28 +0000 (20:38 -0400)]
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

2 years agouma: Fix a few problems with KASAN integration
Mark Johnston [Sat, 10 Jul 2021 00:38:21 +0000 (20:38 -0400)]
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

2 years agox86: Mark the trapframe as initialized in ipi_bitmap_handler()
Mark Johnston [Sat, 10 Jul 2021 00:38:18 +0000 (20:38 -0400)]
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

2 years agohwpmc: Disable KASAN in pmc_save_kernel_callchain()
Mark Johnston [Sat, 10 Jul 2021 00:38:11 +0000 (20:38 -0400)]
hwpmc: Disable KASAN in pmc_save_kernel_callchain()

As in commit 831850d8b087, this routine can trigger false positives, so
exclude it from instrumentation.

Reported by: pho
Sponsored by: The FreeBSD Foundation

2 years agoamd64: Mark the trapframe as initialized in trap()
Mark Johnston [Sat, 10 Jul 2021 00:38:03 +0000 (20:38 -0400)]
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

2 years agosctp: Fix errno in case of association setup failures
Michael Tuexen [Fri, 9 Jul 2021 21:17:35 +0000 (23:17 +0200)]
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

2 years agoiichid(4): Perform bus_teardown_intr/bus_setup_intr to disable interrupts
Vladimir Kondratyev [Fri, 9 Jul 2021 19:32:59 +0000 (22:32 +0300)]
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

2 years agomath(3): Use the .Fa macro for function arguments
Gordon Bergling [Fri, 9 Jul 2021 17:51:44 +0000 (19:51 +0200)]
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

2 years agoarm: remove fslsdma from GENERIC
MIHIRA Sanpei Yoshiro [Fri, 9 Jul 2021 17:12:39 +0000 (11:12 -0600)]
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

2 years agostand/kmem_zalloc: panic when a M_WAITOK allocation fails
Warner Losh [Fri, 9 Jul 2021 17:21:18 +0000 (11:21 -0600)]
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

2 years agoSupport fixed size, variable location acpi resources
Andrew Turner [Thu, 8 Jul 2021 15:25:38 +0000 (15:25 +0000)]
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

2 years agosctp: provide consistent stream information in case of early errors
Michael Tuexen [Fri, 9 Jul 2021 12:15:22 +0000 (14:15 +0200)]
sctp: provide consistent stream information in case of early errors

While there, make sure the function is called correctly.

MFC after: 3 days

2 years agogrep: fix combination of quite and count flag
Mariusz Zaborski [Fri, 9 Jul 2021 12:09:14 +0000 (14:09 +0200)]
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

2 years agosctp: provide sac_error also for ABORT chunk being sent
Michael Tuexen [Fri, 9 Jul 2021 11:46:27 +0000 (13:46 +0200)]
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

2 years agopf: bound DIOCGETSTATESV2 memory use
Kristof Provost [Thu, 8 Jul 2021 13:01:19 +0000 (15:01 +0200)]
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

2 years agolibpfctl: migrate to DIOCGETSTATESV2
Kristof Provost [Tue, 6 Jul 2021 11:05:19 +0000 (13:05 +0200)]
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

2 years agopf: add DIOCGETSTATESV2
Kristof Provost [Tue, 6 Jul 2021 10:12:12 +0000 (12:12 +0200)]
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

2 years agoUPDATING: fix typo
Warner Losh [Fri, 9 Jul 2021 05:42:15 +0000 (23:42 -0600)]
UPDATING: fix typo

The correct version is 20210215, not 20120215 :(

Reported by: Yasuhiro Kimura
Fixes: 3f7b23177f1d
Sponsored by: Netflix

2 years agoUPDATING: Note awk upgraded to upstream one-true-awk 20210215.
Warner Losh [Fri, 9 Jul 2021 05:10:38 +0000 (23:10 -0600)]
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

2 years agoawk: Reduce diffs with upstream to almost nothing.
Warner Losh [Fri, 9 Jul 2021 03:51:24 +0000 (21:51 -0600)]
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

2 years agoUPDATING: Add an entry for commit 1e0a518d6548
Rick Macklem [Fri, 9 Jul 2021 01:30:24 +0000 (18:30 -0700)]
UPDATING: Add an entry for commit 1e0a518d6548

2 years agonfscl: Add a Linux compatible "nconnect" mount option
Rick Macklem [Fri, 9 Jul 2021 00:39:04 +0000 (17:39 -0700)]
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

2 years agonanobsd: remove sparc64 embedded example
Warner Losh [Thu, 8 Jul 2021 23:55:20 +0000 (17:55 -0600)]
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

2 years agodevmatch: don't announce autoloading so much
Warner Losh [Thu, 8 Jul 2021 19:53:18 +0000 (13:53 -0600)]
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

2 years agodevmatch: Be tolerant of .ko being present.
Warner Losh [Thu, 8 Jul 2021 19:44:21 +0000 (13:44 -0600)]
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

2 years agofan53555: attach to build and switch from syr827
Bjoern A. Zeeb [Thu, 8 Jul 2021 17:25:31 +0000 (17:25 +0000)]
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

2 years agodummynet: reduce console spam
Luiz Otavio O Souza [Thu, 11 Feb 2016 13:35:01 +0000 (07:35 -0600)]
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")

2 years agopf: pf_killstates() never fails, so remove the return value
Kristof Provost [Thu, 8 Jul 2021 08:54:16 +0000 (10:54 +0200)]
pf: pf_killstates() never fails, so remove the return value

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

2 years agoiostat: fix rounding errors in iostat -x
Alan Somers [Thu, 8 Jul 2021 16:16:32 +0000 (10:16 -0600)]
iostat: fix rounding errors in iostat -x

Better to round numbers instead of flooring them.

MFC after: 3 weeks
Sponsored by: Axcient

2 years agopf: fallback if $pf_rules fails to load
Thomas Steen Rasmussen [Wed, 16 Jun 2021 18:29:06 +0000 (20:29 +0200)]
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

2 years agopf: add pf_find_state_all_exists
Mateusz Guzik [Thu, 8 Jul 2021 13:11:57 +0000 (15:11 +0200)]
pf: add pf_find_state_all_exists

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agosetkey: drop an unused argument from postproc
Mateusz Guzik [Thu, 8 Jul 2021 11:31:43 +0000 (11:31 +0000)]
setkey: drop an unused argument from postproc

2 years agosetkey: fix several warnings popping up when compiling without WARNS=1
Mateusz Guzik [Thu, 8 Jul 2021 11:30:45 +0000 (11:30 +0000)]
setkey: fix several warnings popping up when compiling without WARNS=1

2 years agosetkey: ansify
Mateusz Guzik [Thu, 8 Jul 2021 11:28:34 +0000 (11:28 +0000)]
setkey: ansify

2 years agoFix the name of the arm64 SCTLR_E0E register
Andrew Turner [Wed, 7 Jul 2021 23:12:50 +0000 (23:12 +0000)]
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

2 years agotcp: Fix 32 bit platform breakage
Randall Stewart [Thu, 8 Jul 2021 11:06:58 +0000 (07:06 -0400)]
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

2 years agopf: Handle errors returned by pf_killstates()
Kristof Provost [Mon, 5 Jul 2021 12:21:03 +0000 (14:21 +0200)]
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")

2 years agopf: Remove unneeded NULL check
Kristof Provost [Mon, 5 Jul 2021 12:02:06 +0000 (14:02 +0200)]
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")

2 years agopf: rename pf_state to pf_kstate
Kristof Provost [Tue, 6 Jul 2021 09:42:20 +0000 (11:42 +0200)]
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

2 years agointrng: remove now redundant shadow variable.
Michal Meloun [Fri, 2 Jul 2021 18:28:25 +0000 (20:28 +0200)]
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

2 years agointrng: Releasing interrupt source should clear interrupt table full state.
Michal Meloun [Fri, 2 Jul 2021 18:17:36 +0000 (20:17 +0200)]
intrng: Releasing interrupt source should clear interrupt table full state.

The first release of an interrupt in a situation where the interrupt table
is full should schedule a full table check the next time an interrupt is
allocated. A full check is necessary to ensure maximum separation between
the order of allocation and the order of release.

Submitted by: ehem_freebsd@m5p.com (initial version)
Discussed in: https://reviews.freebsd.org/D29310
MFC after: 4 weeks

2 years agoone-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs
Warner Losh [Wed, 7 Jul 2021 23:30:35 +0000 (17:30 -0600)]
one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs

Import the latest bsd-features branch of the one-true-awk upstream:

o Move to bison for $YACC
o Set close-on-exec flag for file and pipe redirects that aren't std*
o lots of little fixes to modernize ocde base
o free sval member before setting it
o fix a bug where a{0,3} could match aaaa
o pull in systime and strftime from NetBSD awk
o pull in fixes from {Net,Free,Open}BSD (normalized our code with them)
o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop)

Also revert a few of the trivial FreeBSD changes that were done slightly
differently in the upstreaming process. Also, our PR database may have
been mined by upstream for these fixes, and Mikolaj Golub may deserve
credit for some of the fixes in this update.

Suggested by: Mikolaj Golub <to.my.trociny@gmail.com>
PR: 143363,143365,143368,143369,143373,143375,214782
Sponsored by: Netflix

2 years agoone-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs
Warner Losh [Wed, 7 Jul 2021 23:03:17 +0000 (17:03 -0600)]
one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs

Import the latest bsd-features branch of the one-true-awk upstream:

o Move to bison for $YACC
o Set close-on-exec flag for file and pipe redirects that aren't std*
o lots of little fixes to modernize ocde base
o free sval member before setting it
o fix a bug where a{0,3} could match aaaa
o pull in systime and strftime from NetBSD awk
o pull in fixes from {Net,Free,Open}BSD
o add BSD extensions and, or, xor, compl, lsheift, rshift

Sponsored by: Netflix

2 years agozfs: merge openzfs/zfs@bdd11cbb9 (master) into main
Martin Matuska [Wed, 7 Jul 2021 21:31:10 +0000 (23:31 +0200)]
zfs: merge openzfs/zfs@bdd11cbb9 (master) into main

Notable upstream pull request merges:
  #12274 Optimize txg_kick() process
  #12281 Move gethrtime() calls out of vdev queue lock
  #12287 Remove refcount from spa_config_*(
  #12289 Compact dbuf/buf hashes and lock arrays
  #12290 Remove avl_size field from struct avl_tree
  #12294 Upstream: dmu_zfetch_stream_fini leaks refcount
  #12295 Fix abd leak, kmem_free correct size of abd_t
  #12328 FreeBSD: Hardcode abd_chunk_size to PAGE_SIZE

Obtained from: OpenZFS
OpenZFS commit: bdd11cbb90a2afa54fd00935ac0d34b4ddf2515c

2 years agodevmatch: defer until after kld
Helge Oldach [Wed, 7 Jul 2021 20:43:35 +0000 (14:43 -0600)]
devmatch: defer until after kld

devmatch loads a number of things automatically. Allow the list of
things to load to happen first in case those drivers affect what would
be loaded. Normally, this will produce the same results, but there's
some special cases that may not when drivers are loaded that report
other drivers missing, like virtio_pci.

PR: 253287
Reviewed by: imp
MFC After: 2 weeks

2 years agoObsoleteFiles.inc: Remove manpages from OLD_FILES
Fernando Apesteguía [Wed, 7 Jul 2021 13:15:02 +0000 (15:15 +0200)]
ObsoleteFiles.inc: Remove manpages from OLD_FILES

In 0a0f7486413c147d56808b38055c40c64cff61f5 sconfig.8.gz and apmd.8.gz
were moved back to the parent directory share/man/man8.

This conflicts with a previous entry in OLD_FILES so running 'make
delete-old' would delete the new installed files.

Reported by: marklmi@yahoo.com
Approved by: emaste@
Fixes: 0a0f7486413c - Build manpages for all architectures
MFH: 4 weeks
Differential Revision: https://reviews.freebsd.org/D31092

2 years ago[skip ci] correct a few SPDX license tags
Alan Somers [Wed, 7 Jul 2021 19:52:20 +0000 (13:52 -0600)]
[skip ci] correct a few SPDX license tags

These were all incorrectly labeled as 2-clause BSD licenses by a
semi-automated process, when in fact they are 3-clause.

Discussed with: pfg, imp
MFC after: 2 weeks
Sponsored by: Axcient

2 years agoktls: make ktls_disable_ifnet() shim static
Andrew Gallatin [Wed, 7 Jul 2021 19:05:49 +0000 (15:05 -0400)]
ktls: make ktls_disable_ifnet() shim static

A user reported that when compiling without KERN_TLS, and
with -O0, the kernel failed to link due to ktls_disable_ifnet()
being undefined.   Making the shim static works around this issue.

Reported by: Gary Jennejohn
Sponsored by: Netflix

2 years agoarm64: Simplify fcmpset failure in pmap_promote_l2()
Alan Cox [Wed, 7 Jul 2021 18:16:03 +0000 (13:16 -0500)]
arm64: Simplify fcmpset failure in pmap_promote_l2()

When the initial fcmpset in pmap_promote_l2() fails, there is no need
to repeat the check for the physical address being 2MB aligned or for
the accessed bit being set.  While the pmap is locked the hardware can
only transition the accessed bit from 0 to 1, and we have already
determined that it is 1 when the fcmpset fails.

MFC after: 1 week

2 years agozfs: attach zpool_influxdb to build
Martin Matuska [Wed, 7 Jul 2021 17:45:52 +0000 (19:45 +0200)]
zfs: attach zpool_influxdb to build

From the zpool_influxdb.8 manual page:
  zpool_influxdb produces InfluxDB-line-protocol-compatible metrics from
  zpools.  Like the zpool command, zpool_influxdb reads the current pool
  status and statistics.  Unlike the zpool command which is intended for
  humans, zpool_influxdb formats the output in the InfluxDB line protocol.
  The expected use is as a plugin to a metrics collector or aggregator,
  such as Telegraf.

zpool_influxdb is installed into /usr/libexec/zfs/

Differential revision: https://reviews.freebsd.org/D31094
MFC after: 3 days

2 years agotcp: fix alternate stack build with LINT-NO{INET,INET6,IP}
Andrew Gallatin [Wed, 7 Jul 2021 17:02:08 +0000 (13:02 -0400)]
tcp: fix alternate stack build with LINT-NO{INET,INET6,IP}

When fixing another bug, I noticed that the alternate
TCP stacks do not build when various combinations of
ipv4 and ipv6 are disabled.

Reviewed by: rrs, tuexen
Differential Revision: https://reviews.freebsd.org/D31094
Sponsored by: Netflix

2 years agoktls: fix NOINET build
Andrew Gallatin [Wed, 7 Jul 2021 14:38:57 +0000 (10:38 -0400)]
ktls: fix NOINET build

Reported by: mjguzik
Sponsored by: Netflix

3 years agotcp: HPTS performance enhancements
Randall Stewart [Tue, 6 Jul 2021 19:23:22 +0000 (15:23 -0400)]
tcp: HPTS performance enhancements

HPTS drives both rack and bbr, and yet there have been many complaints
about performance. This bit of work restructures hpts to help reduce CPU
overhead. It does this by now instead of relying on the timer/callout to
drive it instead use user return from a system call as well as lro flushes
to drive hpts. The timer becomes a backstop that dynamically adjusts
based on how "late" we are.

Reviewed by: tuexen, glebius
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D31083

3 years agocloudabi and linux ABIs: do not call umtx_thread_cleanup() from thr_exit syscall
Konstantin Belousov [Thu, 1 Jul 2021 22:30:59 +0000 (01:30 +0300)]
cloudabi and linux ABIs: do not call umtx_thread_cleanup() from thr_exit syscall

These ABIs do not use umtx at all, so there is nothing to clean.
Cloudabi references to umtx keys do not require any cleanups anyway.

Requested by: dchagin
Reviewed by: dchagin, markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30987

3 years agoDo not call FreeBSD-ABI specific code for all ABIs
Konstantin Belousov [Thu, 1 Jul 2021 18:00:29 +0000 (21:00 +0300)]
Do not call FreeBSD-ABI specific code for all ABIs

Use sysentvec hooks to only call umtx_thread_exit/umtx_exec, which handle
robust mutexes, for native FreeBSD ABI.  Similarly, there is no sense
in calling sigfastblock_clear() for non-native ABIs.

Requested by: dchagin
Reviewed by: dchagin, markj (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30987

3 years agoMove sv_onexit() sysentvec hook slightly later
Konstantin Belousov [Thu, 1 Jul 2021 18:06:42 +0000 (21:06 +0300)]
Move sv_onexit() sysentvec hook slightly later

after itimers are stopped.  This makes it more usable for e.g. native FreeBSD
ABI sysentvecs.

Reviewed by: dchagin, markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30987

3 years agoAdd sv_onexec_old() sysent hook for exec event
Konstantin Belousov [Thu, 1 Jul 2021 18:04:06 +0000 (21:04 +0300)]
Add sv_onexec_old() sysent hook for exec event

Unlike sv_onexec(), it is called from the old (pre-exec) sysentvec structure.
The old vmspace for the process is still intact during the call.

Reviewed by: dchagin, markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30987

3 years agocxgb: use m_gethdr_raw
Mateusz Guzik [Wed, 7 Jul 2021 07:38:23 +0000 (09:38 +0200)]
cxgb: use m_gethdr_raw

Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoiflib: use m_gethdr_raw
Mateusz Guzik [Tue, 6 Jul 2021 18:52:48 +0000 (20:52 +0200)]
iflib: use m_gethdr_raw

Reviewed by: gallatin
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31081

3 years agombuf: add m_get_raw and m_gethdr_raw
Mateusz Guzik [Tue, 6 Jul 2021 18:51:20 +0000 (20:51 +0200)]
mbuf: add m_get_raw and m_gethdr_raw

The intent is to eliminate the MT_NOINIT flag and consequently a branch
from the constructor.

Reviewed by: gallatin
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31080

3 years agombuf: replace all direct uma_zfree(zone_mbuf) calls with m_free_raw
Mateusz Guzik [Tue, 6 Jul 2021 16:44:35 +0000 (18:44 +0200)]
mbuf: replace all direct uma_zfree(zone_mbuf) calls with m_free_raw

Reviewed by: donner
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31082

3 years agoFreeBSD: Hardcode abd_chunk_size to PAGE_SIZE
Alexander Motin [Wed, 7 Jul 2021 00:39:23 +0000 (20:39 -0400)]
FreeBSD: Hardcode abd_chunk_size to PAGE_SIZE

It makes no sense to set it below PAGE_SIZE, since it increases all
overheads and makes returning memory to OS problematic.  It makes no
sense to set it above PAGE_SIZE, since such allocations and especially
frees are too expensive and cause KVA fragmentation to benefit from
fewer chunks.  After that it makes no sense to keep more complicated
math here.

What may have sense though is just a tunable border between linear and
scatter ABDs, previously also controlled by this tunable.  Retain that
functionality by taking abd_scatter_min_size tunable from Linux, just
with different default value.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes #12328

3 years agoMove gethrtime() calls out of vdev queue lock
Alexander Motin [Tue, 6 Jul 2021 21:38:00 +0000 (17:38 -0400)]
Move gethrtime() calls out of vdev queue lock

This dramatically reduces the lock contention on systems with slower
(non-TSC) timecounters.  With TSC the difference is minimal, but since
this lock is pretty congested, any improvement counts.  Plus I don't
see any reason to do it under the lock other than the latency of the
lock itself, which this change actually reduces.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12281

3 years agoSync the arm64 special registers with the Armv8.5 XML
Andrew Turner [Thu, 1 Jul 2021 01:14:09 +0000 (01:14 +0000)]
Sync the arm64 special registers with the Armv8.5 XML

Add the missing macros and decode all the fields as described in the
Arm Architecture System Registers XML corresponding to Armv8.5.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30983

3 years agocam: enable kern.cam.ada.enable_uma_ccbs by default
Edward Tomasz Napierala [Wed, 7 Jul 2021 08:39:34 +0000 (09:39 +0100)]
cam: enable kern.cam.ada.enable_uma_ccbs by default

This makes the ada(4) driver use UMA for its CCBs.  While it's
da(4) counterpart needs some more testing, this one seems to be
safe now.

Please let me know via email if you notice any suspicious kernel
messages,

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30567

3 years agoMMCCAM: fix a panic after cam_sim_alloc_dev() removal in sdhci.c
Bjoern A. Zeeb [Wed, 7 Jul 2021 00:37:45 +0000 (00:37 +0000)]
MMCCAM: fix a panic after cam_sim_alloc_dev() removal in sdhci.c

During the removal of cam_sim_alloc_dev() in
aeb04e88f51a706ef4b6a380bf5e82d15203fb6a for sdhci.c and the
follow-up build-fix in a72af82e3169fcacfedf9047120679300a4296f8
slot->dev and slot->bus got mixed up for MMCCAM;  slot->dev is
only used in the !MMCCAM case so is uninitialised here leading to
a panic;  switch back to slot->bus to return to the status quo.

Reviewed by: imp (ack on arm@)
X-Differential Revision: https://reviews.freebsd.org/D30857

3 years agoUdev rules: remove zvol compat symlinks (without the leading zvol/)
Justin Gottula [Tue, 6 Jul 2021 20:41:17 +0000 (13:41 -0700)]
Udev rules: remove zvol compat symlinks (without the leading zvol/)

This is a potentially arguable change, because it removes some
compatibility cruft that certain systems or people may have come to rely
on (either a very long time ago, or unwisely in recent times).

On the other hand, it's been literally over a decade since OpenZFS
switched to the strategy of using opaque numbered /dev/zd* device nodes,
with the canonical zvol access path being a directory tree of symlinks
created by udev rules inside /dev/zvol/*. (See #102.) Even at the time,
the /dev/* scheme was labeled as being for "compatibility".

This commit removes the second tree of symlinks located directly at
/dev/*, under the assumption that anybody with any sense has been using
the intended /dev/zvol/* path for a very very long time now.

(The more I think about this, the more I anticipate that some large
fraction of people will have been blissfully unaware that the intention
has been for them to use the /dev/zvol/* tree all along, and they will
have come to rely upon the /dev/* tree simply because it's been there
this whole time despite being a compat thing.)

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Neal Gompa <ngompa@datto.com>
Signed-off-by: Justin Gottula <justin@jgottula.com>
Closes #12303

3 years agotcp: Address goodput and TLP edge cases.
Randall Stewart [Tue, 6 Jul 2021 14:36:14 +0000 (10:36 -0400)]
tcp: Address goodput and TLP edge cases.

There are several cases where we make a goodput measurement and we are running
out of data when we decide to make the measurement. In reality we should not make
such a measurement if there is no chance we can have "enough" data. There is also
some corner case TLP's that end up not registering as a TLP like they should, we
fix this by pushing the doing_tlp setup to the actual timeout that knows it did
a TLP. This makes it so we always have the appropriate flag on the sendmap
indicating a TLP being done as well as count correctly so we make no more
that two TLP's.

In addressing the goodput lets also add a "quality" metric that can be viewed via
blackbox logs so that a casual observer does not have to figure out how good
of a measurement it is. This is needed due to the fact that we may still make
a measurement that is of a poorer quality as we run out of data but still have
a minimal amount of data to make a measurement.

Reviewed by: tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D31076

3 years agocxgb: switch bare zone_mbuf use to m_free_raw
Mateusz Guzik [Tue, 6 Jul 2021 16:25:39 +0000 (18:25 +0200)]
cxgb: switch bare zone_mbuf use to m_free_raw

Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoAdd ocs_gendump.c to the build, missed in 29e2dbd42c3e.
Alexander Motin [Tue, 6 Jul 2021 19:03:06 +0000 (15:03 -0400)]
Add ocs_gendump.c to the build, missed in 29e2dbd42c3e.

3 years agozfsd: Check for error from zpool_vdev_online
Ryan Moeller [Tue, 6 Jul 2021 16:00:18 +0000 (16:00 +0000)]
zfsd: Check for error from zpool_vdev_online

Onlining a vdev can fail. Log the error if it does.

Reviewed by: mav, asomers
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D30882

3 years agoocs_fc: Add gendump and dump_to_host ioctl command support.
Ram Kishore Vegesna [Thu, 24 Jun 2021 07:05:00 +0000 (12:35 +0530)]
ocs_fc: Add gendump and dump_to_host ioctl command support.

Support to generate firmware dump.

Approved by: mav(mentor)

3 years agoetc/ttys: add xen console
Julien Grall [Thu, 29 Oct 2015 14:22:35 +0000 (11:22 -0300)]
etc/ttys: add xen console

Xen VMs get a simulated serial device meant for use as a console.  Often
an xterm or other advanced terminal is used, so use xterm as the type.

Depending on configuration, FreeBSD on Xen for amd64 may instead use an
emulated serial port, but the virtual console may also be available.

Submitted by: Elliott Mitchell <ehem+freebsd@m5p.com>
Reviewed by: imp (slightly earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29873

3 years agoetc/ttys: merge ttys file down to single file
Elliott Mitchell [Thu, 13 May 2021 06:58:00 +0000 (03:58 -0300)]
etc/ttys: merge ttys file down to single file

The tty lists were already pretty similar and there hadn't been any real
need for them to remain distinct for some time. As such, merge to a
single file.

The RISC-V console is preserved. For systems where it doesn't exist, its
presence in /etc/ttys is harmless. The uncommented version of the
ttyv8/XDM line from ttys.amd64 was the one chosen.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30256

3 years agoktls: auto-disable ifnet (inline hw) kTLS
Andrew Gallatin [Tue, 6 Jul 2021 14:17:33 +0000 (10:17 -0400)]
ktls: auto-disable ifnet (inline hw) kTLS

Ifnet (inline) hw kTLS NICs typically keep state within
a TLS record, so that when transmitting in-order,
they can continue encryption on each segment sent without
DMA'ing extra state from the host.

This breaks down when transmits are out of order (eg,
TCP retransmits).  In this case, the NIC must re-DMA
the entire TLS record up to and including the segment
being retransmitted.  This means that when re-transmitting
the last 1448 byte segment of a TLS record, the NIC will
have to re-DMA the entire 16KB TLS record. This can lead
to the NIC running out of PCIe bus bandwidth well before
it saturates the network link if a lot of TCP connections have
a high retransmoit rate.

This change introduces a new sysctl (kern.ipc.tls.ifnet_max_rexmit_pct),
where TCP connections with higher retransmit rate will be
switched to SW kTLS so as to conserve PCIe bandwidth.

Reviewed by: hselasky, markj, rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30908

3 years agoSkip netgraph tests when WITHOUT_NETGRAPH is set
Ed Maste [Tue, 6 Jul 2021 13:44:15 +0000 (09:44 -0400)]
Skip netgraph tests when WITHOUT_NETGRAPH is set

PR: 256986
Reported by: John Marshall
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoFix building rescue/rescue when sanitizers are enabled
Alex Richardson [Tue, 6 Jul 2021 11:18:29 +0000 (12:18 +0100)]
Fix building rescue/rescue when sanitizers are enabled

We have to ensure that we don't link any instrumented object files
into rescue as it is a static executable and static binaries can't
use the sanitizer runtime.

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D31044

3 years agousr.bin/diff: fix UBSan error in readhash
Alex Richardson [Tue, 6 Jul 2021 11:16:40 +0000 (12:16 +0100)]
usr.bin/diff: fix UBSan error in readhash

UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since
that can overflow an `int`. Use `unsigned int` instead to ensure that
overflow is well-defined.

Reviewed By: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31075

3 years agoImport Arm Optimized Routines v21.02
Alex Richardson [Tue, 6 Jul 2021 10:02:44 +0000 (11:02 +0100)]
Import Arm Optimized Routines v21.02

This is the new replacement for the existing cortex-strings code which will
be replaced in a follow-up commit.
We should also be able to use some of the math functions to allow the
tests to pass on AArch64 (and other architectures) instead of just x86.
We might also be able to reuse some of the tests for the kyua testsuite.

Imported using
```
curl -L https://github.com/ARM-software/optimized-routines/tarball/e823e3abf5f89ecba58a10fc0fd82c13d9984b6b | tar --strip-components=1 -xvzf -
git add .
```

Differential Revision: https://reviews.freebsd.org/D29035
git-subtree-dir: contrib/arm-optimized-routines
git-subtree-mainline: e34c713b0e660a49b57fafc02c9eccb26b938220
git-subtree-split: f9f37c002ab5a580accfe26b731eef45e798b435

3 years agortld/tests: Avoid function name conflict with libc opendir()
Alex Richardson [Tue, 6 Jul 2021 09:51:57 +0000 (10:51 +0100)]
rtld/tests: Avoid function name conflict with libc opendir()

This prevents these tests from being compiled with ASAN since the asan
interceptors also define opendir() but matching the libc function.

Reviewed By: oshogbo, kib, markj
Differential Revision: https://reviews.freebsd.org/D31038

3 years agousr.bin/login: send errors to console if syslog isn't running
Alex Richardson [Tue, 6 Jul 2021 09:50:05 +0000 (10:50 +0100)]
usr.bin/login: send errors to console if syslog isn't running

I was debugging why login(1) wasn't working as expected on a minimal
MFS_ROOT disk image. This image doesn't have syslogd running so the
warnings were lost and I had to use GDB to find out why login(1) was
failing (missing PAM libraries) instead of being able to see it in
the console output.

MFC after: 1 week
Reviewed By: pfg
Differential Revision: https://reviews.freebsd.org/D30892

3 years agousr.bin/sort: Avoid UBSan errors
Alex Richardson [Mon, 5 Jul 2021 13:32:48 +0000 (14:32 +0100)]
usr.bin/sort: Avoid UBSan errors

UBSan complains about out-of-bounds accesses for zero-length arrays. To
avoid this we can use flexible array members. However, the C standard does
not allow for structures that only contain flexible array members, so we
move the length parameters into that structure too.

Split out from D28233.

Reviewed By: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31009

3 years agocam: drop unused 'saved_ccb' field from softcs
Edward Tomasz Napierala [Tue, 6 Jul 2021 09:04:09 +0000 (10:04 +0100)]
cam: drop unused 'saved_ccb' field from softcs

No functional changes.  Do not MFC this, it changes kernel ABI.

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D30698

3 years agocam(4): preserve alloc_flags when copying CCBs
Edward Tomasz Napierala [Tue, 6 Jul 2021 08:23:25 +0000 (09:23 +0100)]
cam(4): preserve alloc_flags when copying CCBs

Before UMA CCBs, all CCBs were of the same size, and could
be trivially copied using bcopy(9).  Now we have to preserve
alloc_flags, otherwise we might end up attempting to free
stack-allocated CCB to UMA; we also need to take CCB size
into account.

This fixes kernel panic which would occur when trying to access
a stopped (as in, SCSI START STOP, also "ctladm stop") SCSI device.

Reported By: Gary Jennejohn <gljennjohn@gmail.com>
Tested By: Gary Jennejohn <gljennjohn@gmail.com>
Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31054