]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoRemove references to EISA support from the vx driver, along with EISA
imp [Thu, 16 Feb 2017 21:56:46 +0000 (21:56 +0000)]
Remove references to EISA support from the vx driver, along with EISA
support. Fix a comment block that's shared with both vx and ep. Remove
obsolete refernce to statically compiling a kernel with a fixed number
of vx devices. Have not removed EISA from the title of the document
the register definitions were originally derived from (though no doubt
more recent docments were also consulted).

7 years agoRemove references to C-Bus support in the le(4) driver. Support for
imp [Thu, 16 Feb 2017 21:56:41 +0000 (21:56 +0000)]
Remove references to C-Bus support in the le(4) driver. Support for
these devices were removed when pc98 was removed.

7 years agoRemove stray reference to EISA bus support that was never in FreeBSD.
imp [Thu, 16 Feb 2017 21:56:36 +0000 (21:56 +0000)]
Remove stray reference to EISA bus support that was never in FreeBSD.

7 years agoRemove references to EISA support in mlx. The driver never supported
imp [Thu, 16 Feb 2017 21:56:32 +0000 (21:56 +0000)]
Remove references to EISA support in mlx. The driver never supported
the EISA cards and EISA bus support is being removed.

7 years agoRemove the ahb driver for the EISA Adaptec 174x.
imp [Thu, 16 Feb 2017 21:56:27 +0000 (21:56 +0000)]
Remove the ahb driver for the EISA Adaptec 174x.

7 years agoRemove stale MCA comment now that the MCA bus support is gone.
imp [Thu, 16 Feb 2017 21:56:21 +0000 (21:56 +0000)]
Remove stale MCA comment now that the MCA bus support is gone.

Relnotes: yes

7 years agoRevert r313814 and r313816
rstone [Thu, 16 Feb 2017 21:18:31 +0000 (21:18 +0000)]
Revert r313814 and r313816

Something evidently got mangled in my git tree in between testing and
review, as an old and broken version of the patch was apparently submitted
to svn.  Revert this while I work out what went wrong.

Reported by: tuexen
Pointy hat to: rstone

7 years agoPull in r285478 from upstream compiler-rt trunk (by Saleem Abdulrasool):
dim [Thu, 16 Feb 2017 21:03:43 +0000 (21:03 +0000)]
Pull in r285478 from upstream compiler-rt trunk (by Saleem Abdulrasool):

  build: give aliases the same visibility

  ARM EABI also uses function aliases.  Ensure that those aliased
  functions are given proper visibility annotations.

Reported by: mmel
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D9633

7 years agoRemove inet_ntoa() from the kernel
vangyzen [Thu, 16 Feb 2017 20:50:01 +0000 (20:50 +0000)]
Remove inet_ntoa() from the kernel

inet_ntoa() cannot be used safely in a multithreaded environment
because it uses a static local buffer.  Remove it from the kernel.

Suggested by: glebius, emaste
Reviewed by: gnn
MFC after: never
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9625

7 years agoUse inet_ntoa_r() instead of inet_ntoa() throughout the kernel
vangyzen [Thu, 16 Feb 2017 20:47:41 +0000 (20:47 +0000)]
Use inet_ntoa_r() instead of inet_ntoa() throughout the kernel

inet_ntoa() cannot be used safely in a multithreaded environment
because it uses a static local buffer. Instead, use inet_ntoa_r()
with a buffer on the caller's stack.

Suggested by: glebius, emaste
Reviewed by: gnn
MFC after: 2 weeks
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9625

7 years agopf: use inet_ntoa_r() instead of inet_ntoa(); maybe fix IPv6 OS fingerprinting
vangyzen [Thu, 16 Feb 2017 20:44:44 +0000 (20:44 +0000)]
pf: use inet_ntoa_r() instead of inet_ntoa(); maybe fix IPv6 OS fingerprinting

inet_ntoa() cannot be used safely in a multithreaded environment
because it uses a static local buffer. Instead, use inet_ntoa_r()
with a buffer on the caller's stack.

This code had an INET6 conditional before this commit, but opt_inet6.h
was not included, so INET6 was never defined.  Apparently, pf's OS
fingerprinting hasn't worked with IPv6 for quite some time.
This commit might fix it, but I didn't test that.

Reviewed by: gnn, kp
MFC after: 2 weeks
Relnotes: yes (if I/someone can test pf OS fingerprinting with IPv6)
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9625

7 years agoRemove outdated claim.
pfg [Thu, 16 Feb 2017 20:30:55 +0000 (20:30 +0000)]
Remove outdated claim.

Despite wishful thinking the removal of these old function hasn't
happened yet.

MFC after: 3 days

7 years agoSmall inclusion guard comment fix.
pfg [Thu, 16 Feb 2017 20:28:30 +0000 (20:28 +0000)]
Small inclusion guard comment fix.

7 years agoacpica: remove a superfluous NULL check
vangyzen [Thu, 16 Feb 2017 20:27:22 +0000 (20:27 +0000)]
acpica: remove a superfluous NULL check

The address-of operator can't produce NULL (in practice).
Remove an unnecessary NULL check.

MFC after: 3 days
Sponsored by: Dell EMC

7 years agoFix a typo in my previous commit
rstone [Thu, 16 Feb 2017 20:06:21 +0000 (20:06 +0000)]
Fix a typo in my previous commit

