]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agogdb(4): Don't escape GDB special characters at application layer
cem [Wed, 30 Sep 2020 14:55:54 +0000 (14:55 +0000)]
gdb(4): Don't escape GDB special characters at application layer

In r351368, we introduced this XML- and GDB-encoded data.  The protocol
'offset' should reflex the logical XML data offset, but unfortunately we
counted the GDB escapes as well.

In fact, we cannot safely do GDB character escaping at this layer at
all, because we don't know what will be flushed in a packet.  It is
bogus to send only the first character of a two-character escape
sequence.

This patch "corrects" the problem by squashing these characters in the
transmitted XML document.  It would be nice to transmit the characters
faithfully, but that is a more complicated change.  Thread names are a
nice convenience feature for the GDB client, but one can always inspect
td_name or p_comm directly to find the true name.

Reported by: Ka Ho Ng <khng300 AT gmail.com>
Tested by: Ka Ho Ng
Reviewed by: emaste, markj, rlibby
Differential Revision: https://reviews.freebsd.org/D26599

3 years agoContinued ipfilter #ifdef cleanup. The r343701 log entry contains a
cy [Wed, 30 Sep 2020 08:26:25 +0000 (08:26 +0000)]
Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after: 1 week

3 years agoipfilter getifname ifdef cleanup.
cy [Wed, 30 Sep 2020 08:26:22 +0000 (08:26 +0000)]
ipfilter getifname ifdef cleanup.

MFC after: 2 months

3 years agoResurrect ipfilter's getifname, replacing the stub with the real
cy [Wed, 30 Sep 2020 08:26:00 +0000 (08:26 +0000)]
Resurrect ipfilter's getifname, replacing the stub with the real
function.

MFC after: 2 months

3 years agoriscv: Panic on PMP errors
kp [Wed, 30 Sep 2020 08:23:43 +0000 (08:23 +0000)]
riscv: Panic on PMP errors

Load/store/fetch access exceptions always indicate a violation of a PMP
rule. We can't treat those as page faults, because updating the page
table and trying again will only result in exactly the same access
exception recurring. This leaves us in an endless exception loop.

We cannot recover from these exceptions, so panic instead.

Reviewed by: jhb
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D26544

3 years agocache: use cache_has_entries where appropriate instead of opencoding it
mjg [Wed, 30 Sep 2020 04:27:38 +0000 (04:27 +0000)]
cache: use cache_has_entries where appropriate instead of opencoding it

3 years agoriscv: Define __PCI_REROUTE_INTERRUPT
jrtc27 [Wed, 30 Sep 2020 02:21:38 +0000 (02:21 +0000)]
riscv: Define __PCI_REROUTE_INTERRUPT

Every other architecture defines this and this is required for
interrupts to work when using QEMU's PCI VirtIO devices (which all
report an interrupt line of 0) for two reasons.

Firstly, interrupt line 0 is wrong; they use one of 0x20-0x23 with the
lines being cycled across devices like normal. Moreover, RISC-V uses
INTRNG, whose IRQs are virtual as indices into its irq_map, so even if
we have the right interrupt line we still need to try and route the
interrupt in order to ultimately call into intr_map_irq and get back a
unique index into the map for the given line, otherwise we will use
whatever happens to be in irq_map[line] (which for QEMU where the line
is initialised to 0 results in using the first allocated interrupt,
namely the RTC on IRQ 11 at time of commit).

Note that pci_assign_interrupt will still do the wrong thing for INTRNG
when using a tunable, as it will bypass INTRNG entirely and use the
tunable's value as the index into irq_map, when it should instead
(indirectly) call intr_map_irq to allocate a new entry for the given
IRQ and treat the tunable as stating the physical line in use, which is
what one would expect. This, however, is a problem shared by all INTRNG
architectures, and not exclusive to RISC-V.

Reviewed by: kib
Approved by: kib
Differential Revision: https://reviews.freebsd.org/D26564

3 years agoMake copy_file_range(2) Linux compatible for overflow of offset + len.
rmacklem [Wed, 30 Sep 2020 02:18:09 +0000 (02:18 +0000)]
Make copy_file_range(2) Linux compatible for overflow of offset + len.

Without this patch, if a call to copy_file_range(2) specifies an input file
offset + len that would wrap around, EINVAL is returned.
I thought that was the Linux behaviour, but recent testing showed that
Linux accepts this case and does the copy_file_range() to EOF.

This patch changes the FreeBSD code to exhibit the same behaviour as
Linux for this case.

Reviewed by: asomers, kib
Differential Revision: https://reviews.freebsd.org/D26569

3 years agoMakefile.inc1: sysent: allow subordinate sysent targets to run in parallel
kevans [Wed, 30 Sep 2020 00:47:57 +0000 (00:47 +0000)]
Makefile.inc1: sysent: allow subordinate sysent targets to run in parallel

makesyscalls.lua (and indeed makesyscalls.sh) are both safe to be run in
parallel, so let's do it.

This is a trivial difference because runtime per-target is pretty small, but
I like seeing it run in parallel when my muscle memory types `make -sj4`.

Reviewed by: brooks, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26594

3 years agoHoist comment on fixup of ld path
brooks [Tue, 29 Sep 2020 23:48:05 +0000 (23:48 +0000)]
Hoist comment on fixup of ld path

