]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r335844:
oshogbo [Wed, 7 Nov 2018 20:31:36 +0000 (20:31 +0000)]
MFC r335844:

  core(5): overwrite the oldest core dump

  The '%I' format in the kern.corefile sysctl limits the number of
  core files that a process can generate to the number stored in the
  debug.ncores sysctl. The '%I' format is replaced by the single digit
  index. Previously, if all indexes were taken the kernel would overwrite
  only a core file with the highest index in a filename.
  Currently the system will create a new core file if there is a free
  index or if all slots are taken it will overwrite the oldest one.

  Reviewed by:  kib(code), bcr (updating)
  Differential Revision:        https://reviews.freebsd.org/D15991
  Differential Revision:        https://reviews.freebsd.org/D16084

5 years agoMFC r339896:
kib [Wed, 7 Nov 2018 18:33:09 +0000 (18:33 +0000)]
MFC r339896:
Initialize ifunc calling machinery earlier.

5 years agoMFC r339892:
kib [Wed, 7 Nov 2018 18:32:10 +0000 (18:32 +0000)]
MFC r339892:
Clarify explanation of VFCF_SBDRY.

5 years agoMFC r340137: rtld: move relro enforcement after ifunc processing
emaste [Wed, 7 Nov 2018 18:12:18 +0000 (18:12 +0000)]
MFC r340137: rtld: move relro enforcement after ifunc processing

Previously the combination of relro (implicit), -z now and ifunc use
resulted in a segfault when applying ifuncs after relro (test binary
here just calls amd64_get_fsbase()):

| % env LD_DEBUG=1 libexec/rtld-elf/obj/ld-elf.so.1 a.out
| ...
| enforcing main obj relro
| ...
| resolving ifuncs
| reloc_jmpslot: *0x203198 = 0x189368ea4570
| zsh: bus error (core dumped)  LD_DEBUG=1 obj/ld-elf.so.1 ~/a.out

5 years agoMFC r339595: nfsrvd_readdirplus: for some errors, do not fail the entire request
avg [Tue, 6 Nov 2018 14:21:26 +0000 (14:21 +0000)]
MFC r339595: nfsrvd_readdirplus: for some errors, do not fail the entire request

Sponsored by: Panzura

5 years agoMFC r339591: ichwd: add support for TCO watchdog timer in Lewisburg PCH (C620)
avg [Tue, 6 Nov 2018 13:54:24 +0000 (13:54 +0000)]
MFC r339591: ichwd: add support for TCO watchdog timer in Lewisburg PCH (C620)

PR: 222079
Relnotes: maybe
Sponsored by: Panzura

5 years agoMFC r306024: mrsas: update for sys/capability.h rename
emaste [Tue, 6 Nov 2018 12:57:38 +0000 (12:57 +0000)]
MFC r306024: mrsas: update for sys/capability.h rename

Also followup fix in r312672 by jkim.

5 years agoMFC r306023: auditdistd: update for sys/capability.h rename
emaste [Tue, 6 Nov 2018 12:52:58 +0000 (12:52 +0000)]
MFC r306023: auditdistd: update for sys/capability.h rename

Reported by: dhw

5 years agoMFC r312758: Add sys/capability.h deprecation warning
emaste [Mon, 5 Nov 2018 22:26:57 +0000 (22:26 +0000)]
MFC r312758: Add sys/capability.h deprecation warning

In r263232 sys/capability.h was renamed to sys/capsicum.h, to avoid
conflicts with a capability.h header found on other operating systems.

Reported by: antoine
Sponsored by: The FreeBSD Foundation

5 years agoe1000: Don't use 9k jumbo clusters
mmacy [Mon, 5 Nov 2018 06:59:41 +0000 (06:59 +0000)]
e1000: Don't use 9k jumbo clusters

Backported to 11-STABLE from 12-CURRENT.
Avoids the issue with 9k jumbo cluster fragmentation
by maxing out at page size jumbo clusters for RX mbufs.

Submitted by: Ryan Moeller
Reviewed by: erj@
Differential Revision: https://reviews.freebsd.org/D16534

5 years agoBackport of r338074 - generalize uart_bus_probe and add SNPS support to x86
mmacy [Sun, 4 Nov 2018 23:28:56 +0000 (23:28 +0000)]
Backport of r338074 - generalize uart_bus_probe and add SNPS support to x86

Submitted by: Rajesh Kumar
Differential Revision: https://reviews.freebsd.org/D17381

5 years agoMFC r337904:
bz [Fri, 2 Nov 2018 15:02:44 +0000 (15:02 +0000)]
MFC r337904:

  Allow the use of TCP instead of UDP for queries by setting options usevc
  in resolv.conf which sets RES_USEVC.

  Reviewed by: ume

5 years agoMFC r330795:
bz [Fri, 2 Nov 2018 14:59:52 +0000 (14:59 +0000)]
MFC r330795:

  The vmresult table was missing most of the values apart from two due to
  extra "_" in the names we grep for. Add the "_" to the pattern.

  Reviewed by: jhb
  Sponsored by: iXsystems, Inc.

5 years agoMFC r339931,r339933
bz [Fri, 2 Nov 2018 14:15:52 +0000 (14:15 +0000)]
MFC r339931,r339933

  As a follow-up to r339930 and various reports implement logging in case
  we fail during module load because the pcpu or vnet module sections are
  full.  We did return a proper error but not leaving any indication to
  the user as to what the actual problem was.

PR: 228854

