]>
Commit | Line | Data |
---|---|---|
186a316b JB |
1 | From 94fbe64fb22d61726ca0c0996987574b6c783c19 Mon Sep 17 00:00:00 2001 |
2 | From: Jiri Bohac <jbohac@suse.cz> | |
3 | Date: Tue, 16 Jan 2024 18:14:31 +0100 | |
4 | Subject: kexec: don't use kexec_file_load on XEN | |
5 | ||
6 | Since commit 29fe5067ed07 ("kexec: make -a the default") | |
7 | kexec tries the kexec_file_load syscall first and only falls back to kexec_load on | |
8 | selected error codes. | |
9 | ||
10 | This effectively breaks kexec on XEN, unless -c is pecified to force the kexec_load | |
11 | syscall. | |
12 | ||
13 | The XEN-specific functions (xen_kexec_load / xen_kexec_unload) are only called | |
14 | from my_load / k_unload, i.e. the kexec_load code path. | |
15 | ||
16 | With -p (panic kernel) kexec_file_load on XEN fails with -EADDRNOTAVAIL (crash | |
17 | kernel reservation is ignored by the kernel on XEN), which is not in the list | |
18 | of return codes that cause the fallback to kexec_file. | |
19 | ||
20 | Without -p kexec_file_load actualy leads to a kernel oops on v6.4.0 | |
21 | (needs to be dubugged separately). | |
22 | ||
23 | Signed-off-by: Jiri Bohac <jbohac@suse.cz> | |
24 | Fixes: 29fe5067ed07 ("kexec: make -a the default") | |
25 | Signed-off-by: Simon Horman <horms@kernel.org> | |
26 | --- | |
27 | kexec/kexec.8 | 1 + | |
28 | kexec/kexec.c | 4 ++++ | |
29 | 2 files changed, 5 insertions(+) | |
30 | ||
31 | diff --git a/kexec/kexec.8 b/kexec/kexec.8 | |
32 | index b969cea6..9e995fea 100644 | |
33 | --- a/kexec/kexec.8 | |
34 | +++ b/kexec/kexec.8 | |
35 | @@ -162,6 +162,7 @@ Specify that the new kernel is of this | |
36 | .TP | |
37 | .BI \-s\ (\-\-kexec-file-syscall) | |
38 | Specify that the new KEXEC_FILE_LOAD syscall should be used exclusively. | |
39 | +Ignored on XEN. | |
40 | .TP | |
41 | .BI \-c\ (\-\-kexec-syscall) | |
42 | Specify that the old KEXEC_LOAD syscall should be used exclusively. | |
43 | diff --git a/kexec/kexec.c b/kexec/kexec.c | |
44 | index 08edfca2..9d0ec46e 100644 | |
45 | --- a/kexec/kexec.c | |
46 | +++ b/kexec/kexec.c | |
47 | @@ -1685,6 +1685,10 @@ int main(int argc, char *argv[]) | |
48 | } | |
49 | } | |
50 | } | |
51 | + if (xen_present()) { | |
52 | + do_kexec_file_syscall = 0; | |
53 | + do_kexec_fallback = 0; | |
54 | + } | |
55 | if (do_kexec_file_syscall) { | |
56 | if (do_load_jump_back_helper && !do_kexec_fallback) | |
57 | die("--load-jump-back-helper not supported with kexec_file_load\n"); | |
58 | -- | |
59 | cgit 1.2.3-korg | |
60 | ||
61 | From 328de8e00e298f00d7ba6b25dc3950147e9642e6 Mon Sep 17 00:00:00 2001 | |
62 | From: Michel Lind <salimma@fedoraproject.org> | |
63 | Date: Tue, 30 Jan 2024 04:14:31 -0600 | |
64 | Subject: Fix building on x86_64 with binutils 2.41 | |
65 | ||
66 | Newer versions of the GNU assembler (observed with binutils 2.41) will | |
67 | complain about the ".arch i386" in files assembled with "as --64", | |
68 | with the message "Error: 64bit mode not supported on 'i386'". | |
69 | ||
70 | Fix by moving ".arch i386" below the relevant ".code32" directive, so | |
71 | that the assembler is no longer expecting 64-bit instructions to be used | |
72 | by the time that the ".arch i386" directive is encountered. | |
73 | ||
74 | Based on similar iPXE fix: | |
75 | https://github.com/ipxe/ipxe/commit/6ca597eee | |
76 | ||
77 | Signed-off-by: Michel Lind <michel@michel-slm.name> | |
78 | Signed-off-by: Simon Horman <horms@kernel.org> | |
79 | --- | |
80 | purgatory/arch/i386/entry32-16-debug.S | 2 +- | |
81 | purgatory/arch/i386/entry32-16.S | 2 +- | |
82 | purgatory/arch/i386/entry32.S | 2 +- | |
83 | purgatory/arch/i386/setup-x86.S | 2 +- | |
84 | 4 files changed, 4 insertions(+), 4 deletions(-) | |
85 | ||
86 | diff --git a/purgatory/arch/i386/entry32-16-debug.S b/purgatory/arch/i386/entry32-16-debug.S | |
87 | index 5167944d..12e11649 100644 | |
88 | --- a/purgatory/arch/i386/entry32-16-debug.S | |
89 | +++ b/purgatory/arch/i386/entry32-16-debug.S | |
90 | @@ -25,10 +25,10 @@ | |
91 | .globl entry16_debug_pre32 | |
92 | .globl entry16_debug_first32 | |
93 | .globl entry16_debug_old_first32 | |
94 | - .arch i386 | |
95 | .balign 16 | |
96 | entry16_debug: | |
97 | .code32 | |
98 | + .arch i386 | |
99 | /* Compute where I am running at (assumes esp valid) */ | |
100 | call 1f | |
101 | 1: popl %ebx | |
102 | diff --git a/purgatory/arch/i386/entry32-16.S b/purgatory/arch/i386/entry32-16.S | |
103 | index c051aab0..eace0958 100644 | |
104 | --- a/purgatory/arch/i386/entry32-16.S | |
105 | +++ b/purgatory/arch/i386/entry32-16.S | |
106 | @@ -20,10 +20,10 @@ | |
107 | #undef i386 | |
108 | .text | |
109 | .globl entry16, entry16_regs | |
110 | - .arch i386 | |
111 | .balign 16 | |
112 | entry16: | |
113 | .code32 | |
114 | + .arch i386 | |
115 | /* Compute where I am running at (assumes esp valid) */ | |
116 | call 1f | |
117 | 1: popl %ebx | |
118 | diff --git a/purgatory/arch/i386/entry32.S b/purgatory/arch/i386/entry32.S | |
119 | index f7a494f1..8ce9e316 100644 | |
120 | --- a/purgatory/arch/i386/entry32.S | |
121 | +++ b/purgatory/arch/i386/entry32.S | |
122 | @@ -20,10 +20,10 @@ | |
123 | #undef i386 | |
124 | ||
125 | .text | |
126 | - .arch i386 | |
127 | .globl entry32, entry32_regs | |
128 | entry32: | |
129 | .code32 | |
130 | + .arch i386 | |
131 | ||
132 | /* Setup a gdt that should that is generally usefully */ | |
133 | lgdt %cs:gdt | |
134 | diff --git a/purgatory/arch/i386/setup-x86.S b/purgatory/arch/i386/setup-x86.S | |
135 | index 201bb2cb..a212eed4 100644 | |
136 | --- a/purgatory/arch/i386/setup-x86.S | |
137 | +++ b/purgatory/arch/i386/setup-x86.S | |
138 | @@ -21,10 +21,10 @@ | |
139 | #undef i386 | |
140 | ||
141 | .text | |
142 | - .arch i386 | |
143 | .globl purgatory_start | |
144 | purgatory_start: | |
145 | .code32 | |
146 | + .arch i386 | |
147 | ||
148 | /* Load a gdt so I know what the segment registers are */ | |
149 | lgdt %cs:gdt | |
150 | -- | |
151 | cgit 1.2.3-korg | |
152 |