When mmap-ing a file from a noexec mount, be sure not to grant the right
to mmap it PROT_EXEC. This also depends on the architecture, as some architextures (e.g. i386) do not distinguish between read and exec pages Inspired by: http://linux.bkbits.net:8080/linux-2.4/cset@1.1267.1.85 Reviewed by: alc
This commit is contained in:
parent
12c2822777
commit
365db5dd01
@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/file.h>
|
||||
#include <sys/mac.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vmmeter.h>
|
||||
@ -323,7 +324,10 @@ mmap(td, uap)
|
||||
* credentials do we use for determination? What if
|
||||
* proc does a setuid?
|
||||
*/
|
||||
maxprot = VM_PROT_EXECUTE; /* ??? */
|
||||
if (vp->v_mount->mnt_flag & MNT_NOEXEC)
|
||||
maxprot = VM_PROT_NONE;
|
||||
else
|
||||
maxprot = VM_PROT_EXECUTE;
|
||||
if (fp->f_flag & FREAD) {
|
||||
maxprot |= VM_PROT_READ;
|
||||
} else if (prot & PROT_READ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user