]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoRemove -mlong-calls vhen building arm libraries and llvm.
dim [Tue, 10 Mar 2020 06:49:43 +0000 (06:49 +0000)]
Remove -mlong-calls vhen building arm libraries and llvm.

Clang from 9.0.0 onwards already has the necessary relocation range
extenders, so this workaround is no longer needed (it produces longer
and slower code). Tested on real hardware, and in cross-compile
environment.

Submitted by: mmel

4 years agoMerge ^/head r358712 through r358730.
dim [Sat, 7 Mar 2020 15:09:45 +0000 (15:09 +0000)]
Merge ^/head r358712 through r358730.

4 years agoFix an issue of net.inet.igmp.stats handler.
hrs [Sat, 7 Mar 2020 08:41:10 +0000 (08:41 +0000)]
Fix an issue of net.inet.igmp.stats handler.
The header of (struct igmpstat) could be cleared by sysctl(3).
This can be reproduced by "netstat -s -z -p igmp".

PR: 244584
MFC after: 1 week

4 years agocompat: Allow explicit overriding of COMPAT_ARCH and COMPAT_CPUTYPE
jhibbits [Sat, 7 Mar 2020 03:58:58 +0000 (03:58 +0000)]
compat: Allow explicit overriding of COMPAT_ARCH and COMPAT_CPUTYPE

Summary:
Allow src.conf to override the inferred COMPAT_ARCH and COMPAT_CPUTYPE
variables, such that a different CPU target can be specified explicitly
for the general target vs the compat target.

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

4 years agoMove SMR pointer type definition and access macros to smr_types.h.
markj [Sat, 7 Mar 2020 00:55:46 +0000 (00:55 +0000)]
Move SMR pointer type definition and access macros to smr_types.h.

The intent is to provide a header that can be included by other headers
without introducing too much pollution.  smr.h depends on various
headers and will likely grow over time, but is less likely to be
required by system headers.

Rename SMR_TYPE_DECLARE() to SMR_POINTER():
- One might use SMR to protect more than just pointers; it
  could be used for resizeable arrays, for example, so TYPE seems too
  generic.
- It is useful to be able to define anonymous SMR-protected pointer
  types and the _DECLARE suffix makes that look wrong.

Reviewed by: jeff, mjg, rlibby
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23988

4 years agoReword a comment to describe what's actually going on. We can call invalidate
imp [Sat, 7 Mar 2020 00:29:12 +0000 (00:29 +0000)]
Reword a comment to describe what's actually going on. We can call invalidate
several times potentially. We just don't do anything on the second and
subsequent calls.

4 years agoRemove an apparently incorrect assertion.
brooks [Fri, 6 Mar 2020 23:31:09 +0000 (23:31 +0000)]
Remove an apparently incorrect assertion.

Without this change mips64 fails to boot.

Discussed with: markj
Sponsored by: DARPA

4 years agoRevert
andreast [Fri, 6 Mar 2020 23:01:49 +0000 (23:01 +0000)]
Revert

4 years agoDrop 'All rights reserved'
andreast [Fri, 6 Mar 2020 21:51:28 +0000 (21:51 +0000)]
Drop 'All rights reserved'
Replace hardcoded sizes by nitems and sizeof
Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE, I run this driver since a few
years with CTLFLAG_MPSAFE w/o issues.

4 years agoDrop 'All rights reserved'
andreast [Fri, 6 Mar 2020 21:32:42 +0000 (21:32 +0000)]
Drop 'All rights reserved'
Replace hardcoded sizes by nitems and sizeof
Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE, I run this driver since a few
years with CTLFLAG_MPSAFE w/o issues.
Add a HACK to handle a special case for a sensor location.

4 years agoDrop 'All rights reserved'
andreast [Fri, 6 Mar 2020 21:26:35 +0000 (21:26 +0000)]
Drop 'All rights reserved'
Replace hardcoded size by nitems

4 years agoDrop 'All rights reserved'
andreast [Fri, 6 Mar 2020 21:24:09 +0000 (21:24 +0000)]
Drop 'All rights reserved'
Replace hardcoded sizes by nitems and sizeof

4 years ago- Drop 'All rights reserved'
andreast [Fri, 6 Mar 2020 21:21:01 +0000 (21:21 +0000)]
- Drop 'All rights reserved'
- Replace hardcoded size by nitems

4 years agozfs dmu_read: loosen the assertion.
kib [Fri, 6 Mar 2020 21:15:25 +0000 (21:15 +0000)]
zfs dmu_read: loosen the assertion.

Since switch to the lockless grab, shared busy for ahead/behind pages
allows other threads to validate and map the pages readonly.

Reviewed by: avg, jeff, markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D23986

4 years agoRemove dead code from the powerpc uma_small_alloc().
markj [Fri, 6 Mar 2020 20:44:22 +0000 (20:44 +0000)]
Remove dead code from the powerpc uma_small_alloc().

32-bit Book-E doesn't set UMA_MD_SMALL_ALLOC, and 32-bit OEA platforms
have a 32-bit vm_paddr_t.  Moreover, this code was wrong in that it
leaked the page if the check failed.

Reviewed by: jhibbits
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23991

4 years agocxgbe/t4_tom: Do not uninitialize a toepcb that has not been initialized.
np [Fri, 6 Mar 2020 19:56:12 +0000 (19:56 +0000)]
cxgbe/t4_tom: Do not uninitialize a toepcb that has not been initialized.

