]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoDon't fail universe kernel stage for TARGET_ARCHes without a kernel config.
John Baldwin [Tue, 7 Jan 2020 21:56:28 +0000 (21:56 +0000)]
Don't fail universe kernel stage for TARGET_ARCHes without a kernel config.

This fixes a regression in r356418 where the entire universe would
fail early due to an undefined make target when a given TARGET_ARCH
had no associated kernel configs.  This is true for all of the
hard-float mips TARGET_ARCHes currently.

Pointy hat to: me
Reviewed by: emaste
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23071

4 years agoUse a deterministic hash for USDT symbol names.
Mark Johnston [Tue, 7 Jan 2020 21:56:20 +0000 (21:56 +0000)]
Use a deterministic hash for USDT symbol names.

Previously libdtrace used ftok(3), which hashes the inode number of the
input object file.  To increase reproducibility of builds that embed
USDT probes, include a hash of the object file path in the symbol name
instead.

Reported and tested by: bdrewery
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

4 years agolibjail: Handle an error from reallocarray() when trimming the buffer.
Mark Johnston [Tue, 7 Jan 2020 21:44:27 +0000 (21:44 +0000)]
libjail: Handle an error from reallocarray() when trimming the buffer.

There is no API guarantee that realloc() will not fail when the buffer
is shrinking.  Handle it by simply returning the untrimmed buffer.
While this is unlikely to ever happen in practice, it seems worth
handling just to silence static analyzer warnings.

PR: 243106
Submitted by: Hans Christian Woithe <chwoithe@yahoo.com>
MFC after: 1 week

4 years agoFix a typo - passing wrong mbuf pointer to needs_udp_csum(). Will
Gleb Smirnoff [Tue, 7 Jan 2020 21:29:42 +0000 (21:29 +0000)]
Fix a typo - passing wrong mbuf pointer to needs_udp_csum().  Will
trigger panic only on a kernel with RATELIMIT.

Submitted by: rrs

4 years agoAdd Host Memory Buffer support to nvme(4).
Alexander Motin [Tue, 7 Jan 2020 21:17:11 +0000 (21:17 +0000)]
Add Host Memory Buffer support to nvme(4).

This allows cheapest DRAM-less NVMe SSDs to use some of host RAM (about
1MB per 1GB on the devices I have) for its metadata cache, significantly
improving random I/O performance.  Device reports minimal and preferable
size of the buffer.  The code limits it to 1% of physical RAM by default.
If the buffer can not be allocated or below minimal size, the device will
just have to work without it.

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

4 years agoFix rtsock route message generation for interface addresses.
Alexander V. Chernikov [Tue, 7 Jan 2020 21:16:30 +0000 (21:16 +0000)]
Fix rtsock route message generation for interface addresses.

Reviewed by: olivier
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D22974

4 years agoAdd #ifdef option-test wrappers around another call to an arm/unwind.c
Ian Lepore [Tue, 7 Jan 2020 21:13:34 +0000 (21:13 +0000)]
Add #ifdef option-test wrappers around another call to an arm/unwind.c
function which is only compiled-in with certain options.

Why is it always the most trivial part of a big commit that takes 3 tries
to get right?

4 years agovfs: handle doomed vnodes in vdefer_inactive
Mateusz Guzik [Tue, 7 Jan 2020 20:24:21 +0000 (20:24 +0000)]
vfs: handle doomed vnodes in vdefer_inactive

vgone dooms the vnode while keeping VI_OWEINACT set and then drops the
interlock.

vputx can pick up the interlock and pass it to vdefer_inactive since the
flag is set.

The race is harmless, just don't defer anything as vgone will take care of it.

Reported by: pho

4 years agoRemove gcclibs libssp build glue
Kyle Evans [Tue, 7 Jan 2020 19:49:31 +0000 (19:49 +0000)]
Remove gcclibs libssp build glue

r356356 started providing libssp based on ^/lib/libc/secure and disconnected
this version from the build. This one did formally provide runtime support
for _FORTIFY_SOURCE, but FreeBSD lacks the build support that would have
been needed to take advantage of it.

MFC after: never

4 years agoDo not define TCPOUTFLAGS in rack_bbr_common
Ed Maste [Tue, 7 Jan 2020 17:57:08 +0000 (17:57 +0000)]
Do not define TCPOUTFLAGS in rack_bbr_common

tcp_outflags isn't used in this source file and compilation failed with
external GCC on sparc64.  I'm not sure why only that case failed (perhaps
inconsistent -Werror config) but it is a legitimate issue to fix.

Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D23068

4 years agoRevert r355861 because the issue has been fixed in r356443
Li-Wen Hsu [Tue, 7 Jan 2020 17:49:49 +0000 (17:49 +0000)]
Revert r355861 because the issue has been fixed in r356443

PR: 242689
Notified by: markj
Sponsored by: The FreeBSD Foundation

4 years agoVarious cleanups to cryptocheck.
John Baldwin [Tue, 7 Jan 2020 17:07:58 +0000 (17:07 +0000)]
Various cleanups to cryptocheck.

- Rename 'blkcipher' to 'cipher'.  Some of the ciphers being tested
  are stream ciphers.
- Rename 'authenc' to 'eta' as it is only testing ETA chained
  operations and not other combination modes.
- Add a notion of an OCF session and some helper routines to try to
  reduce duplicated code.  This also uses a single session for both
  encrypt and decrypt operations during a single test.
- Add tests to ensure that AEAD algorithms fail decryption with
  EBADMSG when given a corrupted tag.
- Remove the transitional hack for COP_F_CIPHER_FIRST.
- Update block comment to mention plain hashes.

Reviewed by: cem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D22940

4 years agoRemove support for using GCC 4.2.1 from make tinderbox.
John Baldwin [Tue, 7 Jan 2020 16:53:51 +0000 (16:53 +0000)]
Remove support for using GCC 4.2.1 from make tinderbox.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D23054

