]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agobitset: rename confusing macro NAND to ANDNOT
rlibby [Fri, 13 Dec 2019 09:32:16 +0000 (09:32 +0000)]
bitset: rename confusing macro NAND to ANDNOT

s/BIT_NAND/BIT_ANDNOT/, and for CPU and DOMAINSET too.  The actual
implementation is "and not" (or "but not"), i.e. A but not B.
Fortunately this does appear to be what all existing callers want.

Don't supply a NAND (not (A and B)) operation at this time.

Discussed with: jeff
Reviewed by: cem
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22791

4 years agouma: report slab efficiency
rlibby [Fri, 13 Dec 2019 09:32:09 +0000 (09:32 +0000)]
uma: report slab efficiency

Reviewed by: jeff
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22766

4 years agouma: delay bucket_init() until we might actually enable buckets
rlibby [Fri, 13 Dec 2019 09:32:03 +0000 (09:32 +0000)]
uma: delay bucket_init() until we might actually enable buckets

This helps with a bootstrapping problem in upcoming work.

We don't first enable buckets until uma_startup2(), so we can delay
bucket creation until then.  The other two paths to bucket_enable() are
both later, one in the pageout daemon (SI_SUB_KTHREAD_PAGE vs SI_SUB_VM)
and one in uma_timeout() (first activated in uma_startup3()).  Note that
although some bucket functions are accessible before uma_startup2()
(e.g. bucket_select() in zone_ctor()), none of them inspect ubz_zone.

Discussed with: jeff
Reviewed by: markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22765

4 years agouma dbg: flexible size for slab debug bitset too
rlibby [Fri, 13 Dec 2019 09:31:59 +0000 (09:31 +0000)]
uma dbg: flexible size for slab debug bitset too

Recently (r355315) the size of the struct uma_slab bitset field us_free
became dynamic instead of conservative.  Now, make the debug bitset
size dynamic too.  The debug bitset is INVARIANTS-only, so in fact we
don't care too much about the space savings that results from this, but
enabling minimally-sized slabs on INVARIANTS builds is still important
in order to be able to test new slab layouts effectively.

Reviewed by: jeff, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22759

4 years agoAdd kern.geom.part.separator tunable. This makes it possible
trasz [Fri, 13 Dec 2019 09:28:44 +0000 (09:28 +0000)]
Add kern.geom.part.separator tunable.  This makes it possible
to specify an optional separator to insert before partition name;
eg if it's set to "c/", you'll get "ada0c/s1" instead of "ada0s1".
(It cannot be set to just “/“, since ada0 is a device node, not
a directory.)

Reviewed by: imp
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D22193

4 years agoloader: clean up devopen and devclose a bit
tsoome [Fri, 13 Dec 2019 08:41:37 +0000 (08:41 +0000)]
loader: clean up devopen and devclose a bit

devopen should undo setup of f->f_dev in case of error.
devclose can just call free().

MFC after: 1 week

4 years agoloader: vdisk dereference after free
tsoome [Fri, 13 Dec 2019 08:20:20 +0000 (08:20 +0000)]
loader: vdisk dereference after free

print out the information and then free the memory used.

MFC after: 1 week

4 years agontpd(8): Don't use OpenSSL's RAND API
cem [Fri, 13 Dec 2019 05:54:38 +0000 (05:54 +0000)]
ntpd(8): Don't use OpenSSL's RAND API

The !USE_OPENSSL_CRYPTO_RAND path uses arc4random_buf() correctly.

In general, we should prefer to avoid things OpenSSL does poorly when a good
alternative exists in libc.

4 years agolibtelnet: Replace bogus use of srandomdev + random to generate "public key pair"
cem [Fri, 13 Dec 2019 05:42:57 +0000 (05:42 +0000)]
libtelnet: Replace bogus use of srandomdev + random to generate "public key pair"

I'm pretty skeptical that any crypto in telnet is worth using, but if we're
ostensibly generating keys, arc4random is strictly better than the previous
construct.

4 years agobsnmpd(1): Replace dubious srandomdev+random(3) with arc4random(3)
cem [Fri, 13 Dec 2019 05:13:25 +0000 (05:13 +0000)]
bsnmpd(1): Replace dubious srandomdev+random(3) with arc4random(3)

4 years agolibtacplus: Remove bogus srandomdev+random
cem [Fri, 13 Dec 2019 05:11:34 +0000 (05:11 +0000)]
libtacplus: Remove bogus srandomdev+random

Replace with arc4random.

TACAS+ is a 1993 Cisco extension to the 1984 TACAS.  Is this something we want
in base still?  The directory has been substantively unmaintained since 2002,
at least.

4 years agolibradius: Rip out dubious use of srandomdev(3)+random(3)
cem [Fri, 13 Dec 2019 04:55:17 +0000 (04:55 +0000)]
libradius: Rip out dubious use of srandomdev(3)+random(3)

These functions appear to intend to produce unpredictable results.  Just use
arc4random.

While here, use an explicit_bzero instead of memset where the intent is clearly
to zero out a secret (clear_passphrase).

4 years agokern/subr_unit: Rip srandomdev, random(3) out of dead code
cem [Fri, 13 Dec 2019 04:48:20 +0000 (04:48 +0000)]
kern/subr_unit: Rip srandomdev, random(3) out of dead code

