]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agofstyp(8): Use iconv(3) to convert NTFS vol labels correctly
cem [Mon, 23 Dec 2019 02:41:13 +0000 (02:41 +0000)]
fstyp(8): Use iconv(3) to convert NTFS vol labels correctly

Rather than hackily extracting only the ASCII subset of UTF-16LE, go ahead
and convert the label to the user's locale correctly.

4 years agoIn gptboot, don't assume a partition number is a single digit, 1-9. GPT
ian [Sun, 22 Dec 2019 22:33:22 +0000 (22:33 +0000)]
In gptboot, don't assume a partition number is a single digit, 1-9.  GPT
partitions can have 128 partitions, so parse contiguous digits and then
validate that the number is between 1-128 inclusive.

I'm not sure 128 is a hard limit in the GPT standard, but it's the common
number in use, and it's a better upper limit than 9.

4 years agoCompile uart_cpu_acpi.c, added in r348195, into uart.ko.
markj [Sun, 22 Dec 2019 22:10:20 +0000 (22:10 +0000)]
Compile uart_cpu_acpi.c, added in r348195, into uart.ko.

PR: 242771
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agolagg: Clean up handling of the rr_limit option.
markj [Sun, 22 Dec 2019 21:56:47 +0000 (21:56 +0000)]
lagg: Clean up handling of the rr_limit option.

- Don't allow an unprivileged user to set the stride. [1]
- Only set the stride under the softc lock.
- Rename the internal fields to accurately reflect their use.  Keep
  ro_bkt to avoid changing the user API.
- Simplify the implementation.  The port index is just sc_seq / stride.
- Document rr_limit in ifconfig.8.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> [1]
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22857

4 years agoFix typo using RB_INITIALIZER.
dougm [Sun, 22 Dec 2019 21:53:05 +0000 (21:53 +0000)]
Fix typo using RB_INITIALIZER.

The macro RB_INITIALIZER ignores its argument, but is documented to
require "&head" as argument to initialize "head".  So using
"_vm_phys_fictitious_tree" as the argument to initialize
"vm_phys_fictitious_tree" is an inconsequential error, corrected here.

Discussed with: alc

4 years agoFix a bug introduced in r356002. Prior versions of this patchset had
jeff [Sun, 22 Dec 2019 20:35:50 +0000 (20:35 +0000)]
Fix a bug introduced in r356002.  Prior versions of this patchset had
vm_page_remove() rather than !vm_page_wired() as the condition for free.
When this changed back to wired the busy lock was leaked.

Reported by: pho
Reviewed by: markj

4 years agoMerge commit f97936fab from llvm git (by Eric Fiselier):
dim [Sun, 22 Dec 2019 11:58:44 +0000 (11:58 +0000)]
Merge commit f97936fab from llvm git (by Eric Fiselier):

  [libc++] Cleanup and enable multiple warnings.

  Too many warnings are being disabled too quickly. Warnings are
  important to keeping libc++ correct. This patch re-enables two
  warnings: -Wconstant-evaluated and -Wdeprecated-copy.

  In future, all warnings disabled for the test suite should require an
  attached bug. The bug should state the plan for re-enabling that
  warning, or a strong case why it should remain disabled.

This should fix a number of new g++ 9 warnings.

Requested by: rlibby
MFC after: 3 days

