MFC r256556:
Remove a buggy comparision when setting manually the path MTU.
After fixing, the comparision would have become redundant.
Thanks to Andrew Galante for reporting the issue.

MFC r257272:
Fix compilation if SCTP_DONT_DO_PRIVADDR_SCOPE is defined.
The issue was reported by Andrew Galante.

MFC r257274:
Fix the value of *optlen when calling getsockopt() for
SCTP_REMOTE_UDP_ENCAPS_PORT.
This issue was reported by Andrew Galante.

MFC r257359:
Terminate a debug output with a \n.

MFC r257555:
Changes from upstream to improve compilation when INET or INET6
or none of them is defined.

MFC r257574:
Unlock the lock before destroying it.
This issue was reported by Andrew Galante.

MFC r257800:
Use htons()/ntohs() appropriately.
These issues were reported by Andrew Galante.

MFC r257803:
Make sure that we don't try to build an ASCONF-ACK chunk
larger than what fits in the the mbuf cluster.
This issue was reported by Andrew Galante.

MFC r257804:
Get rid of the artification limitation enforced by
SCTP_AUTH_RANDOM_SIZE_MAX.
This was suggested by Andrew Galante.

MFC r258221:
Cleanups which result in fixes which have been made upstream
and where partially suggested by Andrew Galante.
There is no functional change in FreeBSD.

MFC r258224:
When determining if an address belongs to an stcb, take the address family
into account for wildcard bound endpoints.

MFC r258228:
Remove a stray write operation.

MFC r258235:
Use SCTP_PR_SCTP_TTL when the user provides a positive
timetolive in sctp_sendmsg().

Approved by: re@
MFC r258155
ql_hw.[c,h]: set minimum thresholds on pkt size for lro path.
ql_ioctl.c: validate the length and address of buffer passed to QL_RD_FW_DUMP
MFC r258156
qls_ioctl.c: Validate the buffer and its length passed to QLA_MPI_DUMP.
             copyout dump only if qls_mpi_core_dump() is successful.
(like to credit x90c for pointing the issue)

Approved by: re (delphij)
MFC r258318:

Also delete lib32 libiconv.

Reported by:	Tomoaki AOKI <junchoon@dec.sakura.ne.jp>

MFC r258345:

One more BIND remnant: /etc/mtree/BIND.chroot.dist

Discussed with:	des

Approved by:	re (kib)
Merge r256769 by des from head:
  Last few remnants of BIND (hopefully...)

Approved by:	re (kib)
Merge r258122 from head:
  Emphasize that pf(4) in FreeBSD doesn't match pf(4) in
  OpenBSD 4.5, but is derived from it, and got some
  important local changes.

Approved by:	re (kib)
Merge r258128 from head:
  Fix a very bad typo from r248887.

Approved by:	re (kib)
MFC r258432, r258433

Update text related to Intel CPU support and Apple hardware support.
Update copyrights

Submitted by: skreuzer
Approved by: re (hrs, delphij)
MFC r258316:

Bug fixes in iconv(3) UTF-7 support.

- Add ' to the list of directly encoded characters and * to the list of
  optionally directly encoded characters as per RFC 2152.

- In _citrus_UTF7_mbtoutf16 on end of input when the next output character
  has only been partially decoded, save a copy of the buffer of input
  characters (not just its length).  On the next call with more input
  characters this buffer is reprocessed together with the new input to
  form a fully decoded output character.

- At the end of a base64 encoded sequence fully discard '-' (BASE64_OUT)
  by decrementing psenc->chlen and i.  This is needed to make room in
  psenc->ch (input buffer) in case the next input character starts a new
  base64 encoded sequence.  And also, if this is the end of input and no
  output character can be returned, this brings the encoder in the initial
  state as indicated by _citrus_UTF7_stdenc_get_state_desc_generic which
  is used by the caller to distinguish between no output and partial
  output.

- In _citrus_UTF7_mbrtowc_priv pass the s parameter (input pointer)
  directly to _citrus_UTF7_mbtoutf16 instead of a copy (s0).  This way s
  is updated correctly in case of errors.

- In _citrus_UTF7_mbrtowc_priv when called with psenc->surrogate set
  (previous call did not have enough input), retrieve the previously
  decoded UTF-16 character from (psenc->cache >> psenc->bits) instead of
  (psenc->cache >> 2).

Approved by:	re (kib)
MFC r256951:
gnop: make sure that newly allocated memory for softc is zeroed

This prevents mtx_init from encountering non-zeros and panicking
the kernel as a result.

Approved by:	re
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)