In NaClHostDescMap, mmap sans PROT_EXEC, then request the permission using mprotect.
In NaClHostDescMap, mmap sans PROT_EXEC, then request the permission using mprotect.

In chromium-os, the /dev/shm and the user partition (where installed apps live) are mounted no-exec, and a special modification was made to the chromium-os version of the Linux kernel to allow mmap to use files as backing store with PROT_EXEC.  The standard mmap code path will fail mmap requests that ask for PROT_EXEC, but mprotect will allow chaning the permissions later.  This retains most of the defense-in-depth property of disallowing PROT_EXEC in mmap, but enables the use case of getting executable code from a file without copying.

See https://code.google.com/p/chromium/issues/detail?id=202321 for details of the chromium-os change.

TEST= existing: run_mmap_prot_exec_test
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3355

Review URL: https://codereview.chromium.org/13991010

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@11199 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client