mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
powerpc fixes for 5.11 #8
One fix for a regression seen in io_uring, introduced by our support for KUAP (Kernel User Access Prevention) with the Hash MMU. Thanks to: Aneesh Kumar K.V, Zorro Lang. -----BEGIN PGP SIGNATURE----- iQJHBAABCAAxFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmAlIXsTHG1wZUBlbGxl cm1hbi5pZC5hdQAKCRBR6+o8yOGlgBemD/4pl6wsnmPnoxAKSL1jeJ6XXDOeBRJF gCk6/NgnH7YUOrQcHhme6Rbs9CMaitidw8tqRwexyjs2AmcAF8lelqsRJHcFPgWt AYGR0sb00ThI5iMo4heZKMQ/swmHikhZRnH+bx9+fHFgIVoLLCU9bsATSzAM3RXM +s+bVn8S4dYFx8imC4tYmki2FpZAUzcWhEMP6gTfHoUeP7+GIybDcERBbVoQfBGj Gqq0nnJxjgXCs9yY/11QevQhqqbeKIyXLvRqm09wGWQacJGti2dd2X5hBWGUeNa1 SMx7ZpnfpGqLudyJBA6XUUBtfbuLZANTJe7CAtYtaYZJ3u75Wd+I5UaHypI+LibC WvaUC89C/y9DDlhyZqntqiiaYPxvNQxauhbjX4MBJdCXaAZB3GpzqaDCkXB3WUSN yXlx9hJpFmmumWelWqiuLTdtfMuehj9okLvQ7OSBI5ueQdoxrYw2jeGJPsj3+Zrq okeMgrDpx3yq4AmcLkTppcYkqT9OJ59A52vk1rCMev0kz44o0sjF0ebiHNpoXZe+ mVRF9RbxYYYCd2YojOqpLm3nQmx0TbB2DSSmE+tkzMS7BZ/ERBtvqzJ0EGmc6af/ zc+K1JoWAMLrAqYX5BgKptVRh9NPcEL08cS6ZrLLXZDYkpcUQAeiVN5aIvc8wamH iCwIf5hSyKeQ9g== =iXnC -----END PGP SIGNATURE----- Merge tag 'powerpc-5.11-8' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux Pull powerpc fix from Michael Ellerman: "One fix for a regression seen in io_uring, introduced by our support for KUAP (Kernel User Access Prevention) with the Hash MMU. Thanks to Aneesh Kumar K.V, and Zorro Lang" * tag 'powerpc-5.11-8' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/kuap: Allow kernel thread to access userspace after kthread_use_mm
This commit is contained in:
commit
dcc0b49040
@ -199,25 +199,31 @@ DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
|
||||
|
||||
#ifdef CONFIG_PPC_PKEY
|
||||
|
||||
extern u64 __ro_after_init default_uamor;
|
||||
extern u64 __ro_after_init default_amr;
|
||||
extern u64 __ro_after_init default_iamr;
|
||||
|
||||
#include <asm/mmu.h>
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
/*
|
||||
* For kernel thread that doesn't have thread.regs return
|
||||
* default AMR/IAMR values.
|
||||
/* usage of kthread_use_mm() should inherit the
|
||||
* AMR value of the operating address space. But, the AMR value is
|
||||
* thread-specific and we inherit the address space and not thread
|
||||
* access restrictions. Because of this ignore AMR value when accessing
|
||||
* userspace via kernel thread.
|
||||
*/
|
||||
static inline u64 current_thread_amr(void)
|
||||
{
|
||||
if (current->thread.regs)
|
||||
return current->thread.regs->amr;
|
||||
return AMR_KUAP_BLOCKED;
|
||||
return default_amr;
|
||||
}
|
||||
|
||||
static inline u64 current_thread_iamr(void)
|
||||
{
|
||||
if (current->thread.regs)
|
||||
return current->thread.regs->iamr;
|
||||
return AMR_KUEP_BLOCKED;
|
||||
return default_iamr;
|
||||
}
|
||||
#endif /* CONFIG_PPC_PKEY */
|
||||
|
||||
|
@ -5,10 +5,6 @@
|
||||
|
||||
#include <asm/book3s/64/hash-pkey.h>
|
||||
|
||||
extern u64 __ro_after_init default_uamor;
|
||||
extern u64 __ro_after_init default_amr;
|
||||
extern u64 __ro_after_init default_iamr;
|
||||
|
||||
static inline u64 vmflag_to_pte_pkey_bits(u64 vm_flags)
|
||||
{
|
||||
if (!mmu_has_feature(MMU_FTR_PKEY))
|
||||
|
@ -31,6 +31,7 @@ static u32 initial_allocation_mask __ro_after_init;
|
||||
u64 default_amr __ro_after_init = ~0x0UL;
|
||||
u64 default_iamr __ro_after_init = 0x5555555555555555UL;
|
||||
u64 default_uamor __ro_after_init;
|
||||
EXPORT_SYMBOL(default_amr);
|
||||
/*
|
||||
* Key used to implement PROT_EXEC mmap. Denies READ/WRITE
|
||||
* We pick key 2 because 0 is special key and 1 is reserved as per ISA.
|
||||
|
Loading…
Reference in New Issue
Block a user