Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+12 -9
+11 -5
arch/powerpc/include/asm/book3s/64/kup.h
··· 199 199 200 200 #ifdef CONFIG_PPC_PKEY 201 201 202 + extern u64 __ro_after_init default_uamor; 203 + extern u64 __ro_after_init default_amr; 204 + extern u64 __ro_after_init default_iamr; 205 + 202 206 #include <asm/mmu.h> 203 207 #include <asm/ptrace.h> 204 208 205 - /* 206 - * For kernel thread that doesn't have thread.regs return 207 - * default AMR/IAMR values. 209 + /* usage of kthread_use_mm() should inherit the 210 + * AMR value of the operating address space. But, the AMR value is 211 + * thread-specific and we inherit the address space and not thread 212 + * access restrictions. Because of this ignore AMR value when accessing 213 + * userspace via kernel thread. 208 214 */ 209 215 static inline u64 current_thread_amr(void) 210 216 { 211 217 if (current->thread.regs) 212 218 return current->thread.regs->amr; 213 - return AMR_KUAP_BLOCKED; 219 + return default_amr; 214 220 } 215 221 216 222 static inline u64 current_thread_iamr(void) 217 223 { 218 224 if (current->thread.regs) 219 225 return current->thread.regs->iamr; 220 - return AMR_KUEP_BLOCKED; 226 + return default_iamr; 221 227 } 222 228 #endif /* CONFIG_PPC_PKEY */ 223 229
-4
arch/powerpc/include/asm/book3s/64/pkeys.h
··· 5 5 6 6 #include <asm/book3s/64/hash-pkey.h> 7 7 8 - extern u64 __ro_after_init default_uamor; 9 - extern u64 __ro_after_init default_amr; 10 - extern u64 __ro_after_init default_iamr; 11 - 12 8 static inline u64 vmflag_to_pte_pkey_bits(u64 vm_flags) 13 9 { 14 10 if (!mmu_has_feature(MMU_FTR_PKEY))
+1
arch/powerpc/mm/book3s64/pkeys.c
··· 31 31 u64 default_amr __ro_after_init = ~0x0UL; 32 32 u64 default_iamr __ro_after_init = 0x5555555555555555UL; 33 33 u64 default_uamor __ro_after_init; 34 + EXPORT_SYMBOL(default_amr); 34 35 /* 35 36 * Key used to implement PROT_EXEC mmap. Denies READ/WRITE 36 37 * We pick key 2 because 0 is special key and 1 is reserved as per ISA.