]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoUse bootstrapped install(1) install of tools/install.sh in world stage
arichardson [Tue, 25 Aug 2020 13:30:14 +0000 (13:30 +0000)]
Use bootstrapped install(1) install of tools/install.sh in world stage

This should be noticeably faster due to fewer processes being forked and
also handles other flags such as -S or writing to METALOG.

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

3 years agoFix running the builddtb target on a noexec file system
arichardson [Tue, 25 Aug 2020 13:30:09 +0000 (13:30 +0000)]
Fix running the builddtb target on a noexec file system

Obtained from: CheriBSD

3 years agoPass -fuse-ld=/path/to/ld if ${LD} != "ld"
arichardson [Tue, 25 Aug 2020 13:30:03 +0000 (13:30 +0000)]
Pass -fuse-ld=/path/to/ld if ${LD} != "ld"

This is needed so that setting LD/XLD is not ignored when linking with $CC
instead of directly using $LD. Currently only clang accepts an absolute
path for -fuse-ld= (Clang 12+ will add a new --ld-path flag), so we now
warn when building with GCC and $LD != "ld" since that might result in the
wrong linker being used.

We have been setting XLD=/path/to/cheri/ld.lld in CheriBSD for a long time and
used a similar version of this patch to avoid linking with /usr/bin/ld.
This change is also required when building FreeBSD on an Ubuntu with Clang:
In that case we set XCC=/usr/lib/llvm-10/bin/clang and since
/usr/lib/llvm-10/bin/ does not contain a "ld" binary the build fails with
`clang: error: unable to execute command: Executable "ld" doesn't exist!`
unless we pass -fuse-ld=/usr/lib/llvm-10/bin/ld.lld.

This change passes -fuse-ld instead of copying ${XLD} to WOLRDTMP/bin/ld
since then we would have to ensure that this file does not exist while
building the bootstrap tools. The cross-linker might not be compatible with
the host linker (e.g. when building on macos: host-linker= Mach-O /usr/bin/ld,
cross-linker=LLVM ld.lld).

Reviewed By: brooks, emaste
Differential Revision: https://reviews.freebsd.org/D26055

3 years agoAdd necessary Makefile.inc1 infrastructure for building on non-FreeBSD
arichardson [Tue, 25 Aug 2020 13:29:57 +0000 (13:29 +0000)]
Add necessary Makefile.inc1 infrastructure for building on non-FreeBSD

The most awkward bit in this patch is the bootstrapping of m4:
We can't simply use the host version of m4 since that is not compatible
with the flags passed by lex (at least on macOS, possibly also on Linux).
Therefore we need to bootstrap m4, but lex needs m4 to build and m4 also
depends on lex (which needs m4 to generate any files). To work around this
cyclic dependency we can build a bootstrap version of m4 (with pre-generated
files) then use that to build the real m4.

This patch also changes the xz/unxz/dd tools to always use the host version
since the version in the source tree cannot easily be bootstrapped on macOS
or Linux.

Reviewed By: brooks, imp (earlier version)
Differential Revision: https://reviews.freebsd.org/D25992

3 years agoAdd missing FreeBSD functions to -legacy when building on macOS/Linux
arichardson [Tue, 25 Aug 2020 13:23:31 +0000 (13:23 +0000)]
Add missing FreeBSD functions to -legacy when building on macOS/Linux

In most cases this simply builds the file from lib/libc for missing
functions (e.g. strlcpy on Linux etc.). In cases where this is not possible
I've added an implementation to tools/build/cross-build.

The fgetln.c/fgetwln.c/closefrom.c compatibility code was obtained from
https://gitlab.freedesktop.org/libbsd/libbsd, but I'm not sure it makes
sense to import it into to contrib just for these three bootstrap files.

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

3 years agoAdd mlx5en(4) to the list of supported netdump network drivers.
hselasky [Tue, 25 Aug 2020 13:21:49 +0000 (13:21 +0000)]
Add mlx5en(4) to the list of supported netdump network drivers.

MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoAdd Linux/macOS compatibility system headers to tools/build/cross-build
arichardson [Tue, 25 Aug 2020 13:18:53 +0000 (13:18 +0000)]
Add Linux/macOS compatibility system headers to tools/build/cross-build

These headers are required in order to build the bootstrap tools on macOS
and Linux. A follow-up commit will add implementations of functions that
don't exist on those operating systems to -legacy when bootstrapping.

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

3 years agoRFC 3465 defines a limit L used in TCP slow start for limiting the number
tuexen [Tue, 25 Aug 2020 09:42:03 +0000 (09:42 +0000)]
RFC 3465 defines a limit L used in TCP slow start for limiting the number
of acked bytes as described in Section 2.2 of that document.
This patch ensures that this limit is not also applied in congestion
avoidance. Applying this limit also in congestion avoidance can result in
using less bandwidth than allowed.

Reported by: l.tian.email@gmail.com
Reviewed by: rrs, rscheff
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D26120

3 years agoAdd atomic and bswap functions to libcompiler_rt
dim [Tue, 25 Aug 2020 06:49:10 +0000 (06:49 +0000)]
Add atomic and bswap functions to libcompiler_rt

There have been several mentions on our mailing lists about missing
atomic functions in our system libraries (e.g. __atomic_load_8 and
friends), and recently I saw __bswapdi2 and __bswapsi2 mentioned too.

To address this, add implementations for the functions from compiler-rt
to the system compiler support libraries, e.g. libcompiler_rt.a and and
libgcc_s.so.

This also needs a small fixup in compiler-rt's atomic.c, to ensure that
32-bit mips can build correctly.

Bump __FreeBSD_version to make it easier for port maintainers to detect
when these functions were added.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26159

3 years agoFix libzfs build failures for some
mmacy [Tue, 25 Aug 2020 03:43:52 +0000 (03:43 +0000)]
Fix libzfs build failures for some

In some environments adding zstd/include to the include path
would cause zstd's stdlib.h to hide the system one.

3 years agoMention OpenZFS merge in UPDATING
mmacy [Tue, 25 Aug 2020 02:42:48 +0000 (02:42 +0000)]
Mention OpenZFS merge in UPDATING

