arm64: relocation testing module
PATCH 1/1 arm64: relocation testing module
This module tests the module loader's ELF relocation processing routines. When loaded, it logs output like below.
Relocation test:
-------------------------------------------------------
R_AARCH64_ABS64 0xffff880000cccccc pass
R_AARCH64_ABS32 0x00000000f800cccc pass
R_AARCH64_ABS16 0x000000000000f8cc pass
R_AARCH64_MOVW_SABS_Gn 0xffff880000cccccc pass
R_AARCH64_MOVW_UABS_Gn 0xffff880000cccccc pass
R_AARCH64_ADR_PREL_LO21 0xffffff9cf4d1a400 pass
R_AARCH64_PREL64 0xffffff9cf4d1a400 pass
R_AARCH64_PREL32 0xffffff9cf4d1a400 pass
R_AARCH64_PREL16 0xffffff9cf4d1a400 pass--- arch/arm64/Kconfig.debug | 4 ++ arch/arm64/kernel/Makefile | 2 + arch/arm64/kernel/reloc_test_core.c | 79 +++++++++++++++++++++++++++++++++++ arch/arm64/kernel/reloc_test_syms.S | 83 +++++++++++++++++++++++++++++++++++++ 4 files changed, 168 insertions(+) create mode 100644 arch/arm64/kernel/reloc_test_core.c create mode 100644 arch/arm64/kernel/reloc_test_syms.S
arch/arm64/Kconfig.debug +4 -0
@@ -62,6 +62,10 @@ config DEBUG_ALIGN_RODATA If in doubt, say N. +config ARM64_RELOC_TEST + depends on m + tristate "Relocation testing module" + source "drivers/hwtracing/coresight/Kconfig" endmenu
arch/arm64/kernel/Makefile +2 -0
@@ -50,6 +50,8 @@ arm64-obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o arm64-obj-$(CONFIG_HIBERNATION) += hibernate.o hibernate-asm.o arm64-obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o \ cpu-reset.o +arm64-obj-$(CONFIG_ARM64_RELOC_TEST) += arm64-reloc-test.o +arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o obj-y += $(arm64-obj-y) vdso/ probes/ obj-m += $(arm64-obj-m)
arch/arm64/kernel/reloc_test_core.c new file +79 -0
79 lines not on this page · raw message
arch/arm64/kernel/reloc_test_syms.S new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH 1/1 arm64: relocation testing module
Hi Ard,
Quoted 16 lines · Ard Biesheuvel
This module tests the module loader's ELF relocation processing routines. When loaded, it logs output like below.
Relocation test: ------------------------------------------------------- R_AARCH64_ABS64 0xffff880000cccccc pass R_AARCH64_ABS32 0x00000000f800cccc pass R_AARCH64_ABS16 0x000000000000f8cc pass R_AARCH64_MOVW_SABS_Gn 0xffff880000cccccc pass R_AARCH64_MOVW_UABS_Gn 0xffff880000cccccc pass R_AARCH64_ADR_PREL_LO21 0xffffff9cf4d1a400 pass R_AARCH64_PREL64 0xffffff9cf4d1a400 pass R_AARCH64_PREL32 0xffffff9cf4d1a400 pass R_AARCH64_PREL16 0xffffff9cf4d1a400 passSigned-off-by Ard Biesheuvel <[email protected]>
Quoted 8 lines
--- arch/arm64/Kconfig.debug | 4 ++ arch/arm64/kernel/Makefile | 2 + arch/arm64/kernel/reloc_test_core.c | 79 +++++++++++++++++++++++++++++++++++ arch/arm64/kernel/reloc_test_syms.S | 83 +++++++++++++++++++++++++++++++++++++ 4 files changed, 168 insertions(+) create mode 100644 arch/arm64/kernel/reloc_test_core.c create mode 100644 arch/arm64/kernel/reloc_test_syms.S
Thanks for posting this, I really like it. Just a couple of things:
arch/arm64/Kconfig.debug config DEBUG_ALIGN_RODATA · line 68
Quoted 12 lines
arch/arm64/Kconfig.debug +4
-0@@ -62,6 +62,10 @@ config DEBUG_ALIGN_RODATA If in doubt, say N. +config ARM64_RELOC_TEST + depends on m + tristate "Relocation testing module" +
There's a trivial conflict with for-next/core here (just an FYI for Catalin).
Quoted 22 lines
arch/arm64/Kconfig.debug +0
-0source "drivers/hwtracing/coresight/Kconfig" endmenuarch/arm64/kernel/Makefile +2
-0@@ -50,6 +50,8 @@ arm64-obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o arm64-obj-$(CONFIG_HIBERNATION) += hibernate.o hibernate-asm.o arm64-obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o \ cpu-reset.o +arm64-obj-$(CONFIG_ARM64_RELOC_TEST) += arm64-reloc-test.o +arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o obj-y += $(arm64-obj-y) vdso/ probes/ obj-m += $(arm64-obj-m)arch/arm64/kernel/reloc_test_core.c new file +0
-0
arch/arm64/kernel/reloc_test_core.c line 8
Quoted 8 lines
arch/arm64/kernel/reloc_test_core.c new file +8
-0@@ -0,0 +1,79 @@ +/* +* Copyright (C) 2016 Linaro Ltd; <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +*/
Could you then add a MODULE_LICENSE entry, please? Without it, loading the test taints the kernel:
arm64_reloc_test: module license 'unspecified' taints kernel.
With that:
Thanks,
Will