PC-BSD/trueos 7bbf607contrib/llvm/lib/Demangle ItaniumDemangle.cpp, contrib/llvm/lib/Target/X86 X86ISelLowering.cpp X86InstrAVX512.td

Merge branch 'master' of https://github.com/freebsd/freebsd into trueos-master

PC-BSD/trueos 14cfae9usr.sbin/bhyve pci_virtio_scsi.c bhyve.8

Allow CTL device specification in bhyve virtio-scsi.

There was a large refactoring done in CTL to allow multiple ioctl frontend
ports (and respective devices) to be created, particularly for bhyve.
Unfortunately, respective part of bhyve functionality got lost somehow from
the original virtio-scsi commit.  This change allows wanted device path to
be specified in either of two ways:
 -s 6,virtio-scsi,/dev/cam/ctl1.1
 -s 6,virtio-scsi,dev=/dev/cam/ctl2.3
If neither is specified, the default /dev/cam/ctl device is used.

While there, remove per-queue CTL device opening, which makes no sense at
this point.

Reported by:    wg
Reviewed by:    araujo
MFC after:      3 days
Sponsored by:   iXsystems, Inc.
Differential Revision:  https://reviews.freebsd.org/D18504

PC-BSD/trueos 7e31d1dsys/cddl/compat/opensolaris/kern opensolaris_policy.c, sys/fs/ext2fs ext2_vnops.c

Remove unused argument to priv_check_cred.

Patch mostly generated with cocinnelle:

@@
expression E1,E2;
@@

- priv_check_cred(E1,E2,0)
+ priv_check_cred(E1,E2)

Sponsored by:   The FreeBSD Foundation

PC-BSD/trueos d41b4eccontrib/llvm/lib/Demangle ItaniumDemangle.cpp, contrib/llvm/lib/Target/X86 X86ISelLowering.cpp X86InstrAVX512.td

Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
the upstream release_70 branch r348686 (effectively, 7.0.1 rc3).  The
release will follow very soon, but no more functional changes are
expected.

Release notes for llvm, clang and lld 7.0.0 are available here:
<http://releases.llvm.org/7.0.0/docs/ReleaseNotes.html>
<http://releases.llvm.org/7.0.0/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/7.0.0/tools/lld/docs/ReleaseNotes.html>

PR:            230240, 230355
Relnotes:       yes
MFC after:      2 months

PC-BSD/trueos 2e14ce7contrib/wpa/src/ap wpa_auth_ft.c dpp_hostapd.c, contrib/wpa/src/common dpp.c qca-vendor.h

Merge pull request #233 from miwi-fbsd/trueos-master

Sync with FreeBSD to fix CVE-2018-17160

PC-BSD/trueos e870850sys/net iflib.c

Fix !tx_abdicate error from r336560

r336560 was supposed to restore pre-r323954 behaviour when tx_abdicate is
not set (the default case). However, it appears that rather than the drainage
check being made conditional on tx_abdicate being set, it was duplicated
so it occured twice if tx_abdicate was set and once if it was not.

Now when !tx_abdicate, drainage is only checked if the doorbell isn't
pending.

Reported by:    lev
MFC after:      1 week
Sponsored by:   Limelight Networks
DeltaFile
+0-1sys/net/iflib.c
+0-11 files

PC-BSD/trueos 7120659. UPDATING ObsoleteFiles.inc

Set tentative merge date, and add UPDATING note.

PC-BSD/trueos 9be8abasys/security/audit audit.h

audi: replace open-coded TDP_AUDITREC checks with the macro

Sponsored by:   The FreeBSD Foundation

PC-BSD/trueos b598872sys/x86/x86 ucode.c

Fix the PAE kernel gcc build.

The error was caused by map_ucode() casting a vm_paddr_t to a void *.
Use a uintptr_t instead to match the caller.  Fix some style bugs while
here.

Reported by:    bde
Reviewed by:    bde
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
DeltaFile
+10-8sys/x86/x86/ucode.c
+10-81 files