3 years agoBump __FreeBSD_version for OpenZFS switchover
mmacy [Tue, 25 Aug 2020 02:22:49 +0000 (02:22 +0000)]
Bump __FreeBSD_version for OpenZFS switchover

3 years agoMerge OpenZFS support in to HEAD.
mmacy [Tue, 25 Aug 2020 02:21:27 +0000 (02:21 +0000)]
Merge OpenZFS support in to HEAD.

The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.

I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.

Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.

Improvements include:
  project quotas, encrypted datasets,
  allocation classes, vectorized raidz,
  vectorized checksums, various command line
  improvements, zstd compression.

Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.

Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872

3 years agoFix hangs with processes stuck sleeping on btalloc on i386.
rmacklem [Tue, 25 Aug 2020 00:58:14 +0000 (00:58 +0000)]
Fix hangs with processes stuck sleeping on btalloc on i386.

r358097 introduced a problem for i386, where kernel builds will intermittently
get hung, typically with many processes sleeping on "btalloc".
I know nothing about VM, but received assistance from rlibby@ and markj@.

rlibby@ stated the following:
   It looks like the problem is that
   for systems that do not have UMA_MD_SMALL_ALLOC, we do
           uma_zone_set_allocf(vmem_bt_zone, vmem_bt_alloc);
   but we haven't set an appropriate free function.  This is probably why
   UMA_ZONE_NOFREE was originally there.  When NOFREE was removed, it was
   appropriate for systems with uma_small_alloc.

   So by default we get page_free as our free function.  That calls
   kmem_free, which calls vmem_free ... but we do our allocs with
   vmem_xalloc.  I'm not positive, but I think the problem is that in
   effect we vmem_xalloc -> vmem_free, not vmem_xfree.

   Three possible fixes:
    1: The one you tested, but this is not best for systems with
       uma_small_alloc.
    2: Pass UMA_ZONE_NOFREE conditional on UMA_MD_SMALL_ALLOC.
    3: Actually provide an appropriate vmem_bt_free function.

   I think we should just do option 2 with a comment, it's simple and it's
   what we used to do.  I'm not sure how much benefit we would see from
   option 3, but it's more work.

This patch implements #2. I haven't done a comment, since I don't know
what the problem is.

markj@ noted the following:
   I think the suggested patch is ok, but not for the reason stated.
   On platforms without a direct map the problem is:
   to allocate btags we need a slab,
   and to allocate a slab we need to map a page, and to map a page we need
   to allocate btags.

   We handle this recursion using a custom slab allocator which specifies
   M_USE_RESERVE, allowing it to dip into a reserve of free btags.
   Because the returned slab can be used to keep the reserve populated,
   this ensures that there are always enough free btags available to
   handle the recursion.

   UMA_ZONE_NOFREE ensures that we never reclaim free slabs from the zone.
   However, when it was removed, an apparent bug in UMA was exposed:
   keg_drain() ignores the reservation set by uma_zone_reserve()
   in vmem_startup().
   So under memory pressure we reclaim the free btags that are needed to
   break the recursion.
   That's why adding _NOFREE back fixes the problem: it disables the
   reclamation.

   We could perhaps fix it more cleverly, by modifying keg_drain() to always
   leave uk_reserve slabs available.

markj@'s initial patch failed testing, so committing this patch was agreed
upon as the interim solution.
Either rlibby@ or markj@ might choose to add a comment to it.

PR: 248008
Reviewed by: rlibby, markj

3 years agoInitial import from vendor-sys branch of openzfs
mmacy [Mon, 24 Aug 2020 23:31:26 +0000 (23:31 +0000)]
Initial import from vendor-sys branch of openzfs

3 years agodrm2: Update deprecation message
zeising [Mon, 24 Aug 2020 22:53:23 +0000 (22:53 +0000)]
drm2: Update deprecation message

Update the deprecation message in the drm2 (aka legacy drm) drivers to point
towards the graphics/drm-kmod ports for all architectures, not just amd64.
drm-kmod has support for more architectures these days, and the
graphics/drm-legacy-kmod port is being deprecated.

Approved by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26174

3 years agoVendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
mmacy [Mon, 24 Aug 2020 22:48:19 +0000 (22:48 +0000)]
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b

Sponsored by: iX Systems, Inc.

3 years agoRestore workaround for sysret fault on non-canonical address after LA57.
kib [Mon, 24 Aug 2020 22:12:45 +0000 (22:12 +0000)]
Restore workaround for sysret fault on non-canonical address after LA57.

Sponsored by: The FreeBSD Foundation

3 years agoAfter r364732, we can now enable MK_OPENMP for aarch64 by default.
dim [Mon, 24 Aug 2020 20:40:26 +0000 (20:40 +0000)]
After r364732, we can now enable MK_OPENMP for aarch64 by default.

PR: 248864
MFC after: 2 weeks

3 years agoMerge commit cde8f4c16 from llvm git (by me):
dim [Mon, 24 Aug 2020 20:37:18 +0000 (20:37 +0000)]
Merge commit cde8f4c16 from llvm git (by me):

  Move special va_list handling to kmp_os.h

  Instead of copying and pasting the same #ifdef expressions in
  multiple places, define a type and a pair of macros in kmp_os.h, to
  handle whether va_list is pointer-like or not:

  * kmp_va_list is the type to use for __kmp_fork_call()
  * kmp_va_deref() dereferences a va_list, if necessary
  * kmp_va_addr_of() takes the address of a va_list, if necessary

  Also add FreeBSD to the list of OSes that has a non pointer-like
  va_list. This can now be easily extended to other OSes too.

  Reviewed By: AndreyChurbanov

  Differential Revision: https://reviews.llvm.org/D86397

This should enable building of LLVM's OpenMP on AArch64. Addition to
share/mk will follow in a subsequent commit.

PR: 248864
MFC after: 2 weeks

3 years agonetmap: use FreeBSD guards for epoch calls
vmaffione [Mon, 24 Aug 2020 20:28:21 +0000 (20:28 +0000)]
netmap: use FreeBSD guards for epoch calls

EPOCH calls are FreeBSD specific. Use guards to protect these, so
that the code can compile under Linux.

MFC after: 1 week

3 years agoRemove RT_LOCK mutex from rte.
melifaro [Mon, 24 Aug 2020 20:23:34 +0000 (20:23 +0000)]
Remove RT_LOCK mutex from rte.

