NetBSD/sys/arch/x86
maxv c4cd7f0720 There is an issue in the way the direct map is set up on amd64.
When allocating memory, the kernel allocates physical pages and virtual
addresses for these pages. In order to optimize allocations smaller
than PAGE_SIZE, uvm_km_kmem_alloc can allocate a single physical page
and take its virtual address in the direct map in high virtual memory.
This direct map is set up at boot time, its PTEs do not change, and
therefore they don't need to be kentered. These high virtual PTEs being
constant, the permissions of the areas they point to are fixed at boot
time and cannot change.

The problem is that at boot time, they are created with RWX permissions.
Therefore, allocations smaller than PAGE_SIZE in the kernel heap are all
executable: mbufs, pnbufs, small kmem allocations, etc.

Fix this by setting the NOX bit in the direct map pages at boot time. We
also set the NOX bit in the temporary tmpva, since it does not need to
be executable either.

This also makes the U-area non executable on amd64.
2016-05-21 07:15:56 +00:00
..
acpi Fix build break. 2016-01-28 23:50:04 +00:00
conf Add cpu_rng, a framework for simple on-CPU random number generators. 2016-02-27 00:09:44 +00:00
include Add some bit definitions mainly taken from the latest Intel SDM: 2016-04-27 08:51:32 +00:00
isa add intr_handle_t and let pci_intr_handle_t use it. 2015-04-27 06:51:40 +00:00
pci Introduce softint-based if_input 2016-02-09 08:32:07 +00:00
x86 There is an issue in the way the direct map is set up on amd64. 2016-05-21 07:15:56 +00:00