]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r320658:
kib [Tue, 11 Jul 2017 05:31:37 +0000 (05:31 +0000)]
MFC r320658:
When reporting undefined symbol, note the version, if specified.

6 years agoMFC r320785:
gjb [Mon, 10 Jul 2017 12:24:56 +0000 (12:24 +0000)]
MFC r320785:
 Connect ena(4) to the build.

Sponsored by: The FreeBSD Foundation

6 years agoMFC 313727, 317483
grehan [Mon, 10 Jul 2017 06:28:50 +0000 (06:28 +0000)]
MFC 313727, 317483
  In addition, replace the missing caph routines with
small helper functions (bhyverun.c) or an open-coded
replacement (uart_emul.c)

  313727   Capsicumize bhyve
  317483   Allow CAP_MMAP_RW on memfd for PCI passthru

6 years agoMFC r320619:
kib [Mon, 10 Jul 2017 05:59:06 +0000 (05:59 +0000)]
MFC r320619:
Resolve confusion between different error code spaces.

6 years agoMFC r319455,r319456:
ngie [Mon, 10 Jul 2017 05:34:37 +0000 (05:34 +0000)]
MFC r319455,r319456:

r319455:

Fix up `TEST_METADATA`

- `TEST_METADATA.foo` should be `TEST_METADATA.run_tests`: this will unbreak
  trying to run the tests on a system without python installed in $PATH.
- The tests require root because they load aesni(4) and/or cryptodev(4) if
  not already loaded.

r319456:

tests/sys/opencrypto/runtests: apply minor polish to test script

- Refactor kld loading/unloading logic:
-- Use a loop instead of an unrolled one.
-- Check for the module being loaded before trying to load it, to reduce
   noise when loading modules that are already loaded.
-- Don't mute stderr from kldload -- it could be potentially useful to
   the tester.
-- In the event that the test script was terminated early, it would leave
   the modules still attached to the system (which is undesirable).
   Always unload the modules at test end with EXIT/SIGINT/SIGTERM so the
   system is returned to its former operating state as best possible.
   Unload the modules in reverse order, in part for consistency and/or
   dependency reasons.

6 years agoMFC r311699
grehan [Mon, 10 Jul 2017 03:11:48 +0000 (03:11 +0000)]
MFC r311699

ps2 mouse fixes, found by plan9/9front.

Reminded by: sevan

6 years agoMFC r320408:
pfg [Sun, 9 Jul 2017 15:13:40 +0000 (15:13 +0000)]
MFC r320408:
ext2fs: Support e2di_uid_high and e2di_gid_high.

The fields exist on all versions of the filesystem and using them is a mount
option on linux. For FreeBSD, the corresponding i_uid and i_gid are always
long enough so use them by default.

Reviewed by: Fedor Uporov

6 years agoMFC r320079:
pfg [Sun, 9 Jul 2017 15:03:41 +0000 (15:03 +0000)]
MFC r320079:
ext2fs: Enable RO huge_file feature support.

We have support for reading ext4 "huge" files but we can't write
(anything) on ext4. and some filesystem. Formally enable the feature
so that we can mount such filesystems.

Submitted by: Fedor Uporov

6 years agoMFC 320675: Add deprecation notices for gdb and kgdb.
jhb [Sun, 9 Jul 2017 04:13:33 +0000 (04:13 +0000)]
MFC 320675: Add deprecation notices for gdb and kgdb.

Even though gdb and kgdb may not be removed for 12.0 on some architectures,
the notice is unconditional as these tools will likely be removed at some
point in the future when adequate replacements are available (gdb in ports
or lldb in base).

6 years agoMFC r320570:
kib [Sun, 9 Jul 2017 03:54:10 +0000 (03:54 +0000)]
MFC r320570:
Correct signatures of several pthreads stubs.

6 years agoMFC r320069: Add ZFS to Linux statfs ftype
emaste [Sun, 9 Jul 2017 00:24:52 +0000 (00:24 +0000)]
MFC r320069: Add ZFS to Linux statfs ftype

PR: 220086
Sponsored by: The FreeBSD Foundation

6 years agoMFC r320665:
delphij [Sat, 8 Jul 2017 04:30:11 +0000 (04:30 +0000)]
MFC r320665:

In open_binary_fd: when using buffer size for strl* and snprintf,
always use >= instead of > to avoid truncation.

releng/11.1 candidate.

6 years agoDirect commit to fix a mismerge in r320797.
markj [Sat, 8 Jul 2017 02:02:49 +0000 (02:02 +0000)]
Direct commit to fix a mismerge in r320797.

6 years agoMFC r311346, r311352, r313756:
markj [Sat, 8 Jul 2017 01:56:48 +0000 (01:56 +0000)]
MFC r311346, r311352, r313756:
Add an allocator for KVA for execve arguments.

6 years agoMFC: r320208
rmacklem [Fri, 7 Jul 2017 21:26:27 +0000 (21:26 +0000)]
MFC: r320208
Ensure that the credentials field of the NFSv4 client open structure is
initialized.

bdrewery@ has reported panics "newnfs_copycred: negative nfsc_ngroups".
The only way I can see that this occurs is that the credentials field of
the open structure gets used before being filled in.
I am not sure quite how this happens, but for the file create case, the
code is serialized via the vnode lock on the directory. If, somehow, a
link to the same file gets created just after file creation, this might
occur.

This patch ensures that the credentials field is initialized to a reasonable
set of credentials before the structure is linked into any list, so I
this should ensure it is initialized before use.
I am committing the patch now, since bdrewery@ notes that the panics
are intermittent and it may be months before he knows if the patch fixes
his problem.

