提交 fcba63c4 编写于 作者: L Linus Torvalds 提交者: Zheng Zengkai

objtool: print out the symbol type when complaining about it

stable inclusion
from stable-v5.10.133
commit e7118a25a87f6b456c70f6a216b1b5042709cee7
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5PTAS
CVE: CVE-2022-29900,CVE-2022-23816,CVE-2022-29901

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e7118a25a87f6b456c70f6a216b1b5042709cee7

--------------------------------

commit 7fab1c12 upstream.

The objtool warning that the kvm instruction emulation code triggered
wasn't very useful:

    arch/x86/kvm/emulate.o: warning: objtool: __ex_table+0x4: don't know how to handle reloc symbol type: kvm_fastop_exception

in that it helpfully tells you which symbol name it had trouble figuring
out the relocation for, but it doesn't actually say what the unknown
symbol type was that triggered it all.

In this case it was because of missing type information (type 0, aka
STT_NOTYPE), but on the whole it really should just have printed that
out as part of the message.

Because if this warning triggers, that's very much the first thing you
want to know - why did reloc2sec_off() return failure for that symbol?

So rather than just saying you can't handle some type of symbol without
saying what the type _was_, just print out the type number too.

Fixes: 24ff6525 ("objtool: Teach get_alt_entry() about more relocation types")
Link: https://lore.kernel.org/lkml/CAHk-=wiZwq-0LknKhXN4M+T8jbxn_2i9mcKpO+OaBSSq_Eh7tg@mail.gmail.com/Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NBen Hutchings <ben@decadent.org.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NLin Yujun <linyujun809@huawei.com>
Reviewed-by: NZhang Jianhua <chris.zjh@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 d7ea907a
......@@ -106,8 +106,10 @@ static int get_alt_entry(struct elf *elf, struct special_entry *entry,
return -1;
}
if (!reloc2sec_off(orig_reloc, &alt->orig_sec, &alt->orig_off)) {
WARN_FUNC("don't know how to handle reloc symbol type: %s",
sec, offset + entry->orig, orig_reloc->sym->name);
WARN_FUNC("don't know how to handle reloc symbol type %d: %s",
sec, offset + entry->orig,
orig_reloc->sym->type,
orig_reloc->sym->name);
return -1;
}
......@@ -128,8 +130,10 @@ static int get_alt_entry(struct elf *elf, struct special_entry *entry,
return 1;
if (!reloc2sec_off(new_reloc, &alt->new_sec, &alt->new_off)) {
WARN_FUNC("don't know how to handle reloc symbol type: %s",
sec, offset + entry->new, new_reloc->sym->name);
WARN_FUNC("don't know how to handle reloc symbol type %d: %s",
sec, offset + entry->new,
new_reloc->sym->type,
new_reloc->sym->name);
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册