]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFV 354917, 354918, 354919
pfg [Wed, 20 Nov 2019 23:56:20 +0000 (23:56 +0000)]
MFV 354917, 354918, 354919
openresolv: update to version 3.9.2

MFC after: 3 weeks

4 years agoCreate /etc/os-release file.
imp [Wed, 20 Nov 2019 23:45:31 +0000 (23:45 +0000)]
Create /etc/os-release file.

Each boot, regenerate /var/run/os-release based on the currently running
system. Create a /etc/os-release symlink pointing to this file (so that this
doesn't create a new reason /etc can not be mounted read-only).

This is compatible with what other systems do and is what the sysutil/os-release
port attempted to do, but in an incomplete way. Linux, Solaris and DragonFly all
implement this natively as well. The complete standard can be found at
https://www.freedesktop.org/software/systemd/man/os-release.html

Moving this to the base solves both the non-standard location problem with the
port, as well as the lack of update of this file on system update.

Bump __FreeBSD_version to 1300060

PR: 238953
Differential Revision:  https://reviews.freebsd.org/D22271

4 years agoImport openresolv 3.9.0
pfg [Wed, 20 Nov 2019 22:13:14 +0000 (22:13 +0000)]
Import openresolv 3.9.0

More information at: https://roy.marples.name/projects/openresolv

4 years agoStandardize EFI's ESP mount point.
imp [Wed, 20 Nov 2019 21:06:29 +0000 (21:06 +0000)]
Standardize EFI's ESP mount point.

Mount the UEFI ESP on /boot/efi. No current system uses this by default, but
there are many ad-hoc schemes that do this in /efi or /esp or /uefi and adding a
new directory at the top-level would have a much higher likelihood of
collision. Document this in /etc/mtree/BSD.root.mtree and create EFIDIR and
related variables in bsd.own.mk.

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

4 years agoSet handling for some "Logical unit not ready" errors.
mav [Wed, 20 Nov 2019 20:00:03 +0000 (20:00 +0000)]
Set handling for some "Logical unit not ready" errors.

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

4 years agorandom/ivy: Trivial refactoring
cem [Wed, 20 Nov 2019 19:55:43 +0000 (19:55 +0000)]
random/ivy: Trivial refactoring

It is clearer to me to return success/error (true/false) instead of some
retry count linked to the inline assembly implementation.

No functional change.

Approved by: core(csprng) => csprng(markm)
Differential Revision: https://reviews.freebsd.org/D22454

4 years agoRe-apply fixed r354847
cem [Wed, 20 Nov 2019 19:43:34 +0000 (19:43 +0000)]
Re-apply fixed r354847

unifdef(1): Improve worst-case bound on symbol resolution

Use RB_TREE to make some algorithms O(lg N) and O(N lg N) instead of O(N)
and O(N^2).

While here, remove arbitrarily limit on number of macros understood.

Reverts r354877 and r354878, which disabled the (correct) test.

PR: 242095
Reported by: lwhsu

4 years agoRevert r354847 for now
cem [Wed, 20 Nov 2019 19:07:22 +0000 (19:07 +0000)]
Revert r354847 for now

It was broken.

PR: 242095
Reported by: lwhsu

4 years agoFix typo: deprected -> deprecated.
dim [Wed, 20 Nov 2019 19:07:08 +0000 (19:07 +0000)]
Fix typo: deprected -> deprecated.

4 years agoMake the warning for deprecated NO_ variables an error.
brooks [Wed, 20 Nov 2019 18:36:58 +0000 (18:36 +0000)]
Make the warning for deprecated NO_ variables an error.

Support for NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, NO_MAN, NO_PROFILE,
and NO_WARNS as deprecated in 2014 with a warning added for each one
found. Turn these into error in preperation for removal of compatability
support before FreeBSD 13.

Reviewed by: imp
Relnotes: yes
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22448

4 years agoAdd explanatory comments for the different SRCS_xxx variables used in
dim [Wed, 20 Nov 2019 18:12:01 +0000 (18:12 +0000)]
Add explanatory comments for the different SRCS_xxx variables used in
the Makefiles for libllvm and libclang.  While here, cleanup a commented
out SRCS entry in libllvmminimal's Makefile.

MFC after: 3 days

4 years agoAs with r354905 use uint16_t to store aflags on the stack and as function
andrew [Wed, 20 Nov 2019 18:00:43 +0000 (18:00 +0000)]
As with r354905 use uint16_t to store aflags on the stack and as function
arguments as the aflags size in vm_page_t has increased.

Sponsored by: DARPA, AFRL

4 years agosrc.conf.5: regen for several recent changes
emaste [Wed, 20 Nov 2019 17:57:46 +0000 (17:57 +0000)]
src.conf.5: regen for several recent changes

r354289 armv6: Switch to LLD by default
r354290 Take arm.arm (armv5) out of universe
r354348 armv6, armv7: Switch to llvm-libunwind by default
r354660 Enable the RISC-V LLVM backend by default.

as well as lib32 changes

Sponsored by: The FreeBSD Foundation

4 years agoUse atomic_load_16 to load aflags as it's a uint16_t after r354820.
andrew [Wed, 20 Nov 2019 17:49:58 +0000 (17:49 +0000)]
Use atomic_load_16 to load aflags as it's a uint16_t after r354820.

Sponsored by: DARPA, AFRL

4 years agosrc.conf.5: regen after r354902, WITHOUT_AMD by default
emaste [Wed, 20 Nov 2019 17:49:32 +0000 (17:49 +0000)]
src.conf.5: regen after r354902, WITHOUT_AMD by default

4 years agoAdd description for WITH_AMD
emaste [Wed, 20 Nov 2019 17:45:31 +0000 (17:45 +0000)]
Add description for WITH_AMD

WITHOUT_AMD is now the default as of r354902.

Sponsored by: The FreeBSD Foundation

4 years agodisable amd(8) by default
emaste [Wed, 20 Nov 2019 17:37:45 +0000 (17:37 +0000)]
disable amd(8) by default

As of FreeBSD 10.1 the autofs(5) is available for automounting, and the
amd man page has indicated that the in-tree copy of amd is obsolete.
Disable it by default for now, with the expectation that it will be
removed before FreeBSD 13.0.

Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22460

4 years agoAllow boostrapping xinstall on Linux
arichardson [Wed, 20 Nov 2019 17:24:49 +0000 (17:24 +0000)]
Allow boostrapping xinstall on Linux

Linux does not have st_flags so we have to avoid using it there.

Reviewed By: emaste, imp
Differential Revision: https://reviews.freebsd.org/D22446

4 years agoUse the correct variable, also limit the scope to bfd
lwhsu [Wed, 20 Nov 2019 16:54:21 +0000 (16:54 +0000)]
Use the correct variable, also limit the scope to bfd

PR: 242109
Reported by: jhb
Sponsored by: The FreeBSD Foundation

4 years agoLimit the workaround to riscv only
lwhsu [Wed, 20 Nov 2019 16:35:58 +0000 (16:35 +0000)]
Limit the workaround to riscv only

PR: 242109
Sponsored by: The FreeBSD Foundation

4 years agoUntil every possible root cause for an "invalid ASID" assertion failure is
alc [Wed, 20 Nov 2019 16:32:13 +0000 (16:32 +0000)]
Until every possible root cause for an "invalid ASID" assertion failure is
resolved, assign every pmap a valid ASID when it is first initialized.

4 years agosshd: make getpwclass wrapper MON_ISAUTH not MON_AUTH
emaste [Wed, 20 Nov 2019 16:30:37 +0000 (16:30 +0000)]
sshd: make getpwclass wrapper MON_ISAUTH not MON_AUTH

In r339216 a privsep wrapper was added for login_getpwclass to address
PR 231172.  Unfortunately the change used the MON_AUTH flag in the
wrapper, and MON_AUTH includes MON_AUTHDECIDE which triggers an
auth_log() on each invocation.  getpwclass() does not participate in the
authentication decision, so should be MON_ISAUTH instead.

PR: 234793
Submitted by: Henry Hu
Reviewed by: Yuichiro NAITO
MFC after: 1 week

4 years agoWorkaround riscv64 build when using binutils 2.33.1
lwhsu [Wed, 20 Nov 2019 16:20:49 +0000 (16:20 +0000)]
Workaround riscv64 build when using binutils 2.33.1

PR: 242109
Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22457

4 years agoInstead of looking up a predecessor or successor to the current map
dougm [Wed, 20 Nov 2019 16:06:48 +0000 (16:06 +0000)]
Instead of looking up a predecessor or successor to the current map
entry, when that entry has been seen already, keep the
already-looked-up value in a variable and use that instead of looking
it up again.

Approved by: alc, markj (earlier version), kib (earlier version)
Differential Revision: https://reviews.freebsd.org/D22348

4 years agoImport the NetBSD Kernel Concurrency Sanitizer (KCSAN) runtime.
andrew [Wed, 20 Nov 2019 14:37:48 +0000 (14:37 +0000)]
Import the NetBSD Kernel Concurrency Sanitizer (KCSAN) runtime.

KCSAN is a tool to find concurrent memory access that may race each other.
After a determined number of memory accesses a cell is created, this
describes the current access. It will then delay for a short period
to allow other CPUs a chance to race. If another CPU performs a memory
access to an overlapping region during this delay the race is reported.

This is a straight import of the NetBSD code, it will be adapted to
FreeBSD in a future commit.

Sponsored by: DARPA, AFRL

4 years agocache: minor stat cleanup
mjg [Wed, 20 Nov 2019 12:08:32 +0000 (12:08 +0000)]
cache: minor stat cleanup

Remove duplicated stats and move numcachehv from debug to vfs.cache.

4 years agovfs: perform a more racy check in vfs_notify_upper
mjg [Wed, 20 Nov 2019 12:07:54 +0000 (12:07 +0000)]
vfs: perform a more racy check in vfs_notify_upper

Locking mp does not buy anything interms of correctness and only contributes to
contention.

4 years agolinux: avoid overhead of P_CONTROLT checks if possible
mjg [Wed, 20 Nov 2019 12:06:29 +0000 (12:06 +0000)]
linux: avoid overhead of P_CONTROLT checks if possible

Sponsored by: The FreeBSD Foundation

4 years agovfs: change si_usecount management to count used vnodes
mjg [Wed, 20 Nov 2019 12:05:59 +0000 (12:05 +0000)]
vfs: change si_usecount management to count used vnodes

Currently si_usecount is effectively a sum of usecounts from all associated
vnodes. This is maintained by special-casing for VCHR every time usecount is
modified. Apart from complicating the code a little bit, it has a scalability
impact since it forces a read from a cacheline shared with said count.

There are no consumers of the feature in the ports tree. In head there are only
2: revoke and devfs_close. Both can get away with a weaker requirement than the
exact usecount, namely just the count of active vnodes. Changing the meaning to
the latter means we only need to modify it on 0<->1 transitions, avoiding the
check plenty of times (and entirely in something like vrefact).

Reviewed by: kib, jeff
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22202

4 years agoamd64: in double fault handler, do not rely on sane gsbase value.
kib [Wed, 20 Nov 2019 11:12:19 +0000 (11:12 +0000)]
amd64: in double fault handler, do not rely on sane gsbase value.

Typical reasons for doublefault faults are either kernel stack
overflow or bugs in the code that manipulates protection CPU state.
The later code is the code which often has to set up gsbase for
kernel.  Switching to explicit load of GSBASE MSR in the fault handler
makes it more probable to output a useful information.

Now all IST handlers have nmi_pcpu structure on top of their stacks.

It would be even more useful to save gsbase value at the moment of the
fault.  I did not this because I do not want to modify PCB layout now.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agozpool.8: remove a paragraph about quorum disks
avg [Wed, 20 Nov 2019 08:56:01 +0000 (08:56 +0000)]
zpool.8: remove a paragraph about quorum disks

FreeBSD has no such thing.
illumos and ZoL manuals do not talk about quorum disks either.
Only Oracle ZFS mentions them.

MFC after: 1 week

4 years agofix up r354804, resolve merge conflicts in zpool.8
avg [Wed, 20 Nov 2019 08:49:13 +0000 (08:49 +0000)]
fix up r354804, resolve merge conflicts in zpool.8

Somehow I managed to commit the manual page with unresolved conflicts in
it.

While here, I also replaced .sp with .Pp.

MFC after: 3 weeks
X-MFC with: r354804

4 years agoOnly skip failing test case in CI.
lwhsu [Wed, 20 Nov 2019 05:34:02 +0000 (05:34 +0000)]
Only skip failing test case in CI.

PR: 242095
Sponsored by: The FreeBSD Foundation

4 years agoTemporarily skip the failing test case usr.bin.unifdef.basic_test.basic
lwhsu [Wed, 20 Nov 2019 05:30:31 +0000 (05:30 +0000)]
Temporarily skip the failing test case usr.bin.unifdef.basic_test.basic

PR: 242095
Sponsored by: The FreeBSD Foundation

4 years agobcm2835_vcbus: add compatibility name for ^/sys/contrib/vchiq
kevans [Wed, 20 Nov 2019 05:04:44 +0000 (05:04 +0000)]
bcm2835_vcbus: add compatibility name for ^/sys/contrib/vchiq

It's unclear how this didn't get caught in my last iteration, but the fix is
easy- the interface is still compatible, it was just gratuituously renamed
to match my arbitrary definition of consistency... VCBUS, the BCM2835 name,
represents an address on the VideoCore CPU Bus.

In a similar fashion, while it is a physical address, the ARMC portion
represents that these are addresses as seen by the ARM CPU.

To make things even more fun, the BCM2711 peripheral documentation describes
not virtual address space vs. physical address space, but instead the 32-bit
address map vs. the address map in "Low Peripheral" mode. The latter of
these is what the *ARMC* macros translate to/from.

4 years agobcm2835: push address mapping conversion for DMA/mailbox to runtime
kevans [Wed, 20 Nov 2019 03:57:46 +0000 (03:57 +0000)]
bcm2835: push address mapping conversion for DMA/mailbox to runtime

We could maintain the static conversions for the !AArch64 Raspberry Pis, but
I'm not sure it's worth it -- we'll traverse the platform list exactly once
(of which there are only two for armv7), then every conversion there-after
traverses the memory map listing of which there are at-most two entries for
these boards: sdram and peripheral space.

Detecting this at runtime is necessary for the AArch64 SOC, though, because
of the distinct IO windows being otherwise not discernible just from support
compiled into the kernel. We currently select the correct window based on
/compatible in the FDT.

We also use a similar mechanism to describe the DMA restrictions- the RPi 4
can have up to 4GB of RAM while the DMA controller and mailbox mechanism can
technically, kind of, only access the lowest 1GB. See the comment in
bcm2835_vcbus.h for a fun description/clarification of this.

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

4 years agoWhen we set OFFPAGE to limit fragmentation we should also set VTOSLAB
jeff [Wed, 20 Nov 2019 01:57:33 +0000 (01:57 +0000)]
When we set OFFPAGE to limit fragmentation we should also set VTOSLAB
so that we avoid the hashtables.  The hashtable is now only required if
a zone is created with OFFPAGE specified initially, not internally.  This
flag signals to UMA that it can't touch the allocated memory and so
can't store a slab pointer in the containing page.

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

4 years agoWhite space cleanup. No functional change.
mckusick [Wed, 20 Nov 2019 01:14:22 +0000 (01:14 +0000)]
White space cleanup. No functional change.

Sponsored by: Netflix

4 years agoAdd some KASSERTs. Reacquire a mutex after a kernel printf rather
mckusick [Wed, 20 Nov 2019 01:10:01 +0000 (01:10 +0000)]
Add some KASSERTs. Reacquire a mutex after a kernel printf rather
than holding it during the printf. White space cleanup.

Sponsored by: Netflix

4 years agoOnly keep anonymous objects on shadow lists. This eliminates locking of
jeff [Wed, 20 Nov 2019 00:31:14 +0000 (00:31 +0000)]
Only keep anonymous objects on shadow lists.  This eliminates locking of
globally visible objects when they are part of a backing chain.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D22423

4 years agoRemove unnecessary object locking from the vnode pager. Recent changes to
jeff [Tue, 19 Nov 2019 23:30:09 +0000 (23:30 +0000)]
Remove unnecessary object locking from the vnode pager.  Recent changes to
busy/valid/dirty locking make these acquires redundant.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D22186

4 years agoSimplify anonymous memory handling with an OBJ_ANON flag. This eliminates
jeff [Tue, 19 Nov 2019 23:19:43 +0000 (23:19 +0000)]
Simplify anonymous memory handling with an OBJ_ANON flag.  This eliminates
reudundant complicated checks and additional locking required only for
anonymous memory.  Introduce vm_object_allocate_anon() to create these
objects.  DEFAULT and SWAP objects now have the correct settings for
non-anonymous consumers and so individual consumers need not modify the
default flags to create super-pages and avoid ONEMAPPING/NOSPLIT.

Reviewed by: alc, dougm, kib, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22119

4 years agobcm2835_sdhci: various refactoring of DMA path
kevans [Tue, 19 Nov 2019 23:12:43 +0000 (23:12 +0000)]
bcm2835_sdhci: various refactoring of DMA path

This round of refactoring is mostly about streamlining the interrupt handler
to make it easier to verify and reason about operations taking place while
trying to bring FreeBSD up on the RPi4.

4 years agonetmap: check if we already ran mmap before we attempt it
vmaffione [Tue, 19 Nov 2019 21:29:49 +0000 (21:29 +0000)]
netmap: check if we already ran mmap before we attempt it

Submitted by: neel@neelc.org
Reviewed by: vmaffione
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22390

4 years agoin6: move include
bz [Tue, 19 Nov 2019 21:14:15 +0000 (21:14 +0000)]
in6: move include

Move the include for sysctl.h out of the middle of the file to the
includes at the beginning.  This is will make it easier to add new
sysctls.

No functional changes.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agobhyve: virtio-net: disable receive until features are negotiated
vmaffione [Tue, 19 Nov 2019 21:10:44 +0000 (21:10 +0000)]
bhyve: virtio-net: disable receive until features are negotiated

This patch fixes a race condition where the receive callback is called
while the device is being reset. Since the rx_merge variable may change
during reset, the receive callback may operate inconsistently with what
the guest expects.
Also, get rid of the unused rx_vhdrlen variable.

PR: 242023
Reported by: aleksandr.fedorov@itglobal.com
Reviewed by: markj, jhb
MFC with: r354552
Differential Revision: https://reviews.freebsd.org/D22440

4 years agond6: sysctl
bz [Tue, 19 Nov 2019 21:08:18 +0000 (21:08 +0000)]
nd6: sysctl

Move the SYSCTL_DECL to the top of the file.  Move the sysctl function
before SYSCTL_PROC so that we don't need an extra function declaration in
the middle of the file.

No functional changes.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agond6: make nd6_timer_ch static
bz [Tue, 19 Nov 2019 20:54:17 +0000 (20:54 +0000)]
nd6: make nd6_timer_ch static

nd6_timer_ch is only used in file local context.  There is no need to
export it, so make it static.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agond6_rtr: re-sort functions
bz [Tue, 19 Nov 2019 20:34:33 +0000 (20:34 +0000)]
nd6_rtr: re-sort functions

Resort functions within file in a way that they depend on each other as
that makes it easier to rework various things.
Also allows us to remove file local function declarations.

No functional changes.

MFC after: 3 weeks
Sponsored by: Netflix

4 years agoAchieve two goals at once: (1) Avoid an unnecessary broadcast TLB
alc [Tue, 19 Nov 2019 19:05:05 +0000 (19:05 +0000)]
Achieve two goals at once: (1) Avoid an unnecessary broadcast TLB
invalidation in reclaim_pv_chunk(). (2) Prevent an "invalid ASID" assertion
failure in reclaim_pv_chunk().  The detailed explanation for this change is
provided by r354792.

X-MFC with: r354792

4 years agoWITH_SYSTEM_LINKER: Fix rebuilding lld every time.
bdrewery [Tue, 19 Nov 2019 16:40:46 +0000 (16:40 +0000)]
WITH_SYSTEM_LINKER: Fix rebuilding lld every time.

This is due to LLD_REVISION_STRING being renamed to LLD_REVISION in
r351442 and the value being moved to another location in r351965.

`make test-system-linker` can be used to see the values being used here.

Reported by: ler

4 years agoFix the byte order of IPv4 address parsed from begemotSnmpdTransInetStatus
ae [Tue, 19 Nov 2019 16:29:47 +0000 (16:29 +0000)]
Fix the byte order of IPv4 address parsed from begemotSnmpdTransInetStatus
config option.

An address is already in network byte order, there is no need to do
htonl().

PR: 242056
MFC after: 1 week

4 years agoReduce the vnet_set module size of ip_mroute to allow loading as a module.
bz [Tue, 19 Nov 2019 15:38:55 +0000 (15:38 +0000)]
Reduce the vnet_set module size of ip_mroute to allow loading as a module.

With VIMAGE kernels modules get special treatment as they need
to also keep the original values and make copies for each instance.
For that a few pages of vnet modspace are provided and the
kernel-linker and the VNET framework know how to deal with things.
When the modspace is (almost) full, other modules which would
overflow the modspace cannot be loaded and kldload will fail.

ip_mroute uses a lot of variable space, mostly be four big arrays:
set_vnet 0000000000000510 vnet_entry_multicast_register_if
set_vnet 0000000000000700 vnet_entry_viftable
set_vnet 0000000000002000 vnet_entry_bw_meter_timers
set_vnet 0000000000002800 vnet_entry_bw_upcalls

Dynamically malloc the three big ones for each instance we need
and free them again on vnet teardown (the 4th is an ifnet).
That way they only need module space for a single pointer and
allow a lot more modules using virtualized variables to be loaded
on a VNET kernel.

PR: 206583
Reviewed by: hselasky, kp
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D22443

4 years agomld: fix epoch assertion
bz [Tue, 19 Nov 2019 14:53:13 +0000 (14:53 +0000)]
mld: fix epoch assertion

in6ifa_ifpforlinklocal() asserts the net epoch.  The test case from r354832
revealed code paths where we call into the function without having
acquired the net epoch first and consequently we hit the assert.
This happens in certain MLD states during VNET shutdown and most people
normaly not notice this.

For correctness acquire the net epoch around calls to
mld_v1_transmit_report() in all cases to avoid the assertion firing.

MFC after: 2 weeks
Sponsored by: Netflix

4 years agoDon't sanitize linker_set
dab [Tue, 19 Nov 2019 14:46:28 +0000 (14:46 +0000)]
Don't sanitize linker_set

The assumptions of linker_set don't play nicely with
AddressSanitizer. AddressSanitizer adds a 'redzone' of zeros around
globals (including those in named sections), whereas linker_set
assumes they are all packed consecutively like a pointer array. So:
let's annotate linker_set so that AddressSanitizer ignores it.

Submitted by: Matthew Bryan <matthew.bryan@isilon.com>
Reviewed by: kib, rang_acm.org
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22239

4 years agoReturn 0 from ptrace_set_pc as it now completes successfully.
andrew [Tue, 19 Nov 2019 13:28:59 +0000 (13:28 +0000)]
Return 0 from ptrace_set_pc as it now completes successfully.

Sponsored by: DARPA, AFRL

4 years agoAllow ptrace to set the probram counter on arm64.
andrew [Tue, 19 Nov 2019 13:25:46 +0000 (13:25 +0000)]
Allow ptrace to set the probram counter on arm64.

Sponsored by: DARPA, AFRL

4 years agoFix the definition of bus_space_read_stream_8 on arm64.
andrew [Tue, 19 Nov 2019 10:57:44 +0000 (10:57 +0000)]
Fix the definition of bus_space_read_stream_8 on arm64.

This is currently unused, however will be when the Kernel Concurrency
Sanitizer (KCSAN) is imported from NetBSD.

Sponsored by: DARPA, AFRL

4 years agoDrop the extra argument from swp_pager_meta_ctl and have it do lookup
dougm [Tue, 19 Nov 2019 08:06:31 +0000 (08:06 +0000)]
Drop the extra argument from swp_pager_meta_ctl and have it do lookup
only.  Rename it swp_pager_meta_lookup.  Stop checking for obj->type
== swap there and assert it instead.  Make the caller responsible for
the obj->type check.

Move the meta_ctl 'pop' functionality to swap_pager_unswapped, the
only place that uses it, and assume obj->type == swap there too.

Assisted by: ota_j.email.ne.jp
Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22437

4 years agohyperv/storvsc: stash a pointer to hv_storvsc_request in ccb
avg [Tue, 19 Nov 2019 07:20:59 +0000 (07:20 +0000)]
hyperv/storvsc: stash a pointer to hv_storvsc_request in ccb

A SIM-private field is used for that.
The pointer can be useful when examining a state of a queued ccb.
E.g., a ccb on a da_softc.pending_ccbs.

MFC after: 2 weeks

4 years agounifdef(1): Improve worst-case bound on symbol resolution
cem [Tue, 19 Nov 2019 04:30:23 +0000 (04:30 +0000)]
unifdef(1): Improve worst-case bound on symbol resolution

Use RB_TREE to make some algorithms O(lg N) and O(N lg N) instead of O(N)
and O(N^2).  Because N is typically small and the former linear array also has
great constant factors (as a property of CPU caching), this doesn't provide
material benefit most or all of the time.

While here, remove arbitrarily limit on number of macros understood.

4 years agobcm2835_sdhci: formalize DMA tag/segment scaling requirements
kevans [Tue, 19 Nov 2019 04:23:57 +0000 (04:23 +0000)]
bcm2835_sdhci: formalize DMA tag/segment scaling requirements

This allows easy and care-free scaling of NUM_DMA_SEGS with proper-ish
calculations to make sure we can actually handle the number of segments we'd
like to handle on average so that performance comparisons can be easily made
at different values if/once we can actually handle it. It also makes it
helps the untrained reader understand more quickly the reasoning behind the
choice of maxsize/maxsegs/maxsegsize.

4 years agobcm2835_sdhci: some style cleanup, no functional change
kevans [Tue, 19 Nov 2019 03:45:41 +0000 (03:45 +0000)]
bcm2835_sdhci: some style cleanup, no functional change

4 years agobcm2835_sdhci: drop an assert in start_dma_seg
kevans [Tue, 19 Nov 2019 03:40:17 +0000 (03:40 +0000)]
bcm2835_sdhci: drop an assert in start_dma_seg

Trivial change to clarify locking expectations... no functional change.

4 years agounifdef(1): Kill totally useless header
cem [Tue, 19 Nov 2019 03:15:06 +0000 (03:15 +0000)]
unifdef(1): Kill totally useless header

No functional change.

4 years agoELF toolchain: Add PowerPC VMX and VSX note decode to readelf
jhibbits [Tue, 19 Nov 2019 02:11:00 +0000 (02:11 +0000)]
ELF toolchain: Add PowerPC VMX and VSX note decode to readelf

Summary: A follow-on to r276634, which added the VMX note to userland cores,
and r334538 for VSX notes.

Copied from note_type_linux_core().

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

4 years agoAdd ioat_get_domain() to ioat(4) KPI.
mav [Tue, 19 Nov 2019 02:09:04 +0000 (02:09 +0000)]
Add ioat_get_domain() to ioat(4) KPI.

This allows NUMA-aware consumers to reduce inter-domain traffic.

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

4 years agoCall bus_dma_dmar_set_buswide(9) added in r354830.
mav [Tue, 19 Nov 2019 02:03:10 +0000 (02:03 +0000)]
Call bus_dma_dmar_set_buswide(9) added in r354830.

PLX NTB sends translated DMA requests not only from itsels, but from all
slots and functions of its bus.  By default DMAR blocks those additional.

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

4 years agopowerpc/pmap: Remove an unused error from moea64_pvo_enter()
jhibbits [Tue, 19 Nov 2019 02:00:13 +0000 (02:00 +0000)]
powerpc/pmap: Remove an unused error from moea64_pvo_enter()

ENOENT is leftover from mmu_oea.c's moea_pvo_enter(), where it's used to
syncicache() on the first new mapping of a page.  This sync is done
differently in OEA64.

4 years agopowerpc/booke pmap: Use the right 'tlbilx' form to invalidate TIDs
jhibbits [Tue, 19 Nov 2019 01:28:06 +0000 (01:28 +0000)]
powerpc/booke pmap: Use the right 'tlbilx' form to invalidate TIDs

'tlbilxpid' is 'tlbilx 1, 0', while the existing form is 'tlbilx 0, 0',
which translates to 'tlbilxlpid', invalidating a LDPID.  This effectively
invalidates the entire TLB, causing unnecessary reloads.

4 years agoflua: newer GCC complains about format-nonliteral at WARNS=2
kevans [Tue, 19 Nov 2019 00:02:56 +0000 (00:02 +0000)]
flua: newer GCC complains about format-nonliteral at WARNS=2

Disable that one, too.

4 years agosysent: regenerate after r354835
kevans [Mon, 18 Nov 2019 23:31:12 +0000 (23:31 +0000)]
sysent: regenerate after r354835

The lua-based makesyscalls produces slightly different output than its
makesyscalls.sh predecessor, all whitespace differences more closely
matching the source syscalls.master.

4 years agoConvert in-tree sysent targets to use new makesyscalls.lua
kevans [Mon, 18 Nov 2019 23:28:23 +0000 (23:28 +0000)]
Convert in-tree sysent targets to use new makesyscalls.lua

flua is bootstrapped as part of the build for those on older
versions/revisions that don't yet have flua installed. Once upgraded past
r354833, "make sysent" will again naturally work as expected.

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

4 years agobsnmp: Fix operator precedence in error check in table_check_response
jhibbits [Mon, 18 Nov 2019 23:23:38 +0000 (23:23 +0000)]
bsnmp: Fix operator precedence in error check in table_check_response

Summary:
The ?: operator has a lower precedence than == and &&, so the result will always
be recorded as true.  Found by gcc8.

Reviewed by: ngie, ae
Differential Revision: https://reviews.freebsd.org/D22427

4 years agoAdd flua to the base system, install to /usr/libexec
kevans [Mon, 18 Nov 2019 23:21:13 +0000 (23:21 +0000)]
Add flua to the base system, install to /usr/libexec

FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever
extensions we need for base system operations. We currently support a subset
of lfs and lposix that are used in the rewrite of makesyscall.sh into lua,
added in r354786.

flua is intentionally written such that one can install standard lua and
some set of lua modules from ports and achieve the same effect.

linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added
in. This is similar to what we do in stand/. linit.c has been renamed to
make it clear that this has flua-specific bits.

luaconf has been slightly obfuscated to make extensions more difficult. Part
of the problem is that flua is already hard enough to use as a bootstrap
tool because it's not in PATH- attempting to do extension loading would
require a special bootstrap version of flua with paths changed to protect
the innocent.

src.lua.mk has been added to make it easy for in-tree stuff to find flua,
whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1.

Reviewed by: brooks, emaste (both earlier version), imp
Differential Revision: https://reviews.freebsd.org/D21893

4 years agoicmpv6: Fix mbuf change in mld
bz [Mon, 18 Nov 2019 21:59:47 +0000 (21:59 +0000)]
icmpv6: Fix mbuf change in mld

After r354748 mld_input() can change the mbuf.  The new pointer
is never returned to icmp6_input() and when passed to
icmp6_rip6_input() the mbuf may no longer valid leading to
a panic.
Pass a pointer to the mbuf to mld_input() so we can return an
updated version in the non-error case.

Add a test sending an MLD packet case which will trigger this bug.

Pointyhat to: bz
Reported by: gallatin, thj
MFC After: 2 weeks
X-MFC with: r354748
Sponsored by: Netflix

4 years agoipv6 tests
bz [Mon, 18 Nov 2019 21:54:29 +0000 (21:54 +0000)]
ipv6 tests

Add a simple ping6 test as well.

MFC after: 2 weeks
Sponsored by: Netflix

4 years agobus_dma_dmar_set_buswide(9): KPI to indicate that the whole dmar
kib [Mon, 18 Nov 2019 20:56:59 +0000 (20:56 +0000)]
bus_dma_dmar_set_buswide(9): KPI to indicate that the whole dmar
context should share page tables.

Practically it means that dma requests from any device on the bus are
translated according to the entries loaded for the bus:0:0 device.
KPI requires that the slot and function of the device be 0:0, and that
no tags for other devices on the bus were used.

The intended use are NTBs which pass TLPs from the downstream to the
host with slot:func of the downstream originator.

Reviewed and tested by: mav
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22434

4 years agoAdd a "B" suffix to memory quantities in top(1) output.
markj [Mon, 18 Nov 2019 20:55:01 +0000 (20:55 +0000)]
Add a "B" suffix to memory quantities in top(1) output.

Otherwise small quantities look nonsensical.  For instance, when
swapping in a single page we would print "4096 In".

Fix code indentation while here.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoAdd x86 msr tweak KPI.
kib [Mon, 18 Nov 2019 20:53:57 +0000 (20:53 +0000)]
Add x86 msr tweak KPI.

Use the KPI to tweak MSRs in mitigation code.

Reviewed by: markj, scottl
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22431

4 years agoCheck for errors from copyout() and suword*() in sv_copyout_args/strings.
jhb [Mon, 18 Nov 2019 20:07:43 +0000 (20:07 +0000)]
Check for errors from copyout() and suword*() in sv_copyout_args/strings.

Reviewed by: brooks, kib
Tested on: amd64 (amd64, i386, linux64), i386 (i386, linux)
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D22401

4 years agoSet MALLOC_DEBUG_MAXZONES=1 in GENERIC-NODEBUG configurations.
markj [Mon, 18 Nov 2019 20:03:28 +0000 (20:03 +0000)]
Set MALLOC_DEBUG_MAXZONES=1 in GENERIC-NODEBUG configurations.

The purpose of this option is to make it easier to track down memory
corruption bugs by reducing the number of malloc(9) types that might
have recently been associated with a given chunk of memory.  However, it
increases fragmentation and is disabled in release kernels.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agobcm2835_sdhci: use a macro for interrupts we handle
kevans [Mon, 18 Nov 2019 19:28:09 +0000 (19:28 +0000)]
bcm2835_sdhci: use a macro for interrupts we handle

This is just further simplification, very little functional change. In the
DMA interrupt handler, we *do* now acknowledge both DATA_AVAIL | SPACE_AVAIL
every time -- these operations are mutually exclusive, so while this is a
functional change, it's effectively a nop. Removing the 'mask' local allows
us to further simplify in a future change.

4 years agoFix grammar in gpart.8.
markj [Mon, 18 Nov 2019 19:05:52 +0000 (19:05 +0000)]
Fix grammar in gpart.8.

PR: 241973
MFC after: 3 days

4 years agobcm2835_sdhci: push DATA_END handling out of DMA interrupt path
kevans [Mon, 18 Nov 2019 18:40:35 +0000 (18:40 +0000)]
bcm2835_sdhci: push DATA_END handling out of DMA interrupt path

This simplifies the DMA interrupt handler quite a bit. The sdhci framework
will call platform_finish_transfer() if it's received SDHCI_INT_DATA_END, so
we can take care of any final cleanup there and simply not worry about the
possibility of it ending in the DMA interrupt path.

4 years agoFix inconsistencies in anonymous DOF files.
markj [Mon, 18 Nov 2019 18:34:23 +0000 (18:34 +0000)]
Fix inconsistencies in anonymous DOF files.

The DOF file output by dtrace -A contains only the loadable sections.
However, as it was created by a call to dtrace_dof_create() without
flags, the original DOF was created with the loadable sections.  The
result is that the DOF includes the section headers for the unloadable
sections (COMMENTS and UTSNAME) without these sections actually being
present.  This is inconsistent.

A simple change to anon_prog() ensures that the missing sections are
present in the outputted DOF.  Alternatively, the call to
dtrace_dof_create() could pass the DTRACE_D_STRIP flag stripping out the
loadable sections.  As the unloadable sections contain info useful for
debugging purposes they haven't been stripped.

Submitted by: Graeme Jenkinson <graeme.jenkinson@cl.cam.ac.uk>
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21875

4 years agoGroup per-domain reservation data in the same structure.
markj [Mon, 18 Nov 2019 18:25:51 +0000 (18:25 +0000)]
Group per-domain reservation data in the same structure.

We currently have the per-domain partially populated reservation queues
and the per-domain queue locks.  Define a new per-domain padded
structure to contain both of them.  This puts the queue fields and lock
in the same cache line and avoids the false sharing within the old queue
array.

Also fix field packing in the reservation structure.  In many places we
assume that a domain index fits in 8 bits, so we can do the same there
as well.  This reduces the size of the structure by 8 bytes.

Update some comments while here.  No functional change intended.

Reviewed by: dougm, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22391

4 years agoWiden the vm_page aflags field to 16 bits.
markj [Mon, 18 Nov 2019 18:22:41 +0000 (18:22 +0000)]
Widen the vm_page aflags field to 16 bits.

We are now out of aflags bits, whereas the "flags" field only makes use
of five of its sixteen bits, so narrow "flags" to eight bits.  I have no
intention of adding a new aflag in the near future, but would like to
combine the aflags, queue and act_count fields into a single atomically
updated word.  This will allow vm_page_pqstate_cmpset() to become much
simpler and is a step towards eliminating the use of the page lock array
in updating per-page queue state.

The change modifies the layout of struct vm_page, so bump
__FreeBSD_version.

Reviewed by: alc, dougm, jeff, kib
Sponsored by: Netflix, Intel
Differential Revision: https://reviews.freebsd.org/D22397

4 years agoImplement vm.pmap.kernel_maps for arm64.
markj [Mon, 18 Nov 2019 15:37:01 +0000 (15:37 +0000)]
Implement vm.pmap.kernel_maps for arm64.

Reviewed by: alc
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22142

4 years agoLet arm64 pmap_qenter() and pmap_kenter() unconditionally set NX.
markj [Mon, 18 Nov 2019 15:36:46 +0000 (15:36 +0000)]
Let arm64 pmap_qenter() and pmap_kenter() unconditionally set NX.

As on amd64, there is no need for mappings created by these functions to
be executable.

Reviewed by: alc, andrew
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22141

4 years agoUpdate the ses(4) man page
asomers [Mon, 18 Nov 2019 14:12:33 +0000 (14:12 +0000)]
Update the ses(4) man page

This driver was largely rewritten in 2015 (svn r235911) but the man page was
never updated to match.

Reviewed by: trasz
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D22339

4 years agoJail and capability mode for shm_rename; add audit support for shm_rename
dab [Mon, 18 Nov 2019 13:31:16 +0000 (13:31 +0000)]
Jail and capability mode for shm_rename; add audit support for shm_rename

Co-mingling two things here:

  * Addressing some feedback from Konstantin and Kyle re: jail,
    capability mode, and a few other things
  * Adding audit support as promised.

The audit support change includes a partial refresh of OpenBSM from
upstream, where the change to add shm_rename has already been
accepted. Matthew doesn't plan to work on refreshing anything else to
support audit for those new event types.

Submitted by: Matthew Bryan <matthew.bryan@isilon.com>
Reviewed by: kib
Relnotes: Yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22083

4 years agofix up r354804, add new ZFS file mmp.c to kernel files
avg [Mon, 18 Nov 2019 10:46:55 +0000 (10:46 +0000)]
fix up r354804, add new ZFS file mmp.c to kernel files

Reported by: CI LINT build
MFC after: 4 weeks
X-MFC with: r354804

4 years agofix up r354804, link zstreamdump with libzfs
avg [Mon, 18 Nov 2019 10:34:27 +0000 (10:34 +0000)]
fix up r354804, link zstreamdump with libzfs

Since r354804 libzpool depends on libzfs for get_system_hostid symbol.
Except for zstreamdump, all binaries linked with libzpool were already
linked with libzfs.  So, zstreamdump is the only fall-out.

It's interesting that on amd64 not only I was able to successfully build
zstreamdump, I am able to run it despite having the unresolved symbol in
libzpool.

MFC after: 4 weeks
X-MFC with: r354804

4 years agoMake linux(4) open(2)/openat(2) return ELOOP instead of EMLINK,
trasz [Mon, 18 Nov 2019 10:19:16 +0000 (10:19 +0000)]
Make linux(4) open(2)/openat(2) return ELOOP instead of EMLINK,
when being passed O_NOFOLLOW.  This fixes LTP testcase openat02:5.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22384

4 years agoMFV r354378,r354379,r354386: 10499 Multi-modifier protection (MMP)
avg [Mon, 18 Nov 2019 09:38:35 +0000 (09:38 +0000)]
MFV r354378,r354379,r354386: 10499 Multi-modifier protection (MMP)

10499 Multi-modifier protection (MMP)
illumos/illumos-gate@e0f1c0afa46cc84d4b1e40124032a9a87310386e
https://github.com/illumos/illumos-gate/commit/e0f1c0afa46cc84d4b1e40124032a9a87310386e
https://www.illumos.org/issues/10499
  Port the following ZFS commits from ZoL to illumos.
  379ca9cf2 Multi-modifier protection (MMP)
  bbffb59ef Fix multihost stale cache file import
  0d398b256 Do not initiate MMP writes while pool is suspended

10701 Correct lock ASSERTs in vdev_label_read/write
illumos/illumos-gate@58447f688d5e308373ab16a3b129bc0ba0fbc154
https://github.com/illumos/illumos-gate/commit/58447f688d5e308373ab16a3b129bc0ba0fbc154
https://www.illumos.org/issues/10701
  Port of ZoL commit:
  0091d66f4e Correct lock ASSERTs in vdev_label_read/write
  At a minimum, this fixes a blown assert during an MMP test run when running on
  a DEBUG build.

11770 additional mmp fixes
illumos/illumos-gate@4348eb901228d2f8fa50bb132a34248e8662074e
https://github.com/illumos/illumos-gate/commit/4348eb901228d2f8fa50bb132a34248e8662074e
https://www.illumos.org/issues/11770
  Port a few additional MMP fixes from ZoL that came in after our
  initial MMP port.
  4ca457b065 ZTS: Fix mmp_interval failure
  ca95f70dff zpool import progress kstat
  (only minimal changes from above can be pulled in right now)
  060f0226e6 MMP interval and fail_intervals in uberblock

Note from the committer (me).
I do not have any use for this feature and I have not tested it.  I only
did smoke testing with multihost=off.
Please be aware.
I merged the code only to make future merges easier.

Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Portions contributed by: Tim Chase <tim@chase2k.com>
Portions contributed by: sanjeevbagewadi <sanjeev.bagewadi@gmail.com>
Portions contributed by: John L. Hammond <john.hammond@intel.com>
Portions contributed by: Giuseppe Di Natale <dinatale2@llnl.gov>
Portions contributed by: Prakash Surya <surya1@llnl.gov>
Portions contributed by: Brian Behlendorf <behlendorf1@llnl.gov>
Author: Olaf Faaland <faaland1@llnl.gov>

MFC after: 4 weeks

4 years agoMFV r354798:
delphij [Mon, 18 Nov 2019 04:22:04 +0000 (04:22 +0000)]
MFV r354798:

Apply vendor fixes:

06de62c Detect multiplication overflow when computing sector position
46a8443 Limit the number of elements in a vector (found by oss-fuzz)

Requested by: wen
MFC after: 3 days
Security: CVE-2019-18218

4 years agoLink in NetBSD's unifdef(1) tests
cem [Mon, 18 Nov 2019 04:03:11 +0000 (04:03 +0000)]
Link in NetBSD's unifdef(1) tests

Skip one, is it currently fails.

4 years agoAlso clean LINT64 kernel configuration for powerpc
lwhsu [Mon, 18 Nov 2019 01:56:19 +0000 (01:56 +0000)]
Also clean LINT64 kernel configuration for powerpc

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agopowerpc: Re-add -Wno-redundant-decls to DPAA build flags
jhibbits [Sun, 17 Nov 2019 20:49:24 +0000 (20:49 +0000)]
powerpc: Re-add -Wno-redundant-decls to DPAA build flags

Since the DPAA code is from a third party, with minimal edits, there is no
intent to fix these specific warnings at this time.  Hide these warnings to
prevent the noise from hiding real warnings.