1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __ASM_MMAN_H__ 3 #define __ASM_MMAN_H__ 4 5 #include <linux/compiler.h> 6 #include <linux/types.h> 7 #include <linux/mm.h> 8 #include <uapi/asm/mman.h> 9 10 static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, 11 unsigned long pkey __always_unused) 12 { 13 unsigned long ret = 0; 14 15 /* 16 * If PROT_WRITE was specified, force it to VM_READ | VM_WRITE. 17 * Only VM_WRITE means shadow stack. 18 */ 19 if (prot & PROT_WRITE) 20 ret = (VM_READ | VM_WRITE); 21 return ret; 22 } 23 24 #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey) 25 26 #endif /* ! __ASM_MMAN_H__ */ 27