kernel-ark/arch/arm
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
..
boot [ARM] nommu: manage the CP15 things 2006-09-27 17:34:30 +01:00
common [ARM] Off-by-one in arch/arm/common/icst* 2006-09-27 23:17:54 +01:00
configs [ARM] 3851/1: iop3xx: add io-data glantank support 2006-09-25 10:34:02 +01:00
kernel Merge nommu branch 2006-09-28 22:20:39 +01:00
lib Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
mach-aaec2000 [PATCH] ARM: fixup irqflags breakage after ARM genirq merge 2006-07-02 17:29:22 -07:00
mach-at91rm9200 [ARM] 3870/1: AT91: Start removing static memory mappings 2006-09-28 18:11:22 +01:00
mach-clps711x [PATCH] ARM: fixup irqflags breakage after ARM genirq merge 2006-07-02 17:29:22 -07:00
mach-clps7500 [PATCH] ARM: fixup irqflags breakage after ARM genirq merge 2006-07-02 17:29:22 -07:00
mach-ebsa110 [PATCH] ARM: fixup irqflags breakage after ARM genirq merge 2006-07-02 17:29:22 -07:00
mach-ep93xx [ARM] 3811/1: ep93xx: add cirrus logic edb9312 support 2006-09-25 10:25:25 +01:00
mach-footbridge [ARM] 3759/2: Remove uses of %? 2006-09-20 14:58:35 +01:00
mach-h720x [PATCH] ARM: fixup irqflags breakage after ARM genirq merge 2006-07-02 17:29:22 -07:00
mach-imx [ARM] 3739/1: genirq updates: irq_chip, add and use irq_chip.name 2006-08-01 22:26:25 +01:00
mach-integrator [ARM] Add Integrator support for glibc outb() and friends 2006-08-28 12:47:05 +01:00
mach-iop32x [ARM] 3851/1: iop3xx: add io-data glantank support 2006-09-25 10:34:02 +01:00
mach-iop33x [ARM] 3832/1: iop3xx: coding style cleanup 2006-09-25 10:25:53 +01:00
mach-ixp4xx [ARM] 3856/1: Add clocksource for Intel IXP4xx platforms 2006-09-28 20:59:25 +01:00
mach-ixp23xx [PATCH] ARM: fixup irqflags breakage after ARM genirq merge 2006-07-02 17:29:22 -07:00
mach-ixp2000 [PATCH] ARM: fixup irqflags breakage after ARM genirq merge 2006-07-02 17:29:22 -07:00
mach-l7200 [ARM] 3684/1: ARM: Convert l7200 to generic irq handling 2006-07-01 22:32:19 +01:00
mach-lh7a40x [ARM] 3739/1: genirq updates: irq_chip, add and use irq_chip.name 2006-08-01 22:26:25 +01:00
mach-netx [PATCH] ARM: fixup irqflags breakage after ARM genirq merge 2006-07-02 17:29:22 -07:00
mach-omap1 ARM: OMAP: Sync clocks with linux-omap tree 2006-09-25 13:27:20 +03:00
mach-omap2 ARM: OMAP: Sync clocks with linux-omap tree 2006-09-25 13:27:20 +03:00
mach-pnx4008 [ARM] 3709/1: pnx4008: convert to generic irq subsystem 2006-07-05 14:47:20 +01:00
mach-pxa USB: pxa2xx_udc understands GPIO based VBUS sensing 2006-09-27 11:58:48 -07:00
mach-realview [PATCH] ARM: fixup irqflags breakage after ARM genirq merge 2006-07-02 17:29:22 -07:00
mach-rpc [PATCH] ARM: fixup irqflags breakage after ARM genirq merge 2006-07-02 17:29:22 -07:00
mach-s3c2410 [ARM] 3873/1: S3C24XX: Add irq_chip names 2006-09-28 20:55:23 +01:00
mach-sa1100 [ARM] 3847/2: Convert LOMOMO to use struct device for GPIOs 2006-09-27 20:58:59 +01:00
mach-shark [ARM] 3739/1: genirq updates: irq_chip, add and use irq_chip.name 2006-08-01 22:26:25 +01:00
mach-versatile [ARM] 3860/1: Versatile PCI config byte accesses 2006-09-27 09:35:07 +01:00
mm [PATCH] make PROT_WRITE imply PROT_READ 2006-09-29 09:18:05 -07:00
nwfpe [ARM] 3729/3: EABI padding rules necessitate the packed attribute of floatx80 2006-07-13 13:04:24 +01:00
oprofile [ARM] 3832/1: iop3xx: coding style cleanup 2006-09-25 10:25:53 +01:00
plat-iop [ARM] 3832/1: iop3xx: coding style cleanup 2006-09-25 10:25:53 +01:00
plat-omap Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-09-28 14:40:39 -07:00
tools [ARM] Update mach-types 2006-09-25 10:32:32 +01:00
vfp [ARM] Cleanups for 4cc9bd2eaa 2006-09-25 10:34:59 +01:00
Kconfig Merge nommu branch 2006-09-28 22:20:39 +01:00
Kconfig-nommu [ARM] nommu: manage the CP15 things 2006-09-27 17:34:30 +01:00
Kconfig.debug [ARM] Trivial typo fixes 2006-06-04 21:22:11 +01:00
Makefile [ARM] nommu: add ARM946E-S core support 2006-09-27 17:39:19 +01:00