Reported by: jrtc27
Differential Revision: https://reviews.freebsd.org/D26591

3 years agoarm64: set the correct HWCAP
mhorne [Tue, 29 Sep 2020 23:21:56 +0000 (23:21 +0000)]
arm64: set the correct HWCAP

This appears to be a typo. The AdvSIMD field encodes support for
half-precision floating point SIMD instructions, which corresponds to
HWCAP_ASIMDHP, not HWCAP_ASIMDDP.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agoPrefer --ld-path=/path/to/ld on clang >= 12
brooks [Tue, 29 Sep 2020 22:30:15 +0000 (22:30 +0000)]
Prefer --ld-path=/path/to/ld on clang >= 12

Clang 12 warns about passing a path to -fuse-ld and -Werror makes that
an error preventing building world without this change.

Reviewed by: arichardson, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26591

3 years agoFallback to software for more GCM and CCM requests.
jhb [Tue, 29 Sep 2020 21:51:32 +0000 (21:51 +0000)]
Fallback to software for more GCM and CCM requests.

ccr(4) uses software to handle GCM and CCM requests not supported by
the crypto engine (e.g. with only AAD and no payload).  This change
adds a fallback for a few more requests such as those with more SGL
entries than can fit in a work request (this can happen for GCM when
decrypting a TLS record split across 15 or more packets).

Reported by: Chelsio QA
Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D26582

3 years agortwn: narrow the epoch area
bz [Tue, 29 Sep 2020 20:46:25 +0000 (20:46 +0000)]
rtwn: narrow the epoch area

Rather than placing the epoch around the entire receive loop which
might call into rtwn_rx_frame() and USB and sleep, split the loop
into two[1] and leave us with one unlock/lock cycle as well.

PR: 249925
Reported by: thj, (rkoberman gmail.com)
Tested by: thj
Suggested by: adrian [1]
Reviewed by: adrian
MFC after: 3 days
Sponsored by: The FreeBSD Foundation (initially, paniced my iwl lab host)
Differential Revision: https://reviews.freebsd.org/D26554

3 years agoRename kernel option ACPI_DMAR to IOMMU.
br [Tue, 29 Sep 2020 20:29:07 +0000 (20:29 +0000)]
Rename kernel option ACPI_DMAR to IOMMU.
This is mostly needed for a common arm64/amd64 iommu code.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D26587

3 years agoUpdates to chroot(2) docs
imp [Tue, 29 Sep 2020 18:13:54 +0000 (18:13 +0000)]
Updates to chroot(2) docs

1. Note what settings give historic behavior
2. Recommend jail under security considerations.

3 years agoStandalone SX shims
imp [Tue, 29 Sep 2020 18:06:02 +0000 (18:06 +0000)]
Standalone SX shims

Create a do-nothing version of SX locks. OpenZFS needs them. However,
since the boot loader is single threaded, they can be nops.

3 years agokldconfig(8): Add EXAMPLES to the man page
fernape [Tue, 29 Sep 2020 17:52:15 +0000 (17:52 +0000)]
kldconfig(8): Add EXAMPLES to the man page

Add EXAMPLES section to the man page showing the use of all flags except for
-S.

While here, clarify -f description. It not only suppresses diagnostic messages
but it also affects the exit status of the command itself. This is shown in two
of the examples.

Approved by: bcr@
Differential Revision: https://reviews.freebsd.org/D26588

3 years agoImplement some time variables from kernel
imp [Tue, 29 Sep 2020 16:29:50 +0000 (16:29 +0000)]
Implement some time variables from kernel

OpenZFS will start using some of the kernel timekeeping bits
shortly. This implements the bare minimum of that which currently
is just the time_seconds variable.

3 years agoo Rename acpi_iommu_get_dma_tag() -> iommu_get_dma_tag().
br [Tue, 29 Sep 2020 15:10:56 +0000 (15:10 +0000)]
o Rename acpi_iommu_get_dma_tag() -> iommu_get_dma_tag().
  This function isn't ACPI dependent and we may use it on FDT systems
  as well.
o Don't repeat the function declaration, include iommu.h instead.

Reviewed by: andrew, kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D26584

3 years agoZFS: Fix a logic bug in the FreeBSD getpages VOP
markj [Tue, 29 Sep 2020 13:41:47 +0000 (13:41 +0000)]
ZFS: Fix a logic bug in the FreeBSD getpages VOP

This was introduced when I merged r361287 to OpenZFS and has been fixed
there already, commit 3f6bb6e43fd68e.

Reported by: swills
Reviewed by: allanjude, freqlabs, mmacy

3 years agoBuild debug kernels with -O2.
trasz [Tue, 29 Sep 2020 11:48:22 +0000 (11:48 +0000)]
Build debug kernels with -O2.

LLVM 11 changed the meaning of '-O' from '-O2' to '-O1', which resulted
in debug kernels (with 'makeoptions DEBUG=-g') being built with inlining
disabled, causing severe performance hit.

The -O2 was already being used for building amd64, powerpc, and powerpcspe.

Discussed with: jrtc27, arichardson, bdragon, jhibbits
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26471

3 years agoUse the 'traced' variable instead of comparing p->p_flag again.
trasz [Tue, 29 Sep 2020 11:18:48 +0000 (11:18 +0000)]
Use the 'traced' variable instead of comparing p->p_flag again.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26577

