[packages/kexec-tools] - added git fixes for xen and binutils 2.41+

qboosh qboosh at pld-linux.org
Mon Mar 18 19:12:34 CET 2024


commit 186a316b0856707f0038cd752d08486f1202d7b0
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Mon Mar 18 18:51:34 2024 +0100

    - added git fixes for xen and binutils 2.41+

 kexec-tools-git.patch | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++
 kexec-tools.spec      |   2 +
 2 files changed, 154 insertions(+)
---
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 9df6fd9..ce297f5 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -21,6 +21,7 @@ Source1:	kexec.init
 Source2:	kexec.sysconfig
 # from http://patchwork.openembedded.org/patch/90971/raw/ (stripped to remaining syscall part)
 Patch0:		%{name}-x32.patch
+Patch1:		%{name}-git.patch
 URL:		https://www.kernel.org/pub/linux/utils/kernel/kexec/
 BuildRequires:	autoconf >= 2.50
 BuildRequires:	rpmbuild(macros) >= 1.228
@@ -51,6 +52,7 @@ działać na każdej architekturze.
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 
 %build
 %{__autoconf}
diff --git a/kexec-tools-git.patch b/kexec-tools-git.patch
new file mode 100644
index 0000000..be04114
--- /dev/null
+++ b/kexec-tools-git.patch
@@ -0,0 +1,152 @@
+From 94fbe64fb22d61726ca0c0996987574b6c783c19 Mon Sep 17 00:00:00 2001
+From: Jiri Bohac <jbohac at suse.cz>
+Date: Tue, 16 Jan 2024 18:14:31 +0100
+Subject: kexec: don't use kexec_file_load on XEN
+
+Since commit 29fe5067ed07 ("kexec: make -a the default")
+kexec tries the kexec_file_load syscall first and only falls back to kexec_load on
+selected error codes.
+
+This effectively breaks kexec on XEN, unless -c is pecified to force the kexec_load
+syscall.
+
+The XEN-specific functions (xen_kexec_load / xen_kexec_unload) are only called
+from my_load / k_unload, i.e. the kexec_load code path.
+
+With -p (panic kernel) kexec_file_load on XEN fails with -EADDRNOTAVAIL (crash
+kernel reservation is ignored by the kernel on XEN), which is not in the list
+of return codes that cause the fallback to kexec_file.
+
+Without -p kexec_file_load actualy leads to a kernel oops on v6.4.0
+(needs to be dubugged separately).
+
+Signed-off-by: Jiri Bohac <jbohac at suse.cz>
+Fixes: 29fe5067ed07 ("kexec: make -a the default")
+Signed-off-by: Simon Horman <horms at kernel.org>
+---
+ kexec/kexec.8 | 1 +
+ kexec/kexec.c | 4 ++++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/kexec/kexec.8 b/kexec/kexec.8
+index b969cea6..9e995fea 100644
+--- a/kexec/kexec.8
++++ b/kexec/kexec.8
+@@ -162,6 +162,7 @@ Specify that the new kernel is of this
+ .TP
+ .BI \-s\ (\-\-kexec-file-syscall)
+ Specify that the new KEXEC_FILE_LOAD syscall should be used exclusively.
++Ignored on XEN.
+ .TP
+ .BI \-c\ (\-\-kexec-syscall)
+ Specify that the old KEXEC_LOAD syscall should be used exclusively.
+diff --git a/kexec/kexec.c b/kexec/kexec.c
+index 08edfca2..9d0ec46e 100644
+--- a/kexec/kexec.c
++++ b/kexec/kexec.c
+@@ -1685,6 +1685,10 @@ int main(int argc, char *argv[])
+ 			}
+ 		}
+ 	}
++	if (xen_present()) {
++		do_kexec_file_syscall = 0;
++		do_kexec_fallback = 0;
++	}
+ 	if (do_kexec_file_syscall) {
+ 		if (do_load_jump_back_helper && !do_kexec_fallback)
+ 			die("--load-jump-back-helper not supported with kexec_file_load\n");
+-- 
+cgit 1.2.3-korg
+
+From 328de8e00e298f00d7ba6b25dc3950147e9642e6 Mon Sep 17 00:00:00 2001
+From: Michel Lind <salimma at fedoraproject.org>
+Date: Tue, 30 Jan 2024 04:14:31 -0600
+Subject: Fix building on x86_64 with binutils 2.41
+
+Newer versions of the GNU assembler (observed with binutils 2.41) will
+complain about the ".arch i386" in files assembled with "as --64",
+with the message "Error: 64bit mode not supported on 'i386'".
+
+Fix by moving ".arch i386" below the relevant ".code32" directive, so
+that the assembler is no longer expecting 64-bit instructions to be used
+by the time that the ".arch i386" directive is encountered.
+
+Based on similar iPXE fix:
+https://github.com/ipxe/ipxe/commit/6ca597eee
+
+Signed-off-by: Michel Lind <michel at michel-slm.name>
+Signed-off-by: Simon Horman <horms at kernel.org>
+---
+ purgatory/arch/i386/entry32-16-debug.S | 2 +-
+ purgatory/arch/i386/entry32-16.S       | 2 +-
+ purgatory/arch/i386/entry32.S          | 2 +-
+ purgatory/arch/i386/setup-x86.S        | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/purgatory/arch/i386/entry32-16-debug.S b/purgatory/arch/i386/entry32-16-debug.S
+index 5167944d..12e11649 100644
+--- a/purgatory/arch/i386/entry32-16-debug.S
++++ b/purgatory/arch/i386/entry32-16-debug.S
+@@ -25,10 +25,10 @@
+ 	.globl entry16_debug_pre32
+ 	.globl entry16_debug_first32
+ 	.globl entry16_debug_old_first32
+-	.arch i386
+ 	.balign 16
+ entry16_debug:
+ 	.code32
++	.arch i386
+ 	/* Compute where I am running at (assumes esp valid) */
+ 	call	1f
+ 1:	popl	%ebx
+diff --git a/purgatory/arch/i386/entry32-16.S b/purgatory/arch/i386/entry32-16.S
+index c051aab0..eace0958 100644
+--- a/purgatory/arch/i386/entry32-16.S
++++ b/purgatory/arch/i386/entry32-16.S
+@@ -20,10 +20,10 @@
+ #undef i386	
+ 	.text
+ 	.globl entry16, entry16_regs
+-	.arch i386
+ 	.balign 16
+ entry16:
+ 	.code32
++	.arch i386
+ 	/* Compute where I am running at (assumes esp valid) */
+ 	call	1f
+ 1:	popl	%ebx
+diff --git a/purgatory/arch/i386/entry32.S b/purgatory/arch/i386/entry32.S
+index f7a494f1..8ce9e316 100644
+--- a/purgatory/arch/i386/entry32.S
++++ b/purgatory/arch/i386/entry32.S
+@@ -20,10 +20,10 @@
+ #undef i386
+ 
+ 	.text
+-	.arch	i386
+ 	.globl entry32, entry32_regs
+ entry32:
+ 	.code32
++	.arch	i386
+ 
+ 	/* Setup a gdt that should that is generally usefully */
+ 	lgdt	%cs:gdt
+diff --git a/purgatory/arch/i386/setup-x86.S b/purgatory/arch/i386/setup-x86.S
+index 201bb2cb..a212eed4 100644
+--- a/purgatory/arch/i386/setup-x86.S
++++ b/purgatory/arch/i386/setup-x86.S
+@@ -21,10 +21,10 @@
+ #undef i386
+ 
+ 	.text
+-	.arch	i386
+ 	.globl purgatory_start
+ purgatory_start:
+ 	.code32
++	.arch	i386
+ 
+ 	/* Load a gdt so I know what the segment registers are */
+ 	lgdt	%cs:gdt
+-- 
+cgit 1.2.3-korg
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kexec-tools.git/commitdiff/186a316b0856707f0038cd752d08486f1202d7b0



More information about the pld-cvs-commit mailing list