Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp725575imm; Thu, 13 Sep 2018 06:53:24 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbn0EGDgveqdhegmqmc8bPQhquHKQpEA7xmVQV/+YbpUaD2U5Y0vRaoPHK1c30C+g+YWvtQ X-Received: by 2002:a17:902:b03:: with SMTP id 3-v6mr7590789plq.156.1536846804169; Thu, 13 Sep 2018 06:53:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846804; cv=none; d=google.com; s=arc-20160816; b=NS9hRHZjTmh+P+fIen2gEX1hUkVLe339qwz9KjGKePSPvEngv2Ike4+kNqHeNfa848 ZLIB7XL7ppwpeCfAKzCkTE+WQ8r5/ojAAqg5S7pugPgryoMA47HLbd0vXbLaLS3op7A9 1FPX86xmSBfC91FQNfM/pCczBHnshHNAmPgH2Iy2s1uvKvUX9oiPEEECTWSliintZeyw DFtjHa1QcHgdwscE8ViNlLE10Th+4Jjzd6l2KJy5eUdBRY6VxxM4pWDmiB9iFbzrsy5D bHe9UfQippBnBVKAaJEBHGqWDRrctBU/LUG13txZZ+AJBbTkpJO0hpgdLRG7UPeFU2cq 2LTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=f1abH1s9NGJ2ppftY86XkLs3DMTjyll0BXgzDX42jWs=; b=HwTZ4SdJAKd7HMiY3g3xoCFWiK5+2CtPcwComSxWh2HvvLJ3DjmT+xpLEHqhaVB/Nb iPSQ5z7oEPzkLbxXY59NMcnfv1Xma8CftQ/RfqCOq/o6gtIJ8mjx7341c3dITB4/JLWM G2V0WG9g0Vc1zQ4XDnLCLyAQip1nByTMNz89pJEt5qYTqOm57CtDG2xiL+e0cUfb7dL7 KUNWKG+iikU6q6YvEFv3Ou8zBP/fIqCrnfeFuh7H4I4X2gq5XCsCincYnikCbe74InJ7 0kn1oOT1hvgGGdBvbX7Eigzmh3CHRivxXuoSPpPHqC6dlCV6Cixj1Ya8c6IQYwrdMF1E vVGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a95-v6si4230722pla.514.2018.09.13.06.53.08; Thu, 13 Sep 2018 06:53:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731057AbeIMTCg (ORCPT + 99 others); Thu, 13 Sep 2018 15:02:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33600 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730002AbeIMTCf (ORCPT ); Thu, 13 Sep 2018 15:02:35 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 61EBFCE7; Thu, 13 Sep 2018 13:52:59 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Morse , Alexey Dobriyan , Omar Sandoval , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.18 047/197] fs/proc/kcore.c: use __pa_symbol() for KCORE_TEXT list entries Date: Thu, 13 Sep 2018 15:29:56 +0200 Message-Id: <20180913131843.426055535@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- fs/proc/kcore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -384,8 +384,10 @@ static void elf_kcore_store_hdr(char *bu phdr->p_flags = PF_R|PF_W|PF_X; phdr->p_offset = kc_vaddr_to_offset(m->addr) + dataoff; phdr->p_vaddr = (size_t)m->addr; - if (m->type == KCORE_RAM || m->type == KCORE_TEXT) + if (m->type == KCORE_RAM) phdr->p_paddr = __pa(m->addr); + else if (m->type == KCORE_TEXT) + phdr->p_paddr = __pa_symbol(m->addr); else phdr->p_paddr = (elf_addr_t)-1; phdr->p_filesz = phdr->p_memsz = m->size;