The simulation cannot be reproduced, so the value of using a deterministic PRNG
like random(3) is dubious.  The number of repitions used in the sample isn't a
problem for the Chacha implementation of arc4random we have today.  (Also, no
one actually runs this code; it was provided as an example of the work the
author did validating the implementation.  It's not even test code.)

4 years agorandom(6): produce random results
cem [Fri, 13 Dec 2019 04:37:39 +0000 (04:37 +0000)]
random(6): produce random results

This program is trash and there's no reason to keep it in base.  But as long as
we're shipping a silly program named 'random', let's actually make it random.

4 years agofsirand(8): Just use arc4random(3)
cem [Fri, 13 Dec 2019 04:12:13 +0000 (04:12 +0000)]
fsirand(8): Just use arc4random(3)

Remove single use of dubious srandomdev(3) + random(3) and replace with
arc4random(3), as is used already in this program.

Follow-up question: Do we really need this program anymore?  In base?

4 years agokeyserv(8): unifdef out __FreeBSD__ and KEYSERV_RANDOM
cem [Fri, 13 Dec 2019 04:03:05 +0000 (04:03 +0000)]
keyserv(8): unifdef out __FreeBSD__ and KEYSERV_RANDOM

This doesn't appear to have some active upstream (and it's a steaming pile of
bad 90s crypto design).  Rip out the completely horrible bits and leave the
only mildly less horrible bits.  The whole thing should probably be deleted; to
the extent it purports to provide a security feature: it doesn't.

4 years agoIf device_delete_children() returns an error, bail on the rest of the
ian [Fri, 13 Dec 2019 02:20:26 +0000 (02:20 +0000)]
If device_delete_children() returns an error, bail on the rest of the
detach work and return the error.  Especially don't call iicbus_reset()
since the most likely cause of failing to detach children is that one
of them has IO in progress.

4 years agoDocument that the debug server supports writing to guest memory.
jhb [Fri, 13 Dec 2019 02:18:44 +0000 (02:18 +0000)]
Document that the debug server supports writing to guest memory.

This was added in r348212.

4 years agoFix a mismerge in r355683 and remove the local gdb_port from main.
jhb [Fri, 13 Dec 2019 02:15:34 +0000 (02:15 +0000)]
Fix a mismerge in r355683 and remove the local gdb_port from main.

4 years agoClean up some of my copyrights; add SPDX tag and remove All rights reserved.
ian [Fri, 13 Dec 2019 01:38:48 +0000 (01:38 +0000)]
Clean up some of my copyrights; add SPDX tag and remove All rights reserved.

4 years agoAdd some more initializations to quiet riscv build.
rmacklem [Fri, 13 Dec 2019 01:34:25 +0000 (01:34 +0000)]
Add some more initializations to quiet riscv build.

The one case in nfs_copy_file_range() was a legitimate case, although
it would probably never occur in practice.

4 years agoDon't call into the debug server if it isn't configured.
jhb [Fri, 13 Dec 2019 01:17:20 +0000 (01:17 +0000)]
Don't call into the debug server if it isn't configured.

Reviewed by: markj (as part of a larger diff)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D20309

4 years agoFix the build for MAC not defined and a couple of might not be initialized.
rmacklem [Fri, 13 Dec 2019 00:45:14 +0000 (00:45 +0000)]
Fix the build for MAC not defined and a couple of might not be initialized.

r355677 broke the build for the not MAC defined case and a couple of
might not be initialized warnings were generated for riscv. Others seem
to be erroneous.

Hopefully there won't be too many more build errors.

Pointy hat goes on me.

4 years agor355677 requires that vop_stdioctl() be global so it can be called from NFS.
rmacklem [Fri, 13 Dec 2019 00:14:12 +0000 (00:14 +0000)]
r355677 requires that vop_stdioctl() be global so it can be called from NFS.

r355677 modified the NFS client so that it does lseek(SEEK_DATA/SEEK_HOLE)
for NFSv4.2, but calls vop_stdioctl() otherwise. As such, vop_stdioctl()
needs to be a global function.

Missed during the code merge for r355677.

4 years agoAvoid relying on silent type casting in the native atomic_load_32.
markj [Thu, 12 Dec 2019 23:55:34 +0000 (23:55 +0000)]
Avoid relying on silent type casting in the native atomic_load_32.

Reported by: np

4 years agoBump __FreeBSD_version since r355677 changes the internal interface
rmacklem [Thu, 12 Dec 2019 23:37:04 +0000 (23:37 +0000)]
Bump __FreeBSD_version since r355677 changes the internal interface
between the NFS modules such that they all need to be upgraded to
post r355677 simultaneously.

4 years agoAdd an entry to UPDATING for r355677.
rmacklem [Thu, 12 Dec 2019 23:33:32 +0000 (23:33 +0000)]
Add an entry to UPDATING for r355677.

4 years agoAdd support for NFSv4.2 to the NFS client and server.
rmacklem [Thu, 12 Dec 2019 23:22:55 +0000 (23:22 +0000)]
Add support for NFSv4.2 to the NFS client and server.

This patch adds support for NFSv4.2 (RFC-7862) and Extended Attributes
(RFC-8276) to the NFS client and server.
NFSv4.2 is comprised of several optional features that can be supported
in addition to NFSv4.1. This patch adds the following optional features:
   - posix_fadvise(POSIX_FADV_WILLNEED/POSIX_FADV_DONTNEED)
   - posix_fallocate()
   - intra server file range copying via the copy_file_range(2) syscall
     --> Avoiding data tranfer over the wire to/from the NFS client.
   - lseek(SEEK_DATA/SEEK_HOLE)
   - Extended attribute syscalls for "user" namespace attributes as defined
     by RFC-8276.

Although this patch is fairly large, it should not affect support for
the other versions of NFS. However it does add two new sysctls that allow
a sysadmin to limit which minor versions of NFSv4 a server supports, allowing
a sysadmin to disable NFSv4.2.

Unfortunately, when the NFS stats structure was last revised, it was assumed
that there would be no additional operations added beyond what was
specified in RFC-7862. However RFC-8276 did add additional operations,
forcing the NFS stats structure to revised again. It now has extra unused
entries in all arrays, so that future extensions to NFSv4.2 can be
accomodated without revising this structure again.

A future commit will update nfsstat(1) to report counts for the new NFSv4.2
specific operations/procedures.

This patch affects the internal interface between the nfscommon, nfscl and
nfsd modules and, as such, they all must be upgraded simultaneously.
I will do a version bump (although arguably not needed), due to this.

This code has survived a "make universe" but has not been built with a
recent GCC. If you encounter build problems, please email me.

Relnotes: yes

4 years agortld: make checks for mmap(2) failures compliant with documentation.
kib [Thu, 12 Dec 2019 22:59:22 +0000 (22:59 +0000)]
rtld: make checks for mmap(2) failures compliant with documentation.

On error, mmap(2) returns MAP_FAILED.  There is no need to use its
definition or to cast.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agocxgbe(4): Never use hardware checksumming in netmap tx.
np [Thu, 12 Dec 2019 21:33:00 +0000 (21:33 +0000)]
cxgbe(4): Never use hardware checksumming in netmap tx.

MFC after: 1 week
Sponsored by: Chelsio Communications

4 years agoImplement atomic state updates using the new vm_page_astate_t structure.
markj [Thu, 12 Dec 2019 21:13:20 +0000 (21:13 +0000)]
Implement atomic state updates using the new vm_page_astate_t structure.

Introduce primitives vm_page_astate_load() and vm_page_astate_fcmpset()
to operate on the 32-bit per-page atomic state.  Modify
vm_page_pqstate_fcmpset() to use them.  No functional change intended.

Introduce PGA_QUEUE_OP_MASK, a subset of PGA_QUEUE_STATE_MASK that only
includes queue operation flags.  This will be used in subsequent
patches.

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

4 years agolibpmc: add MIT SPDX tag to header file
emaste [Thu, 12 Dec 2019 20:55:43 +0000 (20:55 +0000)]
libpmc: add MIT SPDX tag to header file

The jevents tool includes a copy of the jsmn json parser which is MIT
licensed.  Upstream the MIT license appears in the jsmn.c source and a
standalone LICENSE file, but the latter is not included in the copy
contained in libpmc and the jsmn.h header carried no license information.
Add an SPDX tag to clarify the situation.

4 years agoRather than pass the address of the packet information control block to
cy [Thu, 12 Dec 2019 20:44:49 +0000 (20:44 +0000)]
Rather than pass the address of the packet information control block to
ipf_pcksum6(), directly pass the adddress of the mbuf to it. This reduces
one pointer dereference. ipf_pcksum6() doesn't use the packet information
control block except to obtain the mbuf address.

MFC after: 3 days

4 years agoin6_cksum() returns zero when checksums are good.
cy [Thu, 12 Dec 2019 20:44:46 +0000 (20:44 +0000)]
in6_cksum() returns zero when checksums are good.

PR: 203275
Reported by: Frank Volf <frank@deze.org>
MFC after: 3 days

4 years agolibpmc: convert s390 events data to proper json
emaste [Thu, 12 Dec 2019 19:37:10 +0000 (19:37 +0000)]
libpmc: convert s390 events data to proper json

4 years agolibpmc: convert powerpc event files to proper json
emaste [Thu, 12 Dec 2019 19:33:16 +0000 (19:33 +0000)]
libpmc: convert powerpc event files to proper json

4 years agolibpmc: sort some amdfam17h entries to make valid json
emaste [Thu, 12 Dec 2019 19:23:38 +0000 (19:23 +0000)]
libpmc: sort some amdfam17h entries to make valid json

4 years agoAdd kern_sync(9), and make kernel code call it instead of going
trasz [Thu, 12 Dec 2019 18:45:31 +0000 (18:45 +0000)]
Add kern_sync(9), and make kernel code call it instead of going
via sys_sync(2).  Minor cleanup, no functional changes.

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

4 years agoAdd comments and macros to the tcr_el1 setting code to help understand it.
andrew [Thu, 12 Dec 2019 18:27:54 +0000 (18:27 +0000)]
Add comments and macros to the tcr_el1 setting code to help understand it.

This code is non-obvious when reading for the first time. To help with
understanding of it add comments explaining what it's doing.

While here use macros from armreg.h rather than magic numbers.

Sponsored by: DARPA, AFRL

4 years agortld: do not try to mmap a zero-sized PT_LOAD
bdragon [Thu, 12 Dec 2019 17:40:32 +0000 (17:40 +0000)]
rtld: do not try to mmap a zero-sized PT_LOAD

