]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Dimitry Andric [Fri, 31 Jul 2020 21:43:56 +0000 (21:43 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11-init-20933-g3c1fca803bc.

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Dimitry Andric [Fri, 31 Jul 2020 21:22:58 +0000 (21:22 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from
which release/11.x was branched.

Note that for now, I rolled back all our local changes to make merging
easier, and I will reapply the still-relevant ones after updating to
11.0.0-rc1.

3 years agoMerge ^/head r363583 through r363738.
Dimitry Andric [Fri, 31 Jul 2020 19:25:35 +0000 (19:25 +0000)]
Merge ^/head r363583 through r363738.

3 years agoFix compilation error for install.c in loader
Stephen J. Kiernan [Fri, 31 Jul 2020 16:08:25 +0000 (16:08 +0000)]
Fix compilation error for install.c in loader

Fix typo in interp_include() invocation (missing 'p')
Remove setting tftpip, as servip is used by the tftp code in libsa. There
is no separate tftpip global variable any more.

Obtained from: Juniper Networks, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25897

3 years agoPoint to rc(8) for more details about the autoboot variable
Mateusz Piotrowski [Fri, 31 Jul 2020 14:13:26 +0000 (14:13 +0000)]
Point to rc(8) for more details about the autoboot variable

Reviewed by: bcr, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25904

3 years agong_iface(4): Remove unsupported protocols.
Mark Johnston [Fri, 31 Jul 2020 14:08:54 +0000 (14:08 +0000)]
ng_iface(4): Remove unsupported protocols.

Update the ng_iface documentation and hooks to reflect the fact that the
node currently only supports IPv4 and v6 packets.

Reviewed by: Lutz Donnerhacke
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25862

3 years agong_iface(4): Set the current VNET before calling netisr_dispatch().
Mark Johnston [Fri, 31 Jul 2020 14:08:32 +0000 (14:08 +0000)]
ng_iface(4): Set the current VNET before calling netisr_dispatch().

This is normally handled by a netgraph thread, but netgraph messages may
be dispatched directly to a node, in which case no VNET is set before
ng_iface calls into the network stack.  Netgraph could probably handle
this more generally, but for now just be sure to set the current VNET in
ng_iface.

PR: 242406
Tested by: Michael Muenz <m.muenz@gmail.com>
Reviewed by: Lutz Donnerhacke
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25788

3 years ago<regex.h>: reserve a regcomp field for REG_POSIX
Kyle Evans [Fri, 31 Jul 2020 12:40:31 +0000 (12:40 +0000)]
<regex.h>: reserve a regcomp field for REG_POSIX

For libc regcomp, this will be a nop. libregex will take this to mean that
it needs to turn off GNU extensions, effectively switching it back to the
POSIX-compliant libc implementation at runtime.

3 years agoReplace magic numbers in Identify page register 0 with ATA definitions.
Peter Grehan [Fri, 31 Jul 2020 12:10:28 +0000 (12:10 +0000)]
Replace magic numbers in Identify page register 0 with ATA definitions.

No functional change. Verified with objdump output before/after.

Requested by: rpokala
Reviewed by: rpokala
MFC after: 3 weeks

3 years agoInclude virtio support in std.MALTA
Alex Richardson [Fri, 31 Jul 2020 11:28:09 +0000 (11:28 +0000)]
Include virtio support in std.MALTA

The MALTA kernel config is generally used for QEMU and having support
for VirtIO there by default is quite useful.

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D25217

3 years agoThe recent changes to move the ref count increment
Randall Stewart [Fri, 31 Jul 2020 10:03:32 +0000 (10:03 +0000)]
The recent changes to move the ref count increment
back from the end of the function created an issue.
If one of the routines returns NULL during setup
we have inp's with extra references (which is why
the increment was at the end).

Also the stack switch return code was being ignored
and actually has meaning if the stack cannot take over
it should return NULL.

Fix both of these situation by being sure to test the
return code and of course in any case of return NULL (there
are 3) make sure we properly reduce the ref count.

Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D25903

3 years agoUPDATING: Add a note about running installworld twice
Kyle Evans [Fri, 31 Jul 2020 02:21:19 +0000 (02:21 +0000)]
UPDATING: Add a note about running installworld twice

Some folks seem to be hitting issues with build orchestration; presumably
some of our .WAIT-removal optimizations are going awry, and they're ending
up with applications linked against new libc being installed before the new
libc.

Letting installworld complete the first time should ensure that the new libc
is installed by the end of it, then the second installworld will ensure
consistency as everything should succeed.

3 years agogetblk: Remove a non-sensical LK_NOWAIT | LK_SLEEPFAIL
Conrad Meyer [Fri, 31 Jul 2020 00:13:40 +0000 (00:13 +0000)]
getblk: Remove a non-sensical LK_NOWAIT | LK_SLEEPFAIL

No functional change.

LK_SLEEPFAIL implies a behavior that is only possible if the lock operation can
sleep.  LK_NOWAIT prevents the lock operation from sleeping.

Discussed with: kib

3 years agogetblk: Avoid sleeping on wrong buf in lockless path
Conrad Meyer [Fri, 31 Jul 2020 00:07:01 +0000 (00:07 +0000)]
getblk: Avoid sleeping on wrong buf in lockless path

If the buffer identity changed during lookup, sleeping could introduce a
lock order reversal.  Since we do not know if the identity changed until we
get the lock, we must try-lock (LK_NOWAIT) only.  EINTR and ERESTART error
handling becomes irrelevant, as we no longer sleep.

Reported by: kib
Reviewed by: kib
X-MFC-With: r363482
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D25898

3 years agoImport PCG-C into sys/contrib
Conrad Meyer [Thu, 30 Jul 2020 23:54:25 +0000 (23:54 +0000)]
Import PCG-C into sys/contrib

The intended (future) use is to provide fast pseudo-random numbers in non-
cryptographic applications.

3 years agoDefinition for the 'removable media flag' from word 0 in the Identify page.
Peter Grehan [Thu, 30 Jul 2020 23:49:49 +0000 (23:49 +0000)]
Definition for the 'removable media flag' from word 0 in the Identify page.

This will be used to remove a magic number in the bhyve AHCI emulation.

Reported by: rpokala
Reviewed by: imp, rpokala
Approved by: imp, rpokala
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D25893

3 years agoImport PCG-C master, 2019-07-18 (83252d9c23df9c82ecb42210afed61a7b42402d7)
Conrad Meyer [Thu, 30 Jul 2020 23:17:30 +0000 (23:17 +0000)]
Import PCG-C master, 2019-07-18 (83252d9c23df9c82ecb42210afed61a7b42402d7)

3 years agoFix tinderbox build after r363714
Mateusz Guzik [Thu, 30 Jul 2020 22:56:57 +0000 (22:56 +0000)]
Fix tinderbox build after r363714

3 years agocache: drop the useless numchecks counter
Mateusz Guzik [Thu, 30 Jul 2020 22:52:18 +0000 (22:52 +0000)]
cache: drop the useless numchecks counter

3 years agoFurther depessimize priv_check_cred_vfs_generation
Mateusz Guzik [Thu, 30 Jul 2020 22:14:04 +0000 (22:14 +0000)]
Further depessimize priv_check_cred_vfs_generation

3 years agofd: predict in fdrop
Mateusz Guzik [Thu, 30 Jul 2020 22:13:15 +0000 (22:13 +0000)]
fd: predict in fdrop

3 years agoip6_output(): Check the return value of in6_getlinkifnet().
Mark Johnston [Thu, 30 Jul 2020 17:43:23 +0000 (17:43 +0000)]
ip6_output(): Check the return value of in6_getlinkifnet().

If the destination address has an embedded scope ID, make sure that it
corresponds to a valid ifnet before proceeding.  Otherwise a sendto()
with a bogus link-local address can trigger a NULL pointer dereference.

Reported by: syzkaller
Reviewed by: ae
Fixes: r358572
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25887

3 years agovfs: inline vops if there are no pre/post associated calls
Mateusz Guzik [Thu, 30 Jul 2020 15:50:51 +0000 (15:50 +0000)]
vfs: inline vops if there are no pre/post associated calls

This removes a level of indirection from frequently used methods, most notably
VOP_LOCK1 and VOP_UNLOCK1.

Tested by: pho

3 years agovfs: fold poll_no_poll into vop_nopoll
Mateusz Guzik [Thu, 30 Jul 2020 15:48:56 +0000 (15:48 +0000)]
vfs: fold poll_no_poll into vop_nopoll

The logic was almost completely present in vop_stdpoll anyway.

3 years agovfs: short-circuit the common case NDFREE calls
Mateusz Guzik [Thu, 30 Jul 2020 15:47:41 +0000 (15:47 +0000)]
vfs: short-circuit the common case NDFREE calls

Almost all consumers use the NDF_ONLY_PNBUF macro, making them avoidably branch
a lot in the NDFREE routine. Also note most of them should not need to call
any cleanup anyway as they don't request HASBUF.

3 years agovfs: add support for WANTPARENT and LOCKPARENT to lockless lookup
Mateusz Guzik [Thu, 30 Jul 2020 15:45:11 +0000 (15:45 +0000)]
vfs: add support for WANTPARENT and LOCKPARENT to lockless lookup

This makes the realpath syscall operational with the new lookup. Note that the
walk to obtain the full path name still takes locks.

Tested by:      pho
Differential Revision: https://reviews.freebsd.org/D23917

3 years agovfs: support negative entry promotion in lockless lookup
Mateusz Guzik [Thu, 30 Jul 2020 15:44:10 +0000 (15:44 +0000)]
vfs: support negative entry promotion in lockless lookup

Tested by: pho

3 years agovfs: add NOMACCHECK and AUDITVNODE2 to lockless lookup
Mateusz Guzik [Thu, 30 Jul 2020 15:43:16 +0000 (15:43 +0000)]
vfs: add NOMACCHECK and AUDITVNODE2 to lockless lookup

They are both nops since lookup does not progress with either mac or audit enabled.

Tested by: pho

3 years agoMove Ti AM335x to dev/extres/clk framework.
Michal Meloun [Thu, 30 Jul 2020 14:45:05 +0000 (14:45 +0000)]
Move Ti AM335x to dev/extres/clk framework.

Re-implement clocks for these SoC by using now standard extres/clk framework.
This is necessary for future expansion of these. The new  implementation
is (due to the size of the patch) only the initial (minimum) version.
It will be updated/expanded with a subsequent set of particular patches.

This patch is also not tested on OMAP4 based boards (BeagleBone),
so all possible issues should be (and will be) fixed by ASAP once
identified.

Submited by: Oskar Holmlund (oskar.holmlund@ohdata.se)
Differential Revision:  https://reviews.freebsd.org/D25118

3 years agosed: fix hex_subst test after after r363679
Kyle Evans [Thu, 30 Jul 2020 13:36:24 +0000 (13:36 +0000)]
sed: fix hex_subst test after after r363679

r363679 is in-fact the future change referenced by the comment, helpfully
left and forgotten by kevans. Instead of just silently not matching, we
should now be erroring out with vigor.

3 years agodiff: fix side_by_side after r363679
Kyle Evans [Thu, 30 Jul 2020 13:33:45 +0000 (13:33 +0000)]
diff: fix side_by_side after r363679

It's currently unclear to me how this could have worked previously; \n here
is not a literal newline but actual '\' 'n', and was getting passed to the
underlying regex engine as such. regex(3) does not translate this to a
newline, and this became an error because we don't really allow escaping
of arbitrary ordinary characters anymore.

Run the pattern strings through printf to make sure we're dealing with real
newlines before passing them through to atf_check, which ultimately feeds
them directly to regcomp(3).

This fix is different than that will be needed for sed, in that this is the
proper way to inject newlines into search strings as long as regex(3)
won't combine \ + n as folks might expect.

Reported by: Jenkins via lwhsu
MFC after: 1 week

3 years agoPrevent framebuffer mmio space from being allocated to other devices on HyperV.
Wei Hu [Thu, 30 Jul 2020 07:26:11 +0000 (07:26 +0000)]
Prevent framebuffer mmio space from being allocated to other devices on HyperV.

On Gen2 VMs, Hyper-V provides mmio space for framebuffer.
This mmio address range is not useable for other PCI devices.
Currently only efifb driver is using this range without reserving
it from system.
Therefore, vmbus driver reserves it before any other PCI device
drivers start to request mmio addresses.

PR: 222996
Submitted by: weh@microsoft.com
Reported by: dmitry_kuleshov@ukr.net
Reviewed by: decui@microsoft.com
Sponsored by: Microsoft

3 years agovfs: make sure startdir_used is always assigned to before use
Mateusz Guzik [Thu, 30 Jul 2020 07:11:08 +0000 (07:11 +0000)]
vfs: make sure startdir_used is always assigned to before use

CID: 1431070

3 years agoremove some long abandonded serial drivers (cy, rc, rp) since 2008
John-Mark Gurney [Thu, 30 Jul 2020 00:53:56 +0000 (00:53 +0000)]
remove some long abandonded serial drivers (cy, rc, rp) since 2008

Reviewed by: phk (earlier version)
Reviewed by: emaste (earlier version)
Reviewed by: bcr (earlier version)
Reviewed by: zeising (earlier version)
Differential Revision: https://reviews.freebsd.org/D25874

3 years agoFix a logic error in uipc_ready_scan().
Mark Johnston [Thu, 30 Jul 2020 00:52:37 +0000 (00:52 +0000)]
Fix a logic error in uipc_ready_scan().

When processing the last record in a socket buffer, take care to avoid a
NULL pointer dereference when advancing the record iterator.

Reported by: syzbot+6a689cc9c27bd265237a@syzkaller.appspotmail.com
Fixes: r359778
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoUPDATING / RELNOTES: Document new regcomp(3) behavior
Kyle Evans [Wed, 29 Jul 2020 23:59:35 +0000 (23:59 +0000)]
UPDATING / RELNOTES: Document new regcomp(3) behavior

This is a breaking change that had a not-insignificant impact in ports, it
is worth documenting it well.

3 years agoProperly handle a closed TLS socket with pending receive data.
John Baldwin [Wed, 29 Jul 2020 23:24:32 +0000 (23:24 +0000)]
Properly handle a closed TLS socket with pending receive data.

If the remote end closes a TLS socket and the socket buffer still
contains not-yet-decrypted TLS records but no decrypted TLS records,
soreceive needs to block or fail with EWOULDBLOCK.  Previously it was
trying to return data and dereferencing a NULL pointer.

Reviewed by: np
Sponsored by: Chelsio
Differential Revision: https://reviews.freebsd.org/D25838

3 years agoregex(3): Interpret many escaped ordinary characters as EESCAPE
Kyle Evans [Wed, 29 Jul 2020 23:21:56 +0000 (23:21 +0000)]
regex(3): Interpret many escaped ordinary characters as EESCAPE

In IEEE 1003.1-2008 [1] and earlier revisions, BRE/ERE grammar allows for
any character to be escaped, but "ORD_CHAR preceded by an unescaped
<backslash> character [gives undefined results]".

Historically, we've interpreted an escaped ordinary character as the
ordinary character itself. This becomes problematic when some extensions
give special meanings to an otherwise ordinary character
(e.g. GNU's \b, \s, \w), meaning we may have two different valid
interpretations of the same sequence.

To make this easier to deal with and given that the standard calls this
undefined, we should throw an error (EESCAPE) if we run into this scenario
to ease transition into a state where some escaped ordinaries are blessed
with a special meaning -- it will either error out or have extended
behavior, rather than have two entirely different versions of undefined
behavior that leave the consumer of regex(3) guessing as to what behavior
will be used or leaving them with false impressions.

This change bumps the symbol version of regcomp to FBSD_1.6 and provides the
old escape semantics for legacy applications, just in case one has an older
application that would immediately turn into a pumpkin because of an
extraneous escape that's embedded or otherwise critical to its operation.

This is the final piece needed before enhancing libregex with GNU extensions
and flipping the switch on bsdgrep.

[1] http://pubs.opengroup.org/onlinepubs/9699919799.2016edition/

PR: 229925 (exp-run, courtesy of antoine)
Differential Revision: https://reviews.freebsd.org/D10510

3 years agoAdd support for ext_pgs mbufs to nfsrvd_readdir() and nfsrvd_readdirplus().
Rick Macklem [Wed, 29 Jul 2020 22:58:08 +0000 (22:58 +0000)]
Add support for ext_pgs mbufs to nfsrvd_readdir() and nfsrvd_readdirplus().

This patch code that optionally (based on ND_TLS, never set yet) generates
readdir replies in ext_pgs mbufs.
To trim the list back, a new function that is ext_pgs aware called
nfsm_trimtrailing() replaces newnfs_trimtrailing().
newnfs_trimtrailing() is no longer used, but will be removed in a future
commit, since its removal does modify the internal kpi between the NFS
modules.

This is another in the series of commits that add support to the NFS client
and server for building RPC messages in ext_pgs mbufs with anonymous pages.
This is useful so that the entire mbuf list does not need to be
copied before calling sosend() when NFS over TLS is enabled.

Use of ext_pgs mbufs will not be enabled until the kernel RPC is updated
to handle TLS.

3 years agoo Don't include headers from iommu.h, include them from the header
Ruslan Bukin [Wed, 29 Jul 2020 22:08:54 +0000 (22:08 +0000)]
o Don't include headers from iommu.h, include them from the header
  consumers instead;
o Order includes properly.

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

3 years agoadd link to crypto(7) page, and drop a link to unrelated crypt(3) page..
John-Mark Gurney [Wed, 29 Jul 2020 21:15:06 +0000 (21:15 +0000)]
add link to crypto(7) page, and drop a link to unrelated crypt(3) page..

3 years agoRemove the volatile qualifier from busy_lock.
Mark Johnston [Wed, 29 Jul 2020 19:38:49 +0000 (19:38 +0000)]
Remove the volatile qualifier from busy_lock.

Use atomic(9) to load the lock state.  Some places were doing this
already, so it was inconsistent.  In initialization code, the lock state
is still initialized with plain stores.

Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25861

3 years agoContinued ipfilter #ifdef cleanup. The r343701 log entry contains a
Cy Schubert [Wed, 29 Jul 2020 19:36:24 +0000 (19:36 +0000)]
Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after: 1 week

3 years agoFix !ACPI_DMAR build.
Ruslan Bukin [Wed, 29 Jul 2020 19:22:50 +0000 (19:22 +0000)]
Fix !ACPI_DMAR build.

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

3 years agovfs: elide MAC-induced locking on rename if there are no relevant hoooks
Mateusz Guzik [Wed, 29 Jul 2020 17:05:31 +0000 (17:05 +0000)]
vfs: elide MAC-induced locking on rename if there are no relevant hoooks

3 years agovfs: honor error code returned by mac_vnode_check_rename_from
Mateusz Guzik [Wed, 29 Jul 2020 17:04:33 +0000 (17:04 +0000)]
vfs: honor error code returned by mac_vnode_check_rename_from

MFC after: 3 days

3 years agoFix build.
Ruslan Bukin [Wed, 29 Jul 2020 15:46:17 +0000 (15:46 +0000)]
Fix build.

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

3 years agoo Move iommu_set_buswide_ctx, iommu_is_buswide_ctx to
Ruslan Bukin [Wed, 29 Jul 2020 13:23:27 +0000 (13:23 +0000)]
o Move iommu_set_buswide_ctx, iommu_is_buswide_ctx to
  the generic iommu busdma backend;
o Move bus_dma_iommu_set_buswide, bus_dma_iommu_load_ident
  prototypes to iommu.h.

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

3 years agoAdd my entry to the calendar file
Daniel Ebdrup Jensen [Wed, 29 Jul 2020 11:19:57 +0000 (11:19 +0000)]
Add my entry to the calendar file

As part of onboarding, ensure that I'm listed in the FreeBSD calendar file,
while listening to Don't Take Away The Music by Tavares.

Reviewed by: 0mp, bcr
Approved by: 0mp (mentor), allanjude (mentor)
Differential Revision: D25856

3 years agoOutline mentorship
Daniel Ebdrup Jensen [Wed, 29 Jul 2020 11:17:44 +0000 (11:17 +0000)]
Outline mentorship

As part of onboarding and while listening to Holy Ghost by The Bar-Kays, outline
my mentorship. 0mp is mentor, with allanjude and bcr as co-mentor.

Reviewed by: 0mp, allanjude, bcr
Approved by: 0mp (mentor), allanjude (mentor), bcr (mentor)
Differential Revision: D25855

3 years agoOnly try managing the regulator when EXT_RESOURCES is defined
Andrew Turner [Wed, 29 Jul 2020 08:24:40 +0000 (08:24 +0000)]
Only try managing the regulator when EXT_RESOURCES is defined

Not all Raspberry Pi kernel configs define EXT_RESOURCES. Check for this
before trying to manage the regulator.

Sponsored by: Innovate UK

3 years agoAdd myself (rew) as src committer.
Robert Wing [Wed, 29 Jul 2020 05:27:19 +0000 (05:27 +0000)]
Add myself (rew) as src committer.

Reviewed by:    kevans (mentor), allanjude (mentor)
Approved by:    kevans (mentor), allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D25837

3 years agosshd: allow UseBlocklist alias for UseBlacklist
Ed Maste [Wed, 29 Jul 2020 00:34:24 +0000 (00:34 +0000)]
sshd: allow UseBlocklist alias for UseBlacklist

blacklistd has been renamed to blocklistd upstream, and a future
import into FreeBSD will follow that change.  Support the new name
as an alias in config files.

Reviewed by: bz, delphij
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25865

3 years agoWhen modifying LUN pass "special" options too.
Alexander Motin [Tue, 28 Jul 2020 22:32:50 +0000 (22:32 +0000)]
When modifying LUN pass "special" options too.

Before switching to nvlists CTL merged previous and new options, so
any options not passed just kept previous value.  Now CTL completely
replaces them, so we must pass everything still relevant.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

3 years agoFixup some incorrect information and some comments. These changes
Christian S.J. Peron [Tue, 28 Jul 2020 20:06:16 +0000 (20:06 +0000)]
Fixup some incorrect information and some comments. These changes
were cherry picked up the upstream OpenBSD repository. At some point we
will look at doing another import, but the diffs are substantial and will
require some careful testing.

Differential Revision: https://reviews.freebsd.org/D25021
MFC after: 2 weeks
Submitted by: gbe
Reviewed by: myself, bcr

3 years agovm_page_xbusy_claim(): Use atomics to update busy lock state.
Mark Johnston [Tue, 28 Jul 2020 19:50:39 +0000 (19:50 +0000)]
vm_page_xbusy_claim(): Use atomics to update busy lock state.

vm_page_xbusy_claim() could clobber the waiter bit.  For its original
use, kernel memory pages, this was not a problem since nothing would
ever block on the busy lock for such pages.  r363607 introduced a new
use where this could in principle be a problem.

Fix the problem by using atomic_cmpset to update the lock owner.  Since
this macro is defined only for INVARIANTS kernels the extra overhead
doesn't seem prohibitive.

Reported by: vangyzen
Reviewed by: alc, kib, vangyzen
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25859

3 years agoAdd further clarification on si_addr and si_trapno.
John Baldwin [Tue, 28 Jul 2020 17:09:15 +0000 (17:09 +0000)]
Add further clarification on si_addr and si_trapno.

- In the initial description of si_addr, do not claim that it is
  always the faulting instruction.

- For si_addr, document that it is generally set to the PC for
  synchronous signals, but that it can be set to the the address of
  the faulting memory reference for some signals including SIGSEGV and
  SIGBUS.  In particular, while SIGSEGV generally sets si_addr to the
  faulting memory reference, SIGBUS can vary.  On some platforms, some
  SIGBUS signals set si_addr to the PC and other SIGBUS signals set
  si_addr to the faulting address depending on the specific hardware
  exception.

- For si_trapno, synchronous signals should set this to some value.

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

3 years agoo Move the buswide_ctxs bitmap to iommu_unit and rename related functions.
Ruslan Bukin [Tue, 28 Jul 2020 16:08:14 +0000 (16:08 +0000)]
o Move the buswide_ctxs bitmap to iommu_unit and rename related functions.
o Rename bus_dma_dmar_load_ident() as well.

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

3 years agops(1): Fix formatting of the "command" field for kernel threads.
Mark Johnston [Tue, 28 Jul 2020 15:26:19 +0000 (15:26 +0000)]
ps(1): Fix formatting of the "command" field for kernel threads.

When -H is specified, for kernel threads the command is formatted as
"<proc name>/<td name>" and truncated to MAXCOMLEN.  But each of the
proc name and td name may be up to MAXCOMLEN bytes in length.

Also handle the ki_moretdname field to ensure that the full thread name
gets printed.  This is already handled correctly when formatting for
"-o tdname".

Reported by: freqlabs
Reviewed by: freqlabs
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25840

3 years agoAdd a workaround for a bug when setting the Raspberry GIO config and state
Andrew Turner [Tue, 28 Jul 2020 11:32:45 +0000 (11:32 +0000)]
Add a workaround for a bug when setting the Raspberry GIO config and state

The Raspberry Pi GPIO config and state messages incorrectly return with
the tag length set to 0. We then check this value to have the response
flag set. Work around this by setting the response flag when setting the
GPIO config or state and this value is zero.

Sponsored by: Innovate UK

3 years agovirtio: fix mips regression introduced by r357596
Alfredo Dal'Ava Junior [Tue, 28 Jul 2020 11:23:37 +0000 (11:23 +0000)]
virtio: fix mips regression introduced by r357596

PowerPC support was fixed in r357596 by changing PCI bustag to BE as
part of the solution, but this caused regression on mips. This change
implements byte swapping of virtio PCI config area in the driver,
leaving lower layer untouched.

Submittnd by: Fernando Valle <fernando.valle@eldorado.org.br>
Reported by: arichardson
Reviewed by: alfredo, arichardson
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D25416

3 years agoAadd Raspberry Pi firmware messages to manage GPIOs
Andrew Turner [Tue, 28 Jul 2020 11:13:37 +0000 (11:13 +0000)]
Aadd Raspberry Pi firmware messages to manage GPIOs

Some GPIOs are managed by an external IO expaandder through the firmware.
Add the message details for these.

Sponsored by: Innovate UK

3 years ago- Cleanups related to sparc64 removal.
Yoshihiro Takahashi [Tue, 28 Jul 2020 10:58:37 +0000 (10:58 +0000)]
- Cleanups related to sparc64 removal.
- Remove remains of sparc64 files.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D25831

3 years agoSwitch the bcm2835 cpufreq driver to use the firmware interface
Andrew Turner [Tue, 28 Jul 2020 10:45:29 +0000 (10:45 +0000)]
Switch the bcm2835 cpufreq driver to use the firmware interface

Use the new Raspberry Pi firmware driver in the cpufreq driver. It is
intended all drivers that need to interact with the firmware will move to
use the firmware driver, this is the first.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25609

3 years agoMove the bcm2835 firmware driver earlier in the boot.
Andrew Turner [Tue, 28 Jul 2020 10:43:52 +0000 (10:43 +0000)]
Move the bcm2835 firmware driver earlier in the boot.

It will be needed by other eaarly drivers.

While here make the dependency of the mailbox formal with MODULE_DEPEND.

Reviewed by: manu
Sponsored by: Innovate UK

3 years agoRevert r363639 so I can use a more correct commit message
Andrew Turner [Tue, 28 Jul 2020 10:41:43 +0000 (10:41 +0000)]
Revert r363639 so I can use a more correct commit message

3 years agoMove the bcm2835 mailbox driver earlier in the boot
Andrew Turner [Tue, 28 Jul 2020 10:40:00 +0000 (10:40 +0000)]
Move the bcm2835 mailbox driver earlier in the boot

This will be needed before the firmware driver is loaded

3 years agoHave the bcm2835 firmware driver depend on the mailbox driver
Andrew Turner [Tue, 28 Jul 2020 10:37:58 +0000 (10:37 +0000)]
Have the bcm2835 firmware driver depend on the mailbox driver

The firmware driver uses the mailbox driver to communicate with the
firmware. Make this a more formal dependency.

Reviewed by: manu
Sponsored by: Innovate UK

3 years agoFix ENA build when integrated into kernel
Marcin Wojtas [Tue, 28 Jul 2020 10:08:07 +0000 (10:08 +0000)]
Fix ENA build when integrated into kernel

Provide missing rules for ena_datapath.c and ena_netmap.c,
which prevented the ENA driver from building.
This issue was showing up only when building the driver statically
into the kernel.

PR: 248116
Submitted by: Artur Rojek <ar@semihalf.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25796
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

3 years agoEnable use of the regulator in the Broadcom SDHCI controller
Andrew Turner [Tue, 28 Jul 2020 09:46:58 +0000 (09:46 +0000)]
Enable use of the regulator in the Broadcom SDHCI controller

This will be needed before a future GPIO controller driver is added
as the later enables regulators that leave the SDHCI controller disabled.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25834

3 years agoAdd an ACPI attachment for if_smc
Andrew Turner [Tue, 28 Jul 2020 09:29:56 +0000 (09:29 +0000)]
Add an ACPI attachment for if_smc

This is needed by some of the Arm simulators as they implement a smc based
network interface, but use ACPI rather than FDT.

Sponsored by: Innovate UK

3 years agolibpmc: Use known pmc_cpuid buffer size
Ryan Moeller [Tue, 28 Jul 2020 02:56:26 +0000 (02:56 +0000)]
libpmc: Use known pmc_cpuid buffer size

Use the existing PMC_CPUID_LEN to size pmc_cpuid in the kernel and various
buffers for reading it in libpmc.  This avoids some extra syscalls and
malloc/frees.

While in here, use strlcpy to copy a user-provided cpuid string instead of
memcpy, to make sure we terminate the buffer.

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

3 years agomakesyscalls.sh: improve the 'this is going away' message
Kyle Evans [Tue, 28 Jul 2020 01:05:40 +0000 (01:05 +0000)]
makesyscalls.sh: improve the 'this is going away' message

Reported by: Ronald Klop, rgrimes

3 years agossh: Remove AES-CBC ciphers from default server and client lists
Ed Maste [Tue, 28 Jul 2020 00:24:12 +0000 (00:24 +0000)]
ssh: Remove AES-CBC ciphers from default server and client lists

A base system OpenSSH update in 2016 or so removed a number of ciphers
from the default lists offered by the server/client, due to known
weaknesses.  This caused POLA issues for some users and prompted
PR207679; the ciphers were restored to the default lists in r296634.

When upstream removed these ciphers from the default server list, they
moved them to the client-only default list.  They were subsequently
removed from the client default, in OpenSSH 7.9p1.

The change has persisted long enough.  Remove these extra ciphers from
both the server and client default lists, in advance of FreeBSD 13.

Reviewed by: markm, rgrimes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25833

3 years agoAdd initial driver for ACPI Platform Error Interfaces.
Alexander Motin [Mon, 27 Jul 2020 21:19:41 +0000 (21:19 +0000)]
Add initial driver for ACPI Platform Error Interfaces.

APEI allows platform to report different kinds of errors to OS in several
ways.  We've found that Supermicro X10/X11 motherboards report PCIe errors
appearing on hot-unplug via this interface using NMI.  Without respective
driver it ended up in kernel panic without any additional information.

This driver introduces support for the APEI Generic Hardware Error Source
reporting via NMI, SCI or polling.  It decodes the reported errors and
either pass them to pci(4) for processing or just logs otherwise.  Errors
marked as fatal still end up in kernel panic, but some more informative.

When somebody get to native PCIe AER support implementation both of the
reporting mechanisms should get common error recovery code.  Since in our
case errors happen when the device is already gone, there is nothing to
recover, so the code just clears the error statuses, practically ignoring
the otherwise destructive NMIs in nicer way.

MFC after: 2 weeks
Relnotes: yes
Sponsored by: iXsystems, Inc.

3 years agocxgbe(4): Stop checking for failures from malloc(M_WAITOK).
Mark Johnston [Mon, 27 Jul 2020 19:05:53 +0000 (19:05 +0000)]
cxgbe(4): Stop checking for failures from malloc(M_WAITOK).

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org>
Reviewed by: np
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25767

3 years agoRestrict definition of CTL_P1003_1B_MAXID to the kernel
Alan Somers [Mon, 27 Jul 2020 18:57:28 +0000 (18:57 +0000)]
Restrict definition of CTL_P1003_1B_MAXID to the kernel

This constant is only used to size an array within the kernel. There are
probably no legitimate uses in userland. Worse, since the kernel's array
could theoretically change size over time, any use of that symbol in
userland wouldn't be forwards compatible to new kernel versions.

Reviewed by: jhb
MFC after: Never
Differential Revision: https://reviews.freebsd.org/D25816

3 years agosh(1): print a newline when ^D quits sh
Piotr Pawel Stefaniak [Mon, 27 Jul 2020 18:46:20 +0000 (18:46 +0000)]
sh(1): print a newline when ^D quits sh

I've always found this a little bit confusing:
> sh
$ ^D> sh
$ ^D>

Reviewed by: 0mp, jilles
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25813

3 years agocomm(1): Add EXAMPLES section
Fernando Apesteguía [Mon, 27 Jul 2020 16:51:23 +0000 (16:51 +0000)]
comm(1): Add EXAMPLES section

Add two very simple examples.

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

3 years agoTrim some extraneous parentheses.
John Baldwin [Mon, 27 Jul 2020 16:37:18 +0000 (16:37 +0000)]
Trim some extraneous parentheses.

Reported by: kib (do_trap_user)
Sponsored by: DARPA

3 years agoSet si_addr to dar for MMU and alignment faults.
John Baldwin [Mon, 27 Jul 2020 16:34:31 +0000 (16:34 +0000)]
Set si_addr to dar for MMU and alignment faults.

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

3 years agoFix si_addr value for breakpoints in a delay slot.
John Baldwin [Mon, 27 Jul 2020 16:32:21 +0000 (16:32 +0000)]
Fix si_addr value for breakpoints in a delay slot.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25773

3 years agoFix indentation.
John Baldwin [Mon, 27 Jul 2020 16:31:21 +0000 (16:31 +0000)]
Fix indentation.

3 years agoSet si_trapno to the fault index from fsr.
John Baldwin [Mon, 27 Jul 2020 16:29:21 +0000 (16:29 +0000)]
Set si_trapno to the fault index from fsr.

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

3 years agoSet si_trapno to the exception code from scause.
John Baldwin [Mon, 27 Jul 2020 16:28:44 +0000 (16:28 +0000)]
Set si_trapno to the exception code from scause.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25770

3 years agoDon't include T_USER in si_trapno reported to userland.
John Baldwin [Mon, 27 Jul 2020 16:25:18 +0000 (16:25 +0000)]
Don't include T_USER in si_trapno reported to userland.

Signals are only reported for user traps, so T_USER is redundant.  It
is also a software convention and not included in the value reported
by the hardware.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25769

3 years agotruncate(1): Add EXAMPLES section
Fernando Apesteguía [Mon, 27 Jul 2020 15:25:04 +0000 (15:25 +0000)]
truncate(1): Add EXAMPLES section

Add four simple examples showing the use of -c, -r and -s

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D25774

3 years agompr(4), mps(4): Stop checking for failures from malloc(M_WAITOK).
Mark Johnston [Mon, 27 Jul 2020 14:28:55 +0000 (14:28 +0000)]
mpr(4), mps(4): Stop checking for failures from malloc(M_WAITOK).

PR: 240545
Submitted by: Andrew Reiter <arr@watson.org>
Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25766

3 years agovm_page_free_invalid(): Relax the xbusy assertion.
Mark Johnston [Mon, 27 Jul 2020 14:25:10 +0000 (14:25 +0000)]
vm_page_free_invalid(): Relax the xbusy assertion.

vm_page_assert_xbusied() asserts that the busying thread is the current
thread.  For some uses of vm_page_free_invalid() (e.g., error handling
in vnode_pager_generic_getpages_done()), this condition might not hold.

Reported by: Jenkins via trasz
Reviewed by: chs, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25828

3 years agotree.3: Bump date after 363450 (WAVL)
Mateusz Piotrowski [Mon, 27 Jul 2020 11:42:22 +0000 (11:42 +0000)]
tree.3: Bump date after 363450 (WAVL)

While here:
- Address whitespace warnings.
- Start sentences on a new line.

3 years agonologin.8: Improve wording
Mateusz Piotrowski [Mon, 27 Jul 2020 10:45:47 +0000 (10:45 +0000)]
nologin.8: Improve wording

Reported by: yuripv
Reviewed by: bcr, yuripv
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D25814

3 years agoactually enable gate control for allwinner's r-ccu ir clock
Andriy Gapon [Mon, 27 Jul 2020 09:10:02 +0000 (09:10 +0000)]
actually enable gate control for allwinner's r-ccu ir clock

The gate control bit offset was correctly specified, but AW_CLK_HAS_GATE
flag was not set.
Tested with (C)IR receiver on Orange Pi PC Plus.

Reviewed by: manu
MFC after: 1 week

3 years agoSupport the setting of additional AHCI controller parameters.
Peter Grehan [Mon, 27 Jul 2020 07:56:55 +0000 (07:56 +0000)]
Support the setting of additional AHCI controller parameters.

Allow the serial number, firmware revision, model number and nominal media
rotation rate (nmrr) parameters to be set from the command line.

Note that setting the nmrr value can be used to indicate the AHCI
device is an SSD.

Submitted by: Wanpeng Qian
Reviewed by: jhb, grehan (#bhyve)
Approved by: jhb, grehan
MFC after: 3 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D24174

3 years agomakesyscalls.sh: spit out a deprecation notice to stderr
Kyle Evans [Mon, 27 Jul 2020 03:13:23 +0000 (03:13 +0000)]
makesyscalls.sh: spit out a deprecation notice to stderr

This has for a while been replaced by makesyscalls.lua in the stock FreeBSD
build.  Ensure downstreams get some notice that it'a going away if they're
reliant on it, maybe.

3 years agoiflib: fix LOR with bpf detach
Matt Macy [Mon, 27 Jul 2020 01:17:59 +0000 (01:17 +0000)]
iflib: fix LOR with bpf detach

Reported by: grehan@
Approved by: grehan@
MFC after: 1 week
Sponsored by: Netgate
Differential Revision: https://reviews.freebsd.org/D25530

3 years agoFix the NFSv4 client so that it checks for support of TimeCreate before
Rick Macklem [Sun, 26 Jul 2020 23:13:10 +0000 (23:13 +0000)]
Fix the NFSv4 client so that it checks for support of TimeCreate before
trying to set it.

r362490 added support for setting of the TimeCreate (va_birthtime) attribute,
but it does so without checking to see if the server supports the attribute.
This could result in NFSERR_ATTRNOTSUPP error replies to the Setattr operation.
This patch adds code to check that the server supports TimeCreate before
attempting to do a Setattr of it to avoid these error returns.

3 years agoFix the NFS server so that it sets va_birthtime.
Rick Macklem [Sun, 26 Jul 2020 23:03:41 +0000 (23:03 +0000)]
Fix the NFS server so that it sets va_birthtime.

r362490 marked that the NFSv4 attribute TimeCreate (va_birthtime) is supported,
but it did not change the NFS server code to actually do it.
As such, errors could occur when unrolling a tarball onto an NFSv4 mounted
volume, since setting TimeCreate would fail with a NFSERR_ATTRNOTSUPP reply.

This patch fixes the server so that it does TimeCreate and also makes
sure that TimeCreate will not be set for a DS file for a pNFS server.

A separate commit will add a check to the NFSv4 client for support of
the TimeCreate attribute before attempting to set it, to avoid a problem
when mounting a server that does not support the attribute.
The failures will still occur for r362490 or later kernels that do not
have this patch, since they indicate support for the attribute, but do not
actually support the attribute.

3 years agogctl_get_geom: Skip validation of g_class.
Xin LI [Sun, 26 Jul 2020 22:30:55 +0000 (22:30 +0000)]
gctl_get_geom: Skip validation of g_class.

The caller from kernel is expected to provide an valid g_class
pointer, instead of traversing the global g_class list, just
use that pointer directly instead.

Reviewed by: mav
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25811

3 years agogeom_map and geom_redboot: Remove unused ctlreq handler.
Xin LI [Sun, 26 Jul 2020 22:30:01 +0000 (22:30 +0000)]
geom_map and geom_redboot: Remove unused ctlreq handler.

The two classes do not take any verbs and always gctl_error for
all requests, so don't bother to provide a ctlreq handler.

Reviewed by: mav
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25810

3 years agoVendor import of llvm-project branch release/11.x
Dimitry Andric [Sun, 26 Jul 2020 19:46:28 +0000 (19:46 +0000)]
Vendor import of llvm-project branch release/11.x
llvmorg-11-init-20933-g3c1fca803bc.