Subject: [PATCH v3 6/6] arm64: kernel: Add support for Privileged Access Never

From: [email-masked] (James Morse)
Date: Thu, 23 Jul 2015 08:58:26 +0100

On 22/07/15 19:14, Will Deacon wrote:
> On Wed, Jul 22, 2015 at 07:04:54PM +0100, James Morse wrote:
>> On 22/07/15 18:01, Will Deacon wrote:
>>> I've applied your series with the exception of this last one, as it
>>> conflicts with some other patches I have queued for 4.3. Please can you
>>> rebase this against the arm64 "devel" branch? (usually it would be
>>> for-next/core, but I'm holding off stabilising until -rc4 since allmodconfig
>>> build is broken atm).
>>
>> The version of patch 5 "arm64: kernel: Add optional CONFIG_ parameter to
>> ALTERNATIVE()" in your tree has:
>>
>>> [will: removed unused asm macro changes for now to avoid conflicts]
>>
>> Those were used in arch/arm64/lib/clear_user.S and friends.
>> I shall remove the 'CONFIG_ARM64_PAN' from those four asm files - it can be
>> tidied up later.
> 
> Ah, damn, I didn't realise you'd made the ALTERNATIVE macro work for both
> C and asm. The reason I changed it is because I don't know what's best to
> do with the new alternative_if_not macros -- having an enabled argument
> for the _else and _endif variants is really odd.
> 
> I think the options are:
> 
>   (1) Just spit out a NOP (you're current approach)
>   (2) Use #ifdefs at the caller
>   (3) Only have the option for alternative_insn
>   (4) Add the option to all the alternative_ macros
> 
> What do you reckon?

I would go with (1) for now, it only affects four functions, not the
uaccess.h macros, where it would be inlined all over the place.

(4) can be a future optimisation.

James