rtentry lock traditionally served 2 purposed: first was protecting refcounts,
 the second was assuring consistent field access/changes.
Since route nexthop introduction, the need for the former disappeared and
 the need for the latter reduced.
To be more precise, the following rte field are mutable:

rt_nhop (nexthop pointer, updated with RIB_WLOCK, passed in rib_cmd_info)
rte_flags (only RTF_HOST and RTF_UP, where RTF_UP gets changed at rte removal)
rt_weight (relative weight, updated with RIB_WLOCK, passed in rib_cmd_info)
rt_expire (time when rte deletion is scheduled, updated with RIB_WLOCK)
rt_chain (deletion chain pointer, updated with RIB_WLOCK)
All of them are updated under RIB_WLOCK, so the only remaining concern is the reading.

rt_nhop and rt_weight (addressed in this review) are read under rib lock and
 stored in the rib_cmd_info, so the caller has no problem with consitency.
rte_flags is currently read unlocked in rtsock reporting (however the scope
 is only RTF_UP flag, which is pretty static).
rt_expire is currently read unlocked in rtsock reporting.
rt_chain accesses are safe, as this is only used at route deletion.

rt_expire and rte_flags reads will be dealt in a separate reviews soon.

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

3 years agoFix silly typo...
imp [Mon, 24 Aug 2020 20:02:13 +0000 (20:02 +0000)]
Fix silly typo...

3 years agoDocument devd event change from r364725
imp [Mon, 24 Aug 2020 19:49:22 +0000 (19:49 +0000)]
Document devd event change from r364725

3 years agoDocument the kern -> kernel name change for resume events.
imp [Mon, 24 Aug 2020 19:35:27 +0000 (19:35 +0000)]
Document the kern -> kernel name change for resume events.

MFC After: 3 days

3 years agoChange the resume notification event from 'kern' to 'kernel'
imp [Mon, 24 Aug 2020 19:35:15 +0000 (19:35 +0000)]
Change the resume notification event from 'kern' to 'kernel'

We have both a system of 'kern' and of 'kernel'. Prefer the latter and
convert this notification to use 'kernel' instead of 'kern'. As a
transition period, continue to also generate the 'kern' notification
until sometime after FreeBSD 13 is branched.

MFC After: 3 days

3 years agocache: remove leftover assert in vn_fullpath_any_smr
mjg [Mon, 24 Aug 2020 18:23:58 +0000 (18:23 +0000)]
cache: remove leftover assert in vn_fullpath_any_smr

It is only valid when !slash_prefixed. For slash_prefixed the length
is properly accounted for later.

Reported by: markj (syzkaller)

3 years agoUpdate unbound version number.
cy [Mon, 24 Aug 2020 18:17:13 +0000 (18:17 +0000)]
Update unbound version number.

MFC after: 1 month
X-MFC with: r364721

3 years agoMFV 364468:
cy [Mon, 24 Aug 2020 18:14:04 +0000 (18:14 +0000)]
MFV 364468:

Update unbound 1.10.1 --> 1.11.0.

MFH: 1 month

3 years agoMFV 364467:
cy [Mon, 24 Aug 2020 18:13:44 +0000 (18:13 +0000)]
MFV 364467:

Update sqlite to 3.33.0 (3330000).

Release announcement at https://www.sqlite.org/releaselog/3_33_0.html.

MFC after: 1 month

3 years agow(1): Add EXAMPLES to man page
fernape [Mon, 24 Aug 2020 17:57:08 +0000 (17:57 +0000)]
w(1): Add EXAMPLES to man page

