opnsense-src/sys/fs
Konstantin Belousov ecc6c515ab Apply noexec mount option for mmap(PROT_EXEC).
Right now the noexec mount option disallows image activators to try
execve the files on the mount point.  Also, after r127187, noexec
also limits max_prot map entries permissions for mappings of files
from such mounts, but not the actual mapping permissions.

As result, the API behaviour is inconsistent.  The files from noexec
mount can be mapped with PROT_EXEC, but if mprotect(2) drops execution
permission, it cannot be re-enabled later.  Make this consistent
logically and aligned with behaviour of other systems, by disallowing
PROT_EXEC for mmap(2).

Note that this change only ensures aligned results from mmap(2) and
mprotect(2), it does not prevent actual code execution from files
coming from noexec mount.  Such files can always be read into
anonymous executable memory and executed from there.

Reported by:	shamaz.mazum@gmail.com
PR:	217062
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-02-19 20:51:04 +00:00
..
autofs Remove spurious space. 2016-11-13 12:06:25 +00:00
cd9660 cd9660: fix up compilation on sparc after r311665 2017-01-10 04:17:53 +00:00
cuse Prevent cuse4bsd.ko and cuse.ko from loading at the same time by 2016-09-23 07:41:23 +00:00
deadfs Style changes for deadfs: 2014-10-15 13:22:33 +00:00
devfs Apply noexec mount option for mmap(PROT_EXEC). 2017-02-19 20:51:04 +00:00
ext2fs ext2fs: Remove unused assignment. 2017-02-17 20:56:43 +00:00
fdescfs Hide the boottime and bootimebin globals, provide the getboottime(9) 2016-07-27 11:08:59 +00:00
fifofs Rewrite sigdeferstop(9) and sigallowstop(9) into more flexible 2016-06-26 20:07:24 +00:00
fuse If a local (AF_LOCAL, AF_UNIX) socket creation (bind) is attempted 2016-05-18 22:23:20 +00:00
msdosfs Use buffer pager for msdosfs. 2016-10-28 11:46:15 +00:00
nandfs prefix UFS symbols with UFS_ to reduce namespace pollution 2017-02-15 19:50:26 +00:00
nfs Do not allocate struct statfs on kernel stack. 2017-01-05 17:19:26 +00:00
nfsclient Do not access memory past the buffer end. 2017-02-16 06:36:16 +00:00
nfsserver Use inet_ntoa_r() instead of inet_ntoa() throughout the kernel 2017-02-16 20:47:41 +00:00
nullfs Do not allocate struct statfs on kernel stack. 2017-01-05 17:19:26 +00:00
procfs Hide the boottime and bootimebin globals, provide the getboottime(9) 2016-07-27 11:08:59 +00:00
pseudofs Forcibly remove the cached items from pseudofs vncache on module unload. 2017-01-09 20:14:18 +00:00
smbfs Replace all remaining calls to vprint(9) with vn_printf(9), and remove 2016-08-10 16:12:31 +00:00
tmpfs Remove mistakenly merged field. 2017-01-19 20:03:26 +00:00
udf On error, bread(9) zeroes buffer pointer, do not dereference it. 2016-11-22 13:24:57 +00:00
unionfs Do not allocate struct statfs on kernel stack. 2017-01-05 17:19:26 +00:00