Kernel related (?) user space crash at ARM11 MPCore

Catalin Marinas catalin.marinas at
Mon Sep 21 06:08:53 EDT 2009

On Mon, 2009-09-21 at 10:41 +0100, Jamie Lokier wrote:
>   - Whether sys_cacheflush is necessary when doing mprotect RW->RX
>     after writing new code, or does the mprotect imply it (I presume
>     _mmap_ always does);

mmap() doesn't do this as it doesn't map the pages itself. The pages are
mapped later during fault processing and it's the
flush_dcache_page/update_mmu_cache combination that takes care of the
D-cache cleaning and I-cache invalidation.

IMHO, mprotect(RX) should do the flushing but let's see Russell's
opinion (that's what my patch proposes).

>   - If a kernel bug has been uncovered which makes sys_cacheflush
>     insufficient for that in some obscure case under discussion with
>     COW pages;

sys_cacheflush isn't insufficient with write-allocate caches, it's only
that the dynamic linker doesn't use it (since it's only writing data but
in a text page).

>   - Whether it is necessary if only the data words in a code+data
>     page are modified (similar to ELF PLT updates), in principle, and

IMHO, no.

>   - If the above answer is no, with only the data words written, the
>     bug under discussion, is sys_cacheflush necessary to work with
>     unfixed kernels?

sys_cacheflush would work around the problem but distributions,
including Debian and Ubuntu, are affected and the dynamic linker would
need to be fixed (for such filesystems it's easier to push a kernel fix
than a toolchain one).


More information about the linux-arm-kernel mailing list