When a PT_LOAD segment has a zero p_filesz, skip the data mmap, as mmapping
zero bytes from a file is an error.

A PT_LOAD with zero p_filesz is legal (but somewhat uncommon due to segment
merging in modern linkers, as it is more efficient to merge .data and .bss
by just extending p_memsz in the previous segment, assuming compatible
page protection.)

This was seen on ports/graphics/glew on a powerpc64 ELFv2 experimental
build.

Submitted by: Alfredo Dal'Ava Junior <alfredo.junior@eldorado.org.br>
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D22634

4 years ago[PowerPC] Fix SPE floating point environment manipulation
bdragon [Thu, 12 Dec 2019 17:12:18 +0000 (17:12 +0000)]
[PowerPC] Fix SPE floating point environment manipulation

Fix multiple problems in the powerpcspe floating point code.

* Endianness handling of the SPEFSCR in fenv.h was completely broken.
* Ensure SPEFSCR synchronization requirements are being met.

The __r.__d -> __r transformations were written by jhibbits.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D22526

4 years ago[PowerPC] Fix powerpc 32 bit build in mmu_oea64.c
bdragon [Thu, 12 Dec 2019 16:49:55 +0000 (16:49 +0000)]
[PowerPC] Fix powerpc 32 bit build in mmu_oea64.c

Due to ppc32 building mmu_oea64.c (for use when in bridge mode on a G5), we
need to guard the new moea64_page_array_startup code behind __powerpc64__
to avoid a compile error, since vm_offset_t is not 64-bit on ppc32.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D22782

4 years agolibpmc: remove undesired prefix from two s390 counters
emaste [Thu, 12 Dec 2019 14:52:37 +0000 (14:52 +0000)]
libpmc: remove undesired prefix from two s390 counters

Two counters included a prefix 'Counter:###\tName:XXX' in their
descriptions that appears to be a leftover from some conversion
process.  Remove them.

Found because a json validator tripped over the tab in the description.

4 years agoFollow RFC 4443 p2.2 and always use own addresses for reflected ICMPv6
ae [Thu, 12 Dec 2019 13:28:46 +0000 (13:28 +0000)]
Follow RFC 4443 p2.2 and always use own addresses for reflected ICMPv6
datagrams.

Previously destination address from original datagram was used. That
looked confusing, especially in the traceroute6 output.
Also honor IPSTEALTH kernel option and do TTL/HLIM decrementing only
when stealth mode is disabled.

Reported by: Marco van Tol <marco at tols org>
Reviewed by: melifaro
MFC after: 2 weeks
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D22631

4 years agoarm64: rockchip: rk_pinctrl: Fix parse_bias for RK3399
manu [Thu, 12 Dec 2019 13:21:43 +0000 (13:21 +0000)]
arm64: rockchip: rk_pinctrl: Fix parse_bias for RK3399

Only bank 0 and bank 2 are different than other rockchip SoC, fix this.
While here remove some debug printfs that where added in r355648

MFC after: 3 days
X-MFC-With: r355648

4 years agoarm64: rockchip: rk_pinctrl: Add bias parsing based on the SoC type
manu [Thu, 12 Dec 2019 13:02:22 +0000 (13:02 +0000)]
arm64: rockchip: rk_pinctrl: Add bias parsing based on the SoC type

Not all rockchip have the same value for pullup/pulldown so add a function
per SoC and call the right one to have the proper value.

MFC after: 3 days

4 years ago[showmount] implement long options
eadler [Thu, 12 Dec 2019 05:11:53 +0000 (05:11 +0000)]
[showmount] implement long options

add long options support to showmount. Where mappings exist use the GNU
names for said options.

Differential Revision: https://reviews.freebsd.org/D22543
Reviewed by: kevans (earlier version)

4 years agoRevert r354348
cem [Thu, 12 Dec 2019 04:47:02 +0000 (04:47 +0000)]
Revert r354348

Switch ARM32 default libunwind back to old GPL2 libgcc version.  Reportedly,
the llvm-libunwind code is nonfunctional.

Requested by: mmel

4 years agoarm: libgcc_s: Fix ABI breakage introduced in r354347
cem [Thu, 12 Dec 2019 04:44:09 +0000 (04:44 +0000)]
arm: libgcc_s: Fix ABI breakage introduced in r354347

Provide the symbol version for llvm-libunwind's _Unwind_Backtrace that libgcc
has historically provided on arm, in addition to the (default) standard version
used on all other arch.

Reported by: mmel

4 years agoRename tdq_ipipending and clear it in sched_switch().
markj [Thu, 12 Dec 2019 02:43:24 +0000 (02:43 +0000)]
Rename tdq_ipipending and clear it in sched_switch().

This fixes a regression after r355311.  Specifically, sched_preempt()
may trigger a context switch by calling thread_lock(), since
thread_lock() calls critical_exit() in its slow path and the interrupted
thread may have already been marked for preemption.  This would happen
before tdq_ipipending is cleared, blocking further preemption IPIs.  The
CPU can be left in this state indefinitely if the interrupted thread
migrates.

Rename tdq_ipipending to tdq_owepreempt.  Any switch satisfies a remote
preemption request, so clear tdq_owepreempt in sched_switch() instead of
sched_preempt() to avoid subtle problems of the sort described above.

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

