diff options
author | Mark Rutland <mark.rutland@arm.com> | 2022-07-13 16:09:49 +0200 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2022-07-20 17:08:10 +0200 |
commit | 1191b6256e50a07e7d8ce36eb970708e42a4be1a (patch) | |
tree | c58b828600bf30c24250f68dcd7122c7ed5ecfab /arch/arm64/kernel/idreg-override.c | |
parent | arm64: Add an override for ID_AA64SMFR0_EL1.FA64 (diff) | |
download | linux-1191b6256e50a07e7d8ce36eb970708e42a4be1a.tar.xz linux-1191b6256e50a07e7d8ce36eb970708e42a4be1a.zip |
arm64: fix KASAN_INLINE
Since commit:
a004393f45d9a55e ("arm64: idreg-override: use early FDT mapping in ID map")
Kernels built with KASAN_INLINE=y die early in boot before producing any
console output. This is because the accesses made to the FDT (e.g. in
generic string processing functions) are instrumented with KASAN, and
with KASAN_INLINE=y any access to an address in TTBR0 results in a bogus
shadow VA, resulting in a data abort.
This patch fixes this by reverting commits:
7559d9f97581654f ("arm64: setup: drop early FDT pointer helpers")
bd0c3fa21878b6d0 ("arm64: idreg-override: use early FDT mapping in ID map")
... and using the TTBR1 fixmap mapping of the FDT.
Note that due to a later commit:
b65e411d6cc2f12a ("arm64: Save state of HCR_EL2.E2H before switch to EL1")
... which altered the prototype of init_feature_override() (and
invocation from head.S), commit bd0c3fa21878b6d0 does not revert
cleanly, and I've fixed that up manually.
Fixes: a004393f45d9 ("arm64: idreg-override: use early FDT mapping in ID map")
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Will Deacon <will@kernel.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20220713140949.45440-1-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/kernel/idreg-override.c')
-rw-r--r-- | arch/arm64/kernel/idreg-override.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index aa2a53d0d417..7206fd0ed9eb 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -262,11 +262,16 @@ static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) } while (1); } -static __init const u8 *get_bootargs_cmdline(const void *fdt) +static __init const u8 *get_bootargs_cmdline(void) { const u8 *prop; + void *fdt; int node; + fdt = get_early_fdt_ptr(); + if (!fdt) + return NULL; + node = fdt_path_offset(fdt, "/chosen"); if (node < 0) return NULL; @@ -278,9 +283,9 @@ static __init const u8 *get_bootargs_cmdline(const void *fdt) return strlen(prop) ? prop : NULL; } -static __init void parse_cmdline(const void *fdt) +static __init void parse_cmdline(void) { - const u8 *prop = get_bootargs_cmdline(fdt); + const u8 *prop = get_bootargs_cmdline(); if (IS_ENABLED(CONFIG_CMDLINE_FORCE) || !prop) __parse_cmdline(CONFIG_CMDLINE, true); @@ -290,9 +295,9 @@ static __init void parse_cmdline(const void *fdt) } /* Keep checkers quiet */ -void init_feature_override(const void *fdt, u64 boot_status); +void init_feature_override(u64 boot_status); -asmlinkage void __init init_feature_override(const void *fdt, u64 boot_status) +asmlinkage void __init init_feature_override(u64 boot_status) { int i; @@ -305,7 +310,7 @@ asmlinkage void __init init_feature_override(const void *fdt, u64 boot_status) __boot_status = boot_status; - parse_cmdline(fdt); + parse_cmdline(); for (i = 0; i < ARRAY_SIZE(regs); i++) { if (regs[i]->override) |