MFC r258086:
  Strip the -pN patch level from the VERSION string which gets encoded into
  CTF data.  Otherwise FreeBSD Update builds think every kernel file has
  changed every time there's a security advisory, since the FreeBSD Update
  build code isn't smart enough to look inside CTF data to ignore those
  changes.

Approved by:	re (gjb)
MFC: r258387,r258425
Split raw reading/programming into smaller chunks to avoid allocating too
big chunk of kernel memory. Validate size of data. Add error handling to
avoid calling copyout() when data has not been read correctly. Also MFC of
change r258425 which fixes problem introduced by r258387.

Reviewed by:    zbb
Reported by:    x90c <geinblues@gmail.com>
Approved by:    re
MFC r258426: libexecinfo: Include terminating null in byte count

  Otherwise, a formatted string with a strlen equal to the remaining
  buffer space would have the last character omitted (because vsnprintf
  always null-terminates), and later the assert in backtrace_symbols_fmt
  would fail.

Sponsored by:	DARPA, AFRL
Approved by:	re (gjb)
MFC r258135: x86: Allow users to change PSL_RF via ptrace(PT_SETREGS...)

  Debuggers may need to change PSL_RF. Note that tf_eflags is already stored
  in the signal context during signal handling and PSL_RF previously could
  be modified via sigreturn, so this change should not provide any new
  ability to userspace.

  For background see the thread at:
  http://lists.freebsd.org/pipermail/freebsd-i386/2007-September/005910.html

  Reviewed by:	jhb, kib

Sponsored by:	DARPA, AFRL
Approved by:	re (gjb)
MFC r258353: zfs page_busy: fix the boundaries of the cleared range

This is a fix for a regression introduced in r246293.

vm_page_clear_dirty expects the range to have DEV_BSIZE aligned boundaries,
otherwise it extends them.  Thus it can happen that the whole page is
marked clean while actually having some small dirty region(s).
This commit makes the range properly aligned and ensures that only
the clean data is marked as such.

It would interesting to evaluate how much benefit clearing with DEV_BSIZE
granularity produces.  Perhaps instead we should clear the whole page
when it is completely overwritten and don't bother clearing any bits
if only a portion a page is written.

Reviewed by:	kib
Approved by:	re (gjb)
MFV r258377: 4088 use after free in arc_release()

illumos/illumos-gate@ccc22e130479b5bd7c0002267fee1e0602d3f772

Approved by:	re (gjb)
MFV r258378: 4089 NULL pointer dereference in arc_read()

illumos/illumos-gate@57815f6b95a743697e148327725b7f568e75e6ea

Tested by:	adrian
Approved by:	re (gjb)
MFC 258570

Change sysinstall.8 references to bsdinstall.8.

Submitted by: skreuzer
Approved by: re (delphij)
MFC r258294:
Fix ZFS deadlock when sending a snapshot which is mounted.

Approved by:	re (glebius)
Sponsored by:	Multiplay
MFC r258350:

Pull in r191896 from upstream llvm trunk:

  CaptureTracking: Plug a loophole in the "too many uses" heuristic.

  The heuristic was added to avoid spending too much compile time in a
  specially crafted test case (PR17461, PR16474) with many uses on a
  select or bitcast instruction can still trigger the slow case. Add a
  check for that case.

  This only affects compile time, don't have a good way to test it.

This fixes the excessive compile time spent on a specific file of the
graphics/rawtherapee port.

Reported by:	mandree
Approved by:	re (gjb)
MFC r258399,258492:
mark aesni module _SYNC, improves performance ~27%...

Approved by:	re (glebius)
[Forced commit to correct checkin comment for r256757]

MFC: r256423

Allow FreeBSD to be booted from CDROM media on XenServer 6.2 and
prior releases.

Submitted by:	Roger Pau Monné
Sponsored by:	Citrix Systems R&D
Reviewed by:	gibbs
Approved by:	re (gjb)