5 years agoMFC r339431:
bz [Fri, 2 Nov 2018 14:13:31 +0000 (14:13 +0000)]
MFC r339431:

  In r78161 the lookup_set linker method was introduced which optionally
  returns the section start and stop locations as well as a count if the
  caller asks for them.
  There was only one out-of-file consumer of count which did not actually
  use it and hence was eliminated in r339407.
  In r194784 parse_dpcpu(), and in r195699 parse_vnet() (a copy of the
  former) started to use the link_elf_lookup_set() interface internally
  also asking for the count.

  count is computed as the difference of the void **stop - void **start
  locations and as such, if the absoulte numbers
   (stop - start) % sizeof(void *) != 0
  a round-down happens, e.g., **stop 0x1003 - **start 0x1000 => count 0.

  To get the section size instead of "count is the number of pointer
  elements in the section", the parse_*() functions do a
   count *= sizeof(void *).
  They use the result to allocate memory and copy the section data
  into the "master" and per-instance memory regions with a size of
  count.

  As a result of count possibly round-down this can miss the last
  bytes of the section.  The good news is that we do not touch
  out of bounds memory during these operations (we may at a later stage
  if the last bytes would overflow the master sections).
  Given relocation in elf_relocaddr() works based on the absolute
  numbers of start and stop, this means that we can possibly try to
  access relocated data which was never copied and hence we get
  random garbage or at best zeroed memory.

  Stop the two (last) consumers of count (the parse_*() functions)
  from using count as well, and calculate the section size based on
  the absolute numbers of stop and start and use the proper size for
  the memory allocation and data copies.  This will make the symbols
  in the last bytes of the pcpu or vnet sections be presented as
  expected.

PR: 232289

5 years agoMFC r339407:
bz [Fri, 2 Nov 2018 14:10:29 +0000 (14:10 +0000)]
MFC r339407:

  The countp argument passed to linker_file_lookup_set() in
  linker_load_dependencies() is unused, so no need to ask for the
  value in first place.  Remove the unused "count" variable.

5 years agoMFC r339930:
bz [Fri, 2 Nov 2018 14:07:06 +0000 (14:07 +0000)]
MFC r339930:

  With more excessive use of modules, more kernel parts working with
  VIMAGE, and feature richness and global state increasing the 8k of
  vnet module space are no longer sufficient for people and loading
  multiple modules, e.g., pf(4) and ipl(4) or ipsec(4) will fail on
  the second module.

  Increase the module space to 8 * PAGE_SIZE which should be enough
  to hold multiple firewalls, ipsec, multicast (as in the old days was
  a problem), epair, carp, and any kind of other vnet enabled modules.

  Sadly this is a global byte array part of the vnet_set, so we cannot
  dynamically change its size;  otherwise a TUNABLE would have been
  a better solution.

PR: 228854

5 years agoMFC 338813: Clear all of the VFP state in fill_fpregs().
jhb [Thu, 1 Nov 2018 20:42:54 +0000 (20:42 +0000)]
MFC 338813: Clear all of the VFP state in fill_fpregs().

Zero the entire FP register set structure returned for ptrace() if a
thread hasn't used FP registers rather than leaking garbage in the
fp_sr and fp_cr fields.

5 years agoMFC 338360,338415,338624,338630,338631,338725: Dynamic x86 IRQ layout.
jhb [Thu, 1 Nov 2018 18:34:26 +0000 (18:34 +0000)]
MFC 338360,338415,338624,338630,338631,338725: Dynamic x86 IRQ layout.

338360:
Dynamically allocate IRQ ranges on x86.

Previously, x86 used static ranges of IRQ values for different types
of I/O interrupts.  Interrupt pins on I/O APICs and 8259A PICs used
IRQ values from 0 to 254.  MSI interrupts used a compile-time-defined
range starting at 256, and Xen event channels used a
compile-time-defined range after MSI.  Some recent systems have more
than 255 I/O APIC interrupt pins which resulted in those IRQ values
overflowing into the MSI range triggering an assertion failure.

Replace statically assigned ranges with dynamic ranges.  Do a single
pass computing the sizes of the IRQ ranges (PICs, MSI, Xen) to
determine the total number of IRQs required.  Allocate the interrupt
source and interrupt count arrays dynamically once this pass has
completed.  To minimize runtime complexity these arrays are only sized
once during bootup.  The PIC range is determined by the PICs present
in the system.  The MSI and Xen ranges continue to use a fixed size,
though this does make it possible to turn the MSI range size into a
tunable in the future.

As a result, various places are updated to use dynamic limits instead
of constants.  In addition, the vmstat(8) utility has been taught to
understand that some kernels may treat 'intrcnt' and 'intrnames' as
pointers rather than arrays when extracting interrupt stats from a
crashdump.  This is determined by the presence (vs absence) of a
global 'nintrcnt' symbol.

This change reverts r189404 which worked around a buggy BIOS which
enumerated an I/O APIC twice (using the same memory mapped address for
both entries but using an IRQ base of 256 for one entry and a valid
IRQ base for the second entry).  Making the "base" of MSI IRQ values
dynamic avoids the panic that r189404 worked around, and there may now
be valid I/O APICs with an IRQ base above 256 which this workaround
would incorrectly skip.

If in the future the issue reported in PR 130483 reoccurs, we will
have to add a pass over the I/O APIC entries in the MADT to detect
duplicates using the memory mapped address and use some strategy to
choose the "correct" one.

While here, reserve room in intrcnts for the Hyper-V counters.

338415:
Fix build of x86 UP kernels after dynamic IRQ changes in r338360.

338624:
msi: remove the check that interrupt sources have been added

When running as a specific type of Xen guest the hypervisor won't
provide any emulated IO-APICs or legacy PICs at all, thus hitting the
following assert in the MSI code:

panic: Assertion num_io_irqs > 0 failed at /usr/src/sys/x86/x86/msi.c:334
cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff826ffa70
vpanic() at vpanic+0x1a3/frame 0xffffffff826ffad0
panic() at panic+0x43/frame 0xffffffff826ffb30
msi_init() at msi_init+0xed/frame 0xffffffff826ffb40
apic_setup_io() at apic_setup_io+0x72/frame 0xffffffff826ffb50
mi_startup() at mi_startup+0x118/frame 0xffffffff826ffb70
start_kernel() at start_kernel+0x10

Fix this by removing the assert in the MSI code, since it's possible
to get to the MSI initialization without having registered any other
interrupt sources.

338630:
lapic: skip setting intrcnt if lapic is not present

Instead of panicking. Legacy PVH mode doesn't provide a lapic, and
since native_lapic_intrcnt is called unconditionally this would cause
the assert to trigger. Change the assert into a continue in order to
take into account the possibility of systems without a lapic.

338631:
xen: legacy PVH fixes for the new interrupt count

Register interrupts using the PIC pic_register_sources method instead
of doing it in apic_setup_io. This is now required, since the internal
interrupt structures are not yet setup when calling apic_setup_io.