6 years agoMFC r312208, r312994:
markj [Fri, 7 Jul 2017 16:59:14 +0000 (16:59 +0000)]
MFC r312208, r312994:
Optimize vm_object_madvise().

6 years agoMFC r310888:
eugen [Fri, 7 Jul 2017 13:44:18 +0000 (13:44 +0000)]
MFC r310888:

  Retry to open an F_PIPE process when it dies unexpectedly.

PR:           215335
Reviewed by:  ae
Approved by:  az (mentor)

6 years agoMFC 320490
sephe [Fri, 7 Jul 2017 08:49:37 +0000 (08:49 +0000)]
MFC 320490

    hyperv/input: Remove unnecessary inclusion.

    The unbreaks gcc compilation.

    Submitted by:   Ryan Libby
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11415

6 years agoMFC r318894: Enable Amazon's "Elastic Network Adapter" in EC2 AMIs.
cperciva [Thu, 6 Jul 2017 22:34:54 +0000 (22:34 +0000)]
MFC r318894: Enable Amazon's "Elastic Network Adapter" in EC2 AMIs.

6 years agoMFC r320748:
gjb [Thu, 6 Jul 2017 18:46:33 +0000 (18:46 +0000)]
MFC r320748:
 Allow passing NOPKG= to make(1) to enable the pkg-stage target
 from getting executed when NOPKG is defined but empty.

Approved by: re (kib, insta-MFC)
Sponsored by: The FreeBSD Foundation

6 years agoMFC 319803
gnn [Thu, 6 Jul 2017 18:33:33 +0000 (18:33 +0000)]
MFC 319803

Manual page for the DTrace lockstat provider

Reviewed by: markj

6 years agoFix up r320731:
cperciva [Thu, 6 Jul 2017 18:08:38 +0000 (18:08 +0000)]
Fix up r320731:
* Record mergeinfo for merges of r317518, r318647, r319197, r319198,
r319199, r319201, r320625, r320626, r320628, r320629, r320630, r320631,
r320632.
* Merge r319200, which (commit message notwithstanding) seems to have
gotten lost from the r320731 merge.

6 years agoMFC r320165-r320167
asomers [Thu, 6 Jul 2017 17:34:53 +0000 (17:34 +0000)]
MFC r320165-r320167

r320165:
devd(8): Remove pidfile on shutdown

Sponsored by: Spectra Logic Corp

r320166:
Require devd to be running for its ATF tests to run

The ATF tests communicate with the system's running devd

PR: 220169
Reported by: gjb
Sponsored by: Spectra Logic Corp

r320167:
zfsd(8): Remove pidfile on shutdown

Sponsored by: Spectra Logic Corp

6 years agoMFC r320690:
markj [Thu, 6 Jul 2017 17:20:35 +0000 (17:20 +0000)]
MFC r320690:
Defer ACPI taskqueue creation to SI_SUB_KICK_SCHEDULER.

PR: 220277

6 years agoMFC r317518, r318647, r319197, r319198, r319199, r319200, r320625, r320626,
zbb [Thu, 6 Jul 2017 11:45:13 +0000 (11:45 +0000)]
MFC r317518, r318647, r319197, r319198, r319199, r319200, r320625, r320626,
r320628, r319201, r320629, r320630, r320631, r320632.

r317518:
Import Amazon Elastic Network Adapter (ENA) HAL to sys/contrib/

Import from vendor-sys/ena-com/1.1.4.1
SVN rev.: 317516
Version: 1.1.4.1

r318647:
Add support for Amazon Elastic Network Adapter (ENA) NIC

ENA is a networking interface designed to make good use of modern CPU
features and system architectures.

The ENA device exposes a lightweight management interface with a
minimal set of memory mapped registers and extendable command set
through an Admin Queue.

The driver supports a range of ENA devices, is link-speed independent
(i.e., the same driver is used for 10GbE, 25GbE, 40GbE, etc.), and has
a negotiated and extendable feature set.

Some ENA devices support SR-IOV. This driver is used for both the
SR-IOV Physical Function (PF) and Virtual Function (VF) devices.

ENA devices enable high speed and low overhead network traffic
processing by providing multiple Tx/Rx queue pairs (the maximum number
is advertised by the device via the Admin Queue), a dedicated MSI-X
interrupt vector per Tx/Rx queue pair, and CPU cacheline optimized
data placement.

The ENA driver supports industry standard TCP/IP offload features such
as checksum offload and TCP transmit segmentation offload (TSO).
Receive-side scaling (RSS) is supported for multi-core scaling.

The ENA driver and its corresponding devices implement health
monitoring mechanisms such as watchdog, enabling the device and driver
to recover in a manner transparent to the application, as well as
debug logs.

Some of the ENA devices support a working mode called Low-latency
Queue (LLQ), which saves several more microseconds. This feature will
be implemented for driver in future releases.

r319197:
Add mbuf defragmentation to the ENA driver

When mbuf chain is too long and device cannot handle that number
of segments in DMA transaction, mbuf chain will be defragmented.
Initially, driver was dropping all mbuf chains that were exceeding
supported number of segments.

r319198:
Add locks before each ena_up and ena_down

Lock only ena_up and ena_down calls in ioctl handler, instead of whole
ioctl. Locking ioctl with sx lock that is sleepable, is not allowed in
some cases, e.g. when multicast options are being changed.
Additional locking was added in deatch function to prevent race condition
with ioctl function.

r319199:
Add error handling to the ENA driver if init of the reset task fails

Also, to simplify cleaning routine, reset task is initialized before
allocating statistics and other resources.

r319200:
Move ENA's hw stats updating routine to separate task

Initially, stats were being updated each time OS was requesting for
the first statistic.
To read statistics from hw, condvar was used. cv_timedwait cannot be
called when unsleepable lock is held, and this happens when FreeBSD
is requesting statistic.
Seperate task is reading statistics from NIC each 1 second.

