freebsd-dev/sys/kern
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
..
bus_if.m
capabilities.conf
clock_if.m
cpufreq_if.m
device_if.m
genassym.sh
imgact_aout.c
imgact_binmisc.c Use NULL for SYSINIT's last arg, which is a pointer type 2018-05-18 17:58:09 +00:00
imgact_elf32.c
imgact_elf64.c
imgact_elf.c Correct pointer subtraction in KASSERT(). 2018-05-29 17:49:03 +00:00
imgact_gzip.c
imgact_shell.c
inflate.c
init_main.c Use strsep() to parse init_path in start_init(). 2018-05-17 23:07:51 +00:00
init_sysent.c Regen after r334223: make vadvise compat freebsd11. 2018-05-25 20:41:26 +00:00
kern_acct.c
kern_alq.c
kern_clock.c epoch: skip poll function call in hardclock unless there are callbacks pending 2018-05-17 21:39:15 +00:00
kern_clocksource.c stop and restart kernel event timers in the suspend / resume cycle 2018-05-21 20:23:04 +00:00
kern_condvar.c
kern_conf.c conf: revert last change and annotate unused var instead 2018-05-19 05:07:03 +00:00
kern_cons.c add support for console resuming, implement it for uart, use on x86 2018-05-29 16:16:24 +00:00
kern_context.c
kern_cpu.c Boost thread priority while changing CPU frequency 2018-05-07 15:24:03 +00:00
kern_cpuset.c kern_cpuset: fix small leak on error path 2018-05-26 14:23:11 +00:00
kern_ctf.c
kern_descrip.c ANSIfy sys/kern 2018-06-01 13:26:45 +00:00
kern_dtrace.c systrace: track it like sdt probes 2018-04-27 15:16:34 +00:00
kern_dump.c Print the dump progress indicator after calling dump_start(). 2018-05-01 17:32:43 +00:00
kern_environment.c
kern_et.c
kern_event.c kevent: annotate unused stack local 2018-05-19 05:06:18 +00:00
kern_exec.c Use a single, consistent approach to returning success versus failure in 2018-06-04 16:28:06 +00:00
kern_exit.c
kern_fail.c
kern_ffclock.c
kern_fork.c
kern_hhook.c
kern_idle.c
kern_intr.c Yank crufty INTR_FILTER option 2018-05-24 17:06:00 +00:00
kern_jail.c Try to be consistent and spell "vnet" lower case like all the 2018-05-24 15:31:05 +00:00
kern_khelp.c
kern_kthread.c hwpmc: log name->pid, name->tid mappings 2018-06-05 04:26:40 +00:00
kern_ktr.c
kern_ktrace.c Reduce overhead of ktrace checks in the common case. 2018-05-09 00:00:47 +00:00
kern_linker.c Use NULL for SYSINIT's last arg, which is a pointer type 2018-05-18 17:58:09 +00:00
kern_lock.c remove unused locked variable in lockmgr_unlock_fast_path 2018-05-19 03:58:40 +00:00
kern_lockf.c lockf: annotate LOCKF_DEBUG only var 2018-05-19 05:04:38 +00:00
kern_lockstat.c lockstat: track lockstat just like sdt probes 2018-04-24 01:04:10 +00:00
kern_loginclass.c
kern_malloc.c Make UMA and malloc(9) return non-executable memory in most cases. 2018-06-13 17:04:41 +00:00
kern_mbuf.c Add an mbuf allocator for netdump. 2018-05-06 00:19:48 +00:00
kern_mib.c clk: Put the sysctls under hw.clock instead of clock 2018-04-27 00:12:00 +00:00
kern_module.c Use NULL for SYSINIT's last arg, which is a pointer type 2018-05-18 17:58:09 +00:00
kern_mtxpool.c
kern_mutex.c Remove an unused argument to turnstile_unpend. 2018-06-02 22:37:53 +00:00
kern_ntptime.c
kern_osd.c
kern_physio.c physio: avoid uninitialized variables 2018-05-19 04:09:58 +00:00
kern_pmc.c hwpmc: simplify calling convention for hwpmc interrupt handling 2018-06-08 04:58:03 +00:00
kern_poll.c
kern_priv.c
kern_proc.c
kern_procctl.c
kern_prot.c
kern_racct.c
kern_rangelock.c
kern_rctl.c
kern_resource.c
kern_rmlock.c Remove an unused argument to turnstile_unpend. 2018-06-02 22:37:53 +00:00
kern_rwlock.c Remove an unused argument to turnstile_unpend. 2018-06-02 22:37:53 +00:00
kern_sdt.c
kern_sema.c
kern_sendfile.c Revert second chunk of r333860. The warning from gcc is false positive. The 2018-05-29 21:45:15 +00:00
kern_sharedpage.c
kern_shutdown.c remove unused variable 2018-05-19 03:55:42 +00:00
kern_sig.c signotify: don't create a stack local that isn't used on non-debug builds 2018-05-19 03:57:41 +00:00
kern_switch.c Remove incorrect owepreempt assertion added in r334062 2018-05-23 10:13:17 +00:00
kern_sx.c sx: fixup a braino in r334024 2018-05-22 15:13:25 +00:00
kern_synch.c Reduce sdt-related branch-fest in mi_switch. 2018-05-22 08:27:33 +00:00
kern_syscalls.c Avoid calls to syscall_thread_enter/exit for statically defined syscalls 2018-05-07 22:29:32 +00:00
kern_sysctl.c Use NULL for SYSINIT's last arg, which is a pointer type 2018-05-18 17:58:09 +00:00
kern_tc.c tc: bcopy -> memcpy 2018-05-04 22:48:10 +00:00
kern_thr.c hwpmc: log name->pid, name->tid mappings 2018-06-05 04:26:40 +00:00
kern_thread.c hwpmc: log name->pid, name->tid mappings 2018-06-05 04:26:40 +00:00
kern_time.c
kern_timeout.c
kern_tslog.c
kern_umtx.c umtx: don't call umtxq_getchain unless the value is needed 2018-05-19 05:09:10 +00:00
kern_uuid.c
kern_xxx.c
ksched.c
link_elf_obj.c link_elf_obj: correct an error message 2018-05-30 12:55:27 +00:00
link_elf.c Use NULL for SYSINIT's last arg, which is a pointer type 2018-05-18 17:58:09 +00:00
linker_if.m
Make.tags.inc
Makefile
makesyscalls.sh makesyscalls: simplify capenabled pipeline 2018-06-11 18:57:40 +00:00
md4c.c
md5c.c
msi_if.m
p1003_1b.c
pic_if.m
posix4_mib.c Use NULL for SYSINIT's last arg, which is a pointer type 2018-05-18 17:58:09 +00:00
sched_4bsd.c Inlined sched_userret. 2018-05-07 23:36:16 +00:00
sched_ule.c Inlined sched_userret. 2018-05-07 23:36:16 +00:00
serdev_if.m
stack_protector.c
subr_acl_nfs4.c
subr_acl_posix1e.c
subr_autoconf.c
subr_blist.c
subr_bufring.c
subr_bus_dma.c
subr_bus.c Make the data returned by devinfo harder to overflow. 2018-05-31 02:57:58 +00:00
subr_busdma_bufalloc.c
subr_capability.c kern_sendit: use pre-initialized rights 2018-05-23 01:48:09 +00:00
subr_clock.c
subr_compressor.c
subr_counter.c counter: add a bit missed in r334858 2018-06-08 22:06:32 +00:00
subr_devmap.c
subr_devstat.c
subr_disk.c Implement a 'car limit' for bioq. 2018-06-13 16:48:07 +00:00
subr_dummy_vdso_tc.c
subr_epoch.c epoch(9): make epoch closer to style(9) 2018-05-30 03:39:57 +00:00
subr_eventhandler.c
subr_fattime.c
subr_firmware.c
subr_gtaskqueue.c iflib: mark irq allocation name parameter as constant 2018-05-29 21:56:39 +00:00
subr_hash.c
subr_hints.c
subr_intr.c
subr_kdb.c kdb_trap: Fix use of uninitialized data 2018-05-26 14:01:44 +00:00
subr_kobj.c
subr_lock.c
subr_log.c
subr_mchain.c
subr_module.c
subr_msgbuf.c
subr_param.c
subr_pcpu.c Use NULL for SYSINIT's last arg, which is a pointer type 2018-05-18 17:58:09 +00:00
subr_pctrie.c
subr_pidctrl.c When pidctrl_daemon() is called multiple times within an interval, it 2018-06-07 07:48:50 +00:00
subr_power.c
subr_prf.c fix uninitialized variable warning 2018-05-19 03:49:36 +00:00
subr_prof.c ANSIfy sys/kern 2018-06-01 13:26:45 +00:00
subr_rman.c
subr_rtc.c
subr_sbuf.c
subr_scanf.c
subr_sfbuf.c
subr_sglist.c
subr_sleepqueue.c turnstile / sleepqueue: annotate variables only used by debug builds 2018-05-19 05:00:16 +00:00
subr_smp.c
subr_stack.c
subr_syscall.c systrace: track it like sdt probes 2018-04-27 15:16:34 +00:00
subr_taskqueue.c
subr_terminal.c teken, vt(4): New callbacks to lock the terminal once 2018-05-16 09:01:02 +00:00
subr_trap.c hwpmc: support sampling both kernel and user stacks when interrupted in kernel 2018-06-04 01:10:23 +00:00
subr_turnstile.c Remove an unused argument to turnstile_unpend. 2018-06-02 22:37:53 +00:00
subr_uio.c simplify control flow so that gcc knows we never pass save to curthread_pflags_restore 2018-05-19 04:04:44 +00:00
subr_unit.c
subr_vmem.c Make UMA and malloc(9) return non-executable memory in most cases. 2018-06-13 17:04:41 +00:00
subr_witness.c witness/hwpmc: fix locking order for pmc locks 2018-05-28 23:14:38 +00:00
sys_capability.c capsicum: propagate const correctness 2018-05-19 05:14:05 +00:00
sys_generic.c Fix the build after r333457 2018-05-10 13:19:42 +00:00
sys_getrandom.c
sys_pipe.c ANSIfy sys/kern 2018-06-01 13:26:45 +00:00
sys_procdesc.c Eliminate the overhead of gratuitous repeated reinitialization of cap_rights 2018-05-09 18:47:24 +00:00
sys_process.c sys_process.c fix set but not used warning 2018-05-19 03:48:35 +00:00
sys_socket.c
syscalls.c Regen after r334223: make vadvise compat freebsd11. 2018-05-25 20:41:26 +00:00
syscalls.master Reimplement brk() and sbrk() to avoid the use of _end. 2018-06-04 19:35:15 +00:00
systrace_args.c Regen after r334626. 2018-06-04 19:36:47 +00:00
sysv_ipc.c
sysv_msg.c ANSIfy sys/kern 2018-06-01 13:26:45 +00:00
sysv_sem.c
sysv_shm.c
tty_compat.c
tty_info.c
tty_inq.c tty: use __unused annotation instead to silence warnings 2018-05-19 04:48:26 +00:00
tty_outq.c tty: use __unused annotation instead to silence warnings 2018-05-19 04:48:26 +00:00
tty_pts.c
tty_tty.c
tty_ttydisc.c
tty.c
uipc_accf.c
uipc_debug.c Load balance sockets with new SO_REUSEPORT_LB option. 2018-06-06 15:45:57 +00:00
uipc_domain.c
uipc_mbuf2.c
uipc_mbuf.c Add a SPD cache to speed up lookups. 2018-05-22 15:54:25 +00:00
uipc_mbufhash.c
uipc_mqueue.c mqueue: avoid unused variables 2018-05-19 04:10:53 +00:00
uipc_sem.c Eliminate the overhead of gratuitous repeated reinitialization of cap_rights 2018-05-09 18:47:24 +00:00
uipc_shm.c
uipc_sockbuf.c This commit brings in a new refactored TCP stack called Rack. 2018-06-07 18:18:13 +00:00
uipc_socket.c limit change to fixing controlp handling pending review 2018-06-11 17:10:19 +00:00
uipc_syscalls.c kern_sendit: use pre-initialized rights 2018-05-23 01:48:09 +00:00
uipc_usrreq.c AF_UNIX: bring uipc_ready in compliance with new locking protocol 2018-06-08 20:31:59 +00:00
vfs_acl.c
vfs_aio.c Eliminate the overhead of gratuitous repeated reinitialization of cap_rights 2018-05-09 18:47:24 +00:00
vfs_bio.c Avoid completing I/O when dumping core after a panic. 2018-06-01 23:49:32 +00:00
vfs_cache.c cache_lookup remove unused variable and initialize used 2018-05-19 04:08:11 +00:00
vfs_cluster.c ANSIfy sys/kern 2018-06-01 13:26:45 +00:00
vfs_default.c vfs: simplify vop_stdlock/unlock 2018-05-20 04:45:05 +00:00
vfs_export.c
vfs_extattr.c
vfs_hash.c
vfs_init.c Make it easier for filesystems to count themselves as jail-enabled, 2018-05-04 20:54:27 +00:00
vfs_lookup.c vfs: annotate variables only used by debug builds as __unused 2018-05-19 04:59:39 +00:00
vfs_mount.c Make it easier for filesystems to count themselves as jail-enabled, 2018-05-04 20:54:27 +00:00
vfs_mountroot.c
vfs_subr.c Revert r334708 2018-06-06 15:12:19 +00:00
vfs_syscalls.c Fix the encoding of major and minor numbers in 64-bit dev_t by restoring 2018-06-13 12:22:00 +00:00
vfs_vnops.c ANSIfy sys/kern 2018-06-01 13:26:45 +00:00
vnode_if.src