338725:
Fix a regression in r338360 when booting an x86 machine without APIC.

The atpic_register_sources callback tries to avoid registering interrupt
sources that would collide with an I/O APIC.  However, the previous
implementation was failing to register IRQs 8-15 since the slave PIC
saw valid IRQs from the master and assumed an I/O APIC was present.  To
fix, go back to registering all 8259A interrupt sources in one loop when
the master's register_sources method is invoked.

PR:             229429, 130483, 231291

5 years agoMFC r339924:
hselasky [Thu, 1 Nov 2018 15:50:57 +0000 (15:50 +0000)]
MFC r339924:
Implement the dump_stack() function in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

5 years agoMFC r339923:
hselasky [Thu, 1 Nov 2018 14:43:34 +0000 (14:43 +0000)]
MFC r339923:
Implement __KERNEL_DIV_ROUND_UP() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

5 years agoMFC r339868:
hselasky [Thu, 1 Nov 2018 09:00:37 +0000 (09:00 +0000)]
MFC r339868:
Implement dma_pool_zalloc() in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

5 years agoMFhead r339643:
glebius [Wed, 31 Oct 2018 23:05:44 +0000 (23:05 +0000)]
MFhead r339643:

  Fix ipw_start(), where logic was reverted in r287197.

PR: 232554

5 years agoMFC r313557 (by bz):
markj [Wed, 31 Oct 2018 19:09:48 +0000 (19:09 +0000)]
MFC r313557 (by bz):
Allow Dtrace to be compiled into the kernel again after r313177.

PR: 232825

5 years agoMFC r339586:
bz [Wed, 31 Oct 2018 11:37:05 +0000 (11:37 +0000)]
MFC r339586:

  In bhyve's fbuf emulation improve the overall "usage" message and
  for the vga option, rather than printing the entire option string,
  only print vga (as we do for everything else).

MFC r339681:

  Allow the bhyve VNC server to listen on IPv6 for incoming connections.

  Alternatively to IPv4 address:port this will allow to listen on IPv6
  link-local (incl. scope), a specific address, or ::.  Addresses have
  to be given in RFC2732 format so that [::]:port parsing will work.

  This patch also starts to introduce WITH_INET/INET6_SUPPORT to bhyve.

PR: 232018
  Submitted by: Dave Rush (northwoodlogic.free gmail.com) (original)
  Reviewed by: Dave Rush (updated verison)

5 years agoMFC r339848: Import tzdata 2018g
philip [Wed, 31 Oct 2018 02:01:28 +0000 (02:01 +0000)]
MFC r339848: Import tzdata 2018g

5 years agoMFC 338408: Don't directly dereference a user pointer in the VPD ioctl.
jhb [Tue, 30 Oct 2018 21:31:32 +0000 (21:31 +0000)]
MFC 338408: Don't directly dereference a user pointer in the VPD ioctl.

The PCIOCLISTVPD ioctl on /dev/pci is used to fetch a list of VPD
key-value pairs for a specific PCI function.  It is used by
'pciconf -l -V'.  The list is stored in a userland-supplied buffer as
an array of variable-length structures where the key and data length
are stored in a fixed-size header followed by the variable-length
value as a byte array.  To facilitate walking this array in userland,
<sys/pciio.h> provides a PVE_NEXT() helper macro to return a pointer
to the next array element by reading the the length out of the current
header and using it to compute the address of the next header.

To simplify the implementation, the ioctl handler was also using
PVE_NEXT() when on the user address of the user buffer to compute the
user address of the next array element.  However, the PVE_NEXT() macro
when used with a user address was reading the value's length by
indirecting the user pointer.  The value was ready after the current
record had been copied out to the user buffer, so it appeared to work
on architectures where user addresses are directly dereferencable from
the kernel (all but powerpc and i386 after the 4:4 split).  The recent
enablement of SMAP on amd64 caught this violation however.  To fix,
add a variant of PVE_NEXT() for use in the ioctl handler that takes an
explicit value length.

5 years agoMFC 338148: Remove 'imen' global variable from atpic(4).
jhb [Tue, 30 Oct 2018 19:10:41 +0000 (19:10 +0000)]
MFC 338148: Remove 'imen' global variable from atpic(4).

In pre-SMPng, the global 'imen' was used to track mask state of the
hardware interrupts and was aligned to the masks used by spl*().
When the atpic code was converted to using the x86 interrupt source
abstraction, the global 'imen' was preserved by having each PIC
instance point to an individual byte in the global 'imen' to hold its
8-bit interrupt mask.  The global 'imen' is no longer used for
anything however, so rather than storing pointers in 'struct atpic',
just store the individual 8-bit mask for each PIC as a char.

While here, convert the ATPIC macro to using C99 initializers.

5 years agoMFC r339366
davidcs [Mon, 29 Oct 2018 21:09:39 +0000 (21:09 +0000)]
MFC r339366
Add support for Error Recovery

Submitted by:Vaishali.Kulkarni@cavium.com

5 years agoMFC r338734
davidcs [Mon, 29 Oct 2018 21:00:16 +0000 (21:00 +0000)]
MFC r338734

Fixed isses:
   State check before enqueuing transmit task in bxe_link_attn() routine.
   State check before invoking bxe_nic_unload in bxe_shutdown().

Submitted by:Vaishali.Kulkarni@cavium.com

5 years agoMFC 338101: Merge amd64 and i386 <machine/intr_machdep.h> headers.
jhb [Mon, 29 Oct 2018 20:21:10 +0000 (20:21 +0000)]
MFC 338101: Merge amd64 and i386 <machine/intr_machdep.h> headers.

5 years agoMFC: 339585
whu [Mon, 29 Oct 2018 15:12:15 +0000 (15:12 +0000)]
MFC: 339585

    r339585:
        Do not drop UDP traffic when TXCSUM_IPV6 flag is on

        PR:             231797
        Submitted by:   whu
        Reviewed by:    dexuan
        Obtained from:  Kevin Morse
        Sponsored by:   Microsoft
        Differential Revision:  https://bugs.freebsd.org/bugzilla/attachment.cgi?id=198333&action=diff

