mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
powerpc64: Don't ignore lookup errors in kernel linker
If a lookup fails for a R_PPC_JMP_SLOT (PLT relocation) ignoring errors results in an address of 0 gets written into the jump slot, leading to a NULL pointer jump when attempting to call the function it points to. Fix this with proper error checking so that a module will fail to load instead of crashing later on.
This commit is contained in:
1 parent
68ba58a064
commit
934ffa4c7d
1 file changed
+3
-1
@@ -363,7 +363,9 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
|
||||
break;
|
||||
|
||||
case R_PPC_JMP_SLOT: /* function descriptor copy */
|
||||
lookup(lf, symidx, 1, &addr);
|
||||
error = lookup(lf, symidx, 1, &addr);
|
||||
if (error != 0)
|
||||
return (-1);
|
||||
#if !defined(_CALL_ELF) || _CALL_ELF == 1
|
||||
memcpy(where, (Elf_Addr *)addr, 3*sizeof(Elf_Addr));
|
||||
#else
|
||||
|
||||
Reference in new issue
Block a user