zephyr/kernel
Leandro Pereira b007b64d30 kernel: Add option to ensure writable pages are not executable
This adds CONFIG_EXECUTE_XOR_WRITE, which is enabled by default on
systems that support controlling whether a page can contain executable
code.  This is also known as W^X[1].

Trying to add a memory domain with a page that is both executable and
writable, either for supervisor mode threads, or for user mode threads,
will result in a kernel panic.

There are few cases where a writable page should also be executable
(JIT compilers, which are most likely out of scope for Zephyr), so an
option is provided to disable the check.

Since the memory domain APIs are executed in supervisor mode, a
determined person could bypass these checks with ease.  This is seen
more as a way to avoid people shooting themselves in the foot.

[1] https://en.wikipedia.org/wiki/W%5EX

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-11-02 13:40:50 -07:00
..
include cleanup: rename fiber/task -> thread 2017-10-30 18:41:15 -04:00
Kconfig kernel: Add option to ensure writable pages are not executable 2017-11-02 13:40:50 -07:00
Kconfig.event_logger kernel: Add thread events to kernel event logger 2017-04-25 02:16:36 +00:00
Kconfig.power_mgmt doc: spelling fixes in Kconfig files 2017-06-12 19:40:51 -04:00
Makefile kernel: add syscalls for k_object_access APIs 2017-10-05 12:53:41 -04:00
alert.c kernel: Provide only one _SYSCALL_HANDLER() macro 2017-10-16 13:42:15 -04:00
atomic_c.c license: Replace Apache boilerplate with SPDX tag 2017-01-19 03:50:58 +00:00
compiler_stack_protect.c linker: move all linker headers to include/linker 2017-06-18 09:24:04 -05:00
device.c kernel: Compare pointers before strings when getting device binding 2017-10-19 14:43:48 -07:00
errno.c kernel: errno: Use per-thread accessor function compatible with Newlib 2017-05-10 20:54:56 -04:00
idle.c linker: move all linker headers to include/linker 2017-06-18 09:24:04 -05:00
init.c tests: benchmarking: cleanup of the benchmarking code. 2017-11-02 09:01:06 -04:00
int_latency_bench.c Convert remaining code to using newly introduced integer sized types 2017-04-21 11:38:23 -05:00
mailbox.c kernel: Use SYS_DLIST_FOR_EACH_CONTAINER whenever possible 2017-08-25 09:08:50 -04:00
mem_domain.c kernel: Add option to ensure writable pages are not executable 2017-11-02 13:40:50 -07:00
mem_slab.c kernel: introduce object validation mechanism 2017-09-07 16:33:33 -07:00
mempool.c mem_pool: Don't check level_empty() before breaking a block 2017-07-31 09:14:59 -07:00
msg_q.c kernel: Provide only one _SYSCALL_HANDLER() macro 2017-10-16 13:42:15 -04:00
mutex.c kernel: Remove dead or commented code from k_mutex_lock() 2017-10-24 11:11:00 -07:00
pipes.c kernel: Provide only one _SYSCALL_HANDLER() macro 2017-10-16 13:42:15 -04:00
poll.c poll: k_poll: Return -EINTR if not ready 2017-10-18 13:02:52 -04:00
pthread.c kernel: POSIX thread IPC support 2017-08-15 19:42:07 -04:00
queue.c queue: k_queue_cancel_wait: Fix not interrupting other threads 2017-10-18 13:02:52 -04:00
sched.c kernel: Provide only one _SYSCALL_HANDLER() macro 2017-10-16 13:42:15 -04:00
sem.c kernel: Fix comment section of semaphore object 2017-10-27 10:56:58 -07:00
stack.c kernel: Provide only one _SYSCALL_HANDLER() macro 2017-10-16 13:42:15 -04:00
sys_clock.c kernel: Provide only one _SYSCALL_HANDLER() macro 2017-10-16 13:42:15 -04:00
system_work_q.c kernel: introduce stack definition macros 2017-06-09 18:53:28 -04:00
thread.c kernel: fix bit clearing logic in _k_thread_group_leave 2017-10-27 10:56:58 -07:00
thread_abort.c kernel: Provide only one _SYSCALL_HANDLER() macro 2017-10-16 13:42:15 -04:00
timer.c kernel: Provide only one _SYSCALL_HANDLER() macro 2017-10-16 13:42:15 -04:00
userspace.c drivers: Rename `random` to `entropy` 2017-11-01 08:26:29 -04:00
userspace_handler.c userspace handlers: finer control of init state 2017-10-16 19:02:00 -07:00
version.c kernel: version: no need to store version in RAM 2017-09-07 16:34:50 -07:00
work_q.c kernel: fix k_thread_stack_t definition 2017-10-17 08:24:29 -07:00