4 years agoBump __FreeBSD_version for r355641, new sig set ops
kevans [Thu, 12 Dec 2019 02:42:27 +0000 (02:42 +0000)]
Bump __FreeBSD_version for r355641, new sig set ops

This will be needed to unbreak qemu-user-static.

4 years agoObsoleteFiles.inc: remove stale comment
emaste [Thu, 12 Dec 2019 02:18:18 +0000 (02:18 +0000)]
ObsoleteFiles.inc: remove stale comment

A comment at the top of the file claimed that the file was grouped into
OLD_FILES, OLD_LIBS, then OLD_DIRS, but that hasn't been the case since
the mid-2000s.  Delete the stale comment, add a new comment for the
historical split entries, and move the one more recent entry (from 2013)
to group it into a single logical change.

4 years agoAdd sigsetop extensions commonly found in musl libc and glibc
kevans [Thu, 12 Dec 2019 01:41:55 +0000 (01:41 +0000)]
Add sigsetop extensions commonly found in musl libc and glibc

These functions (sigandset, sigisemptyset, sigorset) are commonly available
in at least musl libc and glibc; sigorset, at least, has proven quite useful
in qemu-bsd-user work for tracking the current process signal mask in a more
self-documenting/aesthetically pleasing manner.

Reviewed by: bapt, jilles, pfg
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22187

4 years agostand: liblua: drop default buffer size to 128
kevans [Thu, 12 Dec 2019 01:35:56 +0000 (01:35 +0000)]
stand: liblua: drop default buffer size to 128

Lua allocates LUAL_BUFFERSIZE buffers on the stack for various string
functions (string.format, string.gsub) -- this works out to be somewhat
significant and not necessary, based on how we use string operations.
Dropping it risks having to allocate per call to format/gsub, but this is
not the case for our usage. This simply stops allocating 8K buffers on the
stack when luaL_Buffer is used.

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

4 years agousr.sbin/ntp: don't emit versions w/ make -s
kevans [Thu, 12 Dec 2019 01:33:45 +0000 (01:33 +0000)]
usr.sbin/ntp: don't emit versions w/ make -s

<sys.mk> defines ECHO=echo when not using make -s, and ECHO=true when using
make -s.

export ECHO for ntp products and use it in the mkver script to echo the
version. This suppresses the output as appropriate. ECHO is given a default
value to make sure things still work as expected for anyone that isn't
redefining ECHO.

Reviewed by: cy
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22101

4 years agoObsoleteFiles.inc: chase libpcap update in r334277
emaste [Thu, 12 Dec 2019 00:51:08 +0000 (00:51 +0000)]
ObsoleteFiles.inc: chase libpcap update in r334277

libpcap 1.9.0 (pre-release) update removed the export-defs.h header.

PR: 242559
Submitted by: John Hein
MFC after: 3 days

4 years agolibpmc: build json event support also on arm64
emaste [Thu, 12 Dec 2019 00:14:01 +0000 (00:14 +0000)]
libpmc: build json event support also on arm64

4 years agoEmulate reads of the PCI command register for passthrough devices.
jhb [Wed, 11 Dec 2019 23:41:39 +0000 (23:41 +0000)]
Emulate reads of the PCI command register for passthrough devices.

VFs return zero for the memory enable bit even if it has been set by a
prior write.  After r348779 this caused the annoying behavior that a
guest OS would unintentionally disable memory decoding on a future
read-modify-write operation on the command register.  Instead, return
the shadow value of the command register for reads.  This ensures that
the guest will only toggle the state of the memory enable bit when it
specifically intends to do so.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

4 years agovfs: locking primitives which elide ->v_vnlock and shared locking disablement
mjg [Wed, 11 Dec 2019 23:11:21 +0000 (23:11 +0000)]
vfs: locking primitives which elide ->v_vnlock and shared locking disablement

Both of these features are not needed by many consumers and result in avoidable
reads which in turn puts them on profiles due to cache-line ping ponging.

On top of that the current lockgmr entry point is slower than necessary
single-threaded. As an attempted clean up preparing for other changes,
provide new routines which don't support any of the aforementioned features.

With these patches in place vop_stdlock and vop_stdunlock disappear from
flamegraphs during -j 104 buildkernel.

Reviewed by: jeff (previous version)
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22665

4 years agofd: static-ize and devolatile openfiles
mjg [Wed, 11 Dec 2019 23:09:12 +0000 (23:09 +0000)]
fd: static-ize and devolatile openfiles

Almost all access is using atomics. The only read is sysctl which should use
a whole-int-at-a-time friendly read internally.

4 years agoMove reset to the interrutp processing stage
imp [Wed, 11 Dec 2019 22:51:02 +0000 (22:51 +0000)]
Move reset to the interrutp processing stage

This trims the boot time a bit more for AWS and other platforms that have nvme
drives. There's no reason too do this inline. This has been in my tree a while,
but IIRC I talked to Jim Harris about this at one of our face to face meetings.

MFC After: 2 weeks

4 years agolibpmc: convert arm64 data files to proper json
emaste [Wed, 11 Dec 2019 22:09:22 +0000 (22:09 +0000)]
libpmc: convert arm64 data files to proper json

jevents includes a very permissive json parser that accepts invalid
json, of which there are many examples in libpmc (typically extra or
missing commas).  Convert the arm64 files to proper json so other tools
can parse them.

