c4cd7f0720
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. |
||
---|---|---|
.. | ||
acpi | ||
conf | ||
include | ||
isa | ||
pci | ||
x86 |