r319201:
Introduce additional locks when releasing TX resources and buffers in ENA

There could be race condition with TX cleaning routine when cleaning mbufs,
when it was called directly from main sending thread (ena_mq_start).

r320625:
Add missing lock upon initialization of the interface

Lack of this lock was causing crash if down was called in
parallel with the initialization routine.

r320626:
Acquire locks before calling drbr_flush()

It is required to hold lock that is associated with buffer ring before
flushing drbr.

r320628:
Unmask all IO irqs after driver state is set as running

If driver left MSI-x handlling routine because interface was put down,
it is not unmasking IRQs, so any requesting interrupt will be awaiting
for unmasking.

On ena_up() routine all interrupts are being unmasked and any awaiting
interrupt will be handled right away.

If handler was executed before driver state was set as running, handling
routine is being ended immediately, leaving IO irqs for given queue
masked.

r320629:
Call drbr_advance() before leaving TX routine

If drbr_advance() is not called before doing cleanup and packet is
already enqueued for sending (tx_info is holding pointer to mbuf), then
mbuf is cleaned both in drbr_flush() and in cleanup routine, when all
mbufs hold by tx_buffer_info are being released.

This causes panic, because mbuf is released twice.

r320630:
Remove RX mtx from ENA driver

RX lock is no longer required. There can only be one RX cleanup task
running at a time, RX cleanup cannot be executed if interface is not
yet initialized and ena_down() will not free any RX resources if any io
interrupt is being handled - RX cleanup task is only called from an
interrupt handler.

r320631:
Fix creation of dma tags and TSO settings

TSO settings were not reflecting real HW capabilities.

DMA tags were created with wrong window - high address was the same as
low, so excluding window was not working.

Capabilities of TX dma transaction were not set properly - TSO max size
had been increased and size of one segment had been adjusted.

r320632:
Replace mbuf defragmentation with collapse

Collapse should be more effective than defragmentation.
Added missing declaration of ena_check_and_collapse_mbuf().

Submitted by: Michal Krawczyk <mk@semihalf.com>
Jakub Palider <jpa@semihalf.com>
Jan Medala <jan@semihalf.com>
Obtained from: Semihalf, Amazon.com Inc.
Sponsored by: Amazon.com Inc.

6 years agoMFC r317161:
ngie [Thu, 6 Jul 2017 05:59:22 +0000 (05:59 +0000)]
MFC r317161:

which(1): sort #includes

No functional change [intended].

6 years agoRegenerate src.conf(5)
ngie [Thu, 6 Jul 2017 05:53:38 +0000 (05:53 +0000)]
Regenerate src.conf(5)

6 years agoMFC r317179:
ngie [Thu, 6 Jul 2017 05:51:23 +0000 (05:51 +0000)]
MFC r317179:

Clean up WITH*_PROFILE

- Clarify that profiled libraries are usable with gprof(8).
- Add WITH_PROFILE to complement WITHOUT_PROFILE and placate makeman.

6 years agoMFC r318651:
ngie [Thu, 6 Jul 2017 05:30:11 +0000 (05:30 +0000)]
MFC r318651:

Remove glimpse make target added in r181432

The textproc/glimpse port expired over 3 years ago because there weren't any
more publicly available distfiles, and because it lacked a maintainer. Remove
the target as it's no longer executable on FreeBSD.

6 years agoMFC r319626:
ngie [Thu, 6 Jul 2017 05:28:32 +0000 (05:28 +0000)]
MFC r319626:

Add basic tests for echo(1)

Verify that echo(1) does not...
- ... print the trailing newline character with option '-n'.
- ... print the trailing newline character when '\c' is appended to
      the end of the string.

6 years agoMFC r319637:
ngie [Thu, 6 Jul 2017 05:26:24 +0000 (05:26 +0000)]
MFC r319637:

Add testcases for `cat -b`

6 years agoMFC r319634:
ngie [Thu, 6 Jul 2017 05:22:02 +0000 (05:22 +0000)]
MFC r319634:

Add additional testcases for cat(1)

Verify the following additional cases:
- -s (in isolation, in addition to the -se testcase obtained via the
      NetBSD test).
- -vt

6 years agoMFC r320599:
gjb [Thu, 6 Jul 2017 00:43:43 +0000 (00:43 +0000)]
MFC r320599:
 Fix Vagrant image upload after recent API changes.

 - Update ATLAS_UPLOAD_URL to avoid various regular expressions
   from failing to match due to redirections.
 - Use ATLAS_UPLOAD_URL throughout the script.
 - Adjust several regular expression patterns.

Sponsored by: The FreeBSD Foundation

6 years agoThis update is primarily bug fixes in C++ symbol demangling, including:
emaste [Wed, 5 Jul 2017 16:39:29 +0000 (16:39 +0000)]
This update is primarily bug fixes in C++ symbol demangling, including:

- rvalue reference
- builtin type auto and decltype(auto)
- revamped support for function return types
- formatting fixes
- omit void when its the only param
- ref-qualifiers and others in function types
- type qualifiers in pointer-to-member function types
- incorrect handling regarding CV-qualifiers in function types
- ref-qualifier found in nested-name
- properly handle <name> ::= <substitute><template-args>
- make sure that nested function name is not a substitute candidate
- correctly handle expression in template args
- skip unknown substitution abbreviations

Also r320663 libelftc: bump version, tracking import in r320343

6 years agoMFC r320451:
markj [Wed, 5 Jul 2017 16:21:26 +0000 (16:21 +0000)]
MFC r320451:
Complete support for the IO_APPEND flag in fuse.

6 years agoMFC r320163:
asomers [Wed, 5 Jul 2017 15:59:52 +0000 (15:59 +0000)]
MFC r320163:

Fix usr.sbin/makefs/makefs_ffs_tests when /etc/fstab does not exist

dumpfs prints a harmless warning message (via ufs_disk_fillout(3) and
getfsfile(3)), when /etc/fstab does not exist.  We can ignore it.

PR: 220165
Reported by: gjb
Sponsored by: Spectra Logic Corp

6 years agoMFC r319714, r319854
asomers [Wed, 5 Jul 2017 15:58:23 +0000 (15:58 +0000)]
MFC r319714, r319854

r319714:
Add tests for ln(1)

* Verify that when creating a hard link to a symbolic link, '-L' option
  creates a hard link to the target of the symbolic link
* Verify that when creating a hard link to a symbolic link, '-P' option
  creates a hard link to the symbolic link itself
* Verify that if the target file already exists, '-f' option unlinks it so
  that link may occur
* Verify that if the target file or directory is a symbolic link, '-shf'
  option prevents following the link
* Verify that if the target file or directory is a symbolic link, '-snf'
  option prevents following the link
* Verify that '-s' option creates a symbolic link
* Verify that '-w' option produces a warning if the source of a symbolic
  link does not currently exist

Submitted by: shivansh
Reviewed by: asomers, ngie
Sponsored by: Google, Inc (GSoC 2017)
Differential Revision: https://reviews.freebsd.org/D11084

r319854:
bin/ln: Set umask appropriately before creating files for testing

These changes were missed in D11084

Submitted by: shivansh
Reviewed by: asomers
X-MFC-With: 319714
Sponsored by: Google, Inc (GSoC 2017)
Differential Revision: https://reviews.freebsd.org/D11158

6 years agoMFC r319900:
asomers [Wed, 5 Jul 2017 15:50:41 +0000 (15:50 +0000)]
MFC r319900:

sbin/ipfw: strcpy, strncpy => strlcpy

Reported by: Coverity
CID: 13561621356166
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10662

6 years agoMFC r319337:
asomers [Wed, 5 Jul 2017 15:34:06 +0000 (15:34 +0000)]
MFC r319337:

Fix integer overflow in "camcontrol format"

Reported by: Coverity
CID: 1011426
Sponsored by: Spectra Logic Corp

6 years agoMFC r318790, r319336
asomers [Wed, 5 Jul 2017 15:31:42 +0000 (15:31 +0000)]
MFC r318790, r319336

r318790:
Fix a buffer overflow in bootparamd(8)

If /etc/bootparams contains a line with an excessively long pathname, and a
client asks for that path, then bootparamd will overflow a buffer and crash
while parsing that line.  This is not remotely exploitable since it requires
a malformed /etc/bootparams file.

Reported by: Coverity
CID: 1305954
Sponsored by: Spectra Logic Corp

r319336:
Fix uninitialized variable in bootparamd.c

Restore line that was accidentally deleted in change 318790

Reported by: Coverity
CID: 1375855
X-MFC-With: 318790
Sponsored by: Spectra Logic Corp

6 years agoMFC r320318:
kib [Wed, 5 Jul 2017 06:32:53 +0000 (06:32 +0000)]
MFC r320318:
Use address space guard to implement inter-segment gap.

6 years agoAdd MAP_GUARD and use it for stack grow area protection.
kib [Wed, 5 Jul 2017 06:18:00 +0000 (06:18 +0000)]
Add MAP_GUARD and use it for stack grow area protection.
Bump __FreeBSD_version.

MFC r320317:
Implement address space guards.

MFC r320338:
Remove stale part of the comment.

MFC r320339:
Correctly handle small MAP_STACK requests.

MFC r320344:
For now, allow mprotect(2) over the guards to succeed regardless of
the requested protection.

MFC r320430:
Treat the addr argument for mmap(2) request without MAP_FIXED flag as
a hint.

MFC r320560 (by alc):
Modify vm_map_growstack() to protect itself from the possibility of the
gap entry in the vm map being smaller than the sysctl-derived stack guard
size.

6 years agoMFC r320644:
allanjude [Tue, 4 Jul 2017 15:53:23 +0000 (15:53 +0000)]
MFC r320644:
Add deprecation notices for all rcmd tools

6 years agoMFC r320403, r320497
andrew [Tue, 4 Jul 2017 10:54:08 +0000 (10:54 +0000)]
MFC r320403, r320497

r320403:
Some of the atomic_clear_* functions were incorrectly defined to be an
atomic add. Correct these, fixing a NULL-pointer dereference in netgraph.

PR: 220273
Sponsored by: DARPA, AFRL

r320497:
Remove a blank line accidentally added in r320403.

6 years agoMFC r320422:
kib [Tue, 4 Jul 2017 04:53:21 +0000 (04:53 +0000)]
MFC r320422:
Do not ignore an error from vm_mmap_object().

6 years agoMFC r319699
alc [Mon, 3 Jul 2017 22:20:42 +0000 (22:20 +0000)]
MFC r319699
  When allocating swap blocks, if the available number of free blocks in a
  subtree is already zero, then setting the "largest contiguous free block"
  hint for that subtree to anything other than zero makes no sense.  (To be
  clear, assigning a value to the hint that is too large is not a correctness
  problem, only a pessimization.)

MFC r319755
  blist_fill()'s return type is too narrow.  blist_fill() accepts a 64-bit
  quantity as the size of the range to fill, but returns a 32-bit quantity
  as the number of blocks that were allocated to fill that range.  This
  revision corrects that mismatch.