4 years agoDecrease logging severity when adding a device or reading config table.
Mark Johnston [Tue, 7 Jan 2020 16:07:30 +0000 (16:07 +0000)]
Decrease logging severity when adding a device or reading config table.

In PR 243056 a user reports some spam from smartpqi(4).  In particular,
the driver warns about an unrecognized PQI_CONF_TABLE_SECTION_SOFT_RESET
section (not yet defined in the driver, but handled in Linux), but this
doesn't cause any problems.  The Linux driver also does not warn about
unrecognized sections.

Also do not log a warning when a device is added, since this is routine.
Lower severity to DISC, to match pqisrc_remove_device().

PR: 243056
Reviewed by: sbruno
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23023

4 years agortld: Fix segfault in direct exec mode
Ryan Stone [Tue, 7 Jan 2020 16:03:11 +0000 (16:03 +0000)]
rtld: Fix segfault in direct exec mode

When rtld is directly executed with arguments, it has to move the
program arguments, environment and elf aux data up a few slots to
remove its own arguments before the process being executed sees
them.  When copying the environment, rtld was incorrectly testing
whether the location about to be written to currently contained
NULL, when was supposed to check whether it had just copied the
NULL terminator of the environment string.  This had the result
that the ELF aux data was mostly treated as environment variables,
and rtld would quickly crash when it tried to access required
ELF aux data that it didn't think was present.

Differential Revision: https://reviews.freebsd.org/D23008
Reviewed by: kib
MFC after: 1 month

4 years agoDefine a unified pmap structure for i386.
Mark Johnston [Tue, 7 Jan 2020 15:59:31 +0000 (15:59 +0000)]
Define a unified pmap structure for i386.

The overloading of struct pmap for PAE and non-PAE pmaps results in
three distinct layouts for the structure, which is embedded in
struct vmspace.  This causes a large number of duplicate structure
definitions in the i386 kernel's CTF type graph.

Since most pmap fields are the same in the two pmaps, simply provide
side-by-side variants of the fields that are distinct, using fixed-size
types.

PR: 242689
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22896

4 years agoConsistently use pmap_t instead of struct pmap *.
Mark Johnston [Tue, 7 Jan 2020 15:59:02 +0000 (15:59 +0000)]
Consistently use pmap_t instead of struct pmap *.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agovfs: reimplement deferred inactive to use a dedicated flag (VI_DEFINACT)
Mateusz Guzik [Tue, 7 Jan 2020 15:56:24 +0000 (15:56 +0000)]
vfs: reimplement deferred inactive to use a dedicated flag (VI_DEFINACT)

The previous behavior of leaving VI_OWEINACT vnodes on the active list without
a hold count is eliminated. Hold count is kept and inactive processing gets
explicitly deferred by setting the VI_DEFINACT flag. The syncer is then
responsible for vdrop.

Reviewed by: kib (previous version)
Tested by: pho (in a larger patch, previous version)
Differential Revision: https://reviews.freebsd.org/D23036

4 years agovfs: trylock in vfs_msync and refactor the func
Mateusz Guzik [Tue, 7 Jan 2020 15:44:19 +0000 (15:44 +0000)]
vfs: trylock in vfs_msync and refactor the func

- use LK_NOWAIT instead of calling VOP_ISLOCKED before deciding to lock
- evaluate flags before looping over vnodes

Reviewed by: kib
Tested by: pho (in a larger patch, previous version)
Differential Revision: https://reviews.freebsd.org/D23035

4 years agovfs: use a dedicated counter for free vnode recycling
Mateusz Guzik [Tue, 7 Jan 2020 15:42:01 +0000 (15:42 +0000)]
vfs: use a dedicated counter for free vnode recycling

Otherwise vlrureclaim activitity is mixed in and it is hard to tell which
vnodes got reclaimed.

4 years agosifive: Fix incorrect tx/rx ctrl defines
Kristof Provost [Tue, 7 Jan 2020 09:02:14 +0000 (09:02 +0000)]
sifive: Fix incorrect tx/rx ctrl defines

Happily these were never used, but they should be correct anyway.

Reported by: Nicholas O'Brien <nickisobrien_gmail.com>
Sponsored by: Axiado

4 years agoprocstat: read lo_name instead of now removed v_tag
Mateusz Guzik [Tue, 7 Jan 2020 05:33:33 +0000 (05:33 +0000)]
procstat: read lo_name instead of now removed v_tag

4 years agozfs: plug a vnode reserve leak in zfs_make_xattrdir
Mateusz Guzik [Tue, 7 Jan 2020 04:34:29 +0000 (04:34 +0000)]
zfs: plug a vnode reserve leak in zfs_make_xattrdir

4 years agovfs: prevent numvnodes and freevnodes re-reads when appropriate
Mateusz Guzik [Tue, 7 Jan 2020 04:34:03 +0000 (04:34 +0000)]
vfs: prevent numvnodes and freevnodes re-reads when appropriate

Otherwise in code like this:
if (numvnodes > desiredvnodes)
vnlru_free_locked(numvnodes - desiredvnodes, NULL);

numvnodes can drop below desiredvnodes prior to the call and if the
compiler generated another read the subtraction would get a negative
value.

4 years agofsck_msdosfs.8: document -M.
Xin LI [Tue, 7 Jan 2020 04:33:14 +0000 (04:33 +0000)]
fsck_msdosfs.8: document -M.

Reported by: mckusick
Reviewed by: mckusick, emaste, bcr
MFC after: 28 days
X-MFC-with: r356313
Differential Revision: https://reviews.freebsd.org/D23049

4 years agovfs: annotate numvnodes and vnode_free_list_mtx with __exclusive_cache_line
Mateusz Guzik [Tue, 7 Jan 2020 04:30:49 +0000 (04:30 +0000)]
vfs: annotate numvnodes and vnode_free_list_mtx with __exclusive_cache_line

