twx-linux/arch/arm64/kernel/pi
Omar Sandoval 5973a62efa arm64: map [_text, _stext) virtual address range non-executable+read-only
Since the referenced fixes commit, the kernel's .text section is only
mapped starting from _stext; the region [_text, _stext) is omitted. As a
result, other vmalloc/vmap allocations may use the virtual addresses
nominally in the range [_text, _stext). This address reuse confuses
multiple things:

1. crash_prepare_elf64_headers() sets up a segment in /proc/vmcore
   mapping the entire range [_text, _end) to
   [__pa_symbol(_text), __pa_symbol(_end)). Reading an address in
   [_text, _stext) from /proc/vmcore therefore gives the incorrect
   result.
2. Tools doing symbolization (either by reading /proc/kallsyms or based
   on the vmlinux ELF file) will incorrectly identify vmalloc/vmap
   allocations in [_text, _stext) as kernel symbols.

In practice, both of these issues affect the drgn debugger.
Specifically, there were cases where the vmap IRQ stacks for some CPUs
were allocated in [_text, _stext). As a result, drgn could not get the
stack trace for a crash in an IRQ handler because the core dump
contained invalid data for the IRQ stack address. The stack addresses
were also symbolized as being in the _text symbol.

Fix this by bringing back the mapping of [_text, _stext), but now make
it non-executable and read-only. This prevents other allocations from
using it while still achieving the original goal of not mapping
unpredictable data as executable. Other than the changed protection,
this is effectively a revert of the fixes commit.

Fixes: e2a073dde921 ("arm64: omit [_text, _stext) from permanent kernel mapping")
Cc: stable@vger.kernel.org
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Will Deacon <will@kernel.org>
2025-09-22 11:58:17 +01:00
..
.gitignore arm64: gitignore: ignore relacheck 2024-02-22 21:57:52 +00:00
idreg-override.c arm64: Add override for MPAM 2025-06-02 13:49:09 +01:00
kaslr_early.c arm64/mm: Remove randomization of the linear map 2025-04-29 13:21:49 +01:00
Makefile arm64 updates for 6.17: 2025-07-29 20:21:54 -07:00
map_kernel.c arm64: map [_text, _stext) virtual address range non-executable+read-only 2025-09-22 11:58:17 +01:00
map_range.c arm64: mm: Represent physical memory with phys_addr_t and resource_size_t 2025-09-16 20:39:49 +01:00
patch-scs.c arm64/scs: Deal with 64-bit relative offsets in FDE frames 2024-11-08 16:37:55 +00:00
pi.h arm64: mm: Represent physical memory with phys_addr_t and resource_size_t 2025-09-16 20:39:49 +01:00
relacheck.c arm64: kernel: Manage absolute relocations in code built under pi/ 2024-02-16 12:42:28 +00:00
relocate.c arm64: head: Move early kernel mapping routines into C code 2024-02-16 12:42:33 +00:00