MFC r319793
  Remove an unnecessary field from struct blist.  (The comment describing
  what this field represented was also inaccurate.)

  In r178792, blist_create() grew a malloc flag, allowing M_NOWAIT to be
  specified.  However, blist_create() was not modified to handle the
  possibility that a malloc() call failed.  Address this omission.

  Increase the width of the local variable "radix" to 64 bits.  This
  matches the width of the corresponding field in struct blist.

6 years agoMFC: r319882, r320062, r320070, r320126
rmacklem [Mon, 3 Jul 2017 19:46:12 +0000 (19:46 +0000)]
MFC: r319882, r320062, r320070, r320126
Make MAXBCACHEBUF a tunable called vfs.maxbcachebuf.

By making MAXBCACHEBUF a tunable, it can be increased to allow for
larger read/write data sizes for the NFS client.
The tunable is limited to MAXPHYS, which is currently 128K.
Making MAXPHYS a tunable or increasing its value is being discussed,
since it would be nice to support a read/write data size of 1Mbyte
for the NFS client when mounting the AmazonEFS file service.

Also, define NFS_MAXXDR as the upper bound on XDR overhead in an NFS RPC.

6 years agoMFC r303052:
markj [Mon, 3 Jul 2017 18:42:26 +0000 (18:42 +0000)]
MFC r303052:
Make vm_pageout_wakeup_thresh a u_int rather than an int.

6 years agoMFC r309017 (partially):
markj [Mon, 3 Jul 2017 16:40:05 +0000 (16:40 +0000)]
MFC r309017 (partially):
Omit v_cache_count when computing the number of free pages, since its
value is always 0.

6 years agoMFC r320421:
ken [Mon, 3 Jul 2017 15:34:21 +0000 (15:34 +0000)]
MFC r320421:

  ------------------------------------------------------------------------
  r320421 | ken | 2017-06-27 13:26:02 -0600 (Tue, 27 Jun 2017) | 37 lines

  Fix a panic in camperiphfree().

  If a peripheral driver (e.g. da, sa, cd) is added or removed from the
  peripheral driver list while an unrelated peripheral driver instance (e.g.
  da0, sa5, cd2) is going away and is inside camperiphfree(), we could
  dereference an invalid pointer.

  When peripheral drivers are added or removed (see periphdriver_register()
  and periphdriver_unregister()), the peripheral driver array is resized
  and existing entries are moved.

  Although we hold the topology lock while we traverse the peripheral driver
  list, we retain a pointer to the location of the peripheral driver pointer
  and then drop the topology lock.  So we are still vulnerable to the list
  getting moved around while the lock is dropped.

  To solve the problem, cache a copy of the peripheral driver pointer.  If
  its storage location in the list changes while we have the lock dropped, it
  won't have any effect.

  This doesn't solve the issue that peripheral drivers ("da", "cd", as opposed
  to individual instances like "da0", "cd0") are not generally part of a
  reference counting scheme to guard against deregistering them while there
  are instances active.  The caller (generally the person unloading a module)
  has to be aware of active drivers and not unload something that is in use.

  sys/cam/cam_periph.c:
   In camperiphfree(), cache a pointer to the peripheral driver
   instance to avoid holding a pointer to an invalid memory location
   in the event that the peripheral driver list changes while we have
   the topology lock dropped.

  PR: kern/219701
  Submitted by: avg
  Sponsored by: Spectra Logic

  ------------------------------------------------------------------------
PR: kern/219701
Sponsored by: Spectra Logic

6 years agoMFC r320420:
ken [Mon, 3 Jul 2017 15:10:16 +0000 (15:10 +0000)]
MFC r320420:

  ------------------------------------------------------------------------
  r320420 | ken | 2017-06-27 11:55:25 -0600 (Tue, 27 Jun 2017) | 25 lines

  In scsi_zbc_in(), fill in the length in the ZBC IN CDB.

  Without the allocation length set, the target will either reject
  the command or complete it without transferring any data.

  This fixes the REPORT ZONES command for SCSI ZBC protocol devices,
  as well as ATA ZAC protocol devices that are behind a SCSI to ATA
  translation layer.  (LSI/Broadcom's 12Gb SAS adapters translate ZBC
  commands to ZAC commands.)  Those are Host Aware and Host Managed SMR
  drives.

  This will fix REPORT ZONE commands sent to the da(4) driver via the
  GEOM bio interface and zonectl, and REPORT ZONE commands sent from
  camcontrol(8).

  Note that in the case of camcontrol(8), we currently only send
  SCSI ZBC commands to native SCSI protocol devices, not ATA devices
  behind a SAT layer.

  sys/cam/scsi/scsi_da.c:
   Fill in the length field in scsi_zbc_in().

  Sponsored by: Spectra Logic
  ------------------------------------------------------------------------

6 years agoMFC r320488:
gjb [Mon, 3 Jul 2017 13:02:21 +0000 (13:02 +0000)]
MFC r320488:
 Correct the branch naming convention in param.h.
 While here, consistently use upper-case 'X' to represent the
 version number.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r320479:
ae [Mon, 3 Jul 2017 08:53:22 +0000 (08:53 +0000)]
MFC r320479:
  Fix IPv6 extension header parsing. The length field doesn't include the
  first 8 octets.

  Obtained from: Yandex LLC

6 years agoMFC r320093: Check return value of seteuid() and bail out if we fail.
delphij [Mon, 3 Jul 2017 05:22:10 +0000 (05:22 +0000)]
MFC r320093: Check return value of seteuid() and bail out if we fail.

6 years agoMFC r320494: Fix double free by reverting r300385 and r300624 which was
delphij [Mon, 3 Jul 2017 02:11:14 +0000 (02:11 +0000)]
MFC r320494: Fix double free by reverting r300385 and r300624 which was
false positive reported by cppcheck.

releng/11.1 candidate.