This fixes the following panic:
--- trap 0xc, rip = 0xffffffff80c00411, rsp = 0xfffffe0025192840, rbp = 0xfffffe0025192860 ---
vmem_xfree() at vmem_xfree+0xd1/frame 0xfffffe0025192860
tls_uninit_toep() at tls_uninit_toep+0x78/frame 0xfffffe0025192880
free_toepcb() at free_toepcb+0x32/frame 0xfffffe00251928a0
t4_connect() at t4_connect+0x3be/frame 0xfffffe0025192950
tcp_offload_connect() at tcp_offload_connect+0xa4/frame 0xfffffe0025192990
tcp_usr_connect() at tcp_usr_connect+0xec/frame 0xfffffe00251929f0
soconnect() at soconnect+0xae/frame 0xfffffe0025192a30
kern_connectat() at kern_connectat+0xe2/frame 0xfffffe0025192a90
sys_connect() at sys_connect+0x75/frame 0xfffffe0025192ad0
amd64_syscall() at amd64_syscall+0x137/frame 0xfffffe0025192bf0
fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0025192bf0
--- syscall (98, FreeBSD ELF64, sys_connect), rip = 0x8008e9d8a, rsp = 0x7fffffffc0f8, rbp = 0x7fffffffc130 ---

Reviewed by: jhb@
MFC after: 3 days
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D23989

4 years agoUse COUNTER_U64_DEFINE_EARLY() in places where it simplifies things.
markj [Fri, 6 Mar 2020 19:10:00 +0000 (19:10 +0000)]
Use COUNTER_U64_DEFINE_EARLY() in places where it simplifies things.

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

4 years agoAdd COUNTER_U64_SYSINIT() and COUNTER_U64_DEFINE_EARLY().
markj [Fri, 6 Mar 2020 19:09:01 +0000 (19:09 +0000)]
Add COUNTER_U64_SYSINIT() and COUNTER_U64_DEFINE_EARLY().

The aim is to reduce the boilerplate needed today to define and
initialize global counters.  Also add SI_SUB_COUNTER to the sysinit
ordering.

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

4 years agoAdd a new "mntfs" pseudo file system which provides private device vnodes for
chs [Fri, 6 Mar 2020 18:41:37 +0000 (18:41 +0000)]
Add a new "mntfs" pseudo file system which provides private device vnodes for
file systems to safely access their disk devices, and adapt FFS to use it.
Also add a new BO_NOBUFS flag to allow enforcing that file systems using
mntfs vnodes do not accidentally use the original devfs vnode to create buffers.

Reviewed by: kib, mckusick
Approved by: imp (mentor)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D23787

4 years agoreadelf: print GNU Build-ID
emaste [Fri, 6 Mar 2020 17:24:51 +0000 (17:24 +0000)]
readelf: print GNU Build-ID

Sponsored by: The FreeBSD Foundation

4 years agoMerge ^/head r358678 through r358711.
dim [Fri, 6 Mar 2020 17:11:29 +0000 (17:11 +0000)]
Merge ^/head r358678 through r358711.

4 years agoMerge commit f75939599 from llvm git (by Erich Keane):
dim [Fri, 6 Mar 2020 17:02:14 +0000 (17:02 +0000)]
Merge commit f75939599 from llvm git (by Erich Keane):

  Reland r374450 with Richard Smith's comments and test fixed.

  The behavior from the original patch has changed, since we're no
  longer allowing LLVM to just ignore the alignment.  Instead, we're
  just assuming the maximum possible alignment.

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

  llvm-svn: 374562

This fixes 'Assertion failed: (Alignment != 0 && "Invalid Alignment"),
function CreateAlignmentAssumption', when building recent versions of
v8, which invoke __builtin_assume_aligned() with its alignment argument
set to 4GiB or more.

Clang will now report a warning, and show the maximum possible alignment
instead, e.g.:

huge-align.cpp:1:27: warning: requested alignment must be 536870912 bytes or smaller; maximum alignment assumed [-Wbuiltin-assume-aligned-alignment]
void *f(void *g) { return __builtin_assume_aligned(g, 4294967296); }
                          ^                           ~~~~~~~~~~

Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=43839
Reported by: cem
MFC after: 3 days

4 years agoAdd more are64 special register fields
andrew [Fri, 6 Mar 2020 16:00:35 +0000 (16:00 +0000)]
Add more are64 special register fields

Obtained from: https://github.com/FreeBSD-UPB/freebsd

4 years agoreadelf: decode and print Xen ELF note strings
emaste [Fri, 6 Mar 2020 15:58:52 +0000 (15:58 +0000)]
readelf: decode and print Xen ELF note strings

Sponsored by: The FreeBSD Foundation

4 years agoreadelf: add XEN_ELFNOTE_PHYS32_ENTRY note
emaste [Fri, 6 Mar 2020 15:26:15 +0000 (15:26 +0000)]
readelf: add XEN_ELFNOTE_PHYS32_ENTRY note

See r336469 for details.

Sponsored by: The FreeBSD Foundation

4 years agoUpdate the hypervisor registers
andrew [Fri, 6 Mar 2020 14:46:50 +0000 (14:46 +0000)]
Update the hypervisor registers

 - Add more registers needed by bhyve [1]
 - Move EL2 registers from armreg.h to hypervisor.h
 - Add the register name to hypervisor.h

Obtained from: https://github.com/FreeBSD-UPB/freebsd [1]

4 years agoixl: Add missing conversions from/to LE16
luporl [Fri, 6 Mar 2020 12:37:04 +0000 (12:37 +0000)]
ixl: Add missing conversions from/to LE16

