Skip to content

Commit

Permalink
sh: Flush executable pages in copy_user_highpage
Browse files Browse the repository at this point in the history
This resolves a problem seen when using the Android dynamic linker.
Sometimes the dynamic linker would seg-fault at start up and this
was eventually traced to the handling of a COW fault for a page which
was being modified by the linker. If there was no cache aliasing between
the kernel and the user page, the page was not flushed, leaving the
newly copied data in the D-cache. However when executing instructions
from that page, the I-cache is filled directly from external memory,
rather than the D-cache, and causing garbage to be executed.

Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Stuart Menefy authored and Paul Mundt committed Feb 15, 2011
1 parent a086536 commit a25bbe1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/sh/mm/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ void copy_user_highpage(struct page *to, struct page *from,
kunmap_atomic(vfrom, KM_USER0);
}

if (pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
if (pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK) ||
(vma->vm_flags & VM_EXEC))
__flush_purge_region(vto, PAGE_SIZE);

kunmap_atomic(vto, KM_USER1);
Expand Down

0 comments on commit a25bbe1

Please sign in to comment.