4 years agovfs: eliminate v_tag from struct vnode
Mateusz Guzik [Tue, 7 Jan 2020 04:29:34 +0000 (04:29 +0000)]
vfs: eliminate v_tag from struct vnode

There was only one consumer and it was using it incorrectly.

It is given an equivalent hack.

Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D23037

4 years agovfs: add a helper for allocating marker vnodes
Mateusz Guzik [Tue, 7 Jan 2020 04:27:40 +0000 (04:27 +0000)]
vfs: add a helper for allocating marker vnodes

4 years agoAdd more Arm arm64 CPU identification values
Andrew Turner [Mon, 6 Jan 2020 20:57:59 +0000 (20:57 +0000)]
Add more Arm arm64 CPU identification values

 - Add all the Cortex-A CPU ID register values I can find.
 - Add the Neoverse-N1 ID regiser value [1]
 - Sort macros by register value.

PR: 243065
Submitted by: Ali Saidi <alisaidi AT amazon.com> [1]
Sponsored by: DARPA, AFRL (other than [1])

4 years agokern_sysctl: make sysctl.debug work as intended
Pawel Biernacki [Mon, 6 Jan 2020 19:47:59 +0000 (19:47 +0000)]
kern_sysctl: make sysctl.debug work as intended

r136999 introduced SYSTCL_DEBUG but apparently "opt_sysctl.h" was never
included making the option ignored.

r322954 introduced sysctl.reuse_test with OID number equal to 0, effectively
shadowing the very special sysctl.debug one. Use OID_AUTO as it doesn't need
any special treatment.

Reviewed by: kib (mentor)
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D23056

4 years agoloader: update zfsimpl.c from illumos review suggestions
Toomas Soome [Mon, 6 Jan 2020 19:35:22 +0000 (19:35 +0000)]
loader: update zfsimpl.c from illumos review suggestions

Add extra comments and update error handling.

MFH: 1 week

4 years agoRefine fusefs test workaround for mips+llvm
Kyle Evans [Mon, 6 Jan 2020 18:25:58 +0000 (18:25 +0000)]
Refine fusefs test workaround for mips+llvm

This re-enables building the googletest suite by default on mips and instead
specifically doesn't build fusefs tests for mips+clang builds.  clang will
easily spent >= 1.5 hours compiling a single file due to a bug in
optimization (see LLVM PR 43263), so turn these off for now while that's
hashed out.

GCC builds are unaffected and build the fusefs tests as-is. Clang builds
only happen by early adopters attempting to hash out the remaining issues.

The comment has been updated to reflect its new position and use less strong
wording about imposing on people.

Discussed with: ngie, asomers
Reviewed by: ngie

4 years agoUpdate libssp paths in various Makefile.depend* files
Kyle Evans [Mon, 6 Jan 2020 18:15:55 +0000 (18:15 +0000)]
Update libssp paths in various Makefile.depend* files

I've been advised that the model that uses these are fairly resilient, but
we do know the proper path to use (or remove, in the case of ^/targets/...),
so go ahead and update them to reflect that.

4 years agosrc.conf.5: regen after r356419, reenabling powerpc in universe
Ed Maste [Mon, 6 Jan 2020 18:07:54 +0000 (18:07 +0000)]
src.conf.5: regen after r356419, reenabling powerpc in universe

4 years agoSimplify arguments to signal handlers on mips.
John Baldwin [Mon, 6 Jan 2020 18:02:02 +0000 (18:02 +0000)]
Simplify arguments to signal handlers on mips.

- Use ksi_addr directly as si_addr in the siginfo instead of the
  'badvaddr' register.
- Remove a duplicate assignment of si_code.
- Use ksi_addr as the 4th argument to the old-style handler instead of
  'badvaddr'.

Reviewed by: brooks, kevans
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23013

4 years agoEnable powerpc in make tinderbox using clang instead of GCC.
John Baldwin [Mon, 6 Jan 2020 17:36:28 +0000 (17:36 +0000)]
Enable powerpc in make tinderbox using clang instead of GCC.

powerpcspe is disabled for now until clang/llvm issues with spe
have been fixed.

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

4 years agoOnly build kernels for enabled TARGET_ARCHes in make universe/tinderbox.
John Baldwin [Mon, 6 Jan 2020 17:34:17 +0000 (17:34 +0000)]
Only build kernels for enabled TARGET_ARCHes in make universe/tinderbox.

Previously, all of the kernels for a given TARGET were built if that
target was enabled.  This was implemented by having each kernel built
via a universe_kernconf_<KERNEL> target that was depended on by a
universe_kernconfs target.  However, this meant that if one did a
build with a limited set of TARGET_ARCH values for a given TARGET,
kernels could be built for which we hadn't built a world or toolchain.
For example, 'make TARGETS=mips TARGET_ARCHES_mips=mips64' would build
mips32 kernels.

Fix this by adding an extra layer of indirection in the kernel make
targets.  universe_kernconf_<KERNEL> is now a dependency of a new
universe_kernconfs_<TARGET_ARCH>.  universe_kernconfs in turn depends
on a list of universe_kernconfs_<target_arch> values, but only the
values enabled in TARGET_ARCHES_<TARGET>.

Reviewed by: imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23031

4 years agoThis catches rack up in the recent changes to ECN and
Randall Stewart [Mon, 6 Jan 2020 15:29:14 +0000 (15:29 +0000)]
This catches rack up in the recent changes to ECN and
also commonizes the functions that both the freebsd and
rack stack uses.

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

4 years agoMFV r356415
Martin Matuska [Mon, 6 Jan 2020 13:21:10 +0000 (13:21 +0000)]
MFV r356415
Sync libarchive with vendor

Relevant vendor changes:
  Issue #1302: Re-do fix for archive_write_client_open()

X-MFC-With: r356212,r356365
MFC after: 1 week

4 years agoUpdate vendor/libarchive/dist to git 3f1bad815d02160ab27f7063257aed4b25dbaebe
Martin Matuska [Mon, 6 Jan 2020 13:13:58 +0000 (13:13 +0000)]
Update vendor/libarchive/dist to git 3f1bad815d02160ab27f7063257aed4b25dbaebe