This fixes some errors on PPC64, during attach and when trying to assign an IP
to an interface.  With this change, basic operation of X710 NICs is now
possible.

This also fixes builds with IXL_DEBUG enabled

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

4 years agoDefine more subsystem orders.
hselasky [Fri, 6 Mar 2020 11:26:16 +0000 (11:26 +0000)]
Define more subsystem orders.
Intended for use with module_init_order() in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix some whitespace issues in ipoib.
hselasky [Fri, 6 Mar 2020 09:59:07 +0000 (09:59 +0000)]
Fix some whitespace issues in ipoib.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoAdd Gigabit Ethernet support for RT3883 and RT2880 Ralink/Mediatek SoCs
sgalabov [Fri, 6 Mar 2020 08:50:18 +0000 (08:50 +0000)]
Add Gigabit Ethernet support for RT3883 and RT2880 Ralink/Mediatek SoCs

Submitted by: yamori813@yahoo.co.jp
Reported by: yamori813@yahoo.co.jp
Reviewed by: sgalabov, ray
Obtained from: yamori813@yahoo.co.jp
Differential Revision: https://reviews.freebsd.org/D22618

4 years agopowerpc/memcpy: Don't predict the src and dst will be misaligned
jhibbits [Fri, 6 Mar 2020 03:46:48 +0000 (03:46 +0000)]
powerpc/memcpy: Don't predict the src and dst will be misaligned

Predicting misalignment will pessimize the expected common case.  Don't
predict true or false in thise case.

4 years agoFinish revert of r358672, missed in r358688.
jhibbits [Fri, 6 Mar 2020 02:30:04 +0000 (02:30 +0000)]
Finish revert of r358672, missed in r358688.

Manual reverts never succeed correctly.

Reported by: luporl

4 years agoFix a mistaken conditional in mfi_tbolt_send_frame()
jhibbits [Fri, 6 Mar 2020 01:50:15 +0000 (01:50 +0000)]
Fix a mistaken conditional in mfi_tbolt_send_frame()

As written, the condition of (cdb[0] != 0x28 || cdb[0] != 0x2A) will always
be true, since if it's one, it's obviously not the other.  Reading the code,
the intent appears to be that it should only perform the operation if it's
neither, otherwise the conditional can be elided.

Found by clang 10.

4 years agopowerpc/powerpc64: Enforce natural alignment in memcpy
jhibbits [Fri, 6 Mar 2020 01:45:03 +0000 (01:45 +0000)]
powerpc/powerpc64: Enforce natural alignment in memcpy

Summary:
POWER architecture CPUs (Book-S) require natural alignment for
cache-inhibited storage accesses.  Since we can't know the caching model
for a page ahead of time, always enforce natural alignment in memcpy.
This fixes a SIGBUS in X with acceleration enabled on POWER9.

As part of this, revert r358672, it's no longer necessary with this fix.

Regression tested by alfredo.

Reviewed by: alfredo
Differential Revision: https://reviews.freebsd.org/D23969

4 years agotftpd: tests: raise targeted cstd to c11
kevans [Thu, 5 Mar 2020 22:45:16 +0000 (22:45 +0000)]
tftpd: tests: raise targeted cstd to c11

r358556 added alignas() use to the functional tests, which isn't defined
until C11. Raise the -std to C11 to fix the build under freebsd-gcc{6,9}.

Reported by: mhorne, Jenkins/CI

4 years agoAlign the buffer to the alignment of the structure we expect.
glebius [Thu, 5 Mar 2020 21:01:47 +0000 (21:01 +0000)]
Align the buffer to the alignment of the structure we expect.

Submitted by: Slawa Olhovchenkov <slw zxy.spb.ru>

4 years agolibelf: rationalize error handling in ELF note conversion
emaste [Thu, 5 Mar 2020 20:53:43 +0000 (20:53 +0000)]
libelf: rationalize error handling in ELF note conversion

Previously _libelf_cvt_NOTE_tom (to host) returned false if a note's
namesz + descsz exceeded the buffer size, while _libelf_cvt_NOTE_tof
(to file) silently truncated.  Return false in the latter case too.

Sponsored by: The FreeBSD Foundation

4 years ago[aacraid] Port driver to big-endian
luporl [Thu, 5 Mar 2020 20:04:41 +0000 (20:04 +0000)]
[aacraid] Port driver to big-endian

Port aacraid driver to big-endian (BE) hosts.

The immediate goal of this change is to make it possible to use the
aacraid driver on PowerPC64 machines that have Adaptec Series 8 SAS
controllers.

Adapters supported by this driver expect FIB contents in little-endian
(LE) byte order. All FIBs have a fixed header part as well as a data
part that depends on the command being issued to the controller.

In this way, on BE hosts, the FIB header and all FIB data structures
used in aacraid.c and aacraid_cam.c need to be converted to LE before
being sent to the adapter and converted to BE when coming from it.

The functions to convert each struct are on aacraid_endian.c.
For little-endian (LE) targets, they are macros that expand
to nothing.
In some cases, when only a few fields of a large structure are used,
the fields are converted inline, by the code using them.

PR: 237463
Reviewed by: jhibbits
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D23887

4 years agoRemove vfs.zfs.top_maxinflight tunable/sysctl.
mav [Thu, 5 Mar 2020 19:43:43 +0000 (19:43 +0000)]
Remove vfs.zfs.top_maxinflight tunable/sysctl.

It is dead since sorted scrub import at r334844.

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