3 years agoBump manual page date after 366243
0mp [Tue, 29 Sep 2020 10:07:46 +0000 (10:07 +0000)]
Bump manual page date after 366243

While here, address mandoc warnings.

3 years agoImprove the input validation and processing of cookies.
tuexen [Tue, 29 Sep 2020 09:36:06 +0000 (09:36 +0000)]
Improve the input validation and processing of cookies.
This avoids setting the association in an inconsistent
state, which could result in a use-after-free situation.
This can be triggered by a malicious peer, if the peer
can modify the cookie without the local endpoint recognizing
it.
Thanks to Ned Williamson for reporting the issue.

MFC after: 3 days

3 years agocxgbe(4): Avoid unnecessary work in the firmware during netmap tx.
np [Tue, 29 Sep 2020 09:25:52 +0000 (09:25 +0000)]
cxgbe(4): Avoid unnecessary work in the firmware during netmap tx.

Bind the netmap tx queues to a special '0xff' scheduling class which
makes the firmware skip some processing related to rate limiting on the
outgoing traffic.  Future firmwares will do this automatically.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoRemove duplicate line.
np [Tue, 29 Sep 2020 09:11:51 +0000 (09:11 +0000)]
Remove duplicate line.

3 years agocxgbe(4): adjust the doorbell threshold for netmap freelists to match the
np [Tue, 29 Sep 2020 07:51:06 +0000 (07:51 +0000)]
cxgbe(4): adjust the doorbell threshold for netmap freelists to match the
maximum burst size used when fetching descriptors from the list.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agocxgbe(4): display an error message when netmap cannot be enabled because
np [Tue, 29 Sep 2020 07:36:21 +0000 (07:36 +0000)]
cxgbe(4): display an error message when netmap cannot be enabled because
the interface is down.

MFC after: 1 week

3 years agoDocument the fact (bug?) that the -a option will normally process
grog [Tue, 29 Sep 2020 05:49:45 +0000 (05:49 +0000)]
Document the fact (bug?) that the -a option will normally process
root's calendar files three times, once each for root, toor and
daemon.

This relates to bug 246943, but does not solve it.  See discussion in
bug report for more details.

PR: 246943
Reported by: wcarson.bugzilla@disillusion.net

3 years agocxgbe(4): fixes for netmap operation with only some queues active.
np [Tue, 29 Sep 2020 05:08:45 +0000 (05:08 +0000)]
cxgbe(4): fixes for netmap operation with only some queues active.

- Only active netmap receive queues should be in the RSS lookup table.

- The RSS table should be restored for NIC operation when the last
  active netmap queue is switched off, not the first one.

- Support repeated netmap ON/OFF on a subset of the queues.  This works
  whether the the queues being enabled and disabled are the only ones
  active or not.  Some kring indexes have to be reset in the driver for
  the second case.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoprocstat: Fix regression after 365880.
kib [Tue, 29 Sep 2020 00:20:58 +0000 (00:20 +0000)]
procstat: Fix regression after 365880.

