blob: 901f159c65e658f502239ab02ef4e36f18a5c269 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2022, Oracle and/or its affiliates.
*/
#include <linux/kernel.h>
#include <linux/pgtable.h>
#include <asm/ktext.h>
#include <asm/memory.h>
void __init ktext_replication_init(void)
{
int kidx = pgd_index((phys_addr_t)KERNEL_START);
/*
* If we've messed up and the kernel shares a L0 entry with the
* module or vmalloc area, then don't even attempt to use text
* replication.
*/
if (pgd_index(MODULES_VADDR) == kidx) {
pr_warn("Kernel is located in the same L0 index as modules - text replication disabled\n");
return;
}
if (pgd_index(VMALLOC_START) == kidx) {
pr_warn("Kernel is located in the same L0 index as vmalloc - text replication disabled\n");
return;
}
}
|