]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoReapply r344852:
dim [Thu, 6 Aug 2020 16:27:24 +0000 (16:27 +0000)]
Reapply r344852:

Put in a temporary workaround for what is likely a gcc 6 bug (it does
not occur with gcc 7 or later).  This should prevent the following error
from breaking the head-amd64-gcc CI builds:

In file included from /workspace/src/contrib/llvm/tools/lldb/source/API/SBMemoryRegionInfo.cpp:14:0:
/workspace/src/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h:128:54: error: 'template<class _InputIterator> lldb_private::MemoryRegionInfos::MemoryRegionInfos(_InputIterator, _InputIterator, const allocator_type&)' inherited from 'std::__1::vector<lldb_private::MemoryRegionInfo>'
   using std::vector<lldb_private::MemoryRegionInfo>::vector;
                                                      ^~~~~~
/workspace/src/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h:128:54: error: conflicts with version inherited from 'std::__1::vector<lldb_private::MemoryRegionInfo>'

Reported by: CI

3 years agoReapply r343111 (partially, by mckusick):
dim [Thu, 6 Aug 2020 16:25:56 +0000 (16:25 +0000)]
Reapply r343111 (partially, by mckusick):

Create new EINTEGRITY error with message "Integrity check failed".

An integrity check such as a check-hash or a cross-correlation failed.
The integrity error falls between EINVAL that identifies errors in
parameters to a system call and EIO that identifies errors with the
underlying storage media. EINTEGRITY is typically raised by intermediate
kernel layers such as a filesystem or an in-kernel GEOM subsystem when
they detect inconsistencies. Uses include allowing the mount(8) command
to return a different exit value to automate the running of fsck(8)
during a system boot.

These changes make no use of the new error, they just add it. Later
commits will be made for the use of the new error number and it will
be added to additional manual pages as appropriate.

Reviewed by:    gnn, dim, brueffer, imp
Discussed with: kib, cem, emaste, ed, jilles
Differential Revision: https://reviews.freebsd.org/D18765

3 years agoReapply r332965 (by emaste):
dim [Thu, 6 Aug 2020 16:20:45 +0000 (16:20 +0000)]
Reapply r332965 (by emaste):

lldb: remove assertion that target_arch is FreeBSD

The target is not necessarily a FreeBSD binary - for example, it may be
a Linux binary running under the linuxulator.  Basic ptrace (live)
debugging already worked in this case, except for the assertion.

Sponsored by: Turing Robotic Industries Inc.

3 years agoReapply r329859 (partially, by imp):
dim [Thu, 6 Aug 2020 16:12:13 +0000 (16:12 +0000)]
Reapply r329859 (partially, by imp):

Do not include float interfaces when using libsa.

We don't support float in the boot loaders, so don't include
interfaces for float or double in systems headers. In addition, take
the unusual step of spiking double and float to prevent any more
accidental seepage.

3 years agoReapply r327151 (partially):
dim [Thu, 6 Aug 2020 15:46:39 +0000 (15:46 +0000)]
Reapply r327151 (partially):

For our lldb customizations, instead of commenting out lines, use #ifdef
LLDB_ENABLE_ALL / #endif preprocess directives instead, so our diffs
against upstream only consist of added lines.

(Note that upstream has largely reshuffled the way optional lldb plugins
are handled, so we need a lot less of these #ifdefs. However, not all of
them can be dropped, unless we re-import several sources that we have
always skipped.)

3 years agoUndo r230021 again, further shrinking the diff against upstream.
dim [Mon, 3 Aug 2020 17:51:57 +0000 (17:51 +0000)]
Undo r230021 again, further shrinking the diff against upstream.

This revision worked around an endless recursion when compiling clzdi2.c
and ctzdi2.c with gcc, upstream landed a different workaround for this
in https://reviews.llvm.org/rL324593, which is effective enough.

Noticed by: jrtc27

3 years agoReapply r327026 (partially):
dim [Sun, 2 Aug 2020 18:34:29 +0000 (18:34 +0000)]
Reapply r327026 (partially):

Merge lld trunk r321017 to contrib/llvm/tools/lld.

(Note that in this merge, I foolishly combined upstream changes with
this local change. But only this ifdef part is really needed, as we
always default to ELF link mode.)

3 years agoReapply r326600 (by imp):
dim [Sun, 2 Aug 2020 18:30:29 +0000 (18:30 +0000)]
Reapply r326600 (by imp):

Since this is contrib code, create an upstreamable version of my
change. Now on FreeBSD and NetBSD if _STANDALONE is defined, we
include the kernel version with alloances for the quirky differences
between the two.

Sponsored by: Netflix

3 years agoReapply r322168 (partially, by br):
dim [Sun, 2 Aug 2020 18:27:59 +0000 (18:27 +0000)]
Reapply r322168 (partially, by br):

o Replace __riscv__ with __riscv
o Replace __riscv64 with (__riscv && __riscv_xlen == 64)

This is required to support new GCC 7.1 compiler.
This is compatible with current GCC 6.1 compiler.

