freebsd-dev/sys/vm
Jonathan T. Looney 0766f278d8 Make UMA and malloc(9) return non-executable memory in most cases.
Most kernel memory that is allocated after boot does not need to be
executable.  There are a few exceptions.  For example, kernel modules
do need executable memory, but they don't use UMA or malloc(9).  The
BPF JIT compiler also needs executable memory and did use malloc(9)
until r317072.

(Note that a side effect of r316767 was that the "small allocation"
path in UMA on amd64 already returned non-executable memory.  This
meant that some calls to malloc(9) or the UMA zone(9) allocator could
return executable memory, while others could return non-executable
memory.  This change makes the behavior consistent.)

This change makes malloc(9) return non-executable memory unless the new
M_EXEC flag is specified.  After this change, the UMA zone(9) allocator
will always return non-executable memory, and a KASSERT will catch
attempts to use the M_EXEC flag to allocate executable memory using
uma_zalloc() or its variants.

Allocations that do need executable memory have various choices.  They
may use the M_EXEC flag to malloc(9), or they may use a different VM
interfact to obtain executable pages.

Now that malloc(9) again allows executable allocations, this change also
reverts most of r317072.

PR:		228927
Reviewed by:	alc, kib, markj, jhb (previous version)
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D15691
2018-06-13 17:04:41 +00:00
..
_vm_radix.h sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
default_pager.c SPDX: wrong license. 2017-11-30 15:45:42 +00:00
device_pager.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
memguard.c Eliminate kmem_arena and kmem_object in preparation for further NUMA commits. 2017-11-28 23:40:54 +00:00
memguard.h sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
phys_pager.c sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
pmap.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
redzone.c sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
redzone.h sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
sg_pager.c sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
swap_pager.c Move most of the contents of opt_compat.h to opt_global.h. 2018-04-06 17:35:35 +00:00
swap_pager.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
uma_core.c Make UMA and malloc(9) return non-executable memory in most cases. 2018-06-13 17:04:41 +00:00
uma_dbg.c sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
uma_dbg.h sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
uma_int.h Align UMA data to 128 byte cacheline size 2018-06-04 15:44:17 +00:00
uma.h Make UMA and malloc(9) return non-executable memory in most cases. 2018-06-13 17:04:41 +00:00
vm_domainset.c Use the canonical check for reservation support. 2018-05-19 23:49:13 +00:00
vm_domainset.h Implement several enhancements to NUMA policies. 2018-03-29 02:54:50 +00:00
vm_extern.h Make UMA and malloc(9) return non-executable memory in most cases. 2018-06-13 17:04:41 +00:00
vm_fault.c Typo. 2018-05-30 16:48:48 +00:00
vm_glue.c Account the size of the vslock-ed memory by the thread. 2018-03-24 13:51:27 +00:00
vm_init.c Make UMA and malloc(9) return non-executable memory in most cases. 2018-06-13 17:04:41 +00:00
vm_kern.c Make UMA and malloc(9) return non-executable memory in most cases. 2018-06-13 17:04:41 +00:00
vm_kern.h Make UMA and malloc(9) return non-executable memory in most cases. 2018-06-13 17:04:41 +00:00
vm_map.c Use a single, consistent approach to returning success versus failure in 2018-06-04 16:28:06 +00:00
vm_map.h Make vm_map_max/min/pmap KBI stable. 2018-03-30 10:55:31 +00:00
vm_meter.c vm: move vm_cnt to __read_mostly now that it is not written to 2018-04-27 05:36:02 +00:00
vm_mmap.c Use a single, consistent approach to returning success versus failure in 2018-06-04 16:28:06 +00:00
vm_object.c Fix some races introduced in r332974. 2018-05-04 17:17:30 +00:00
vm_object.h Use per-domain locks for vm page queue free. Move paging control from 2018-02-06 22:10:07 +00:00
vm_page.c Fix a typo in vm_domain_set(). When a domain crosses into the severe range, 2018-06-07 13:29:54 +00:00
vm_page.h Fix a race in vm_page_pagequeue_lockptr(). 2018-05-17 04:27:08 +00:00
vm_pageout.c Correct the description of vm_pageout_scan_inactive() after r334508. 2018-06-04 16:46:36 +00:00
vm_pageout.h Fix GCC build: Remove redundant pagedaemon_wakeup declaration 2018-03-16 07:05:09 +00:00
vm_pagequeue.h Make UMA and malloc(9) return non-executable memory in most cases. 2018-06-13 17:04:41 +00:00
vm_pager.c SPDX: Consider code from Carnegie-Mellon University. 2017-11-30 15:48:35 +00:00
vm_pager.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
vm_param.h SPDX: Consider code from Carnegie-Mellon University. 2017-11-30 15:48:35 +00:00
vm_phys.c Improve VM page queue scalability. 2018-04-24 21:15:54 +00:00
vm_phys.h Add a uma cache of free pages in the DEFAULT freepool. This gives us 2018-04-01 04:50:05 +00:00
vm_radix.c Fix boot_pages calculation for machines that don't have UMA_MD_SMALL_ALLOC. 2018-02-06 22:06:59 +00:00
vm_radix.h sys: general adoption of SPDX licensing ID tags. 2017-11-27 15:23:17 +00:00
vm_reserv.c Fix two compliation problems on non-amd64 architectures. 2018-03-23 18:24:02 +00:00
vm_reserv.h Lock reservations with a dedicated lock in each reservation. Protect the 2018-03-22 19:21:11 +00:00
vm_swapout_dummy.c SPDX: Consider code from Carnegie-Mellon University. 2017-11-30 15:48:35 +00:00
vm_swapout.c Improve VM page queue scalability. 2018-04-24 21:15:54 +00:00
vm_unix.c Reimplement brk() and sbrk() to avoid the use of _end. 2018-06-04 19:35:15 +00:00
vm.h Move vm_ndomains to vm.h where it can be used with a single header include 2018-03-27 03:27:02 +00:00
vnode_pager.c Implement several enhancements to NUMA policies. 2018-03-29 02:54:50 +00:00
vnode_pager.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00