From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr730136.outbound.protection.outlook.com ([40.107.73.136]:59395 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727205AbeH3WEo (ORCPT ); Thu, 30 Aug 2018 18:04:44 -0400 From: Sasha Levin To: "stable@vger.kernel.org" CC: James Morse , Alexey Dobriyan , Omar Sandoval , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH AUTOSEL 4.18 011/113] fs/proc/kcore.c: use __pa_symbol() for KCORE_TEXT list entries Date: Thu, 30 Aug 2018 18:01:22 +0000 Message-ID: <20180830180050.35735-11-alexander.levin@microsoft.com> References: <20180830180050.35735-1-alexander.levin@microsoft.com> In-Reply-To: <20180830180050.35735-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: James Morse [ Upstream commit df865e8337c397471b95f51017fea559bc8abb4a ] 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 Cc: Alexey Dobriyan Cc: Omar Sandoval Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/proc/kcore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index e64ecb9f2720..66c373230e60 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -384,8 +384,10 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr,= int dataoff) phdr->p_flags =3D PF_R|PF_W|PF_X; phdr->p_offset =3D kc_vaddr_to_offset(m->addr) + dataoff; phdr->p_vaddr =3D (size_t)m->addr; - if (m->type =3D=3D KCORE_RAM || m->type =3D=3D KCORE_TEXT) + if (m->type =3D=3D KCORE_RAM) phdr->p_paddr =3D __pa(m->addr); + else if (m->type =3D=3D KCORE_TEXT) + phdr->p_paddr =3D __pa_symbol(m->addr); else phdr->p_paddr =3D (elf_addr_t)-1; phdr->p_filesz =3D phdr->p_memsz =3D m->size; --=20 2.17.1