newlib-cygwin/newlib/libc/sys/rtems/include
brooks e94d2a0f8b Extend mmap/mprotect API to specify the max page
protections.

A new macro PROT_MAX() alters a protection value so it can be OR'd with
a regular protection value to specify the maximum permissions.  If
present, these flags specify the maximum permissions.

While these flags are non-portable, they can be used in portable code
with simple ifdefs to expand PROT_MAX() to 0.

This change allows (e.g.) a region that must be writable during run-time
linking or JIT code generation to be made permanently read+execute after
writes are complete.  This complements W^X protections allowing more
precise control by the programmer.

This change alters mprotect argument checking and returns an error when
unhandled protection flags are set.  This differs from POSIX (in that
POSIX only specifies an error), but is the documented behavior on Linux
and more closely matches historical mmap behavior.

In addition to explicit setting of the maximum permissions, an
experimental sysctl vm.imply_prot_max causes mmap to assume that the
initial permissions requested should be the maximum when the sysctl is
set to 1.  PROT_NONE mappings are excluded from this for compatibility
with rtld and other consumers that use such mappings to reserve
address space before mapping contents into part of the reservation.  A
final version this is expected to provide per-binary and per-process
opt-in/out options and this sysctl will go away in its current form.
As such it is undocumented.

Reviewed by:	emaste, kib (prior version), markj
Additional suggestions from:	alc
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D18880
2019-09-25 09:01:10 +02:00
..
arpa RTEMS: Update FreeBSD version tags 2018-08-24 15:04:39 +02:00
machine Move RTEMS and XMK specific type definitions 2019-02-19 09:06:22 +01:00
net Plug routing sysctl leaks. 2018-12-20 12:12:37 +01:00
netinet RTEMS: Introduce <machine/_kernel_in.h> 2018-08-24 15:04:43 +02:00
netinet6 RTEMS: Introduce <machine/_kernel_in6.h> 2018-08-24 15:04:43 +02:00
sys Extend mmap/mprotect API to specify the max page 2019-09-25 09:01:10 +02:00
limits.h RTEMS: Increase SEM_VALUE_MAX 2016-12-20 12:39:31 +01:00
netdb.h Fix mismatch from r342379. 2019-09-25 09:01:04 +02:00
semaphore.h RTEMS: Make sem_t self-contained 2017-10-05 14:56:12 +02:00
syslog.h Add some POSIX header files for RTEMS 2017-05-25 12:41:33 -04:00
termios.h RTEMS: Update FreeBSD version tags 2018-08-24 15:04:39 +02:00