sys/dev/xen/blkfront/blkfront.c:
	On XenServer versions up to an including 6.2, paravirtualized
	CDROM support is broken.  When running in an HVM domain,
	ignore paravirtualized instances of CDROM media, and instead
	rely on native drivers attaching to emulated hardware.  This
	functions correctly on all currently known Xen based
	platforms.
------------------------------------------------------------------------
MFC r258437:

Sync with NetBSD.  The functional change is to make the output when
comparing a directory to an mtree file more compatible with fmtree when
FreeBSD 9 compatiblity mode is on.  This output is clearly intended for
humans not computers, but some tools such as mergemaster's -U option rely
on it.

Approved by:	re (glebius)
MFC: r258456

Fix mergemaster -U by forcing FreeBSD 9 compatiblity in mtree when mtree is
nmtree.

The mtree output used by mergemaster in this case was clearly not meant for
computer consumption and an approach based on -f <file1> -f <file2> would
probably be a better idea, but this is a minimal change.

Approved by:	re (glebius)
MFC r258262:

drm: Support DRM_CAP_TIMESTAMP_MONOTONIC capability

This fixes DPMS with KDE and radeonkms. Without this, the display would
freeze when the monitor is put into sleep state, and only resumes after
several dozens of minutes once the monitor is powered on again.

Tested by:	Mathias Picker <Mathias.Picker@virtual-earth.de>
Approved by:	re (kib)
MFC r258549 and r258553:

drm: Dereference pointers given to qsort_r()'s cmp callback

drm_le_cmp() (qsort_r()'s callback) receives pointers to elements in the
array passed to qsort_r(), not the elements themselves.

Before this fix, the use of qsort_r() shuffled the array, not sorted it,
because the compare callback accessed random memory locations, not the
expected elements.

This bug triggered an infinite loop in KDE/xserver:

    1. KDE has a kded module called "randrmonitor" which queries xserver
       for current monitors at startup and then listens to RandR
       notifications from xserver.

    2. xserver handles the query from "randrmonitor" by polling the
       video device using the "drm_mode_getconnector()" ioctl. This
       ioctl returns a list of connectors and, for those with a
       connected monitor, the available modes. Each modes list is sorted
       by the kernel before returning. When xserver gets the connectors
       list, it sorts the modes lists again.

       In the case of this bug, when two modes are equal (in xserver's
       compare function PoV), their order is kept stable (ie. the
       kernel order is kept for those two modes). And because the list
       was shuffled by the kernel, the order of two equal modes was
       frequently changed in the final modes list in xserver.

    3. xserver compares the returned connectors list with the list
       obtained earlier. In particular, it compares the sorted
       modes lists for each connector. If a property of a connector
       changes (eg. modes), xserver sends a "RRNotify_OutputChange"
       notification.

       Because of the change of order between equal modes, xserver sent
       a notification after each polling of the connectors.

    4. "randrmonitor" receives a notification, triggered by its query. The
       notification doesn't contain the new connectors list, therefore, it
       asks for the new list using the same function: go back to step #2.

Approved by:	re (kib)
MFC r258227 (bapt):
 Enabled should be a boolean, not a string

Approved by:	re (glebius)
Sponsored by:	The FreeBSD Foundation
MFC r257879:

Fix typo in r256646: We want to generate lists of directories in
INDEX-OLD and INDEX-NEW and compare them, not generate the same
list of directories from INDEX-OLD twice...

Pointy hats to: cperciva & everybody who didn't proofread
		EN-13:04 enough
Errata Notice:	FreeBSD-EN-13:05.freebsd-update
Approved by:	re (gjb)
MFC r258714
  Add some text to clarify that nslookup and dig are no longer in the
  base system after the removal of BIND.

Approved by: re (delphij)
MFC r258620:

Pull in r195558 from upstream clang trunk:

  Fix a SSE2 intrinsics typo

  Full discourse at:

   http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131104/092514.html
   http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-November/068124.html

  Patch by Dimitry Andric and Alexey Dokuchaev!

Reported by:	danfe
Approved by:	re (gjb)