MFC r271317:

Avoid unlocking unlocked mutex in RCTL jail code.  Specific test case
is attached to PR.

PR:		193457
Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
MFC r271436:

Fix typo.

Approved by:	re (marius)
Sponsored by:	The FreeBSD Foundation
MFC r271157:

Fix typo.

Approved by:	re (marius)
Sponsored by:	The FreeBSD Foundation
MFC r271169:

Turn two errors, which are possible to trigger only by bugs,
into assertions.

Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
MFC r271187:

Avoid ctld(8) crash on getaddrinfo(3) failure.

Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
MFC r265171 by nwhitehorn: Use mkimg instead of md(4) and gpart [for powerpc].

Approved by:	re
MFC EFI support for the installer

r264978 (nwhitehorn):

    Add EFI support to the installer. This requires that the kernel
    provide a sysctl to determine what firmware is in use. This sysctl
    does not exist yet, so the following blocks are in front of the
    wheels:
    - I've provisionally called this "hw.platform" after the equivalent
      thing on PPC
    - The logic to check the sysctl is short-circuited to always choose
      BIOS.  There's a comment in the top of the file about how to turn
      this off.

    If IA64 acquired a boot1.efifat-like thing (probably with very few
    modifications), the same code could be adapted there.

r265016 (nwhitehorn):

    Finish connecting up installer UEFI support. If the kernel was
    booted using EFI, set up the disks for an EFI system. If booted from
    BIOS/CSM, set up for BIOS.

r268256 (nwhitehorn):

    After EFI support was added to the installer, it needed to allow
    boot partitions of types other than "freebsd-boot" (in particular,
    "efi").  This allows the removal of some nasty hacks for supporting
    PowerPC systems, in particular aliasing freebsd-boot to apple-boot
    on APM and an IBM-specific code on MBR.

    This changes the installer to use the correct names, which also
    breaks a degeneracy in the meaning of "freebsd-boot" that allows the
    addition of support for some newer IBM systems that can boot from
    GPT in addition to MBR. Since I have no idea how to detect which
    those systems are, leave the default on IBM PPC systems as MBR for
    now.

Approved by:	re
PR:		193658
Relnotes:	Yes
MFC r268540 by nwhitehorn:

    Allow up to 512K for boot code on GPT with BIOS. As pmbr.s says in
    a comment, "545K should be enough for any boot code". This rounds
    down slightly.

Approved by:	re
MFC r271452:

Add two forgotten keymap names (fr.kbd and fr.acc.kbd) to the list
of files to be installed.

Approved by:	re
MFC r270689:
    Implement the 0x2B SUB instruction, and the OR variant of 0x81.

    Found with local APIC accesses from bitrig/amd64 bsd.rd, 07/15-snap.

Approved by:	re (rodrigc)
Fix Denial of Service in TCP packet processing.

Security:	FreeBSD-SA-14:19.tcp
Approved by:	re (implicit, security advisory)
MFC Clang rev 205331 debuginfo crash fix

r271282:
    Debug info: fix a crash when emitting IndirectFieldDecls, which were
    previously not handled at all.
    rdar://problem/16348575

rr271283:

  Add clang patch corresponding to r271432

Sponsored by:	DARPA, AFRL
r271250 (dumbbell): vt(4): Change the terminal and buffer sizes, even without a font

This fixes a bug where scroll lock would not work for tty #0 when using
vt_vga's textmode. The reason was that this window is created with a
static 256x100 buffer, larger than the real size of 80x25.

Now, in vt_change_font() and vt_compute_drawable_area(), we still
perform operations even of the window has no font loaded (this is the
case in textmode here vw->vw_font == NULL). One of these operation
resizes the buffer accordingly.

In vt_compute_drawable_area(), we take the terminal size as is (ie.
80x25) for the drawable area.

The font argument to vt_set_border() is removed (it was never used) and
the code now uses the computed drawable area instead of re-doing its own
calculation.

Reported by:	Harald Schmalzbauer <h.schmalzbauer_omnilan.de>
Tested by:	Harald Schmalzbauer <h.schmalzbauer_omnilan.de>
MFC after:	3 days
fbd: Fix a bug where vt_fb_attach() success would be considered a failure

vt_fb_attach() currently always returns 0, but it could return a code
defined in errno.h. However, it doesn't return a CN_* code. So checking
its return value against CN_DEAD (which is 0) is incorrect, and in this
case, a success becomes a failure.

The consequence was unimportant, because the caller (drm_fb_helper.c)
would only log an error message in this case. The console would still
work.

Approved by:	nwhitehorn

r269779
vt(4): Add cngrab() and cnungrab() callbacks

They are used when a panic occurs or when entering a DDB session for
instance.

cngrab() forces a vt-switch to the console window, no matter if the
original window is another terminal or an X session. However, cnungrab()
doesn't vt-switch back to the original window currently.

MFC after:	1 week

r270705
pause_sbt(): Take the cold path (ie. use DELAY()) if KDB is active

This fixes a panic in the i915 driver when one uses debug.kdb.enter=1
under vt(4).

PR:		193269
Reported by:	emaste@
Submitted by:	avg@
MFC after:	3 days
o Add sysctls to enable/disable potentially dengerous key combinations, like
        reboot/halt/debug.
o Add support for most key combinations supported by syscons(4).

Reviewed by:	dumbbell, emaste (prev revision of D747)
MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
MFC spelling fixes

rXXXXXX: spelling fixes

    Submitted by:	"Sam Fourman Jr." <sfourman@gmail.com>

rXXXXXX: Fix one more spelling mistake.

    Pointed by:	danfe
vt_vga: vd_setpixel_t and vd_drawrect_t are noop in text mode

MFC after:	3 days
XXX manpage date change from MFC vtfontcvt improvements: