kup.h (1136fa0c07de570dc17858745af8be169d1440ba) | kup.h (792993919349fefba20f58ae4843c80e8b01f518) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _ASM_POWERPC_BOOK3S_64_KUP_H 3#define _ASM_POWERPC_BOOK3S_64_KUP_H 4 5#include <linux/const.h> 6#include <asm/reg.h> 7 8#define AMR_KUAP_BLOCK_READ UL(0x5455555555555555) --- 314 unchanged lines hidden (view full) --- 323 * so it doesn't break anything. 324 */ 325 if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) 326 return AMR_KUAP_BLOCKED; 327 328 return mfspr(SPRN_AMR); 329} 330 | 1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _ASM_POWERPC_BOOK3S_64_KUP_H 3#define _ASM_POWERPC_BOOK3S_64_KUP_H 4 5#include <linux/const.h> 6#include <asm/reg.h> 7 8#define AMR_KUAP_BLOCK_READ UL(0x5455555555555555) --- 314 unchanged lines hidden (view full) --- 323 * so it doesn't break anything. 324 */ 325 if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) 326 return AMR_KUAP_BLOCKED; 327 328 return mfspr(SPRN_AMR); 329} 330 |
331static inline void set_kuap(unsigned long value) | 331static __always_inline void set_kuap(unsigned long value) |
332{ 333 if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) 334 return; 335 336 /* 337 * ISA v3.0B says we need a CSI (Context Synchronising Instruction) both 338 * before and after the move to AMR. See table 6 on page 1134. 339 */ --- 53 unchanged lines hidden (view full) --- 393static inline void set_kuap(unsigned long value) { } 394 395static __always_inline void allow_user_access(void __user *to, const void __user *from, 396 unsigned long size, unsigned long dir) 397{ } 398 399#endif /* !CONFIG_PPC_KUAP */ 400 | 332{ 333 if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) 334 return; 335 336 /* 337 * ISA v3.0B says we need a CSI (Context Synchronising Instruction) both 338 * before and after the move to AMR. See table 6 on page 1134. 339 */ --- 53 unchanged lines hidden (view full) --- 393static inline void set_kuap(unsigned long value) { } 394 395static __always_inline void allow_user_access(void __user *to, const void __user *from, 396 unsigned long size, unsigned long dir) 397{ } 398 399#endif /* !CONFIG_PPC_KUAP */ 400 |
401static inline void prevent_user_access(unsigned long dir) | 401static __always_inline void prevent_user_access(unsigned long dir) |
402{ 403 set_kuap(AMR_KUAP_BLOCKED); 404 if (static_branch_unlikely(&uaccess_flush_key)) 405 do_uaccess_flush(); 406} 407 408static inline unsigned long prevent_user_access_return(void) 409{ --- 18 unchanged lines hidden --- | 402{ 403 set_kuap(AMR_KUAP_BLOCKED); 404 if (static_branch_unlikely(&uaccess_flush_key)) 405 do_uaccess_flush(); 406} 407 408static inline unsigned long prevent_user_access_return(void) 409{ --- 18 unchanged lines hidden --- |