Re: [PATCH] LoongArch: Fix an issue with relocatable vmlinux
On Fri, Nov 24, 2023 at 04:54:10PM +0800, WANG Rui wrote: > Normally vmlinux for LoongArch is of ET_EXEC type, while if built with > CONFIG_RELOCATABLE (this is PIE) and Clang, it will be of ET_DYN type. > Meanwhile, physical address field of segments in vmlinux has actually > the same value as virtual address field. > > Similar to arm64, this patch allows to unconditionally skip the check > on LoongArch. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1963 > Signed-off-by: WANG Rui Thanks, applied. ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH] LoongArch: Fix an issue with relocatable vmlinux
Reviewed-by: Huacai Chen On Fri, Nov 24, 2023 at 4:54 PM WANG Rui wrote: > > Normally vmlinux for LoongArch is of ET_EXEC type, while if built with > CONFIG_RELOCATABLE (this is PIE) and Clang, it will be of ET_DYN type. > Meanwhile, physical address field of segments in vmlinux has actually > the same value as virtual address field. > > Similar to arm64, this patch allows to unconditionally skip the check > on LoongArch. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1963 > Signed-off-by: WANG Rui > --- > kexec/kexec-elf-exec.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/kexec/kexec-elf-exec.c b/kexec/kexec-elf-exec.c > index bea7b3e..b337642 100644 > --- a/kexec/kexec-elf-exec.c > +++ b/kexec/kexec-elf-exec.c > @@ -39,12 +39,13 @@ static int get_elf_exec_load_base(struct mem_ehdr *ehdr, > struct kexec_info *info > unsigned long first, last; > size_t i; > > - /* Note on arm64: > + /* Note on arm64 and loongarch64: > * arm64's vmlinux has virtual address in physical address > * field of PT_LOAD segments. So the following validity check > * and relocation makes no sense on arm64. > +* This is also applies to LoongArch. > */ > - if (ehdr->e_machine == EM_AARCH64) > + if (ehdr->e_machine == EM_AARCH64 || ehdr->e_machine == EM_LOONGARCH) > return 0; > > first = ULONG_MAX; > -- > 2.43.0 > ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH] LoongArch: Fix an issue with relocatable vmlinux
Normally vmlinux for LoongArch is of ET_EXEC type, while if built with CONFIG_RELOCATABLE (this is PIE) and Clang, it will be of ET_DYN type. Meanwhile, physical address field of segments in vmlinux has actually the same value as virtual address field. Similar to arm64, this patch allows to unconditionally skip the check on LoongArch. Link: https://github.com/ClangBuiltLinux/linux/issues/1963 Signed-off-by: WANG Rui --- kexec/kexec-elf-exec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kexec/kexec-elf-exec.c b/kexec/kexec-elf-exec.c index bea7b3e..b337642 100644 --- a/kexec/kexec-elf-exec.c +++ b/kexec/kexec-elf-exec.c @@ -39,12 +39,13 @@ static int get_elf_exec_load_base(struct mem_ehdr *ehdr, struct kexec_info *info unsigned long first, last; size_t i; - /* Note on arm64: + /* Note on arm64 and loongarch64: * arm64's vmlinux has virtual address in physical address * field of PT_LOAD segments. So the following validity check * and relocation makes no sense on arm64. +* This is also applies to LoongArch. */ - if (ehdr->e_machine == EM_AARCH64) + if (ehdr->e_machine == EM_AARCH64 || ehdr->e_machine == EM_LOONGARCH) return 0; first = ULONG_MAX; -- 2.43.0 ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec