Skip to content

[PW_SID:1160906] module: reject out-of-range relocation target indices - #2625

Open
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1160906
Open

[PW_SID:1160906] module: reject out-of-range relocation target indices#2625
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1160906

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 1160906 applied to workflow__riscv__fixes

Name: module: reject out-of-range relocation target indices
URL: https://patchwork.kernel.org/series/1160906/
Version: 1

apply_relocations() skips relocation sections whose sh_info target index
is outside the section table. ARM, ARM64, LoongArch, PA-RISC and RISC-V
use sh_info earlier in module_frob_arch_sections(), before this check.

ARM, ARM64, LoongArch and RISC-V use the unchecked index to read
sh_flags outside the section header table. PA-RISC uses it to index an
e_shnum-sized heap array for a read and an update. QEMU reproduced
page-fault Oopses on ARM, ARM64, LoongArch and RISC-V, and a Data TLB
miss on the PA-RISC array read.

Validate sh_info for SHT_REL and SHT_RELA sections in
elf_validity_cache_sechdrs(). Reject the module with ENOEXEC before
architecture code can use the index.

Fixes: c298be7 ("parisc: fix module loading failure of large kernel modules")
Fixes: 7d485f6 ("ARM: 8220/1: allow modules outside of bl range")
Fixes: fd045f6 ("arm64: add support for module PLTs")
Fixes: ab1ef68 ("RISC-V: Add sections of PLT and GOT for kernel module")
Fixes: fcdfe9d ("LoongArch: Add ELF and module support")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants