2021-03-12 20:50:47 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#include <asm/kup.h>
|
2021-06-03 16:41:41 +08:00
|
|
|
#include <asm/smp.h>
|
2021-06-03 16:41:36 +08:00
|
|
|
|
2021-06-03 16:41:42 +08:00
|
|
|
struct static_key_false disable_kuep_key;
|
|
|
|
|
2021-06-28 14:56:11 +08:00
|
|
|
void setup_kuep(bool disabled)
|
2021-06-03 16:41:36 +08:00
|
|
|
{
|
2021-06-03 16:41:42 +08:00
|
|
|
if (!disabled)
|
|
|
|
kuep_lock();
|
2021-06-03 16:41:41 +08:00
|
|
|
|
|
|
|
if (smp_processor_id() != boot_cpuid)
|
|
|
|
return;
|
|
|
|
|
2021-06-03 16:41:36 +08:00
|
|
|
if (disabled)
|
2021-06-03 16:41:42 +08:00
|
|
|
static_branch_enable(&disable_kuep_key);
|
|
|
|
else
|
|
|
|
pr_info("Activating Kernel Userspace Execution Prevention\n");
|
2021-06-03 16:41:36 +08:00
|
|
|
}
|