PC-BSD/trueos 1b02aefsys/dev/asmc asmcvar.h asmc.c

asmc: Add Support for MacBookAir 7,1 and 7,2

PR:            226172
Submitted by:   James Wright <james.wright at jigsawdezign.com>
Reported by:    James Wright <james.wright at jigsawdezign.com>
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18396

PC-BSD/trueos ba8523csys/kern kern_descrip.c

fd: dedup code in sys_getdtablesize

Sponsored by:   The FreeBSD Foundation

PC-BSD/trueos 5936383sys/kern kern_resource.c, sys/sys resourcevar.h

Make lim_cur inline if possible.

It is a function call only to accomodate *some* ABIs which install a hook.
They only care for 3 types of limits: DATA, STACK, VMEM

Instead of always calling the func, see at compilation time if the requested
limit is something else and just do the read if so.

Sponsored by:   The FreeBSD Foundation

PC-BSD/trueos 45f96absys/kern kern_descrip.c

fd: tidy up closing a fd

- avoid a call to knote_close in the common case
- annotate mqueue as unlikely

Sponsored by:   The FreeBSD Foundation

PC-BSD/trueos 78cf9b9sys/kern kern_descrip.c

fd: stop looking for exact freefile after allocation

If a lower fd is closed later, the lookup goes to waste. Allocation
always performs the lookup anyway.

Sponsored by:   The FreeBSD Foundation

PC-BSD/trueos 3e3733asys/arm64/acpica acpi_machdep.c

Only read the ACPI proximity tabled on arm64 when we are booting from
ACPI.

Sponsored by:   DARPA, AFRL

PC-BSD/trueos 30c4d65share/vt/keymaps uk.macbook.kbd, stand/powerpc/uboot ppc64_elf_freebsd.c

Merge ^/head r341764 through r341812.

PC-BSD/trueos 3140f98share/mk src.opts.mk

For arm and armv6, only enable LLVM target support for arm by default,
to shrink libllvm.a.

This is a workaround for "relocation truncated to fit" errors with BFD
ld 2.17.50 on arm and armv6, when linking executables against it.

The required range extensions are not yet supported by this very old
version of BFD ld.  When arm and armv6 userland can be successfully
linked by lld, this workaround can be removed.

PC-BSD/trueos 1fcf9e5sys/dev/ahci ahci_pci.c

Remove questionable initialization for ICH8M, rely on BIOS to properly
initialize the controller.

According to the datasheet, the old code checks if port 2 (P2E, 0x4) was
the only enabled port (except port 0, which was ignored by mask 0xfe),
and issue a write to the PCS register to disable all but port 0, right
before ahci_ctlr_reset.

Some other operating systems would issue a port enable to all ports, but
since the current code only does the special initialization for ICH8M,
it entirely and rely on BIOS to do the right thing (the alternative
would be https://reviews.freebsd.org/D18300?id=50922 , should we see
reports that we really need to do it).

Reviewed by:    mav
MFC after:      3 months
Differential Revision:  https://reviews.freebsd.org/D18300

PC-BSD/trueos 28de053sys/kern kern_thread.c, sys/x86/x86 mp_x86.c

Free bootstacks after AP startup.

Bootstacks are unused after APs executed sched_throw() in
init_secondary_tail() and started executing on proper idle thread
stack.  Add sysinit that detects that the idle thread for each CPU was
scheduled at least once, and free corresponding bootstack.

Slight addition of the code (~200 bytes) is compensated by the saving,
because even on typical small modern desktop CPU we leak 128K of
memory otherwise (4 pages x 8 threads).

Reviewed by:    jhb
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D18486

PC-BSD/trueos 4045451lib/libc/sys getfh.2, sys/kern vfs_syscalls.c

Remove special case handling for getfhat(fd, NULL, handle).

There is no reason for it to behave differently from openat(fd, NULL).
Also the handling did not worked because the substituted path was from
the system address space, causing EFAULT.

Submitted by:   Jack Halford <jack at gandi.net>
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D18501

PC-BSD/trueos 2918dccsys/riscv/riscv pmap.c

Remove an unused malloc(9) type.

MFC after:      1 week
Sponsored by:   The FreeBSD Foundation

PC-BSD/trueos 32498fdsys/riscv/riscv pmap.c

Use inline tests for individual PTE bits in the RISC-V pmap.

Inline tests for PTE_* bits are easy to read and don't really require a
predicate function, and predicates which operate on a pt_entry_t are
inconvenient when working with L1 and L2 page table entries.

Reviewed by:    jhb
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D18461
DeltaFile
+20-51sys/riscv/riscv/pmap.c
+20-511 files

PC-BSD/trueos 6122d43share/vt/keymaps uk.macbook.kbd INDEX.keymaps

Add uk.macbook.kbd keymap (vt)

PR:            215185
Submitted by:   James Wright <james.wright at jigsawdezign.com>
Reported by:    James Wright <james.wright at jigsawdezign.com>
Reviewed by:    emaste (earlier version)
MFC after:      1 week
Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D18395

PC-BSD/trueos 5b0ef9csys/powerpc/booke locore.S

powerpc/booke: Don't get and use the load offset for TOC on APs

The code was a near exact copy of the code in startup, but it doesn't need
the complexity since the kernel is already relocated.  With
VM_MIN_KERNEL_ADDRESS as currently set to KERNBASE, this doesn't cause a
problem, because it's a zero offset.  However, when KERNBASE is changed to a
physical load address, it then has a non-zero offset, and ends up with an
invalid stack pointer, causing the AP to hang.

PC-BSD/trueos 46a4fa6libexec/rc rc.subr

rc.subr: Implement list_vars without using 'read'

'read' pessimistically read(2)s one byte at a time, which can be quite
silly for large environments in slow emulators.

In my boring user environment, truss shows that the number of read()
syscalls to source rc.subr and invoke list_vars is reduced by something like
3400 to 60.  ministat(1) shows a significant time difference of about -71%
for my environment.

Suggested by:   jilles
Discussed with: dteske, jhb, jilles
Differential Revision:  https://reviews.freebsd.org/D18481
DeltaFile
+19-7libexec/rc/rc.subr
+19-71 files

PC-BSD/trueos 934f800usr.bin/truss main.c

Validate the string size parameter passed to -s.

Use strtonum() to reject negative sizes instead of core dumping.

PR:            232206
Submitted by:   David Carlier <devnexen at gmail.com>
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D17537

PC-BSD/trueos da25748sys/mips/conf ADM5120.hints IDT.hints

Remove stray hints files.

PC-BSD/trueos 7b28e77sys/kern kern_sig.c, tests/sys/kern ptrace_test.c

Don't report stale signal information for non-signal events in ptrace_lwpinfo.

Once a signal's siginfo was copied to 'td_si' as part of the signal
exchange in issignal(), it was never cleared.  This caused future
thread events that are reported as SIGTRAP events without signal
information to report the stale siginfo in 'td_si'.  For example, if a
debugger created a new process and used SIGSTOP to stop it after
PT_ATTACH, future system call entry / exit events would set PL_FLAG_SI
with the SIGSTOP siginfo in pl_siginfo.  This broke 'catch syscall' in
current versions of gdb as it assumed PL_FLAG_SI with SIGTRAP
indicates a breakpoint or single step trap.

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

PC-BSD/trueos 2243bfesbin/ipfw ipfw2.c

Rework how protocol number is tracked in rule. Save it when O_PROTO
opcode will be printed. This should solve the problem, when protocol
name is not printed in `ipfw -N show`.

Reported by:    Claudio Eichenberger <cei at yourshop.com>
MFC after:      1 week
DeltaFile
+6-10sbin/ipfw/ipfw2.c
+6-101 files

PC-BSD/trueos 4e62948sbin/ipfw ipfw2.c

Use correct size for IPv4 address in gethostbyaddr().

When u_long is 8 bytes, it returns EINVAL and 'ipfw -N show' doesn't work.

