From patchwork Tue Feb 28 07:05:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miles Chen X-Patchwork-Id: 9594883 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 982E0600CB for ; Tue, 28 Feb 2017 07:06:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 880F1284E7 for ; Tue, 28 Feb 2017 07:06:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C5E2284EC; Tue, 28 Feb 2017 07:06:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2BCD9284E7 for ; Tue, 28 Feb 2017 07:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=b0A8uG/EZJGodfd+S/lgM26na99rhCdyDuU4ds3ieCc=; b=iEUlpKTEsu2deJ kHNvJJB82RHoJY3MNzdJenSnDcyGdOpN+P3ANBjVAHKSHVi/Mkqb2eyd/VScSc0BzUdGg17A2f/y6 kNJbmvtIWJekbQcvcPPRD2ykARfriSLJelB8d/InMgvzOXaU8t9rnhFChJgRxHGaf09YQzt5L5vs7 88BFlvyglNLxP5B9zFEZvAKiwvPbjvIMGcrTOTurE5Kh0TRbzIK12q2VLlrQDKO1dXureJ2V7aKJQ jIDZxMj1f4eKNqqZYNnnCtWSOW0oCTQ9DOKGYuxhPSsfRANHds1F4GR62NbKMnXa5rsxPQuOfvUsI cc/lDHMhoCdrUIYtDiOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cibs6-0005pN-T6; Tue, 28 Feb 2017 07:06:54 +0000 Received: from [210.61.82.184] (helo=mailgw02.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cibrQ-0005VX-BT; Tue, 28 Feb 2017 07:06:14 +0000 Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 628128257; Tue, 28 Feb 2017 15:05:38 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Tue, 28 Feb 2017 15:05:37 +0800 From: Miles Chen To: Catalin Marinas , Will Deacon Subject: [PATCH] arm64: dump: hide kernel pointers Date: Tue, 28 Feb 2017 15:05:36 +0800 Message-ID: <1488265536-20441-1-git-send-email-miles.chen@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170227_230612_714453_DDF02AEB X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miles Chen , linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, wsd_upstream@mediatek.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Mask kernel pointers of /sys/kernel/debug/kernel_page_tables entry like /proc/vmallocinfo does. With sysctl kernel.kptr_restrict=0 or 1: cat /sys/kernel/debug/kernel_page_tables ---[ Modules start ]--- ---[ Modules end ]--- ---[ vmalloc() Area ]--- ffffff8008000000-ffffff8008010000 64K PTE RW NX SHD AF... ffffff8008015000-ffffff8008016000 4K PTE RW NX SHD AF... ffffff8008020000-ffffff8008030000 64K PTE RW NX SHD AF... ffffff8008031000-ffffff8008071000 256K PTE RW NX SHD AF... ffffff8008080000-ffffff8008200000 1536K PTE ro x SHD AF... ffffff8008200000-ffffff8008400000 2M PMD ro x SHD AF... ffffff8008400000-ffffff8008540000 1280K PTE ro x SHD AF... ffffff8008540000-ffffff8008690000 1344K PTE ro NX SHD AF... ffffff8008940000-ffffff8008a10000 832K PTE RW NX SHD AF... ffffff8008aca000-ffffff8008acd000 12K PTE RW NX SHD AF... ffffffbebffd8000-ffffffbebffdb000 12K PTE RW NX SHD AF... ---[ vmalloc() End ]--- ---[ Fixmap start ]--- ffffffbefe800000-ffffffbefea00000 2M PMD ro NX SHD AF... ---[ Fixmap end ]--- ---[ PCI I/O start ]--- ---[ PCI I/O end ]--- ---[ Linear Mapping ]--- ffffffc000000000-ffffffc000080000 512K PTE RW NX SHD AF... ffffffc000080000-ffffffc000200000 1536K PTE ro NX SHD AF... ffffffc000200000-ffffffc000600000 4M PMD ro NX SHD AF... ffffffc000600000-ffffffc000690000 576K PTE ro NX SHD AF... ffffffc000690000-ffffffc000800000 1472K PTE RW NX SHD AF... ffffffc000800000-ffffffc002000000 24M PMD RW NX SHD AF... ffffffc002000000-ffffffc040000000 992M PMD RW NX SHD AF... ffffffc040000000-ffffffc080000000 1G PGD RW NX SHD AF... With sysctl kernel.kptr_restrict=2: cat /sys/kernel/debug/kernel_page_tables ---[ Modules start ]--- ---[ Modules end ]--- ---[ vmalloc() Area ]--- 0000000000000000-0000000000000000 64K PTE RW NX SHD AF... 0000000000000000-0000000000000000 4K PTE RW NX SHD AF... 0000000000000000-0000000000000000 64K PTE RW NX SHD AF... 0000000000000000-0000000000000000 256K PTE RW NX SHD AF... 0000000000000000-0000000000000000 1536K PTE ro x SHD AF... 0000000000000000-0000000000000000 2M PMD ro x SHD AF... 0000000000000000-0000000000000000 1280K PTE ro x SHD AF... 0000000000000000-0000000000000000 1344K PTE ro NX SHD AF... 0000000000000000-0000000000000000 832K PTE RW NX SHD AF... 0000000000000000-0000000000000000 12K PTE RW NX SHD AF... 0000000000000000-0000000000000000 12K PTE RW NX SHD AF... ---[ vmalloc() End ]--- ---[ Fixmap start ]--- 0000000000000000-0000000000000000 2M PMD ro NX SHD AF... ---[ Fixmap end ]--- ---[ PCI I/O start ]--- ---[ PCI I/O end ]--- ---[ Linear Mapping ]--- 0000000000000000-0000000000000000 512K PTE RW NX SHD AF... 0000000000000000-0000000000000000 1536K PTE ro NX SHD AF... 0000000000000000-0000000000000000 4M PMD ro NX SHD AF... 0000000000000000-0000000000000000 576K PTE ro NX SHD AF... 0000000000000000-0000000000000000 1472K PTE RW NX SHD AF... 0000000000000000-0000000000000000 24M PMD RW NX SHD AF... 0000000000000000-0000000000000000 992M PMD RW NX SHD AF... 0000000000000000-0000000000000000 1G PGD RW NX SHD AF... Signed-off-by: Miles Chen --- arch/arm64/mm/dump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index ca74a2a..e055ecf 100644 --- a/arch/arm64/mm/dump.c +++ b/arch/arm64/mm/dump.c @@ -253,8 +253,8 @@ static void note_page(struct pg_state *st, unsigned long addr, unsigned level, if (st->current_prot) { note_prot_uxn(st, addr); note_prot_wx(st, addr); - pt_dump_seq_printf(st->seq, "0x%016lx-0x%016lx ", - st->start_address, addr); + pt_dump_seq_printf(st->seq, "%pK-%pK ", + (void *)st->start_address, (void *)addr); delta = (addr - st->start_address) >> 10; while (!(delta & 1023) && unit[1]) {