freebsd.git
7 years agoCheck to see if the kernel has cd9660 before running tests that require it
brd [Mon, 27 Mar 2017 15:20:31 +0000 (15:20 +0000)]
Check to see if the kernel has cd9660 before running tests that require it

Approved by: ngie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10096

7 years agoAccess *correct* ifp data structure when debug sysctl is invoked.
sbruno [Mon, 27 Mar 2017 15:08:02 +0000 (15:08 +0000)]
Access *correct* ifp data structure when debug sysctl is invoked.

Submitted by: Kevin Bowling <kevin.bowling@kev009.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D10126

7 years agoChange the default rss_type to M_HASHTYPE_OPAQUE_HASH.
sbruno [Mon, 27 Mar 2017 14:55:23 +0000 (14:55 +0000)]
Change the default rss_type to M_HASHTYPE_OPAQUE_HASH.

Submitted by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9905

7 years agomacOS 10.12 release date added.
pluknet [Mon, 27 Mar 2017 14:37:35 +0000 (14:37 +0000)]
macOS 10.12 release date added.

7 years agoFix pfil_add_hook() and pfil_remove_hook() type.
pluknet [Mon, 27 Mar 2017 14:32:34 +0000 (14:32 +0000)]
Fix pfil_add_hook() and pfil_remove_hook() type.

7 years agoSame as r316022 (Fix hexadecimal escape codes in jail.conf(5)),
jamie [Mon, 27 Mar 2017 13:37:40 +0000 (13:37 +0000)]
Same as r316022 (Fix hexadecimal escape codes in jail.conf(5)),
but do it right this time.

Reported by: Kyle Evans <Kyle Evans>
MFC after: 3 days

7 years agoFix hexadecimal escape codes in jail.conf(5).
jamie [Mon, 27 Mar 2017 13:27:39 +0000 (13:27 +0000)]
Fix hexadecimal escape codes in jail.conf(5).

PR: 218154
Submitted by: Masahiro Konishi <mkonishi@sea.plala.or.jp>
MFC after: 3 days

7 years agorevert r315959 because it causes build problems
avg [Mon, 27 Mar 2017 12:34:29 +0000 (12:34 +0000)]
revert r315959 because it causes build problems

The change introduced a dependency between genassym.c and header files
generated from .m files, but that dependency is not specified in the
make files.

Also, the change could be not as useful as I thought it was.

Reported by: dchagin, Manfred Antar <null@pozo.com>, and many others

7 years agoupdate comment describing topo_probe_amd()
avg [Mon, 27 Mar 2017 11:04:57 +0000 (11:04 +0000)]
update comment describing topo_probe_amd()

MFC after: 2 weeks
MFC with: r316017