Reported by:    Claudio Eichenberger <cei at yourshop.com>
MFC after:      1 week
DeltaFile
+2-1sbin/ipfw/ipfw2.c
+2-11 files

PC-BSD/trueos 38e00d5sys/powerpc/aim aim_machdep.c, sys/powerpc/include trap.h

ppc64: handle exception 0x1500 (soft patch)

This change adds a hypervisor trap handler for exception 0x1500 (soft patch),
normalizing all VSX registers and returning.
This avoids a kernel panic due to unknown exception.

Change made with the collaboration of leonardo.bianconi_eldorado.org.br,
that found out that this is a hypervisor exception and not a supervisor one,
and fixed this in the code.

Reviewed by:    jhibbits, sbruno
Differential Revision:  https://reviews.freebsd.org/D17806

PC-BSD/trueos 13b1c7a. Makefile.inc1

Clean stale wpa dependencies and objects after r341759

The wpa update added some source files with the same name as a file in
another directory (found via .PATH in the previous version).  Having a
stale entry in a .depend file means the new file won't be built, so test
for this case and if found remove all of wpa's dependency files.

MFC with:       r341759
Sponsored by:   The FreeBSD Foundation
DeltaFile
+8-0Makefile.inc1
+8-01 files

PC-BSD/trueos 1f9b1e2sbin/ping ping.c

ping(8): add space after "<=" as per style(9).

MFC after:      1 week
X-MFC-with:     r341768
DeltaFile
+1-1sbin/ping/ping.c
+1-11 files

PC-BSD/trueos b2b1b70sys/compat/linuxkpi/common/include/asm atomic.h atomic-long.h

Remove no longer needed ifdefs in the LinuxKPI, after r341787.

Differential Revision:  https://reviews.freebsd.org/D18450
Reviewed by:           kib@
MFC after:             3 days
Sponsored by:          Mellanox Technologies

PC-BSD/trueos dd98a57sys/arm/include atomic.h, sys/mips/include atomic.h

Implement atomic_swap_xxx() for all platforms.

Differential Revision:  https://reviews.freebsd.org/D18450
Reviewed by:           kib@
MFC after:             3 days
Sponsored by:          Mellanox Technologies

PC-BSD/trueos 2d987basys/dev/rtwn/usb rtwn_usb_attach.h, sys/dev/usb usbdevs

rtwn, rsu: add more USB ids.

PR:            233638
Submitted by:   cezary.sliwa at gmail.com
MFC after:      3 days

PC-BSD/trueos 9aa88ecsys/dev/sfxge sfxge_tx.c sfxge_ev.c

sfxge(4): use n Tx queues instead of n + 2 on EF10 HW

On EF10 HW we can avoid sending packets without checksum offload
or with IP-only checksum offload to dedicated queues. Instead, we
can use option descriptors to change offload policy on any queue
during runtime. Thus, we don't need to create two dedicated queues.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18390

PC-BSD/trueos b3dce2dsys/dev/sfxge sfxge.c sfxge_tx.c

sfxge(4): prepare the number of Tx queues on event queue 0 to become variable

The number of Tx queues on event queue 0 can depend on the NIC family type,
and this property will be leveraged by future patches.
This patch prepares the code for this change.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18389

PC-BSD/trueos 641fe35sys/dev/sfxge/common efx_nic.c efx.h

sfxge(4): report support for Tx checksum op descriptors

FreeBSD driver needs a patch to provide a means for packets
which do not need checksum offload but have flow ID set
to avoid hitting only the first Tx queue (which has been used
for packets not needing checksum offload).

This should be possible on Huntington, Medford or Medford2 chips
since these support toggling checksum offload on any given queue
dynamically by means of pushing option descriptors.

The patch for FreeBSD driver will then need a means to figure out
whether the feature can be used, and testing adapter family might
not be a good solution.

This patch adds a feature bit specifically to indicate support
for checksum option descriptors. The new feature bits may have
more users in future, apart from the mentioned FreeBSD patch.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18388

