PC-BSD/trueos 8238f0fsys/contrib/dev/acpica/components/debugger dbtest.c, sys/contrib/dev/acpica/components/parser psloop.c

Merge pull request #296 from trueos/head-20190222

Head 20190222

PC-BSD/trueos f7eb832sys/contrib/dev/acpica/components/debugger dbtest.c, sys/contrib/dev/acpica/components/parser psloop.c

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

PC-BSD/trueos 1e1408asys/conf NOTES

Quick fix for building LINT on i386.  A fix is needed on all arches and
this one should also work on amd64 and sparc64.

LINT was broken in r312910 with the removal of pc98 support, by changing
the pathname in UKBD_DFLT_KEYBAP from a removed pc98 file to a nonexistent

There are many bugs nearby.  Some are:
- the error is not properly detected and handled by make(1), because
  kbdcontrol(8) exits with status 0 after failing to find the keymap file
- UKBD_DFLT_KEYBAP is supposed to be MI, and is in MI NOTES to try enforce
  this, but 5 out of 8 arches don't support it
- LINT seems to have been broken by this in only 7 out of 8 arches.  mips
  breaks test coverage instead, by killing this option in its MD NOTES.
  arm kills ukbd but that is not enough to configure an unsupported option
  used only by ukbd.
+1-11 files

PC-BSD/trueos 559f0dfusr.sbin/vidcontrol vidcontrol.c

Oops, actually fix warnings from -Wpointer-sign.

PC-BSD/trueos 426c5causr.sbin/vidcontrol vidcontrol.c

Fix warnings from -Wpointer-sign.

PC-BSD/trueos d68a469share/man/man4 syscons.4, sys/conf files NOTES

Connect the restored dumb and sc terminal emulators to the kernel build.
Add or fix options to control static and dynamic configuration.  Keep
the default of scteken, but default to statically configuring all available
emulators (now 3 instead of 1).

The dumb emulator is almost usable.  libedit and libreadline handle
dumb terminals perfectly for at least shell history.  less(1) works
as well as possible except on exit.  But curses programs make messes.
The dumb emulator has strange color support, with 2 dumb colors for
normal output but fancy colorization for the cursor, mouse pointer and
(with a non-dumb initial emulator) for low-level console output.

Using the sc emulator instead of the default of scteken fixes at least
the following bugs:
- NUL is a printing character in cons25 but not in teken
- teken doesn't support fixed colors for "reverse" video.
- The best versions of sc are about 10 times faster than scteken (for
  printing to the frame buffer).  This version is only about 5 times

Fix configuration features:
- make SC_DFLT_TERM (for setting the initial emulator) a normal option.

Add configuration features:
- negative options SC_NO_TERM_* for omitting emulators in the static config.

    [3 lines not shown]

PC-BSD/trueos aedcdb3sys/arm/allwinner axp81x.c

Add base to the warning threshold.

PC-BSD/trueos 04f9fc1sys/cddl/contrib/opensolaris/uts/intel/dtrace fasttrap_isa.c

Commit a missing piece of r344452.

MFC with:       r344452

PC-BSD/trueos 57c4e2dsys/cddl/contrib/opensolaris/uts/common/dtrace fasttrap.c, sys/cddl/contrib/opensolaris/uts/intel/dtrace fasttrap_isa.c

Fix a tracepoint lookup race in fasttrap_pid_probe().

fasttrap hooks the userspace breakpoint handler; the hook looks up the
breakpoint address in a hash table of tracepoints.  It is possible for
the tracepoint to be removed by a different thread in between the
breakpoint trap and the hash table lookup, in which case SIGTRAP gets
delivered to the target process.  Fix the problem by adding a
per-process generation counter that gets incremented when a tracepoint
belonging to that process is removed.  Then, when a lookup fails, the
trapping instruction is restarted if the thread's counter doesn't match
that of the process.

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

PC-BSD/trueos 81d4ad9usr.sbin/nfsd nfsd.c

Fix the usage error I introduced in r344192.

Specifically, I put the new option line in the wrong place, and then fixed
up the rest without realizing it.  This puts the usage statement back to
what it was, with an additional line for the new -V option.

Reported by:    mav
Sponsored by:   iXsystems Inc.

PC-BSD/trueos af1684dsys/modules/dtrace Makefile

Disconnect fasttrap from the 32-bit powerpc build.

An upcoming bug fix requires 64-bit atomics, which aren't implemented on
powerpc.  The powerpc port of fasttrap is incomplete anyway and doesn't
get loaded by dtraceall.ko on powerpc because of a missing dependency;
it's presumed that it's effectively unused.

Discussed with: jhibbits
MFC after:      2 weeks

PC-BSD/trueos 55cc697crypto/openssh scp.c scp.1

scp: validate filenames provided by server against wildcard in client

OpenSSH-portable commits:

check in scp client that filenames sent during remote->local directory
copies satisfy the wildcard specified by the user.

This checking provides some protection against a malicious server
sending unexpected filenames, but it comes at a risk of rejecting wanted
files due to differences between client and server wildcard expansion rules.

For this reason, this also adds a new -T flag to disable the check.

reported by Harry Sintonen
fix approach suggested by markus@;
has been in snaps for ~1wk courtesy deraadt@

OpenBSD-Commit-ID: 00f44b50d2be8e321973f3c6d014260f8f7a8eda

Minor patch conflict (getopt) resolved.

Obtained from: OpenSSH-portable 391ffc4b9d31fa1f4ad566499fef9176ff8a07dc

scp: add -T to usage();

    [10 lines not shown]

PC-BSD/trueos 55fd5fesys/contrib/dev/acpica/components/utilities utdecode.c

MFV:    r344447

Fix missing comma in array declaration.

PC-BSD/trueos 0ac12a8usr.sbin/bhyve acpi.c

Catch up with ACPICA 20190215.

PR:            235922

PC-BSD/trueos 543fd0fsys/dev/syscons scterm-dumb.c scterm-sc.c

Fix the dumb and sc terminal emulators to compile and work.

First remove ifdefs of the unsupported option SC_DUMB_TERMINAL which
prevented building using both in the same kernel and broke regression
tests.  This option will be replaced by per-emulator supported options.

The dumb emulator rotted with KSE in r83366, but usually compiled since
it is ifdefed to nothing unless SC_DUMB_TERMINAL is defined.  The type
of an unused function parameter changed.

Both emulators rotted when 2 new methods were added while the emulators
were removed.  Only null methods are needed, but null function pointers
give panics instead.

The wildcard in the default for the unsupported option SC_DFLT_TERM
never really worked.  It tends to prefer the dumb emulator when multiple
emulators are configured.  Change it to prefer scteken for compatibility.

PC-BSD/trueos 992b29acontrib/llvm/tools/lld/ELF Config.h SyntheticSections.cpp, contrib/llvm/tools/lld/ELF/Arch X86.cpp X86_64.cpp

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

  Recommit r353293 "[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target."

  With the following changes:
  1) Compilation fix:
  std::atomic<bool> HasStaticTlsModel = false; ->
  std::atomic<bool> HasStaticTlsModel{false};

  2) Adjusted the comment in code.

  Initial commit message:

  DF_STATIC_TLS flag indicates that the shared object or executable
  contains code using a static thread-local storage scheme.

  Patch checks if IE/LE relocations were used to check if the code uses
  a static model. If so it sets the DF_STATIC_TLS flag.

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

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

  [LLD][ELF] - Set DF_STATIC_TLS flag for X64 target

    [15 lines not shown]

PC-BSD/trueos 3273186sys/conf files.amd64 files

Move scterm_teken.c from 6 MD files lists to the MI files list so that it
is easier to configure.  It is MI, unlike some of the other syscons files
already in the MI list.

Move scvtb.c similarly.  It is needed whenever sc is configured, and is
more MI than most of the files already in the MI list.

This only changes the combined list for arm64 and mips.  These arches
already cannot build sc or even NOTES.

PC-BSD/trueos df1afa2sys/dev/ioat ioat.c ioat_internal.h

