Getting biarch support
Subsystems (2)
cover Getting biarch support
It looks like no one ever tested taking a crashdump from a 64bit kernel with a 32bit userspace on x86, and we have a reuse-cmdline regression fixes follow.
Eric
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/3 Refix concat_cmdline
When removing the potential leak the logic was flipped which mean we never reached the case for handling when both parameters were set.
--- kexec/kexec.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kexec/kexec.c +2 -2
@@ -1007,9 +1007,9 @@ char *concat_cmdline(const char *base, const char *append)char *cmdline;if (!base && !append)return NULL ; -if (append) +if (append && !base)return xstrdup (append); -if (base) +if (base && !append)return xstrdup (base); cmdline =xmalloc (strlen (base) +1 +strlen (append) +1 );strcpy (cmdline, base);
Signature · 7 lines
1.6.6.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 4 lines · Eric W. Biederman
It looks like no one ever tested taking a crashdump from a 64bit kernel with a 32bit userspace on x86, and we have a reuse-cmdline regression fixes follow.
I seem to recall testing that, but it was many moons ago :-)
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/3 kexec: Figure out our native architecture before load
In reply to Eric W. BiedermanThis moves the computing of our native archtecture earlier so that load can use it, as arch/i386/crashdump-x86.c has been trying to.
--- kexec/kexec.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
kexec/kexec.c +7 -5
@@ -695,17 +695,19 @@ static int my_load(const char *type, int fileind, int argc, char **argv, } } } +/* Figure out our native architecture before load */ + native_arch =physical_arch (); +if (native_arch <0 ) { +return -1 ; + } + info.kexec_flags |= native_arch; +if (file_type[i].load (argc, argv, kernel_buf, kernel_size, &info) <0 ) {fprintf (stderr,"Cannot load %s\n" , kernel);return -1 ; }/* If we are not in native mode setup an appropriate trampoline */ - native_arch =physical_arch (); -if (native_arch <0 ) { -return -1 ; - } - info.kexec_flags |= native_arch;if (arch_compat_trampoline (&info) <0 ) {return -1 ; }
Signature · 7 lines
1.6.6.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 3/3 x86: Fix biarch crashdump setup.
In reply to Eric W. BiedermanGenerate the correct crashdump header for x86_64 kernels when a 32bit kernel is used.
--- kexec/arch/i386/crashdump-x86.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
kexec/arch/i386/crashdump-x86.c +10 -1
@@ -509,7 +509,7 @@ static struct crash_elf_info elf_info32 =static enum coretype get_core_type (struct kexec_info *info,struct memory_range *range,int ranges) { -if (info->kexec_flags &KEXEC_ARCH_X86_64 ) +if ((info->kexec_flags &KEXEC_ARCH_MASK ) ==KEXEC_ARCH_X86_64 )return CORE_TYPE_ELF64 ;else {/* fall back to default */
@@ -534,6 +534,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,unsigned long sz, elfcorehdr;int nr_ranges, align =1024 ;struct memory_range *mem_range, *memmap_p; +unsigned machine;if (get_crash_memory_ranges (&mem_range, &nr_ranges, info->kexec_flags) <0 )
@@ -548,6 +549,12 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,get_core_type (info, mem_range, nr_ranges); } +/* Get the elf architecture of the running kernel */ + machine =EM_386 ; +if ((info->kexec_flags &KEXEC_ARCH_MASK ) ==KEXEC_ARCH_X86_64 ) { + machine =EM_X86_64 ; + } +/* Memory regions which panic kernel can safely use to boot into */ sz = (sizeof (struct memory_range ) * (KEXEC_MAX_SEGMENTS +1 )); memmap_p =xmalloc (sz);
@@ -571,6 +578,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,/* Create elf header segment and store crash image data. */ if (arch_options.core_header_type ==CORE_TYPE_ELF64 ) { + elf_info64.machine = machine; if (crash_create_elf64_headers(info, &elf_info64, crash_memory_range, nr_ranges, &tmp, &sz,
@@ -578,6 +586,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,return -1 ; }else { + elf_info32.machine = machine; if (crash_create_elf32_headers(info, &elf_info32, crash_memory_range, nr_ranges, &tmp, &sz,
Signature · 7 lines
1.6.6.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Zitat von "Eric W. Biederman" <[email protected]>:
Quoted 4 lines
It looks like no one ever tested taking a crashdump from a 64bit kernel with a 32bit userspace on x86, and we have a reuse-cmdline regression fixes follow.
I didn't even know that it is supposed to work...
Regards,
Bernhard
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 8 lines · Bernhard Walle
Zitat von "Eric W. Biederman" <[email protected]>:
Quoted 4 lines
It looks like no one ever tested taking a crashdump from a 64bit kernel with a 32bit userspace on x86, and we have a reuse-cmdline regression fixes follow.
I didn't even know that it is supposed to work...
The x86 biarch tends to be an after thought. But we have to do the hard work for all of the architectures where the optimal configuration is 32bit userspace with a 64bit kernel. So we might as well have it work on x86 so we can test the code without need an exotic architecture.
In my case it was purely code size savings on an embedded setup that got me using, and thus fixing it.
Eric
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 4 lines · Eric W. Biederman
It looks like no one ever tested taking a crashdump from a 64bit kernel with a 32bit userspace on x86, and we have a reuse-cmdline regression fixes follow.
Thanks, these patches all look good to me. I have applied and pushed them.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec