freebsd-skq/sys/sparc64
Jonathan T. Looney beb2406556 amd64: Protect the kernel text, data, and BSS by setting the RW/NX bits
correctly for the data contained on each memory page.

There are several components to this change:
 * Add a variable to indicate the start of the R/W portion of the
   initial memory.
 * Stop detecting NX bit support for each AP.  Instead, use the value
   from the BSP and, if supported, activate the feature on the other
   APs just before loading the correct page table.  (Functionally, we
   already assume that the BSP and all APs had the same support or
   lack of support for the NX bit.)
 * Set the RW and NX bits correctly for the kernel text, data, and
   BSS (subject to some caveats below).
 * Ensure DDB can write to memory when necessary (such as to set a
   breakpoint).
 * Ensure GDB can write to memory when necessary (such as to set a
   breakpoint).  For this purpose, add new MD functions gdb_begin_write()
   and gdb_end_write() which the GDB support code can call before and
   after writing to memory.

This change is not comprehensive:
 * It doesn't do anything to protect modules.
 * It doesn't do anything for kernel memory allocated after the kernel
   starts running.
 * In order to avoid excessive memory inefficiency, it may let multiple
   types of data share a 2M page, and assigns the most permissions
   needed for data on that page.

Reviewed by:	jhb, kib
Discussed with:	emaste
MFC after:	2 weeks
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D14282
2018-03-06 14:28:37 +00:00
..
central sys/sparc64: further adoption of SPDX licensing ID tags. 2017-11-27 15:10:39 +00:00
conf It's time to retire AHC_REG_PRETTY_PRINT and AHD_REG_PRETTY_PRINT from 2017-11-29 23:41:49 +00:00
ebus sys/sparc64: further adoption of SPDX licensing ID tags. 2017-11-27 15:10:39 +00:00
fhc sys/sparc64: further adoption of SPDX licensing ID tags. 2017-11-27 15:10:39 +00:00
include amd64: Protect the kernel text, data, and BSS by setting the RW/NX bits 2018-03-06 14:28:37 +00:00
isa sys/sparc64: further adoption of SPDX licensing ID tags. 2017-11-27 15:10:39 +00:00
pci kernel: Fix several typos and minor errors 2017-12-27 03:23:21 +00:00
sbus sys/sparc64: further adoption of SPDX licensing ID tags. 2017-11-27 15:10:39 +00:00
sparc64 Make v_wire_count a per-cpu counter(9) counter. This eliminates a 2018-02-12 22:53:00 +00:00