[PATCH 4/7] arm64: kpti: Add ->enable callback to remap swapper using nG mappings

Marc Zyngier marc.zyngier at arm.com
Fri Jan 26 06:23:55 PST 2018


On 26/01/18 14:05, Will Deacon wrote:
> Hi Marc,
> 
> On Fri, Jan 26, 2018 at 01:40:50PM +0000, Marc Zyngier wrote:
>> On 26/01/18 12:03, Will Deacon wrote:
>>> +/*
>>> + * void __kpti_install_ng_mappings(int cpu, int num_cpus, phys_addr_t swapper)
>>> + *
>>> + * Called exactly once from stop_machine context by each CPU found during boot.
>>> + */
>>> +__idmap_kpti_flag:
>>> +	.long	1
>>
>> I'm a bit concerned that we're placing the counter in a section that is
>> not writeable (at least in theory). We can either have the idmap
>> writeable entirely, or have a idmap data section (which means extending
>> it to be more than a single page).
> 
> The idmap is mapped using the same attributes as the initial swapper
> mappings (SWAPPER_MM_MMUFLAGS) but, unlike swapper, it is not subsequently
> remapped and therefore remains writeable.
> 
> I could update the .pushsection flags to reflect this with "awx"?

I think it would at least reflect both the expectations of this code and
what the mapping code does.

> 
> Also, whilst looking around in head.S, I noticed phys_to_pte. I'll move
> that into assembler.h and switch the argument order as a separate patch.
> 
>> Not sure if that's a concern, but I thought I'd raise it. The core works
>> pretty well as is, so  it cannot be completely wrong... ;-)
> 
> Is that a Tested-by? ;)

Since I'm lucky enough to have access to a ThunderX, here's one ;-)
Tested-by: Marc Zyngier <marc.zyngier at arm.com>

Also:
Reviewed-by: Marc Zyngier <marc.zyngier at arm.com>

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...



More information about the linux-arm-kernel mailing list