1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * This file contains the routines for initializing kernel userspace protection 4 */ 5 6 #include <linux/export.h> 7 #include <linux/init.h> 8 #include <linux/printk.h> 9 #include <linux/smp.h> 10 11 #include <asm/kup.h> 12 #include <asm/smp.h> 13 14 #ifdef CONFIG_PPC_KUAP setup_kuap(bool disabled)15void setup_kuap(bool disabled) 16 { 17 if (disabled) { 18 if (smp_processor_id() == boot_cpuid) 19 cur_cpu_spec->mmu_features &= ~MMU_FTR_KUAP; 20 return; 21 } 22 23 pr_info("Activating Kernel Userspace Access Protection\n"); 24 25 prevent_user_access(KUAP_READ_WRITE); 26 } 27 #endif 28