Sponsored by: The FreeBSD Foundation

4 years agodwmmc: Use device_delete_children
manu [Wed, 11 Dec 2019 19:40:30 +0000 (19:40 +0000)]
dwmmc: Use device_delete_children

Instead of first detaching the children(s) and then delete them,
use the device_delete_children function that does all of that.

MFC after: 1 month
Suggested by: ian

4 years agomakesyscalls.lua: trim trailing spaces/commas from args
kevans [Wed, 11 Dec 2019 19:32:52 +0000 (19:32 +0000)]
makesyscalls.lua: trim trailing spaces/commas from args

These are insignificant as far as declarations go, and we've historically
allowed it. fhlinkat in ^/sys/kern/syscalls.master, for example, currently
has a trailing comma after its final argument that this version of
makesyscalls is ignoring (not by conscious decision).

Fix it for now by actively stripping off trailing whitespace/commas until
we decide to actively prohibit it.

4 years agodwmmc: Handle the card detect interrupt
manu [Wed, 11 Dec 2019 18:50:23 +0000 (18:50 +0000)]
dwmmc: Handle the card detect interrupt

The driver used to always add the mmc device as it's child even
it no card was detected. Add a function that will detect if the
card is present or not and that will attach/detach the mmc device.
The function is either call on attach (as we won't have the interrupt
fired) or from two taskqueues. The first taskqueue will directly call
the function when the sdcard was present and is now removed and the other
one will delay a bit the attach when we didn't had a card and now have one.
This is mostly based on comments from the sdhci driver where it describe
a situation when the CD pin is detected before the others pins are connected.

MFC after: 1 month

4 years agoarm64: rockchip: Add a module for rk_dwmmc
manu [Wed, 11 Dec 2019 18:43:39 +0000 (18:43 +0000)]
arm64: rockchip: Add a module for rk_dwmmc

This is mostly needed for dev/debug as most users will have their root
on the sdcard or emmc.

MFC after: 1 month

4 years agodwmmc: Add a detach method
manu [Wed, 11 Dec 2019 18:41:13 +0000 (18:41 +0000)]
dwmmc: Add a detach method

This method will disable the regulators, clocks and assert the reset of
the module. It will also detach it's children (the mmc device) and release
it's resources.
While here enable the regulators on attach as we need them to power up
the sdcard or emmc.

MFC after: 1 month

4 years agoarm64: rk3328: Add the *clk_peri_niu clocks
manu [Wed, 11 Dec 2019 18:39:05 +0000 (18:39 +0000)]
arm64: rk3328: Add the *clk_peri_niu clocks

Those clocks are always enable by default and are not really explained
in the TRM but the reason we had them is that they have the periph clock
as a parent and those parent should never be disable which can happen
if we disable all the childs. The current childs are the sd/emmc/sdio clocks
so the board will hang if we disable them.

MFC after: 1 month

4 years agoarm64: Add explicit devices for dwmmc variant
manu [Wed, 11 Dec 2019 18:36:07 +0000 (18:36 +0000)]
arm64: Add explicit devices for dwmmc variant

We used to include the hisi version if soc_hisi_hi6220 was present,
include the altera version if dwmmc_altera was present and include
the rockchip version if soc_rockchip_rk3328 was present.
Now every version have it's own device directive.
The rockchip version isn't named dwmmc_rockchip because all other
rockchip driver are named rk_XXX.

MFC after: 1 month

4 years agoarm linuxulator: regen sysent after r355621
emaste [Wed, 11 Dec 2019 18:24:43 +0000 (18:24 +0000)]
arm linuxulator: regen sysent after r355621

4 years agoarm linuxulator: put syscall type and argument on one line
emaste [Wed, 11 Dec 2019 18:21:35 +0000 (18:21 +0000)]
arm linuxulator: put syscall type and argument on one line

4 years agoarm linuxulator: add "make sysent" generated files
emaste [Wed, 11 Dec 2019 17:52:06 +0000 (17:52 +0000)]
arm linuxulator: add "make sysent" generated files

Sponsored by: The FreeBSD Foundation

4 years agoconnect arm linuxulator to top-level make sysent
emaste [Wed, 11 Dec 2019 17:48:34 +0000 (17:48 +0000)]
connect arm linuxulator to top-level make sysent

Reported by: kevans

4 years agoUpdate dirdeps.mk and gendirdeps.mk
sjg [Wed, 11 Dec 2019 17:38:15 +0000 (17:38 +0000)]
Update dirdeps.mk and gendirdeps.mk

The env space consumed by exporting all libc's .meta files
left little room for command line,
so unexport when done.

Update dirdeps.mk to latest and add
dirdeps-targets.mk to simplify/update targets/Makefile

Makefile changes to go with Makefile.depend changes in D22494

Reviewed by:  bdrewery
MFC after: 1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22495

4 years agoUpdate Makefile.depend files
sjg [Wed, 11 Dec 2019 17:37:53 +0000 (17:37 +0000)]
Update Makefile.depend files

Update a bunch of Makefile.depend files as
a result of adding Makefile.depend.options files

Reviewed by:  bdrewery
MFC after: 1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22494

4 years agoAdd Makefile.depend.options
sjg [Wed, 11 Dec 2019 17:37:37 +0000 (17:37 +0000)]
Add Makefile.depend.options