Relevant vendor changes:
  Issue #1302: Re-do fix for archive_write_client_open()

4 years agoThis change adds a small feature to the tcp logging code. Basically
Randall Stewart [Mon, 6 Jan 2020 12:48:06 +0000 (12:48 +0000)]
This change adds a small feature to the tcp logging code. Basically
a connection can now have a separate tag added to the id.

Obtained from: Lawrence Stewart
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D22866

4 years agosysctl: mark more nodes as MPSAFE
Pawel Biernacki [Mon, 6 Jan 2020 10:52:13 +0000 (10:52 +0000)]
sysctl: mark more nodes as MPSAFE

vm.kvm_size and vm.kvm_free are read only and marked as MPSAFE on i386
already. Mark them as that on amd64 and arm64 too to avoid locking Giant.

Reviewed by: kib (mentor)
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D23039

4 years agoAdd own counter for cancelled USB transfers.
Hans Petter Selasky [Mon, 6 Jan 2020 09:49:20 +0000 (09:49 +0000)]
Add own counter for cancelled USB transfers.
Do not count these as errors.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix uma boot pages calculations on NUMA machines that also don't have
Jeff Roberson [Mon, 6 Jan 2020 02:51:19 +0000 (02:51 +0000)]
Fix uma boot pages calculations on NUMA machines that also don't have
MD_UMA_SMALL_ALLOC.  This is unusual but not impossible.  Fix the alignemnt
of zones while here.  This was already correct because uz_cpu strongly
aligned the zone structure but the specified alignment did not match
reality and involved redundant defines.

Reviewed by: markj, rlibby
Differential Revision: https://reviews.freebsd.org/D23046

4 years agoFix host memory buffer sizes reporting.
Alexander Motin [Mon, 6 Jan 2020 01:51:23 +0000 (01:51 +0000)]
Fix host memory buffer sizes reporting.

Hardware reports values in 4KB units, not in bytes.

MFC after: 3 days

4 years agoThe fix in r356353 was insufficient. Not every architecture returns 0 for
Jeff Roberson [Sun, 5 Jan 2020 22:54:25 +0000 (22:54 +0000)]
The fix in r356353 was insufficient.  Not every architecture returns 0 for
EARLY_COUNTER.  Only amd64 seems to.

Suggested by: markj
Reported by: lwhsu
Reviewed by: markj
PR: 243117

4 years agonetgraph/ng_bridge: Reestablish old ABI
Bjoern A. Zeeb [Sun, 5 Jan 2020 19:14:16 +0000 (19:14 +0000)]
netgraph/ng_bridge: Reestablish old ABI

In order to be able to merge r353026 bring back support for the old
cookie API for a transition period in 12.x releases (and possibly 13)
before the old API can be removed again entirely.

Suggested by: julian
Submitted by: Lutz Donnerhacke (lutz donnerhacke.de)
PR: 240787
Reviewed by: julian
MFC after: 2 weeks
X-MFC with: r353026
Differential Revision: https://reviews.freebsd.org/D21961

4 years agoarch.7: correct overzealous claims of external binutils use
Ed Maste [Sun, 5 Jan 2020 18:06:32 +0000 (18:06 +0000)]
arch.7: correct overzealous claims of external binutils use

powerpc and powerpcspe still use in-tree ld 2.17.50

4 years agoarch.7: update toolchain table for external ld use
Ed Maste [Sun, 5 Jan 2020 18:03:53 +0000 (18:03 +0000)]
arch.7: update toolchain table for external ld use

As of r356379 and r356381 mips* and sparc64 now use external Binutils
ld as their linker.

4 years agosrc.conf.5: regen after r356381, disable BINUTILS_BOOTSTRAP more widely
Ed Maste [Sun, 5 Jan 2020 18:01:52 +0000 (18:01 +0000)]
src.conf.5: regen after r356381, disable BINUTILS_BOOTSTRAP more widely

4 years agosrc.opts.mk: disable BINUTILS_BOOTSTRAP on all mips* and sparc64
Ed Maste [Sun, 5 Jan 2020 18:01:15 +0000 (18:01 +0000)]
src.opts.mk: disable BINUTILS_BOOTSTRAP on all mips* and sparc64

Extend r356379 to include 32-bit mips and sparc64.  Using a decade-old
binutils linker with a contemporary compiler (either Clang or GCC) is
a combination unlikely to be used by anyone else, and it's not going
to be a good use of our time investigating and addressing any issues
that arise.  Expect that all architectures newly migrated to external
GCC will also use external binutils.

4 years agosrc.conf.5: regen after r356379, disable BINUTILS_BOOTSTRAP on mips64*
Ed Maste [Sun, 5 Jan 2020 17:12:41 +0000 (17:12 +0000)]
src.conf.5: regen after r356379, disable BINUTILS_BOOTSTRAP on mips64*

4 years agosrc.opts.mk: disable BINUTILS_BOOTSTRAP on mips64*
Ed Maste [Sun, 5 Jan 2020 16:59:24 +0000 (16:59 +0000)]
src.opts.mk: disable BINUTILS_BOOTSTRAP on mips64*

After GCC was disabled by default in r356367, mips and sparc64 started
relying external GCC.  However, the in-tree Binutils ld 2.17.50 is not
compatible with GCC for some mips64 targets, so turn off
BINUTILS_BOOTSTRAP and rely on external binutils (linker) as well.

4 years agoDon't make the sendall iterator as being up if it could not be started.
Michael Tuexen [Sun, 5 Jan 2020 14:08:01 +0000 (14:08 +0000)]
Don't make the sendall iterator as being up if it could not be started.

MFC after: 1 week

4 years agoReturn -1 consistently if an error occurs.
Michael Tuexen [Sun, 5 Jan 2020 14:06:40 +0000 (14:06 +0000)]
Return -1 consistently if an error occurs.

