#ifndef __ASSEMBLY__
+#include <linux/jump_label.h>
+
+extern struct static_key_false disable_kuep_key;
+
static __always_inline bool kuap_is_disabled(void)
{
return !IS_ENABLED(CONFIG_PPC_KUAP);
static __always_inline bool kuep_is_disabled(void)
{
- return !IS_ENABLED(CONFIG_PPC_KUEP);
+ return !IS_ENABLED(CONFIG_PPC_KUEP) || static_branch_unlikely(&disable_kuep_key);
}
static inline void kuep_lock(void)
#include <asm/kup.h>
#include <asm/smp.h>
+struct static_key_false disable_kuep_key;
+
void __init setup_kuep(bool disabled)
{
- kuep_lock();
+ if (!disabled)
+ kuep_lock();
if (smp_processor_id() != boot_cpuid)
return;
- pr_info("Activating Kernel Userspace Execution Prevention\n");
-
if (disabled)
- pr_warn("KUEP cannot be disabled yet on 6xx when compiled in\n");
+ static_branch_enable(&disable_kuep_key);
+ else
+ pr_info("Activating Kernel Userspace Execution Prevention\n");
}