Fix few issues in ioat(4) driver.

 - Do not explicitly count active descriptors.  It allows hardware reset
to happen while device is still referenced, plus simplifies locking.
 - Do not stop/start callout each time the queue becomes empty.  Let it
run to completion and rearm if needed, that is much cheaper then to touch
it every time, plus also simplifies locking.
 - Decouple submit and cleanup locks, making driver reentrant.
 - Avoid memory mapped status register read on every interrupt.
 - Improve locking during device attach/detach.
 - Remove some no longer used variables.

Reviewed by:    cem
MFC after:      1 week
Sponsored by:   iXsystems, Inc.
Differential Revision:  https://reviews.freebsd.org/D19231

PC-BSD/trueos 00ee058sys/vm vm_pageout.c

Clear pointers to indicate that the respective locks are released.

This fixes a problem in r344231: vm_pageout_launder() may scan two
queues when swap is disabled.

Reported by:    pho
MFC with:       r344231

PC-BSD/trueos 0514659usr.bin/svn Makefile.inc, usr.bin/svn/svn Makefile

svn: support building with WITH_PIE

Subversion builds and links against its own .a archives using local
rules, so did not benefit from with the WITH_PIE library support added
in r344179.  Apply the same _pie suffix locally.

Reviewed by:    cem
Differential Revision:  https://reviews.freebsd.org/D19246

PC-BSD/trueos 621218asys/dev/ntb/ntb_hw ntb_hw_plx.c

Allow I/OAT of present Xeon E5/E7 to work thorugh PLX NTB.

Its a hack, we can't know/list all DMA engines, but this covers all
I/OAT of Xeon E5/E7 at least from Sandy Bridge till Skylake I saw.

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

PC-BSD/trueos e763f31sys/netinet tcp_input.c

The receive buffer autoscaling for TCP is based on a linear growth, which
is acceptable in the congestion avoidance phase, but not during slow start.
The MTU is is also not taken into account.
Use a method instead, which is based on exponential growth working also in
slow start and being independent from the MTU.

This is joint work with rrs@.

Reviewed by:           rrs@, Richard Scheffenegger
Sponsored by:          Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D18375
+12-151 files

PC-BSD/trueos 27723fdsys/kern kern_kcov.c, tests/sys/kern kcov.c

Allow the kcov buffer to be mmaped multiple times.

After r344391 this restriction is no longer needed.

Sponsored by:   DARPA, AFRL

PC-BSD/trueos ccea7c1tests/sys/kern kcov.c

Use KCOV_ENTRY_SIZE for the entry size.

Previously it was sizeof(uint64_t). While this is currently true, it may
not be on all future architectures.

Sponsored by:   DARPA, AFRL

PC-BSD/trueos 192c95esys/netinet tcp_reass.c

This patch addresses an issue brought up by bz@ in D18968:
When TCP_REASS_LOGGING is defined, a NULL pointer dereference would happen,
if user data was received during the TCP handshake and BB logging is used.

A KASSERT is also added to detect tcp_reass() calls with illegal parameter

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

PC-BSD/trueos 61c0685sys/dev/syscons scterm-sc.c sctermvar.h

Restore syscons' terminal emulators.  The trivial fixes to make them compile
will be committed later.

The "sc" emulator has the advantages of full support for cons25 and running
about 8 times faster than teken (for writing to the frame buffer).

The "dumb" emulator has the advantage of being simple.

Runtime choice of the emulator is good, but compile time choice is bad.

PC-BSD/trueos 0be3f78sys/fs/fuse fuse_vfsops.c

fuse: Fix a regression introduced in r337165

On systems with non-default DFLTPHYS and/or MAXBSIZE, FUSE would attempt to
use a buf cache block size in excess of permitted size.  This did not affect
most configurations, since DFLTPHYS and MAXBSIZE both default to 64kB.
The issue was discovered and reported using a custom kernel with a DFLTPHYS
of 512kB.

