“ddc04c41636f8cd374d72cdd3a0fcaa916fbc5d0”上不存在“git@gitcode.net:openeuler/raspberrypi-kernel.git”
提交 3e2117bd 编写于 作者: J Josh Poimboeuf 提交者: Zheng Zengkai

objtool: Don't make .altinstructions writable

stable inclusion
from stable-v5.10.133
commit 364e463097a7c949e19fa93283f1a888ba96ed21
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=364e463097a7c949e19fa93283f1a888ba96ed21

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

commit e31694e0 upstream.

When objtool creates the .altinstructions section, it sets the SHF_WRITE
flag to make the section writable -- unless the section had already been
previously created by the kernel.  The mismatch between kernel-created
and objtool-created section flags can cause failures with external
tooling (kpatch-build).  And the section doesn't need to be writable
anyway.

Make the section flags consistent with the kernel's.

Fixes: 9bc0bb50 ("objtool/x86: Rewrite retpoline thunk calls")
Reported-by: NJoe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: NIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/6c284ae89717889ea136f9f0064d914cd8329d31.1624462939.git.jpoimboe@redhat.comSigned-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>
上级 6d2b391b
...@@ -611,7 +611,7 @@ static int elf_add_alternative(struct elf *elf, ...@@ -611,7 +611,7 @@ static int elf_add_alternative(struct elf *elf,
sec = find_section_by_name(elf, ".altinstructions"); sec = find_section_by_name(elf, ".altinstructions");
if (!sec) { if (!sec) {
sec = elf_create_section(elf, ".altinstructions", sec = elf_create_section(elf, ".altinstructions",
SHF_WRITE, size, 0); SHF_ALLOC, size, 0);
if (!sec) { if (!sec) {
WARN_ELF("elf_create_section"); WARN_ELF("elf_create_section");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部