[PATCH] powerpc: Fix __clear_user() with KUAP enabled

Andrew Donnellan ajd at linux.ibm.com
Tue Dec 10 00:21:39 AEDT 2019


On 9/12/19 10:50 pm, Christophe Leroy wrote:
> 
> 
> Le 09/12/2019 à 11:59, Andrew Donnellan a écrit :
>> The KUAP implementation adds calls in clear_user() to enable and disable
>> access to userspace memory. However, it doesn't add these to
>> __clear_user(), which is used in the ptrace regset code.
>>
>> As there's only one direct user of __clear_user(), and the time taken to
>> set the AMR for KUAP purposes is going to dominate the cost of a quick
>> access_ok(), there's not much point having a separate path.
> 
> No risk that access_ok() fails ?
> 

The only user of __clear_user() is the regset code, and 
copy_regset_{to,from}_user() already checks access_ok().

I think ideally we could get rid of __clear_user() completely.

> There is also a call to might_fault() in clear_user(), isn't it a problem ?

I don't think it's a problem, just some lockdep debugging?

-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd at linux.ibm.com             IBM Australia Limited



More information about the Linuxppc-dev mailing list