[PATCH] ARM: Implement copy_to_user_page() for noMMU

Catalin Marinas catalin.marinas at arm.com
Tue Mar 30 05:30:35 EDT 2010


On Tue, 2010-03-30 at 02:31 +0100, Jamie Lokier wrote:
> Catalin Marinas wrote:
> > +void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
> > +                    unsigned long uaddr, void *dst, const void *src,
> > +                    unsigned long len)
> > +{
> > +     memcpy(dst, src, len);
> > +     if (vma->vm_flags & VM_EXEC)
> > +             __cpuc_coherent_user_range(uaddr, uaddr + len);
> > +}
> 
> Does that do the right thing with uaddr + len == 0?

There is a corner case where uaddr + len == 0 and uaddr is at the top of
the 4GB range. Are there such platforms? A workaround is to change the
CPU-specific loop, probably to using BLT rather than BLO.

> Other variations such as writing when a mapping is !VM_EXEC and later
> mapping or mprotecting the same shmem VM_EXEC, but it's even more
> forbidden semantically to write to a read-only mapping (and just as
> unchecked on nommu), and conversion of writable to VM_EXEC ought to
> flush i-cache at mprotect time.

ARM Linux doesn't do any cache maintenance for mprotect on VIPT or noMMU
hardware (not sure about VIVT). We discussed this in the past and it
wasn't clear whether it is required or not.

-- 
Catalin




More information about the linux-arm-kernel mailing list