Piotr Kwapulinski f138556daf mm/mprotect.c: don't imply PROT_EXEC on non-exec fs
The mprotect(PROT_READ) fails when called by the READ_IMPLIES_EXEC
binary on a memory mapped file located on non-exec fs.  The mprotect
does not check whether fs is _executable_ or not.  The PROT_EXEC flag is
set automatically even if a memory mapped file is located on non-exec
fs.  Fix it by checking whether a memory mapped file is located on a
non-exec fs.  If so the PROT_EXEC is not implied by the PROT_READ.  The
implementation uses the VM_MAYEXEC flag set properly in mmap.  Now it is
consistent with mmap.

I did the isolated tests (PT_GNU_STACK X/NX, multiple VMAs, X/NX fs).  I
also patched the official 3.19.0-47-generic Ubuntu 14.04 kernel and it
seems to work.

Signed-off-by: Piotr Kwapulinski <kwapulinski.piotr@gmail.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-22 15:36:02 -07:00
..
2016-03-22 15:36:02 -07:00
2015-11-05 19:34:48 -08:00
2016-03-17 15:09:34 -07:00
2015-06-24 17:49:45 -07:00
2016-03-19 15:38:41 -07:00
2016-03-17 15:09:34 -07:00
2011-07-26 16:49:47 -07:00
2016-03-17 15:09:34 -07:00
2016-03-22 15:36:02 -07:00
2016-03-17 15:09:34 -07:00
2016-03-17 15:09:34 -07:00
2016-03-17 15:09:34 -07:00
2015-09-08 15:35:28 -07:00
2016-01-21 17:20:51 -08:00
2016-03-17 15:09:34 -07:00
2016-03-17 15:09:34 -07:00
2015-11-05 19:34:48 -08:00
2016-03-22 15:36:02 -07:00
2016-03-17 15:09:34 -07:00
2016-03-17 15:09:34 -07:00
2016-03-17 15:09:34 -07:00