MFC after: 1 week

4 years agoEnsure that we don't miss a trigger for kicking off the SCTP iterator.
Michael Tuexen [Sun, 5 Jan 2020 13:56:32 +0000 (13:56 +0000)]
Ensure that we don't miss a trigger for kicking off the SCTP iterator.

Reported by: nwhitehorn@
MFC after: 1 week

4 years agolocks: add default delay struct
Mateusz Guzik [Sun, 5 Jan 2020 12:48:19 +0000 (12:48 +0000)]
locks: add default delay struct

Use it for all primitives. This makes everything fit in 8 bytes.

4 years agolocks: convert delay times to u_short
Mateusz Guzik [Sun, 5 Jan 2020 12:47:29 +0000 (12:47 +0000)]
locks: convert delay times to u_short

int is just a waste of space for this purpose.

4 years agoMark mtxpool_sleep as read mostly, not frequently.
Mateusz Guzik [Sun, 5 Jan 2020 12:46:35 +0000 (12:46 +0000)]
Mark mtxpool_sleep as read mostly, not frequently.

The latter is not justified.

4 years agoshm: correct KPI mistake introduced around memfd_create
Kyle Evans [Sun, 5 Jan 2020 04:06:40 +0000 (04:06 +0000)]
shm: correct KPI mistake introduced around memfd_create

When file sealing and shm_open2 were introduced, we should have grown a new
kern_shm_open2 helper that did the brunt of the work with the new interface
while kern_shm_open remains the same. Instead, more complexity was
introduced to kern_shm_open to handle the additional features and consumers
had to keep changing in somewhat awkward ways, and a kern_shm_open2 was
added to wrap kern_shm_open.

Backpedal on this and correct the situation- kern_shm_open returns to the
interface it had prior to file sealing being introduced, and neither
function needs an initial_seals argument anymore as it's handled in
kern_shm_open2 based on the shmflags.

4 years agoshmfd/mmap: restrict maxprot with MAP_SHARED + F_SEAL_WRITE
Kyle Evans [Sun, 5 Jan 2020 03:15:16 +0000 (03:15 +0000)]
shmfd/mmap: restrict maxprot with MAP_SHARED + F_SEAL_WRITE

If a write seal is set on a shared mapping, we must exclude VM_PROT_WRITE as
the fd is effectively read-only. This was discovered by running
devel/linux-ltp, which mmap's with acceptable protections specified then
attempts to raise to PROT_READ|PROT_WRITE with mprotect(2), which we
allowed.

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

4 years agoarch.7: update to show mips* and sparc64 use external GCC after r356367
Ed Maste [Sun, 5 Jan 2020 03:07:59 +0000 (03:07 +0000)]
arch.7: update to show mips* and sparc64 use external GCC after r356367

4 years agosrc.conf.5: regen after r356367, default to GCC off
Ed Maste [Sun, 5 Jan 2020 03:03:34 +0000 (03:03 +0000)]
src.conf.5: regen after r356367, default to GCC off

4 years agoAdjust WITH_/WITHOUT_ descriptions for GCC options after r356367
Ed Maste [Sun, 5 Jan 2020 03:00:26 +0000 (03:00 +0000)]
Adjust WITH_/WITHOUT_ descriptions for GCC options after r356367

The options default to NO on all archs now, and will be removed before
FreeBSD 13.

Sponsored by: The FreeBSD Foundation

4 years agoDo not build GCC 4.2.1 by default for any CPU architecture
Ed Maste [Sun, 5 Jan 2020 02:47:56 +0000 (02:47 +0000)]
Do not build GCC 4.2.1 by default for any CPU architecture

By default set to NO:

GCC
GCC_BOOTSTRAP
GNUCXX

As described by imp@ on the freebsd-arch mailing list Aug 13, 2019 with
Subject: Gcc 4.2.1 to be removed before FreeBSD 13, a firm timeline
https://lists.freebsd.org/pipermail/freebsd-arch/2019-August/019674.html

Reviewed by: jhb, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23026

4 years agoMFV r356365:
Martin Matuska [Sun, 5 Jan 2020 01:42:21 +0000 (01:42 +0000)]
MFV r356365:
Sync libarchive with vendor

Relevant vendor changes:
  Issue #1302: Plug memory leak on failure of archive_write_client_open()

4 years agoUpdate vendor/libarchive/dist to git 5e270715b51d199467195b56f77e21cb8bb1d642
Martin Matuska [Sun, 5 Jan 2020 01:30:41 +0000 (01:30 +0000)]
Update vendor/libarchive/dist to git 5e270715b51d199467195b56f77e21cb8bb1d642

Relevant vendor changes:
  Issue #1302: Plug memory leak on failure of archive_write_client_open()

4 years agovfs: factor out avoidable branches in _vn_lock
Mateusz Guzik [Sun, 5 Jan 2020 01:00:11 +0000 (01:00 +0000)]
vfs: factor out avoidable branches in _vn_lock

4 years agovfs: drop thread argument from vinactive
Mateusz Guzik [Sun, 5 Jan 2020 00:59:47 +0000 (00:59 +0000)]
vfs: drop thread argument from vinactive

4 years agovfs: patch up vnode count assertions to report found value
Mateusz Guzik [Sun, 5 Jan 2020 00:59:16 +0000 (00:59 +0000)]
vfs: patch up vnode count assertions to report found value

4 years agovfs: predict VN_IS_DOOMED as false
Mateusz Guzik [Sun, 5 Jan 2020 00:58:20 +0000 (00:58 +0000)]
vfs: predict VN_IS_DOOMED as false

The macro is used everywhere.

4 years agokern_mmap: restore character deleted in transit
Kyle Evans [Sat, 4 Jan 2020 23:51:44 +0000 (23:51 +0000)]
kern_mmap: restore character deleted in transit

Pointy hat to: kevans
X-MFC-With: r356359

