From 5ae25b8367ac511b1caac6c34666f4c76b3face6 Mon Sep 17 00:00:00 2001 From: bcoles Date: Fri, 12 Apr 2024 01:08:44 +1000 Subject: [PATCH] Split kasld.h header into separate header files for each architecture --- .gitignore | 2 + Makefile | 2 +- src/bcm_msg_head_struct.c | 2 +- src/boot-config.c | 2 +- src/default.c | 2 +- src/dmesg_android_ion_snapshot.c | 2 +- src/dmesg_backtrace.c | 2 +- src/dmesg_check_for_initrd.c | 2 +- src/dmesg_driver_component_ops.c | 2 +- src/dmesg_early_init_dt_add_memory_arch.c | 2 +- src/dmesg_ex_handler_msr.c | 2 +- src/dmesg_fake_numa_init.c | 2 +- src/dmesg_free_area_init_node.c | 2 +- src/dmesg_free_reserved_area.c | 2 +- src/dmesg_kaslr-disabled.c | 5 +- src/dmesg_mem_init_kernel_layout.c | 2 +- src/dmesg_mmu_idmap.c | 2 +- src/dmesg_riscv_relocation.c | 2 +- src/entrybleed.c | 2 +- src/include/kasld.h | 95 ++++ src/include/kasld/arm32.h | 46 ++ src/include/kasld/arm64.h | 60 +++ src/include/kasld/mips32.h | 47 ++ src/include/kasld/mips64.h | 37 ++ src/include/kasld/ppc32.h | 41 ++ src/include/kasld/ppc64.h | 44 ++ src/include/kasld/riscv32.h | 35 ++ src/include/kasld/riscv64.h | 47 ++ src/include/kasld/s390.h | 22 + src/include/kasld/sparc.h | 16 + src/include/kasld/x86_32.h | 52 +++ src/include/kasld/x86_64.h | 57 +++ src/kasld.h | 515 ---------------------- src/mincore.c | 2 +- src/mmap-brute-vmsplit.c | 2 +- src/perf_event_open.c | 2 +- src/pppd_kallsyms.c | 2 +- src/proc-cmdline.c | 2 +- src/proc-config.c | 2 +- src/proc-kallsyms.c | 2 +- src/proc-modules.c | 2 +- src/proc-pid-syscall.c | 2 +- src/proc-stat-wchan.c | 2 +- src/sysfs-kernel-notes-xen.c | 2 +- src/sysfs-module-sections.c | 2 +- src/sysfs_iscsi_transport_handle.c | 2 +- src/sysfs_nf_conntrack.c | 2 +- 47 files changed, 636 insertions(+), 547 deletions(-) create mode 100644 src/include/kasld.h create mode 100644 src/include/kasld/arm32.h create mode 100644 src/include/kasld/arm64.h create mode 100644 src/include/kasld/mips32.h create mode 100644 src/include/kasld/mips64.h create mode 100644 src/include/kasld/ppc32.h create mode 100644 src/include/kasld/ppc64.h create mode 100644 src/include/kasld/riscv32.h create mode 100644 src/include/kasld/riscv64.h create mode 100644 src/include/kasld/s390.h create mode 100644 src/include/kasld/sparc.h create mode 100644 src/include/kasld/x86_32.h create mode 100644 src/include/kasld/x86_64.h delete mode 100644 src/kasld.h diff --git a/.gitignore b/.gitignore index cba7efc..8e98998 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ a.out +*.gch +build diff --git a/Makefile b/Makefile index 82238a6..5ceaecd 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ pre-build : @echo "Building $(OBJ_DIR) ..." mkdir -p "$(OBJ_DIR)" # check for pre-compile errors before building - $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(SRC_DIR)/kasld.h + $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(SRC_DIR)/include/kasld.h .PHONY: build diff --git a/src/bcm_msg_head_struct.c b/src/bcm_msg_head_struct.c index b7b6ac2..566ccd2 100644 --- a/src/bcm_msg_head_struct.c +++ b/src/bcm_msg_head_struct.c @@ -13,7 +13,7 @@ // --- // -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/boot-config.c b/src/boot-config.c index c9db98a..d57f197 100644 --- a/src/boot-config.c +++ b/src/boot-config.c @@ -9,7 +9,7 @@ // --- // -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/default.c b/src/default.c index e757ec7..2fbbc3b 100644 --- a/src/default.c +++ b/src/default.c @@ -7,7 +7,7 @@ #include #include #include -#include "kasld.h" +#include "include/kasld.h" unsigned long get_kernel_addr_default() { return (unsigned long)KERNEL_TEXT_DEFAULT; diff --git a/src/dmesg_android_ion_snapshot.c b/src/dmesg_android_ion_snapshot.c index 36611ac..25c1279 100644 --- a/src/dmesg_android_ion_snapshot.c +++ b/src/dmesg_android_ion_snapshot.c @@ -20,7 +20,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_backtrace.c b/src/dmesg_backtrace.c index a14cd84..ce2e176 100644 --- a/src/dmesg_backtrace.c +++ b/src/dmesg_backtrace.c @@ -11,7 +11,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_check_for_initrd.c b/src/dmesg_check_for_initrd.c index e53ae77..452797f 100644 --- a/src/dmesg_check_for_initrd.c +++ b/src/dmesg_check_for_initrd.c @@ -17,7 +17,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_driver_component_ops.c b/src/dmesg_driver_component_ops.c index 2a33019..d7429b1 100644 --- a/src/dmesg_driver_component_ops.c +++ b/src/dmesg_driver_component_ops.c @@ -29,7 +29,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_early_init_dt_add_memory_arch.c b/src/dmesg_early_init_dt_add_memory_arch.c index 2ba08f1..112665f 100644 --- a/src/dmesg_early_init_dt_add_memory_arch.c +++ b/src/dmesg_early_init_dt_add_memory_arch.c @@ -25,7 +25,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_ex_handler_msr.c b/src/dmesg_ex_handler_msr.c index 2c7c954..3ca5a5c 100644 --- a/src/dmesg_ex_handler_msr.c +++ b/src/dmesg_ex_handler_msr.c @@ -47,7 +47,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_fake_numa_init.c b/src/dmesg_fake_numa_init.c index d0f3ba1..526b695 100644 --- a/src/dmesg_fake_numa_init.c +++ b/src/dmesg_fake_numa_init.c @@ -25,7 +25,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_free_area_init_node.c b/src/dmesg_free_area_init_node.c index 5437c34..5ef019b 100644 --- a/src/dmesg_free_area_init_node.c +++ b/src/dmesg_free_area_init_node.c @@ -18,7 +18,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_free_reserved_area.c b/src/dmesg_free_reserved_area.c index b36086b..69d71b6 100644 --- a/src/dmesg_free_reserved_area.c +++ b/src/dmesg_free_reserved_area.c @@ -27,7 +27,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_kaslr-disabled.c b/src/dmesg_kaslr-disabled.c index 568f593..e519a1a 100644 --- a/src/dmesg_kaslr-disabled.c +++ b/src/dmesg_kaslr-disabled.c @@ -2,6 +2,9 @@ // // Search kernel log for messages stating KASLR is disabled. // +// x86/x86_64: +// KASLR disabled: 'kaslr' not on cmdline (hibernation selected). +// // ARM64: // KASLR disabled due to lack of seed // KASLR disabled due to FDT remapping failure @@ -28,7 +31,7 @@ #define _GNU_SOURCE #include "include/syslog.h" -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/dmesg_mem_init_kernel_layout.c b/src/dmesg_mem_init_kernel_layout.c index c093406..7ad178c 100644 --- a/src/dmesg_mem_init_kernel_layout.c +++ b/src/dmesg_mem_init_kernel_layout.c @@ -54,7 +54,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_mmu_idmap.c b/src/dmesg_mmu_idmap.c index a5b5def..beba8e7 100644 --- a/src/dmesg_mmu_idmap.c +++ b/src/dmesg_mmu_idmap.c @@ -23,7 +23,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include "include/syslog.h" #include #include diff --git a/src/dmesg_riscv_relocation.c b/src/dmesg_riscv_relocation.c index 33e59b6..736da25 100644 --- a/src/dmesg_riscv_relocation.c +++ b/src/dmesg_riscv_relocation.c @@ -41,7 +41,7 @@ #define _GNU_SOURCE #include "include/syslog.h" -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/entrybleed.c b/src/entrybleed.c index 071a737..934f68e 100644 --- a/src/entrybleed.c +++ b/src/entrybleed.c @@ -31,7 +31,7 @@ #endif #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/include/kasld.h b/src/include/kasld.h new file mode 100644 index 0000000..43297bc --- /dev/null +++ b/src/include/kasld.h @@ -0,0 +1,95 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Expected kernel address space values for supported architectures. +// +// - KERNEL_VAS_START: Expected virtual address for start of the kernel +// virtual address space (VAS). +// (eg. 0xc0000000 for 32-bit systems with 3GB vmsplit) +// +// - KERNEL_VAS_END: Expected end of kernel virtual address space. +// (including modules, I/O, guard regions, ...) +// +// - KERNEL_BASE_MIN: Expected minimum possible kernel base virtual address. +// +// - KERNEL_BASE_MAX: Expected maximum possible kernel base virtual address. +// +// - MODULES_START: Expected start virtual address for kernel modules. +// +// - MODULES_END: Expected end virtual address for kernel modules. +// +// - KERNEL_ALIGN: Expected kernel address alignment. +// (usually 2MiB on modern systems) +// +// - KERNEL_TEXT_DEFAULT: Default kernel base virtual address when KASLR is +// disabled (including text offset). This value is +// calculated automatically based on above values. +// +// The default values should work on most systems, but may need +// to be tweaked for the target system - especially old kernels, +// embedded devices (ie, armv7), or systems with a non-default +// memory layout. +// --- +// + +#define MB 0x100000ul +#define GB 0x40000000ul + +#if defined(__x86_64__) || defined(__amd64__) +#include "kasld/x86_64.h" +#elif defined(__i386__) +#include "kasld/x86_32.h" +#elif defined(__aarch64__) +#include "kasld/arm64.h" +#elif defined(__arm__) || defined(__ARM_ARCH_6__) || \ + defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \ + defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || \ + defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_7__) || \ + defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || \ + defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) +#include "kasld/arm32.h" +#elif defined(__mips64) || defined(__mips64__) +#include "kasld/mips64.h" +#elif defined(__mips__) +#include "kasld/mips32.h" +#elif defined(__powerpc64__) || defined(__POWERPC64__) || \ + defined(__ppc64__) || defined(__PPC64__) +#include "kasld/ppc64.h" +#elif defined(__powerpc__) || defined(__POWERPC__) || defined(__ppc__) || \ + defined(__PPC__) +#include "kasld/ppc32.h" +#elif (defined(__riscv) || defined(__riscv__)) && __riscv_xlen == 64 +#include "kasld/riscv64.h" +#elif (defined(__riscv) || defined(__riscv__)) && __riscv_xlen == 32 +#include "kasld/riscv32.h" +#elif defined(__s390__) || defined(__s390x__) || defined(__370__) || \ + defined(__zarch__) +#include "kasld/s390.h" +#elif defined(__sparc__) +#include "kasld/sparc.h" +#else +#error "Unrecognised architecture!" +#endif + +/* ----------------------------------------------------------------------------- + * Sanity check configured values + * ----------------------------------------------------------------------------- + */ +#if KERNEL_VAS_START > KERNEL_VAS_END +#error "Defined KERNEL_VAS_START is larger than KERNEL_VAS_END" +#endif + +#if KERNEL_VAS_START > KERNEL_BASE_MIN +#error "Defined KERNEL_VAS_START is larger than KERNEL_BASE_MIN" +#endif + +#if KERNEL_BASE_MAX > KERNEL_VAS_END +#error "Defined KERNEL_BASE_MAX is larger than KERNEL_VAS_END" +#endif + +#if KERNEL_TEXT_DEFAULT > KERNEL_BASE_MAX +#error "Generated KERNEL_TEXT_DEFAULT is larger than KERNEL_BASE_MAX" +#endif + +#if KERNEL_TEXT_DEFAULT < KERNEL_BASE_MIN +#error "Generated KERNEL_TEXT_DEFAULT is smaller than KERNEL_BASE_MIN" +#endif diff --git a/src/include/kasld/arm32.h b/src/include/kasld/arm32.h new file mode 100644 index 0000000..1a61a34 --- /dev/null +++ b/src/include/kasld/arm32.h @@ -0,0 +1,46 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for ARM 32-bit (arm6l / arm7l / armhf) +// +// KASLR support added in commit 588ab3f9afdfa1a6b1e5761c858b2c4ab6098285 in +// kernel v4.6-rc1~110 on 2016-03-17. +// +// References: +// https://github.com/torvalds/linux/commit/588ab3f9afdfa1a6b1e5761c858b2c4ab6098285 +// https://people.kernel.org/linusw/how-the-arm32-linux-kernel-decompresses +// https://people.kernel.org/linusw/how-the-arm32-kernel-starts +// https://www.kernel.org/doc/Documentation/arm/Porting +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/kernel/head.S +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/include/asm/memory.h#L30 +// --- +// + +// 3GB vmsplit (0xc0000000) is common; but an unsafe assumption, +// especially for embedded systems +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/Kconfig#L1116 +#define PAGE_OFFSET 0xc0000000ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/Kconfig#L276 +#define PHYS_OFFSET 0ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/include/asm/memory.h#L286 +#define phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET + PAGE_OFFSET)) + +#define KERNEL_VAS_START PAGE_OFFSET +#define KERNEL_VAS_END 0xfffffffful + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/include/asm/memory.h#L26 +#define KERNEL_BASE_MIN PAGE_OFFSET +#define KERNEL_BASE_MAX 0xf0000000ul + +// Modules are located below kernel: PAGE_OFFSET - 16MiB (0x01000000) +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/include/asm/memory.h#L51 +#define MODULES_START PAGE_OFFSET - 0x01000000 // 0xbf000000ul +#define MODULES_END PAGE_OFFSET + +#define KERNEL_ALIGN 2 * MB + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/Makefile#L145 +#define TEXT_OFFSET 0x8000 + +#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) diff --git a/src/include/kasld/arm64.h b/src/include/kasld/arm64.h new file mode 100644 index 0000000..ea3d95a --- /dev/null +++ b/src/include/kasld/arm64.h @@ -0,0 +1,60 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for ARM 64-bit (aarch64 / arm64) +// +// KASLR support added in commit 588ab3f9afdfa1a6b1e5761c858b2c4ab6098285 in +// kernel v4.6-rc1~110 on 2016-03-17. +// +// References: +// https://github.com/torvalds/linux/commit/588ab3f9afdfa1a6b1e5761c858b2c4ab6098285 +// https://lwn.net/Articles/673598/ +// https://www.kernel.org/doc/Documentation/arm64/memory.txt +// https://github.com/torvalds/linux/blob/master/Documentation/arm64/booting.rst +// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/memory.rst +// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/head.S +// --- +// + +// 52 va bits (CONFIG_ARM64_VA_BITS_48_52) is largest. +// 48 va bits (CONFIG_ARM64_VA_BITS_48) is more common. +// page_offset = (0xffffffffffffffffUL) << (va_bits - 1) +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm64/include/asm/memory.h#L45 +// We assume 52 va bits: +#define PAGE_OFFSET 0xfff8000000000000ul +#define PHYS_OFFSET 0ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm64/include/asm/memory.h#L295 +#define phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET) + +#define KERNEL_VAS_START PAGE_OFFSET +#define KERNEL_VAS_END 0xfffffffffffffffful + +// 48 va bits (CONFIG_ARM64_VA_BITS_48) is a common configuration; +// but an unsafe assumption since introduction of CONFIG_ARM64_VA_BITS_48_52. +// older kernels may use 0xffff000008000000ul +#define KERNEL_BASE_MIN 0xffff800008000000ul +#define KERNEL_BASE_MAX 0xffffffffff000000ul + +#define MODULES_START 0xffff800000000000ul +#define MODULES_END 0xffff800007fffffful + +// MIN_KIMG_ALIGN is 2MiB (used without KASLR). +// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/arm64/include/asm/boot.h#L18 +// EFI_KIMG_ALIGN is the larger of THREAD_ALIGN or SEGMENT_ALIGN: +// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/arm64/include/asm/efi.h#L102 +// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/arm64/include/asm/efi.h#L72 +// SEGMENT_ALIGN is hard-coded as 64KiB: +// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/arm64/include/asm/memory.h#L131 +// The largest possible THREAD_ALIGN is also 64KiB. +// THREAD_ALIGN = THREAD_SIZE = (1 << THREAD_SHIFT) +// default CONFIG_ARM64_PAGE_SHIFT is 12. largest is 16. +// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/arm64/Kconfig#L262 +// Use 64KiB (0x10000) by default +#define KERNEL_ALIGN 0x10000ul + +// TEXT_OFFSET was changed from 0x80000 to zero in 2020 from kernel v5.8 onwards +// https://elixir.bootlin.com/linux/v5.8/source/arch/arm64/Makefile +// https://lore.kernel.org/all/20200428134119.GI6791@willie-the-truck/T/ +#define TEXT_OFFSET 0 + +#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) diff --git a/src/include/kasld/mips32.h b/src/include/kasld/mips32.h new file mode 100644 index 0000000..737eb80 --- /dev/null +++ b/src/include/kasld/mips32.h @@ -0,0 +1,47 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for MIPS 32-bit (mips / mipsbe / mipsel) +// +// KASLR support added in commit 405bc8fd12f59ec865714447b2f6e1a961f49025 in +// kernel v4.7-rc1~6^2~183 on 2016-05-13. +// +// References: +// https://github.com/torvalds/linux/commit/405bc8fd12f59ec865714447b2f6e1a961f49025 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/processor.h#L39 +// https://www.kernel.org/doc/Documentation/mips/booting.rst +// https://training.mips.com/basic_mips/PDF/Memory_Map.pdf +// --- +// + +// Boards: +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-ar7/spaces.h#L17 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-malta/spaces.h#L36 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-generic/spaces.h#L91 +// +// We use generic and assume kseg0: 0x80000000 - 0x9fffffff +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-generic/spaces.h#L33 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/addrspace.h#L98 +#define PAGE_OFFSET 0x80000000ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-generic/spaces.h#L28 +#define PHYS_OFFSET 0ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/page.h#L199 +#define phys_to_virt(x) ((unsigned long)((x) + PAGE_OFFSET - PHYS_OFFSET)) + +#define KERNEL_VAS_START PAGE_OFFSET +#define KERNEL_VAS_END 0xfffffffful + +#define KERNEL_BASE_MIN PAGE_OFFSET +#define KERNEL_BASE_MAX 0xc0000000ul + +#define MODULES_START 0xc0000000ul +#define MODULES_END 0xfffffffful + +// page aligned (default CONFIG_PAGE_SIZE_4KB=y) +#define KERNEL_ALIGN 0x1000ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/kernel/head.S#L67 +#define TEXT_OFFSET 0x400 + +#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + 0x100000ul + TEXT_OFFSET) diff --git a/src/include/kasld/mips64.h b/src/include/kasld/mips64.h new file mode 100644 index 0000000..2cc65b9 --- /dev/null +++ b/src/include/kasld/mips64.h @@ -0,0 +1,37 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for MIPS 64-bit (mips64el) +// +// KASLR support added in commit 405bc8fd12f59ec865714447b2f6e1a961f49025 in +// kernel v4.7-rc1~6^2~183 on 2016-05-13. +// +// References: +// https://github.com/torvalds/linux/commit/405bc8fd12f59ec865714447b2f6e1a961f49025 +// https://training.mips.com/basic_mips/PDF/Memory_Map.pdf +// --- +// + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/addrspace.h#L68 +#define PAGE_OFFSET 0xffffffff80000000ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-generic/spaces.h#L28 +#define PHYS_OFFSET 0ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/page.h#L199 +#define phys_to_virt(x) ((unsigned long)((x) + PAGE_OFFSET - PHYS_OFFSET)) + +#define KERNEL_VAS_START 0xffff000000000000ul +#define KERNEL_VAS_END 0xfffffffffffffffful + +#define KERNEL_BASE_MIN PAGE_OFFSET +#define KERNEL_BASE_MAX 0xffffffffc0000000ul + +#define MODULES_START 0xffffffffc0000000ul +#define MODULES_END 0xfffffffffffffffful + +#define KERNEL_ALIGN 2 * MB + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/kernel/head.S#L67 +#define TEXT_OFFSET 0x400 + +#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + 0x100000ul + TEXT_OFFSET) diff --git a/src/include/kasld/ppc32.h b/src/include/kasld/ppc32.h new file mode 100644 index 0000000..261d8d3 --- /dev/null +++ b/src/include/kasld/ppc32.h @@ -0,0 +1,41 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for PowerPC 32-bit (powerpc / ppc) +// +// KASLR support added in commit 2b0e86cc5de6dabadc2d64cefa429fc227c8a756 in +// kernel v5.5-rc1~110^2~29^2~6 on 2019-11-13. +// +// References: +// https://github.com/torvalds/linux/commit/2b0e86cc5de6dabadc2d64cefa429fc227c8a756 +// https://docs.kernel.org/6.1/powerpc/kaslr-booke32.html +// --- +// + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1203 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1220 +#define PAGE_OFFSET 0xc0000000ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1233 +#define PHYSICAL_START 0ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/include/asm/page.h#L240 +#define phys_to_virt(x) ((unsigned long)((x) + PAGE_OFFSET - PHYSICAL_START)) + +#define KERNEL_VAS_START PAGE_OFFSET +#define KERNEL_VAS_END 0xfffffffful + +#define KERNEL_BASE_MIN PAGE_OFFSET +#define KERNEL_BASE_MAX 0xf0000000ul + +// Modules are located below kernel: PAGE_OFFSET - 256MiB (0x10000000) +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/include/asm/book3s/32/pgtable.h#L214 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/include/asm/nohash/32/mmu-8xx.h#L173 +#define MODULES_START PAGE_OFFSET - 0x10000000ul // 0xb0000000ul +#define MODULES_END PAGE_OFFSET + +// page aligned +#define KERNEL_ALIGN 0x1000ul + +#define TEXT_OFFSET 0 + +#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) diff --git a/src/include/kasld/ppc64.h b/src/include/kasld/ppc64.h new file mode 100644 index 0000000..856f85e --- /dev/null +++ b/src/include/kasld/ppc64.h @@ -0,0 +1,44 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for PowerPC 64-bit (powerpc64 / ppc64 / ppc64le) +// +// Linux for PowerPC 64-bit does not support KASLR. +// +// Work in progress patches for KASLR support from 2020 appear to be abandoned: +// https://lwn.net/Articles/816271/ +// +// References: +// https://www.kernel.org/doc/ols/2001/ppc64.pdf +// --- +// + +// 0xc000000000000000ul is a common configuration; but an unsafe assumption. +// For Freescale E-Book readers (CONFIG_PPC_BOOK3E_64), the kernel VAS start +// and text start is 0x8000000000000000ul. +// vmalloc, I/O and Bolted sections are mapped above kernel. +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1267 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1264 +#define PAGE_OFFSET 0xc000000000000000ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/include/asm/page.h#L227 +#define phys_to_virt(x) ((unsigned long)((x) | PAGE_OFFSET)) + +#define KERNEL_VAS_START PAGE_OFFSET +#define KERNEL_VAS_END 0xfffffffffffffffful + +#define KERNEL_BASE_MIN PAGE_OFFSET +#define KERNEL_BASE_MAX 0xffffffffff000000ul + +#define MODULES_START 0xc000000000000000ul +#define MODULES_END 0xfffffffffffffffful + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1270 +#define PHYSICAL_START 0ul + +// 16KiB (0x4000) aligned +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L595 +#define KERNEL_ALIGN 0x4000ul + +#define TEXT_OFFSET 0 + +#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) diff --git a/src/include/kasld/riscv32.h b/src/include/kasld/riscv32.h new file mode 100644 index 0000000..05e9155 --- /dev/null +++ b/src/include/kasld/riscv32.h @@ -0,0 +1,35 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for RISC-V 32-bit (riscv32) +// +// Linux for RISC-V 32-bit does not support KASLR. +// +// References: +// https://elixir.bootlin.com/linux/v6.8.2/source/arch/riscv/Kconfig#L819 +// --- +// + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/Kconfig#L169 +#define PAGE_OFFSET 0xc0000000ul + +// Assume linear mapping (not Execute-In-Place (XIP_KERNEL) kernel) +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/include/asm/page.h#L125 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/mm/init.c#L984 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/mm/init.c#L976 +#define phys_to_virt(x) ((unsigned long)(x) + PAGE_OFFSET) + +#define KERNEL_VAS_START PAGE_OFFSET +#define KERNEL_VAS_END 0xfffffffful + +#define KERNEL_BASE_MIN PAGE_OFFSET +#define KERNEL_BASE_MAX 0xf0000000ul + +#define MODULES_START PAGE_OFFSET +#define MODULES_END 0xfffffffful + +// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/riscv/include/asm/efi.h#L41 +#define KERNEL_ALIGN 4 * MB + +#define TEXT_OFFSET 0x2000 + +#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) diff --git a/src/include/kasld/riscv64.h b/src/include/kasld/riscv64.h new file mode 100644 index 0000000..6d2298b --- /dev/null +++ b/src/include/kasld/riscv64.h @@ -0,0 +1,47 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for RISC-V 64-bit (riscv64) +// +// KASLR support added in commit f57805555834494e8cad729d01d86ba326d64959 in +// kernel v6.6-rc1~10^2~5 on 2023-11-08. +// +// References: +// https://github.com/torvalds/linux/commit/f57805555834494e8cad729d01d86ba326d64959 +// https://www.kernel.org/doc/html/next/riscv/vm-layout.html +// https://www.kernel.org/doc/html/next/riscv/boot.html +// --- +// + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/Kconfig#L171 +#define PAGE_OFFSET 0xff60000000000000ul + +// Assume linear mapping (not Execute-In-Place (XIP_KERNEL) kernel) +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/include/asm/page.h#L125 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/mm/init.c#L984 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/mm/init.c#L976 +#define phys_to_virt(x) ((unsigned long)(x) + (PAGE_OFFSET - 0x80000000ul)) + +// VAS start with SV57 (5-level page tables): 0xff1bffff_fea00000 +// VAS start with SV48 (4-level page tables): 0xffff8d7f_fea00000 +// VAS start with SV39 (3-level page tables): 0xffffffc6_fea00000 +#define KERNEL_VAS_START 0xff10000000000000ul +#define KERNEL_VAS_END 0xfffffffffffffffful + +// common: +// 0xffffffe0_00000000 +// 0xffffffff_80000000 +#define KERNEL_BASE_MIN 0xffffffe000000000ul +#define KERNEL_BASE_MAX 0xffffffffff000000ul + +// Modules are located below kernel: KERNEL_LINK_ADDR - 2GB (0x80000000) +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/include/asm/pgtable.h#L52 +// 0xffffffd0_00000000 is also common +#define MODULES_START KERNEL_VAS_START - 0x80000000ul +#define MODULES_END 0xfffffffffffffffful + +// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/riscv/include/asm/efi.h#L41 +#define KERNEL_ALIGN 2 * MB + +#define TEXT_OFFSET 0x2000 + +#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) diff --git a/src/include/kasld/s390.h b/src/include/kasld/s390.h new file mode 100644 index 0000000..ad43650 --- /dev/null +++ b/src/include/kasld/s390.h @@ -0,0 +1,22 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for S390 (24-bit s370 / 32-bit s390 / 64-bit s390x) +// +// KASLR support added in commit b2d24b97b2a9691351920e700bfda4368c177232 in +// kernel v5.2-rc1~186^2~14 on 2019-02-03. +// +// kernel uses 1:1 phys:virt mapping. +// kernel text starts at 0x00000000_00100000 (1MiB) offset. +// Uses 24-bit (amode24), 32-bit (amode31) and 64-bit (amode64) addressing +// modes. +// +// References: +// https://github.com/torvalds/linux/commit/b2d24b97b2a9691351920e700bfda4368c177232 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/s390/mm/vmem.c#L665 +// https://www.ibm.com/docs/en/zos-basic-skills?topic=1960s-what-is-virtual-storage +// https://share.confex.com/share/115/webprogram/Handout/Session6865/Understanding%20zOS%20CS%20storage%20use.pdf +// https://www.linux-kvm.org/images/a/ae/KVM_Forum_2018_s390_KVM_memory_management.pdf +// --- +// + +#error "S390 architecture is not supported!" diff --git a/src/include/kasld/sparc.h b/src/include/kasld/sparc.h new file mode 100644 index 0000000..44e231d --- /dev/null +++ b/src/include/kasld/sparc.h @@ -0,0 +1,16 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for SPARC (sparc / sparc64) +// +// Linux for sparc/sparc64 is largely abandoned and does not support KASLR. +// +// sparc32 kernel text starts at 0xf0004000 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/sparc/kernel/vmlinux.lds.S#L11 +// +// sparc64 kernel text starts at 0x00000000_00404000 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/sparc/kernel/head_64.S#L39 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/sparc/kernel/vmlinux.lds.S#L18 +// --- +// + +#error "SPARC architecture is not supported!" diff --git a/src/include/kasld/x86_32.h b/src/include/kasld/x86_32.h new file mode 100644 index 0000000..503425a --- /dev/null +++ b/src/include/kasld/x86_32.h @@ -0,0 +1,52 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for x86_32 (i386 / i686) +// +// KASLR support added in commit 8ab3820fd5b2896d66da7bb2a906bc382e63e7bc in +// kernel v3.14-rc1~156^2~11 on 2013-10-13. +// +// KASLR was not compatible with hibernation (CONFIG_HIBERNATION) until commit +// 65fe935dd2387a4faf15314c73f5e6d31ef0217e in v4.8-rc1~179^2~20 on 2016-06-26. +// +// Enabled by default in commit 16b76293c5c81e6345323d7aef41b26e8390f62d in +// kernel v4.12-rc1~150 on 2017-05-01. +// +// References: +// https://github.com/torvalds/linux/commit/8ab3820fd5b2896d66da7bb2a906bc382e63e7bc +// https://github.com/torvalds/linux/commit/16b76293c5c81e6345323d7aef41b26e8390f62d +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/Kconfig +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/kernel/head_32.S +// --- +// + +// 3GB vmsplit (0xc0000000) is a common configuration +// for distro kernels for non-embedded systems +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/Kconfig#L1474 +#define PAGE_OFFSET 0xc0000000ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/include/asm/page.h#L59 +#define phys_to_virt(x) ((unsigned long)(x + PAGE_OFFSET)) + +#define KERNEL_VAS_START PAGE_OFFSET +#define KERNEL_VAS_END 0xfffffffful + +// Old <= 4.4 era kernels used the RANDOMIZE_BASE_MAX_OFFSET config option +// which limited the maximum offset to 512 MiB (0x2000_0000), yielding 256 +// possible base addresses (between 0xc0000000 and 0xe0000000). +// The RANDOMIZE_BASE_MAX_OFFSET option was later removed. +// We use a larger range with a max of 0xf0000000. +#define KERNEL_BASE_MIN PAGE_OFFSET +#define KERNEL_BASE_MAX 0xf0000000ul + +#define MODULES_START 0xf0000000ul +#define MODULES_END 0xfffffffful + +// For x86_32, possible max alignment is 0x100_0000 (16MiB) with default of +// 0x20_0000 (2MiB) in increments of 0x2000 (8KiB). +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/boot/compressed/kaslr.c#L850 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/Kconfig#L2182 +#define KERNEL_ALIGN 2 * MB + +#define TEXT_OFFSET 0 + +#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) diff --git a/src/include/kasld/x86_64.h b/src/include/kasld/x86_64.h new file mode 100644 index 0000000..015132d --- /dev/null +++ b/src/include/kasld/x86_64.h @@ -0,0 +1,57 @@ +// This file is part of KASLD - https://github.com/bcoles/kasld +// +// Definitions for x86_64 (amd64) +// +// KASLR support added in commit 8ab3820fd5b2896d66da7bb2a906bc382e63e7bc in +// kernel v3.14-rc1~156^2~11 on 2013-10-13. +// +// KASLR was not compatible with hibernation (CONFIG_HIBERNATION) until commit +// 65fe935dd2387a4faf15314c73f5e6d31ef0217e in v4.8-rc1~179^2~20 on 2016-06-26. +// +// Enabled by default in commit 16b76293c5c81e6345323d7aef41b26e8390f62d in +// kernel v4.12-rc1~150 on 2017-05-01. +// +// References: +// https://github.com/torvalds/linux/commit/8ab3820fd5b2896d66da7bb2a906bc382e63e7bc +// https://github.com/torvalds/linux/commit/16b76293c5c81e6345323d7aef41b26e8390f62d +// https://www.kernel.org/doc/Documentation/x86/x86_64/mm.txt +// --- +// + +// VAS start with 5-level page tables (CONFIG_X86_5LEVEL): 0xff000000_00000000 +// VAS start with 4-level page tables: 0xffff8000_00000000 +// https://www.kernel.org/doc/html/latest/x86/x86_64/mm.html +// https://www.cateee.net/lkddb/web-lkddb/X86_5LEVEL.html +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/include/asm/page_64_types.h#L34 +#define PAGE_OFFSET 0xff00000000000000ul + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/include/asm/page.h#L59 +#define phys_to_virt(x) ((unsigned long)(x + PAGE_OFFSET)) + +#define KERNEL_VAS_START PAGE_OFFSET +#define KERNEL_VAS_END 0xfffffffffffffffful + +// Old <= 4.4 era kernels used the RANDOMIZE_BASE_MAX_OFFSET config option +// which limited the maximum offset to 1 GiB (0x4000_0000), yielding 512 +// possible base addresses (between 0xffffffff_80000000 and +// 0xffffffff_c0000000). The RANDOMIZE_BASE_MAX_OFFSET option was later removed. +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/include/asm/page_64_types.h#L50 +#define KERNEL_BASE_MIN 0xffffffff80000000ul +#define KERNEL_BASE_MAX 0xffffffffc0000000ul + +#define MODULES_START 0xffffffffc0000000ul +#define MODULES_END 0xfffffffffffffffful + +// For x86_64, possible max alignment is 0x100_0000 (16MiB) with default of +// 0x20_0000 (2MiB) in increments of 0x20_0000 (2MiB). +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/boot/compressed/kaslr.c#L850 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/Kconfig#L2182 +#define KERNEL_ALIGN 2 * MB + +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/Kconfig#L2084 +// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/boot/compressed/kaslr.c#L869 +#define PHYSICAL_START 0x1000000ul + +#define TEXT_OFFSET 0 + +#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + PHYSICAL_START + TEXT_OFFSET) diff --git a/src/kasld.h b/src/kasld.h deleted file mode 100644 index 684c368..0000000 --- a/src/kasld.h +++ /dev/null @@ -1,515 +0,0 @@ -// This file is part of KASLD - https://github.com/bcoles/kasld -// -// Expected kernel address space values for supported architectures. -// -// - KERNEL_VAS_START: Expected virtual address for start of the kernel -// virtual address space (VAS). -// (eg. 0xc0000000 for 32-bit systems with 3GB vmsplit) -// -// - KERNEL_VAS_END: Expected end of kernel virtual address space. -// (including modules, I/O, guard regions, ...) -// -// - KERNEL_BASE_MIN: Expected minimum possible kernel base virtual address. -// -// - KERNEL_BASE_MAX: Expected maximum possible kernel base virtual address. -// -// - MODULES_START: Expected start virtual address for kernel modules. -// -// - MODULES_END: Expected end virtual address for kernel modules. -// -// - KERNEL_ALIGN: Expected kernel address alignment. -// (usually 2MiB on modern systems) -// -// - KERNEL_TEXT_DEFAULT: Default kernel base virtual address when KASLR is -// disabled (including text offset). This value is -// calculated automatically based on above values. -// -// The default values should work on most systems, but may need -// to be tweaked for the target system - especially old kernels, -// embedded devices (ie, armv7), or systems with a non-default -// memory layout. -// --- -// - -// clang-format off - -#define MB 0x100000ul -#define GB 0x40000000ul - -/* ----------------------------------------------------------------------------- - * x86_64 (amd64) - * ----------------------------------------------------------------------------- - * https://www.kernel.org/doc/Documentation/x86/x86_64/mm.txt - */ -#if defined(__x86_64__) || defined(__amd64__) - -// VAS start with 5-level page tables (CONFIG_X86_5LEVEL): 0xff000000_00000000 -// VAS start with 4-level page tables: 0xffff8000_00000000 -// https://www.kernel.org/doc/html/latest/x86/x86_64/mm.html -// https://www.cateee.net/lkddb/web-lkddb/X86_5LEVEL.html -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/include/asm/page_64_types.h#L34 -#define PAGE_OFFSET 0xff00000000000000ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/include/asm/page.h#L59 -#define phys_to_virt(x) ((unsigned long)(x + PAGE_OFFSET)) - -#define KERNEL_VAS_START PAGE_OFFSET -#define KERNEL_VAS_END 0xfffffffffffffffful - -// Old <= 4.4 era kernels used the RANDOMIZE_BASE_MAX_OFFSET config option -// which limited the maximum offset to 1 GiB (0x40_000_000), yielding 512 -// possible base addresses (between 0xffffffff_80000000 and -// 0xffffffff_c0000000). The RANDOMIZE_BASE_MAX_OFFSET option was later removed. -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/include/asm/page_64_types.h#L50 -#define KERNEL_BASE_MIN 0xffffffff80000000ul -#define KERNEL_BASE_MAX 0xffffffffc0000000ul - -#define MODULES_START 0xffffffffc0000000ul -#define MODULES_END 0xfffffffffffffffful - -// For x86_64, possible max alignment is 0x1_000_000 (16MiB) with default of -// 0x200_000 (2MiB) in increments of 0x200_000 (2MiB). -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/boot/compressed/kaslr.c#L850 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/Kconfig#L2182 -#define KERNEL_ALIGN 2 * MB - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/Kconfig#L2084 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/boot/compressed/kaslr.c#L869 -#define PHYSICAL_START 0x1000000ul - -#define TEXT_OFFSET 0 - -#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + PHYSICAL_START + TEXT_OFFSET) - -/* ----------------------------------------------------------------------------- - * ARM 64-bit (aarch64 / arm64) - * ----------------------------------------------------------------------------- - * https://lwn.net/Articles/673598/ - * https://www.kernel.org/doc/Documentation/arm64/memory.txt - * https://github.com/torvalds/linux/blob/master/Documentation/arm64/booting.rst - * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/memory.rst - * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/head.S - */ -#elif defined(__aarch64__) - -// 52 va bits (CONFIG_ARM64_VA_BITS_48_52) is largest. -// 48 va bits (CONFIG_ARM64_VA_BITS_48) is more common. -// page_offset = (0xffffffffffffffffUL) << (va_bits - 1) -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm64/include/asm/memory.h#L45 -// We assume 52 va bits: -#define PAGE_OFFSET 0xfff8000000000000ul -#define PHYS_OFFSET 0ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm64/include/asm/memory.h#L295 -#define phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET) - -#define KERNEL_VAS_START PAGE_OFFSET -#define KERNEL_VAS_END 0xfffffffffffffffful - -// 48 va bits (CONFIG_ARM64_VA_BITS_48) is a common configuration; -// but an unsafe assumption since introduction of CONFIG_ARM64_VA_BITS_48_52. -// older kernels may use 0xffff000008000000ul -#define KERNEL_BASE_MIN 0xffff800008000000ul -#define KERNEL_BASE_MAX 0xffffffffff000000ul - -#define MODULES_START 0xffff800000000000ul -#define MODULES_END 0xffff800007fffffful - -// MIN_KIMG_ALIGN is 2MiB (used without KASLR). -// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/arm64/include/asm/boot.h#L18 -// EFI_KIMG_ALIGN is the larger of THREAD_ALIGN or SEGMENT_ALIGN: -// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/arm64/include/asm/efi.h#L102 -// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/arm64/include/asm/efi.h#L72 -// SEGMENT_ALIGN is hard-coded as 64KiB: -// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/arm64/include/asm/memory.h#L131 -// The largest possible THREAD_ALIGN is also 64KiB. -// THREAD_ALIGN = THREAD_SIZE = (1 << THREAD_SHIFT) -// default CONFIG_ARM64_PAGE_SHIFT is 12. largest is 16. -// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/arm64/Kconfig#L262 -#define KERNEL_ALIGN 0x10000ul - -// TEXT_OFFSET was changed from 0x80000 to zero in 2020 from kernel v5.8 onwards -// https://elixir.bootlin.com/linux/v5.8/source/arch/arm64/Makefile -// https://lore.kernel.org/all/20200428134119.GI6791@willie-the-truck/T/ -#define TEXT_OFFSET 0 - -#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) - -/* ----------------------------------------------------------------------------- - * MIPS 64-bit (mips64el) - * ----------------------------------------------------------------------------- - * https://training.mips.com/basic_mips/PDF/Memory_Map.pdf - */ -#elif defined(__mips64) || defined(__mips64__) - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/addrspace.h#L68 -#define PAGE_OFFSET 0xffffffff80000000ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-generic/spaces.h#L28 -#define PHYS_OFFSET 0ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/page.h#L199 -#define phys_to_virt(x) ((unsigned long)((x) + PAGE_OFFSET - PHYS_OFFSET)) - -#define KERNEL_VAS_START 0xffff000000000000ul -#define KERNEL_VAS_END 0xfffffffffffffffful - -#define KERNEL_BASE_MIN PAGE_OFFSET -#define KERNEL_BASE_MAX 0xffffffffc0000000ul - -#define MODULES_START 0xffffffffc0000000ul -#define MODULES_END 0xfffffffffffffffful - -#define KERNEL_ALIGN 2 * MB - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/kernel/head.S#L67 -#define TEXT_OFFSET 0x400 - -#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + 0x100000ul + TEXT_OFFSET) - -/* ----------------------------------------------------------------------------- - * x86_32 (i386 / i686) - * ----------------------------------------------------------------------------- - * https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/Kconfig - * https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/kernel/head_32.S - */ -#elif defined(__i386__) - -// 3GB vmsplit (0xc0000000) is a common configuration -// for distro kernels for non-embedded systems -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/Kconfig#L1474 -#define PAGE_OFFSET 0xc0000000ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/include/asm/page.h#L59 -#define phys_to_virt(x) ((unsigned long)(x + PAGE_OFFSET)) - -#define KERNEL_VAS_START PAGE_OFFSET -#define KERNEL_VAS_END 0xfffffffful - -// Old <= 4.4 era kernels used the RANDOMIZE_BASE_MAX_OFFSET config option -// which limited the maximum offset to 512 MiB (0x20_000_000), yielding 256 -// possible base addresses (between 0xc0000000 and 0xe0000000). -// The RANDOMIZE_BASE_MAX_OFFSET option was later removed. -// We use a larger range with a max of 0xf0000000. -#define KERNEL_BASE_MIN PAGE_OFFSET -#define KERNEL_BASE_MAX 0xf0000000ul - -#define MODULES_START 0xf0000000ul -#define MODULES_END 0xfffffffful - -// For x86_32, possible max alignment is 0x1_000_000 (16MiB) with default of -// 0x200_000 (2MiB) in increments of 0x2_000 (8KiB). -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/boot/compressed/kaslr.c#L850 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/x86/Kconfig#L2182 -#define KERNEL_ALIGN 2 * MB - -#define TEXT_OFFSET 0 - -#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) - -/* ----------------------------------------------------------------------------- - * ARM 32-bit (arm6l / arm7l / armhf) - * ----------------------------------------------------------------------------- - * https://people.kernel.org/linusw/how-the-arm32-linux-kernel-decompresses - * https://people.kernel.org/linusw/how-the-arm32-kernel-starts - * https://www.kernel.org/doc/Documentation/arm/Porting - * https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/kernel/head.S - * https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/include/asm/memory.h#L30 - */ -#elif defined(__arm__) || defined(__ARM_ARCH_6__) || \ - defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \ - defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || \ - defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_7__) || \ - defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || \ - defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) - -// 3GB vmsplit (0xc0000000) is common; but an unsafe assumption, -// especially for embedded systems -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/Kconfig#L1116 -#define PAGE_OFFSET 0xc0000000ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/Kconfig#L276 -#define PHYS_OFFSET 0ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/include/asm/memory.h#L286 -#define phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET + PAGE_OFFSET)) - -#define KERNEL_VAS_START PAGE_OFFSET -#define KERNEL_VAS_END 0xfffffffful - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/include/asm/memory.h#L26 -#define KERNEL_BASE_MIN PAGE_OFFSET -#define KERNEL_BASE_MAX 0xf0000000ul - -// Modules are located below kernel: PAGE_OFFSET - 16MiB (0x01000000) -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/include/asm/memory.h#L51 -#define MODULES_START PAGE_OFFSET - 0x01000000 // 0xbf000000ul -#define MODULES_END PAGE_OFFSET - -#define KERNEL_ALIGN 2 * MB - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/arm/Makefile#L145 -#define TEXT_OFFSET 0x8000 - -#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) - -/* ----------------------------------------------------------------------------- - * MIPS 32-bit (mips / mipsbe / mipsel) - * ----------------------------------------------------------------------------- - * https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/processor.h#L39 - * https://www.kernel.org/doc/Documentation/mips/booting.rst - * https://training.mips.com/basic_mips/PDF/Memory_Map.pdf - */ -#elif defined(__mips__) - -// Boards: -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-ar7/spaces.h#L17 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-malta/spaces.h#L36 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-generic/spaces.h#L91 -// -// We use generic and assume kseg0: 0x80000000 - 0x9fffffff -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-generic/spaces.h#L33 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/addrspace.h#L98 -#define PAGE_OFFSET 0x80000000ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/mach-generic/spaces.h#L28 -#define PHYS_OFFSET 0ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/include/asm/page.h#L199 -#define phys_to_virt(x) ((unsigned long)((x) + PAGE_OFFSET - PHYS_OFFSET)) - -#define KERNEL_VAS_START PAGE_OFFSET -#define KERNEL_VAS_END 0xfffffffful - -#define KERNEL_BASE_MIN PAGE_OFFSET -#define KERNEL_BASE_MAX 0xc0000000ul - -#define MODULES_START 0xc0000000ul -#define MODULES_END 0xfffffffful - -// page aligned (default CONFIG_PAGE_SIZE_4KB=y) -#define KERNEL_ALIGN 0x1000ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/mips/kernel/head.S#L67 -#define TEXT_OFFSET 0x400 - -#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + 0x100000ul + TEXT_OFFSET) - -/* ----------------------------------------------------------------------------- - * PowerPC 64-bit (powerpc64 / ppc64 / ppc64le) - * ----------------------------------------------------------------------------- - * https://www.kernel.org/doc/ols/2001/ppc64.pdf - */ -#elif defined(__powerpc64__) || defined(__POWERPC64__) \ - || defined(__ppc64__) || defined(__PPC64__) - -// 0xc000000000000000ul is a common configuration; but an unsafe assumption. -// For Freescale E-Book readers (CONFIG_PPC_BOOK3E_64), the kernel VAS start -// and text start is 0x8000000000000000ul. -// vmalloc, I/O and Bolted sections are mapped above kernel. -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1267 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1264 -#define PAGE_OFFSET 0xc000000000000000ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/include/asm/page.h#L227 -#define phys_to_virt(x) ((unsigned long)((x) | PAGE_OFFSET)) - -#define KERNEL_VAS_START PAGE_OFFSET -#define KERNEL_VAS_END 0xfffffffffffffffful - -#define KERNEL_BASE_MIN PAGE_OFFSET -#define KERNEL_BASE_MAX 0xffffffffff000000ul - -#define MODULES_START 0xc000000000000000ul -#define MODULES_END 0xfffffffffffffffful - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1270 -#define PHYSICAL_START 0ul - -// 16KiB (0x4000) aligned -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L595 -#define KERNEL_ALIGN 0x4000ul - -#define TEXT_OFFSET 0 - -#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) - -/* ----------------------------------------------------------------------------- - PowerPC 32-bit (powerpc / ppc) - * ----------------------------------------------------------------------------- - */ -#elif defined(__powerpc__) || defined(__POWERPC__) || \ - defined(__ppc__) || defined(__PPC__) - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1203 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1220 -#define PAGE_OFFSET 0xc0000000ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/Kconfig#L1233 -#define PHYSICAL_START 0ul - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/include/asm/page.h#L240 -#define phys_to_virt(x) ((unsigned long)((x) + PAGE_OFFSET - PHYSICAL_START)) - -#define KERNEL_VAS_START PAGE_OFFSET -#define KERNEL_VAS_END 0xfffffffful - -#define KERNEL_BASE_MIN PAGE_OFFSET -#define KERNEL_BASE_MAX 0xf0000000ul - -// Modules are located below kernel: PAGE_OFFSET - 256MiB (0x10000000) -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/include/asm/book3s/32/pgtable.h#L214 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/powerpc/include/asm/nohash/32/mmu-8xx.h#L173 -#define MODULES_START PAGE_OFFSET - 0x10000000ul // 0xb0000000ul -#define MODULES_END PAGE_OFFSET - -// page aligned -#define KERNEL_ALIGN 0x1000ul - -#define TEXT_OFFSET 0 - -#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) - -/* ----------------------------------------------------------------------------- - * RISC-V 64-bit (riscv64) - * ----------------------------------------------------------------------------- - * KASLR support added in commit f57805555834494e8cad729d01d86ba326d64959 in - * v6.6-rc1~10^2~5 on 2023-11-08. - * https://github.com/torvalds/linux/commit/f57805555834494e8cad729d01d86ba326d64959 - * https://www.kernel.org/doc/html/next/riscv/vm-layout.html - * https://www.kernel.org/doc/html/next/riscv/boot.html - */ -#elif (defined(__riscv) || defined(__riscv__)) && __riscv_xlen == 64 - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/Kconfig#L171 -#define PAGE_OFFSET 0xff60000000000000ul - -// Assume linear mapping (not Execute-In-Place (XIP_KERNEL) kernel) -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/include/asm/page.h#L125 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/mm/init.c#L984 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/mm/init.c#L976 -#define phys_to_virt(x) ((unsigned long)(x) + (PAGE_OFFSET - 0x80000000ul)) - -// VAS start with SV57 (5-level page tables): 0xff1bffff_fea00000 -// VAS start with SV48 (4-level page tables): 0xffff8d7f_fea00000 -// VAS start with SV39 (3-level page tables): 0xffffffc6_fea00000 -#define KERNEL_VAS_START 0xff10000000000000ul -#define KERNEL_VAS_END 0xfffffffffffffffful - -// common: -// 0xffffffe0_00000000 -// 0xffffffff_80000000 -#define KERNEL_BASE_MIN 0xffffffe000000000ul -#define KERNEL_BASE_MAX 0xffffffffff000000ul - -// Modules are located below kernel: KERNEL_LINK_ADDR - 2GB (0x80000000) -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/include/asm/pgtable.h#L52 -// 0xffffffd0_00000000 is also common -#define MODULES_START KERNEL_VAS_START - 0x80000000ul -#define MODULES_END 0xfffffffffffffffful - -// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/riscv/include/asm/efi.h#L41 -#define KERNEL_ALIGN 2 * MB - -#define TEXT_OFFSET 0x2000 - -#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) - -/* ----------------------------------------------------------------------------- - * RISC-V 32-bit (riscv32) - * ----------------------------------------------------------------------------- - * Linux for RISCV 32-bit does not support KASLR - * https://elixir.bootlin.com/linux/v6.8.2/source/arch/riscv/Kconfig#L819 - */ -#elif (defined(__riscv) || defined(__riscv__)) && __riscv_xlen == 32 - -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/Kconfig#L169 -#define PAGE_OFFSET 0xc0000000ul - -// Assume linear mapping (not Execute-In-Place (XIP_KERNEL) kernel) -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/include/asm/page.h#L125 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/mm/init.c#L984 -// https://elixir.bootlin.com/linux/v6.1.1/source/arch/riscv/mm/init.c#L976 -#define phys_to_virt(x) ((unsigned long)(x) + PAGE_OFFSET) - -#define KERNEL_VAS_START PAGE_OFFSET -#define KERNEL_VAS_END 0xfffffffful - -#define KERNEL_BASE_MIN PAGE_OFFSET -#define KERNEL_BASE_MAX 0xf0000000ul - -#define MODULES_START PAGE_OFFSET -#define MODULES_END 0xfffffffful - -// https://elixir.bootlin.com/linux/v6.2-rc2/source/arch/riscv/include/asm/efi.h#L41 -#define KERNEL_ALIGN 4 * MB - -#define TEXT_OFFSET 0x2000 - -#define KERNEL_TEXT_DEFAULT (KERNEL_BASE_MIN + TEXT_OFFSET) - -/* ----------------------------------------------------------------------------- - * S390 (24-bit s370 / 32-bit s390 / 64-bit s390x) - * ----------------------------------------------------------------------------- - * kernel uses 1:1 phys:virt mapping. - * kernel text starts at 0x00000000_00100000 (1MiB) offset. - * Uses 24-bit (amode24), 32-bit (amode31) and 64-bit (amode64) addressing modes. - * Linux for s390x did not receive KASLR support until kernel 5.2. - * - * https://elixir.bootlin.com/linux/v6.1.1/source/arch/s390/mm/vmem.c#L665 - * https://www.ibm.com/docs/en/zos-basic-skills?topic=1960s-what-is-virtual-storage - * https://share.confex.com/share/115/webprogram/Handout/Session6865/Understanding%20zOS%20CS%20storage%20use.pdf - * https://www.linux-kvm.org/images/a/ae/KVM_Forum_2018_s390_KVM_memory_management.pdf - */ -#elif defined(__s390__) || defined(__s390x__) || \ - defined(__370__) || defined(__zarch__) -#error "S390 architecture is not supported!" - -/* ----------------------------------------------------------------------------- - * SPARC (sparc / sparc64) - * ----------------------------------------------------------------------------- - * Linux for sparc/sparc64 is largely abandoned and does not support KASLR. - * - * sparc32 kernel text starts at 0xf0004000 - * https://elixir.bootlin.com/linux/v6.1.1/source/arch/sparc/kernel/vmlinux.lds.S#L11 - * - * sparc64 kernel text starts at 0x00000000_00404000 - * https://elixir.bootlin.com/linux/v6.1.1/source/arch/sparc/kernel/head_64.S#L39 - * https://elixir.bootlin.com/linux/v6.1.1/source/arch/sparc/kernel/vmlinux.lds.S#L18 - */ -#elif defined(__sparc__) -#error "SPARC architecture is not supported!" - -/* ----------------------------------------------------------------------------- - * Unsupported architectures - * ----------------------------------------------------------------------------- - */ -#else -#error "Unrecognised architecture!" -#endif - -// clang-format on - -/* ----------------------------------------------------------------------------- - * Sanity check configured values - * ----------------------------------------------------------------------------- - */ -#if KERNEL_VAS_START > KERNEL_VAS_END -#error "Defined KERNEL_VAS_START is larger than KERNEL_VAS_END" -#endif - -#if KERNEL_VAS_START > KERNEL_BASE_MIN -#error "Defined KERNEL_VAS_START is larger than KERNEL_BASE_MIN" -#endif - -#if KERNEL_BASE_MAX > KERNEL_VAS_END -#error "Defined KERNEL_BASE_MAX is larger than KERNEL_VAS_END" -#endif - -#if KERNEL_TEXT_DEFAULT > KERNEL_BASE_MAX -#error "Generated KERNEL_TEXT_DEFAULT is larger than KERNEL_BASE_MAX" -#endif - -#if KERNEL_TEXT_DEFAULT < KERNEL_BASE_MIN -#error "Generated KERNEL_TEXT_DEFAULT is smaller than KERNEL_BASE_MIN" -#endif diff --git a/src/mincore.c b/src/mincore.c index 0a7c664..51f735c 100644 --- a/src/mincore.c +++ b/src/mincore.c @@ -18,7 +18,7 @@ #endif #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/mmap-brute-vmsplit.c b/src/mmap-brute-vmsplit.c index bcc489a..4accb2d 100644 --- a/src/mmap-brute-vmsplit.c +++ b/src/mmap-brute-vmsplit.c @@ -15,7 +15,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/perf_event_open.c b/src/perf_event_open.c index f6ce104..6aaf69d 100644 --- a/src/perf_event_open.c +++ b/src/perf_event_open.c @@ -11,7 +11,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/pppd_kallsyms.c b/src/pppd_kallsyms.c index e18e3fd..0d340ab 100644 --- a/src/pppd_kallsyms.c +++ b/src/pppd_kallsyms.c @@ -12,7 +12,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/proc-cmdline.c b/src/proc-cmdline.c index 721c164..a2005c9 100644 --- a/src/proc-cmdline.c +++ b/src/proc-cmdline.c @@ -7,7 +7,7 @@ // --- // -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/proc-config.c b/src/proc-config.c index 32187aa..89953ae 100644 --- a/src/proc-config.c +++ b/src/proc-config.c @@ -15,7 +15,7 @@ // --- // -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/proc-kallsyms.c b/src/proc-kallsyms.c index 87bad17..c868128 100644 --- a/src/proc-kallsyms.c +++ b/src/proc-kallsyms.c @@ -10,7 +10,7 @@ // --- // -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/proc-modules.c b/src/proc-modules.c index d027358..846481c 100644 --- a/src/proc-modules.c +++ b/src/proc-modules.c @@ -11,7 +11,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/proc-pid-syscall.c b/src/proc-pid-syscall.c index dc11d7e..0323b03 100644 --- a/src/proc-pid-syscall.c +++ b/src/proc-pid-syscall.c @@ -23,7 +23,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/proc-stat-wchan.c b/src/proc-stat-wchan.c index cf27160..e6c698c 100644 --- a/src/proc-stat-wchan.c +++ b/src/proc-stat-wchan.c @@ -19,7 +19,7 @@ // --- // -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/sysfs-kernel-notes-xen.c b/src/sysfs-kernel-notes-xen.c index 88fcfca..45b8db1 100644 --- a/src/sysfs-kernel-notes-xen.c +++ b/src/sysfs-kernel-notes-xen.c @@ -35,7 +35,7 @@ #endif #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/sysfs-module-sections.c b/src/sysfs-module-sections.c index aecf064..c321c07 100644 --- a/src/sysfs-module-sections.c +++ b/src/sysfs-module-sections.c @@ -11,7 +11,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/sysfs_iscsi_transport_handle.c b/src/sysfs_iscsi_transport_handle.c index 16f908c..7b1524b 100644 --- a/src/sysfs_iscsi_transport_handle.c +++ b/src/sysfs_iscsi_transport_handle.c @@ -18,7 +18,7 @@ // --- // -#include "kasld.h" +#include "include/kasld.h" #include #include #include diff --git a/src/sysfs_nf_conntrack.c b/src/sysfs_nf_conntrack.c index 11804c4..08b2545 100644 --- a/src/sysfs_nf_conntrack.c +++ b/src/sysfs_nf_conntrack.c @@ -15,7 +15,7 @@ // #define _GNU_SOURCE -#include "kasld.h" +#include "include/kasld.h" #include #include #include