5 years agoMFC r339600:
hselasky [Mon, 29 Oct 2018 14:37:27 +0000 (14:37 +0000)]
MFC r339600:
Make sure returned value is checked and assert a valid refcount.
While at it fix a print: Unsigned types cannot be negative.

Reviewed by: kib, mjg
Differential revision: https://reviews.freebsd.org/D17616
Sponsored by: Mellanox Technologies

5 years agoMFC r337528: add an option for ddb ps command to print process arguments
avg [Mon, 29 Oct 2018 12:47:15 +0000 (12:47 +0000)]
MFC r337528: add an option for ddb ps command to print process arguments

Sponsored by: Panzura

5 years agoMFC r303648: Fix ddb "show proc" to show full arguments
avg [Mon, 29 Oct 2018 12:41:49 +0000 (12:41 +0000)]
MFC r303648: Fix ddb "show proc" to show full arguments

PR: 200052

5 years agoMFC r339587:
hselasky [Mon, 29 Oct 2018 12:10:06 +0000 (12:10 +0000)]
MFC r339587:
Added support for formula-based arbitrary baud rates, in contrast to
the current fixed values, which enables use of rates above 1 Mbps.
Improved the detection of HXD chips, and the status flag handling as
well.

Submitted by: Gabor Simon <gabor.simon75@gmail.com>
PR: 225932
Differential revision: https://reviews.freebsd.org/D16639
Sponsored by: Mellanox Technologies

5 years agoMFC r339740:
ae [Sun, 28 Oct 2018 18:23:13 +0000 (18:23 +0000)]
MFC r339740:
  Use correct format specificator to print setdscp action.

  PR: 232642

5 years agoFollow up on r331936. gets_s(3) will also fail in the same way that
cy [Sun, 28 Oct 2018 00:57:44 +0000 (00:57 +0000)]
Follow up on r331936. gets_s(3) will also fail in the same way that
gets(3) does. This was missed in r331936.

Reported by: emaste@

5 years agoMFH (r305124): fix case where fd_lastfile is -1.
des [Sat, 27 Oct 2018 19:08:06 +0000 (19:08 +0000)]
MFH (r305124): fix case where fd_lastfile is -1.

5 years agofix up more issues introduced by failing to have run TB
mmacy [Fri, 26 Oct 2018 08:52:22 +0000 (08:52 +0000)]
fix up more issues introduced by failing to have run TB
before r339767

5 years agofix i386 breakage caused by r339767
mmacy [Fri, 26 Oct 2018 06:12:56 +0000 (06:12 +0000)]
fix i386 breakage caused by r339767

5 years agohwpmc: Enable hwpmc support for AMD Family 17H devices
mmacy [Fri, 26 Oct 2018 05:12:56 +0000 (05:12 +0000)]
hwpmc: Enable hwpmc support for AMD Family 17H devices

Adds new counters and events for family 17H devices.
Adds libpmc support for family 17H devices.

Direct commit to 11 as this is supported by way of JSON
counter descriptions on 12 & HEAD.

Submitted by: Girish Nandibasappa
Differential Revision: https://reviews.freebsd.org/D17464

5 years agoMFC r339618:
tijl [Thu, 25 Oct 2018 16:01:19 +0000 (16:01 +0000)]
MFC r339618:

Define linuxkpi readq for 64-bit architectures.  It is used by drm-kmod.
Currently the compiler picks up the definition in machine/cpufunc.h.

Add compiler memory barriers to read* and write*.  The Linux x86
implementation of these functions uses inline asm with "memory" clobber.
The Linux x86 implementation of read_relaxed* and write_relaxed* uses the
same inline asm without "memory" clobber.

Implement ioread* and iowrite* in terms of read* and write* so they also
have memory barriers.

Qualify the addr parameter in write* as volatile.

Like Linux, define macros with the same name as the inline functions.

Only define 64-bit versions on 64-bit architectures because generally
32-bit architectures can't do atomic 64-bit loads and stores.

Regroup the functions a bit and add brief comments explaining what they do:
- __raw_read*, __raw_write*: atomic, no barriers, no byte swapping
- read_relaxed*, write_relaxed*: atomic, no barriers, little-endian
- read*, write*: atomic, with barriers, little-endian

Add a comment that says our implementation of ioread* and iowrite*
only handles MMIO and does not support port IO.

Reviewed by: hselasky

5 years agoMFC r339684:
gjb [Thu, 25 Oct 2018 15:14:16 +0000 (15:14 +0000)]
MFC r339684:
 Reduce the GCE image size to 27G to be lower than the free
 quota limit.

PR: 232313
Sponsored by: The FreeBSD Foundation

5 years agoMFC r339582:
hselasky [Thu, 25 Oct 2018 14:55:04 +0000 (14:55 +0000)]
MFC r339582:
Drop sequencer mutex around uiomove() and make sure we don't move more bytes
than is available, else a panic might happen.

Found by: Peter Holm <peter@holm.cc>
Sponsored by: Mellanox Technologies

5 years agoMFC r339581:
hselasky [Thu, 25 Oct 2018 14:34:38 +0000 (14:34 +0000)]
MFC r339581:
Fix off-by-one which can lead to panics.

Found by: Peter Holm <peter@holm.cc>
Sponsored by: Mellanox Technologies

5 years agoMFC r339584 :
slavash [Thu, 25 Oct 2018 14:10:28 +0000 (14:10 +0000)]
MFC r339584 :
mlx5: Notify user that the ConnectX-6 shutdown its port due to power limitation

If power exceed the slot limit, or slot limit is unknown the ConnectX-6
firmware will shutdown its port.
Inform the user via debug message.

Approved by:    hselasky (mentor), kib (mentor)
Sponsored by:   Mellanox Technologies

5 years agoelfcopy: avoid stripping relocations from static binaries
emaste [Thu, 25 Oct 2018 13:46:28 +0000 (13:46 +0000)]
elfcopy: avoid stripping relocations from static binaries

MFC r339350: elfcopy: delete filter_reloc, it is broken and unnecessary

elfcopy contained logic to filter individual relocations in STRIP_ALL
mode.  However, this is not valid; relocations emitted by the linker are
required, unless they apply to an entire section being removed (which is
handled by other logic in elfcopy).