4 years agokern_mmap: add a variant that allows caller to inspect fp
Kyle Evans [Sat, 4 Jan 2020 23:39:58 +0000 (23:39 +0000)]
kern_mmap: add a variant that allows caller to inspect fp

Linux mmap rejects mmap() on a write-only file with EACCES.
linux_mmap_common currently does a fun dance to grab the fp associated with
the passed in fd, validates it, then drops the reference and calls into
kern_mmap(). Doing so is perhaps both fragile and premature; there's still
plenty of chance for the request to get rejected with a more appropriate
error, and it's prone to a race where the file we ultimately mmap has
changed after it drops its referenced.

This change alleviates the need to do this by providing a kern_mmap variant
that allows the caller to inspect the fp just before calling into the fileop
layer. The callback takes flags, prot, and maxprot as one could imagine
scenarios where any of these, in conjunction with the file itself, may
influence a caller's decision.

The file type check in the linux compat layer has been removed; EINVAL is
seemingly not an appropriate response to the file not being a vnode or
device. The fileop layer will reject the operation with ENODEV if it's not
supported, which more closely matches the common linux description of
mmap(2) return values.

If we discover that we're allowing an mmap() on a file type that Linux
normally wouldn't, we should restrict those explicitly.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22977

4 years agolibssp: fix FORTIFY_SOURCE stub declarations
Kyle Evans [Sat, 4 Jan 2020 22:05:00 +0000 (22:05 +0000)]
libssp: fix FORTIFY_SOURCE stub declarations

The LSB 4.1 that I referenced omitted the varargs, and I failed to catch it.
The __vsnprintf_chk error was from just downright misreading the page. GCC6
caught all of these, but I had only tested GCC4.2.

X-MFC-With: r356356

4 years agoMake the message size limit used for SCTP_SENDALL configurable via
Michael Tuexen [Sat, 4 Jan 2020 20:33:12 +0000 (20:33 +0000)]
Make the message size limit used for SCTP_SENDALL configurable via
a sysctl variable instead of a compiled in constant.

This is based on a patch provided by nwhitehorn@.

4 years agoProvide libssp based on libc
Kyle Evans [Sat, 4 Jan 2020 20:19:25 +0000 (20:19 +0000)]
Provide libssp based on libc

For libssp.so, rebuild stack_protector.c with FORTIFY_SOURCE stubs that just
abort built into it.

For libssp_nonshared.a, steal stack_protector_compat.c from
^/lib/libc/secure and massage it to maintain that __stack_chk_fail_local
is a hidden symbol.

libssp is now built unconditionally regardless of {WITH,WITHOUT}_SSP in the
build environment, and the gcclibs version has been disconnected from the
build in favor of this one.

PR: 242950 (exp-run)
Reviewed by: kib, emaste, pfg, Oliver Pinter (earlier version)
Also discussed with: kan
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22943

4 years agossp: knock out some trivial warnings that come up with WARNS=6
Kyle Evans [Sat, 4 Jan 2020 20:07:11 +0000 (20:07 +0000)]
ssp: knock out some trivial warnings that come up with WARNS=6

A future commit will rebuild this as part of libssp. The exact warnings are
fairly trivially fixed:
- No previous declaration for __stack_chk_guard
- idx is the wrong type, nitems yields a size_t
- Casting away volatile on the tmp_stack_chk_guard directly is a no-no.

