Skip to content

Commit df865e8

Browse files
James Morsetorvalds
authored andcommitted
fs/proc/kcore.c: use __pa_symbol() for KCORE_TEXT list entries
elf_kcore_store_hdr() uses __pa() to find the physical address of KCORE_RAM or KCORE_TEXT entries exported as program headers. This trips CONFIG_DEBUG_VIRTUAL's checks, as the KCORE_TEXT entries are not in the linear map. Handle these two cases separately, using __pa_symbol() for the KCORE_TEXT entries. Link: http://lkml.kernel.org/r/20180711131944.15252-1-james.morse@arm.com Signed-off-by: James Morse <james.morse@arm.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Omar Sandoval <osandov@fb.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 36f0620 commit df865e8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎fs/proc/kcore.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,10 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
384384
phdr->p_flags = PF_R|PF_W|PF_X;
385385
phdr->p_offset = kc_vaddr_to_offset(m->addr) + dataoff;
386386
phdr->p_vaddr = (size_t)m->addr;
387-
if (m->type == KCORE_RAM || m->type == KCORE_TEXT)
387+
if (m->type == KCORE_RAM)
388388
phdr->p_paddr = __pa(m->addr);
389+
else if (m->type == KCORE_TEXT)
390+
phdr->p_paddr = __pa_symbol(m->addr);
389391
else
390392
phdr->p_paddr = (elf_addr_t)-1;
391393
phdr->p_filesz = phdr->p_memsz = m->size;

0 commit comments

Comments
 (0)