Note that filter_reloc was also buggy: for RELA relocation sections it
operated on uninitialized rel.r_info resulting in invalid operation.

The logic most likely needs to be inverted: instead of removing
relocations because their associated symbols are being removed, we must
keep symbols referenced by relocations.  That said, in practice we do
not encounter this code path today: objects being stripped are either
dynamically linked binaries which retain .dynsym, or static binaries
with no relocations.

Just remove filter_reloc.  This fixes certain cases including statically
linked binaries containing ifuncs.  Stripping binaries with relocations
referencing removed symbols was already broken, and after this change
may still be broken in a different way.

MFC r339451: objcopy: restore behaviour required by GCC's build

In r339350 filter_reloc() was removed, to fix the case of stripping
statically linked binaries with relocations (which may come from ifunc
use, for example).  As a side effect this changed the behaviour when
stripping object files - the output was broken both before and after
r339350, in different ways.  Unfortunately GCC's build process relies
on the previous behaviour, so:

- Revert r339350, restoring filter_reloc().
- Fix an unitialized variable use (commited as r3638 in ELF Tool Chain).
- Change filter_reloc() to omit relocations referencing removed
  symbols, while retaining relocations with no symbol reference.
- Retain the entire relocation section if it references the dynamic
  symbol table (fix from kaiw in D17596).

PR: 232176
Sponsored by: The FreeBSD Foundation

5 years agoMFC r339509: Fix loader.conf(5) "password" feature
dteske [Wed, 24 Oct 2018 23:17:17 +0000 (23:17 +0000)]
MFC r339509: Fix loader.conf(5) "password" feature

Restore the ability to prevent the user from interrupting the boot process
without first entering the password stored in loader.conf(5).

PR: kern/207069
Reported by: david@dcrosstech.com
Sponsored by: Smule, Inc.

5 years agoMFC r339547:
kp [Wed, 24 Oct 2018 18:19:32 +0000 (18:19 +0000)]
MFC r339547:

vlan: Fix panic with lagg and vlan

vlan_lladdr_fn() is called from taskqueue, which means there's no vnet context
set. We can end up trying to send ARP messages (through the iflladdr_event
event), which requires a vnet context.

PR: 227654

5 years agoMFC r339462: make upgrade from previous FreeBSD versions less painful
eugen [Wed, 24 Oct 2018 05:14:02 +0000 (05:14 +0000)]
MFC r339462: make upgrade from previous FreeBSD versions less painful
and make previously working configuration like this work again:

gif_interfaces="gif0"
gifconfig_gif0="1.1.1.1 2.2.2.2"
ifconfig_gif0="inet 192.168.1.1 192.168.1.2 netmask 255.255.255.252"

PR: 204700

5 years agoMFC r339365:
markj [Tue, 23 Oct 2018 13:44:33 +0000 (13:44 +0000)]
MFC r339365:
Typo.

5 years agoMFC r336634: MFV CK@r336629: Import CK as of commit 1c1f9901c2dea7a883342cd03d3906a1b...
avg [Tue, 23 Oct 2018 13:12:42 +0000 (13:12 +0000)]
MFC r336634: MFV CK@r336629: Import CK as of commit 1c1f9901c2dea7a883342cd03d3906a1bc482583

This adds CK_SLIST_INSERT_PREVPTR and CK_SLIST_REMOVE_PREVPTR macros
as well as ck_pr_dec_is_zero family of functions.

5 years agoMFC r338698:
kp [Tue, 23 Oct 2018 07:24:03 +0000 (07:24 +0000)]
MFC r338698:

Significantly improve pf purge cpu usage by only taking locks
when there is work to do.  This reduces CPU consumption to one
third on systems.  This will help keep the thread CPU usage under
control now that the default hash size has increased.

5 years agoMFC r339503: Import tzdata 2018f
philip [Tue, 23 Oct 2018 01:41:07 +0000 (01:41 +0000)]
MFC r339503: Import tzdata 2018f

5 years agoMFC 338094: Fully retire the unimplemented -t option from vmstat(8).
jhb [Mon, 22 Oct 2018 21:26:37 +0000 (21:26 +0000)]
MFC 338094: Fully retire the unimplemented -t option from vmstat(8).

It was #ifdef'd out in the 4.4BSD import and hasn't been re-enabled
since then.

5 years agoMFC r334189: Import CK as of commit 0f017230ccc86929f56bf44ef2dca93d7df8076b
avg [Mon, 22 Oct 2018 15:54:28 +0000 (15:54 +0000)]
MFC r334189: Import CK as of commit 0f017230ccc86929f56bf44ef2dca93d7df8076b

This brings us the renaming of fields in ck_queue, so that our own
LIST/SLIST/TAILQ/etc won't accidentally work with them.

5 years agoMFC r339357:
ae [Mon, 22 Oct 2018 07:04:44 +0000 (07:04 +0000)]
MFC r339357:
  Add extra parentheses to fix "versrcreach" opcode, (oif != NULL) should
  not be used as condition for ternary operator.

  Submitted by: Tatsuki Makino <tatsuki_makino at hotmail dot com>

5 years agoMFC r339409, r339420:
jamie [Sat, 20 Oct 2018 16:20:36 +0000 (16:20 +0000)]
MFC r339409, r339420:

  Add a new jail permission, allow.read_msgbuf.  When true, jailed processes
  can see the dmesg buffer (this is the current behavior).  When false (the
  new default), dmesg will be unavailable to jailed users, whether root or
  not.

  The security.bsd.unprivileged_read_msgbuf sysctl still works as before,
  controlling system-wide whether non-root users can see the buffer.

PR: 211580
Submitted by: bz

5 years agoMFC r339388:
hselasky [Fri, 19 Oct 2018 08:38:34 +0000 (08:38 +0000)]
MFC r339388:
Fix for reception of large full speed isochronous frames via the transaction
translator, when using the DWC OTG USB controller driver. Make sure to re-try
getting the complete split packets until a DATA0 packet is received. Larger
isochronous frames may be split into multiple MDATA packets terminated
by a single DATA0 packet.

PR: 230434
Sponsored by: Mellanox Technologies