Reviewed by: kib, emaste, pfg, Oliver Pinter (earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22943

4 years agoWhen a copy-on-write fault occurs, pmap_enter() is called on to replace the
Alan Cox [Sat, 4 Jan 2020 19:50:25 +0000 (19:50 +0000)]
When a copy-on-write fault occurs, pmap_enter() is called on to replace the
mapping to the old read-only page with a mapping to the new read-write page.
To destroy the old mapping, pmap_enter() must destroy its page table and PV
entries and invalidate its TLB entry.  This change simply invalidates that
TLB entry a little earlier, specifically, on amd64 and arm64, before the PV
list lock is held.

Reviewed by: kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23027

4 years agoFix an assertion introduced in r356348. On architectures without
Jeff Roberson [Sat, 4 Jan 2020 19:29:25 +0000 (19:29 +0000)]
Fix an assertion introduced in r356348.  On architectures without
UMA_MD_SMALL_ALLOC vmem has a more complicated startup sequence that
violated the new assert.  Resolve this by rewriting the COLD asserts to
look at the per-cpu allocation counts for evidence of api activity.

Discussed with: rlibby
Reviewed by: markj
Reported by: lwhsu

4 years agolio_listio_empty_nowait_thread sometimes does *not* hang.
Bryan Drewery [Sat, 4 Jan 2020 18:59:46 +0000 (18:59 +0000)]
lio_listio_empty_nowait_thread sometimes does *not* hang.

The other tests consistently do hang though.

Sponsored by: DellEMC

4 years agoUMA NUMA flag day. UMA_ZONE_NUMA was a source of confusion. Make the names
Jeff Roberson [Sat, 4 Jan 2020 18:48:13 +0000 (18:48 +0000)]
UMA NUMA flag day.  UMA_ZONE_NUMA was a source of confusion.  Make the names
more consistent with other NUMA features as UMA_ZONE_FIRSTTOUCH and
UMA_ZONE_ROUNDROBIN.  The system will now pick a select a default depending
on kernel configuration.  API users need only specify one if they want to
override the default.

Remove the UMA_XDOMAIN and UMA_FIRSTTOUCH kernel options and key only off
of NUMA.  XDOMAIN is now fast enough in all cases to enable whenever NUMA
is.

Reviewed by: markj
Discussed with: rlibby
Differential Revision: https://reviews.freebsd.org/D22831

4 years agoSort cross-domain frees into per-domain buckets before inserting these
Jeff Roberson [Sat, 4 Jan 2020 07:56:28 +0000 (07:56 +0000)]
Sort cross-domain frees into per-domain buckets before inserting these
onto their respective bucket lists.  This is a several order of magnitude
improvement in contention on the keg lock under heavy free traffic while
requiring only an additional bucket per-domain worth of memory.

Discussed with: markj, rlibby
Differential Revision: https://reviews.freebsd.org/D22830

4 years agoUse per-domain keg locks. This provides both a lock and separate space
Jeff Roberson [Sat, 4 Jan 2020 03:30:08 +0000 (03:30 +0000)]
Use per-domain keg locks.  This provides both a lock and separate space
accounting for each NUMA domain.  Independent keg domain locks are important
with cross-domain frees.  Hashed zones are non-numa and use a single keg
lock to protect the hash table.

Reviewed by: markj, rlibby
Differential Revision: https://reviews.freebsd.org/D22829

4 years agoUse a separate lock for the zone and keg. This provides concurrency
Jeff Roberson [Sat, 4 Jan 2020 03:15:34 +0000 (03:15 +0000)]
Use a separate lock for the zone and keg.  This provides concurrency
between populating buckets from the slab layer and fetching full buckets
from the zone layer.  Eliminate some nonsense locking patterns where
we lock to fetch a single variable.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D22828

4 years agoUse atomics for the zone limit and sleeper count. This relies on the
Jeff Roberson [Sat, 4 Jan 2020 03:04:46 +0000 (03:04 +0000)]
Use atomics for the zone limit and sleeper count.  This relies on the
sleepq to serialize sleepers.  This patch retains the existing sleep/wakeup
paradigm to limit 'thundering herd' wakeups.  It resolves a missing wakeup
in one case but otherwise should be bug for bug compatible.  In particular,
there are still various races surrounding adjusting the limit via sysctl
that are now documented.

Discussed with: markj
Reviewed by: rlibby
Differential Revision: https://reviews.freebsd.org/D22827

4 years agopowerpc: Remove 'sec' device from QORIQ64 config
Justin Hibbits [Sat, 4 Jan 2020 01:13:00 +0000 (01:13 +0000)]
powerpc: Remove 'sec' device from QORIQ64 config

The SEC crypto engine, as implemented in this driver, does not exist on any
64-bit SoC, so don't bother compiling it in.

4 years agoUse the freebsd-gcc6 toolchains instead of powerpc64-xtoolchain-gcc.
John Baldwin [Sat, 4 Jan 2020 00:59:47 +0000 (00:59 +0000)]
Use the freebsd-gcc6 toolchains instead of powerpc64-xtoolchain-gcc.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D23029

4 years agovfs: remove CTASSERT from VOP_UNLOCK_FLAGS
Mateusz Guzik [Sat, 4 Jan 2020 00:44:53 +0000 (00:44 +0000)]
vfs: remove CTASSERT from VOP_UNLOCK_FLAGS

gcc does not like it and it's not worth working around just for that
compiler.

4 years agoSet correct lib32 MACHINE_ARCH for mips64el*.
John Baldwin [Fri, 3 Jan 2020 23:31:38 +0000 (23:31 +0000)]
Set correct lib32 MACHINE_ARCH for mips64el*.

Use "mipsel" instead of "mips" as the 32-bit MACHINE_ARCH when
building lib32 for little-endian 64-bit MIPS targets.  This fixes an
error where some objects were compiled as LE and others compiled as BE
causing a link error for rtld32.

Reviewed by: emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23028

4 years agovfs: add a file missed in r356337
Mateusz Guzik [Fri, 3 Jan 2020 22:47:31 +0000 (22:47 +0000)]
vfs: add a file missed in r356337

4 years agovfs: drop the mostly unused flags argument from VOP_UNLOCK
Mateusz Guzik [Fri, 3 Jan 2020 22:29:58 +0000 (22:29 +0000)]
vfs: drop the mostly unused flags argument from VOP_UNLOCK

Filesystems which want to use it in limited capacity can employ the
VOP_UNLOCK_FLAGS macro.

Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D21427

4 years agounionfs: fix up VOP_UNLOCK use after flags stopped being supported
Mateusz Guzik [Fri, 3 Jan 2020 22:12:25 +0000 (22:12 +0000)]
unionfs: fix up VOP_UNLOCK use after flags stopped being supported

For the most part the code was passing the LK_RELEASE flag.
The 2 cases which did not use the VOP_UNLOCK_FLAGS macro.

This fixes a panic when stacking unionfs on top of e.g., tmpfs when
debug is enabled.

Note there are latent bugs which prevent unionfs from working with debug
regardless of this change.

PR: 243064
Reported by: Mason Loring Bliss

4 years agovfs: add VOP_UNLOCK_FLAGS
Mateusz Guzik [Fri, 3 Jan 2020 22:10:11 +0000 (22:10 +0000)]
vfs: add VOP_UNLOCK_FLAGS

The flags argument from VOP_UNLOCK is about to be removed and some
filesystems unlock the interlock as a convienience with it.

Add a helper to retain the behavior for the few cases it is needed.

4 years agoMakefile.inc1: remove libcompiler_rt from _startup_libs
Kyle Evans [Fri, 3 Jan 2020 21:40:32 +0000 (21:40 +0000)]
Makefile.inc1: remove libcompiler_rt from _startup_libs

libcompiler_rt is already present in _prereq_libs, which will get built just
before _startup_libs and in advance of shared libc. Dedupe.

4 years agoMerge commit 189b7393d from llvm git (by John Baldwin):
Dimitry Andric [Fri, 3 Jan 2020 20:29:54 +0000 (20:29 +0000)]
Merge commit 189b7393d from llvm git (by John Baldwin):

  [lld][RISCV] Use an e_flags of 0 if there are only binary input files.

  Summary:
  If none of the input files are ELF object files (for example, when
  generating an object file from a single binary input file via "-b
  binary"), use a fallback value for the ELF header flags instead of
  crashing with an assertion failure.

  Reviewers: MaskRay, ruiu, espindola

  Reviewed By: MaskRay, ruiu

  Subscribers: kevans, grimar, emaste, arichardson, asb, rbar,
  johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217,
  zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o,
  rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton,
  pzheng, sameer.abuasal, apazos, luismarques, llvm-commits, jrtc27

  Tags: #llvm

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

This is a prerequisite for building and linking hard- and soft-float
riscv worlds with clang and lld.

Requested by: jhb
MFC after: 1 week
X-MFC-With: r353358

4 years agoMerge commit d7be3eab5 from llvm git (by Luís Marques):
Dimitry Andric [Fri, 3 Jan 2020 20:28:06 +0000 (20:28 +0000)]
Merge commit d7be3eab5 from llvm git (by Luís Marques):

  [RISCV] Handle fcopysign(f32, f64) and fcopysign(f64, f32)

  Summary: Adds tablegen patterns to explicitly handle fcopysign where
  the magnitude and sign arguments have different types, due to the
  sign value casts being removed the by DAGCombiner. Support for RV32IF
  follows in a separate commit. Adds tests for all relevant scenarios
  except RV32IF.

  Reviewers: lenary
  Reviewed By: lenary
  Tags: #llvm
  Differential Revision: https://reviews.llvm.org/D70678

This is a prerequisite for building and linking hard- and soft-float
riscv worlds with clang and lld.

Requested by: jhb
MFC after: 1 week
X-MFC-With: r353358

4 years agoMerge commit c6b09bff5 from llvm git (by Luís Marques):
Dimitry Andric [Fri, 3 Jan 2020 20:19:17 +0000 (20:19 +0000)]
Merge commit c6b09bff5 from llvm git (by Luís Marques):

  [RISCV] Fix wrong CFI directives

  Summary: Removes CFI CFA directives that could incorrectly propagate
  beyond the basic block they were inteded for. Specifically it removes
  the epilogue CFI directives. See the branch_and_tail_call test for an
  example of the issue. Should fix the stack unwinding issues caused by
  the incorrect directives.

  Reviewers: asb, lenary, shiva0217
  Reviewed By: lenary
  Tags: #llvm
  Differential Revision: https://reviews.llvm.org/D69723

This is a prerequisite for building and linking hard- and soft-float
riscv worlds with clang and lld.

Requested by: jhb
MFC after: 1 week
X-MFC-With: r353358

4 years agoMerge commit da7b129b1 from llvm git (by James Clarke):
Dimitry Andric [Fri, 3 Jan 2020 20:11:40 +0000 (20:11 +0000)]
Merge commit da7b129b1 from llvm git (by James Clarke):

  [RISCV] Don't force Local Exec TLS for non-PIC

  Summary:

  Forcing Local Exec TLS requires the use of copy relocations. Copy
  relocations need special handling in the runtime linker when being
  used against TLS symbols, which is present in glibc, but not in
  FreeBSD nor musl, and so cannot be relied upon. Moreover, copy
  relocations are a hack that embed the size of an object in the ABI
  when it otherwise wouldn't be, and break protected symbols (which are
  expected to be DSO local), whilst also wasting space, thus they
  should be avoided whenever possible. As discussed in D70398, RISC-V
  should move away from forcing Local Exec, and instead use Initial
  Exec like other targets, with possible linker relaxation to follow.
  The RISC-V GCC maintainers also intend to adopt this
  more-conventional behaviour (see
  https://github.com/riscv/riscv-elf-psabi-doc/issues/122).

  Reviewers: asb, MaskRay

  Reviewed By: MaskRay

  Subscribers: emaste, krytarowski, hiraditya, rbar, johnrusso,
  simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng,
  edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe,
  PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng,
  sameer.abuasal, apazos, llvm-commits, bsdjhb

  Tags: #llvm

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

This is a prerequisite for building and linking hard- and soft-float
riscv worlds with clang and lld.

Requested by: jhb
MFC after: 1 week
X-MFC-With: r353358

4 years agoMerge commit 41449c58c from llvm git (by Roger Ferrer Ibanez):
Dimitry Andric [Fri, 3 Jan 2020 20:09:38 +0000 (20:09 +0000)]
Merge commit 41449c58c from llvm git (by Roger Ferrer Ibanez):

  [RISCV] Fix evaluation of %pcrel_lo

  The following testcase

    function:
    .Lpcrel_label1:
          auipc   a0, %pcrel_hi(other_function)
          addi    a1, a0, %pcrel_lo(.Lpcrel_label1)
          .p2align        2          # Causes a new fragment to be emitted

          .type   other_function,@function
    other_function:
          ret

  exposes an odd behaviour in which only the %pcrel_hi relocation is
  evaluated but not the %pcrel_lo.

    $ llvm-mc -triple riscv64 -filetype obj t.s | llvm-objdump  -d -r -

    <stdin>:      file format ELF64-riscv

    Disassembly of section .text:
    0000000000000000 function:
           0:     17 05 00 00     auipc   a0, 0
           4:     93 05 05 00     mv      a1, a0
                  0000000000000004:  R_RISCV_PCREL_LO12_I other_function+4

    0000000000000008 other_function:
           8:     67 80 00 00     ret

  The reason seems to be that in RISCVAsmBackend::shouldForceRelocation
  we only consider the fragment but in RISCVMCExpr::evaluatePCRelLo we
  consider the section. This usually works but there are cases where
  the section may still be the same but the fragment may be another
  one. In that case we end forcing a %pcrel_lo relocation without any
  %pcrel_hi.

  This patch makes RISCVAsmBackend::shouldForceRelocation use the
  section, if any, to determine if the relocation must be forced or
  not.

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

This is a prerequisite for building and linking hard- and soft-float
riscv worlds with clang and lld.

Requested by: jhb
MFC after: 1 week
X-MFC-With: r353358

4 years agomips !o32: fix csu build
Kyle Evans [Fri, 3 Jan 2020 20:01:36 +0000 (20:01 +0000)]
mips !o32: fix csu build

Pointy hat to: kevans