Leaf directories that have dependencies impacted
by options need a Makefile.depend.options file
to avoid churn in Makefile.depend

DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc
can be set in local.dirdeps-options.mk
which can add to those set in Makefile.depend.options

See share/mk/dirdeps-options.mk

Reviewed by:  bdrewery
MFC after: 1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22469

4 years agoarm linuxulator: add syscalls.conf and Makefile for "make sysent"
emaste [Wed, 11 Dec 2019 17:28:49 +0000 (17:28 +0000)]
arm linuxulator: add syscalls.conf and Makefile for "make sysent"

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

4 years agokbdmap: allow INDEX.keymaps to provide the dialog title
emaste [Wed, 11 Dec 2019 17:19:36 +0000 (17:19 +0000)]
kbdmap: allow INDEX.keymaps to provide the dialog title

Previously kbdmap had a localized menu heading ("Choose your keyboard
layout") but not the dialog title ("Keyboard Menu").

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agosecurity.7: add caveat about interim sysctl paths from r355436
emaste [Wed, 11 Dec 2019 16:43:54 +0000 (16:43 +0000)]
security.7: add caveat about interim sysctl paths from r355436

r355436 moved mitigation sysctls to machdep.mitigations but did not
rationalize the sense of the invidual knobs.  Clarify that the old
names remain the canonical way to set these mitigations.

Backwards compatibility will be maintained for the original names
(e.g. hw.ibrs_disable), but not from the interim names
(e.g. machdep.mitigations.ibrs.disable).

Sponsored by: The FreeBSD Foundation

4 years agoExtract code common to _vm_map_clip_start and _vm_map_clip_end into a
dougm [Wed, 11 Dec 2019 16:09:57 +0000 (16:09 +0000)]
Extract code common to _vm_map_clip_start and _vm_map_clip_end into a
function, vm_map_entry_clone, that can be invoked by each.

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

4 years agoadd a sanity check to the system call registration code
avg [Wed, 11 Dec 2019 15:52:29 +0000 (15:52 +0000)]
add a sanity check to the system call registration code

A system call number should be at least reserved.
We do not expect an attempt to register a fixed number system call
when nothing at all is known about it.

MFC after: 3 weeks
Sponsored by: Panzura

4 years agoMake NOCLEAN an error instead of a warning
emaste [Wed, 11 Dec 2019 14:54:29 +0000 (14:54 +0000)]
Make NOCLEAN an error instead of a warning

The warning was added in r289728 (over four years ago) and at that time
NO_CLEAN was already the correct spelling for over a decade.

Make NOCLEAN an error as the next step to removing these backward
compatibility shims.

4 years agouma: pretty print zone flags sysctl
rlibby [Wed, 11 Dec 2019 06:50:55 +0000 (06:50 +0000)]
uma: pretty print zone flags sysctl

Requested by: jeff
Reviewed by: jeff, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22748

4 years agoAdd a few missed source files to libllvm, for the MK_LLVM_TARGET_BPF=yes
dim [Tue, 10 Dec 2019 22:10:25 +0000 (22:10 +0000)]
Add a few missed source files to libllvm, for the MK_LLVM_TARGET_BPF=yes
case.  Otherwise, linking of clang and other llvm based executables
would complain about missing symbols.

Reported by: rstone
MFC after: 1 month
X-MFC-With: r353358

4 years agoUse callout_func_t instead of the deprecated timeout_t.
jhb [Tue, 10 Dec 2019 22:06:53 +0000 (22:06 +0000)]
Use callout_func_t instead of the deprecated timeout_t.

Reviewed by: kib, imp
Differential Revision: https://reviews.freebsd.org/D22752

4 years agoAdd a callout_func_t typedef for functions used with callout_*().
jhb [Tue, 10 Dec 2019 21:58:30 +0000 (21:58 +0000)]
Add a callout_func_t typedef for functions used with callout_*().

This typedef is the same as timeout_t except that it is in the callout
namespace and header.

Use this typedef in various places of the callout implementation that
were either using the raw type or timeout_t.

While here, add <sys/callout.h> to the manpage.

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

4 years agoCorrect the offset of static TLS variables for Initial-Exec on RISC-V.
jhb [Tue, 10 Dec 2019 21:56:44 +0000 (21:56 +0000)]
Correct the offset of static TLS variables for Initial-Exec on RISC-V.

TP points to the start of the TLS block after the tcb, but
Obj_Entry.tlsoffset includes the tcb, so subtract the size of the tcb
to compute the offset relative to TP.

This is identical to the same fixes for powerpc in r339072 and r342671.

Reviewed by: James Clarke
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D22661

4 years agoDo not attach children of owc_gpiobus until interrupts are working.
ian [Tue, 10 Dec 2019 21:48:21 +0000 (21:48 +0000)]
Do not attach children of owc_gpiobus until interrupts are working.

The children of the bus need to do IO on the bus to probe for hardware
presence.  Doing IO means timing the bus states using sbinuptime(), and
that requires working timecounters, which are not initialized until after
device attachment has completed.

PR: 242526

4 years agocxgbe(4): Man page updates to go with r355107.
np [Tue, 10 Dec 2019 20:51:28 +0000 (20:51 +0000)]
cxgbe(4): Man page updates to go with r355107.

MFC after: 1 week
Sponsored by: Chelsio Communications

4 years ago[ig4] Remove unused methods from bus interface
wulf [Tue, 10 Dec 2019 20:23:05 +0000 (20:23 +0000)]
[ig4] Remove unused methods from bus interface

bus_get/set_resource methods are implemented in child device (iicbus).
As their implementation with bus_generic_rl_get/set calls do not
recurse up the tree, the versions in ig4 are never called.

Suggested by: jhb

4 years agocxgbe(4): Simplify the firmware version checks a bit.
np [Tue, 10 Dec 2019 20:12:21 +0000 (20:12 +0000)]
cxgbe(4): Simplify the firmware version checks a bit.

No functional change.

MFC after: 1 week

4 years agoremove again nonexistent from-* entries from vt INDEX.keymaps
emaste [Tue, 10 Dec 2019 20:11:39 +0000 (20:11 +0000)]
remove again nonexistent from-* entries from vt INDEX.keymaps

A number of entries of the form "de.kbd.from-cp850" existed in vt's
INDEX.keymaps, added in r270114, but these files do not exist.

I removed them in r355585 but accidentally re-added them in r355592.
Remove them yet again.

PR: 235564, 235853
MFC after: 1 week

4 years agofsck_ffs: fix some memory leaks found by Coverity.
vangyzen [Tue, 10 Dec 2019 20:04:08 +0000 (20:04 +0000)]
fsck_ffs: fix some memory leaks found by Coverity.

Reported by: Coverity
CID: 1380549 1380550 1380551
MFC after: 1 week
Sponsored by: Dell EMC Isilon

4 years agoAdd Danish translation for vt font and keymap INDEX files
emaste [Tue, 10 Dec 2019 20:02:57 +0000 (20:02 +0000)]
Add Danish translation for vt font and keymap INDEX files

Also sort some entries into the correct location, correct MacBook
capitalization, etc.

PR: 235853
MFC after: 1 week
Submitted by: scootergrisen gmail com

4 years agoReplace two remaining hex values for control codes with their names.
se [Tue, 10 Dec 2019 19:52:29 +0000 (19:52 +0000)]
Replace two remaining hex values for control codes with their names.

These were the only values in the range from 0 to 0x1f that were defined
as hex values, all other occurances have been converted before.

MFC after: 1 week

4 years agosed: process \r, \n, and \t
kevans [Tue, 10 Dec 2019 19:16:00 +0000 (19:16 +0000)]
sed: process \r, \n, and \t

This is both reasonable and a common GNUism that a lot of ported software
expects.

Universally process \r, \n, and \t into carriage return, newline, and tab
respectively. Newline still doesn't function in contexts where it can't
(e.g. BRE), but we process it anyways rather than passing
UB \n (escaped ordinary) through to the underlying regex engine.

Adding a --posix flag to disable these was considered, but sed.1 already
declares this version of sed a super-set of POSIX specification and this
behavior is the most likely expected when one attempts to use one of these
escape sequences in pattern space.

This differs from pre-r197362 behavior in that we now honor the three
arguably most common escape sequences used with sed(1) and we do so outside
of character classes, too.

Other escape sequences, like \s and \S, will come later when GNU extensions
are added to libregex; sed will likely link against libregex by default,
since the GNU extensions tend to be fairly un-intrusive.

PR: 229925
Reviewed by: bapt, emaste, pfg
Differential Revision: https://reviews.freebsd.org/D22750

4 years agoFix the TAA state machine to do the right thing when the TAA
scottl [Tue, 10 Dec 2019 18:57:39 +0000 (18:57 +0000)]
Fix the TAA state machine to do the right thing when the TAA
migitation is available in microcode and the operator has set
the sysctl to automatic mode.

Reported by: Coverity
CID: 1408334

MFC after: 3 days
Sponsored by: Intel

4 years agoFix WITHOUT_CLANG build.
bdrewery [Tue, 10 Dec 2019 18:50:50 +0000 (18:50 +0000)]
Fix WITHOUT_CLANG build.

This decouples MK_LLVM_TARGET_ALL from MK_CLANG. It is fine if
LLVM_TARGET_* are set even if MK_CLANG is disabled. It never
made sense to depend MK_LLVM_TARGET_* to MK_CLANG (which I did
in r335706).

PR:         240507
Reported by: kevans, swills
MFC after: 2 weeks

4 years agoAdd a helper function to the swapout daemon's deactivation code.
markj [Tue, 10 Dec 2019 18:15:20 +0000 (18:15 +0000)]
Add a helper function to the swapout daemon's deactivation code.

vm_swapout_object_deactivate_pages() is renamed to
vm_swapout_object_deactivate(), and the loop body is moved into the new
vm_swapout_object_deactivate_page().  This makes the code a bit easier
to follow and is in preparation for some functional changes.

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

4 years agoIntroduce vm_page_astate.
markj [Tue, 10 Dec 2019 18:14:50 +0000 (18:14 +0000)]
Introduce vm_page_astate.

This is a 32-bit structure embedded in each vm_page, consisting mostly
of page queue state.  The use of a structure makes it easy to store a
snapshot of a page's queue state in a stack variable and use cmpset
loops to update that state without requiring the page lock.

This change merely adds the structure and updates references to atomic
state fields.  No functional change intended.

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