5 years agoMFC r339372: Skip VDEV_IO_DONE stage only for ZIO_TYPE_FREE.
mav [Fri, 19 Oct 2018 04:37:27 +0000 (04:37 +0000)]
MFC r339372: Skip VDEV_IO_DONE stage only for ZIO_TYPE_FREE.

Device removal code uses zio_vdev_child_io() with ZIO_TYPE_NULL parent,
that never happened before.  It confused FreeBSD-specific TRIM code,
which does not use VDEV_IO_DONE for logical ZIO_TYPE_FREE ZIOs.  As
result of that stage being skipped device removal ZIOs leaked references
and memory that supposed to be freed by VDEV_IO_DONE, making it stuck.

It is a quick patch rather then a nice fix, but hopefully we'll be able
to drop it all together when alternative TRIM implementation finally get
landed.

PR: 228750, 229007

5 years agoMFC r339329: Add ZIO_TYPE_FREE support for indirect vdevs.
mav [Fri, 19 Oct 2018 04:30:25 +0000 (04:30 +0000)]
MFC r339329: Add ZIO_TYPE_FREE support for indirect vdevs.

Upstream code expects only ZIO_TYPE_READ and some ZIO_TYPE_WRITE
requests to removed (indirect) vdevs, while on FreeBSD there is also
ZIO_TYPE_FREE (TRIM).  ZIO_TYPE_FREE requests do not have the data
buffers, so don't need the pointer adjustment.

PR: 228750, 229007

5 years agoMFC r339335: Avoid zero-sized kmem_alloc() in vdev_compact_children().
mav [Fri, 19 Oct 2018 04:28:30 +0000 (04:28 +0000)]
MFC r339335: Avoid zero-sized kmem_alloc() in vdev_compact_children().

The device evacuation code adds a dependency that
vdev_compact_children() be able to properly empty the vdev_child
array by setting it to NULL and zeroing vdev_children.  Under Linux,
kmem_alloc() and related functions return a sentinel pointer rather
than NULL for zero-sized allocations.

This is a part of ZoL port of device removal patch:

commit a1d477c24c7badc89c60955995fd84d311938486
Author: Matthew Ahrens <mahrens@delphix.com>
Ported-by: Tim Chase <tim@chase2k.com>
5 years agoMFC r339331:
kib [Fri, 19 Oct 2018 00:47:19 +0000 (00:47 +0000)]
MFC r339331:
bhyve: emulate CLFLUSH and CLFLUSHOPT.

5 years agoMFC r339384:
kib [Fri, 19 Oct 2018 00:44:06 +0000 (00:44 +0000)]
MFC r339384:
Add clwb().

5 years agoMFC r339013:
dim [Thu, 18 Oct 2018 19:19:45 +0000 (19:19 +0000)]
MFC r339013:

Pull in r329557 from upstream lld trunk (by George Rimar):

  [ELF] - Allow LLD to produce file symbols.

  This is for PR36716 and
  this enables emitting STT_FILE symbols.

  Output size affect is minor:
  lld binary size changes from 52,883,408 to 52,949,400
  clang binary size changes from 83,136,456 to 83,219,600

  Differential revision: https://reviews.llvm.org/D45261

This fixes a regression in lld that made it stop emitting STT_FILE
symbols, which ctfmerge relies upon to uniquify function table entries
that reference STB_LOCAL symbols.  Consequently, ctfmerge stopped
emitting entries for static functions into the function table, and
dtrace no longer gets type info for them.

Reported by: markj
PR: 230444

5 years agoDocument the krpc module requirement in 11.x that was not present
gjb [Thu, 18 Oct 2018 17:33:30 +0000 (17:33 +0000)]
Document the krpc module requirement in 11.x that was not present
in 10.x if the system has a custom kernel configuration that excludes
NFS and, for example, uses MODULES_OVERRIDE="zfs opensolaris".

Reported by: eugen (via -stable)
Sponsored by: The FreeBSD Foundation

5 years agoMFC r334375, r334379:
kp [Thu, 18 Oct 2018 04:36:25 +0000 (04:36 +0000)]
MFC r334375, r334379:

pf: Replace rwlock on PF_RULES_LOCK with rmlock

Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock with rmlock.
This change improves packet processing rate in high pps environments.
Benchmarking by olivier@ shows a 65% improvement in pps.

While here, also eliminate all appearances of "sys/rwlock.h" includes since it
is not used anymore.

Submitted by:   farrokhi@

5 years agoMFC r339211:
jamie [Wed, 17 Oct 2018 16:17:57 +0000 (16:17 +0000)]
MFC r339211:

  Fix the test prohibiting jails from sharing IP addresses.

  It's not supposed to be legal for two jails to contain the same IP address,
  unless both jails contain only that one address.  This is the behavior
  documented in jail(8), and is there to prevent confusion when multiple
  jails are listening on IADDR_ANY.

  VIMAGE jails (now the default for GENERIC kernels) test this correctly,
  but non-VIMAGE jails have been performing an incomplete test when nested
  jails are used.

5 years agoDirect commit since these files have gone away in head
imp [Wed, 17 Oct 2018 04:10:23 +0000 (04:10 +0000)]
Direct commit since these files have gone away in head

Move pc98's biosdisk.c to the new style disk access. This is missing
support in common/part.c, however, for pc98 partitions, so it's
unlikely to actually work. Lack of a pc98 machine that's in sevice
limits my ability to test, but this allows pc98 to compile again.

5 years agoDirect commit to stable, file not present in current
imp [Wed, 17 Oct 2018 02:45:15 +0000 (02:45 +0000)]
Direct commit to stable, file not present in current

Catch up to r332154: Fix d_dev removal of d_type.

5 years agoMFC r336159:
np [Wed, 17 Oct 2018 02:25:15 +0000 (02:25 +0000)]
MFC r336159:

cxgbe(4): Add a sysctl to report the chip's microprocessor's load
averages.  This works with debug or custom firmwares only.

sysctl dev.<nexus>.<instance>.loadavg
sysctl dev.t6nex.0.loadavg

5 years agoMFC r335352:
np [Wed, 17 Oct 2018 02:05:31 +0000 (02:05 +0000)]
MFC r335352:

cxgbe(4): Some mailbox commands require access to the Tx pipeline and
can time out if it's backed up due to a non-stop deluge of PAUSE frames
from a misbehaving peer.  Detect this situation and toggle MPS TxEn
to allow forward progress.