7 years agoOops, my fix for bright colors broke bright black some more (in cases
bde [Mon, 27 Mar 2017 10:48:28 +0000 (10:48 +0000)]
Oops, my fix for bright colors broke bright black some more (in cases
that used to work via the bold hack).

Fix the table entry for bright black.  Fix spelling of plain black in
nearby table entries (use the macro for black everywhere everywhere).
Fix the currently-unused non-bright color table to not have bright
colors in entries 9-15.

Improve nearby comments.  Start converting to the xterm terminology
and default rendering of "bright" instead of "light" for bright
colors.

Syscons wasn't affected by the bug since I optimized it a little by
converting colors 0-15 directly.  This also fixes the layering of
the conversion for these colors.

Apply the same optimization to vt (actually the layer above it).  This
also moves the conversion 1 closer to the correct layer for colors
0-15.

The optimization of just avoiding 2 calls to a trivial function is worth
about 10% for simple output to the virtual buffer with occasional
rendering.  The optimization is so large because the 2 calls are done
on every character, so although there are too many other calls and
other instructions per character, there are only about 10 times as
many.  Old versions of syscons were about 10 times faster for simple
output, by using a fast path with about 12 instructions per character.
Rendering to even slow hardware takes relatively little time provided
it is rarely actually done.

7 years agoIntroduce an audit event identifier -> audit event name mapping
rwatson [Mon, 27 Mar 2017 10:38:53 +0000 (10:38 +0000)]
Introduce an audit event identifier -> audit event name mapping
database in the kernel audit implementation, similar the exist
class mapping database.  This will be used by the DTrace audit
provider to map audit event identifiers originating in the
system-call table back into strings for the purposes of setting
probe names.  The database is initialised and maintained by
auditd(8), which reads values in from the audit_events
configuration file, and then manages them using the A_GETEVENT
and A_SETEVENT auditon(2) operations.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, AFRL
MFC after: 3 weeks

7 years agoadd SMT detection for newer AMD processors
avg [Mon, 27 Mar 2017 09:45:27 +0000 (09:45 +0000)]
add SMT detection for newer AMD processors

The change seems to be more in the nomenclature than in the way the
topology is advertised by the hardware.

Tested by: truckman (earlier version of the change)
MFC after: 2 weeks

7 years agoExtend comment describing path canonicalisation in audit.
rwatson [Mon, 27 Mar 2017 08:29:17 +0000 (08:29 +0000)]
Extend comment describing path canonicalisation in audit.

Sponsored by: DARPA, AFRL
Obtained from: TrustedBSD Project
MFC after: 3 days

7 years agoake pfil's locking macros private.
ae [Mon, 27 Mar 2017 08:18:13 +0000 (08:18 +0000)]
ake pfil's locking macros private.

Obtained from: Yandex LLC
MFC after: 1 week

7 years agoDeclare module version.
ae [Mon, 27 Mar 2017 07:56:41 +0000 (07:56 +0000)]
Declare module version.

MFC after: 1 week

7 years agoTimeout DMAR commands.
kib [Mon, 27 Mar 2017 07:06:45 +0000 (07:06 +0000)]
Timeout DMAR commands.

Implement timeouts for register-based DMAR commands.  Tunable/sysctl
hw.dmar.timeout specifies the timeout in nanoseconds, set it to zero
to allow infinite wait.  Default is 1ms.

Runtime modification of the sysctl is not safe, it is allowed for
debugging.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoiwm: fix build without IWM_DEBUG.
avos [Mon, 27 Mar 2017 07:02:27 +0000 (07:02 +0000)]
iwm: fix build without IWM_DEBUG.

Reported by: O. Hartmann <ohartmann@walstatt.org>
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D10146

7 years agoFix TUNABLE_UINT64() on 32bit architectures.
kib [Mon, 27 Mar 2017 06:37:03 +0000 (06:37 +0000)]
Fix TUNABLE_UINT64() on 32bit architectures.

The macro is not used in the tree.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agocxgbe/iw_cxgbe: Remove unused code.
np [Mon, 27 Mar 2017 03:11:51 +0000 (03:11 +0000)]
cxgbe/iw_cxgbe: Remove unused code.

MFC after: 3 days

7 years agoMerge OpenBSM 1.2-alpha5 from vendor branch to FreeBSD -CURRENT:
rwatson [Sun, 26 Mar 2017 21:14:49 +0000 (21:14 +0000)]
Merge OpenBSM 1.2-alpha5 from vendor branch to FreeBSD -CURRENT:

- Add a new "qsize" parameter in audit_control and the getacqsize(3) API to
  query it, allowing to set the kernel's maximum audit queue length.
- Add support to push a mapping between audit event names and event numbers
  into the kernel (where supported) using new A_GETEVENT and A_SETEVENT
  auditon(2) operations.
- Add audit event identifiers for a number of new (and not-so-new) FreeBSD
  system calls including those for asynchronous I/O, thread management, SCTP,
  jails, multi-FIB support, and misc. POSIX interfaces such as
  posix_fallocate(2) and posix_fadvise(2).
- On operating systems supporting Capsicum, auditreduce(1) and praudit(1) now
  run sandboxed.
- Empty "flags" and "naflags" fields are now permitted in audit_control(5).

Many thanks to Christian Brueffer for producing the OpenBSM release and
importing/tagging it in the vendor branch.  This release will allow improved
auditing of a range of new FreeBSD functionality, as well as non-traditional
events (e.g., fine-grained I/O auditing) not required by the Orange Book or
Common Criteria.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, AFRL
MFC after: 3 weeks

7 years agoRevert r314907, and pull in r298713 from upstream compiler-rt trunk (by
dim [Sun, 26 Mar 2017 20:36:35 +0000 (20:36 +0000)]
Revert r314907, and pull in r298713 from upstream compiler-rt trunk (by
Weiming Zhao):

  builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.

  Summary:
  Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
  mode (-mthumb, -marm), it reflect's capability of given CPU.

  Due to this:
   - use  __tbumb__ and __thumb2__ insteand of __ARM_ARCH_ISA_THUMB
   - use '.thumb' directive consistently  in all affected files
   - decorate all thumb functions using
     DEFINE_COMPILERRT_THUMB_FUNCTION()

  ---------
  Note: This patch doesn't fix broken Thumb1 variant of __udivsi3 !

  Reviewers: weimingz, rengolin, compnerd

  Subscribers: aemerson, dim

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

Discussed with: mmel
X-MFC-With: r314564

7 years agoSlightly improve consistency of "fooint" vs "foo_int" in DPCPU(9) examples.
rwatson [Sun, 26 Mar 2017 20:24:27 +0000 (20:24 +0000)]
Slightly improve consistency of "fooint" vs "foo_int" in DPCPU(9) examples.

MFC after: 3 days

7 years agoAdd a man page for the kernel's dynamic per-CPU memory allocator.
rwatson [Sun, 26 Mar 2017 20:15:08 +0000 (20:15 +0000)]
Add a man page for the kernel's dynamic per-CPU memory allocator.

MFC after: 3 days

7 years agodiff: Show nanoseconds in -u/-c header line.
jilles [Sun, 26 Mar 2017 19:47:43 +0000 (19:47 +0000)]
diff: Show nanoseconds in -u/-c header line.

Show nanoseconds in the -u/-c header line.

The present portability conditionals cannot handle the POSIX standard
st_mtim, so remove them and unconditionally use st_mtim.

PR: 218018
Reported by: jbeich
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D10145

7 years agoFix printing of negative offsets (typically from frame pointers) again.
bde [Sun, 26 Mar 2017 18:46:35 +0000 (18:46 +0000)]
Fix printing of negative offsets (typically from frame pointers) again.
I fixed this in 1997, but the fix was over-engineered and fragile and
was broken in 2003 if not before.  i386 parameters were copied to 8
other arches verbatim, mostly after they stopped working on i386, and
mostly without the large comment saying how the values were chosen on
i386.  powerpc has a non-verbatim copy which just changes the uncritical
parameter and seems to add a sign extension bug to it.

Just treat negative offsets as offsets if they are no more negative than
-db_offset_max (default -64K), and remove all the broken parameters.

-64K is not very negative, but it is enough for frame and stack pointer
offsets since kernel stacks are small.

The over-engineering was mainly to go more negative than -64K for the
negative offset format, without affecting printing for more than a
single address.

Addresses in the top 64K of a (full 32-bit or 64-bit) address space
are now printed less well, but there aren't many interesting ones.
For arches that have many interesting ones very near the top (e.g.,
68k has interrupt vectors there), there would be no good limit for
the negative offset format and -64K is a good as anything.

7 years agoiwn: fix debug message
avos [Sun, 26 Mar 2017 18:06:51 +0000 (18:06 +0000)]
iwn: fix debug message

7 years agoiwn: fix error handling for one well-known corner case.
avos [Sun, 26 Mar 2017 17:59:51 +0000 (17:59 +0000)]
iwn: fix error handling for one well-known corner case.

7 years agoProvide proper contemporary function prototypes for many of the functions
rwatson [Sun, 26 Mar 2017 17:22:44 +0000 (17:22 +0000)]
Provide proper contemporary function prototypes for many of the functions
implemented in top(1), rather than relying on K&R prototypes, which can
cause problems on targets where there are multiple incompatible calling
conventions and the compiler requires argument information to select the
correct one.

(There's a bit more to do here, since it looks like top(1) also sometimes
provides prototypes for various curses functions rather than relying on
the header file...)

Sponsored by: DARPA, AFRL
MFC after: 1 week

7 years agoiwn: drop unneeded bus_dmamap_sync() calls.
avos [Sun, 26 Mar 2017 16:46:39 +0000 (16:46 +0000)]
iwn: drop unneeded bus_dmamap_sync() calls.

1) They are using wrong tag (Tx) + map (Rx) combination.
2) Rx descriptor is already synchronized in iwn_notif_intr()
3) It's not needed for transmitted data since device does not change
mbuf contents.

Tested with Intel 6205 (amd64), STA mode.

7 years agoEmply contemporary function prototypes in bootpd, rather than relying on
rwatson [Sun, 26 Mar 2017 14:37:12 +0000 (14:37 +0000)]
Emply contemporary function prototypes in bootpd, rather than relying on
locally defined K&R prototypes in .c files; use appropriate casts for
pointer types now that types for arguments are available at compile time.
This ensures that compilers with multiple incompatible calling conventions
can select the correct calling convention for external functions.

Sponsored by: DARPA, AFRL
MFC after: 1 week

7 years agoFix 3 entries in mode tables related to mono and 90-column text modes.
bde [Sun, 26 Mar 2017 14:31:29 +0000 (14:31 +0000)]
Fix 3 entries in mode tables related to mono and 90-column text modes.
Newer VGAs don't support any mono modes, but bugs in the tables created
2 virtual mono modes (#45 90x43 and #112 80x43) that behaved more
strangely than crashing.  90-column modes are tweaked 80-column ones
and also fail to work on newer VGAs.  #45 did crash (hang) on some
hardware.

7 years agodiff: Fix mtime of file1 in -u/-c header line.
jilles [Sun, 26 Mar 2017 14:09:25 +0000 (14:09 +0000)]
diff: Fix mtime of file1 in -u/-c header line.

PR: 218018
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D10140

7 years agoRestore switching to a separate kernel terminal "input" state and extend
bde [Sun, 26 Mar 2017 13:03:16 +0000 (13:03 +0000)]
Restore switching to a separate kernel terminal "input" state and extend
it to a separate state for each CPU.

Terminal "input" is user or kernel output.  Its state includes the current
parser state for escape sequences and multi-byte characters, and some
results of previous parsing (mainly attributes), and in teken the cursor
position, but not completed output.  This state must be switched for kernel
output since the kernel can preempt anything, including itself, and this
must not affect the preempted state more than necessary.  Since vty0 is
shared, it is necessary to affect the frame buffer and cursor position and
history, but escape sequences must not be affected and attributes for
further output must not be affected.

This used to work.  The syscons terminal state contained mainly the parser
state for escape sequences and attributes, but not the cursor position,
and was switched.  This was first broken by SMP and/or preemptive kernels.
Then there should really be a separate state for each thread, and one more
for ddb, or locking to prevent preemption.  Serialization of printf() helps.
But it is arcane that full syscons escape sequences mostly work in kernel
printf(), and I have never seen them used except by me to test this fix.
They worked perfectly except for the races, since "input" from the kernel
was not special in any way.

This was broken to use teken.  The general switch was removed, and the
kernel normal attribute was switched specially.  The kernel reverse
attribute (config option SC_CONS_REVERSE_ATTR) became unused, and is
still unusable because teken doesn't support default reverse attributes
(it used to only be used via the ANSI escape sequence to set reverse
video).

The only new difficulty for using teken seems to be that the cursor
position is in the "input" state, so it must be updated in the active
input state for each half of the switch.  Do this to complete the
restoration.

The per-CPU state is mainly to make per-CPU coloring work cleanly, at
a cost of some space.  Each CPU gets its own full set of attribute
(not just the current attribute) maintained in the usual way.  This
also reduces races from unserialized printf()s.  However, this gives
races for serialized printf()s that otherwise have none.  Nothing
prevents the CPU doing the a printf() changing in the middle of an
escape sequence.

7 years agoUse inline asm instead of unportable intrinsics for the SSE4 crc32
bde [Sun, 26 Mar 2017 10:31:48 +0000 (10:31 +0000)]
Use inline asm instead of unportable intrinsics for the SSE4 crc32
optimization.

This fixes building with gcc-4.2.1 (it doesn't support SSE4).
gas-2.17.50 [FreeBSD] supports SSE4 instructions, so this doesn't
need using .byte directives.

This fixes depending on host user headers in the kernel.

Fix user includes (don't depend on namespace pollution in <nmmintrin.h>
that is not included now).

The instrinsics had no advantages except to sometimes avoid compiler
pessimixations.  clang understands them a bit better than inline asm,
and generates better looking code which also runs better for cem, but
for me it just at the same speed or slower by doing excessive
unrollowing in all the wrong places.  gcc-4.2.1 also doesn't understand
what it is doing with unrolling, but with -O3 somehow it does more
unrolling that helps.

Reduce 1 of the the compiler pessimizations (copying a variable which
already satisfies an "rm" constraint in a good way by being in memory
and not used again, to different memory and accessing it there.  Force
copying it to a register instead).

Try to optimize the inner loops significantly, so as to run at full
speed on smaller inputs.  The algorithm is already very MD, and was
tuned for the throughput of 3 crc32 instructions per cycle found on
at least Sandybridge through Haswell.  Now it is even more tuned for
this, so depends more on the compiler not rearranging or unrolling
things too much.  The main inner loop for should have no difficulty
runing at full speed on these CPUs unless the compiler unrolls it too
much.  However, the main inner loop wasn't even used for buffers smaller
than 24K.  Now it is used for buffers larger than 384 bytes.  Now it
is not so long, and the main outer loop is used more.  The new
optimization is to try to arrange that the outer loop runs in parallel
with the next inner loop except for the final iteration; then reduce
the loop sizes significantly to take advantage of this.

Approved by: cem
Not tested in production by: bde

7 years agoiwn: deduplicate code in iwn_tx_data() and iwn_tx_data_raw().
avos [Sun, 26 Mar 2017 09:41:08 +0000 (09:41 +0000)]
iwn: deduplicate code in iwn_tx_data() and iwn_tx_data_raw().

Some code was additionally moved for (future) lock splitting.

Tested with Intel 6205, STA mode.

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

7 years agoiwn: omit unneeded bus_dmamap_sync() calls when compiled without
avos [Sun, 26 Mar 2017 09:10:01 +0000 (09:10 +0000)]
iwn: omit unneeded bus_dmamap_sync() calls when compiled without
'options IWN_DEBUG'

7 years agoPreserve VFP state across signal delivery.
mmel [Sun, 26 Mar 2017 08:36:56 +0000 (08:36 +0000)]
Preserve VFP state across signal delivery.

We don't have enouch space to store full VFP context within mcontext
stucture. Due to this:
 - follow i386/amd64 way and store VFP state outside of the mcontext_t
   but point to it. Use the size of VFP state structure as an 'magic'
   indicator of the saved VFP state presence.
 - teach set_mcontext() about this external storage.
 - for signal delivery, store VFP state to expanded 'struct sigframe'.

Submited by: Andrew Gierth (initial version)
PR: 217611
MFC after: 2 weeks

7 years agoSave VFP state on fork().
mmel [Sun, 26 Mar 2017 08:36:20 +0000 (08:36 +0000)]
Save VFP state on fork().
Update the copy of VFP state in PCB before it is cloned for new process.

MFC after: 2 weeks

7 years agoProvide less laborius way to enable busdma DMAR to only short list of devices.
kib [Sun, 26 Mar 2017 00:40:35 +0000 (00:40 +0000)]
Provide less laborius way to enable busdma DMAR to only short list of devices.

Kernel environment variable hw.busdma.default can take values 'bounce'
and 'dmar' and selects corresponding busdma backend as default.
Per-device environment variable hw.busdma.pci<domain>.<bus>.<slot>.<func>
takes the same values and overrides hw.busdma.default for the given device.

Note that even with hw.busdma.default=bounce, DMA translation engines
are still started if DMARs are enabled, to disable them use
hw.dmar.dma tunable, as before.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years ago[rpi] Use compatibility string from upstream DTB for I2C controller
gonzo [Sat, 25 Mar 2017 22:58:37 +0000 (22:58 +0000)]
[rpi] Use compatibility string from upstream DTB for I2C controller

FreeBSD uses upstream DTB for RPi3 build and compatibility string for
i2c device is different there. Add this new string to compatibility data.

Reported by: Karl Denninger
MFC after: 3 days

7 years agoiwn: fix return code conflict in iwn_init_locked()
avos [Sat, 25 Mar 2017 22:07:21 +0000 (22:07 +0000)]
iwn: fix return code conflict in iwn_init_locked()

Do not try to use errno(2) codes here; instead, just return unique
value (1) when radio is disabled via hardware switch and another
one (-1) for any other error in initialization path.

Tested with Intel 6205, STA mode.

7 years agoftp.microsoft.com is dead and the document was not archived, point to the full
sevan [Sat, 25 Mar 2017 21:33:48 +0000 (21:33 +0000)]
ftp.microsoft.com is dead and the document was not archived, point to the full
protocol spec document instead.
Fix spelling mistake flagged by igor.
Rephrase bad sentence flagged by igor.

Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision:  https://reviews.freebsd.org/D10111

7 years agoAdd ids for ALC233 found on Intel Skull Mountain NUC.
sbruno [Sat, 25 Mar 2017 19:12:09 +0000 (19:12 +0000)]
Add ids for ALC233 found on Intel Skull Mountain NUC.

7 years agodtrace sched:::preempt should fire only when there is preemption
avg [Sat, 25 Mar 2017 19:08:51 +0000 (19:08 +0000)]
dtrace sched:::preempt should fire only when there is preemption

The probe fire on any thread switch before.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Panzura

7 years agospecific end of interrupt implementation for AMD Local APIC
avg [Sat, 25 Mar 2017 18:45:09 +0000 (18:45 +0000)]
specific end of interrupt implementation for AMD Local APIC

The change is more intrusive than I would like because the feature
requires that a vector number is written to a special register.
Thus, now the vector number has to be provided to lapic_eoi().
It was readily available in the IO-APIC and MSI cases, but the IPI
handlers required more work.
Also, we now store the VMM IPI number in a global variable, so that it
is available to the justreturn handler for the same reason.

Reviewed by: kib
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D9880

7 years agoiwn: do not try to update node configuration when the node does not exist.
avos [Sat, 25 Mar 2017 15:57:47 +0000 (15:57 +0000)]
iwn: do not try to update node configuration when the node does not exist.

Firmware will just respond with status '0x8' (node does not exist) or
will hang -> cause 'device timeout's (sometimes).

7 years agoImplement Linux mincore() system call.
dchagin [Sat, 25 Mar 2017 15:47:29 +0000 (15:47 +0000)]
Implement Linux mincore() system call.
This is necessary for the upcoming drm-next.

Suggested by: hselasky@
MFC after: 1 month

7 years agoFix reference count leak with L2 caching.
karels [Sat, 25 Mar 2017 15:06:28 +0000 (15:06 +0000)]
Fix reference count leak with L2 caching.

ip_forward, TCP/IPv6, and probably SCTP leaked references to L2 cache
entry because they used their own routes on the stack, not in_pcb routes.
The original model for route caching was callers that provided a route
structure to ip{,6}input() would keep the route, and this model was used
for L2 caching as well. Instead, change L2 caching to be done by default
only when using a route structure in the in_pcb; the pcb deallocation
code frees L2 as well as L3 cacches. A separate change will add route
caching to TCP/IPv6.

Another suggestion was to have the transport protocols indicate willingness
to use L2 caching, but this approach keeps the changes in the network
level

Reviewed by:    ae gnn
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D10059
and those below, will be ignored--
> Description of fields to fill in above:                     76 columns --|
> PR:                       If and which Problem Report is related.
> Submitted by:             If someone else sent in the change.
> Reported by:              If someone else reported the issue.
> Reviewed by:              If someone else reviewed your modification.
> Approved by:              If you needed approval for this commit.
> Obtained from:            If the change is from a third party.
> MFC after:                N [day[s]|week[s]|month[s]].  Request a reminder email.
> MFH:                      Ports tree branch name.  Request approval for merge.
> Relnotes:                 Set to 'yes' for mention in release notes.
> Security:                 Vulnerability reference (one per line) or description.
> Sponsored by:             If the change was sponsored by an organization.
> Differential Revision:    https://reviews.freebsd.org/D### (*full* phabric URL needed).
> Empty fields above will be automatically removed.

M    netinet/in_pcb.c
M    netinet/ip_output.c
M    netinet6/ip6_output.c

7 years agoMFV r315950:
dchagin [Sat, 25 Mar 2017 14:14:11 +0000 (14:14 +0000)]
MFV r315950:

Update vendor/tcsh to git b605cb561d

Vendor changes:

1. PR/471: Daiki Ueno: Delay interpreting arginp until we've processed
our startup files (which can change the NLS environment).

2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar).

3. Fix out of bounds read (Brooks Davis)
(reproduce by starting tcsh and hitting tab at the prompt).

4. Don't play pointer tricks that are undefined in modern c
(Brooks Davis).

7 years agoUpdate to tcsh 6.20.00
dchagin [Sat, 25 Mar 2017 13:32:28 +0000 (13:32 +0000)]
Update to tcsh 6.20.00

7 years agoImport libcxxrt master 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92.
dim [Sat, 25 Mar 2017 13:17:48 +0000 (13:17 +0000)]
Import libcxxrt master 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92.

Interesting fixes which were not already merged:
0c7c611 Merge C++ demangler bug fixes from ELF Tool Chain (#40)
2b208d9 __cxa_demangle_gnu3: demangle 'z' as '...', not 'ellipsis' (#41)

MFC after: 3 days

7 years agoiwn: add few missing notification types into iwn_intr_str()
avos [Sat, 25 Mar 2017 13:15:43 +0000 (13:15 +0000)]
iwn: add few missing notification types into iwn_intr_str()

7 years agoAdd a regression test for r31512 fix
bapt [Sat, 25 Mar 2017 10:47:58 +0000 (10:47 +0000)]
Add a regression test for r31512 fix

PR: 217934
MFC after: 1 week

7 years agoAvoid leaking allocated but unused context after creation race.
kib [Sat, 25 Mar 2017 10:47:35 +0000 (10:47 +0000)]
Avoid leaking allocated but unused context after creation race.

As noted in the comment, nothing special needs to be done to destroy
the unneeded context after the allocation race, but the context memory
itself still should to be freed.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoDo not create RMRR entries for identity-mapped domains.
kib [Sat, 25 Mar 2017 10:45:16 +0000 (10:45 +0000)]
Do not create RMRR entries for identity-mapped domains.

It does not make sense since identity mapping already provides the
required mapping for RMRR ranges.  More, since identity page tables do
not reflect content of map entries for id domains, creating RMRR
entries makes domain data inconsistent.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoSlight cleanup of the comment.
kib [Sat, 25 Mar 2017 10:42:10 +0000 (10:42 +0000)]
Slight cleanup of the comment.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoFix and add comments to match selected frequency sample.
ganbold [Sat, 25 Mar 2017 10:39:24 +0000 (10:39 +0000)]
Fix and add comments to match selected frequency sample.
Add debug printfs when bootverbose is used.
No functional changes.

7 years ago[iwm] Add the BSS's basic rates to iwm's LQ command, not all the rates.
adrian [Sat, 25 Mar 2017 02:55:13 +0000 (02:55 +0000)]
[iwm] Add the BSS's basic rates to iwm's LQ command, not all the rates.

Makes the firmware use appropriate Tx rates for ACKs.

Obtained from: dragonflybsd.git ab1d3efc208e797c1e09759cd506c95c0aeaa06e

7 years ago[iwm] Enable Energy Based Scan (EBS).
adrian [Sat, 25 Mar 2017 02:49:20 +0000 (02:49 +0000)]
[iwm] Enable Energy Based Scan (EBS).

This can significantly reduce scan duration thus saving time and power.
EBS failure reported by FW disables EBS for current connection. It is
re-enabled upon new connection attempt on any WLAN interface.

Obtained from: dragonflybsd.git 89f579e9823a5c446ca172cf82bbc210d6a054a4

7 years ago[iwm] GC unused code from if_iwm_scan.c, copyied from iwn or iwlwifi/dvm.
adrian [Sat, 25 Mar 2017 02:44:25 +0000 (02:44 +0000)]
[iwm] GC unused code from if_iwm_scan.c, copyied from iwn or iwlwifi/dvm.

Obtained from: dragonflybsd.git 10881df269b93c26e5ee6af629c36db5672e6e52

7 years ago[iwm] Tiny cleanup in iwm_rx_addbuf().
adrian [Sat, 25 Mar 2017 02:42:52 +0000 (02:42 +0000)]
[iwm]  Tiny cleanup in iwm_rx_addbuf().

Obtained from: dragonflybsd.git 3370bc5504ebb3c1b9bb960a185cd0c8052a2845

7 years agocxgbe/iw_cxgbe: allocations that use GFP_KERNEL (which is M_WAITOK on
np [Sat, 25 Mar 2017 02:28:21 +0000 (02:28 +0000)]
cxgbe/iw_cxgbe: allocations that use GFP_KERNEL (which is M_WAITOK on
FreeBSD) cannot fail.

MFC after: 3 days

7 years agocxgbe/iw_cxgbe: alloc_ep expects a gfp_t, and it's always ok to sleep during
np [Sat, 25 Mar 2017 01:45:04 +0000 (01:45 +0000)]
cxgbe/iw_cxgbe: alloc_ep expects a gfp_t, and it's always ok to sleep during
alloc_ep.

7 years agocxgbe/iw_cxgbe: c4iw_connect should always returns a -ve errno on failure.
np [Sat, 25 Mar 2017 01:38:17 +0000 (01:38 +0000)]
cxgbe/iw_cxgbe: c4iw_connect should always returns a -ve errno on failure.

MFC after: 3 days

7 years agoAdd 'device iic' to bring in userland I2C driver.
imp [Fri, 24 Mar 2017 22:33:03 +0000 (22:33 +0000)]
Add 'device iic' to bring in userland I2C driver.

Submitted by: karl@

7 years agonet80211: fix possible panic when wlan(4) interface is destroyed.
avos [Fri, 24 Mar 2017 22:29:51 +0000 (22:29 +0000)]
net80211: fix possible panic when wlan(4) interface is destroyed.

If this is the last running vap wait until device will be powered off
(fixes panic when 'ifconfig wlan0 destroy' is executed for running iwn(4)
interface).

Tested with:
 - Intel 6205, STA mode.
 - RTL8188EU, STA / IBSS modes.
 - RTL8821AU, STA / HOSTAP modes.

7 years agoRemove buggy adjustment of page tables in db_write_bytes().
bde [Fri, 24 Mar 2017 17:34:55 +0000 (17:34 +0000)]
Remove buggy adjustment of page tables in db_write_bytes().

Long ago, perhaps only on i386, kernel text was mapped read-only and
it was necessary to change the mapping to read-write to set breakpoints
in kernel text.  Other writes by ddb to kernel text were also allowed.
This write protection is harder to implement with 4MB pages, and was
lost even for 4K pages when 4MB pages were implemented.  So changing
the mapping became useless.  It was actually worse than useless since
it followed followed various null and otherwise garbage pointers to
not change random memory instead of the mapping.  (On i386s, the
pointers became good in pmap_bootstrap(), and on amd64 the pointers
became bad in pmap_bootstrap() if not before.)

Another bug broke detection of following of null pointers on i386,
except early in boot where not detecting this was a feature.  When
I fixed the bug, I accidentally broke the feature and soon got traps
in db_write_bytes().  Setting breakpoints early in ddb was broken.

kib pointed out that a clean way to do the adjustment would be to use
a special [sub]map giving a small window on the bytes to be written.

The trap handler didn't know how to fix up errors for pagefaults
accessing the map itself.  Such errors rarely need fixups, since most
traps for the map are for the first access which is a read.

Reviewed by: kib

7 years agoAdd brackets to fix incorrect macro expansion.
mav [Fri, 24 Mar 2017 16:26:11 +0000 (16:26 +0000)]
Add brackets to fix incorrect macro expansion.

Reported by: Andreas Hollmann / PVS-Studio
MFC after: 2 weeks

7 years agoProperly initialise with content of pw.conf(5) that was mistakenly ignored.
eugen [Fri, 24 Mar 2017 16:18:57 +0000 (16:18 +0000)]
Properly initialise with content of pw.conf(5) that was mistakenly ignored.
Also, respect "defaultgroup" if specified there.

PR: 217934
Reported by: Victor Sudakov <vas@mpeks.tomsk.su>
Reviewed by: bapt
Approved by: bapt, vsevolod (mentor)
MFC after: 1 week

7 years agoImprove grammar on a warning, and only use one line rather than two when
gavin [Fri, 24 Mar 2017 16:18:20 +0000 (16:18 +0000)]
Improve grammar on a warning, and only use one line rather than two when
printing it.

7 years agoMake sendfile(2) more robust against file change. This fixes a possible
glebius [Fri, 24 Mar 2017 16:01:19 +0000 (16:01 +0000)]
Make sendfile(2) more robust against file change.  This fixes a possible
crash when the file shrinks.  This also fixes sendfile(2) not sending more
data in a case when the file grows, and the request is open-ended or
specifies a size that is greater than old file size.

PR: 217789
Reviewed by: gallatin
MFC after: 10 days

7 years agoRestore the NULL check that was removed in upstream r913. It is not
des [Fri, 24 Mar 2017 14:45:58 +0000 (14:45 +0000)]
Restore the NULL check that was removed in upstream r913.  It is not
unreasonable to call pam_end() with a NULL pamh in error handling code.

Reported by: rwatson

7 years agoUnify initiator and target DMA setup and command sending.
mav [Fri, 24 Mar 2017 14:44:03 +0000 (14:44 +0000)]
Unify initiator and target DMA setup and command sending.

The code is so alike that it is pointless to keep it separate.

MFC after: 2 weeks

7 years agoAdd missing 'else' to conditional. This doesn't really affect the code
sbruno [Fri, 24 Mar 2017 14:27:29 +0000 (14:27 +0000)]
Add missing 'else' to conditional.  This doesn't really affect the code
flow or configuration in any way.

7 years agoAdd missing 'else' to 3-state conditional during setup of interrupts.
sbruno [Fri, 24 Mar 2017 14:25:56 +0000 (14:25 +0000)]
Add missing 'else' to 3-state conditional during setup of interrupts.

We don't want to overwrite the 82574 interrupt setup with a different
configuration.

PR: 218041
Submitted by: razmyslov@viva64.com

7 years agoUse a more stream-lined version of fix_value.
imp [Fri, 24 Mar 2017 13:46:26 +0000 (13:46 +0000)]
Use a more stream-lined version of fix_value.

Submitted by: ian@

7 years agoCleanup structures related to VFP and/or mcontext_t.
mmel [Fri, 24 Mar 2017 11:46:49 +0000 (11:46 +0000)]
Cleanup structures related to VFP and/or mcontext_t.
- in mcontext_t, rename newer used 'union __vfp' to equaly sized 'mc_spare'.
  Space allocated by 'union __vfp' is too small and cannot hold full
  VFP context.
- move structures defined in fp.h to more appropriate headers.
- remove all unused VFP structures.

MFC after: 2 weeks

7 years agoMFV r315290, r315291: 7303 dynamic metaslab selection
mav [Fri, 24 Mar 2017 09:37:00 +0000 (09:37 +0000)]
MFV r315290, r315291: 7303 dynamic metaslab selection

illumos/illumos-gate@8363e80ae72609660f6090766ca8c2c18aa53f0c
https://github.com/illumos/illumos-gate/commit/8363e80ae72609660f6090766ca8c2c18

https://www.illumos.org/issues/7303

  This change introduces a new weighting algorithm to improve metaslab selection.
  The new weighting algorithm relies on the SPACEMAP_HISTOGRAM feature. As a result,
  the metaslab weight now encodes the type of weighting algorithm used
  (size-based vs segment-based).

  This also introduce a new allocation tracing facility and two new dcmds to help
  debug allocation problems. Each zio now contains a zio_alloc_list_t structure
  that is populated as the zio goes through the allocations stage. Here's an
  example of how to use the tracing facility:

> c5ec000::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
  MSID    DVA    ASIZE      WEIGHT             RESULT               VDEV
     -      0      400           0    NOT_ALLOCATABLE           ztest.0a
     -      0      400           0    NOT_ALLOCATABLE           ztest.0a
     -      0      400           0             ENOSPC           ztest.0a
     -      0      200           0    NOT_ALLOCATABLE           ztest.0a
     -      0      200           0    NOT_ALLOCATABLE           ztest.0a
     -      0      200           0             ENOSPC           ztest.0a
     1      0      400      1 x 8M            17b1a00           ztest.0a

> 1ff2400::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
  MSID    DVA    ASIZE      WEIGHT             RESULT               VDEV
     -      0      200           0    NOT_ALLOCATABLE           mirror-2
     -      0      200           0    NOT_ALLOCATABLE           mirror-0
     1      0      200      1 x 4M            112ae00           mirror-1
     -      1      200           0    NOT_ALLOCATABLE           mirror-2
     -      1      200           0    NOT_ALLOCATABLE           mirror-0
     1      1      200      1 x 4M            112b000           mirror-1
     -      2      200           0    NOT_ALLOCATABLE           mirror-2

  If the metaslab is using segment-based weighting then the WEIGHT column will
  display the number of segments available in the bucket where the allocation
  attempt was made.

Author: George Wilson <george.wilson@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Don Brady <don.brady@intel.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

7 years agoInclude <sys/systm.h> to obtain the memcpy() prototype.
ed [Fri, 24 Mar 2017 07:09:33 +0000 (07:09 +0000)]
Include <sys/systm.h> to obtain the memcpy() prototype.

I got a report of this source file not building on Raspberry Pi. It's
interesting that this only fails for that target and not for others.
Again, that's no reason not to include the right headers.

PR: 217969
Reported by: Johannes Jost Meixner
MFC after: 1 week

7 years agoDon't bother checking core version
jhibbits [Fri, 24 Mar 2017 01:52:10 +0000 (01:52 +0000)]
Don't bother checking core version

We already constrain by SoC, so there's no need to check the core version, too.

7 years agoSwitch qoriq_gpio over to using ofw_bus_search_compatible
jhibbits [Fri, 24 Mar 2017 01:30:18 +0000 (01:30 +0000)]
Switch qoriq_gpio over to using ofw_bus_search_compatible

This will make it easier to add more compatibility strings in the future, if
necessary.

7 years agoDon't initialize if_output to ether_output(), ether_ifattach() does it for
kevlo [Fri, 24 Mar 2017 01:23:07 +0000 (01:23 +0000)]
Don't initialize if_output to ether_output(), ether_ifattach() does it for
us already.  While here, remove NOTYET code since if_watchdog is no longer
used.

Reviewed by: royger
MFC after: 3 days

7 years agoCorrect handling of ALTQ with epair(4) interfaces but presenting that ALTQ(9) is...
eri [Fri, 24 Mar 2017 00:55:16 +0000 (00:55 +0000)]
Correct handling of ALTQ with epair(4) interfaces but presenting that ALTQ(9) is supported.

Approved by: ae
MFC after: 2 weeks

7 years agoMFV r315875:
mm [Fri, 24 Mar 2017 00:02:12 +0000 (00:02 +0000)]
MFV r315875:
Sync libarchive with vendor.

Vendor changes (FreeBSD-related):
- store extended attributes with extattr_set_link() if no fd is provided
- add extended attribute tests to libarchive and bsdtar
- fix tar's test_option_acls
- support the UF_HIDDEN file flag

X-MFC with: 315636

7 years agoUpdate vendor/libarchive to git e92cb619661b5b52da63867305442e22892a503d
mm [Thu, 23 Mar 2017 23:44:31 +0000 (23:44 +0000)]
Update vendor/libarchive to git e92cb619661b5b52da63867305442e22892a503d

Vendor changes (FreeBSD-related):
- store extended attributes with extattr_set_link() if no fd is provided
- add extended attribute tests to libarchive and bsdtar
- support the UF_HIDDEN file flag

7 years agoAdd Northstar/BCM4706 core ID for ChipCommon.
landonf [Thu, 23 Mar 2017 22:14:08 +0000 (22:14 +0000)]
Add Northstar/BCM4706 core ID for ChipCommon.

Approved by: adrian (mentor, implicit)

7 years agoAdd a workaround for the BCM4706's dangling core region EROM entries.
landonf [Thu, 23 Mar 2017 22:12:14 +0000 (22:12 +0000)]
Add a workaround for the BCM4706's dangling core region EROM entries.

Approved by: adrian (mentor, implicit)

7 years agoMFV r315791: ntp 4.2.8p10.
delphij [Thu, 23 Mar 2017 22:06:06 +0000 (22:06 +0000)]
MFV r315791: ntp 4.2.8p10.

7 years agoisp field in struct isp_pcmd is also unused.
mav [Thu, 23 Mar 2017 21:18:10 +0000 (21:18 +0000)]
isp field in struct isp_pcmd is also unused.

MFC after: 2 weeks

7 years agoRemove write-only crn field from struct isp_pcmd.
mav [Thu, 23 Mar 2017 21:11:55 +0000 (21:11 +0000)]
Remove write-only crn field from struct isp_pcmd.

MFC after: 2 weeks

7 years agoRemove Solaris 2.6 syscalls selector.
glebius [Thu, 23 Mar 2017 19:54:41 +0000 (19:54 +0000)]
Remove Solaris 2.6 syscalls selector.

Discussed with: kib

7 years ago[mips/broadcom]: Early boot NVRAM support
landonf [Thu, 23 Mar 2017 19:29:12 +0000 (19:29 +0000)]
[mips/broadcom]: Early boot NVRAM support

Add support for early boot access to NVRAM variables, using a new
bhnd_nvram_data_getvar_direct() API to support zero-allocation direct
reading of NVRAM variables from a bhnd_nvram_io instance backed by the
CFE NVRAM device.

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D9913

7 years agoUse ppsratecheck() for ratelimiting in the LinuxKPI.
hselasky [Thu, 23 Mar 2017 16:23:55 +0000 (16:23 +0000)]
Use ppsratecheck() for ratelimiting in the LinuxKPI.

Suggested by: cem @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd proper error checking for the string to number conversion
hselasky [Thu, 23 Mar 2017 16:01:51 +0000 (16:01 +0000)]
Add proper error checking for the string to number conversion
functions in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoIn libcasper, prefer to send a function index or service name over the IPC
rwatson [Thu, 23 Mar 2017 14:35:21 +0000 (14:35 +0000)]
In libcasper, prefer to send a function index or service name over the IPC
channel to a zygote process, rather than sending a function pointer or
service pointer.  This avoids transfering pointers between address spaces,
which while robust in this case (due to the zygote being forked() from the
parent) is not generally a good idea, especially in the presence of
increasingly popular control-flow integrity and pointer protection
mitigation schemes.  With this change, ping(8) and other sandboxed tools
using libcasper for DNS resolution now work on architectures with tagged
memory again.

Reviewed by: oshogbo
MFC after: 1 week
Sponsored by: DARPA, AFRL

7 years agoStop providing the compat_3_brand.
ed [Thu, 23 Mar 2017 14:12:21 +0000 (14:12 +0000)]
Stop providing the compat_3_brand.

As of r315860, the ELF image activator works fine for CloudABI without it.

Reviewed by: kib
MFC after: 2 weeks

7 years agoDon't require the presence of the compat_3_brand.
ed [Thu, 23 Mar 2017 14:09:45 +0000 (14:09 +0000)]
Don't require the presence of the compat_3_brand.

The existing ELF image activator requires the brandinfo to provide such
a string unconditionally, even if the executable format in question
doesn't use this type of branding. Skip matching when it's a null
pointer.

Reviewed by: kib
MFC after: 2 weeks

7 years agoFunction macros are preferred in the LinuxKPI.
hselasky [Thu, 23 Mar 2017 13:28:16 +0000 (13:28 +0000)]
Function macros are preferred in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoaacraid: rework r315083 for a clean build with and without AACRAID_DEBUG
avg [Thu, 23 Mar 2017 11:59:17 +0000 (11:59 +0000)]
aacraid: rework r315083 for a clean build with and without AACRAID_DEBUG

r315083 essentially reverted r263954 which was made for a good reason,
but didn't take into account AACRAID_DEBUG.
Now both types of build should be clean.

MFC after: 5 days
No MFC to: stable/10

7 years agoRemove "UNMAPPED" messages printed on da periph attach.
mav [Thu, 23 Mar 2017 10:50:45 +0000 (10:50 +0000)]
Remove "UNMAPPED" messages printed on da periph attach.

I think this message is not very useful for end user.  Also its formatting
does not match other messages printed at that time.  Those who really need
this information can always find it in `camcontrol negotiate daX -v`.

MFC after: 2 weeks