4 years agoMerge ^/vendor/llvm-project/release-10.x up to its last change (upstream
dim [Thu, 5 Mar 2020 18:11:47 +0000 (18:11 +0000)]
Merge ^/vendor/llvm-project/release-10.x up to its last change (upstream
commit llvmorg-10.0.0-rc3-1-gc290cb61fdc), and bump versions.

4 years agoRevert r357259, after the merge from head which added linker scripts for
dim [Thu, 5 Mar 2020 18:09:19 +0000 (18:09 +0000)]
Revert r357259, after the merge from head which added linker scripts for
stand/i386 boot:

Revert upstream lld r371957 (git commit 06bb7dfbd) by Fangrui Song:

  [ELF] Map the ELF header at imageBase

  If there is no readonly section, we map:

  * The ELF header at imageBase+maxPageSize
  * Program headers at imageBase+maxPageSize+sizeof(Ehdr)
  * The first section .text at imageBase+maxPageSize+sizeof(Ehdr)+sizeof(program headers)

  Due to the interaction between Writer<ELFT>::fixSectionAlignments and
  LinkerScript::allocateHeaders,
  `alignDown(p_vaddr(R PT_LOAD)) = alignDown(p_vaddr(RX PT_LOAD))`.
  The RX PT_LOAD will override the R PT_LOAD at runtime, which is not ideal:

  ```
  // PHDR at 0x401034, should be 0x400034
    PHDR           0x000034 0x00401034 0x00401034 0x000a0 0x000a0 R   0x4
  // R PT_LOAD contains just Ehdr and program headers.
  // At 0x401000, should be 0x400000
    LOAD           0x000000 0x00401000 0x00401000 0x000d4 0x000d4 R   0x1000
    LOAD           0x0000d4 0x004010d4 0x004010d4 0x00001 0x00001 R E 0x1000
  ```

  * createPhdrs allocates the headers to the R PT_LOAD.
  * fixSectionAlignments assigns `imageBase+maxPageSize+sizeof(Ehdr)+sizeof(program headers)` (formula: `alignTo(dot, maxPageSize) + dot % config->maxPageSize`) to addrExpr of .text
  * allocateHeaders computes the minimum address among SHF_ALLOC sections, i.e. addr(.text)
  * allocateHeaders sets address of ELF header to `addr(.text)-sizeof(Ehdr)-sizeof(program headers) = imageBase+maxPageSize`

  The main observation is that when the SECTIONS command is not used, we
  don't have to call allocateHeaders. This requires an assumption that
  the presence of PT_PHDR and addresses of headers can be decided
  regardless of address information.

  This may seem natural because dot is not manipulated by a linker script.
  The other thing is that we have to drop the special rule for -T<section>
  in `getInitialDot`. If -Ttext is smaller than the image base, the headers
  will not be allocated with the old behavior (allocateHeaders is called)
  but always allocated with the new behavior.

  The behavior change is not a problem. Whether and where headers are
  allocated can vary among linkers, or ld.bfd across different versions
  (--enable-separate-code or not). It is thus advised to use a linker
  script with the PHDRS command to have a consistent behavior across
  linkers. If PT_PHDR is needed, an explicit --image-base can be a simpler
  alternative.

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

  llvm-svn: 371957

4 years agoVendor import of llvm-project branch release/10.x
dim [Thu, 5 Mar 2020 18:05:37 +0000 (18:05 +0000)]
Vendor import of llvm-project branch release/10.x
llvmorg-10.0.0-rc3-1-gc290cb61fdc.

4 years agoMerge ^/head r358466 through r358677.
dim [Thu, 5 Mar 2020 17:55:36 +0000 (17:55 +0000)]
Merge ^/head r358466 through r358677.

4 years agoRemove duplicate usr/libexec/cc1plus entry from ObsoleteFiles.inc.
dim [Thu, 5 Mar 2020 17:53:38 +0000 (17:53 +0000)]
Remove duplicate usr/libexec/cc1plus entry from ObsoleteFiles.inc.

4 years agobuffer pager: deref ucred immediately after read.
kib [Thu, 5 Mar 2020 15:52:34 +0000 (15:52 +0000)]
buffer pager: deref ucred immediately after read.

Ucred is passed to bread(9) so that non-local filesystems use proper
credentials.  But, since clean buffer might be cached unless
buf_pager_relbuf is not enabled, it makes credentials to have extra
reference until buffer is reclaimed.  Ucred reference would prevent
jail from destroying if creds are jailed.

Dereferencing the read credentials on the valid buffer avoid that, and
should be fine because the buffer is valid and does not need re-read.

PR: 238032
Reported by: bz
Reproduced and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23775

4 years agoumtx_op.2: correct typo
emaste [Thu, 5 Mar 2020 15:51:44 +0000 (15:51 +0000)]
umtx_op.2: correct typo

PR: 244611
Submitted by: John F. Carr <jfc@mit.edu>
MFC after: 3 days

4 years agoftw.3: Add examples
0mp [Thu, 5 Mar 2020 14:52:24 +0000 (14:52 +0000)]
ftw.3: Add examples

PR: 173448 [1]
Submitted by: fernape@ (previous version) [1]
Reviewed by: jilles
Approved by: bcr (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21750

4 years agoMove compat.linux.map_sched_prio sysctl definition to linux_mib.c so it is
tijl [Thu, 5 Mar 2020 14:41:27 +0000 (14:41 +0000)]
Move compat.linux.map_sched_prio sysctl definition to linux_mib.c so it is
only defined by linux_common kernel module and not both linux and linux64
modules.

Reported by: Yuri Pankov <ypankov@fastmail.com>

4 years ago[PowerPC64] restrict memcpy/bcopy optimization to POWER ISA >=V2.07
alfredo [Thu, 5 Mar 2020 14:13:22 +0000 (14:13 +0000)]
[PowerPC64] restrict memcpy/bcopy optimization to POWER ISA >=V2.07

VSX instructions were added in POWER ISA V2.06 (POWER7), but it
requires data to be word-aligned. Such requirement was removed in
ISA V2.07B (POWER8).

Since current memcpy/bcopy optimization relies on VSX instructions
handling misalignment transparently, and kernel doesn't currently
implement an alignment error handler, this optimzation should be
restrict to ISA V2.07 onwards.

SIGBUS on stxvd2x instruction was reproduced in POWER7+ CPU.

Reviewed by: luporl, jhibbits, bdragon
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D23958

4 years ago[PowerPC64] fix uma_small_free panic
alfredo [Thu, 5 Mar 2020 12:24:48 +0000 (12:24 +0000)]
[PowerPC64] fix uma_small_free panic

Fix panic "Freeing UMA block at 0xn with no associated page".
Also replaces pmap_remove call by pmap_kremove, for symmetry.

Reviewed by: jhibbits
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D23931

4 years agoMark the arm64 machdep.h as kernel only
andrew [Thu, 5 Mar 2020 10:52:16 +0000 (10:52 +0000)]
Mark the arm64 machdep.h as kernel only

None of this is useful for userspace.

Sponsored by: Innovate UK

4 years agoAll paths lead to xpt_done, so move it after the switch.
imp [Thu, 5 Mar 2020 06:21:00 +0000 (06:21 +0000)]
All paths lead to xpt_done, so move it after the switch.

4 years agoxpt_async is submitting a CCB, not finishing it up, so use xpt_action() instead
imp [Thu, 5 Mar 2020 06:20:17 +0000 (06:20 +0000)]
xpt_async is submitting a CCB, not finishing it up, so use xpt_action() instead
of xpt_done(). Add the missing XPT_ASYNC case to xpt_action_default. xpt_async
wants to use the side-effect of the xpt_done() routine to queue this to the
camisr thread so it can be done in that context. However, this breaks the
symmetry that you create a ccb and call xpt_action() for it to be
dispatched. Restore that symmetry by having it go through that path. As far as I
can tell, this is the only CCB that we create and call xpt_done() on directly.

4 years agoAdd a missing bktr header.
glebius [Wed, 4 Mar 2020 23:49:20 +0000 (23:49 +0000)]
Add a missing bktr header.

4 years agoFix spelling of "dropped".
glebius [Wed, 4 Mar 2020 22:32:40 +0000 (22:32 +0000)]
Fix spelling of "dropped".

Submitted by: Lutz Donnerhacke
Differential Revision: https://reviews.freebsd.org/D23954

4 years agoRemove unused function.
glebius [Wed, 4 Mar 2020 22:31:41 +0000 (22:31 +0000)]
Remove unused function.

4 years agoWhen a machine boots the NFS mounting script is executed after
glebius [Wed, 4 Mar 2020 22:27:16 +0000 (22:27 +0000)]
When a machine boots the NFS mounting script is executed after
interfaces are configured, but for many interfaces (e.g. all Intel)
ifconfig causes link renegotiation, so the first attempt to mount
NFS always fails. After that mount_nfs sleeps for 30 seconds, while
only a couple seconds are actually required for interface to get up.

Instead of sleeping, do select(2) on routing socket and check if
some interface became UP and in this case retry immediately.

Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D23934

4 years agoRemove an #include erroneously added in r358432.
markj [Wed, 4 Mar 2020 22:23:24 +0000 (22:23 +0000)]
Remove an #include erroneously added in r358432.

Reported by: erj

4 years agoMFV r358616:
cy [Wed, 4 Mar 2020 21:45:12 +0000 (21:45 +0000)]
MFV r358616:

Update ntp-4.2.8p13 --> 4.2.8p14.

The advisory can be found at:
http://support.ntp.org/bin/view/Main/SecurityNotice#\
March_2020_ntp_4_2_8p14_NTP_Rele

No CVEs have been documented yet.

MFC after: now
Security: http://support.ntp.org/bin/view/Main/NtpBug3610
http://support.ntp.org/bin/view/Main/NtpBug3596
http://support.ntp.org/bin/view/Main/NtpBug3592

4 years agoIntroduce kern_mmap_req().
brooks [Wed, 4 Mar 2020 21:27:12 +0000 (21:27 +0000)]
Introduce kern_mmap_req().

This presents an extensible interface to the generic mmap(2)
implementation via a struct pointer intended to use a designated
initializer or compount literal.  We take advantage of the mandatory
zeroing of fields not listed in the initializer.

Remove kern_mmap_fpcheck() and use kern_mmap_req().

The motivation for this change is a desire to keep the core
implementation from growing an ever-increasing number of arguments
that must be specified in the correct order for the lowest-level
implementations.  In CheriBSD we have already added two more arguments.

Reviewed by: kib
Discussed with: kevans
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D23164

4 years agoLink stand/i386 components using a linker script
dim [Wed, 4 Mar 2020 21:01:22 +0000 (21:01 +0000)]
Link stand/i386 components using a linker script

LLD 10.0.0 changed the behavior of the -Ttext option, so that using
-Ttext=0x0 now causes linking of the loaders to fail with:

ld: error: output file too large: 18446744073707016908 bytes

I reported this in https://bugs.llvm.org/show_bug.cgi?id=44715, and
initially reverted the upstream change in r357259 to work around it.

However, after some discussion with Fangrui Song in the upstream ticket,
I think we can classify this as an unfortunate interaction between using
-Ttext=0 in combination with --no-rosegment.  (We added the latter
in r332090, because btxld does not correctly handle input with more
than 2 PT_LOAD segments.)

Fangrui suggested to use a linker script instead, and Warner was already
attempting this in r305353, but had to revert it due to "crypto-using
boot problems" (not sure what those were :).

This review updates the stand/i386/boot.ldscript to handle more
sections, inserts some symbols like _edata and such that we use in
libsa, and also discards any .interp section.

It uses ORG which is defined on the linker command line using
--defsym ORG=value to set the start of all the sections.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D23952

4 years agoreadelf: simplify namesz / descsz checks
emaste [Wed, 4 Mar 2020 20:41:45 +0000 (20:41 +0000)]
readelf: simplify namesz / descsz checks

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoreadelf: check note namesz and descsz
emaste [Wed, 4 Mar 2020 20:29:49 +0000 (20:29 +0000)]
readelf: check note namesz and descsz

Previously corrupt note namesz or descsz (perhaps caused by readelf's
current lack of endian support for notes) resulted in a crash.  Check
that namesz and descsz do not extend beyond the end of the buffer before
trying to access name and desc data.

Reported by: jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agodwmmc: Rework the DMA engine
manu [Wed, 4 Mar 2020 20:01:03 +0000 (20:01 +0000)]
dwmmc: Rework the DMA engine

Each segment can be up to 4096 bytes in chain structure according to the
RK3399 TRM Part 2.
Set the buffers in full ring where the last one point to the first one.
Correctly reports the MMC_IVAR_MAX_DATA.
Use CACHE_LINE_SIZE for bus_dma alignment.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23894

4 years agoexecve: use LOCKSHARED when looking up the interpreter
mjg [Wed, 4 Mar 2020 19:52:34 +0000 (19:52 +0000)]
execve: use LOCKSHARED when looking up the interpreter

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

4 years agonullfs: don't pre lock exclusive in nullfs_root
mjg [Wed, 4 Mar 2020 19:52:00 +0000 (19:52 +0000)]
nullfs: don't pre lock exclusive in nullfs_root

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

4 years agoloader: crc32 is provided by libsa
tsoome [Wed, 4 Mar 2020 18:38:09 +0000 (18:38 +0000)]
loader: crc32 is provided by libsa

Seems like leftover from moving crc32.c to libsa.

4 years agoReserve WXNEEDED ELF feature control flag
emaste [Wed, 4 Mar 2020 18:21:30 +0000 (18:21 +0000)]
Reserve WXNEEDED ELF feature control flag

This will be used to tag binaries that require W+X mappings, in advance
of the ability to prevent W^X in mmap/mprotect.

There is still some discussion about the flag's name, but the ABI won't
change even if the name does (as kib pointed out in the review).

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

4 years agobnxt(4): Fix ioctls when user addresses are inaccessable.
brooks [Wed, 4 Mar 2020 17:55:57 +0000 (17:55 +0000)]
bnxt(4): Fix ioctls when user addresses are inaccessable.

Check copyin's error code (differ adding copyout checks at this time).

Don't directly access user memory in the switch statement.

Since bnxt_ioctl_data isn't all that big, use a stack allocation.

Reviewed by: jhb
MFC after: 3 days
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23933

4 years agoImplement a detaching flag for the sound(4) subsystem to take
hselasky [Wed, 4 Mar 2020 17:23:20 +0000 (17:23 +0000)]
Implement a detaching flag for the sound(4) subsystem to take
appropriate actions when we are trying to detach an audio device,
but cannot because someone is using it.

This avoids applications having to wait for the DSP read data
timeout before they receive any error indication.
Tested with virtual_oss(8).

Remove some unused definitions while at it.

PR: 194727
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement optional table entry limits for if_llatbl.
bz [Wed, 4 Mar 2020 17:17:02 +0000 (17:17 +0000)]
Implement optional table entry limits for if_llatbl.

Implement counting of table entries linked on a per-table base
with an optional (if set > 0) limit of the maximum number of table
entries.

For that the public lltable_link_entry() and lltable_unlink_entry()
functions as well as the internal function pointers change from void
to having an int return type.

Given no consumer currently sets the new llt_maxentries this can be
committed on its own.  The moment we make use of the table limits,
the callers of the link function must check the return value as
it can change and entries might not be added.

Adjustments for IPv6 (and possibly IPv4) will follow.

Sponsored by: Netflix (originally)
Reviewed by: melifaro
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22713

4 years agomlx5en: Support 50GBase-KR4 media type in mlx5en driver.
kib [Wed, 4 Mar 2020 17:13:35 +0000 (17:13 +0000)]
mlx5en: Support 50GBase-KR4 media type in mlx5en driver.

Submitted by: Adam Peace <adam.e.peace@gmail.com>
Reviewed by: hselasky
Sponsored by: Mellanox Technologies
MFC after: 1 week

4 years agoelfctl: check read return value
emaste [Wed, 4 Mar 2020 16:57:23 +0000 (16:57 +0000)]
elfctl: check read return value

CID: 14202121420213
Reported by: Coverity Scan
Sponsored by: The FreeBSD Foundation

4 years agoelfctl: style(9): use C99 uintX_t types
emaste [Wed, 4 Mar 2020 16:53:49 +0000 (16:53 +0000)]
elfctl: style(9): use C99 uintX_t types

Sponsored by: The FreeBSD Foundation

4 years agoWhen using automatically generated flow labels and using TCP SYN
tuexen [Wed, 4 Mar 2020 16:41:25 +0000 (16:41 +0000)]
When using automatically generated flow labels and using TCP SYN
cookies, use the same flow label for the segments sent during the
handshake and after the handshake.
This fixes a bug by making sure that sc_flowlabel is always stored in
network byte order.

Reviewed by: bz@
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D23957

4 years agoAdd new ICMPv6 counters for Anti-DoS limits.
bz [Wed, 4 Mar 2020 16:20:59 +0000 (16:20 +0000)]
Add new ICMPv6 counters for Anti-DoS limits.

Add four new counters for ND6 related Anti-DoS measures.
We split these out into a separate upfront commit so that we only
change the struct size one time.  Implementations using them will
follow.

PR: 157410
Reviewed by: melifaro
MFC after: 2 weeks
X-MFC: cannot really MFC this without breaking netstat
Sponsored by: Netflix (initially)
Differential Revision: https://reviews.freebsd.org/D22711

4 years agoUpdate ismt(4) man page for r358595.
jhibbits [Wed, 4 Mar 2020 14:56:32 +0000 (14:56 +0000)]
Update ismt(4) man page for r358595.

Submitted by: Dmitry Luhtionov
X-MFC-With: r358595
Sponsored by: Juniper Networks, Inc

4 years agoImport ntp-4.2.8p14.
cy [Wed, 4 Mar 2020 13:59:29 +0000 (13:59 +0000)]
Import ntp-4.2.8p14.

4 years agoDon't send an uninitilised traffic class in the IPv6 header, when
tuexen [Wed, 4 Mar 2020 12:22:53 +0000 (12:22 +0000)]
Don't send an uninitilised traffic class in the IPv6 header, when
sending a TCP segment from the TCP SYN cache (like a SYN-ACK).
This fix initialises it to zero. This is correct for the ECN bits,
but is does not honor the DSCP what an application might have set via
the IPPROTO_IPV6 level socket options IPV6_TCLASS. That will be
fixed separately.

Reviewed by: Richard Scheffenegger
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D23900

4 years ago[aacraid] Add missing unmap call for SYNC mode
luporl [Wed, 4 Mar 2020 12:21:38 +0000 (12:21 +0000)]
[aacraid] Add missing unmap call for SYNC mode

This issue was observed on a PowerPC64 machine with an Adaptec RAID Controller
with PCI device ID 0x028d. After several read/write operations, the kernel was
panic'ing in bus_dmamap_sync(). This was due to a missing aac_unmap_command()
in the SYNC path.

PR: 237463
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D23668

4 years agoRestart the USB keyboard repeat timer at every valid key-press.
hselasky [Wed, 4 Mar 2020 09:46:42 +0000 (09:46 +0000)]
Restart the USB keyboard repeat timer at every valid key-press.

This fixes a regression issue after r357861.

Reported by: James Wright <james.wright@jigsawdezign.com>
PR: 224592
PR: 233884
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoif vm_pager_get_pages_async() returns an error, release the sfio->nios
chs [Wed, 4 Mar 2020 00:22:50 +0000 (00:22 +0000)]
if vm_pager_get_pages_async() returns an error, release the sfio->nios
refcount that we took earlier that represents the I/O that ended up
not being started.

Reviewed by: glebius
Approved by: imp (mentor)
Sponsored by: Netflix

4 years agosys/signalvar.h: Fix opposite boolean sense in comment
cem [Tue, 3 Mar 2020 23:15:30 +0000 (23:15 +0000)]
sys/signalvar.h: Fix opposite boolean sense in comment

Correct the sense of the comment describing sigsetmasked() to match the
code.  It was exactly backwards.

While here, convert the type/values of the predicate from pre-C99 int/1/0 to
bool/true/false.  No functional change.

4 years agoAdd Atom C3000 (Denverton) SMT PCI ID
jhibbits [Tue, 3 Mar 2020 22:23:56 +0000 (22:23 +0000)]
Add Atom C3000 (Denverton) SMT PCI ID

MFC after: 3 days
Sponsored by: Juniper Networks, Inc

4 years agodumpon: skip size check if using zstd
vangyzen [Tue, 3 Mar 2020 22:14:23 +0000 (22:14 +0000)]
dumpon: skip size check if using zstd

As with gzip, let the dump device be smaller than physical memory
when using zstd and full dumps.

Also print the error message if the size check fails, even if -v
is not specified.  Failing silently is not friendly.

Reviewed by: cem markj
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D23923

4 years agoUse ifr_data_get_ptr() consistently.
brooks [Tue, 3 Mar 2020 18:58:43 +0000 (18:58 +0000)]
Use ifr_data_get_ptr() consistently.

4 years agoExpose ifr_buffer_get_(buffer|length) outside if.c.
brooks [Tue, 3 Mar 2020 18:05:11 +0000 (18:05 +0000)]
Expose ifr_buffer_get_(buffer|length) outside if.c.

This is a preparatory commit for D23933.

Reviewed by: jhb

4 years agoGet rid of silly /* FALLTHROUGH */ lines
imp [Tue, 3 Mar 2020 17:40:29 +0000 (17:40 +0000)]
Get rid of silly /* FALLTHROUGH */ lines

Consistently omit /* FALLTHROUGH */ when we have a case statement that does
nothing. Since compilers don't warn about stacked case statements, and we were
inconsistent, resolve by removing extras.

4 years agoSkip if_epair regression test if module doesn't exist
olivier [Tue, 3 Mar 2020 17:35:15 +0000 (17:35 +0000)]
Skip if_epair regression test if module doesn't exist

Approved by: kp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D23876

4 years agoWhen closing a LinuxKPI file always use the real release function to avoid
hselasky [Tue, 3 Mar 2020 15:49:34 +0000 (15:49 +0000)]
When closing a LinuxKPI file always use the real release function to avoid
resource leakage when destroying a LinuxKPI character device.

Submitted by: Andrew Boyer <aboyer@pensando.io>
Reviewed by: kib@
PR: 244572
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix dynamic redrects by adding forgotten RTF_HOST flag.
melifaro [Tue, 3 Mar 2020 15:33:43 +0000 (15:33 +0000)]
Fix dynamic redrects by adding forgotten RTF_HOST flag.
Improve tests to verify the generated route flags.

Reported by: jtl
MFC after: 2 weeks

4 years agoFix the spelling of aliasing.
andrew [Tue, 3 Mar 2020 15:31:40 +0000 (15:31 +0000)]
Fix the spelling of aliasing.

Sponsored by: Innovate UK

4 years agoMove the arm64 cache identification to identcpu.c
andrew [Tue, 3 Mar 2020 15:25:01 +0000 (15:25 +0000)]
Move the arm64 cache identification to identcpu.c

This allows us to call it on a per-CPU basis and to warn if the details
are different across CPUs.

While here read the L1 I-Cache type and store this for use later by pmap.

Sponsored by: Innovate UK

4 years agoIncrease number of write completion threads, matching ZoL.
mav [Tue, 3 Mar 2020 15:05:13 +0000 (15:05 +0000)]
Increase number of write completion threads, matching ZoL.

Our iSCSI benchmarks on a large 80-core system show that previous limit
of 8 threads can be a bottleneck.  At some points this change increases
write IOPS by as much as 50%.  I am still not sure that so many threads
is really required, but we tested lower amounts and got no significant
benefits, while latencies were a bit worse, so decided to not diverge.

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

4 years agotcp_hpts: make RSS kernel compile again.
bz [Tue, 3 Mar 2020 14:15:30 +0000 (14:15 +0000)]
tcp_hpts: make RSS kernel compile again.

Add proper #includes, and #ifdefs and some style fixes to make RSS
kernels compile again.  There are still possible issues with uin16_t
vs. uint_t cpuid which I am not going near.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D23726

4 years agoupic_ktrls: make RSS compile again here
bz [Tue, 3 Mar 2020 14:07:44 +0000 (14:07 +0000)]
upic_ktrls: make RSS compile again here

The results of ktls_get_cpu() are stored in u_int and NETISR_CPUID_NONE
requires u_int.  Adjust uint16_t to uint_t in order to make RSS kernels
compile some more again.

HPTS still has to be fixed, which is a bit more complicated.

Reviewed by: jhb, gallatin, rrs
Differential Revision: https://reviews.freebsd.org/D23726

4 years agoip6: retire in6_selectroute_fib() as promised 8 years ago
bz [Tue, 3 Mar 2020 13:48:12 +0000 (13:48 +0000)]
ip6: retire in6_selectroute_fib() as promised 8 years ago

In r231852 I added in6_selectroute_fib() as a compat function with the
fibnum as an extra argument compared to in6_selectroute() to keep the
KPI stable.
Way too late retire this function again and add the fib to in6_selectroute()
which also only has a single consumer now and was an orphan function before.

4 years agopowerd.8: Improve style & fix typos
0mp [Tue, 3 Mar 2020 13:25:08 +0000 (13:25 +0000)]
powerd.8: Improve style & fix typos

- Sort options.
- Do not use macros (like .Ar) to specify width for Bl (macros within that
  string are not expanded).
- Use Cm instead of Ar for mode names.
- Fix some typos reported by mandoc.
- Move the documentation of the PID file from the -P flag description to
  the FILES section.

Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D23941

4 years agoFix the spelling of the VIPT cache type field
andrew [Tue, 3 Mar 2020 12:50:45 +0000 (12:50 +0000)]
Fix the spelling of the VIPT cache type field

Sponsored by: Innovate UK

4 years agoip6_output: use new routing KPI when not passed a cached route
bz [Tue, 3 Mar 2020 11:32:47 +0000 (11:32 +0000)]
ip6_output: use new routing KPI when not passed a cached route

Implement the equivalent of r347375 (IPv4) for the IPv6 output path.
In IPv6 we get passed a cached route (and inp) by udp6_output()
depending on whether we acquired a write lock on the INP.
In case we neither bind nor connect a first UDP packet would come in
with a cached route (wlocked) and all further packets would not.
In case we bind and do not connect we never write-lock the inp.

When we do not pass in a cached route, rather than providing the
storage for a route locally and pass it over the old lookup code
and down the stack, use the new route lookup KPI and acquire all
details we need to send the packet.

Compared to the IPv4 code the IPv6 code has a couple of possible
complications: given an option with a routing hdr/caching route there,
and path mtu (ro_pmtu) case which now equally has to deal with the
possibility of having a route which is NULL passed in, and the
fwd_tag in case a firewall changes the next hop (something to
factor out in the future).

Sponsored by: Netflix
Reviewed by: glebius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D23886