5 years agoMFC r334987:
np [Wed, 17 Oct 2018 01:59:45 +0000 (01:59 +0000)]
MFC r334987:

cxgbe(4): Remove homemade version of htobe32 from the driver.

It was needed only for ia64 where it was implemented as a call to
bswapXX, which was always a real function.  htobeXX with a constant
argument is calculated at compile-time everywhere else.

5 years agoMFC r320426:
np [Wed, 17 Oct 2018 01:49:43 +0000 (01:49 +0000)]
MFC r320426:

cxgbe/t4_tom: Do not include space taken by the TCP timestamp option in
the "effective MSS" for the connection.  The chip expects it this way.

5 years agoMFC r338254:
np [Wed, 17 Oct 2018 01:30:51 +0000 (01:30 +0000)]
MFC r338254:

cxgbe(4): Use fcmpset instead of cmpset when appropriate.

5 years agoMFC r338924:
np [Wed, 17 Oct 2018 01:20:18 +0000 (01:20 +0000)]
MFC r338924:

cxgbe(4): Link related changes.

- Switch to using 32b port/link capabilities in the driver.  The 32b
  format is used internally by firmwares > 1.16.45.0 and the driver will
  now interact with the firmware in its native format, whether it's 16b
  or 32b.  Note that the 16b format doesn't have room for 50G, 200G, or
  400G speeds.

- Add a bit in the pause_settings knobs to allow negotiated PAUSE
  settings to override manual settings.

- Ensure that manual link settings persist across an administrative
  down/up as well as transceiver unplug/replug.

- Remove unused is_*G_port() functions.

Sponsored by: Chelsio Communications

5 years agoMFC r336042:
np [Wed, 17 Oct 2018 01:05:52 +0000 (01:05 +0000)]
MFC r336042:

cxgbe(4): Assume that any unknown flash on the card is 4MB and has 64KB
sectors, instead of refusing to attach to the card.

Submitted by: Casey Leedom @ Chelsio
Sponsored by: Chelsio Communications

5 years agoMFC r333139:
np [Wed, 17 Oct 2018 00:57:28 +0000 (00:57 +0000)]
MFC r333139:

cxgbe(4): Destroy the cdev before disabling interrupts in driver detach.

Filter work requests are submitted in the nexus cdev's ioctl which then
blocks waiting for a reply.  If driver detach runs in this state and
disables interrupts the ioctl will never complete and detach will hang
in destroy_cdev.

5 years agoMFC r325840, r327811, and r329701.
np [Wed, 17 Oct 2018 00:45:01 +0000 (00:45 +0000)]
MFC r325840, r327811, and r329701.

r325840:
CXGBE: fix big-endian behaviour

The setbit/clearbit pair casts the bitfield pointer
to uint8_t* which effectively treats its contents as
little-endian variable. The ffs() function accepts int as
the parameter, which is big-endian. Use uint8_t here to
avoid mismatch, as we have only 4 doorbells.

Submitted by:          Wojciech Macek <wma@freebsd.org>
Reviewed by:           np
Obtained from:         Semihalf
Sponsored by:          QCM Technologies
Differential revision: https://reviews.freebsd.org/D13084

r327811:
CXGBE: fix get_filt to be endianness-aware

Unconditional 32-bit shift is not endianness-safe.
Modify the logic to work both on LE and BE.

Submitted by:          Wojciech Macek <wma@freebsd.org>
Reviewed by:           np
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D13102

r329701:
CXGBE: implement prefetch on non-Intel architectures

Submitted by:          Michal Stanek <mst@semihalf.com>
Obtained from:         Semihalf
Reviewed by:           np, pdk@semihalf.com
Sponsored by:          IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D14452

5 years agoMFC r320419, r337679, r338366, and r338652.
np [Wed, 17 Oct 2018 00:27:21 +0000 (00:27 +0000)]
MFC r320419, r337679, r338366, and r338652.

r320419:
cxgbe/iw_cxgbe: Disable debug output by default.  The help text for the sysctl
already says that the default is 0.

r337679:
Remove unused stuff from iw_cxgbe.h

r338366:
cxgbe/iw_cxgbe: Fix iWARP RDMA + VIMAGE operation by setting the VNET
properly in a couple of places in the driver.

r338652:
cxgbe/iw_cxgbe: Fix reported build breakage when the kernel
configuration has "device cxgbe' but no VIMAGE.

Sponsored by: Chelsio Communications

5 years agoMFC r332515:
np [Tue, 16 Oct 2018 22:13:05 +0000 (22:13 +0000)]
MFC r332515:
Fix typo in cxgbetool.8.

5 years agoMFC r330887:
np [Tue, 16 Oct 2018 22:09:33 +0000 (22:09 +0000)]
MFC r330887:
cxgbetool(8): Add the ability to decode hardware TCBs.

Sponsored by: Chelsio Communications

5 years agoMFC 326138,326436,326852: Style fixes to kdump.
jhb [Tue, 16 Oct 2018 20:53:16 +0000 (20:53 +0000)]
MFC 326138,326436,326852: Style fixes to kdump.

326138:
Use C standard spelling uint64_t for u_int64_t.

326436:
vmstat: fix style(9) violations and bump WARNS.

326852:
Re-add spaces lost in r326436.

5 years agoMFC r327254, r327904, and r328994.
np [Tue, 16 Oct 2018 19:26:04 +0000 (19:26 +0000)]
MFC r327254, r327904, and r328994.

r327254:
cxgbe/iw_cxgbe: Fix iWARP over VLANs (catch up with r326169).

r327904:
cxgbe/iw_cxgbe: Remove duplicates to fix compilation with recent gcc.

r328994:
iw_cxgbe: Remove declaration of a function that no longer exists.

Sponsored by: Chelsio Communications

5 years agoMFC r339241:
kib [Mon, 15 Oct 2018 10:50:04 +0000 (10:50 +0000)]
MFC r339241:
Disallow zero day of month from strptime("%d").

PR: 232072

5 years agoMFC r336027 (andrew): Teach binutils that arm64 is a 64bit architecture.
emaste [Sun, 14 Oct 2018 01:16:48 +0000 (01:16 +0000)]
MFC r336027 (andrew): Teach binutils that arm64 is a 64bit architecture.