6 years agoMFC r319969-r319970
araujo [Sun, 2 Jul 2017 04:22:37 +0000 (04:22 +0000)]
MFC r319969-r319970

r319969:
Use nitems() from sys/param.h.

r319970:
Use nitems() from sys/param.h.

6 years agoMFC r319678:
araujo [Sun, 2 Jul 2017 04:19:03 +0000 (04:19 +0000)]
MFC r319678:

Allow sysctl kern.vm_guest to return bhyve when running under bhyve.

Submitted by: Sean Fagan <sef@ixsystems.com>
Reviewed by: grehan
MFH: 4 weeks.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11090

6 years agoMFC r319487-r319488, r319682, r319968, r319995
araujo [Sun, 2 Jul 2017 04:14:34 +0000 (04:14 +0000)]
MFC r319487-r319488, r319682, r319968, r319995

r319487:
Add VNC Authentication support based on RFC6143 section 7.2.2.

Submitted by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Reworked by: myself
Reviewed by: grehan, rgrimes and jilles
Relnotes: Yes.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D10818

r319488:
Bump manpage date.

r319682:
Make the VNC authentication build with LibreSSL on HardenedBSD and TrueOS.

PR: 219790
Submitted by: Shirkdog <mshirk@daemon-security.com>
Reviewed by: grehan and rgrimes
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11071

r319968:
Initialize variables and use byteorder(9) instead of aliasing char array
buf via uint32_t pointer.

CID: 1375949
Reported by: Coverity, cem
Reviewed by: cem
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11153

r319995:
Check if pthread_create(3) successfully created the thread prior to call
pthread_join(3). The variable tid is not yet initialized in case
the authentication fails at early stage, that would lead pthread_join be
called with an uninitialized variable.

CID: 1375950
Reported by: Coverity, cem
Reviewed by: cem
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11150

6 years agoMFC r320390:
araujo [Sun, 2 Jul 2017 04:09:05 +0000 (04:09 +0000)]
MFC r320390:

With r318394 seems it breaks gpart(8) in some embedded systems such like PCEngines,
RPI1-B, Alix and APU2 boards as well as NanoBSD with the following message:

vnode_pager_generic_getpages_done: I/O read error 5

Seems the breakage was because it was missed to include acr in glabel update.

Reported by: Peter Blok <pblok@bsd4all.org>,
madpilot, imp and trasz.
Reviewed by: trasz
Tested by: Peter Blok and madpilot.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D11365

6 years agoMFC r320332:
kib [Sun, 2 Jul 2017 03:47:56 +0000 (03:47 +0000)]
MFC r320332:
Style.

6 years agoMFC r320049
alc [Sat, 1 Jul 2017 21:54:11 +0000 (21:54 +0000)]
MFC r320049
  Pages that are passed to swap_pager_putpages() should already be fully
  dirty.  Assert that they are fully dirty rather than redundantly calling
  vm_page_dirty() on them.

6 years agoMFC r320181
alc [Sat, 1 Jul 2017 19:47:13 +0000 (19:47 +0000)]
MFC r320181
  Eliminate an unused macro.

6 years agoMFC r319605
alc [Sat, 1 Jul 2017 19:06:14 +0000 (19:06 +0000)]
MFC r319605
  The variable "breakout" is used like a Boolean, so actually define it as
  one.

6 years agoMFC r320316:
kib [Sat, 1 Jul 2017 03:33:26 +0000 (03:33 +0000)]
MFC r320316:
Do not try to unmark MAP_ENTRY_IN_TRANSITION marked by other thread.

6 years agoMFC r320308:
kib [Sat, 1 Jul 2017 03:30:47 +0000 (03:30 +0000)]
MFC r320308:
Translate between abridged and full x87 tags for compat32 ptrace(PT_GETFPREGS).

6 years ago- Update stable/11 to 11.1-PRERELEASE for the duration of the
gjb [Thu, 29 Jun 2017 23:57:35 +0000 (23:57 +0000)]
- Update stable/11 to 11.1-PRERELEASE for the duration of the
  11.1-RELEASE cycle.
- Reset __FreeBSD_version for 11.1-STABLE.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r320372:
markj [Thu, 29 Jun 2017 17:34:48 +0000 (17:34 +0000)]
MFC r320372:
Fix a memory leak in ses_get_elm_devnames().

Approved by: re (gjb)

6 years agoMFC r320353: linux_getdents, linux_readdir: fix mismatch between malloc and free...
avg [Thu, 29 Jun 2017 12:49:03 +0000 (12:49 +0000)]
MFC r320353: linux_getdents, linux_readdir: fix mismatch between malloc and free tags

Approved by: re (gjb)

6 years agoMFC r320263:
tuexen [Wed, 28 Jun 2017 21:08:21 +0000 (21:08 +0000)]
MFC r320263:
Use a longer buffer for messages in ERROR chunks.

MFC r320264:
Check the length of a COOKIE chunk before accessing fields in it.

MFC r320300:
Handle sctp_get_next_param() in a consistent way.

Approved by: re (marius@)

6 years agoMFC r315518
alc [Wed, 28 Jun 2017 05:28:15 +0000 (05:28 +0000)]
MFC r315518
  Avoid unnecessary calls to vm_map_protect() in elf_load_section().

  Typically, when elf_load_section() unconditionally passed VM_PROT_ALL to
  elf_map_insert(), it was needlessly enabling execute access on the
  mapping, and it would later have to call vm_map_protect() to correct the
  mapping's access rights.  Now, instead, elf_load_section() always passes
  its parameter "prot" to elf_map_insert().  So, elf_load_section() must
  only call vm_map_protect() if it needs to remove the write access that
  was temporarily granted to perform a copyout().

Approved by: re (kib)