4 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [Sun, 22 Dec 2019 11:50:44 +0000 (11:50 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
9.0.1 final release c1a0a213378a458fbea1a5c77b315c7dce08fd05.

Release notes for llvm, clang, lld and libc++ 9.0.1 will become
available here:

https://releases.llvm.org/9.0.1/docs/ReleaseNotes.html
https://releases.llvm.org/9.0.1/tools/clang/docs/ReleaseNotes.html
https://releases.llvm.org/9.0.1/tools/lld/docs/ReleaseNotes.html
https://releases.llvm.org/9.0.1/projects/libcxx/docs/ReleaseNotes.html

PR: 240629
MFC after: 1 month

4 years agoMake page busy state deterministic on free. Pages must be xbusy when
jeff [Sun, 22 Dec 2019 06:56:44 +0000 (06:56 +0000)]
Make page busy state deterministic on free.  Pages must be xbusy when
removed from objects including calls to free.  Pages must not be xbusy
when freed and not on an object.  Strengthen assertions to match these
expectations.  In practice very little code had to change busy handling
to meet these rules but we can now make stronger guarantees to busy
holders and avoid conditionally dropping busy in free.

Refine vm_page_remove() and vm_page_replace() semantics now that we have
stronger guarantees about busy state.  This removes redundant and
potentially problematic code that has proliferated.

Discussed with: markj
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D22822

4 years agoAdd vmgenc(4) driver for ACPI VM generation counter
cem [Sun, 22 Dec 2019 06:25:20 +0000 (06:25 +0000)]
Add vmgenc(4) driver for ACPI VM generation counter

The VM generation counter is a 128-bit value exposed by the BIOS via ACPI.
The value changes to another unique identifier whenever a VM is duplicated.
Additionally, ACPI provides notification events when such events occur.

The driver decodes the pointer to the UUID, exports the value to userspace
via OPAQUE sysctl blob, and forwards the ACPI notifications in the form of
an EVENTHANDLER invocation as well as userspace devctl events.

See design paper: https://go.microsoft.com/fwlink/p/?LinkID=260709

4 years agoRemove unused includes.
delphij [Sun, 22 Dec 2019 05:44:29 +0000 (05:44 +0000)]
Remove unused includes.

MFC after: 2 weeks

4 years agoMove vm_fault busy logic into its own function for clarity and re-use by
jeff [Sun, 22 Dec 2019 04:21:16 +0000 (04:21 +0000)]
Move vm_fault busy logic into its own function for clarity and re-use by
later changes.

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

4 years agofstyp(8): Show exFAT volume labels with -l flag
cem [Sun, 22 Dec 2019 03:19:17 +0000 (03:19 +0000)]
fstyp(8): Show exFAT volume labels with -l flag

exfat is fundamentally the same design as fat32.  The superblock differs
marginally, and there are some additional optional features irrelevant to
fstype(8); the structure of dirents has changed slightly to enable, among
other things, larger files; the directory entries are no longer DOS 8.3
ASCII or local 8-bit encoding, but instead explicitly UCS-2-LE.

(As a result, this change uses iconv to convert a found exfat volume label
to the user's locale.)

Locating the volume label is identical to FAT32: locate the root directory
and walk through dirents until you find a volume label.  Like FAT32, follow
the FAT chain between root directory clusters as necessary.

PR: 242225
Reported by: Victor Sudakov <vas AT sibptus.ru>

4 years agoFix typo in hastd.8 manual page.
mckusick [Sun, 22 Dec 2019 01:22:51 +0000 (01:22 +0000)]
Fix typo in hastd.8 manual page.

Reported by: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
MFC after:   3 days

4 years agoUpdate the nfsstat man page to reflect r355992.
rmacklem [Sun, 22 Dec 2019 00:36:22 +0000 (00:36 +0000)]
Update the nfsstat man page to reflect r355992.

r355992 added listing of NFSv4.2 procedure and operation counts.
This patch updates the nfsstat.1 man page to reflect that change.

This is a content change.

4 years agoUpdate nfsstat to list the NFSv4.2 procedures and operations.
rmacklem [Sun, 22 Dec 2019 00:12:22 +0000 (00:12 +0000)]
Update nfsstat to list the NFSv4.2 procedures and operations.

r355677 added NFSv4.2 support to the NFS client and server. It also updated
the nfsstats structure to keep counts for the new procedures (client) and
operations (server) added for NFSv4.2.
This patch updates the "-E" option of nfsstat so that it lists counts for
these new procedures and operations.

4 years agoMicro-optimize the control flow in _pmap_unwire_ptp(), and eliminate
alc [Sat, 21 Dec 2019 22:32:24 +0000 (22:32 +0000)]
Micro-optimize the control flow in _pmap_unwire_ptp(), and eliminate
unnecessary parentheses.

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

4 years agoMFV r355890:
cy [Sat, 21 Dec 2019 21:05:53 +0000 (21:05 +0000)]
MFV r355890:

Fix libpcap issue #893: check for invalid IPv4 addresses.

This fixes errors such as:

tcpdump -i lagg0 net 999.999.999.999

This was originally discovered on a Red Hat 7.7 server and verified
to also be a bug on FreeBSD.

Obtained from: https://github.com/the-tcpdump-group/libpcap/commit/ \
07070918d5e81a515315b395f334e52589fe0fb
Fixed by: https://github.com/guyharris
MFC after: 2 weeks

4 years agoMFV r353143 (phillip):
cy [Sat, 21 Dec 2019 21:02:50 +0000 (21:02 +0000)]
MFV r353143 (phillip):

Update tcpdump from 4.9.2 to 4.9.3.

MFC after: 2 weeks

4 years agoMFV r353141 (by phillip):
cy [Sat, 21 Dec 2019 21:01:03 +0000 (21:01 +0000)]
MFV r353141 (by phillip):

Update libpcap from 1.9.0 to 1.9.1.

MFC after: 2 weeks

4 years agoFix VPO_UNMANAGED handling in vm_page_reclaim_run() after r353540.
markj [Sat, 21 Dec 2019 19:04:05 +0000 (19:04 +0000)]
Fix VPO_UNMANAGED handling in vm_page_reclaim_run() after r353540.

When allocating a replacement page we must clear VPO_UNMANAGED since we
only ever reclaim pages from managed objects.  vm_page_replace() does
not handle this for us.

Sprinkle some assertions to help catch this sort of issue.

Reported by: pho
Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22868

4 years agoDon't shift 32-bit value by more than 32 bits.
arrowd [Sat, 21 Dec 2019 11:38:48 +0000 (11:38 +0000)]
Don't shift 32-bit value by more than 32 bits.

PR: 207854
Approved by: emaste

4 years agotop: display battery capacity remaining
philip [Sat, 21 Dec 2019 05:03:21 +0000 (05:03 +0000)]
top: display battery capacity remaining

Submitted by: Antranig Vartanian <antranigv@freebsd.am>
Reviewed by:  imp, philip
Differential Revision:        https://reviews.freebsd.org/D22871

4 years agopowerpc: Only build mpc85xx i2c driver for mpc85xx
jhibbits [Sat, 21 Dec 2019 04:44:17 +0000 (04:44 +0000)]
powerpc: Only build mpc85xx i2c driver for mpc85xx

No need to build it for every other platform.

4 years agogoogletest: pick from upstream: Don't allow signed/unsigned wchar_t in gcc 9 and...
rlibby [Sat, 21 Dec 2019 02:44:50 +0000 (02:44 +0000)]
googletest: pick from upstream: Don't allow signed/unsigned wchar_t in gcc 9 and later

Pick 711fccf8317b4fb7adc21c00fc1e20823c5d875f from upstream googletest:

    Don't allow signed/unsigned wchar_t in gcc 9 and later

Upstream pull request: https://github.com/google/googletest/pull/2270

Sponsored by: Dell EMC Isilon

4 years agojemalloc: pick from upstream: Fix GCC-9.1 warning with macro GET_ARG_NUMERIC
rlibby [Sat, 21 Dec 2019 02:44:38 +0000 (02:44 +0000)]
jemalloc: pick from upstream: Fix GCC-9.1 warning with macro GET_ARG_NUMERIC

Pick 2d6d099fed05b1509e81e54458516528bfbbf38d from upstream jemalloc:

    Fix GCC-9.1 warning with macro GET_ARG_NUMERIC

    GCC-9.1 reports following error when trying to compile file
    src/malloc_io.c and with CFLAGS='-Werror' :

    src/malloc_io.c: In function ‘malloc_vsnprintf’:
    src/malloc_io.c:369:2: error: case label value exceeds maximum value for type [-Werror]
      369 |  case '?' | 0x80:      \
          |  ^~~~
    src/malloc_io.c:581:5: note: in expansion of macro ‘GET_ARG_NUMERIC’
      581 |     GET_ARG_NUMERIC(val, 'p');
          |     ^~~~~~~~~~~~~~~
    ...
    <snip>
    cc1: all warnings being treated as errors
    make: *** [Makefile:388: src/malloc_io.sym.o] Error 1

    The warning is reported as by default the type 'char' is 'signed char'
    and or-ing 0x80 will turn the case label char negative which will be
    beyond the printable ascii range (0 - 127).

    The patch fixes this by explicitly casting the 'len' variable as
    unsigned char' inside the 'switch' statement so that value of
    expression " '?' | 0x80 " falls within the legal values of the
    variable 'len'.

Discussed with: jasone (maintainer)
Sponsored by: Dell EMC Isilon

4 years agolibdevdctl: g++9 avoid Wdeprecated-copy
rlibby [Sat, 21 Dec 2019 02:44:26 +0000 (02:44 +0000)]
libdevdctl: g++9 avoid Wdeprecated-copy

g++9 now warns about having defined an assignment operator but using the
default copy constructor, or vice versa.  Avoid the issue in libdevdctl
by just using the default assignment operator too.

Reviewed by: asomers, dim
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22887

4 years agodtrace: avoid gcc9 Walloca-larger-than
rlibby [Sat, 21 Dec 2019 02:44:13 +0000 (02:44 +0000)]
dtrace: avoid gcc9 Walloca-larger-than

gcc9 grew a new warning for unbounded allocas, such as the one in
dt_options_load.  Remove both uses of alloca in dt_options.c.

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

4 years agoDeclare packed struct ata_params as 2-byte-aligned
rlibby [Sat, 21 Dec 2019 02:44:00 +0000 (02:44 +0000)]
Declare packed struct ata_params as 2-byte-aligned

This avoids gcc9 warning about unaligned access to the structure when
casting to uint16_t pointer type.

Submitted by: imp
Reviewed by: imp
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22888

4 years agogcc9: quiet Waddress-of-packed-member for user build
rlibby [Sat, 21 Dec 2019 02:43:49 +0000 (02:43 +0000)]
gcc9: quiet Waddress-of-packed-member for user build

Disable the warning for WARNS <= 3.  This is lame, but it's what we
already do for the clang build.

Reviewed by: dim
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22889

4 years agogcc9: quiet Waddress-of-packed-member for kernel build
rlibby [Sat, 21 Dec 2019 02:43:37 +0000 (02:43 +0000)]
gcc9: quiet Waddress-of-packed-member for kernel build

This is lame, but it's what we already do for the clang build.  We take
misaligned pointers into network header structures in many places.

Reviewed by: ian
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22876

4 years agogcc: quiet Wattribute for no_sanitize("address")
rlibby [Sat, 21 Dec 2019 02:43:20 +0000 (02:43 +0000)]
gcc: quiet Wattribute for no_sanitize("address")

This is an unfortunate instance where the __has_attribute check does
not function usefully.  Gcc does have the attribute, but for gcc it only
applies to functions, not variables, and trying to apply it to a
variable generates Wattribute.  So far we only apply the attribute to
variables.  Only enable the attribute for clang, for now.

Reviewed by: Anton Rang <rang at acm.org>
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22875

4 years agoAvoid unused vars when VE_ECDSA_HASH_AGAIN undefined
sjg [Fri, 20 Dec 2019 21:56:28 +0000 (21:56 +0000)]
Avoid unused vars when VE_ECDSA_HASH_AGAIN undefined

Reviewed by: emaste
MFC after: 1 week

4 years agoVendor import of llvm-project tag llvmorg-9.0.1:
dim [Fri, 20 Dec 2019 21:55:13 +0000 (21:55 +0000)]
Vendor import of llvm-project tag llvmorg-9.0.1:
https://github.com/llvm/llvm-project/tree/llvmorg-9.0.1

4 years agoUpdate the man page to reflect the addition of NFSv4.2 (r355677).
rmacklem [Fri, 20 Dec 2019 21:45:20 +0000 (21:45 +0000)]
Update the man page to reflect the addition of NFSv4.2 (r355677).

Update all the references to NFSv4.1, so that they apply to NFSv4.1 and
NFSv4.2. Also, change the MDS->DS mounts to use NFSv4.2, so that both
versions of the protocol can be used against the server with pNFS enabled.

This is a content change.

4 years agoConsolidate FREEBSD-Xlist files of different llvm sub-projects into one.
dim [Fri, 20 Dec 2019 21:42:10 +0000 (21:42 +0000)]
Consolidate FREEBSD-Xlist files of different llvm sub-projects into one.

4 years agoUpdate the man page to reflect the addition of NFSv4.2 (r355677).
rmacklem [Fri, 20 Dec 2019 21:41:33 +0000 (21:41 +0000)]
Update the man page to reflect the addition of NFSv4.2 (r355677).

Include references to NFSv4.2 and Flexible File layout, plus clarify
when vfs.nfsd.flexlinuxhack needs to be set for Linux pNFS clients.
Also update the man page to reflect the addition of SpaceUsed to the
attributes stored in the extended attribute on the MDS (r354158).

This is a content change.

4 years agoMerge diff elimination updates from r355953 into vendor/llvm-project.
dim [Fri, 20 Dec 2019 21:33:12 +0000 (21:33 +0000)]
Merge diff elimination updates from r355953 into vendor/llvm-project.

4 years agoUpdate the man page to reflect the addition of NFSv4.2 (r355677).
rmacklem [Fri, 20 Dec 2019 21:31:08 +0000 (21:31 +0000)]
Update the man page to reflect the addition of NFSv4.2 (r355677).

Include references to NFSv4.2 and associated RFCs and note new features
present in NFSv4.2.

This is a content change.

4 years agoUpdate the man page to reflect the addition of NFSv4.2 (r355677).
rmacklem [Fri, 20 Dec 2019 21:25:51 +0000 (21:25 +0000)]
Update the man page to reflect the addition of NFSv4.2 (r355677).

Include references to NFSv4.2 and associated RFCs.
Also clarify when a Linux client needs to set vfs.nfsd.flexlinuxhack if
a pNFS server is in use.

This is a content change.

4 years agoEliminate differences between Git version of llvm-project release/9.x,
dim [Fri, 20 Dec 2019 21:25:22 +0000 (21:25 +0000)]
Eliminate differences between Git version of llvm-project release/9.x,
and our vendor import in ^/vendor/llvm-project/release-9.x.

4 years agoMerge empty dir updates from r355950 in vendor/llvm-project.
dim [Fri, 20 Dec 2019 21:18:34 +0000 (21:18 +0000)]
Merge empty dir updates from r355950 in vendor/llvm-project.

4 years agoRemove empty dirs under vendor/llvm-project, which are no longer stored
dim [Fri, 20 Dec 2019 21:12:01 +0000 (21:12 +0000)]
Remove empty dirs under vendor/llvm-project, which are no longer stored
in git.

4 years agorandom(4): Flip default Fortuna generator over to Chacha20
cem [Fri, 20 Dec 2019 21:11:00 +0000 (21:11 +0000)]
random(4): Flip default Fortuna generator over to Chacha20

The implementation was landed in r344913 and has had some bake time (at
least on my personal systems).  There is some discussion of the motivation
for defaulting to this cipher as a PRF in the commit log for r344913.

As documented in that commit, administrators can retain the prior (AES-ICM)
mode of operation by setting the 'kern.random.use_chacha20_cipher' tunable
to 0 in loader.conf(5).

Approved by: csprng(delphij, markm)
Differential Revision: https://reviews.freebsd.org/D22878

4 years agoCorrect a mistakenly inverted condition in r355833.
alc [Fri, 20 Dec 2019 20:46:26 +0000 (20:46 +0000)]
Correct a mistakenly inverted condition in r355833.

Noticed by: kib
X-MFC with: r355833

4 years agoCopy llvm vendor/*/dist-release_90 to vendor/llvm-project/release-9.x
dim [Fri, 20 Dec 2019 20:46:11 +0000 (20:46 +0000)]
Copy llvm vendor/*/dist-release_90 to vendor/llvm-project/release-9.x

This uses the new layout of the upstream repository, which was recently
migrated to GitHub, and converted into a "monorepo".  That is, most of
the earlier separate sub-projects with their own branches and tags were
consolidated into one top-level directory, and are now branched and
tagged together.

4 years agoadd LDNS build knob dependency on OPENSSL
emaste [Fri, 20 Dec 2019 20:23:59 +0000 (20:23 +0000)]
add LDNS build knob dependency on OPENSSL

Reported by: Michael Dexter's run of the Build Options Survey
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoDeduplicate code between if_delgroup() and if_delgroups().
markj [Fri, 20 Dec 2019 20:15:34 +0000 (20:15 +0000)]
Deduplicate code between if_delgroup() and if_delgroups().

Fix some style in if_addgroup().  No functional change intended.

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

4 years agomii(4): Fix ivars leak when the bus device or bus children detach.
markj [Fri, 20 Dec 2019 20:10:26 +0000 (20:10 +0000)]
mii(4): Fix ivars leak when the bus device or bus children detach.

PR: 242727
Submitted by: ghuckriede@blackberry.com
MFC after: 1 week

4 years agoMove all sources from the llvm project into contrib/llvm-project.
dim [Fri, 20 Dec 2019 19:53:05 +0000 (19:53 +0000)]
Move all sources from the llvm project into contrib/llvm-project.

This uses the new layout of the upstream repository, which was recently
migrated to GitHub, and converted into a "monorepo".  That is, most of
the earlier separate sub-projects with their own branches and tags were
consolidated into one top-level directory, and are now branched and
tagged together.

Updating the vendor area to match this layout is next.

4 years agoFix a memory leak in if_delgroups() introduced in r334118.
markj [Fri, 20 Dec 2019 17:21:57 +0000 (17:21 +0000)]
Fix a memory leak in if_delgroups() introduced in r334118.

PR: 242712
Submitted by: ghuckriede@blackberry.com
MFC after: 3 days

4 years agovt: store a pointer to the keyboard instead of index
kevans [Fri, 20 Dec 2019 17:15:09 +0000 (17:15 +0000)]
vt: store a pointer to the keyboard instead of index

This effectively reverts r355935, but is functionally equivalent. We gain no
benefit from storing the index and repeatedly fetching the keyboard with
`kbd_get_keyboard` when we need it. We'll be notified when it's going away
so we can clean up the pointer.

All existing references were trivially converted. Only once instance
actually needed the index.

4 years agoKill off dummy kbd drivers
kevans [Fri, 20 Dec 2019 16:22:14 +0000 (16:22 +0000)]
Kill off dummy kbd drivers

As far as I can tell, these are an artifact of times when linker sets
couldn't be empty, otherwise the kernel build would fail due to unresolved
symbols. hselasky fixed this in r268138, and I've audited the kbd portions
to make sure nothing would blow up due to the empty linker set and
successfully compiled+ran a kernel with no keyboard support at all.

Kill them off now since they're no longer required.

MFC after: 1 week

4 years agovt: fix post-boot keyboard attachment
kevans [Fri, 20 Dec 2019 16:20:38 +0000 (16:20 +0000)]
vt: fix post-boot keyboard attachment

With absolutely no keyboards attached and no kbdmux in kernel, we descend
down this error path. 0 is a valid keyboard index, so leaving
vd->vd_keyboard at 0 when there's no keyboard found is objectively wrong as
later attachment of a keyboard will fail -- it gets index 0, and vt thinks
it's already using that keyboard.

This is decidedly the corniest of corner cases, but it's easy enough to get
correct that we should do so.

Tested in a kernel without atkbdc, atkbd, psm, kbdmux, ukbd, hyperv then
loading ukbd post-boot and attaching a usb keyboard.

4 years agoVERSATILEPB: Unbreak after r355796
kevans [Fri, 20 Dec 2019 15:28:40 +0000 (15:28 +0000)]
VERSATILEPB: Unbreak after r355796

r355796 provided genkbd_get_fkeystr/genkbd_diag private and the default for
get_fkeystr/diag if these members are NULL. Follow suit here.

4 years agoImprove input validation for some parameters having a too small
tuexen [Fri, 20 Dec 2019 15:25:08 +0000 (15:25 +0000)]
Improve input validation for some parameters having a too small
reported length.

Thanks to Natalie Silvanovich from Google for finding one of these
issues in the SCTP userland stack and reporting it.

MFC after: 1 week

4 years agorandom(4): Fortuna: Enable concurrent generation by default for 13
cem [Fri, 20 Dec 2019 08:31:23 +0000 (08:31 +0000)]
random(4): Fortuna: Enable concurrent generation by default for 13

Flip the knob added in r349154 to "enabled."  The commit message from that
revision and associated code comment describe the rationale, implementation,
and motivation for the new default in detail.  I have dog-fooded this
configuration on my own systems for six months, for what that's worth.

For end-users: the result is just as secure.  The benefit is a faster, more
responsive system when processes produce significant demand on random(4).

As mentioned in the earlier commit, the prior behavior may be restored by
setting the kern.random.fortuna.concurrent_read="0" knob in loader.conf(5).

This scales the random generation side of random(4) somewhat, although there
is still a global mutex being shared by all cores and rand_harvestq; the
situation is generally much better than it was before on small CPU systems,
but do not expect miracles on 256-core systems running 256-thread full-rate
random(4) read.  Work is ongoing to address both the generation-side (in
more depth) and the harvest-side scaling problems.

Approved by: csprng(delphij, markm)
Tested by: markm
Differential Revision: https://reviews.freebsd.org/D22879

4 years agoiicoc: fix the build on PCI machines
philip [Fri, 20 Dec 2019 05:15:03 +0000 (05:15 +0000)]
iicoc: fix the build on PCI machines

Pointy hat to:   philip

4 years agoPrint upper 32 bits in devmap table entries
philip [Fri, 20 Dec 2019 03:40:53 +0000 (03:40 +0000)]
Print upper 32 bits in devmap table entries

If the devmap entry uses the upper 32 bits they wouldn't be printed in
devmap_dump_table(). This fixes that.

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

4 years agoiicoc: add FDT bus attachment
philip [Fri, 20 Dec 2019 03:40:50 +0000 (03:40 +0000)]
iicoc: add FDT bus attachment

This adds support for OpenCores I2C master controllers on FDT systems.

Reviewed by:    kp
Sponsored by:   Axiado

4 years agoiicoc: split up common core and PCI bus specifics
philip [Fri, 20 Dec 2019 03:40:46 +0000 (03:40 +0000)]
iicoc: split up common core and PCI bus specifics

The OpenCores I2C IP core can be found on any bus.  Split out the PCI
bus specifics into their own file, only compiled on systems with PCI.

Reviewed by:    kp
Sponsored by:   Axiado

4 years agoiicoc: minor whitespace and style(9) fixes
philip [Fri, 20 Dec 2019 03:40:07 +0000 (03:40 +0000)]
iicoc: minor whitespace and style(9) fixes

No functional changes.  This commit will make upcoming changes
which do affect functionality easier to read.

Reviewed by:    kp
Sponsored by:   Axiado

4 years agoriscv/sifive: add FU540 SPI controller driver
philip [Fri, 20 Dec 2019 03:40:04 +0000 (03:40 +0000)]
riscv/sifive: add FU540 SPI controller driver

Initial working prototype of the Serial Peripheral Interface controller
in the SiFive FU540 SoC.

Reviewed by:    kp
Sponsored by:   Axiado

4 years agoriscv/sifive: add SiFive FU540 PRCI driver
philip [Fri, 20 Dec 2019 03:38:21 +0000 (03:38 +0000)]
riscv/sifive: add SiFive FU540 PRCI driver

The SiFive FU540 Power Reset Clocking Interrupt block contains a PLL
that turns the input crystal (33.3MHz) into a 1-1.5GHz clock.
This clock in turn is divided by two to produce the tlclk, which is fed
into devices such as the SPI and I2C controllers.

Register a new clock device for the PRCI so that those devices can
read the correct clock through the clk framework.

Submitted by:   kp
Sponsored by:   Axiado

4 years ago[PowerPC] Only move linker sets to .data on ELFv1
bdragon [Thu, 19 Dec 2019 22:35:16 +0000 (22:35 +0000)]
[PowerPC] Only move linker sets to .data on ELFv1

In r268055, powerpc64 was special cased regarding linker sets to not mark
the function pointer as 'const'.

This appears to have been done to ensure the compiler generates the function
descriptors correctly. When non-const, the function descriptors will end up
in the .data.rel.local section, and the linker set symbols will get
relocations pointing to them there.

Since function pointers on ELFv2 are "just" pointers like other platforms,
we can leave them const like they are on every other platform.

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

4 years agoFix SIGINFO stack collection to ignore threads with swapped-out stacks.
markj [Thu, 19 Dec 2019 19:34:25 +0000 (19:34 +0000)]
Fix SIGINFO stack collection to ignore threads with swapped-out stacks.

We by definition cannot trace the stack of such a thread.  Also remove a
redundant stack_zero() call in the SIGINFO handler, the stack structure
is cleared by the MD stack_capture().

Sponsored by: The FreeBSD Foundation

4 years agoFix a bug in r355784. I missed a sched_add() call that needed to reacquire
jeff [Thu, 19 Dec 2019 18:22:11 +0000 (18:22 +0000)]
Fix a bug in r355784.  I missed a sched_add() call that needed to reacquire
the thread lock.

Reported by: mjg

4 years agolocaleconv: correct grouping and mon_grouping per C/POSIX
emaste [Thu, 19 Dec 2019 17:01:25 +0000 (17:01 +0000)]
localeconv: correct grouping and mon_grouping per C/POSIX

grouping and mon_grouping should be "" in the C locale.

PR: 172215
MFC after: 6 weeks
Sponsored by: The FreeBSD Foundation

4 years agoIncluding <sys/tmpfs.h> into non-kernel software leads to a
dougm [Thu, 19 Dec 2019 16:39:52 +0000 (16:39 +0000)]
Including <sys/tmpfs.h> into non-kernel software leads to a
compilation error because, without _KERNEL defined, the macro
TMPFS_VALIDATE_DIR is invoked, but never defined. User-level software
that includes sys/tmpfs.h must define _KERNEL to make the definition
of TMPFS_VALIDATE_DIR visible.

This change puts all the inline functions that, directly or
indirectly, invoke MPASS into the scope of the _KERNEL block, allowing
many user-space includers of <sys/tmpfs.h> to stop defining _KERNEL.

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

4 years agoTrim a spurious carriage return from the RFB signature string added in r355301.
jhb [Thu, 19 Dec 2019 15:36:00 +0000 (15:36 +0000)]
Trim a spurious carriage return from the RFB signature string added in r355301.

Submitted by: Yamagi <lists@yamagi.org>

4 years agoipfw: Don't rollback state in alloc_table_vidx() if atomicity is not required.
melifaro [Thu, 19 Dec 2019 10:22:16 +0000 (10:22 +0000)]
ipfw: Don't rollback state in alloc_table_vidx() if atomicity is not required.

Submitted by: Neel Chauhan <neel AT neelc DOT org>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22662

4 years agoRevert r355908 to commit it with a proper message.
melifaro [Thu, 19 Dec 2019 10:20:38 +0000 (10:20 +0000)]
Revert r355908 to commit it with a proper message.

4 years agosvn-commit.tmp
melifaro [Thu, 19 Dec 2019 09:19:27 +0000 (09:19 +0000)]
svn-commit.tmp

4 years agoStop speculation past an eret instruction
andrew [Thu, 19 Dec 2019 08:52:16 +0000 (08:52 +0000)]
Stop speculation past an eret instruction

On arm64 the eret instruction is used to return from an exception handler.
Some implementations may speculate past this instruction into the next
function. As the user may control many registers in these functions add
a synchronisation barrier sequence after the eret instruction to stop these
CPUs from speculating out of the exception handler.

PR: 242676
Submitted by: Anthony Steinhauser <asteinhauser@google.com> (previous version)
MFC after: 1 week

4 years agoTweaks for DIRDEPS_BUILD
sjg [Thu, 19 Dec 2019 02:40:04 +0000 (02:40 +0000)]
Tweaks for DIRDEPS_BUILD

libmagic only depend on mkmagic if not DIRDEPS_BUILD

libpmc fix -I for libpmcstat

local.dirdeps.mk be even more careful about adding gnu/lib/csu to DIRDEPS

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D22872

4 years agoRemove VMware MSI-X from the PCI blacklist.
mp [Wed, 18 Dec 2019 23:00:56 +0000 (23:00 +0000)]
Remove VMware MSI-X from the PCI blacklist.

First reported against ESXi 5.0, PCI passthrough was not working due to
MSI-X issues. However, this issue was fixed via patch releases against
ESXi 5.5 and 6.0 in 2016. Given ESXi 5.5 and earlier have been EOL, this
patch removes the VMware MSI-X blacklist entries in the quirk table.

PR: 203874
Reviewed by: imp, jhb
MFC after: 1 month
Sponsored by: VMware
Differential Revision: https://reviews.freebsd.org/D22819

4 years agoRemove useless code from in6_rmx.c
melifaro [Wed, 18 Dec 2019 22:10:56 +0000 (22:10 +0000)]
Remove useless code from in6_rmx.c

The code in questions walks IPv6 tree every 60 seconds and looks into
 the routes with non-zero expiration time (typically, redirected routes).
For each such route it sets RTF_PROBEMTU flag at the expiration time.
No other part of the kernel checks for RTF_PROBEMTU flag.

RTF_PROBEMTU was defined 21 years ago, 30 Jun 1999, as RTF_PROTO1.
RTF_PROTO1 is a de-facto standard indication of a route installed
 by a routing daemon for a last decade.

Reviewed by: bz, ae
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22865

4 years agovnic: Relax PHY node matching after r336281.
markj [Wed, 18 Dec 2019 21:41:53 +0000 (21:41 +0000)]
vnic: Relax PHY node matching after r336281.

The phy name may apparently be followed by a number in some systems.
Allow that.

PR: 242654
Reported and tested by: Marcel <marcel@brickporch.com>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agocxgbe(4): check if the firmware supports FW_RI_FR_NSMR_TPTE_WR work
np [Wed, 18 Dec 2019 19:10:30 +0000 (19:10 +0000)]
cxgbe(4): check if the firmware supports FW_RI_FR_NSMR_TPTE_WR work
request.

This is used by iw_cxgbe to figure out how best to register memory.

MFC after: 1 month
Sponsored by: Chelsio Communications

4 years agooce: Tighten input validation in the SIOCGI2C handler.
markj [Wed, 18 Dec 2019 18:44:16 +0000 (18:44 +0000)]
oce: Tighten input validation in the SIOCGI2C handler.

Missing validation meant that it was possible to read 8 bytes beyond
the end of sfp_vpd_dump_buffer.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reviewed by: delphij, ram
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22859

4 years agoAdd missing "ereport." prefixes of ZFS events.
mav [Wed, 18 Dec 2019 18:43:44 +0000 (18:43 +0000)]
Add missing "ereport." prefixes of ZFS events.

I was unable to find time when those were working.  I think they have been
broken for at least 5 years or even longer.

Discussed with: avg@
MFC after: 1 month

4 years agoWhen pmap_enter_{l2,pde}() are called to create a kernel mapping, they are
alc [Wed, 18 Dec 2019 18:21:39 +0000 (18:21 +0000)]
When pmap_enter_{l2,pde}() are called to create a kernel mapping, they are
incrementing (and decrementing) the ref_count on kernel page table pages.
They should not do this.  Kernel page table pages are expected to have a
fixed ref_count.  Address this problem by refactoring pmap_alloc{_l2,pde}()
and their callers.  This also eliminates some duplicated code from the
callers.

Correctly implement PMAP_ENTER_NOREPLACE in pmap_enter_{l2,pde}() on kernel
mappings.

Reduce code duplication by defining a function, pmap_abort_ptp(), for
handling a common error case.

Handle a possible page table page leak in pmap_copy().  Suppose that we are
determining whether to copy a superpage mapping.  If we abort because there
is already a mapping in the destination pmap at the current address, then
simply decrementing the page table page's ref_count is correct, because the
page table page must have a ref_count > 1.  However, if we abort because we
failed to allocate a PV entry, this might be a just allocated page table
page that has a ref_count = 1, so we should call pmap_abort_ptp().

Simplify error handling in pmap_enter_quick_locked().

Reviewed by: kib, markj (an earlier)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22763

4 years agoDrop a sleepable lock when we plan on sleeping
imp [Wed, 18 Dec 2019 16:01:15 +0000 (16:01 +0000)]
Drop a sleepable lock when we plan on sleeping

g_io_speedup waits for the completion of the speedup request before proceeding
using biowait(), but check_clear_deps is called with the softdeps lock held
(which is non-sleepable). It's safe to drop this lock around the call to
speedup, so do that.

Submitted by: Peter Holm
Reviewed by: kib@

4 years agoLeave multicast group before reaping and committing state for both
hselasky [Wed, 18 Dec 2019 12:06:34 +0000 (12:06 +0000)]
Leave multicast group before reaping and committing state for both
IPv4 and IPv6.

This fixes a regression issue after r349369. When trying to exit a
multicast group before closing the socket, a multicast leave packet
should be sent.

Differential Revision: https://reviews.freebsd.org/D22848
PR: 242677
Reviewed by: bz (network)
Tested by: Aleksandr Fedorov <aleksandr.fedorov@itglobal.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoRestore important comment in RCU/EPOCH support in FreeBSD after r355784.
hselasky [Wed, 18 Dec 2019 09:30:32 +0000 (09:30 +0000)]
Restore important comment in RCU/EPOCH support in FreeBSD after r355784.

Sponsored by: Mellanox Technologies

4 years agoacpi(4): Add _CID to PNP info string
cem [Wed, 18 Dec 2019 06:22:28 +0000 (06:22 +0000)]
acpi(4): Add _CID to PNP info string

While a given ACPI device may have 0-N compatibility IDs, in practice most
seem to have 0 or 1.  If one is present, emit it as part of the PNP info
string associated with a device.  This could enable MODULE_PNP_INFO-based
automatic kldload for ACPI drivers associated with a given _CID (but without
a good _HID or _UID identifier).

Reviewed by: imp, jhb
Differential Revision: https://reviews.freebsd.org/D22846

4 years agobcm2835_vcbus: add legacy compat mappings
kevans [Wed, 18 Dec 2019 02:29:27 +0000 (02:29 +0000)]
bcm2835_vcbus: add legacy compat mappings

I've opted for just duplicating the two entries needed for this, rather than
writing any other mechanism for maintaining two root compat entries to map
to one config, for simplicity. We'll eventually declare these legacy DTB
unsupported, but let's not do that yet while there's no real burden.

4 years agoFix the aflag shift on big-endian platforms after r355672.
markj [Wed, 18 Dec 2019 01:56:38 +0000 (01:56 +0000)]
Fix the aflag shift on big-endian platforms after r355672.

The structure offset is zero regardless of endianness.

Reported by: brooks
Pointy hat: markj

4 years agoAdd support for TLS 1.3 using AES-GCM to the OCF backend for KTLS.
jhb [Wed, 18 Dec 2019 01:37:00 +0000 (01:37 +0000)]
Add support for TLS 1.3 using AES-GCM to the OCF backend for KTLS.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D22802

4 years agoAdd a structure for the AAD used in TLS 1.3.
jhb [Wed, 18 Dec 2019 01:33:20 +0000 (01:33 +0000)]
Add a structure for the AAD used in TLS 1.3.

While here, add RFC numbers to comments about nonce and AAD data
for TLS 1.2.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D22801

4 years agoBump Dd for changes in r355866.
jhb [Wed, 18 Dec 2019 01:27:49 +0000 (01:27 +0000)]
Bump Dd for changes in r355866.

Pointy hat to: jhb
MFC after: 2 weeks

4 years agoarm: add SOC_BRCM_BCM2837 option, include it in GENERIC
kevans [Tue, 17 Dec 2019 23:01:37 +0000 (23:01 +0000)]
arm: add SOC_BRCM_BCM2837 option, include it in GENERIC

We use armv7/GENERIC for the RPI2 images. The original RPI2 is actually a
32-bit BCM2836, but v1.2 was upgraded to the 64-bit BCM2837. The project
continues to provide the RPI2 image as armv7, as it's the lowest common
denominator of the two. Historically, we've just kind of implicitly
acknowledged this by including some bcm2837 bits on a SOC_BCM2836 kernel
config -- this worked until r354875 added code that actually cared.

Acknowledge formally that BCM2837 is valid in arm32.

This name is inconsistent with the other BCM* SOC on !arm64 for two reasons:

1. It's a pre-existing option on arm64, and
2. the naming convention on arm/ should've arguably changed to include BRCM

#1 seems to be a convincing enough argument to maintain the existing name
for it.

4 years agoUpdate the crypto(4) and crypto(9) manpages.
jhb [Tue, 17 Dec 2019 22:58:07 +0000 (22:58 +0000)]
Update the crypto(4) and crypto(9) manpages.

There are probably bits that are still wrong, but this fixes some
things at least:
- Add named arguments to the functions in crypto(9).
- Add missing algorithms.
- Don't mention arguments that don't exist in crypto_register.
- Add CIOGSESSION2.
- Remove CIOCNFSESSION.
- Clarify some stale language that assumed an fd had only one sesson.
- Note that you have to use CRIOGET and add a note in BUGS lamenting
  that one has to use CRIOGET.
- Various other cleanups.

Reviewed by: cem (earlier version)
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D22784

4 years agoRevert r355833
imp [Tue, 17 Dec 2019 21:53:22 +0000 (21:53 +0000)]
Revert r355833

While it works on nda, it fails on ada and/or da for at least zfs with a modify
after free issue on a trim BIO. Revert while I rework it to fix those devices.

4 years agoan(4): Require privileges for all SIOCGAIRONET requests.
markj [Tue, 17 Dec 2019 21:34:38 +0000 (21:34 +0000)]
an(4): Require privileges for all SIOCGAIRONET requests.

SIOCGAIRONET allows userspace to query an(4) for various device
properties and configuration, which appears to potentially include
sensitive information such as WEP keys (an(4) seems to predate WPA).

Also avoid races by copying in the request structure to a temporary
buffer before locking and modifying the device softc.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoTemporarily skip failing sys.geom.class.multipath.failloop.failloop on i386 CI
lwhsu [Tue, 17 Dec 2019 19:01:09 +0000 (19:01 +0000)]
Temporarily skip failing sys.geom.class.multipath.failloop.failloop on i386 CI

PR: 242689
Sponsored by: The FreeBSD Foundation

4 years agoRemove unnecessary MODULE_DEPEND() from imx_i2c.c, and also from rk_i2c
ian [Tue, 17 Dec 2019 17:03:03 +0000 (17:03 +0000)]
Remove unnecessary MODULE_DEPEND() from imx_i2c.c, and also from rk_i2c
where it got copied to.

4 years agoThis commit is a bit of a re-arrange of deck chairs. It
rrs [Tue, 17 Dec 2019 16:08:07 +0000 (16:08 +0000)]
This commit is a bit of a re-arrange of deck chairs. It
gets both rack and bbr ready for the completion of the STATs
framework in FreeBSD. For now if you don't have both NF_stats and
stats on it disables them. As soon as the rest of the stats framework
lands we can remove that restriction and then just uses stats when
defined.

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

4 years agoUpdate owc_gpiobus (one-wire over gpio) to the modern gpio_pin interface.
ian [Tue, 17 Dec 2019 15:56:48 +0000 (15:56 +0000)]
Update owc_gpiobus (one-wire over gpio) to the modern gpio_pin interface.

It used to be required that a device be a child of gpiobus(4) to manipulate
gpio pins. That requirement didn't work well for FDT-based systems with many
cross-hierarchy users of gpio, so a more modern framework was created that
removed the old hierarchy requirement.

These changes adapt the owc_gpiobus driver to use the newer gpio_pin_*
functions to acquire, release, and manipulate gpio pins. This allows a
single driver to work for both hinted-attachment and fdt-based systems, and
removes the requirement that any one-wire fdt nodes must appear at the root
of the devicetree.

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

4 years agoConvert zpcpu_* inlines to macros and add zpcpu_replace.
mjg [Tue, 17 Dec 2019 14:53:55 +0000 (14:53 +0000)]
Convert zpcpu_* inlines to macros and add zpcpu_replace.

This allows them to do basic type casting internally, effectively relieving
consumers from having to cast on their own.