Basically it reverts one chunk that reversed the parsing logic, making
legacy variants of invocation, like `procstat -a -f', non-operational.

Reported and tested by: Dewayne Geraghty <dewayne@heuristicsystems.com.au>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoAddress whitespace nits in subr_rtc.c
kevans [Mon, 28 Sep 2020 17:19:57 +0000 (17:19 +0000)]
Address whitespace nits in subr_rtc.c

These were separated out from a nearby patch from Andrew Gierth.

MFC after: 3 days

3 years agoadd SIOCGIFDATA ioctl
emaste [Mon, 28 Sep 2020 16:54:39 +0000 (16:54 +0000)]
add SIOCGIFDATA ioctl

For interfaces that do not support SIOCGIFMEDIA (for which there are
quite a few) the only fallback is to query the interface for
if_data->ifi_link_state.  While it's possible to get at if_data for an
interface via getifaddrs(3) or sysctl, both are heavy weight mechanisms.

SIOCGIFDATA is a simple ioctl to retrieve this fast with very little
resource use in comparison.  This implementation mirrors that of other
similar ioctls in FreeBSD.

Submitted by: Roy Marples <roy@marples.name>
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D26538

3 years agoFor mulitcons boot, report it and which console is primary
imp [Mon, 28 Sep 2020 16:19:29 +0000 (16:19 +0000)]
For mulitcons boot, report it and which console is primary

Until we can do proper /etc/rc output on both consoles in multicons
boot (or all of them if we ever generalize), report when we are
booting multicons. Also report the primary console. This will be a big
hint why output stops after this line (though some slow USB discovery
still happens after mountroot / init starts).

Reviewed by: scottl@, tsoome@
Differential Revision: https://reviews.freebsd.org/D26574

3 years agoReport the kernel console on the boot screen
imp [Mon, 28 Sep 2020 16:19:21 +0000 (16:19 +0000)]
Report the kernel console on the boot screen

Report what console the boot loader is telling the kernel to use:
o Dual (Serial Primary)
o Dual (Video Primary)
o Serial
o Video

This allows the user to interrupt the boot and tweak the cosnole, if
needed, in a trivial way. Useful for installs where the default
selected may not be quite what you want, or when you are running a
dual setup and need to toggle over to the other console being primary.
The 'c'/'C' keys will do the cycling through the consoles.  Note:
you'll still have to drop into the loader to set details about serial
consoles. And this doesn't change the console the loader is using.

Reviewed by: kevans@
MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D26573

3 years agoMinor cleanup.
tuexen [Mon, 28 Sep 2020 14:11:53 +0000 (14:11 +0000)]
Minor cleanup.

MFC after: 3 days

3 years agoFix booting arm64 EFI with LINUX_BOOT_ABI enabled.
mmel [Mon, 28 Sep 2020 09:16:27 +0000 (09:16 +0000)]
Fix booting arm64 EFI with LINUX_BOOT_ABI enabled.
Use address of the pointer passed to kernel to determine whether the pointer
is a FDT block (physical address) or a module pointer (virtual kernel address).
This fragment was supposed to be committed before r366196, but I accidentally
skipped it in a patch series.

Reported by: bz

3 years agoSpeciy the dev in an easily changed variable
imp [Mon, 28 Sep 2020 06:00:56 +0000 (06:00 +0000)]
Speciy the dev in an easily changed variable

Rather than hard coding ada0 everywhere, use ${dev}. Also, set
dev=vtbd0 since both qemu and bhyve support this. More work
should be done to use labels instead for fstab.

qemu scripts likely need adjustment. And we should also
likely generate byhve scripts too.

3 years agoFix video on PCI heuristic
imp [Mon, 28 Sep 2020 06:00:39 +0000 (06:00 +0000)]
Fix video on PCI heuristic

The video on PCI heuristic was broken. It was supposed to infer a
video device when the last element of the path was a PCI DEVICE PATH
node. However, the last node in the device path is an END node, so
this heuristic never fired.

This leads, among other things, to bhyve only producing output in the
serial connection once we leave the boot loader. This restores the
dual headed boot on bhyve + UEFI (as we did in 11.2), but will favor
serial in the absence of other config which may be a change from 11.2.

MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D26572

3 years agoUse %ju and cast to (uintmax_t) to avoid using PRI* macros.
delphij [Mon, 28 Sep 2020 04:30:31 +0000 (04:30 +0000)]
Use %ju and cast to (uintmax_t) to avoid using PRI* macros.

Suggested by: kevlo

3 years agoConsistently use __FBSDID("FreeBSD") for ids in usr.bin/procstat.
kib [Sun, 27 Sep 2020 23:01:54 +0000 (23:01 +0000)]
Consistently use __FBSDID("FreeBSD") for ids in usr.bin/procstat.

Submitted by: Juraj Lutter <juraj@lutter.sk>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26568

3 years agoMisc compiler warning fixes in lib/libc
asomers [Sun, 27 Sep 2020 22:26:41 +0000 (22:26 +0000)]
Misc compiler warning fixes in lib/libc

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

3 years agoAdd DSCP support for network QoS to iscsi target.
rscheff [Sun, 27 Sep 2020 21:43:19 +0000 (21:43 +0000)]
Add DSCP support for network QoS to iscsi target.

In order to prioritize iSCSI traffic across a network,
DSCP can be used. In order not to rely on "ipfw setdscp"
or in-network reclassification, this adds the dscp value
directly to the portal group (where TCP sessions are accepted).

The incoming iSCSI session is first handled by ctld for any
CHAP authentication and the socket is then handed off to the
in-kernel iscsi driver without modification of the socket
parameters. Simply setting up the socket in ctld is sufficient
to keep sending outgoing iSCSI related traffic with the
configured DSCP value.

Reviewed by: mav, trasz
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26385

3 years agoGet rid of sa->narg. It serves no purpose; use sa->callp->sy_narg instead.
trasz [Sun, 27 Sep 2020 18:47:06 +0000 (18:47 +0000)]
Get rid of sa->narg.  It serves no purpose; use sa->callp->sy_narg instead.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26458

3 years agoRemove extraneous bracket.
cy [Sun, 27 Sep 2020 18:39:15 +0000 (18:39 +0000)]
Remove extraneous bracket.

MFC after: 3 days

3 years agoRemove Linux and IRIX specific files.
cy [Sun, 27 Sep 2020 18:39:12 +0000 (18:39 +0000)]
Remove Linux and IRIX specific files.

MFC after: 1 week

3 years agoContinuing the effort started in r343701, #ifdef cleanup, remove
cy [Sun, 27 Sep 2020 18:39:09 +0000 (18:39 +0000)]
Continuing the effort started in r343701, #ifdef cleanup, remove
never to be used again checks.

MFC after: 1 week

3 years agoShrink struct sysent from 48 to 32 bytes (on LP64; on ILP32 its probably
trasz [Sun, 27 Sep 2020 18:14:01 +0000 (18:14 +0000)]
Shrink struct sysent from 48 to 32 bytes (on LP64; on ILP32 its probably
from 32 to 28) by shrinking some entries and reordering them.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26508

3 years agoCheck the result of the function, not the pointer to it.
mmel [Sun, 27 Sep 2020 16:15:03 +0000 (16:15 +0000)]
Check the result of the function, not the pointer to it.

3 years agoCleanup, no functional change intended.
tuexen [Sun, 27 Sep 2020 13:32:02 +0000 (13:32 +0000)]
Cleanup, no functional change intended.

MFC after: 3 days

3 years agoImprove the handling of receiving unordered and unreliable user
tuexen [Sun, 27 Sep 2020 13:24:01 +0000 (13:24 +0000)]
Improve the handling of receiving unordered and unreliable user
messages using DATA chunks. Don't use fsn_included when not being
sure that it is set to an appropriate value. If the default is
used, which is -1, this can result in SCTP associaitons not
making any user visible progress.

Thanks to Yutaka Takeda for reporting this issue for the the
userland stack in https://github.com/pion/sctp/issues/138.

MFC after: 3 days

3 years agoDon't send a signal with uninitialized 'sig' and 'code' fields.
mmel [Sun, 27 Sep 2020 11:37:17 +0000 (11:37 +0000)]
Don't send a signal with uninitialized 'sig' and 'code' fields.
We have a few shortcuts in the arm trap code to speed up obvious "must fail"
cases. In these situations, make sure that we fill in the "sig" and "code"
fields of the generated signal.

MFC after: 3 weeks

3 years agoAdd LINUX_BOOT_ABI back to arm64 GENERIC kernel.
mmel [Sun, 27 Sep 2020 10:15:03 +0000 (10:15 +0000)]
Add LINUX_BOOT_ABI back to arm64 GENERIC kernel.

It was removed in r355289 but forgot to return it back when new u-boot booti
support was committed.  Although booti is not the preferred method of
booting the kernel, it is very useful for the initial phase of porting
FreeBSD to a new platform or booting the kernel on various embedded boards
in an industrial environment.

3 years agoReapply r366193 with proper commit log.
mmel [Sun, 27 Sep 2020 09:27:39 +0000 (09:27 +0000)]
Reapply r366193 with proper commit log.

Don't map same physical memory multiple times with different cache attributes.
This is explicitly stated as architectural undefined behavior, leading to
coherency issues sooner or later.

3 years agoRevert r366193, it was committed with unsaved commit log.
mmel [Sun, 27 Sep 2020 09:24:31 +0000 (09:24 +0000)]
Revert r366193, it was committed with unsaved commit log.

3 years agoDon't map same physical memory multiple times with different cache attributes.
mmel [Sun, 27 Sep 2020 09:14:16 +0000 (09:14 +0000)]
Don't map same physical memory  multiple times with different cache attributes.
This is explicitly stated as architectural undefined behavior, leadint to
coherencz issues sonner or later.

3 years agoDon't try to print EFI memeory map if it doesn't exist.
mmel [Sun, 27 Sep 2020 09:12:36 +0000 (09:12 +0000)]
Don't try to print EFI memeory map if it doesn't exist.

MFC after: 1 week

3 years agoBjorn reported a problem where the Linux NFSv4.1 client is
rmacklem [Sat, 26 Sep 2020 23:05:38 +0000 (23:05 +0000)]
Bjorn reported a problem where the Linux NFSv4.1 client is
using an open_to_lock_owner4 when that lock_owner4 has already
been created by a previous open_to_lock_owner4. This caused the NFS server
to reply NFSERR_INVAL.

For NFSv4.0, this is an error, although the updated NFSv4.0 RFC7530 notes
that the correct error reply is NFSERR_BADSEQID (RFC3530 did not specify
what error to return).

For NFSv4.1, it is not obvious whether or not this is allowed by RFC5661,
but the NFSv4.1 server can handle this case without error.
This patch changes the NFSv4.1 (and NFSv4.2) server to handle multiple
uses of the same lock_owner in open_to_lock_owner so that it now correctly
interoperates with the Linux NFS client.
It also changes the error returned for NFSv4.0 to be NFSERR_BADSEQID.

Thanks go to Bjorn for diagnosing this and testing the patch.
He also provided a program that I could use to reproduce the problem.

Tested by: bj@cebitec.uni-bielefeld.de (Bjorn Fischer)
PR: 249567
Reported by: bj@cebitec.uni-bielefeld.de (Bjorn Fischer)
MFC after: 3 days

3 years agoCheck for the only 32-bit MIPS ABIs we support, rather than !n64
jhibbits [Sat, 26 Sep 2020 21:47:11 +0000 (21:47 +0000)]
Check for the only 32-bit MIPS ABIs we support, rather than !n64

There may be additional 64-bit ABIs supported, so use a positive check rather
than a negative check.
Suggested by: imp
MFC after: 1 week
Sponsored by: Juniper Networks, Inc

3 years agobsdconfig, bsdinstall: Prune dead mirrors
zeising [Sat, 26 Sep 2020 16:27:09 +0000 (16:27 +0000)]
bsdconfig, bsdinstall: Prune dead mirrors

Prune dead mirrors from the list of mirrors in bsdconfig and bsdinstall.
All these return NXDOMAIN when trying to resolve them.

Reviewed by: emaste
Approved by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26535

3 years agofix typo imorted -> imported.
imp [Sat, 26 Sep 2020 04:06:16 +0000 (04:06 +0000)]
fix typo imorted -> imported.

Noticed by: Maigurs Stalidzans

3 years agoRevert most of r360179.
jhb [Fri, 25 Sep 2020 21:19:56 +0000 (21:19 +0000)]
Revert most of r360179.

I had failed to notice that sgsendccb() was using cam_periph_mapmem()
and thus was not passing down user pointers directly to drivers.  In
practice this broke requests submitted from userland.

PR: 249395
Reported by: Trenton Schulz <trueos@norwegianrockcat.com>
Reviewed by: scottl
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26550

3 years agoAdjustments to includes for openzfs in _STANDALONE
imp [Fri, 25 Sep 2020 20:51:07 +0000 (20:51 +0000)]
Adjustments to includes for openzfs in _STANDALONE

Allow the necessary parts of systm.h to be visible in the _STANDALONE
environnment. Limit the reset to only being visible for _KERNEL
builds.  Map KASSERT, etc to printf on failure in the bootloader until
we have more confidence things won't break and leave systems
unbootable. Eventually, this should map to a full panic in the
bootloader, but that also needs some enhancement to be more useful.

Reviewed by: tsoome, jhb
Differential Revision:  https://reviews.freebsd.org/D26543

3 years agoFix mips64 build
jhibbits [Fri, 25 Sep 2020 20:27:36 +0000 (20:27 +0000)]
Fix mips64 build

Original patch was against FreeBSD 12, and a test compile wasn't run against
head.  md_tls_tcb_offset field was moved from mdthread to mdproc in the
meantime.

MFC after: 1 week
Sponsored by: Juniper Networks, Inc.

3 years agomips: Fix compat32 library builds from r366162
jhibbits [Fri, 25 Sep 2020 19:04:03 +0000 (19:04 +0000)]
mips: Fix compat32 library builds from r366162

Re-add the a_ptr and a_fcn fields to Elf32_Auxinfo.

MFC after: 1 week
Sponsored by: Juniper Networks, Inc.

3 years agoDont let kernel and standalone both be defined at the same time
imp [Fri, 25 Sep 2020 19:02:49 +0000 (19:02 +0000)]
Dont let kernel and standalone both be defined at the same time

_KERNEL and _STANDALONE are different things. They cannot both be true
at the same time. If things that are normally visible only to _KERNEL
are needed for the _STANDALONE environment, you need to also make them
visible to _STANDALONE. Often times, this will be just a subset of the
required things for _KERNEL (eg global variables are but one example).

sys/cdefs.h is included by pretty much everything in both the loader
and the kernel, so is the ideal choke point.

3 years agong_l2tp: Fix callout synchronization in the rexmit timeout handler
markj [Fri, 25 Sep 2020 18:55:50 +0000 (18:55 +0000)]
ng_l2tp: Fix callout synchronization in the rexmit timeout handler

A received control packet may cause the transmit queue to be flushed, in
which case ng_l2tp_seq_recv_nr() cancels the transmit timeout handler.
The handler checks to see if it was cancelled before doing anything, but
did so before acquiring the node lock, so a small race window could
cause ng_l2tp_seq_rack_timeout() to attempt to flush an empty queue,
ultimately causing a null pointer dereference.

PR: 241133
Reviewed by: bz, glebius, Lutz Donnerhacke
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D26548

3 years agoComment out bogus command line entry
imp [Fri, 25 Sep 2020 18:20:45 +0000 (18:20 +0000)]
Comment out bogus command line entry

Linux implements -d to mean --print-decimal. We don't implement that
and use -d for --device-path. Note that.

3 years agoTweak output of the loader variable
imp [Fri, 25 Sep 2020 18:20:41 +0000 (18:20 +0000)]
Tweak output of the loader variable

When the DEVICE_PATH is <= 4 that means it's effectively empty. I have
a laptop that has a BIOS that likes to generate these:

8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot2001
0000: 01 00 00 00 04 00 45 00 46 00 49 00 20 00 55 00
0010: 53 00 42 00 20 00 44 00 65 00 76 00 69 00 63 00
0020: 65 00 00 00 7f ff 04 00 52 43

which now decodes as
8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot2001
* EFI USB Device
Empty path
Option:
0000: 52 43

which matches my hand-decode.

Add an extra newline after Option: to make it look nice.

I suspect that these entries really should be VenHw entries instead,
but my ability to change that is NIL, so cope with them as best we can.

efibootmgr(8)'s output is fine and doesn't need adjusting.

3 years agoFix compat32 on mips64
jhibbits [Fri, 25 Sep 2020 17:13:45 +0000 (17:13 +0000)]
Fix compat32 on mips64

Summary:
Two bugs:
* Elf32_Auxinfo is broken, using pointers in the union, which are 64-bits not
  32.
* freebsd32_sysarch() doesn't update the 'user local' register when handling
  MIPS_SET_TLS, leading to a NULL pointer dereference in the 32-bit
  application.

Reviewed by: #mips, brooks
MFC after: 1 week
Sponsored by: Juniper Networks, Inc
Differential Revision: https://reviews.freebsd.org/D26556

3 years agoRefine locking inside of syscon driver.
mmel [Fri, 25 Sep 2020 16:44:01 +0000 (16:44 +0000)]
Refine locking inside of syscon driver.
In some cases, the syscon driver may be used by consumer requiring better
control about locking (ie. it may be used as registe file provider for clock
driver which needs locked access to multiple registers).
Add fine locking protocol methods together with bunch of helper functions
in syscon driver and implement this functionality in syscon_generic driver.

MFC after: 4 weeks

3 years agoEnable SO_LINGER to the so_reuseport_lb_test regression tests, preventing
olivier [Fri, 25 Sep 2020 16:02:13 +0000 (16:02 +0000)]
Enable SO_LINGER to the so_reuseport_lb_test regression tests, preventing
many sockets in TIME_WAIT state at the end of the test.

PR: 249885
Reviewed by: markj
Approved by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26549

3 years agoCorrectly handle nodes compatible with "syscon", "simple-bus".
mmel [Fri, 25 Sep 2020 13:52:31 +0000 (13:52 +0000)]
Correctly handle nodes compatible with "syscon", "simple-bus".
Syscon can also have child nodes that share a registration file with it.
To do this correctly, follow these steps:
- subclass syscon from simplebus and expose it if the node is also
  "simple-bus" compatible.
- block simplebus probe for this compatible string, so it's priority
 (bus pass) doesn't colide with syscon driver.

While I'm in, also block "syscon", "simple-mfd" for the same reason.

MFC after: 4 weeks

3 years agoTCP: send full initial window when timestamps are in use
rscheff [Fri, 25 Sep 2020 10:38:19 +0000 (10:38 +0000)]
TCP: send full initial window when timestamps are in use

The fastpath in tcp_output tries to send out
full segments, and avoid sending partial segments by
comparing against the static t_maxseg variable.
That value does not consider tcp options like timestamps,
while the initial window calculation is using
the correct dynamic tcp_maxseg() function.

Due to this interaction, the last, full size segment
is considered too short and not sent out immediately.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26478

3 years agoTCP newreno: improve after_idle ssthresh
rscheff [Fri, 25 Sep 2020 10:23:14 +0000 (10:23 +0000)]
TCP newreno: improve after_idle ssthresh

Adjust ssthresh in after_idle to the maximum of
the prior ssthresh, or 3/4 of the prior cwnd. See
RFC2861 section 2 for an in depth explanation for
the rationale around this.

As newreno is the default "fall-through" reaction,
most tcp variants will benefit from this.

Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D22438

3 years agovi(1): Add URL to the vi/ex reference manual in the man page
fernape [Fri, 25 Sep 2020 10:20:12 +0000 (10:20 +0000)]
vi(1): Add URL to the vi/ex reference manual in the man page

Reported in PR 241985

The manual page references the "vi/ex reference manual" but there is no
information about where to find that document. Add a reference to the manual in
the SEE ALSO section since the Project hosts a copy of it[1].

Change sent upstream[2]

If D26158 gets reviewed and committed, we could close that PR.

[1] https://docs.freebsd.org/44doc/usd/13.viref/paper.pdf).
[2] https://github.com/lichray/nvi2/pull/85

Submitted by: freebsd@tim.thechases.com
Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D26163

3 years agoRegen after r366145.
trasz [Fri, 25 Sep 2020 10:05:38 +0000 (10:05 +0000)]
Regen after r366145.

Sponsored by: DARPA

3 years agoMake simplebus friendlier for subclassing.
mmel [Fri, 25 Sep 2020 09:56:50 +0000 (09:56 +0000)]
Make simplebus friendlier for subclassing.

MFC after: 1 week

3 years agoMake makesyscalls.lua initialize 'struct sysent' entries using c99
trasz [Fri, 25 Sep 2020 09:34:00 +0000 (09:34 +0000)]
Make makesyscalls.lua initialize 'struct sysent' entries using c99
designated initializers.  This makes it easier to modify 'struct sysent'
layout.

Reviewed by: kevans
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26530

3 years agopwm(8): fix potential duty overflow, use unsigneds for period and duty
avg [Fri, 25 Sep 2020 07:55:08 +0000 (07:55 +0000)]
pwm(8): fix potential duty overflow, use unsigneds for period and duty

For a long period value and the duty specified as a percentage,
there could be an overflow.
Using unsigned integers aligns the code with struct pwm_state and allows
to safely use periods up to 4 seconds where supported by drivers.

MFC after: 2 weeks

3 years agopwm(8): do not exit with failure after successfully reading configuration
avg [Fri, 25 Sep 2020 07:54:38 +0000 (07:54 +0000)]
pwm(8): do not exit with failure after successfully reading configuration

MFC after: 1 week

3 years agoaw_pwm: add a check and some comments related to long periods
avg [Fri, 25 Sep 2020 07:41:51 +0000 (07:41 +0000)]
aw_pwm: add a check and some comments related to long periods

The hardware supports periods as long as 196 seconds[*] when using the
maximal prescaling of 72000 and maximum cycle count of 2^16.

But the code becomes incorrect when the period length approaches 1 second.
That's because of things like NS_PER_SEC / period.

[*] At the same time I must note that the KPI provides for maximum
period of about 4 seconds (2^32 nanoseconds).

MFC after: 2 weeks

3 years agoaw_pwm: ensure sane configuration, just in case
avg [Fri, 25 Sep 2020 07:40:56 +0000 (07:40 +0000)]
aw_pwm: ensure sane configuration, just in case

Make sure that the hardware is configured to cycle mode and that the
bypass is disabled.

MFC after: 2 weeks

3 years agoaw_pwm: fix programming of the period
avg [Fri, 25 Sep 2020 07:40:26 +0000 (07:40 +0000)]
aw_pwm: fix programming of the period

The programmed value is biased by one: 0 means 1 cycle,
1 means 2 cycles, etc.

MFC after: 3 weeks

3 years agoaw_pwm: fix selection of the prescaler
avg [Fri, 25 Sep 2020 07:40:02 +0000 (07:40 +0000)]
aw_pwm: fix selection of the prescaler

Prescaling divides the frequency, not multiplies it.

MFC after: 2 weeks

3 years agoaw_pwm: remove the busy bit check
avg [Fri, 25 Sep 2020 07:39:41 +0000 (07:39 +0000)]
aw_pwm: remove the busy bit check

The bit seems to always be set on my hardware, H3.
However, programming the hardware seems to work just fine.

MFC after: 3 weeks

3 years agoaw_pwm: trivially add H3 support
avg [Fri, 25 Sep 2020 07:39:14 +0000 (07:39 +0000)]
aw_pwm: trivially add H3 support

MFC after: 2 weeks

3 years agoamdtemp(4), amdsmn(4): Attach to Ryzen 4000 APU (Zen 2, "Renoir")
cem [Fri, 25 Sep 2020 04:16:28 +0000 (04:16 +0000)]
amdtemp(4), amdsmn(4): Attach to Ryzen 4000 APU (Zen 2, "Renoir")

PR: 249864
Reported by: Florian Millet <florian.millet AT laposte.net>
Tested by: Florian Millet

3 years agolib/libc/tests/iconv: raise WARNS to 6
asomers [Thu, 24 Sep 2020 21:42:44 +0000 (21:42 +0000)]
lib/libc/tests/iconv: raise WARNS to 6

MFC after: 2 weeks

3 years agolib/libc/tests/sys: raise WARNS to 6
asomers [Thu, 24 Sep 2020 21:39:09 +0000 (21:39 +0000)]
lib/libc/tests/sys: raise WARNS to 6

MFC after: 2 weeks

3 years agotcp(4): Add a reference for tcp_bbr(4) man page
gbe [Thu, 24 Sep 2020 19:59:29 +0000 (19:59 +0000)]
tcp(4): Add a reference for tcp_bbr(4) man page

3 years agoAdd missing file (tcp_bbr.4) from r366127
gbe [Thu, 24 Sep 2020 19:35:34 +0000 (19:35 +0000)]
Add missing file (tcp_bbr.4) from r366127

Reviewed by: bcr
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24915

3 years agoAdd a manual page for TCP BBR
gbe [Thu, 24 Sep 2020 19:33:48 +0000 (19:33 +0000)]
Add a manual page for TCP BBR

Reviewed by: bcr
Approved by: bcr
Differential Revision: https://reviews.freebsd.org/D24915

3 years agoFix a typo in the 366098.
sobomax [Thu, 24 Sep 2020 19:12:03 +0000 (19:12 +0000)]
Fix a typo in the 366098.

Reported by: 0mp
MFC after: 2 weeks
(along with 366098)

3 years agocrypto_buffer(9): Add a HISTORY and a AUTHORS section
gbe [Thu, 24 Sep 2020 16:50:14 +0000 (16:50 +0000)]
crypto_buffer(9): Add a HISTORY and a AUTHORS section

Reviewed by: jhb
Approved by: jhb
Differential Revision: https://reviews.freebsd.org/D26487

3 years agoFix typo and environment variable macro
fernape [Thu, 24 Sep 2020 16:42:17 +0000 (16:42 +0000)]
Fix typo and environment variable macro

Follow up for r366119

Reported by: xtouqh@mm.st
Differential Revision: https://reviews.freebsd.org/D26182

3 years agofusefs: fix mmap'd writes in direct_io mode
asomers [Thu, 24 Sep 2020 16:27:53 +0000 (16:27 +0000)]
fusefs: fix mmap'd writes in direct_io mode

If a FUSE server returns FOPEN_DIRECT_IO in response to FUSE_OPEN, that
instructs the kernel to bypass the page cache for that file. This feature
is also known by libfuse's name: "direct_io".

However, when accessing a file via mmap, there is no possible way to bypass
the cache completely. This change fixes a deadlock that would happen when
an mmap'd write tried to invalidate a portion of the cache, wrongly assuming
that a write couldn't possibly come from cache if direct_io were set.

Arguably, we could instead disable mmap for files with FOPEN_DIRECT_IO set.
But allowing it is less likely to cause user complaints, and is more in
keeping with the spirit of open(2), where O_DIRECT instructs the kernel to
"reduce", not "eliminate" cache effects.

PR: 247276
Reported by: trapexit@spawn.link
Reviewed by: cem
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26485

3 years agowhich(1): Add EXAMPLES section to manpage
fernape [Thu, 24 Sep 2020 16:11:53 +0000 (16:11 +0000)]
which(1): Add EXAMPLES section to manpage

Add EXAMPLES section showing the use of -a and -s flags and how which(1)
treates duplicates.

Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D26182

3 years agoFix some signed/unsigned comparison warnings in NFS
asomers [Thu, 24 Sep 2020 15:38:01 +0000 (15:38 +0000)]
Fix some signed/unsigned comparison warnings in NFS

Reviewed by: rmacklem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26533