mirror of
https://github.com/crash-utility/crash
synced 2025-02-21 16:06:49 +00:00
Fix for the determination of the ARM64 phys_offset value when
running live against /proc/kcore. Without the patch, the message "WARNING: cannot access vmalloc'd module memory" may be displayed during session initialization, and vmalloc/module memory will be unaccessible. It should be noted that at the time of this patch, the upstream (4.16.0) version of /proc/kcore does not work correctly for ARM64, because PT_LOAD segments for unity-mapped blocks of physical memory are not generated. (anderson@redhat.com)
This commit is contained in:
parent
6504149678
commit
d66564ae3a
7
arm64.c
7
arm64.c
@ -443,7 +443,7 @@ arm64_verify_symbol(const char *name, ulong value, char type)
|
||||
machdep->machspec->kernel_flags = le64toh(value);
|
||||
|
||||
if ((type == 'A') && STREQ(name, "_kernel_flags_le_hi32"))
|
||||
machdep->machspec->kernel_flags |= (le32toh(value) << 32);
|
||||
machdep->machspec->kernel_flags |= ((ulong)le32toh(value) << 32);
|
||||
|
||||
if ((type == 'A') && STREQ(name, "_kernel_flags_le_lo32"))
|
||||
machdep->machspec->kernel_flags |= le32toh(value);
|
||||
@ -842,7 +842,10 @@ arm64_calc_phys_offset(void)
|
||||
|
||||
if ((machdep->flags & NEW_VMEMMAP) &&
|
||||
ms->kimage_voffset && (sp = kernel_symbol_search("memstart_addr"))) {
|
||||
paddr = sp->value - machdep->machspec->kimage_voffset;
|
||||
if (pc->flags & PROC_KCORE)
|
||||
paddr = KCORE_USE_VADDR;
|
||||
else
|
||||
paddr = sp->value - machdep->machspec->kimage_voffset;
|
||||
if (READMEM(pc->mfd, &phys_offset, sizeof(phys_offset),
|
||||
sp->value, paddr) > 0) {
|
||||
ms->phys_offset = phys_offset;
|
||||
|
1
defs.h
1
defs.h
@ -184,6 +184,7 @@ static inline int string_exists(char *s) { return (s ? TRUE : FALSE); }
|
||||
typedef uint64_t physaddr_t;
|
||||
|
||||
#define PADDR_NOT_AVAILABLE (0x1ULL)
|
||||
#define KCORE_USE_VADDR (-1ULL)
|
||||
|
||||
typedef unsigned long long int ulonglong;
|
||||
struct number_option {
|
||||
|
27
netdump.c
27
netdump.c
@ -1,7 +1,7 @@
|
||||
/* netdump.c
|
||||
*
|
||||
* Copyright (C) 2002-2017 David Anderson
|
||||
* Copyright (C) 2002-2017 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2002-2018 David Anderson
|
||||
* Copyright (C) 2002-2018 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -4098,19 +4098,26 @@ read_proc_kcore(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)
|
||||
Elf64_Phdr *lp64;
|
||||
off_t offset;
|
||||
|
||||
if (!machdep->verify_paddr(paddr)) {
|
||||
if (CRASHDEBUG(1))
|
||||
error(INFO, "verify_paddr(%lx) failed\n", paddr);
|
||||
return READ_ERROR;
|
||||
if (paddr != KCORE_USE_VADDR) {
|
||||
if (!machdep->verify_paddr(paddr)) {
|
||||
if (CRASHDEBUG(1))
|
||||
error(INFO, "verify_paddr(%lx) failed\n", paddr);
|
||||
return READ_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Turn the physical address into a unity-mapped kernel
|
||||
* virtual address, which should work for 64-bit architectures,
|
||||
* and for lowmem access for 32-bit architectures.
|
||||
* Unless specified otherwise, turn the physical address into
|
||||
* a unity-mapped kernel virtual address, which should work
|
||||
* for 64-bit architectures, and for lowmem access for 32-bit
|
||||
* architectures.
|
||||
*/
|
||||
if (paddr == KCORE_USE_VADDR)
|
||||
kvaddr = addr;
|
||||
else
|
||||
kvaddr = PTOV((ulong)paddr);
|
||||
|
||||
offset = UNINITIALIZED;
|
||||
kvaddr = PTOV((ulong)paddr);
|
||||
readcnt = cnt;
|
||||
|
||||
switch (pkd->flags & (KCORE_ELF32|KCORE_ELF64))
|
||||
|
Loading…
Reference in New Issue
Block a user