powerpc/64s/perf: perf interrupt does not have to get_user_pages to access user memory
read_user_stack_slow that walks user address translation by hand is only required on hash, because a hash fault can not be serviced from "NMI" context (to avoid re-entering the hash code) so the user stack can be mapped into Linux page tables but not accessible by the CPU. Radix MMU mode does not have this restriction. A page fault failure would indicate the page is not accessible via get_user_pages either, so avoid this on radix. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20201111120151.3150658-1-npiggin@gmail.com
This commit is contained in:
parent
fdcfeaba38
commit
987c426320
@ -33,7 +33,7 @@ static inline int __read_user_stack(const void __user *ptr, void *ret,
|
|||||||
|
|
||||||
rc = copy_from_user_nofault(ret, ptr, size);
|
rc = copy_from_user_nofault(ret, ptr, size);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_PPC64) && rc)
|
if (IS_ENABLED(CONFIG_PPC64) && !radix_enabled() && rc)
|
||||||
return read_user_stack_slow(ptr, ret, size);
|
return read_user_stack_slow(ptr, ret, size);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
/*
|
/*
|
||||||
* On 64-bit we don't want to invoke hash_page on user addresses from
|
* On 64-bit we don't want to invoke hash_page on user addresses from
|
||||||
* interrupt context, so if the access faults, we read the page tables
|
* interrupt context, so if the access faults, we read the page tables
|
||||||
* to find which page (if any) is mapped and access it directly.
|
* to find which page (if any) is mapped and access it directly. Radix
|
||||||
|
* has no need for this so it doesn't use read_user_stack_slow.
|
||||||
*/
|
*/
|
||||||
int read_user_stack_slow(const void __user *ptr, void *buf, int nb)
|
int read_user_stack_slow(const void __user *ptr, void *buf, int nb)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user