git: 934ffa4c7d8c - main - powerpc64: Don't ignore lookup errors in kernel linker
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 07 Nov 2026 04:06:32 UTC
The branch main has been updated by jhibbits:
URL: https://cgit.FreeBSD.org/src/commit/?id=934ffa4c7d8c24c4eb81dbcc0c85a2fd29b4ea17
commit 934ffa4c7d8c24c4eb81dbcc0c85a2fd29b4ea17
Author: Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2026-11-07 03:20:26 +0000
Commit: Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2026-11-07 03:41:15 +0000
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.
---
sys/powerpc/powerpc/elf64_machdep.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/powerpc/powerpc/elf64_machdep.c b/sys/powerpc/powerpc/elf64_machdep.c
index ade4c0420b4a..4f59f0c4bff7 100644
--- a/sys/powerpc/powerpc/elf64_machdep.c
+++ b/sys/powerpc/powerpc/elf64_machdep.c
@@ -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