PR:            230260 (comment #9)
Reported by:    ken@
MFC after:      π/𝑒 weeks

PC-BSD/trueos 0a59440sys/kgssapi gss_impl.c, usr.sbin/gssd gssd.c

* Handle SIGPIPE in gssd
We've got some cases where the other end of gssd's AF_LOCAL socket gets
closed, resulting in an error (and SIGPIPE) when it tries to do I/O to it.
Closing without cleaning up means the next time nfsd starts up, it hangs,
unkillably; this allows gssd to handle that particular error.

* Limit the retry cound in gssd_syscall to 5.
The default is INT_MAX, which effectively means forever.  And it's an
uninterruptable RPC call, so it will never stop.

The two changes mitigate the problem.

Reviewed by:    macklem
MFC after:      2 weeks
Sponsored by:   iXsystems Inc.
Differential Revision:  https://reviews.freebsd.org/D19153

PC-BSD/trueos 67c6829sys/contrib/dev/acpica changes.txt, sys/contrib/dev/acpica/compiler aslxref.c dttemplate.h

MFV:    r344395

Import ACPICA 20190215.

PC-BSD/trueos 2a20bb1sys/kern kern_kcov.c

Unwire the kcov buffer when freeing the info struct.

Without this the physical memory will not be returned to the kernel.

While here call vm_object_reference on the object when mmapping the buffer.
This removed the need for buggy tracking of if it has been mapped or not.

This fixes issues where kcov could use all the system memory.

Reported by:    tuexen
Reviewed by:    kib
Sponsored by:   DARPA, AFTL
Differential Revision:  https://reviews.freebsd.org/D19252
+16-11 files

PC-BSD/trueos fc60fccsys/kern kern_kcov.c

Call pmap_qenter for each page when creating the kcov buffer.

This removes the need to allocate a buffer to hold the vm_page_t objects
at the cost of extra IPIs on some architectures.

Reviewed by:    kib
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D19252

PC-BSD/trueos 229dccfusr.sbin/newsyslog newsyslog.c

Complete fix for CID 1007454, CID 1007453: Resource leak in newsyslog

The result of a strdup() was stored in a global variable and not freed
before program exit. This is a follow-up to r343906. That change
attempted to plug these resource leaks but managed to miss a code path
on which the leak still occurs. Plug the leak on that path, too.

MFC after:      3 days
Sponsored by:   Dell EMC Isilon

PC-BSD/trueos 5e2c802tools/tools/crypto cryptocheck.c

It turns out that setting the IV length is necessary with CCM in OpenSSL.
This adds that back.

Reviewed by:    cem

PC-BSD/trueos f6f04d1stand/libsa cd9660.c

loader: really fix cd9660 dirmatch

The cd9660_open() does pass whole path to dirmatch() and we need to
compare only the current path component, not full path.

Additinally, skip over duplicate / (if any) and check if the last component
in the path was meant to be directory (having trailing /). If it is in fact
a file, error out.
+30-41 files

PC-BSD/trueos bb9abf2contrib/libc++/include __locale

Pull in r354515 from upstream libc++ trunk:

  Fix the build with gcc when `-Wredundant-decls` is passed


  gcc warns that `__throw_runtime_error` is declared both in
  `<__locale>` and `<stdexcept>`, if `-Wredundant-decls` is passed on
  the command line; this is the case with FreeBSD when ${WARNS} == 6.

  Since `<__locale>` gets its first declaration via a transitive
  include of `<stdexcept>`, and the second declaration is after the
  first invocation of `__throw_runtime_error`, delete that second

  Signed-off-by: Enji Cooper <yaneurabeya at gmail.com>

  Reviewers: kristina, MaskRay, EricWF, ldionne, ngie

  Reviewed By: EricWF

  Subscribers: krytarowski, brooks, emaste, dim, christof, jdoerfert, libcxx-commits

  Tags: #libc

    [4 lines not shown]

PC-BSD/trueos 700097csys/fs/pseudofs pseudofs.c pseudofs.h

PFS: Bump NAMELEN and don't require clients to be sleepable

- debugfs consumers expect to be able to export names more than 48 characters

- debugfs consumers expect to be able to hold locks across calls and are able
  to handle allocation failures

Reviewed by:    hps@
MFC after:      1 week
Sponsored by:   iX Systems
Differential Revision:  https://reviews.freebsd.org/D19256

PC-BSD/trueos d8e1388sys/libkern strdup.c, sys/sys libkern.h

Add non-sleepable strdup variant strdup_flags

debugfs expects to do non-sleepable allocations

Reviewed by:    hps@
MFC after:      1 week
Sponsored by:   iX Systems
Differential Revision:  https://reviews.freebsd.org/D19259

PC-BSD/trueos 77fead5usr.bin/top display.c

Fix more AddressSanitizer violations in usr.bin/top

In line_update(), set lastcol correctly after moving to any non-zero
column, so the "overwrite old stuff" part does not attempt to address
negative offsets in the current line.

Rewrite setup_buffer() to always allocate at least 80 characters,
otherwise various calls to summary_format() will overwrite the end of
the buffers, if the screen width gets small enough.

MFC after:      1 week
+23-291 files

PC-BSD/trueos 539864bsys/dev/drm mga_ucode.h, sys/dev/drm2/i915 intel_display.c i915_gem.c

Merge pull request #294 from trueos/head-update-20190220

Head update 20190220

PC-BSD/trueos 7354c4dsys/kern kern_descrip.c

Remove an obsolete comment.

MFC after:      3 days

PC-BSD/trueos a093706sys/compat/lindebugfs lindebugfs.c, sys/compat/linuxkpi/common/include/linux seq_file.h

Merge branch 'projects/gcov-only' of https://github.com/mattmacy/networking into 

PC-BSD/trueos 87f2a8bsys/netinet tcp_timer.h tcp_syncache.c

Reduce the TCP initial retransmission timeout from 3 seconds to
1 second as allowed by RFC 6298.

Reviewed by:           kbowling@, Richard Scheffenegger
Sponsored by:          Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D18941

PC-BSD/trueos 7961339sys/netinet tcp_syncache.c tcp_timer.c, sys/netinet/tcp_stacks rack.c

Use exponential backoff for retransmitting SYN segments as specified
in the TCP RFCs.

Reviewed by:           rrs@, Richard Scheffenegger
Sponsored by:          Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D18974

PC-BSD/trueos 64666cdcddl/contrib/opensolaris/lib/libdtrace/common dt_consume.c

MFV r344364:
9058 postmortem DTrace frequently broken under vmware

illumos/illumos-gate at 793bd7e3617ae7d3d24e8c6b7d6befe35f07ec1f

MFC after:      1 week

PC-BSD/trueos 9bd042fsys/geom geom_ctl.h geom_ctl.c

Define a constant for the maximum number of GEOM_CTL arguments.

Reviewed by:    eugen
MFC with:       r344305
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D19271

PC-BSD/trueos b973f04sys/dev/drm mga_ucode.h, sys/dev/drm2/i915 intel_display.c i915_gem.c

Merge branch 'master' of https://github.com/freebsd/freebsd into head-update-20190220

PC-BSD/trueos 0f79148sys/crypto/aesni aesni_ccm.c aesni.c, sys/opencrypto ccm-cbc.c ccm-cbc.h

Revert "Import opencrypto changes from:"

This reverts commit 9992c4c3aaff54ba5aefff07cc19c1b21599772a.

PC-BSD/trueos 518a2a9sys/crypto/aesni aesni.c

Revert "Update opencrypto patch to fix build, thanks Matt Macy!"

This reverts commit a5a3dc643f11108be8b2a7fb0a43b2dc28105a8d.

PC-BSD/trueos 01134b6cddl/contrib/opensolaris/cmd/zpool zpool.8

zpool.8: sort zpool status flags in the same order as in illumos manual

Just in case, while I was here.

MFC after:      1 week

PC-BSD/trueos 6c8bb51cddl/contrib/opensolaris/cmd/zpool zpool.8

zpool.8: document -D flag for zpool status

The description is taken from the illumos manual.

Reported by:    stilezy at gmail.com
MFC after:      1 week