1
Hi all,
1
Hi all,
2
2
3
Today's linux-next merge of the kvm-arm tree got a conflict in:
3
Today's linux-next merge of the kvm-arm tree got a conflict in:
4
4
5
arch/arm64/kvm/hypercalls.c
5
arch/arm64/kernel/kaslr.c
6
6
7
between commit:
7
between commit:
8
8
9
d2c173acbf93 ("KVM: arm64: expose SMCCC_ARCH_WORKAROUND_4 to guests")
9
6e13b6b923b3 ("arm64: kaslr: split kaslr/module initialization")
10
e46b7103aef3 ("arm64: module: move module randomization to module.c")
10
11
11
from the arm64 tree and commit:
12
from the arm64 tree and commit:
12
13
13
c0000e58c74e ("KVM: arm64: Introduce KVM_REG_ARM_VENDOR_HYP_BMAP_2")
14
0ddc312b7c73 ("arm64: Turn kaslr_feature_override into a generic SW feature override")
14
15
15
from the kvm-arm tree.
16
from the kvm-arm tree.
16
17
17
I fixed it up (see below) and can carry the fix as necessary. This
18
I fixed it up (see below) and can carry the fix as necessary. This is
18
is now fixed as far as linux-next is concerned, but any non trivial
19
now fixed as far as linux-next is concerned, but any non trivial
19
conflicts should be mentioned to your upstream maintainer when your tree
20
conflicts should be mentioned to your upstream maintainer when your
20
is submitted for merging. You may also want to consider cooperating
21
tree is submitted for merging. You may also want to consider
21
with the maintainer of the conflicting tree to minimise any particularly
22
cooperating with the maintainer of the conflicting tree to minimise any
22
complex conflicts.
23
particularly complex conflicts.
23
24
24
--
25
--
25
Cheers,
26
Cheers,
26
Stephen Rothwell
27
Stephen Rothwell
27
28
28
diff --cc arch/arm64/kvm/hypercalls.c
29
diff --cc arch/arm64/kernel/kaslr.c
29
index 876e6f29a73e,569941eeb3fe..000000000000
30
index 17f96a19781d,5d4ce7f5f157..000000000000
30
--- a/arch/arm64/kvm/hypercalls.c
31
--- a/arch/arm64/kernel/kaslr.c
31
+++ b/arch/arm64/kvm/hypercalls.c
32
+++ b/arch/arm64/kernel/kaslr.c
32
@@@ -397,7 -391,7 +401,8 @@@ static const u64 kvm_arm_fw_reg_ids[]
33
@@@ -4,33 -4,46 +4,33 @@@
33
    KVM_REG_ARM_STD_BMAP,
34
*/
34
    KVM_REG_ARM_STD_HYP_BMAP,
35
    KVM_REG_ARM_VENDOR_HYP_BMAP,
36
+     KVM_REG_ARM_VENDOR_HYP_BMAP_2,
37
+    KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_4,
38
};
39
35
40
void kvm_arm_init_hypercalls(struct kvm *kvm)
36
#include <linux/cache.h>
37
-#include <linux/crc32.h>
38
#include <linux/init.h>
39
-#include <linux/libfdt.h>
40
-#include <linux/mm_types.h>
41
-#include <linux/sched.h>
42
-#include <linux/types.h>
43
-#include <linux/pgtable.h>
44
-#include <linux/random.h>
45
+#include <linux/printk.h>
46
47
-#include <asm/fixmap.h>
48
-#include <asm/kernel-pgtable.h>
49
+#include <asm/cpufeature.h>
50
#include <asm/memory.h>
51
-#include <asm/mmu.h>
52
-#include <asm/sections.h>
53
-#include <asm/setup.h>
54
55
-u64 __ro_after_init module_alloc_base;
56
u16 __initdata memstart_offset_seed;
57
58
- struct arm64_ftr_override kaslr_feature_override __initdata;
59
-
60
-static int __init kaslr_init(void)
61
+bool __ro_after_init __kaslr_is_enabled = false;
62
+
63
+void __init kaslr_init(void)
64
{
65
-     if (kaslr_feature_override.val & kaslr_feature_override.mask & 0xf) {
66
-    u64 module_range;
67
-    u32 seed;
68
-
69
-    /*
70
-     * Set a reasonable default for module_alloc_base in case
71
-     * we end up running with module randomization disabled.
72
-     */
73
-    module_alloc_base = (u64)_etext - MODULES_VSIZE;
74
-
75
+     if (cpuid_feature_extract_unsigned_field(arm64_sw_feature_override.val &
76
+                          arm64_sw_feature_override.mask,
77
+                          ARM64_SW_FEATURE_OVERRIDE_NOKASLR)) {
78
        pr_info("KASLR disabled on command line\n");
79
-        return 0;
80
+        return;
81
    }
82
83
-    if (!kaslr_enabled()) {
84
+    /*
85
+     * The KASLR offset modulo MIN_KIMG_ALIGN is taken from the physical
86
+     * placement of the image rather than from the seed, so a displacement
87
+     * of less than MIN_KIMG_ALIGN means that no seed was provided.
88
+     */
89
+    if (kaslr_offset() < MIN_KIMG_ALIGN) {
90
        pr_warn("KASLR disabled due to lack of seed\n");
91
-        return 0;
92
+        return;
93
    }
94
95
    pr_info("KASLR enabled\n");
diff view generated by jsdifflib