Loading arch/arm64/include/asm/memory.h +5 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,11 @@ extern u64 kimage_vaddr; /* the offset between the kernel virtual and physical mappings */ extern u64 kimage_voffset; static inline unsigned long kaslr_offset(void) { return kimage_vaddr - KIMAGE_VADDR; } /* * Allow all memory at the discovery stage. We will clip it later. */ Loading arch/arm64/kernel/setup.c +4 −4 Original line number Diff line number Diff line Loading @@ -356,11 +356,11 @@ postcore_initcall(topology_init); static int dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p) { u64 const kaslr_offset = kimage_vaddr - KIMAGE_VADDR; const unsigned long offset = kaslr_offset(); if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && kaslr_offset > 0) { pr_emerg("Kernel Offset: 0x%llx from 0x%lx\n", kaslr_offset, KIMAGE_VADDR); if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && offset > 0) { pr_emerg("Kernel Offset: 0x%lx from 0x%lx\n", offset, KIMAGE_VADDR); } else { pr_emerg("Kernel Offset: disabled\n"); } Loading kernel/kcov.c +7 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ #include <linux/debugfs.h> #include <linux/uaccess.h> #include <linux/kcov.h> #include <asm/setup.h> /* * kcov descriptor (one per opened debugfs file). Loading Loading @@ -68,6 +69,11 @@ void notrace __sanitizer_cov_trace_pc(void) if (mode == KCOV_MODE_TRACE) { unsigned long *area; unsigned long pos; unsigned long ip = _RET_IP_; #ifdef CONFIG_RANDOMIZE_BASE ip -= kaslr_offset(); #endif /* * There is some code that runs in interrupts but for which Loading @@ -81,7 +87,7 @@ void notrace __sanitizer_cov_trace_pc(void) /* The first word is number of subsequent PCs. */ pos = READ_ONCE(area[0]) + 1; if (likely(pos < t->kcov_size)) { area[pos] = _RET_IP_; area[pos] = ip; WRITE_ONCE(area[0], pos); } } Loading Loading
arch/arm64/include/asm/memory.h +5 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,11 @@ extern u64 kimage_vaddr; /* the offset between the kernel virtual and physical mappings */ extern u64 kimage_voffset; static inline unsigned long kaslr_offset(void) { return kimage_vaddr - KIMAGE_VADDR; } /* * Allow all memory at the discovery stage. We will clip it later. */ Loading
arch/arm64/kernel/setup.c +4 −4 Original line number Diff line number Diff line Loading @@ -356,11 +356,11 @@ postcore_initcall(topology_init); static int dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p) { u64 const kaslr_offset = kimage_vaddr - KIMAGE_VADDR; const unsigned long offset = kaslr_offset(); if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && kaslr_offset > 0) { pr_emerg("Kernel Offset: 0x%llx from 0x%lx\n", kaslr_offset, KIMAGE_VADDR); if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && offset > 0) { pr_emerg("Kernel Offset: 0x%lx from 0x%lx\n", offset, KIMAGE_VADDR); } else { pr_emerg("Kernel Offset: disabled\n"); } Loading
kernel/kcov.c +7 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ #include <linux/debugfs.h> #include <linux/uaccess.h> #include <linux/kcov.h> #include <asm/setup.h> /* * kcov descriptor (one per opened debugfs file). Loading Loading @@ -68,6 +69,11 @@ void notrace __sanitizer_cov_trace_pc(void) if (mode == KCOV_MODE_TRACE) { unsigned long *area; unsigned long pos; unsigned long ip = _RET_IP_; #ifdef CONFIG_RANDOMIZE_BASE ip -= kaslr_offset(); #endif /* * There is some code that runs in interrupts but for which Loading @@ -81,7 +87,7 @@ void notrace __sanitizer_cov_trace_pc(void) /* The first word is number of subsequent PCs. */ pos = READ_ONCE(area[0]) + 1; if (likely(pos < t->kcov_size)) { area[pos] = _RET_IP_; area[pos] = ip; WRITE_ONCE(area[0], pos); } } Loading