MFC r259132,r259133:
	Per the resolution of POSIX bug 0000779 (note 0002050) add support for using 'i'
	as a case insensitive flag.

	Add regression test for recently added 'i' flag in r259132.

PR:	standards/184641
MFC r259286,259424,259425:
  Apply patch from upstream Heimdal for encoding fix

  RFC 4402 specifies the implementation of the gss_pseudo_random()
  function for the krb5 mechanism (and the C bindings therein).
  The implementation uses a PRF+ function that concatenates the output
  of individual krb5 pseudo-random operations produced with a counter
  and seed.  The original implementation of this function in Heimdal
  incorrectly encoded the counter as a little-endian integer, but the
  RFC specifies the counter encoding as big-endian.  The implementation
  initializes the counter to zero, so the first block of output (16 octets,
  for the modern AES enctypes 17 and 18) is unchanged.  (RFC 4402 specifies
  that the counter should begin at 1, but both existing implementations
  begin with zero and it looks like the standard will be re-issued, with
  test vectors, to begin at zero.)

  This is upstream's commit f85652af868e64811f2b32b815d4198e7f9017f6,
  from 13 October, 2013:
  % Fix krb5's gss_pseudo_random() (n is big-endian)
  %
  % The first enctype RFC3961 prf output length's bytes are correct because
  % the little- and big-endian representations of unsigned zero are the
  % same.  The second block of output was wrong because the counter was not
  % being encoded as big-endian.
  %
  % This change could break applications.  But those applications would not
  % have been interoperating with other implementations anyways (in
  % particular: MIT's).

Bump __FreeBSD_version accordingly and add a note in UPDATING.

Approved by:	hrs (mentor, src committer)
Fix build breakage after r259448

Approved by:	hrs (mentor, src committer)
MFC r244503 and r246565:

Make sure all USB drivers allocate buffer memory
through the USB API and/or busdma.

The following assumptions have been made:
umass - buffers passed from CAM/SCSI layer are OK
network - mbufs are OK.

Some other nits while at it.
MFC r246765:

Remove unused variable.
MFC r246614:
- Streamline detach logic in wlan drivers, so that
  freed memory cannot be used during detach.
- Remove all panic() calls from the urtw driver because
  panic() is not appropriate here.
- Remove redundant checks for device detached in
  device detach callbacks.
- Use DEVMETHOD_END to mark end of device methods.
MFC r238274, r246752, r256720, r256721, r256722, r256955, r257409
 r257429, r257435, r257712, r257732, r257743, r257748, r257955
 r257957, r257958, r258082, r258641, r258643, r258732, r258733,
 r258840, r258919, r258921, r259029, r259030, r259031, r259032 and r259046:

- Add support for the MediaTek/Ralink RT5370/RT5372 chipset.
- Various minor USB WLAN fixes and improvements.

PR:     usb/182936
MFC r258083:
Remove a couple of unused macros.
MFC r256718, r257410 and r257411:
- Fix RF registers for RT3070.
- Initialize BBP68 to improve RX sensitivity.
- Add RT2860_BCN_OFFSET1 and RT2860_MAX_LEN_CFG register initialization to
match with the vendor driver. While here, remove unused RT2860_DEF_MAC
definition.
MFC r253757:
Fix alignment of USB WLAN radiotap headers. This makes USB WLAN adapters
work on ARM, MIPS and similar platforms, where alignment matters.
MFC r258819,258928:

Add new sysctl, kern.supported_archs, containing the list of FreeBSD
MACHINE_ARCH values whose binaries this kernel can run. This patch provides
a feature requested for implementing pkgng ABI identifiers in a robust
way.

The list is designed to indicate whether, say, an i386 package can be run on
the current system. If kern.supported_abis contains "i386", then the answer
is yes. Otherwise, the answer is no.

At the moment, this only supports MACHINE_ARCH and MACHINE_ARCH32. As we
gain support for more interesting combinations, this needs to become more
flexible, possibily through the sysent framework, along with the
hw.machine_arch emulation immediately preceding this code in kern_mib.c.

Reviewed by:	imp
MFC r258039:
Avoid overflow for the page counts.

MFC r258365:
Revert back to use int for the page counts.
Rearrange the checks to correctly handle overflowing address arithmetic.
MFC r258088:
Add check for buflen overflow by comparing the buflen with both offset
and resid.

MFC r258397:
Redo r258088 to avoid relying on signed arithmetic overflow.
MFC r258311

  opensolaris/uts/common/dtrace/fasttrap.c
          Fix several problems that can cause panics on kldload and kldunload.

          * kproc_create(fasttrap_pid_cleanup_cb, ...) gets called before
            fasttrap_provs.fth_table gets allocated.  This can lead to a panic
            on module load, because fasttrap_pid_cleanup_cb references
            fasttrap_provs.fth_table.  Move kproc_create down after the point
            that fasttrap_provs.fth_table gets allocated, and modify the error
            handling accordingly.

          * dtrace_fasttrap_{fork,exec,exit} weren't getting NULLed until
            after fasttrap_provs.fth_table got freed.  That caused panics on
            module unload because fasttrap_exec_exit calls
            fasttrap_provider_retire, which references
            fasttrap_provs.fth_table.  NULL those function pointers earlier.

          * There wasn't any code to destroy the
            fasttrap_{tpoints,provs,procs}.fth_table mutexes on module unload,
            leading to a resource leak when WITNESS is enabled.  Destroy those
            mutexes during fasttrap_unload().

Sponsored by: Spectra Logic Corporation
MFC r254224, r254294, r254328, r258307, r258309, r258310, r258314,
    r258317, r258319, r258320, r258669, r258786, r258853, r258949,
    r259079, r259246:

r254224:
  Update the wrapper script to 'release.sh', as used by the
  FreeBSD Release Engineering Team as of 9.2-RELEASE.

  Document that a cross-build release is possible by setting
  the TARGET and TARGET_ARCH variables.

  Include an example of using release.sh with and without the
  optional configuration file.

  Document the supported release.sh configuration file variables.

  Update the 'cdrom' target output file to disc1.iso.

  Update the 'memstick' target output file to memstick.img.

  Add attributions for the last major updates to this manual page.

  Fix some mdoc(7) style nits.

r254294:
  Remove the defaults for TARGET/TARGET_ARCH.

  Note that WORLD_FLAGS and KERNEL_FLAGS set the number of
  make(1) jobs only on SMP-capable systems.

r254328:
  Remove the {SRC,DOC,PORT}REVISION variables from release(7), and
  update the default {SRC,DOC,PORT}BRANCH defaults.

r258307:
  Add a script and configuration files to fetch pre-built packages
  from pkg.FreeBSD.org for inclusion on release medium (dvd1.iso).

  The script sources ${.CURDIR}/${TARGET}/pkg-stage.conf, which sets
  several environment variables, such as the pkg(8) ABI, PACKAGESITE,
  PKG_DBDIR, and PKG_CACHEDIR.  PKG_CACHEDIR is set to the directory
  on the release medium used by bsdconfig(8) (/packages/${ABI}).  ABI
  is determined by output of 'make -C /usr/src/release -V REVISION'.
  See pkg.conf(5) for descripton on other variables set here.

  The list of packages to include are set within the configuration
  file.

  The script and configuration files are intended to be run by the
  'make dvd' target within the release directory, and assume the
  release is built within a chroot environment (such as by using
  release.sh).

r258309:
  Set the PKG_CACHEDIR directory to 'dvd/' instead of 'release/'
  in preparation of adding a 'dvd1.iso' target.

r258310:
  Add the 'dvd1.iso' target.  This mimics the 'release.iso' target,
  with the additional step of fetching packages for inclusion on the
  dvd image.

  The 'pkg-stage' target is used to run 'scripts/pkg-stage.sh' if
  the '${TARGET}/pkg-stage.conf' configuration file exists (currently
  only amd64 and i386).

  Allow dvd1.iso to be skipped if NODVD=1.

r258314:
  Fix how ABI is evaluated so it matches more than a dot-zero
  case.

r258317:
  Document the 'dvdrom' target.

r258319:
  Remove WITHOUT_PROFILE=1 for the dvd1.iso medium.

r258320:
  Simplify PKG_ABI for pkg-stage.sh.

r258669:
  Document the dvdrom target and NODVD variable.

r258786:
  Move OPTIONS_UNSET outside of the PBUILD_FLAGS variable, otherwise
  the textproc/docproj port build fails.

r258853:
  Turn off the dvdrom target by default.  dvd1.iso is now built by
  specifying 'WITH_DVD=1' during 'make release'.

r258949:
  Ensure WITH_DVD is not empty to prevent 'WITH_DVD= ' from evaluating
  to true.

r259079:
  Add WITH_DVD to RELEASE_RMAKEFLAGS, otherwise it is not actually
  passed to 'make release'.

r259246:
  Prevent release build errors found during snapshot builds where if
  NOPORTS=1, pkg-stage.sh cannot build the ports-mgmt/pkg port if
  WITH_DVD=1.

Tested against:	stable/9@r259512
Sponsored by:	The FreeBSD Foundation
MFC	r258731:

gcc: Make use of TREE_OVERFLOW_P.

While it was brought in r258179 only to fix a build issue,
bringing the rest of the change has the advantage of fixing
GCC/19978.

Obtained from:	gcc 4.3 (rev. 120505; GPLv2)
MFC r258363:

Add alternate ID for Novatel MiFi 2200 CDMA, which is used by my
Virgin Mobile branded device.  It needs the U3GINIT_SCSIEJECT quirk.
Regenerate after
	r248085 (if_ipheth)
	r247474, r250288 (uftdi)
	r250842 (if_rum)
	r244956, r255345 (ng_ubt)
	r248085, r250847, r257042, r259457 (if_run)
	r245727, r250845, r253292, r259593 (u3g)
	r252444 (if_axe)
MFC r259023 and r259095:
Improve the XHCI command timeout recovery handling code.
Fix some typos while at it.
MFC r258629, 258662:

r258629:
  Mention that devd will kldload the driver when the device is connected.

  Mention that the automatic mode switch from umass to u3g needed by some
  devices does not work unless the driver is loaded before the device is
  connected.

r258662 (by joel):
  mdoc: sort sections.