kup.h (8e560921b58cbc18e192f0ac273d307a37a144f9) kup.h (48a8ab4eeb8271f2a0e2ca3cf80844a59acca153)
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(0x4000000000000000)

--- 163 unchanged lines hidden (view full) ---

172
173DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
174
175#ifdef CONFIG_PPC_PKEY
176
177#include <asm/mmu.h>
178#include <asm/ptrace.h>
179
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(0x4000000000000000)

--- 163 unchanged lines hidden (view full) ---

172
173DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
174
175#ifdef CONFIG_PPC_PKEY
176
177#include <asm/mmu.h>
178#include <asm/ptrace.h>
179
180/*
181 * For kernel thread that doesn't have thread.regs return
182 * default AMR/IAMR values.
183 */
184static inline u64 current_thread_amr(void)
185{
186 if (current->thread.regs)
187 return current->thread.regs->amr;
188 return AMR_KUAP_BLOCKED;
189}
190
191static inline u64 current_thread_iamr(void)
192{
193 if (current->thread.regs)
194 return current->thread.regs->iamr;
195 return AMR_KUEP_BLOCKED;
196}
197#endif /* CONFIG_PPC_PKEY */
198
199#ifdef CONFIG_PPC_KUAP
200
180static inline void kuap_user_restore(struct pt_regs *regs)
181{
182 if (!mmu_has_feature(MMU_FTR_PKEY))
183 return;
184
185 isync();
186 mtspr(SPRN_AMR, regs->amr);
187 mtspr(SPRN_IAMR, regs->iamr);

--- 163 unchanged lines hidden ---
201static inline void kuap_user_restore(struct pt_regs *regs)
202{
203 if (!mmu_has_feature(MMU_FTR_PKEY))
204 return;
205
206 isync();
207 mtspr(SPRN_AMR, regs->amr);
208 mtspr(SPRN_IAMR, regs->iamr);

--- 163 unchanged lines hidden ---