newlib-cygwin/newlib/libc/sys
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
..
a29khif Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
amdgcn Add gfortran support for AMD GCN 2019-06-07 13:55:43 -04:00
arm Align libgloss/arm and libc/sys/arm sources: miscellaneous fixes 2019-08-05 13:00:53 +01:00
d10v Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
decstation Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
epiphany Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
h8300hms Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
h8500hms Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
linux Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
m88kbug Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
mmixware Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
netware Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
or1k Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
phoenix Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
rdos Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
rtems Extend mmap/mprotect API to specify the max page 2019-09-25 09:01:10 +02:00
sh Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
sparc64 Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
sun4 Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
sysmec Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
sysnec810 Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
sysnecv850 Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
sysvi386 Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
sysvnecv70 Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
tic80 Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
tirtos Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
w65 Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
z8ksim Bump release to 3.1.0 for yearly snapshot 2018-12-31 23:40:11 -05:00
Makefile.am Make newlib manpages (v3) 2016-07-04 14:17:10 +01:00
Makefile.in Regenerate newlib Makefiles 2016-07-04 17:13:55 +01:00
aclocal.m4 2012-12-20 Jeff Johnston <jjohnstn@redhat.com> 2012-12-20 21:10:27 +00:00
configure AMD GCN Port contributed by Andrew Stubbs <ams@codesourcery.com> 2019-01-15 10:48:08 -05:00
configure.in AMD GCN Port contributed by Andrew Stubbs <ams@codesourcery.com> 2019-01-15 10:48:08 -05:00