PC-BSD/trueos 61f3f70sys/dev/sfxge sfxge_ev.c sfxge.h

sfxge(4): populate per-event queue stats in sysctl

In order to find out why the first event queue and corresponding
interrupt is triggered more frequent, it is useful to know which
events go to each event queue.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18418

PC-BSD/trueos b73b2f4sys/powerpc/mpc85xx platform_mpc85xx.c

powerpc/booke: Replace a logical equivalent of pmap_kextract() with a real call

No sense in reinventing the wheel here.  AP bringup is not a time-critical
point.

PC-BSD/trueos 52d83c9contrib/wpa/src/ap wpa_auth_ft.c dpp_hostapd.c, contrib/wpa/src/common dpp.c qca-vendor.h

Merge remote-tracking branch 'freebsd/master' into trueos-master

PC-BSD/trueos c9a454e. Jenkinsfile README.md

Merge remote-tracking branch 'trueos/trueos-master' into trueos-master
DeltaFile
+6-0Jenkinsfile
+1-1README.md
+7-12 files

PC-BSD/trueos f71d2bdstand/powerpc/uboot ppc64_elf_freebsd.c conf.c

powerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernels

This is just a copy of powerpc/ofw's ppc64_elf_freebsd.c modified to fit
ubldr's boot format.

MFC after:      1 week

PC-BSD/trueos 0887da2sys/modules Makefile

Fix typo in powerpcspe name.

PC-BSD/trueos 568f85fsys/cam/scsi scsi_all.c

Send a START UNIT command when a disk responds with an ASC of 04/1C.
This will hopefully spin up a disk that's in low-power mode.

Sponsored by: Netflix
Submitted by: scottl@

PC-BSD/trueos bac3d63sbin/ping ping.c

ping(8): remove needless comparision with LONG_MAX
after unsigned long ultmp changed to long ltmp in r340245.

MFC after:      1 week
DeltaFile
+1-1sbin/ping/ping.c
+1-11 files

PC-BSD/trueos c7fad43. README.md

TRUEOS-1: Fix Badge URL

Fixes broken build bage
DeltaFile
+1-1README.md
+1-11 files

PC-BSD/trueos af34503sys/kern subr_blist.c

blst_leaf_alloc updates bighint for a leaf when an allocation is successful
and includes the last block represented by the leaf.  The reasoning is that,
if the last block is included, then there must be no solution before that
one in the leaf, so the leaf cannot provide an allocation that big again;
indeed, the leaf cannot provide a solution bigger than range1.

Which is all correct, except that if the value of blk passed in did not
represent the first block of the leaf, because the cursor was pointing to
the middle of the leaf, then a possible solution before the cursor may have
been ignored, and bighint cannot be updated.

Consider the sequence allocate 63 (returning address 0), free 0,63 (freeing
that same block, and allocate 1 (returning 63).  The result is that one
block is allocated from the first leaf, and the value of bighint is 0, so
that nothing can be allocated from that leaf until the only block allocated
from that leaf is freed.  This change detects that skipped-over solution,
and when there is one it makes sure that the value of bighint is not changed
when the last block is allocated.

Submitted by:   Doug Moore <dougm at rice.edu>
Tested by:      pho
X-MFC with:     r340402
Differential Revision:  https://reviews.freebsd.org/D18474
DeltaFile
+29-16sys/kern/subr_blist.c
+29-161 files

PC-BSD/trueos 7173dd8sys/dev/md md.c

Fix devstat on md devices.

devstat_end_transaction() was called before the i/o was actually ended
(by delivering it to GEOM), so at least the i/o length was messed up.
It was always recorded as 0, so the average transaction size and the
average transfer rate was always displayed as 0.

devstat_end_transaction() was not called at all for the error case, so
there were sometimes multiple starts per end.  I didn't observe this in
practice and don't know if it did much damage.  I think it extended the
length of the i/o to the next transaction.

Reviewed by:    kib
DeltaFile
+2-2sys/dev/md/md.c
+2-21 files