android_kernel_samsung_msm8976/arch/arm/mm
Jason Baron df67b3daea [PATCH] make PROT_WRITE imply PROT_READ
Make PROT_WRITE imply PROT_READ for a number of architectures which don't
support write only in hardware.

While looking at this, I noticed that some architectures which do not
support write only mappings already take the exact same approach.  For
example, in arch/alpha/mm/fault.c:

"
        if (cause < 0) {
                if (!(vma->vm_flags & VM_EXEC))
                        goto bad_area;
        } else if (!cause) {
                /* Allow reads even for write-only mappings */
                if (!(vma->vm_flags & (VM_READ | VM_WRITE)))
                        goto bad_area;
        } else {
                if (!(vma->vm_flags & VM_WRITE))
                        goto bad_area;
        }
"

Thus, this patch brings other architectures which do not support write only
mappings in-line and consistent with the rest.  I've verified the patch on
ia64, x86_64 and x86.

Additional discussion:

Several architectures, including x86, can not support write-only mappings.
The pte for x86 reserves a single bit for protection and its two states are
read only or read/write.  Thus, write only is not supported in h/w.

Currently, if i 'mmap' a page write-only, the first read attempt on that page
creates a page fault and will SEGV.  That check is enforced in
arch/blah/mm/fault.c.  However, if i first write that page it will fault in
and the pte will be set to read/write.  Thus, any subsequent reads to the page
will succeed.  It is this inconsistency in behavior that this patch is
attempting to address.  Furthermore, if the page is swapped out, and then
brought back the first read will also cause a SEGV.  Thus, any arbitrary read
on a page can potentially result in a SEGV.

According to the SuSv3 spec, "if the application requests only PROT_WRITE, the
implementation may also allow read access." Also as mentioned, some
archtectures, such as alpha, shown above already take the approach that i am
suggesting.

The counter-argument to this raised by Arjan, is that the kernel is enforcing
the write only mapping the best it can given the h/w limitations.  This is
true, however Alan Cox, and myself would argue that the inconsitency in
behavior, that is applications can sometimes work/sometimes fails is highly
undesireable.  If you read through the thread, i think people, came to an
agreement on the last patch i posted, as nobody has objected to it...

