]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: fix KASLR boot-time I-cache maintenance
authorMark Rutland <mark.rutland@arm.com>
Tue, 15 Mar 2016 11:22:57 +0000 (11:22 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 21 Mar 2016 12:08:50 +0000 (12:08 +0000)
commitc988bb65c9601f87daed9415663d09b8b8158f76
tree5776ae101d27c4eb38dd0a09781a8c6ff284ddbd
parente2b0c61d5746aeb410b2c91efe7c1fc3d278b094
arm64: fix KASLR boot-time I-cache maintenance

Commit 5e08b63d024b48b6 ("arm64: add support for kernel ASLR") missed a
DSB necessary to complete I-cache maintenance in the primary boot path,
and hence stale instructions may still be present in the I-cache and may
be executed until the I-cache maintenance naturally completes.

Since commit a735c912fad3024f ("arm64: mm: ensure patched kernel text is
fetched from PoU"), all CPUs invalidate their I-caches after their MMU
is enabled. Prior a CPU's MMU having been enabled, arbitrary lines may
have been fetched from the PoC into I-caches. We never patch text
expected to be executed with the MMU off. Thus, it is unnecessary to
perform broadcast I-cache maintenance in the primary boot path.

This patch reduces the scope of the I-cache maintenance to the local
CPU, and adds the missing DSB with similar scope, matching prior
maintenance in the primary boot path.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Ard Biesehvuel <ard.biesheuvel@linaro.org>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/head.S