RISC-V is extensible ISA and the idea here is to have built-in define
per each extension, so together with __riscv we will have some subset
of these as well (depending on -march string passed to compiler):

__riscv_compressed
__riscv_atomic
__riscv_mul
__riscv_div
__riscv_muldiv
__riscv_fdiv
__riscv_fsqrt
__riscv_float_abi_soft
__riscv_float_abi_single
__riscv_float_abi_double
__riscv_cmodel_medlow
__riscv_cmodel_medany
__riscv_cmodel_pic
__riscv_xlen

Reviewed by: ngie
Sponsored by: DARPA, AFRL

Differential Revision: https://reviews.freebsd.org/D11901

3 years agoReapply r311165:
dim [Sun, 2 Aug 2020 18:18:16 +0000 (18:18 +0000)]
Reapply r311165:

Disable PDB support in LLVMSymbolizer for now, to avoid llvm-objdump
pulling in all the PDB handling code.

3 years agoReapply r311164:
dim [Sun, 2 Aug 2020 18:16:04 +0000 (18:16 +0000)]
Reapply r311164:

Fix printf format warning on i386.

3 years agoReapply r310365 (by emaste):
dim [Sun, 2 Aug 2020 18:12:14 +0000 (18:12 +0000)]
Reapply r310365 (by emaste):

libunwind: make __{de,}register_frame compatible with libgcc API

The libgcc __register_frame and __deregister_frame functions take a
pointer to a set of FDE/CIEs, terminated by an entry where length is 0.

In Apple's libunwind implementation the pointer is taken to be to a
single FDE. I suspect this was just an Apple bug, compensated by Apple-
specific code in LLVM.

See lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp and
http://lists.llvm.org/pipermail/llvm-dev/2013-April/061737.html
for more detail.

This change is based on the LLVM RTDyldMemoryManager.cpp. It should
later be changed to be alignment-safe.

Reported by: dim
Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8869

Reapply r351610:

Update libunwind custom frame register and deregister functions for
FreeBSD: use the new doubly underscored names for unw_add_dynamic_fde
and unw_remove_dynamic_fde.

NOTE: this should be upstreamed...

3 years agoReapply r230021, r276851 and a few other commits to compiler-rt
dim [Sun, 2 Aug 2020 18:07:16 +0000 (18:07 +0000)]
Reapply r230021, r276851 and a few other commits to compiler-rt

Reapply r230021 (by ed):

Add a workaround to prevent endless recursion in compiler-rt.

SPARC and MIPS CPUs don't have special instructions to count
leading/trailing zeroes. The compiler-rt library provides fallback
rountines for these. The 64-bit routines, __clzdi2 and __ctzdi2, are
implemented as simple wrappers around the compiler built-in
__builtin_clz(), assuming these will expand to either 32-bit
CPU instructions or calls to __clzsi2 and __ctzsi2.

Unfortunately, our GCC 4.2 probably thinks that because the operand is
stored in a 64-bit register, it might just be a better idea to invoke
its 64-bit equivalent, simply resulting into endless recursion. Fix this
by defining __builtin_clz and __builtin_ctz to __clzsi2 and __ctzsi2
explicitly.

Reapply r276851:

Update compiler-rt to trunk r224034.  This brings a number of new
builtins, and also the various sanitizers.  Support for these will be
added in a later commit.

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [Fri, 31 Jul 2020 22:23:32 +0000 (22:23 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-rc1-25-g903c872b169.

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [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
dim [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.
dim [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
stevek [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
0mp [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.
markj [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().
markj [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
kevans [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.
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
arichardson [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
rrs [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
kevans [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
cem [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
cem [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
cem [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.
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)
cem [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
mjg [Thu, 30 Jul 2020 22:56:57 +0000 (22:56 +0000)]
Fix tinderbox build after r363714

3 years agocache: drop the useless numchecks counter
mjg [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
mjg [Thu, 30 Jul 2020 22:14:04 +0000 (22:14 +0000)]
Further depessimize priv_check_cred_vfs_generation

3 years agofd: predict in fdrop
mjg [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().
markj [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
mjg [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
mjg [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
mjg [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
mjg [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
mjg [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
mjg [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.
mmel [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
kevans [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
kevans [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.
whu [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
mjg [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
jmg [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().
markj [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
kevans [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.
jhb [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
kevans [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().
rmacklem [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
br [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..
jmg [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.
markj [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 [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.
br [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
mjg [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
mjg [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.
br [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
br [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
debdrup [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
debdrup [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 [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.
rew [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
emaste [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.
mav [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
csjp [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.
markj [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.
jhb [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.
br [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.
markj [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 [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 [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 [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.
nyan [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 [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 [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 [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 [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 [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
mw [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 [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 [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
freqlabs [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
kevans [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
emaste [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.
mav [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).
markj [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
asomers [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
pstef [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
fernape [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.
jhb [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.
jhb [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.
jhb [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.
jhb [Mon, 27 Jul 2020 16:31:21 +0000 (16:31 +0000)]
Fix indentation.

3 years agoSet si_trapno to the fault index from fsr.
jhb [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.
jhb [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.
jhb [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