Signed-off-by: Jason Baron <jbaron@redhat.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Andi Kleen <ak@muc.de>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Ian Molton <spyro@f2s.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:05 -07:00
..
abort-ev4.S
abort-ev4t.S
abort-ev5t.S
abort-ev5tj.S
abort-ev6.S [ARM] CONFIG_CPU_MPCORE -> CONFIG_CPU_32v6K 2006-02-22 21:13:28 +00:00
abort-lv4t.S [ARM] nommu: abort handler fixup for !CPU_CP15_MMU cores. 2006-09-28 20:15:46 +01:00
abort-macro.S
abort-nommu.S [ARM] nommu: abort handler fixup for !CPU_CP15_MMU cores. 2006-09-28 20:15:46 +01:00
alignment.c [ARM] do_bad_area() always takes current and current->active_mm 2006-09-27 16:13:48 +01:00
cache-v3.S
cache-v4.S [ARM] nommu: manage the CP15 things 2006-09-27 17:34:30 +01:00
cache-v4wb.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
cache-v4wt.S
cache-v6.S [ARM] 3356/1: Workaround for the ARM1136 I-cache invalidation problem 2006-03-10 22:26:47 +00:00
consistent.c [ARM] 3439/2: xsc3: add I/O coherency support 2006-04-02 00:07:39 +01:00
context.c [ARM] Move mmu.c out of the way 2006-09-20 14:58:35 +01:00
copypage-v3.S [ARM] Remove LOADREGS macro 2006-06-25 11:23:45 +01:00
copypage-v4mc.c [ARM] Cleanup arch/arm/mm a little 2006-09-20 14:58:35 +01:00
copypage-v4wb.S kbuild: arm - use generic asm-offsets.h support 2005-09-09 21:08:59 +02:00
copypage-v4wt.S kbuild: arm - use generic asm-offsets.h support 2005-09-09 21:08:59 +02:00
copypage-v6.c [ARM] Cleanup arch/arm/mm a little 2006-09-20 14:58:35 +01:00
copypage-xsc3.S [ARM] 3377/2: add support for intel xsc3 core 2006-03-28 21:00:40 +01:00
copypage-xscale.c [ARM] Cleanup arch/arm/mm a little 2006-09-20 14:58:35 +01:00
discontig.c [ARM] Cleanup ARM includes 2006-01-03 17:39:34 +00:00
extable.c
fault-armv.c [PATCH] mm: arm ready for split ptlock 2005-10-29 21:40:42 -07:00
fault.c [PATCH] make PROT_WRITE imply PROT_READ 2006-09-29 09:18:05 -07:00
fault.h [ARM] do_bad_area() always takes current and current->active_mm 2006-09-27 16:13:48 +01:00
flush.c [ARM] 3853/1: Fix flush_ptrace_access() thinko for nonaliasing VIPT cache case 2006-09-25 10:34:04 +01:00
init.c [ARM] Split ARM MM initialisation for !mmu 2006-09-27 15:27:33 +01:00
iomap.c [ARM] nommu: add stubs for ioremap and friends 2006-06-28 17:59:48 +01:00
ioremap.c [PATCH] Standardize pxx_page macros 2006-09-26 08:48:51 -07:00
Kconfig [ARM] nommu: confirms the CR_V bit in nommu mode 2006-09-28 20:17:30 +01:00
Makefile [ARM] nommu: abort handler fixup for !CPU_CP15_MMU cores. 2006-09-28 20:15:46 +01:00
mm.h [ARM] Move rest of MMU setup code from mm-armv.c to mmu.c 2006-09-27 15:38:34 +01:00
mmap.c [ARM] 3813/1: prevent >= 4G /dev/mem mmap() 2006-09-25 10:25:26 +01:00
mmu.c [ARM] Move rest of MMU setup code from mm-armv.c to mmu.c 2006-09-27 15:38:34 +01:00
nommu.c [ARM] Add setup_mm_for_reboot() for nommu 2006-09-27 15:43:47 +01:00
pgd.c [ARM] Rename mm-armv.c to pgd.c 2006-09-27 15:40:28 +01:00
proc-arm6_7.S [ARM] Set bit 4 on section mappings correctly depending on CPU 2006-06-29 18:24:21 +01:00
proc-arm7tdmi.S [ARM] nommu: add ARM7TDMI core support 2006-09-27 17:39:17 +01:00
proc-arm9tdmi.S [ARM] nommu: abort handler fixup for !CPU_CP15_MMU cores. 2006-09-28 20:15:46 +01:00
proc-arm720.S [PATCH] ARM: Fixup missing includes in arch/arm/mm/proc-<cputype>.S 2006-07-02 17:29:22 -07:00
proc-arm740.S [ARM] nommu: add ARM740T core support 2006-09-27 17:39:17 +01:00
proc-arm920.S Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-07-02 15:04:12 -07:00
proc-arm922.S Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-07-02 15:04:12 -07:00
proc-arm925.S [ARM] Fix bad asm instruction in proc-arm925.S 2006-07-03 12:44:30 +01:00
proc-arm926.S [ARM] 3773/1: Add the HWCAP_VFP bit for the ARM926 CPUs 2006-09-06 19:03:28 +01:00
proc-arm940.S [ARM] nommu: abort handler fixup for !CPU_CP15_MMU cores. 2006-09-28 20:15:46 +01:00
proc-arm946.S [ARM] nommu: abort handler fixup for !CPU_CP15_MMU cores. 2006-09-28 20:15:46 +01:00
proc-arm1020.S [ARM] More missing proc-macros.S includes 2006-07-03 12:36:07 +01:00
proc-arm1020e.S [ARM] More missing proc-macros.S includes 2006-07-03 12:36:07 +01:00
proc-arm1022.S [ARM] More missing proc-macros.S includes 2006-07-03 12:36:07 +01:00
proc-arm1026.S [ARM] More missing proc-macros.S includes 2006-07-03 12:36:07 +01:00
proc-macros.S [ARM] nommu: provide a way for correct control register value selection 2006-06-29 15:09:57 +01:00
proc-sa110.S [PATCH] ARM: Fixup missing includes in arch/arm/mm/proc-<cputype>.S 2006-07-02 17:29:22 -07:00
proc-sa1100.S [PATCH] ARM: Fixup missing includes in arch/arm/mm/proc-<cputype>.S 2006-07-02 17:29:22 -07:00
proc-syms.c [ARM] 3737/1: Export ARM copy/clear_user_page symbols 2006-07-29 08:29:27 +01:00
proc-v6.S Merge nommu branch 2006-07-01 20:43:57 +01:00
proc-xsc3.S Merge nommu branch 2006-07-01 20:43:57 +01:00
proc-xscale.S [ARM] 3814/1: move 80200 dma_inv_range() erratum check out of line 2006-09-25 10:25:27 +01:00
tlb-v3.S kbuild: arm - use generic asm-offsets.h support 2005-09-09 21:08:59 +02:00
tlb-v4.S kbuild: arm - use generic asm-offsets.h support 2005-09-09 21:08:59 +02:00
tlb-v4wb.S kbuild: arm - use generic asm-offsets.h support 2005-09-09 21:08:59 +02:00
tlb-v4wbi.S kbuild: arm - use generic asm-offsets.h support 2005-09-09 21:08:59 +02:00
tlb-v6.S [ARM] 3352/1: DSB required for the completion of a TLB maintenance operation 2006-03-07 14:42:27 +00:00