objtool: Fix SEGFAULT

JIRA: https://issues.redhat.com/browse/RHEL-8594
CVE: CVE-2023-20569
Conflicts: A merge conflict due to upstream merge conflict with
	   upstream commit dbcdbdfdf137 ("objtool: Rework instruction
	   -> symbol mapping"). It is resolved as noted in upstream
	   merge commit 5f6e430f931d ("Merge tag 'powerpc-6.2-1' of
	   git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux").

commit efb11fdb3e1a9f694fa12b70b21e69e55ec59c36
Author: Christophe Leroy <christophe.leroy@csgroup.eu>
Date:   Mon, 14 Nov 2022 23:27:46 +0530

    objtool: Fix SEGFAULT

    find_insn() will return NULL in case of failure. Check insn in order
    to avoid a kernel Oops for NULL pointer dereference.

    Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20221114175754.1131267-9-sv@linux.ibm.com

Signed-off-by: Waiman Long <longman@redhat.com>
This commit is contained in:
Waiman Long 2023-09-25 13:57:12 -04:00
parent abfc8d9dd1
commit cf49ba5db9
1 changed files with 1 additions and 1 deletions

View File

@ -205,7 +205,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
return false;
insn = find_insn(file, func->sec, func->offset);
if (!insn_func(insn))
if (!insn || !insn_func(insn))
return false;
func_for_each_insn(file, func, insn) {