Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1539939
| From | Alexander Popov <alex.popov@linux.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] arm64: setup: introduce kaslr_offset() |
| Date | 2016-12-11 02:00 +0100 |
| Message-ID | <sN0EG-K2-15@gated-at.bofh.it> (permalink) |
| References | <sN0EG-K2-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Introduce kaslr_offset() similarly to x86_64 for fixing kcov.
Signed-off-by: Alexander Popov <alex.popov@linux.com>
---
arch/arm64/include/asm/setup.h | 19 +++++++++++++++++++
arch/arm64/include/uapi/asm/setup.h | 4 ++--
arch/arm64/kernel/setup.c | 8 ++++----
3 files changed, 25 insertions(+), 6 deletions(-)
create mode 100644 arch/arm64/include/asm/setup.h
diff --git a/arch/arm64/include/asm/setup.h b/arch/arm64/include/asm/setup.h
new file mode 100644
index 0000000..e7b59b9
--- /dev/null
+++ b/arch/arm64/include/asm/setup.h
@@ -0,0 +1,19 @@
+/*
+ * arch/arm64/include/asm/setup.h
+ *
+ * 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.
+ */
+
+#ifndef __ASM_SETUP_H
+#define __ASM_SETUP_H
+
+#include <uapi/asm/setup.h>
+
+static inline unsigned long kaslr_offset(void)
+{
+ return kimage_vaddr - KIMAGE_VADDR;
+}
+
+#endif
diff --git a/arch/arm64/include/uapi/asm/setup.h b/arch/arm64/include/uapi/asm/setup.h
index 9cf2e46..26631c8 100644
--- a/arch/arm64/include/uapi/asm/setup.h
+++ b/arch/arm64/include/uapi/asm/setup.h
@@ -16,8 +16,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ASM_SETUP_H
-#define __ASM_SETUP_H
+#ifndef _UAPI__ASM_SETUP_H
+#define _UAPI__ASM_SETUP_H
#include <linux/types.h>
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index f534f49..11eefda5 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -329,11 +329,11 @@ subsys_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");
}
--
2.7.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 1/2] arm64: setup: introduce kaslr_offset() Alexander Popov <alex.popov@linux.com> - 2016-12-11 02:00 +0100
Re: [PATCH 1/2] arm64: setup: introduce kaslr_offset() Will Deacon <will.deacon@arm.com> - 2016-12-12 12:30 +0100
Re: [PATCH 1/2] arm64: setup: introduce kaslr_offset() Alexander Popov <alex.popov@linux.com> - 2016-12-13 23:10 +0100
Re: [PATCH 1/2] arm64: setup: introduce kaslr_offset() Alexander Popov <alex.popov@linux.com> - 2016-12-22 14:00 +0100
Re: [PATCH 1/2] arm64: setup: introduce kaslr_offset() Will Deacon <will.deacon@arm.com> - 2017-01-03 12:40 +0100
Re: [PATCH 1/2] arm64: setup: introduce kaslr_offset() Jon Hunter <jonathanh@nvidia.com> - 2017-01-03 12:20 +0100
csiph-web