6 years agoMFC r320202:
kib [Wed, 28 Jun 2017 05:20:28 +0000 (05:20 +0000)]
MFC r320202:
Call pmap_copy() only for map entries which have the backing object
instantiated.

Approved by: re (delphij)

6 years agoMFC r320201:
kib [Wed, 28 Jun 2017 04:25:20 +0000 (04:25 +0000)]
MFC r320201:
Assert that the protection of a new map entry is a subset of the max
protection.

Approved by: re (delphij)

6 years agoMFC r314310
alc [Wed, 28 Jun 2017 04:01:29 +0000 (04:01 +0000)]
MFC r314310
  Refine the fix from r312954.  Specifically, add a new PDE-only flag,
  PG_PROMOTED, that indicates whether lingering 4KB page mappings might
  need to be flushed on a PDE change that restricts or destroys a 2MB
  page mapping.  This flag allows the pmap to avoid range invalidations
  that are both unnecessary and costly.

Approved by: re (kib)

6 years agoMFC r320123:
ken [Tue, 27 Jun 2017 12:56:36 +0000 (12:56 +0000)]
MFC r320123:

  Fix a potential sleep while holding a mutex in the sa(4) driver.

  If the user issues a MTIOCEXTGET ioctl, and the tape drive in question has
  a serial number that is longer than 80 characters, we malloc a buffer in
  saextget() to hold the output of cam_strvis().

  Since a mutex is held in that codepath, doing a M_WAITOK malloc could lead
  to sleeping while holding a mutex.  Change it to a M_NOWAIT malloc and bail
  out if we fail to allocate the memory.  Devices with serial numbers longer
  than 80 bytes are very rare (I don't recall seeing one), so this
  should be a very unusual case to hit.  But it is a bug that should be fixed.

  sys/cam/scsi/scsi_sa.c:
   In saextget(), if we need to malloc a buffer to hold the output of
   cam_strvis(), don't wait for the memory.  Fail and return an error
   if we can't allocate the memory immediately.

PR: kern/220094
Submitted by: Jia-Ju Bai <baijiaju1990@163.com>
Sponsored by: Spectra Logic
Approved by: re (gjb)

6 years agoMFC r320307:
kib [Tue, 27 Jun 2017 10:50:48 +0000 (10:50 +0000)]
MFC r320307:
Fix indent.

Approved by: re (marius)

6 years agoMFC r320314:
kib [Tue, 27 Jun 2017 10:09:00 +0000 (10:09 +0000)]
MFC r320314:
Remove the description of MAP_HASSEMAPHORE.

Approved by: re (marius)

6 years agoMFC r320313:
kib [Tue, 27 Jun 2017 09:42:56 +0000 (09:42 +0000)]
MFC r320313:
Fix typo.

Approved by: re (marius)

6 years agoMFC r320175
davidcs [Mon, 26 Jun 2017 19:36:24 +0000 (19:36 +0000)]
MFC r320175
Add pkts_cnt_oversized to stats.

Approved by: re(marius)

6 years agoMFC of 320176:
mckusick [Mon, 26 Jun 2017 17:29:32 +0000 (17:29 +0000)]
MFC of 320176:

Allow '_' in labels when specifying -L to newfs.

PR: 220163
Reported by: Keve Nagy
Reviewed by: kib
Approved by: re@ (Xin Li)

6 years agoMFC r320121:
kib [Mon, 26 Jun 2017 12:37:11 +0000 (12:37 +0000)]
MFC r320121:
Ignore the P_SYSTEM process flag, and do not request
VM_MAP_WIRE_SYSTEM mode when wiring the newly grown stack.

Approved by: re (marius)

6 years agoMFC r320125:
kib [Mon, 26 Jun 2017 12:30:39 +0000 (12:30 +0000)]
MFC r320125:
Fix batched unload for DMAR busdma in qi mode.

Approved by: re (marius)

6 years agoMFC r320108:
kib [Mon, 26 Jun 2017 12:17:04 +0000 (12:17 +0000)]
MFC r320108:
Allow negative aio_offset only for the read and write LIO ops on
device nodes.

Approved by: re (marius)

6 years agoMFC r320259: jedec_ts: read device id from the correct register
avg [Mon, 26 Jun 2017 09:32:57 +0000 (09:32 +0000)]
MFC r320259: jedec_ts: read device id from the correct register

Approved by: re (marius)

6 years agoMFC 320184
sephe [Mon, 26 Jun 2017 05:56:49 +0000 (05:56 +0000)]
MFC 320184

    hyperv/storvsc: Reduce log verbosity

    On some windows hosts TEST_UNIT_READY command will return
    SRB_STATUS_ERROR and sense data "NOT READY asc:3a,1 (Medium
    not present - tray closed)", this occurs periodically, and
    not hurt anything else.  So, we prefer to ignore this kind
    of errors.

    Approved by:    re (delphij)
    PR:             219973
    Submitted by:   Hongjiang Zhang <hongzhan microsoft com>
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D11271

6 years agoMFC r320242, r320256:
cy [Mon, 26 Jun 2017 05:42:35 +0000 (05:42 +0000)]
MFC r320242, r320256:

Update leap-seconds to leap-seconds.3676924800.

As per https://datacenter.iers.org/eop/-/somos/5Rgv/latest/16:

     INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)

SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE

SERVICE DE LA ROTATION TERRESTRE
OBSERVATOIRE DE PARIS
61, Av. de l'Observatoire 75014 PARIS (France)
Tel.      : 33 (0) 1 40 51 23 35
FAX       : 33 (0) 1 40 51 22 91
Internet  : services.iers@obspm.fr

                                             Paris, 9 January 2017

                                             Bulletin C 53

                                             To authorities responsible
                                             for the measurement and
                                             distribution of time

                          INFORMATION ON UTC - TAI

 NO leap second will be introduced at the end of June 2017.
 The difference between Coordinated Universal Time UTC and the
 International Atomic Time TAI is :

     from 2017 January 1, 0h UTC, until further notice : UTC-TAI = -37 s

 Leap seconds can be introduced in UTC at the end of the months of December
 or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
 six months, either to announce a time step in UTC, or to confirm that there
 will be no time step at the next possible date.

                                            Christian BIZOUARD
                                            Director
                                            Earth Orientation Center of IERS
                                            Observatoire de Paris, France

Obtained from: ftp://time.nist.gov/pub/leap-seconds.3676924800
Approved by: re@ (delphij@)

6 years agoFix an incorrect revision number.
gjb [Sun, 25 Jun 2017 18:01:27 +0000 (18:01 +0000)]
Fix an incorrect revision number.

Submitted by: David Marec <david dot marec at @davenulle dot .org>
Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r320216: Fix use-after-free introduced in r300388.
delphij [Sun, 25 Jun 2017 17:42:27 +0000 (17:42 +0000)]
MFC r320216: Fix use-after-free introduced in r300388.

In r300388, endnetconfig() was called on nc_handle which would release
the associated netconfig structure, which means tmpnconf->nc_netid
would be a use-after-free.

Solve this by doing endnetconfig() in return paths instead.

Reported by: jemalloc via kevlo
Reviewed by: cem, ngie (earlier version)
Approved by: re (kib)

6 years agoMFC r320052:
kib [Sat, 24 Jun 2017 14:41:57 +0000 (14:41 +0000)]
MFC r320052:
Do not leak syslog_mutex on cancellation.

Approved by: re (marius)

6 years agoMFC r320051:
kib [Sat, 24 Jun 2017 13:53:47 +0000 (13:53 +0000)]
MFC r320051:
Correct translations between abridged and full x87 tags.

Approved by: re (marius)

6 years agoMFC r320206,r320207:
bdrewery [Fri, 23 Jun 2017 20:49:23 +0000 (20:49 +0000)]
MFC r320206,r320207:

  r320206:
    Follow-up r308602: Don't add missing headers to .depend.tables.h.
  r320207:
    Tweak r320206: Still create the TABLE but not the .depend entry for missing
    headers.

Approved by: re (gjb)

6 years agoMFC r320174,r320204:
bdrewery [Fri, 23 Jun 2017 20:38:21 +0000 (20:38 +0000)]
MFC r320174,r320204:

  r320174:
    Fix 'make clean all' to work again.
  r320204:
    Fix various 'make *clean *all *install' combinations.

PR: 219819
Approved by: re (gjb)

6 years agoMFC r319861:
bdrewery [Fri, 23 Jun 2017 20:25:58 +0000 (20:25 +0000)]
MFC r319861:

  META_MODE: NO_FILEMON should imply nofilemon.

Approved by: re (gjb)

6 years agoMFC r319862,r319996,r320030:
bdrewery [Fri, 23 Jun 2017 20:07:56 +0000 (20:07 +0000)]
MFC r319862,r319996,r320030:

  r319862:
    META_MODE: Show .ERROR_CMD in error.
  r319996:
    WITH_META_MODE: Don't try showing command if .ERROR_META_FILE is empty.
  r320030:
    WITH_META_MODE: End each ERROR_CMD CMD line with ';'.

Approved by: re (gjb, marius)

6 years agoMFC r320012,r320028,r320061,r320118:
bdrewery [Fri, 23 Jun 2017 19:44:20 +0000 (19:44 +0000)]
MFC r320012,r320028,r320061,r320118:

  r320012:
    Fix LIBAMU location to fix 'stale .depend' rebuilds in usr.sbin/amd.
  r320028:
    Fix more incorrect library directories fix 'stale .depend' rebuilds.
  r320061:
    Fix Makefiles which override LIBDIR to not add incorrect dependencies into
    .depend.
  r320118:
    Follow-up r320061: Need to respect make.conf/env LIBDIR overrides.

Approved by: re (gjb)

6 years agoMFC r320038:
kib [Fri, 23 Jun 2017 18:57:56 +0000 (18:57 +0000)]
MFC r320038:
Style.

Approved by: re (gjb)

6 years agoUpdate stable/11 to BETA3 as part of the 11.1-RELEASE cycle.
gjb [Fri, 23 Jun 2017 00:00:00 +0000 (00:00 +0000)]
Update stable/11 to BETA3 as part of the 11.1-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r320124:
markj [Thu, 22 Jun 2017 18:40:34 +0000 (18:40 +0000)]
MFC r320124:
Fix the !TD_IS_IDLETHREAD(curthread) locking assertions.

Approved by: re (kib)

6 years agoDocument r320218, primes(6) updated to new limit of 2^64-1.
gjb [Thu, 22 Jun 2017 13:31:44 +0000 (13:31 +0000)]
Document r320218, primes(6) updated to new limit of 2^64-1.
Document r320164, qlnxe(4) firmware and hardware support updates.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

6 years agoMFC r319975:
kib [Thu, 22 Jun 2017 11:03:42 +0000 (11:03 +0000)]
MFC r319975:
Some minor improvements to vnode_pager_generic_putpages().

Approved by: re (marius)

6 years agoMFC r319491:
cperciva [Thu, 22 Jun 2017 05:30:27 +0000 (05:30 +0000)]
MFC r319491:

Skip setting the MTU in the netfront driver (xn# devices) if the new MTU
is the same as the old MTU.  In particular, on Amazon EC2 "T2" instances
without this change, the network interface is reinitialized every 30
minutes due to the MTU being (re)set when a new DHCP lease is obtained.

Approved by: re (delphij)