This is needed to cross build from arm64 to other architectures that
use binutils.

5 years agoMFC r339288: Remove extra thread_exit() call left after r329802.
mav [Sat, 13 Oct 2018 03:12:57 +0000 (03:12 +0000)]
MFC r339288: Remove extra thread_exit() call left after r329802.

spa_condense_indirect_thread() is no longer a thread function, but just
a callback for new zthr KPI.

5 years agoMFC r339076
ken [Fri, 12 Oct 2018 19:44:19 +0000 (19:44 +0000)]
MFC r339076

This has been edited slightly from the version in head.  In head, the probe
sections of dadone() were split out into separate functions.  In stable/11,
dadone() is still a single function.

So, for stable/11, this describes the change:

sys/cam/scsi/scsi_da.c:
In the DA_CCB_PROBE_DONE case in dadone(), free the data pointer
before returning.

  ------------------------------------------------------------------------
  r339076 | ken | 2018-10-01 13:00:46 -0600 (Mon, 01 Oct 2018) | 12 lines

  Fix a da(4) driver memory leak for SCSI SMR devices.

  In the probe case for SCSI SMR Host Aware or Most Managed drives, be sure
  to free allocated memory.

  sys/cam/scsi/scsi_da.c:
   In dadone_probezone(), free the data pointer before returning.

  Sponsored by: Spectra Logic

  ------------------------------------------------------------------------

Sponsored by: Spectra Logic

5 years agoMFC r339197: Add sysctls for dbuf metadata cache variables added in r336959.
mav [Fri, 12 Oct 2018 01:11:20 +0000 (01:11 +0000)]
MFC r339197: Add sysctls for dbuf metadata cache variables added in r336959.

5 years agoMFC 338055: Remove some vestiges of IPI_LAZYPMAP on i386.
jhb [Thu, 11 Oct 2018 19:06:54 +0000 (19:06 +0000)]
MFC 338055: Remove some vestiges of IPI_LAZYPMAP on i386.

The support for lazy pmap invalidations on i386 was removed in r281707.
This removes the constant for the IPI and stops accounting for it when
sizing the interrupt count arrays.

5 years agoMFC r339237: Fix r336951 mismerge -- use of uninitialized variable.
mav [Thu, 11 Oct 2018 15:12:10 +0000 (15:12 +0000)]
MFC r339237: Fix r336951 mismerge -- use of uninitialized variable.

5 years agoMFC r339235:
hselasky [Thu, 11 Oct 2018 07:34:56 +0000 (07:34 +0000)]
MFC r339235:
Add missing steering rules for virtual function, VF, in mlx4en(4) driver.

When acting as a VF it is required to add steering rules for all unicast
addresses. Even if promiscious mode is selected. Else incoming data packets
will be dropped.

Sponsored by: Mellanox Technologies

5 years agoMFC r339181: crt: switch to standard note type definitions from elf_common.h
emaste [Thu, 11 Oct 2018 00:26:15 +0000 (00:26 +0000)]
MFC r339181: crt: switch to standard note type definitions from elf_common.h

This makes it easier to grep the source tree for these notes, and
ensures that they will remain in sync.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r338200: Adding device ID for Terratec SiXPack 5.1+.
avatar [Wed, 10 Oct 2018 22:49:52 +0000 (22:49 +0000)]
MFC r338200: Adding device ID for Terratec SiXPack 5.1+.

5 years agoDisable the KASSERT for curcpu == 0 in netisr for EARLY_AP_STARTUP.
jhb [Wed, 10 Oct 2018 21:28:04 +0000 (21:28 +0000)]
Disable the KASSERT for curcpu == 0 in netisr for EARLY_AP_STARTUP.

In the EARLY_AP_STARTUP case, thread0 can migrate to another CPU
before this SYSINIT is run.  However, the only part of this SYSINIT
that assumes it runs on CPU 0 is in the !EARLY_AP_STARTUP case when it
creates the netisr for the boot CPU.  In the EARLY_AP_STARTUP case we
start up the netisr's for the first N CPUs during the SYSINIT itself
and don't depend on running on the boot CPU for correct operation.

This is a direct comit to stable/11 as the assertion was removed as part
of a different change in r302595.

Reported by: rwatson, truckman, jkim, FreeNAS bug 45611

5 years agoMFC r333569: cpucontrol: improve Intel microcode revision check
emaste [Wed, 10 Oct 2018 15:54:01 +0000 (15:54 +0000)]
MFC r333569: cpucontrol: improve Intel microcode revision check

According to the Intel SDM (Volme 3, 9.11.7) the BIOS signature MSR
should be zeroed before executing cpuid (although in practice it does
not seem to matter).

PR: 192487
Submitted by: Dan Lukes
Reported by: Henrique de Moraes Holschuh

5 years agoMFC r333233: gpart: add fat32lba MBR partition type
emaste [Wed, 10 Oct 2018 15:44:14 +0000 (15:44 +0000)]
MFC r333233: gpart: add fat32lba MBR partition type

FAT32 partition with LBA addressing.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r338810: openssh: rename local macro to avoid OpenSSL 1.1.1 conflict
emaste [Wed, 10 Oct 2018 15:38:33 +0000 (15:38 +0000)]
MFC r338810: openssh: rename local macro to avoid OpenSSL 1.1.1 conflict

Local changes introduced an OPENSSH_VERSION macro, but this conflicts
with a macro of the same name introduced with OepnsSL 1.1.1

Sponsored by: The FreeBSD Foundation

5 years agoMFC r339019: clang: allow ifunc resolvers to accept arguments
emaste [Wed, 10 Oct 2018 15:37:10 +0000 (15:37 +0000)]
MFC r339019: clang: allow ifunc resolvers to accept arguments

Previously Clang required ifunc resolution functions to take no
arguments, presumably because GCC documented ifunc resolvers as taking
no arguments.  However, GCC accepts resolvers accepting arguments, and
our rtld passes CPU ID information (cpuid, hwcap, etc.) to ifunc
resolvers.  Just remove the check from the in-tree compiler for our in-
tree compiler.

Sponsored by: The FreeBSD Foundation