Add small example section showing general use and -d and -h flags

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

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [Mon, 24 Aug 2020 17:43:23 +0000 (17:43 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-rc2-0-g414f32a9e86.

MFC after: 6 weeks
X-MFC-With: r364284

3 years agoIn the endless batch mode (-B), terminate if and when stdout is closed.
sobomax [Mon, 24 Aug 2020 16:45:23 +0000 (16:45 +0000)]
In the endless batch mode (-B), terminate if and when stdout is closed.
That mode is useful to call gstat from other app, however kinda useless
since gstat won't exit and stay running forever when its parent process
has long gone.

MFC after: 2 weeks

3 years agoWhen copying over the binaries, use '-p' to preserve date/time
imp [Mon, 24 Aug 2020 16:06:11 +0000 (16:06 +0000)]
When copying over the binaries, use '-p' to preserve date/time

Although I can't reproduce it, others are seeing different lex/yacc
programs always regenerated after my change to copy rather than
symlink the files. The reported fix is to add '-p' to the copies.
Since it doesn't hurt, go head and add it, though the reasons for
this mattering remain at best obscure and poorly articulated.

3 years agos/redundacy/redundancy
blackend [Mon, 24 Aug 2020 14:04:59 +0000 (14:04 +0000)]
s/redundacy/redundancy

MFC after: 1 week

3 years agoAdd missing Korean doc package entry, remove non-existent Serbian doc
blackend [Mon, 24 Aug 2020 14:00:12 +0000 (14:00 +0000)]
Add missing Korean doc package entry, remove non-existent Serbian doc
package entry.

Approved by: re (gjb)
MFC after: 1 week

3 years ago[PowerPC] Make new auxv format default
luporl [Mon, 24 Aug 2020 13:40:35 +0000 (13:40 +0000)]
[PowerPC] Make new auxv format default

Assume ELF images without OSREL use the new auxv format.

This is specially important for rtld, that is not tagged. Using
direct exec mode with new (ELFv2) binaries that expect the new auxv
format would result in crashes otherwise.

Unfortunately, this may break direct exec'ing old binaries,
but it seems better to correctly support new binaries by default,
considering the transition to ELFv2 happened quite some time
ago. If needed, a sysctl may be added to allow old auxv format to
be used when OSREL is not found.

Reviewed by: bdragon
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D25651

3 years agonet80211: enhance getflags*() and ieee80211_add_channel*()
bz [Mon, 24 Aug 2020 13:15:08 +0000 (13:15 +0000)]
net80211: enhance getflags*() and ieee80211_add_channel*()

For ieee80211_add_channel+*() we are passing in an int flag for
ht40 and in some cases another int flag for vht80 where we'd only
need two bits really.
Convert these variables to a bitflag and fold them together into one.
This also allows for VHT160 and VHT80P80 and whatever may come to
be considered. Define the various options currently needed.

Change the drivers (rtwn and rsu) which actually set this bit to non-0.
For convenience the "1" currently used for HT40 is preserved.

Enahnce getflags_5ghz() to handle the full set of VHT flags based
on the input flags from the the driver.

Update the regdomain implementation as well to make use of the new
flags and deal with higher [V]HT bandwidths.

ieee80211_add_channel() specifically did not take flags so it will
not support naything beyond 20Mhz channels.

Note: I am not entirely happy with the "cbw_flag[s]" name, but we
do use chan_flags elsewhere already.

MFC after: 2 weeks
Reviewed by: adrian, gnn
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
Differential revision: https://reviews.freebsd.org/D26091

3 years agocpu_auxmsr: assert caller is preventing CPU migration.
grehan [Mon, 24 Aug 2020 11:49:49 +0000 (11:49 +0000)]
cpu_auxmsr: assert caller is preventing CPU migration.

Submitted by: Adam Fenn (adam at fenn dot io)
Requested by: kib
Reviewed by: kib, grehan
Approved by: kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D26166

3 years agoiflib: fix isc_rxd_flush call in netmap_fl_refill()
vmaffione [Mon, 24 Aug 2020 11:44:20 +0000 (11:44 +0000)]
iflib: fix isc_rxd_flush call in netmap_fl_refill()

The semantic of the pidx argument of isc_rxd_flush() is the
last valid index of in the free list, rather than the next
index to be published. However, netmap was still using the
old convention. While there, also refactor the netmap_fl_refill()
to simplify a little bit and add an assertion.

MFC after: 2 weeks

3 years agoAlso print number of available CPUs on Linux
arichardson [Mon, 24 Aug 2020 09:20:38 +0000 (09:20 +0000)]
Also print number of available CPUs on Linux

Without this change the buildworld/buildkernel epilogue looks like this:
>>> World built in 249 seconds, sysctl: cannot stat /proc/sys/hw/ncpu: No such file or directory
ncpu: , make -j72.

Reviewed By: emaste, bdrewery
Differential Revision: https://reviews.freebsd.org/D26056

3 years agoAvoid adding duplicates to SRCS/OBJS/SOBJS/POBJS
arichardson [Mon, 24 Aug 2020 09:20:33 +0000 (09:20 +0000)]
Avoid adding duplicates to SRCS/OBJS/SOBJS/POBJS

This is a change in preparation for stopping to use lorder.sh (D26044) and
instead assume that we have a linker newer than ~1990. Without lorder.sh
duplicates end up being passed to the linker when building .so files and this
can result in duplicate symbol definition errors.

There is one minor change: libcompiler_rt.a will no longer provide
gcc_personality_v0 and instead we now only have it in libgcc_eh.a/libgcc_s.so.
This matches GCC's behaviour.

Reviewed By: emaste, cem
Differential Revision: https://reviews.freebsd.org/D26042

3 years agomakefs (msdosfs): Use fprintf instead of debug print for errors
arichardson [Mon, 24 Aug 2020 09:20:27 +0000 (09:20 +0000)]
makefs (msdosfs): Use fprintf instead of debug print for errors

The added print was very helpful for debugging failed disk image creation.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D23200

3 years agoCorrectly determine the real executable in crunched binaries
arichardson [Mon, 24 Aug 2020 09:20:23 +0000 (09:20 +0000)]
Correctly determine the real executable in crunched binaries

This should fix cases like su setting argv[0] to _su for /bin/sh.
Previously cheribsdbox (a crunched tool we use in CheriBSD to reduce the
size of our minimal disk images to allow loading them onto FPGAs without
waiting forever for the transfer) would complain about _su not being
compiled in, but now that we also look at AT_EXECPATH it correctly
invokes the sh tool.

Note: we use use AT_EXECPATH instead of the KERN_PROC_PATHNAME sysctl to get
the crunchgen binary name since it seems like KERN_PROC_PATHNAME just
returns the last cached path for a given hardlink.
When using `su`, instead of invoking /bin/csh this would invoke the last
used hardlink to cheribsdbox. This caused weird test failures when running
tests due to `id` being executed instead of `echo`:

$ id  # id is a hardlink to /bin/cheribsdbox
$ su postgres -c 'echo 1' # su is also a hardlink
uid=1001(postgres) gid=1001(postgres) groups=1001(postgres)

Obtained from: CheriBSD

Reviewed By: emaste, brooks
Differential Revision: https://reviews.freebsd.org/D25998

3 years agoRe-indent crunched_main.c in preparation for D25998
arichardson [Mon, 24 Aug 2020 09:20:18 +0000 (09:20 +0000)]
Re-indent crunched_main.c in preparation for D25998

3 years agoPass the installworld install(1) flags to make buildenv
arichardson [Mon, 24 Aug 2020 09:20:13 +0000 (09:20 +0000)]
Pass the installworld install(1) flags to make buildenv

This ensure that running make install inside buildenv correctly includes
the METALOG flags when building with -DNO_ROOT.

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

3 years agocache: lockless reverse lookup
mjg [Mon, 24 Aug 2020 09:00:57 +0000 (09:00 +0000)]
cache: lockless reverse lookup

This enables fully scalable operation for getcwd and significantly improves
realpath.

For example:
PATH_CUSTOM=/usr/src ./getcwd_processes -t 104
before:  1550851
after: 380135380

Tested by: pho

3 years agocache: drop the always curthread argument from reverse lookup routines
mjg [Mon, 24 Aug 2020 08:57:02 +0000 (08:57 +0000)]
cache: drop the always curthread argument from reverse lookup routines

Note VOP_VPTOCNP keeps getting it as temporary compatibility for zfs.

Tested by: pho

3 years agocache: perform reverse lookup using v_cache_dd if possible
mjg [Mon, 24 Aug 2020 08:55:55 +0000 (08:55 +0000)]
cache: perform reverse lookup using v_cache_dd if possible

Tested by: pho

3 years agocache: populate v_cache_dd for non-VDIR entries
mjg [Mon, 24 Aug 2020 08:55:04 +0000 (08:55 +0000)]
cache: populate v_cache_dd for non-VDIR entries

It makes v_cache_dd into a little bit of a misnomer and it may be addressed later.

Tested by: pho

3 years agobhyve: NVMe queue create must init head/tail
chuck [Mon, 24 Aug 2020 01:51:21 +0000 (01:51 +0000)]
bhyve: NVMe queue create must init head/tail

The NVMe emulation code did not explicitly initialize queue head and
tail pointers on queue creation. As these pointers are part of
calloc()'ed memory, this only becomes a problem if the queues are
deleted and then recreated.

This error can manifest with messages about completions not matching a
command.

3 years agobhyve: NVMe set nominal health values
chuck [Mon, 24 Aug 2020 01:51:17 +0000 (01:51 +0000)]
bhyve: NVMe set nominal health values

Some operating systems believe bhyve's emulated NVMe drive is failing
based on certain values in the SMART / Health Information log page being
zero. Fix is to set the reported temperature and available spare values
to reasonable defaults.

Submitted by: wanpengqian@gmail.com
Reviewed by:    grehan
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D24202

3 years agocaroot: switch to using echo+shell glob to enumerate certs
kevans [Sun, 23 Aug 2020 23:56:57 +0000 (23:56 +0000)]
caroot: switch to using echo+shell glob to enumerate certs

This solves an issue on stable/12 that causes certs to not get installed.
ls is apparently not in PATH during installworld, so TRUSTED_CERTS ends up
blank and nothing gets installed. We don't really require anything
ls-specific, though, so let's just simplify it.

MFC after: 3 days

3 years agonet80211: improve media information for VHT5GHZ
bz [Sun, 23 Aug 2020 21:42:23 +0000 (21:42 +0000)]
net80211: improve media information for VHT5GHZ

Improve ieee80211_media_setup(), media2mode(), and
ieee80211_rate2media() for VHT5GHZ at least.

Reviewed by: adrian, gnn
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision: https://reviews.freebsd.org/D26089

3 years agonet80211: set_vht_extchan() reverse order to always return best
bz [Sun, 23 Aug 2020 21:37:20 +0000 (21:37 +0000)]
net80211: set_vht_extchan() reverse order to always return best

In set_vht_extchan() the checks are performed in the order of VHT20/40/80.
That means if a channel has a lower and higheer VHT flag set we would
return the lower first.
We normally do not set more than one VHT flag so this change is supposed
to be a NOP but follows the logical thinking order of returning the best
first. Also we nowhere assert a single VHT flag so make sure we'll not
be stuck with VHT20 when we could do more.

While here add the debugging printfs for VHT160 and VHT80P80 which still
need doing once we deal with a driver at that level.

Reviewed by: adrian, gnn
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision: https://reviews.freebsd.org/D26088

3 years agovfs: validate ndp state after the lookup
mjg [Sun, 23 Aug 2020 21:06:41 +0000 (21:06 +0000)]
vfs: validate ndp state after the lookup

The intent is to remove known-to-be-nops NDFREE calls after many lookups.

3 years agovfs: convert nameiop into an enum
mjg [Sun, 23 Aug 2020 21:05:39 +0000 (21:05 +0000)]
vfs: convert nameiop into an enum

While here change the field size from long to int and move it into the
gap next to cn_flags.

Shrinks struct componentname from 64 to 56 bytes on amd64.

3 years agovfs: support denying access in vaccess_vexec_smr
mjg [Sun, 23 Aug 2020 21:05:06 +0000 (21:05 +0000)]
vfs: support denying access in vaccess_vexec_smr

3 years agovfs: factor away doomed vnode handling into vdropl_final
mjg [Sun, 23 Aug 2020 21:04:35 +0000 (21:04 +0000)]
vfs: factor away doomed vnode handling into vdropl_final

3 years agoprocctl(8): usermode bits to force LA58/LA57 on exec.
kib [Sun, 23 Aug 2020 20:44:15 +0000 (20:44 +0000)]
procctl(8): usermode bits to force LA58/LA57 on exec.

Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

3 years agoamd64: Handle 5-level paging on wakeup.
kib [Sun, 23 Aug 2020 20:43:23 +0000 (20:43 +0000)]
amd64: Handle 5-level paging on wakeup.

We can switch into long mode directly with LA57 enabled.

Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

3 years agoamd64: Handle 5-level paging for efirt calls.
kib [Sun, 23 Aug 2020 20:40:35 +0000 (20:40 +0000)]
amd64: Handle 5-level paging for efirt calls.

Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

3 years agoFix another minor style glitch.
imp [Sun, 23 Aug 2020 20:38:10 +0000 (20:38 +0000)]
Fix another minor style glitch.

Pull { to the end of the struct line rather than having them on their
own line.

3 years agoAdd bhyve support for LA57 guest mode.
kib [Sun, 23 Aug 2020 20:37:21 +0000 (20:37 +0000)]
Add bhyve support for LA57 guest mode.

Noted and reviewed by: grehan
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

3 years agoAdd amd64 procctl(2) ops to manage forced LA48/LA57 VA after exec.
kib [Sun, 23 Aug 2020 20:32:13 +0000 (20:32 +0000)]
Add amd64 procctl(2) ops to manage forced LA48/LA57 VA after exec.

Tested by: pho (LA48 hardware)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

3 years agoamd64 pmap: LA57 AKA 5-level paging
kib [Sun, 23 Aug 2020 20:19:04 +0000 (20:19 +0000)]
amd64 pmap: LA57 AKA 5-level paging

Since LA57 was moved to the main SDM document with revision 072, it
seems that we should have a support for it, and silicons are coming.

This patch makes pmap support both LA48 and LA57 hardware.  The
selection of page table level is done at startup, kernel always
receives control from loader with 4-level paging.  It is not clear how
UEFI spec would adapt LA57, for instance it could hand out control in
LA57 mode sometimes.

To switch from LA48 to LA57 requires turning off long mode, requesting
LA57 in CR4, then re-entering long mode.  This is somewhat delicate
and done in pmap_bootstrap_la57().  AP startup in LA57 mode is much
easier, we only need to toggle a bit in CR4 and load right value in CR3.

I decided to not change kernel map for now.  Single PML5 entry is
created that points to the existing kernel_pml4 (KML4Phys) page, and a
pml5 entry to create our recursive mapping for vtopte()/vtopde().
This decision is motivated by the fact that we cannot overcommit for
KVA, so large space there is unusable until machines start providing
wider physical memory addressing.  Another reason is that I do not
want to break our fragile autotuning, so the KVA expansion is not
included into this first step.  Nice side effect is that minidumps are
compatible.

On the other hand, (very) large address space is definitely
immediately useful for some userspace applications.

For userspace, numbering of pte entries (or page table pages) is
always done for 5-level structures even if we operate in 4-level mode.
The pmap_is_la57() function is added to report the mode of the
specified pmap, this is done not to allow simultaneous 4-/5-levels
(which is not allowed by hw), but to accomodate for EPT which has
separate level control and in principle might not allow 5-leve EPT
despite x86 paging supports it. Anyway, it does not seems critical to
have 5-level EPT support now.

Tested by: pho (LA48 hardware)
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

3 years agoAdd definition for CR4.LA57 bit.
kib [Sun, 23 Aug 2020 20:08:05 +0000 (20:08 +0000)]
Add definition for CR4.LA57 bit.

Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

3 years agoPass pointers to info parsed from notes, to brandinfo->header_supported filter.
kib [Sun, 23 Aug 2020 20:06:55 +0000 (20:06 +0000)]
Pass pointers to info parsed from notes, to brandinfo->header_supported filter.

Currently, we parse notes for the values of ELF FreeBSD feature flags
and osrel.  Knowing these values, or knowing that image does not carry
the note if pointers are NULL, is useful to decide which ABI variant
(brand) we want to activate for the image.

Right now this is only a plumbing change

Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

3 years agoStyle.
kib [Sun, 23 Aug 2020 20:05:35 +0000 (20:05 +0000)]
Style.

3 years agoReserve FreeBSD ELF feature control bit LA48 to control VA layout on amd64.
kib [Sun, 23 Aug 2020 19:47:27 +0000 (19:47 +0000)]
Reserve FreeBSD ELF feature control bit LA48 to control VA layout on amd64.

Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

3 years agokern_sharedpage.c: Add exec_sysvec_init_secondary() helper.
kib [Sun, 23 Aug 2020 19:43:47 +0000 (19:43 +0000)]
kern_sharedpage.c: Add exec_sysvec_init_secondary() helper.

It allows a sysent to share existing usermode data in shared page with
other sysent, assuming ABI differences are not in the layout of the
page.

Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25273

3 years agong_ubt: Add a device ID.
markj [Sun, 23 Aug 2020 19:30:06 +0000 (19:30 +0000)]
ng_ubt: Add a device ID.

PR: 248838
Submitted by: Andrey Zholos <aaz@q-fu.com>
MFC after: 1 week

3 years agolibc: hide alphasort_thunk behind I_AM_SCANDIR_B
mjg [Sun, 23 Aug 2020 11:06:59 +0000 (11:06 +0000)]
libc: hide alphasort_thunk behind I_AM_SCANDIR_B

Should unbreak gcc build as reported by tinderbox:
lib/libc/gen/scandir.c:59:12: warning: 'alphasort_thunk' declared 'static' but never defined [-Wunused-function]

3 years agovfs: mark freevnode as noinline
mjg [Sun, 23 Aug 2020 11:05:26 +0000 (11:05 +0000)]
vfs: mark freevnode as noinline

3 years agocxgbe(4): Use large clusters for TOE rx queues when TOE+TLS is enabled.
np [Sun, 23 Aug 2020 04:16:20 +0000 (04:16 +0000)]
cxgbe(4): Use large clusters for TOE rx queues when TOE+TLS is enabled.

Rx is more efficient within the chip when the receive buffer size
matches the TLS PDU size.

MFC after: 3 days
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D26127

3 years agoFix several issues with process group orphanage.
kib [Sat, 22 Aug 2020 21:32:11 +0000 (21:32 +0000)]
Fix several issues with process group orphanage.

Attempt of adding assertions that pgrp->pg_jobc counters do not
underflow in r361967, reverted in r362910, points out bugs in the
handling of job control.  Peter Holm was able to narrow down the
problem to very easy reproduction with timeout(1) which uses reaping.

The following list of problems with calculation of pg_jobs which
directs SIGHUP/SIGCONT delivery for orphaned process group was
identified:
- Re-calculation of the orphaned status for children of exiting parent
  was wrong, but mostly unnoticed when all children were reparented to
  init(8).  When child can be reparented to a different process which
  could affect the child' job control state, it was not properly
  accounted for in pg_jobc.
- Lockless check for exiting process' parent process group is racy
  because nothing prevents the parent from changing its group
  membership.
- Exited process is left in the process group, until waited. This
  affects other calculations of pg_jobc.

Split handling of job control status on process changing its process
group, and process exiting.  Calculate increments and decrements for
pg_jobs by exact checking the orphanage instead of assuming process
group membership for children and parent.  Move the call to killjobc()
later under the proctree_lock.  Mark exiting process in killjobc()
with a new flag P_TREE_GRPEXITED and skip it for all pg_jobc
calculations after the flag is set.

Add checker that independently recalculates pg_jobc value and compares
it with the memoized process group state. This is enabled under INVARIANTS.

Reviewed by: jilles
Discussed with: kevans
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D26116

3 years agomtree(8): add xref to mtree(5)
emaste [Sat, 22 Aug 2020 20:52:02 +0000 (20:52 +0000)]
mtree(8): add xref to mtree(5)

mtree(5) and mtree(8) come from different contrib sources. The former
already had an xref to the latter, but not the other way around.

MFC after: 1 week

3 years agoFinish r364492 by renaming rt_flags to rte_flags for multipath code.
melifaro [Sat, 22 Aug 2020 20:02:40 +0000 (20:02 +0000)]
Finish r364492 by renaming rt_flags to rte_flags for multipath code.

3 years agoRename rt_flags to rte_flags && reduce number of rt_nhop accesses.
melifaro [Sat, 22 Aug 2020 19:30:56 +0000 (19:30 +0000)]
Rename rt_flags to rte_flags && reduce number of rt_nhop accesses.

No functional changes.

Most of the routing flags are stored in the netxtop instead of rtentry.
Rename rt->rt_flags to rt->rte_flags to simplify reading/modifying code
 checking routing flags.

In the new multipath code, rt->rt_nhop may actually point to nexthop group
 instead of nhop. To ease transition, reduce the amount of rt->rt_nhop->...
 accesses.

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

3 years agoWhitespace change to line up dev_sotfc definition.
imp [Sat, 22 Aug 2020 19:18:31 +0000 (19:18 +0000)]
Whitespace change to line up dev_sotfc definition.

3 years agoRetire obsolete sysctl hw.bus.devctl_disable
imp [Sat, 22 Aug 2020 19:02:15 +0000 (19:02 +0000)]
Retire obsolete sysctl hw.bus.devctl_disable

hw.bus.devctl_disable has tagged been obsolete for a decade. Remove it. Also
remove some long obsolete comments. This was done and backed out once in 2014,
but we've had enough releases with the 'new' method of setting queue length that
we can just remove this sysctl now (stable/11, stable/12 and current all don't
reference it).

3 years agoAdd test for checking RTF_HOST and RTAX_NETMASK inconsistency.
melifaro [Sat, 22 Aug 2020 18:14:05 +0000 (18:14 +0000)]
Add test for checking RTF_HOST and RTAX_NETMASK inconsistency.

RTF_HOST indicates whether route is a host route
 (netmask is empty or /{32,128}).
Check that if netmask is empty and host route is not specified, kernel
 returns an error.

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

3 years agovfs: assert that HASBUF is only set with SAVENAME or SAVESTART
mjg [Sat, 22 Aug 2020 16:58:59 +0000 (16:58 +0000)]
vfs: assert that HASBUF is only set with SAVENAME or SAVESTART

as requested by the caller. The intent is to eradicate the mostly
spurious NDFREE_PNBUF calls.

3 years agocache: stronger vnode asserts in cache_enter_time
mjg [Sat, 22 Aug 2020 16:58:34 +0000 (16:58 +0000)]
cache: stronger vnode asserts in cache_enter_time

3 years agofd: pwd_drop after releasing filedesc lock
mjg [Sat, 22 Aug 2020 16:57:45 +0000 (16:57 +0000)]
fd: pwd_drop after releasing filedesc lock

Fixes a potential LOR against vnode lock.

3 years agoAdd a missed source file for LLVM's BPF target. This target is not
dim [Sat, 22 Aug 2020 15:31:56 +0000 (15:31 +0000)]
Add a missed source file for LLVM's BPF target. This target is not
enabled by default, so I forgot about it, apologies for the breakage.

Reported by: hrs
MFC after: 6 weeks
X-MFC-With: r364284

3 years agoacpi_iort: fix mapping end calculation
emaste [Sat, 22 Aug 2020 14:39:14 +0000 (14:39 +0000)]
acpi_iort: fix mapping end calculation

According to the ARM Design Document "IO Remapping Table Platform"
(DEN 0049D), the "Number of IDs" field of the ID mapping format means
"The number of IDs in the range minus one".

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D25179

3 years agoFix a typo in r364438 affecting 32-bit platforms.
markj [Sat, 22 Aug 2020 14:24:17 +0000 (14:24 +0000)]
Fix a typo in r364438 affecting 32-bit platforms.

Reported by: antoine
MFC with: r364438

3 years agoAdd a few new source files to libc++, in particular the implementation
dim [Sat, 22 Aug 2020 12:05:11 +0000 (12:05 +0000)]
Add a few new source files to libc++, in particular the implementation
part of std::random_shuffle. These were split off at some point by
upstream, but I forgot to add them to our Makefile.

This should allow some ports which use std::random_shuffle to correctly
link again.

Reported by: thierry
PR: 248795
MFC after: 6 weeks
X-MFX-With: r364284

3 years agosysctl(8): clarify -n flag
fernape [Sat, 22 Aug 2020 11:59:14 +0000 (11:59 +0000)]
sysctl(8): clarify -n flag

-n omits the name of the variable regardless of the type of information that is
requested. Rephrase to clarify this point.

PR: 242191
Submitted by: stilezy@gmail.com
Approved by: emaste@
Differential Revision: https://reviews.freebsd.org/D26149

3 years agoMerge commit 1ce07cd614be from llvm git (by me):
dim [Sat, 22 Aug 2020 10:55:55 +0000 (10:55 +0000)]
Merge commit 1ce07cd614be from llvm git (by me):

  Instantiate Error in Target::GetEntryPointAddress() only when
  necessary

  When Target::GetEntryPointAddress() calls
  exe_module->GetObjectFile()->GetEntryPointAddress(), and the returned
  entry_addr is valid, it can immediately be returned.

  However, just before that, an llvm::Error value has been setup, but
  in this case it is not consumed before returning, like is done
  further below in the function.

  In https://bugs.freebsd.org/248745 we got a bug report for this,
  where a very simple test case aborts and dumps core:

  * thread #1, name = 'testcase', stop reason = breakpoint 1.1
      frame #0: 0x00000000002018d4 testcase`main(argc=1, argv=0x00007fffffffea18) at testcase.c:3:5
     1    int main(int argc, char *argv[])
     2    {
  -> 3        return 0;
     4    }
  (lldb) p argc
  Program aborted due to an unhandled Error:
  Error value was Success. (Note: Success values must still be checked prior to being destroyed).

  Thread 1 received signal SIGABRT, Aborted.
  thr_kill () at thr_kill.S:3
  3       thr_kill.S: No such file or directory.
  (gdb) bt
  #0  thr_kill () at thr_kill.S:3
  #1  0x00000008049a0004 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
  #2  0x0000000804916229 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
  #3  0x000000000451b5f5 in fatalUncheckedError () at /usr/src/contrib/llvm-project/llvm/lib/Support/Error.cpp:112
  #4  0x00000000019cf008 in GetEntryPointAddress () at /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:267
  #5  0x0000000001bccbd8 in ConstructorSetup () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:67
  #6  0x0000000001bcd2c0 in ThreadPlanCallFunction () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:114
  #7  0x00000000020076d4 in InferiorCallMmap () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp:97
  #8  0x0000000001f4be33 in DoAllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp:604
  #9  0x0000000001fe51b9 in AllocatePage () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:347
  #10 0x0000000001fe5385 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:383
  #11 0x0000000001974da2 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2301
  #12 CanJIT () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2331
  #13 0x0000000001a1bf3d in Evaluate () at /usr/src/contrib/llvm-project/lldb/source/Expression/UserExpression.cpp:190
  #14 0x00000000019ce7a2 in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Target/Target.cpp:2372
  #15 0x0000000001ad784c in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:414
  #16 0x0000000001ad86ae in DoExecute () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:646
  #17 0x0000000001a5e3ed in Execute () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandObject.cpp:1003
  #18 0x0000000001a6c4a3 in HandleCommand () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:1762
  #19 0x0000000001a6f98c in IOHandlerInputComplete () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2760
  #20 0x0000000001a90b08 in Run () at /usr/src/contrib/llvm-project/lldb/source/Core/IOHandler.cpp:548
  #21 0x00000000019a6c6a in ExecuteIOHandlers () at /usr/src/contrib/llvm-project/lldb/source/Core/Debugger.cpp:903
  #22 0x0000000001a70337 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2946
  #23 0x0000000001d9d812 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/API/SBDebugger.cpp:1169
  #24 0x0000000001918be8 in MainLoop () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:675
  #25 0x000000000191a114 in main () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:890

  Fix the incorrect error catch by only instantiating an Error object
  if it is necessary.

  Reviewed By: JDevlieghere

  Differential Revision: https://reviews.llvm.org/D86355

This should fix lldb aborting as described in the scenario above.

Reported by: dmgk
PR: 248745

3 years agoFix tinderbox build after r364465
mjg [Sat, 22 Aug 2020 07:43:38 +0000 (07:43 +0000)]
Fix tinderbox build after r364465

3 years agovfs: add a work around for vp_crossmp bug to realpath
mjg [Sat, 22 Aug 2020 06:56:04 +0000 (06:56 +0000)]
vfs: add a work around for vp_crossmp bug to realpath

The actual bug is not yet addressed as it will get much easier after other
problems are addressed (most notably rename contract).

The only affected in-tree consumer is realpath. Everyone else happens to be
performing lookups within a mount point, having a side effect of ni_dvp being
set to mount point's root vnode in the worst case.

Reported by: pho

3 years agoAdd an entry for r364475.
rmacklem [Sat, 22 Aug 2020 04:07:44 +0000 (04:07 +0000)]
Add an entry for r364475.

3 years agor364475 changed the internal API between the kernel RPC and NFS, so bump version.
rmacklem [Sat, 22 Aug 2020 04:01:05 +0000 (04:01 +0000)]
r364475 changed the internal API between the kernel RPC and NFS, so bump version.

3 years agoAdd TLS support to the kernel RPC.
rmacklem [Sat, 22 Aug 2020 03:57:55 +0000 (03:57 +0000)]
Add TLS support to the kernel RPC.

An internet draft titled "Towards Remote Procedure Call Encryption By Default"
describes how TLS is to be used for Sun RPC, with NFS as an intended use case.
This patch adds client and server support for this to the kernel RPC,
using KERN_TLS and upcalls to daemons for the handshake, peer reset and
other non-application data record cases.

The upcalls to the daemons use three fields to uniquely identify the
TCP connection. They are the time.tv_sec, time.tv_usec of the connection
establshment, plus a 64bit sequence number. The time fields avoid problems
with re-use of the sequence number after a daemon restart.
For the server side, once a Null RPC with AUTH_TLS is received, kernel
reception on the socket is blocked and an upcall to the rpctlssd(8) daemon
is done to perform the TLS handshake.  Upon completion, the completion
status of the handshake is stored in xp_tls as flag bits and the reply to
the Null RPC is sent.
For the client, if CLSET_TLS has been set, a new TCP connection will
send the Null RPC with AUTH_TLS to initiate the handshake.  The client
kernel RPC code will then block kernel I/O on the socket and do an upcall
to the rpctlscd(8) daemon to perform the handshake.
If the upcall is successful, ct_rcvstate will be maintained to indicate
if/when an upcall is being done.

If non-application data records are received, the code does an upcall to
the appropriate daemon, which will do a SSL_read() of 0 length to handle
the record(s).

When the socket is being shut down, upcalls are done to the daemons, so
that they can perform SSL_shutdown() calls to perform the "peer reset".

The rpctlssd(8) and rpctlscd(8) daemons require a patched version of the
openssl library and, as such, will not be committed to head at this time.

Although the changes done by this patch are fairly numerous, there should
be no semantics change to the kernel RPC at this time.
A future commit to the NFS code will optionally enable use of TLS for NFS.

3 years agoVendor import of Unbound 1.11.0.
cy [Fri, 21 Aug 2020 22:56:05 +0000 (22:56 +0000)]
Vendor import of Unbound 1.11.0.

3 years agoImport sqlite 3.32.3 (3330000).
cy [Fri, 21 Aug 2020 22:54:38 +0000 (22:54 +0000)]
Import sqlite 3.32.3 (3330000).

3 years agoAfter the clang/llvm version 11 import LLD_VERSION is no longer used
bz [Fri, 21 Aug 2020 22:31:45 +0000 (22:31 +0000)]
After the clang/llvm version 11 import LLD_VERSION is no longer used
upstream so Version.inc now only defines LLD_VERSION_STRING.

This breaks the WANT_LINKER_VERSION magic and might lead to us building
more than needed (e.g., for croos-tools).

Change the awk script to parse LLD_VERSION_STRING instead of LLD_VERSION,
which not only unbreaks the current situation but should also be backwards
compatible as dim points out.

PR: 248818
Reviewed by: emaste, dim (seems right and the way to go)
MFC after: 4 weeks
X-MFC before: 364284

3 years agoMake net.fibs growable.
melifaro [Fri, 21 Aug 2020 21:34:52 +0000 (21:34 +0000)]
Make net.fibs growable.

Allow to dynamically grow the amount of fibs in each vnet.

This change alters current behavior. Currently, if one defines
 ROUTETABLES > 1 in the kernel config, each vnet will be created
 with the number of fibs defined in the kernel config.
 After this commit vnets will be created with fibs=1.

Dynamic net.fibs is not compatible with net.add_addr_allfibs.
 The plan is to deprecate the latter and make
 net.add_addr_allfibs=0 default behaviour.

Reviewed by: glebius
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D26062