* [PATCH 0/2] objtool: fixes for couple of endianness issues which appeared in v5.13-rc1
@ 2021-05-12 17:42 Vasily Gorbik
2021-05-12 17:42 ` [PATCH 1/2] objtool: Fix elf_create_undef_symbol() endianness Vasily Gorbik
2021-05-12 17:42 ` [PATCH 2/2] objtool/x86: Fix elf_add_alternative() endianness Vasily Gorbik
0 siblings, 2 replies; 3+ messages in thread
From: Vasily Gorbik @ 2021-05-12 17:42 UTC (permalink / raw)
To: Peter Zijlstra, Josh Poimboeuf
Cc: Ingo Molnar, Borislav Petkov, Miroslav Benes, linux-kernel
Vasily Gorbik (2):
objtool: Fix elf_create_undef_symbol() endianness
objtool/x86: Fix elf_add_alternative() endianness
tools/objtool/arch/x86/decode.c | 3 ++-
tools/objtool/elf.c | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
--
2.25.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] objtool: Fix elf_create_undef_symbol() endianness
2021-05-12 17:42 [PATCH 0/2] objtool: fixes for couple of endianness issues which appeared in v5.13-rc1 Vasily Gorbik
@ 2021-05-12 17:42 ` Vasily Gorbik
2021-05-12 17:42 ` [PATCH 2/2] objtool/x86: Fix elf_add_alternative() endianness Vasily Gorbik
1 sibling, 0 replies; 3+ messages in thread
From: Vasily Gorbik @ 2021-05-12 17:42 UTC (permalink / raw)
To: Peter Zijlstra, Josh Poimboeuf
Cc: Ingo Molnar, Borislav Petkov, Miroslav Benes, linux-kernel
Currently x86 cross-compilation fails on big endian system with:
x86_64-cross-ld: init/main.o: invalid string offset 488112128 >= 6229
for section `.strtab'
Mark new ELF data in elf_create_undef_symbol() as symbol, so that libelf
does endianness handling correctly.
Fixes: 2f2f7e47f052 ("objtool: Add elf_create_undef_symbol()")
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
---
tools/objtool/elf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index a8a0ee21f71a..4d0d4d7a9aba 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -791,6 +791,7 @@ struct symbol *elf_create_undef_symbol(struct elf *elf, const char *name)
data->d_buf = &sym->sym;
data->d_size = sizeof(sym->sym);
data->d_align = 1;
+ data->d_type = ELF_T_SYM;
sym->idx = symtab->len / sizeof(sym->sym);
--
2.25.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] objtool/x86: Fix elf_add_alternative() endianness
2021-05-12 17:42 [PATCH 0/2] objtool: fixes for couple of endianness issues which appeared in v5.13-rc1 Vasily Gorbik
2021-05-12 17:42 ` [PATCH 1/2] objtool: Fix elf_create_undef_symbol() endianness Vasily Gorbik
@ 2021-05-12 17:42 ` Vasily Gorbik
1 sibling, 0 replies; 3+ messages in thread
From: Vasily Gorbik @ 2021-05-12 17:42 UTC (permalink / raw)
To: Peter Zijlstra, Josh Poimboeuf
Cc: Ingo Molnar, Borislav Petkov, Miroslav Benes, linux-kernel
Currently x86 kernel cross-compiled on big endian system fails at boot with:
kernel BUG at arch/x86/kernel/alternative.c:258!
Corresponding bug condition look like the following:
BUG_ON(feature >= (NCAPINTS + NBUGINTS) * 32);
Fix that by converting alternative feature/cpuid to target endianness.
Fixes: 9bc0bb50727c ("objtool/x86: Rewrite retpoline thunk calls")
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
---
tools/objtool/arch/x86/decode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index cedf3ede7545..24295d39713b 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -19,6 +19,7 @@
#include <objtool/elf.h>
#include <objtool/arch.h>
#include <objtool/warn.h>
+#include <objtool/endianness.h>
#include <arch/elf.h>
static int is_x86_64(const struct elf *elf)
@@ -725,7 +726,7 @@ static int elf_add_alternative(struct elf *elf,
return -1;
}
- alt->cpuid = cpuid;
+ alt->cpuid = bswap_if_needed(cpuid);
alt->instrlen = orig_len;
alt->replacementlen = repl_len;
--
2.25.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-12 19:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 17:42 [PATCH 0/2] objtool: fixes for couple of endianness issues which appeared in v5.13-rc1 Vasily Gorbik
2021-05-12 17:42 ` [PATCH 1/2] objtool: Fix elf_create_undef_symbol() endianness Vasily Gorbik
2021-05-12 17:42 ` [PATCH 2/2] objtool/x86: Fix elf_add_alternative() endianness Vasily Gorbik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).