freebsd-nq/sys/powerpc
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
..
aim PowerNV: Put processor to power-save state in idle thread 2018-02-21 14:28:40 +00:00
booke Fix the psl_userset32 definition. 2018-03-01 04:44:17 +00:00
conf PowerNV: Initial support for OPAL I2C transfers 2018-03-01 14:11:07 +00:00
cpufreq sys/powerpc: further adoption of SPDX licensing ID tags. 2017-11-27 15:09:59 +00:00
fpu sys/powerpc: further adoption of SPDX licensing ID tags. 2017-11-27 15:09:59 +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
mambo sys/powerpc: further adoption of SPDX licensing ID tags. 2017-11-27 15:09:59 +00:00
mikrotik - Allow different slicers for different flash types to be registered 2017-02-22 10:21:39 +00:00
mpc85xx Remove platform_cpu_idle() and platform_cpu_idle_wakeup() interfaces 2018-02-24 01:46:56 +00:00
ofw Set internal error returns for OF_peer(), OF_child(), and OF_parent() to 2018-02-19 15:49:14 +00:00
powermac Fix minor locking issues in the Power Mac Uninorth PCI bridge driver. 2018-01-10 22:19:11 +00:00
powernv PowerNV: Initial support for OPAL I2C transfers 2018-03-01 14:11:07 +00:00
powerpc Remove assumption that all physical memory is available to the kernel and 2018-03-03 02:04:40 +00:00
ps3 Honor physical memory regions marked unavailable in the FDT, when present. 2018-03-03 02:06:48 +00:00
pseries Merge AIM and Book-E PCPU fields 2018-02-17 20:59:12 +00:00
psim sys/powerpc: further adoption of SPDX licensing ID tags. 2017-11-27 15:09:59 +00:00