Somehow in the late stages of testing my sched_ule patch, a character was
accidentally deleted from the file.  Correct this.

While I'm committing anyway, the previous commit message requires some
clarification: in the normal case of unlending priority after releasing
a mutex, the thread that was doing the lending will be woken up and
immediately become the highest-priority thread, and in that case no
priority inversion would take place.  However, if that thread is pinned
to a different CPU, then the currently running thread that just had its
priority lowered will not be preempted and then priority inversion can
occur.

Reported by: O. Hartmann (typo), jhb (scheduler clarification)
MFC after: 1 month
Pointy hat to: rstone

7 years agoAdd 0-8 as shortcuts for jumping to menu items in the hardening menu.
robak [Thu, 16 Feb 2017 19:58:02 +0000 (19:58 +0000)]
Add 0-8 as shortcuts for jumping to menu items in the hardening menu.

Submitted by: skreuzer
Reviewed by: allanjude, robak
Approved by: allanjude
Differential Revision: https://reviews.freebsd.org/D6826

7 years agoCheck for preemption after lowering a thread's priority
rstone [Thu, 16 Feb 2017 19:41:13 +0000 (19:41 +0000)]
Check for preemption after lowering a thread's priority

When a high-priority thread is waiting for a mutex held by a
low-priority thread, it temporarily lends its priority to the
low-priority thread to prevent priority inversion.  When the mutex
is released, the lent priority is revoked and the low-priority
thread goes back to its original priority.

When the priority of that thread is lowered (through a call to
sched_priority()), the schedule was not checking whether
there is now a high-priority thread in the run queue.  This can
cause threads with real-time priority to be starved in the run
queue while the low-priority thread finishes its quantum.

Fix this by explicitly checking whether preemption is necessary
when a thread's priority is lowered.

Sponsored by: Dell EMC Isilon
Obtained from: Sandvine Inc
Differential Revision: https://reviews.freebsd.org/D9518
Reviewed by: Jeff Roberson (ule)
MFC after: 1 month

7 years agoMFV 313786
jpaetzel [Thu, 16 Feb 2017 19:00:09 +0000 (19:00 +0000)]
MFV 313786

7500 Simplify dbuf_free_range by removing dn_unlisted_l0_blkid

illumos/illumos-gate@653af1b809998570c7e89fe7a0d3f90992bf0216
https://github.com/illumos/illumos-gate/commit/653af1b809998570c7e89fe7a0d3f90992bf0216

https://www.illumos.org/issues/7500
  With the integration of:

    commit 0f6d88aded0d165f5954688a9b13bac76c38da84
    Author: Alex Reece <alex@delphix.com>
    Date:   Sat Jul 26 13:40:04 2014 -0800
    4873 zvol unmap calls can take a very long time for larger datasets

  the dnode's dn_bufs field was changed from a list to a tree. As a result,
  the dn_unlisted_l0_blkid field is no longer necessary.

Author: Stephen Blinick <stephen.blinick@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>

7 years agoAllow container_of() to be used with constant data pointers.
hselasky [Thu, 16 Feb 2017 14:13:36 +0000 (14:13 +0000)]
Allow container_of() to be used with constant data pointers.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoImplement linux version of ptrace(2). It's nowhere near complete,
trasz [Thu, 16 Feb 2017 13:32:15 +0000 (13:32 +0000)]
Implement linux version of ptrace(2).  It's nowhere near complete,
but it allows to use 64 bit linux strace(1) on 64 bit linux binaries.

Reviewed by: dchagin (earlier version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9406

7 years agoImplement more LinuxKPI atomic functions and macros.
hselasky [Thu, 16 Feb 2017 12:56:10 +0000 (12:56 +0000)]
Implement more LinuxKPI atomic functions and macros.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAllow passing a constant atomic_t to atomic_read().
hselasky [Thu, 16 Feb 2017 12:20:57 +0000 (12:20 +0000)]
Allow passing a constant atomic_t to atomic_read().

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoWhitespace fix.
hselasky [Thu, 16 Feb 2017 12:08:52 +0000 (12:08 +0000)]
Whitespace fix.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix LINT build for powerpc.
ae [Thu, 16 Feb 2017 11:38:50 +0000 (11:38 +0000)]
Fix LINT build for powerpc.

Build kernel modules support only when both IPSEC and TCP_SIGNATURE
are not defined.

Reported by: emaste

7 years agoImprove debugging output.
trasz [Thu, 16 Feb 2017 10:36:00 +0000 (10:36 +0000)]
Improve debugging output.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoRemove unnecessary #includes from the kqueue(2) man page.
ed [Thu, 16 Feb 2017 06:52:53 +0000 (06:52 +0000)]
Remove unnecessary #includes from the kqueue(2) man page.

Now that <sys/event.h> can be included on its own, adjust the manual
page accordingly. Remove both unnecessary #include statements from the
synopsis and the example code.

While there, also add a note to the BUGS section to mention that
previous versions of this header file still depend on <sys/types.h>.

Reviewed by: ngie, vangyzen
Differential Revision: https://reviews.freebsd.org/D9605

7 years agoDo not access memory past the buffer end.
kib [Thu, 16 Feb 2017 06:36:16 +0000 (06:36 +0000)]
Do not access memory past the buffer end.
Do not accept and silently truncate too long hostname.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoDo not allocate char[MNAMELEN] on stack in nfsclient.
kib [Thu, 16 Feb 2017 06:34:20 +0000 (06:34 +0000)]
Do not allocate char[MNAMELEN] on stack in nfsclient.

Right now this is not critical, but will be after planned increase of
MNAMELEN from 88 to 1k.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoUse uintmax_t to print st_nlink.
kib [Thu, 16 Feb 2017 06:32:39 +0000 (06:32 +0000)]
Use uintmax_t to print st_nlink.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoMinor style fixes.
kib [Thu, 16 Feb 2017 06:31:36 +0000 (06:31 +0000)]
Minor style fixes.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 years agomakefs: use a macro to simplify per-fs function declarations
emaste [Thu, 16 Feb 2017 03:12:47 +0000 (03:12 +0000)]
makefs: use a macro to simplify per-fs function declarations

makefs.h 1.28

Obtained from: NetBSD

7 years agoUse symbolic constants for OSC support / control negotiations.
imp [Wed, 15 Feb 2017 23:49:28 +0000 (23:49 +0000)]
Use symbolic constants for OSC support / control negotiations.

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

7 years agorwlock: tidy up r313392
mjg [Wed, 15 Feb 2017 23:33:14 +0000 (23:33 +0000)]
rwlock: tidy up r313392

While a new bit was added and thread alignment got shifted to accomodate it,
RW_READERS_SHIFT was not modified accordingly and clashed with the new flag.

This was surprisingly harmless. If the lock was taken for writing, other flags
were tested. If the lock was taken for reading, it would correctly work for
readers > 1 and this was the only relevant test performed.

7 years agoRemove Micro Channel Architecture support. Of the commonly available
imp [Wed, 15 Feb 2017 23:04:25 +0000 (23:04 +0000)]
Remove Micro Channel Architecture support. Of the commonly available
machines, only a few 486 machines that used it, and those haven't had
enough memory to run FreeBSD for quite some time (often limited to
16MB).

Not to be confused with the Machine Check Architecture, which is still
very much alive and used (and untouched by this commit).

No Objection From: arch@

7 years agoMFV r313781:
mm [Wed, 15 Feb 2017 20:17:55 +0000 (20:17 +0000)]
MFV r313781:
Sync libarchive with vendor

Vendor changes:
Make SCHILY.acl.ace header more compact (NFSv4 ACLs)

Vendor bugfixes:
zip reader integer parsing fix (OSS-Fuzz 556)
spelling fixes (issue #863)

7 years agoprefix UFS symbols with UFS_ to reduce namespace pollution
emaste [Wed, 15 Feb 2017 19:50:26 +0000 (19:50 +0000)]
prefix UFS symbols with UFS_ to reduce namespace pollution

Specifically:
  ROOTINO -> UFS_ROOTINO
  WINO -> UFS_WINO
  NXADDR -> UFS_NXADDR
  NDADDR -> UFS_NDADDR
  NIADDR -> UFS_NIADDR
  MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Also prefix ext2's and nandfs's NDADDR and NIADDR with EXT2_ and NANDFS_

Reviewed by: kib, mckusick
Obtained from: NetBSD
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9536

7 years agoFix handling of negative sbspace() return values.
mav [Wed, 15 Feb 2017 19:46:00 +0000 (19:46 +0000)]
Fix handling of negative sbspace() return values.

I found that at least with Chelsio NICs TOE sockets quite often report
negative sbspace() values.  Using unsigned variable to store it resulted
in attempts to aggregate too much data in one sosend() call, that caused
errors and following connection termination.

MFC after: 2 weeks

7 years agoImprove code readability and fix compilation error when using clang 4.x.
hselasky [Wed, 15 Feb 2017 18:31:09 +0000 (18:31 +0000)]
Improve code readability and fix compilation error when using clang 4.x.

Found by: emaste @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoUn-break vt(4) for {powerpc,powerpc64,sparc64} LINT kernel builds
rpokala [Wed, 15 Feb 2017 17:33:03 +0000 (17:33 +0000)]
Un-break vt(4) for {powerpc,powerpc64,sparc64} LINT kernel builds

The {powerpc,powerpc64,sparc64} LINT kernel builds fail with this error:

    sys/dev/vt/vt_buf.c:198: warning: 'vtbuf_htw' defined but not used

Move vtbuf_htw() inside the '#if SC_NO_CUTPASTE' block where it belongs, and
put it in the proper order.

This fixes the immedate issue w/ vt(4), but all three then fail on different
issues.

Reviewed by: emaste

7 years agoChange the "devfs_fsync: vop_stdfsync failed" from panic to a printf.
trasz [Wed, 15 Feb 2017 16:52:21 +0000 (16:52 +0000)]
Change the "devfs_fsync: vop_stdfsync failed" from panic to a printf.
It's not a proper fix, but should be better than what we have now.
Since it got broken some six months ago it results in an incredibly
annoying and trivially reproducible panic every time eg an USB disk
gets disconnected.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agolocaltime: return NULL if time_t out of range of struct tm
emaste [Wed, 15 Feb 2017 15:32:29 +0000 (15:32 +0000)]
localtime: return NULL if time_t out of range of struct tm

Previously we would truncate tm.tm_year for any time_t corresponding to
a year that does not fit in int.  This issue was discovered because it
caused the bash-static build to fail when linking with LLD.

As reported by Rafael EspĂ­ndola:

    Configure has

    AC_FUNC_MKTIME

    which expands to a test of mktime that fails with the freebsd
    implementation. Given that, bash compiles a mktime.o file that
    defines just mktime and uses localtime. That goes in a .a file
    that is before libc.

    The freebsd libc defines mktime in localtime.o, which also defines
    localtime among other functions.

    When lld sees an undefined reference to mktime from libc, it uses
    the bash provided one and then tries to find a definition of
    localtime. It is found on libc's localtime.o, but now we have a
    duplicated error.

    The reason it works with bfd is that bash doesn't use mktime
    directly and the undefined reference from libc is resolved to the
    libc implementation. It would also fail to link if bash itself
    directly used mktime.

The bash-static configure test verifies that, for many values of t, either
localtime(t) returns NULL or mktime(localtime(t)) == t.  This test failed
when localtime returned a truncated tm_year.

This was fixed in tzcode in 2004 but has persisted in our tree since
rS2708.

Reported by: Rafael EspĂ­ndola
Reviewed by: bapt
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9534

7 years agoLoad the new sp_el0 with interrupts disabled in fork_trampoline. If an
andrew [Wed, 15 Feb 2017 14:56:47 +0000 (14:56 +0000)]
Load the new sp_el0 with interrupts disabled in fork_trampoline. If an
interrupt arrives in fork_trampoline after sp_el0 was written we may then
switch to a new thread, enter userland so change this stack pointer, then
return to this code with the wrong value. This fixes this case by moving
the load of sp_el0 until after interrupts have been disabled.

Reported by: Mark Millard (markmi@dsl-only.net)
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D9593

7 years agobxe: enable usage with NetXtreme II BCM57840 2x20GbE chip
royger [Wed, 15 Feb 2017 14:34:40 +0000 (14:34 +0000)]
bxe: enable usage with NetXtreme II BCM57840 2x20GbE chip

Current bxe probe function won't attach to devices with the NetXtreme II
BCM57840 2x20GbE chip, enable it by adding it's chip ID to the list of
supported chips.

Tested on: HP ProLiant WS460c Gen9
Reviewed by: gnn
MFC after: 1 week
Sponsored by: Citrix Systems R&D
Differential Revision: https://reviews.freebsd.org/D9609

7 years agoRegen after r313769.
trasz [Wed, 15 Feb 2017 14:25:50 +0000 (14:25 +0000)]
Regen after r313769.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoFix definition of linux64 ptrace syscall.
trasz [Wed, 15 Feb 2017 14:12:39 +0000 (14:12 +0000)]
Fix definition of linux64 ptrace syscall.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoPort the Linux AMX 10G network driver to FreeBSD as axgbe. It is unlikely
andrew [Wed, 15 Feb 2017 13:56:04 +0000 (13:56 +0000)]
Port the Linux AMX 10G network driver to FreeBSD as axgbe. It is unlikely
we will import a newer version of the Linux code so the linuxkpi was not
used.

This is still missing 10G support, and multicast has not been tested.

Reviewed by: gnn
Obtained from: ABT Systems Ltd
Sponsored by: SoftIron Inc
Differential Revision: https://reviews.freebsd.org/D8549

7 years agoImport the AMD 10G ethernet driver for the AMD Opteron A1100.
andrew [Wed, 15 Feb 2017 13:37:32 +0000 (13:37 +0000)]
Import the AMD 10G ethernet driver for the AMD Opteron A1100.

This is from Linux git as of 5eb4dce3b3471ec9d1ea2945fa3d2bab4ac7e100

Obtained from: Linux
Sponsored by: SoftIron Inc

7 years agoAdd casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
mmokhi [Wed, 15 Feb 2017 07:59:54 +0000 (07:59 +0000)]
Add casinl() cacosl() catanl() casinhl() cacoshl() catanhl() APIs to msun
to improve C11 conformance.

PR: 216850 216851 216852 216856 216857 216858
Submitted by: mmokhi
Reported by: sgk@troutmask.apl.washington.edu
Reviewed by: bde, mat, theraven
Approved by: bde (src committer), mat (mentor)
Differential Revision: https://reviews.freebsd.org/D9491

7 years agoMFV r313759: license change for a few headers (4 clause BSD to 3 clause BSD).
delphij [Wed, 15 Feb 2017 07:22:47 +0000 (07:22 +0000)]
MFV r313759: license change for a few headers (4 clause BSD to 3 clause BSD).

MFC after: 28 days
X-MFC-with: r313695

7 years agoUse pget() instead of pfind() in fasttrap_pid_{enable,disable}().
markj [Wed, 15 Feb 2017 06:07:01 +0000 (06:07 +0000)]
Use pget() instead of pfind() in fasttrap_pid_{enable,disable}().

Suggested by: mjg
MFC after: 1 week

7 years ago[psm] Fix calculation for clickpad softbuttons at the top
gonzo [Wed, 15 Feb 2017 02:52:43 +0000 (02:52 +0000)]
[psm] Fix calculation for clickpad softbuttons at the top

On laptops like the ThinkPad X240, ClickPad buttons are located at the
top. The hw.psm.synaptics.softbuttons_y sysctl was supposed to allow this
by setting the value to a negative one (e.g. -1700). However, the
condition was wrong (double negative), and doing that placed the buttons
in an unreachable area.

PR: 216342
Submitted by: Greg V <greg@unrelenting.technology>
MFC after: 1 week

7 years agoApply MADV_FREE to exec_map entries only after a lowmem event.
markj [Wed, 15 Feb 2017 01:50:58 +0000 (01:50 +0000)]
Apply MADV_FREE to exec_map entries only after a lowmem event.

This effectively provides the same benefit as applying MADV_FREE inline
upon every execve, since the page daemon invokes lowmem handlers prior to
scanning the inactive queue. It also has less overhead; the cost of
applying MADV_FREE is very noticeable on many-CPU systems since it includes
that of a TLB shootdown of global PTEs. For instance, this change nearly
halves the system CPU usage during a buildkernel on a 128-vCPU EC2
instance (with some other patches applied).

Benchmarked by: cperciva (earlier version)
Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9586

7 years agoCheck for an exiting process when enabling PID provider probes.
markj [Wed, 15 Feb 2017 01:35:26 +0000 (01:35 +0000)]
Check for an exiting process when enabling PID provider probes.

MFC after: 1 week

7 years agomca: use time_uptime instead of ticks for CMCI throttling
avg [Tue, 14 Feb 2017 22:46:39 +0000 (22:46 +0000)]
mca: use time_uptime instead of ticks for CMCI throttling

This solves several problems.
First of all, cmc_throttle is specified in seconds and there was no
conversion between ticks and seconds when they were mixed together.
Second, we avoid potential problems with ticks wrapping around.

Resolution of time_uptime should be sufficient for the throttling
purposes.

Discussed with: jhb
MFC after: 12 days

7 years agomca: fix writes to MSR_MC_CTL2 in cmci_update
avg [Tue, 14 Feb 2017 22:30:22 +0000 (22:30 +0000)]
mca: fix writes to MSR_MC_CTL2 in cmci_update

Previously, if the threshold was changed, then MC_CTL2_CMCI_EN would get
cleared and the logic would switch to the polling only mode.

Discussed with: jhb
MFC after: 2 weeks

7 years agoAdd a regression test for putting a socket on kqueue, and then doing
glebius [Tue, 14 Feb 2017 21:56:01 +0000 (21:56 +0000)]
Add a regression test for putting a socket on kqueue, and then doing
listen(2) on it (see r313043).  Based on Hartmut's code.

7 years agoFix indentation in nss_configure().
markj [Tue, 14 Feb 2017 21:55:50 +0000 (21:55 +0000)]
Fix indentation in nss_configure().

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoRegister nss_atexit() before parsing nsswitch.conf for the first time.
markj [Tue, 14 Feb 2017 21:51:19 +0000 (21:51 +0000)]
Register nss_atexit() before parsing nsswitch.conf for the first time.

NSS modules are loaded when nsswitch.conf is parsed and may register their
own atexit handlers with libc. nss_atexit() unloads any dynamically loaded
NSS modules, so it should run only after the modules' atexit handlers have
been invoked.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoUnbreak the gcc build of netmap.
markj [Tue, 14 Feb 2017 21:36:18 +0000 (21:36 +0000)]
Unbreak the gcc build of netmap.

This fixes several LINT targets.

Reviewed by: Vincenzo Maffione

7 years agoAdd missing check to fix the build with IPSEC_SUPPORT and without MAC.
ae [Tue, 14 Feb 2017 21:33:10 +0000 (21:33 +0000)]
Add missing check to fix the build with IPSEC_SUPPORT and without MAC.

Submitted by: netchild

7 years ago* Add missing parameters to usage()
garga [Tue, 14 Feb 2017 21:14:24 +0000 (21:14 +0000)]
* Add missing parameters to usage()
* Add missing parameters to manpage synopsis
* Add missing description of -d flag
* Sort flags descriptions

Reviewed by: allanjude, kib
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9152

7 years agoNo need to erase sense_data when sense_len is set to zero.
mav [Tue, 14 Feb 2017 21:05:36 +0000 (21:05 +0000)]
No need to erase sense_data when sense_len is set to zero.

MFC after: 2 weeks

7 years agoAdd myself as a new ports committer
tobik [Tue, 14 Feb 2017 19:54:32 +0000 (19:54 +0000)]
Add myself as a new ports committer

Approved by: mat (mentor)
Differential Revision: https://reviews.freebsd.org/D9590

7 years agoReplace Linuxulator implementation of readdir(), getdents() and
dchagin [Tue, 14 Feb 2017 19:13:27 +0000 (19:13 +0000)]
Replace Linuxulator implementation of readdir(), getdents() and
getdents64() with wrapper over kern_getdirentries().

The patch was originally written by emaste@ and then adapted by trasz@
and me.

Note:
1. I divided linux_getdents() and linux_readdir() as in case when the
getdents() called with count = 1 (readdir() case) it can overwrite
user stack (by writing to user buffer pointer more than 1 byte).

2. Linux returns EINVAL in case when user supplied buffer is not enough
to contain fetched dirent.

3. Linux returns ENOTDIR in case when fd points to not a directory.

Reviewed by: trasz@
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D2210

7 years agoDirectly call m_gethdr() instead of m_getm2() for BHS.
mav [Tue, 14 Feb 2017 18:34:25 +0000 (18:34 +0000)]
Directly call m_gethdr() instead of m_getm2() for BHS.

All this code is based on assumption that data will be stored in one piece,
and since buffer size if known and fixed, it is easier to hardcode it.

MFC after: 2 weeks

7 years agoTemporary attach AHS to BHS to calculate header digest.
mav [Tue, 14 Feb 2017 18:29:07 +0000 (18:29 +0000)]
Temporary attach AHS to BHS to calculate header digest.

MFC after: 2 weeks

7 years agoFix style(9)
garga [Tue, 14 Feb 2017 18:11:16 +0000 (18:11 +0000)]
Fix style(9)

Reviewed by: allanjude, vangyzen
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9510

7 years agoFix panic on shutdown of ramdisk LU with zero capacity.
mav [Tue, 14 Feb 2017 18:03:17 +0000 (18:03 +0000)]
Fix panic on shutdown of ramdisk LU with zero capacity.

MFC after: 1 week

7 years agoadd svcpool_close to handle killed nfsd threads
avg [Tue, 14 Feb 2017 17:49:08 +0000 (17:49 +0000)]
add svcpool_close to handle killed nfsd threads

This patch adds a new function to the server krpc called
svcpool_close().  It is similar to svcpool_destroy(), but does not free
the data structures, so that the pool can be used again.

This function is then used instead of svcpool_destroy(),
svcpool_create() when the nfsd threads are killed.

PR: 204340
Reported by: Panzura
Approved by: rmacklem
Obtained from: rmacklem
MFC after: 1 week

7 years agoAdd RLIM_SAVED_MAX and RLIM_SAVED_CUR symbols.
kib [Tue, 14 Feb 2017 17:44:30 +0000 (17:44 +0000)]
Add RLIM_SAVED_MAX and RLIM_SAVED_CUR symbols.

Define them as RLIM_INFINITY.  This is allowed by POSIX in case all
resource limits are representable in an object of type rlim_t.  Since
we do not allow negative rlim_t, with some strength this definition is
conforming.

We are not conforming fully still because POSIX requires rlim_t to be
unsigned type.  Fixing this without breaking ABI to redefine
RLIM_INFINITY is impossible.

PR: 209729
Submitted by: bltsrc@mail.ru
Exp-run done by: antoine
MFC after: 2 weeks

7 years agosleepq_catch_signals: do thread suspension before signal check
badger [Tue, 14 Feb 2017 17:13:23 +0000 (17:13 +0000)]
sleepq_catch_signals: do thread suspension before signal check

Since locks are dropped when a thread suspends, it's possible for another
thread to deliver a signal to the suspended thread. If the thread awakens from
suspension without checking for signals, it may go to sleep despite having
a pending signal that should wake it up. Therefore the suspension check is
done first, so any signals sent while suspended will be caught in the
subsequent signal check.

Reviewed by: kib
Approved by: kib (mentor)
MFC after: 2 weeks
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D9530

7 years agobhyve: whitespace fix for r313727
emaste [Tue, 14 Feb 2017 16:49:32 +0000 (16:49 +0000)]
bhyve: whitespace fix for r313727

Reported by: jhb

7 years agoDo not rely on data alignment after m_pullup().
mav [Tue, 14 Feb 2017 16:33:42 +0000 (16:33 +0000)]
Do not rely on data alignment after m_pullup().

In general case m_pullup() does not really guarantee any data alignment.
Instead of depenting on side effects caused by data being always copied
out of mbuf cluster (which is probably a bug by itself), always allocate
aligned BHS buffer and read data there directly from socket.

While there, reuse new icl_conn_receive_buf() function to read digests.
The code could probably be even more optimized to aggregate those reads,
but until that done, this is still easier then the way it was before.

MFC after: 2 weeks

7 years agotry to fix RACCT_RSS accounting
avg [Tue, 14 Feb 2017 13:54:05 +0000 (13:54 +0000)]
try to fix RACCT_RSS accounting

There could be a race between the vm daemon setting RACCT_RSS based on
the vm space and vmspace_exit (called from exit1) resetting RACCT_RSS to
zero.  In that case we can get a zombie process with non-zero RACCT_RSS.
If the process is jailed, that may break accounting for the jail.
There could be other consequences.

Fix this race in the vm daemon by updating RACCT_RSS only when a process
is in the normal state.  Also, make accounting a little bit more
accurate by refreshing the page resident count after calling
vm_pageout_map_deactivate_pages().
Finally, add an assert that the RSS is zero when a process is reaped.

PR: 210315
Reviewed by: trasz
Differential Revision: https://reviews.freebsd.org/D9464

7 years agoCapsicum support for bhyve(8).
robak [Tue, 14 Feb 2017 13:35:59 +0000 (13:35 +0000)]
Capsicum support for bhyve(8).

Adds Capsicum sandboxing to bhyve.

Submitted by: Pawel Biernacki <pawel.biernacki@gmail.com>
Reviewed by: grehan, oshogbo
Approved by: emaste, grehan
Sponsored by: Mysterious Code Ltd.
Differential Revision: https://reviews.freebsd.org/D8290

7 years agoOrder alphabetically.
kib [Tue, 14 Feb 2017 03:32:37 +0000 (03:32 +0000)]
Order alphabetically.

Noted by: alc
MFC after: 3 days

7 years agoUse %s __func__ to print the actual function name (been looking at
bz [Tue, 14 Feb 2017 01:20:03 +0000 (01:20 +0000)]
Use %s __func__ to print the actual function name (been looking at
the wrong one for too often lately at first), and also use %#lx to
get the 0x prefix for the address.

MFC after: 1 week

7 years agoHandle clang 4.x+ with the compile-time exception added in r312213
ngie [Tue, 14 Feb 2017 00:54:48 +0000 (00:54 +0000)]
Handle clang 4.x+ with the compile-time exception added in r312213

It also fails the assertions noted in bug 208703

PR: 208703
PR: 217084
Submitted by: jbeich
MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years ago[sdhci_acpi] Add support for Bay Trail SDHC SD card slot
gonzo [Tue, 14 Feb 2017 00:04:36 +0000 (00:04 +0000)]
[sdhci_acpi] Add support for Bay Trail SDHC SD card slot

Add ACPI device 80860F14 with _UID 3 to the list of known devices. It
make SD card available on NUCs and Minnowboard. Previously added _UID 1
covered only eMMC devices.

Reported by: kib@
MFC after: 1 week

7 years agovtnet: don't update VLAN filter when parent is not running
philip [Mon, 13 Feb 2017 21:44:29 +0000 (21:44 +0000)]
vtnet: don't update VLAN filter when parent is not running

Submitted by: Gerrie Roos <groos -at- xiplink -dot- com>
Reviewed by: gnn
Sponsored by: XipLink, Inc.
Differential Revision: https://reviews.freebsd.org/D9573

7 years agoloader: cstyle fixes and DIOCGMEDIASIZE should use uint64_t
tsoome [Mon, 13 Feb 2017 21:33:50 +0000 (21:33 +0000)]
loader: cstyle fixes and DIOCGMEDIASIZE should use uint64_t

Cleaned up some spaces where tabs should be.
efipart_ioctl() DIOCGMEDIASIZE needs to use uint64_t, not off_t

Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D9562

7 years agoFix build of BSD dtc when NDEBUG is defined (MK_ASSERT_DEBUG=no):
dim [Mon, 13 Feb 2017 20:56:53 +0000 (20:56 +0000)]
Fix build of BSD dtc when NDEBUG is defined (MK_ASSERT_DEBUG=no):
* Initialize correct parent in binary_operator's constructor.
* Include <errno.h> explicitly, otherwise errno is undefined (without
  NDEBUG, this is accidentally 'fixed' by including <iostream>).

Reported by: matteo
MFC after: 3 days

7 years agoRemove debugging code that was probably unused since before the arm code
cognet [Mon, 13 Feb 2017 20:51:08 +0000 (20:51 +0000)]
Remove debugging code that was probably unused since before the arm code
was initially committed.

Reported by: Alexandre Martins <alexandre.martins@stormshield.eu>

7 years agoRemove M_PKTHDR from m_getm2() in icl_pdu_append_data().
mav [Mon, 13 Feb 2017 20:36:28 +0000 (20:36 +0000)]
Remove M_PKTHDR from m_getm2() in icl_pdu_append_data().

ip_data_mbuf is always appended to ip_bhs_mbuf, so it does not need own
packet header.  This change first avoids allocation/initialization of the
header, and then avoids dropping one when it later gets to socket buffer.

MFC after: 2 weeks

7 years ago[mips/broadcom] Move MIPS-specific bhnd(4) nexus drivers to
landonf [Mon, 13 Feb 2017 19:58:55 +0000 (19:58 +0000)]
[mips/broadcom] Move MIPS-specific bhnd(4) nexus drivers to
sys/mips/broadcom, and add MIPS/BCM4706-specific workaround to
bhnd_nexus_is_hw_disabled() -- the BCM4706 low-cost package leaves
secondary GMAC cores floating.

Reviewed by: mizhka
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D9499

7 years agoMake <sys/event.h> work on its own.
ed [Mon, 13 Feb 2017 19:00:09 +0000 (19:00 +0000)]
Make <sys/event.h> work on its own.

Right now this header file doesn't want to build when included on its
own, as it depends on some integer types that are only declared
internally. Switch it over to use <sys/_types.h> and the __*
counterparts.

7 years agoFix typo where opening brace was needed.
stevek [Mon, 13 Feb 2017 18:52:26 +0000 (18:52 +0000)]
Fix typo where opening brace was needed.

Reported by: Michael Butler
Reviewed by: sjg
Approved by: sjg (mentor)

7 years agoFor MD_PRELOAD type md(4) devices, if there is a file name in the preloaded
stevek [Mon, 13 Feb 2017 17:44:07 +0000 (17:44 +0000)]
For MD_PRELOAD type md(4) devices, if there is a file name in the preloaded
meta-data, copy it into the softc structure.

When returning md(4) device details to the caller, include the file name in
any MD_PRELOAD type devices if it is set (first character is not NUL.)

In mdconfig, for "preload" type md(4) devices, if there is file config
available, print it in the file column of the output.

Reviewed by: brooks
Approved by: sjg (mentor)
MFC after: 1 month
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D9529

7 years agoRemove IPsec related PCB code from SCTP.
ae [Mon, 13 Feb 2017 11:37:52 +0000 (11:37 +0000)]
Remove IPsec related PCB code from SCTP.

The inpcb structure has inp_sp pointer that is initialized by
ipsec_init_pcbpolicy() function. This pointer keeps strorage for IPsec
security policies associated with a specific socket.
An application can use IP_IPSEC_POLICY and IPV6_IPSEC_POLICY socket
options to configure these security policies. Then ip[6]_output()
uses inpcb pointer to specify that an outgoing packet is associated
with some socket. And IPSEC_OUTPUT() method can use a security policy
stored in the inp_sp. For inbound packet the protocol-specific input
routine uses IPSEC_CHECK_POLICY() method to check that a packet conforms
to inbound security policy configured in the inpcb.

SCTP protocol doesn't specify inpcb for ip[6]_output() when it sends
packets. Thus IPSEC_OUTPUT() method does not consider such packets as
associated with some socket and can not apply security policies
from inpcb, even if they are configured. Since IPSEC_CHECK_POLICY()
method is called from protocol-specific input routine, it can specify
inpcb pointer and associated with socket inbound policy will be
checked. But there are two problems:
1. Such check is asymmetric, becasue we can not apply security policy
from inpcb for outgoing packet.
2. IPSEC_CHECK_POLICY() expects that caller holds INPCB lock and
access to inp_sp is protected. But for SCTP this is not correct,
becasue SCTP uses own locks to protect inpcb.

To fix these problems remove IPsec related PCB code from SCTP.
This imply that IP_IPSEC_POLICY and IPV6_IPSEC_POLICY socket options
will be not applicable to SCTP sockets. To be able correctly check
inbound security policies for SCTP, mark its protocol header with
the PR_LASTHDR flag.

Reported by: tuexen
Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D9538

7 years agoRework r313352.
kib [Mon, 13 Feb 2017 09:04:38 +0000 (09:04 +0000)]
Rework r313352.

Rename kern_vm_* functions to kern_*.  Move the prototypes to
syscallsubr.h.  Also change Mach VM types to uintptr_t/size_t as
needed, to avoid headers pollution.

Requested by: alc, jhb
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D9535

7 years agoMFV r313676: libpcap 1.8.1
delphij [Mon, 13 Feb 2017 08:23:39 +0000 (08:23 +0000)]
MFV r313676: libpcap 1.8.1

MFC after: 1 month

7 years agoiwi: add 12-14 2GHz channels into channel list.
avos [Mon, 13 Feb 2017 02:15:56 +0000 (02:15 +0000)]
iwi: add 12-14 2GHz channels into channel list.

Return full channel list via iwi_getradiocaps() method
(ieee80211_init_channels() was replaced with iwi_getradiocaps()
to be consistent with other drivers).

PR: 216923
Submitted and tested by: ds@ukrhub.net (original patch)
MFC after: 5 days

7 years agoRemove MPSAFE and ARGUSED annotations, ANSI-fy syscall handlers.
kib [Mon, 13 Feb 2017 00:40:55 +0000 (00:40 +0000)]
Remove MPSAFE and ARGUSED annotations, ANSI-fy syscall handlers.

Discussed with: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoStyle: wrap long line.
kib [Mon, 13 Feb 2017 00:39:43 +0000 (00:39 +0000)]
Style: wrap long line.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

7 years agoOnly trigger em_local_timer on queue index 0. This was causing continuous
sbruno [Sun, 12 Feb 2017 23:06:41 +0000 (23:06 +0000)]
Only trigger em_local_timer on queue index 0.  This was causing continuous
em_local_timer() executions during normal operation and was very likely
to cause a lock up on igb(4) devices.

Submitted by: Matt Macy (mmacy@nextbsd.org)
Reported by: jtl
Reviewed by: gallatin
Sponsored by: Limelight Networks & Netflix

7 years agoConsistently handle negative or wrapping offsets in the mmap(2) syscalls.
kib [Sun, 12 Feb 2017 21:05:44 +0000 (21:05 +0000)]
Consistently handle negative or wrapping offsets in the mmap(2) syscalls.

For regular files and posix shared memory, POSIX requires that
[offset, offset + size) range is legitimate.  At the maping time,
check that offset is not negative.  Allowing negative offsets might
expose the data that filesystem put into vm_object for internal use,
esp. due to OFF_TO_IDX() signess treatment.  Fault handler verifies
that the mapped range is valid, assuming that mmap(2) checked that
arithmetic gives no undefined results.

For device mappings, leave the semantic of negative offsets to the
driver.  Correct object page index calculation to not erronously
propagate sign.

In either case, disallow overflow of offset + size.

Update mmap(2) man page to explain the requirement of the range
validity, and behaviour when the range becomes invalid after mapping.

Reported and tested by: royger (previous version)
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoSwitch copyout_map() to use vm_mmap_object() instead of vm_mmap().
kib [Sun, 12 Feb 2017 20:54:31 +0000 (20:54 +0000)]
Switch copyout_map() to use vm_mmap_object() instead of vm_mmap().

This is both a microoptimization and a move of the consumer to more
commonly used vm function.

Suggested and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoremove l2_padding_needed statistic from zfs arc
avg [Sun, 12 Feb 2017 19:45:30 +0000 (19:45 +0000)]
remove l2_padding_needed statistic from zfs arc

It became obsolete when the Compressed ARC support was committed.

MFC after: 1 week

7 years agocheck remaining space in zfs implementations of vptocnp
avg [Sun, 12 Feb 2017 19:40:59 +0000 (19:40 +0000)]
check remaining space in zfs implementations of vptocnp

PR: 216939
Submitted by: Iouri V. Ivliev <fbsd@any.com.ru>
MFC after: 1 week

7 years agoFix r313284.
dchagin [Sun, 12 Feb 2017 15:22:50 +0000 (15:22 +0000)]
Fix r313284.

Members of the syscall argument structures are padded to a word size. So,
for COMPAT_LINUX32 we should convert user supplied system call arguments
which is 32-bit in that case to the array of register_t.

Reported by: Oleg V. Nauman
MFC after: 1 week