[PATCH] arm: add an option for erratum 657417

Ard Biesheuvel ard.biesheuvel at linaro.org
Fri Aug 12 06:49:15 PDT 2016


On 12 August 2016 at 15:15, Nicholas Piggin <npiggin at gmail.com> wrote:
> On Fri, 12 Aug 2016 13:33:14 +0100
> Russell King - ARM Linux <linux at armlinux.org.uk> wrote:
>
>> On Fri, Aug 12, 2016 at 06:19:17PM +1000, Nicholas Piggin wrote:
>> > This patch adds an option which defaults to "y" in cases where we
>> > could possibly be running Cortex A8 and using Thumb2 instructions.
>> > In reality the workaround might not be required at all for the kernel
>> > if virtual instruction memory is linear in physical memory.
>>
>> Hmm.
>>
>> The main kernel image is guaranteed to be contiguous in physical memory
>> for all sorts of reasons, so this really isn't a concern for the kernel
>> itself.
>
> That's what it *seems* like. I wanted to be conservative because I don't
> know the architecture nor have actually looked at the errata docs. You
> can probably make stronger guarantees to avoid it. Perhaps enabling just
> for modules would be workable.
>
>
>> Modules, however, are a different matter, as they are mapped in using
>> individual pages, and are most likely to be non-contiguous in physical
>> memory.  The kernel's module linker knows nothing about this errata,
>> so it'll generally just fix up the relocations in the most basic of
>> ways.
>>
>> So, I think we should always use this --no-fix-cortex-a8 option where
>> the linker supports it irrespective of whether we're running on a core
>> needing this workaround, but we probably need to fix the kernel module
>> linker to know about this.
>
> It looks like it would be a bit of work to go that route. The linker of
> course would not give you relocations or stubs for the branches you
> need them.
>

We could enable CONFIG_ARM_MODULE_PLTS in this case, and force a
branch via a PLT entry if an affected instruction is encountered.
However, this only covers branch instructions that are covered by
relocations, so we'd still need to scan the module .text to look for
affected instructions whose targets has been resolved at compile time.

Running this



More information about the linux-arm-kernel mailing list