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: 9594881 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 5EACC600CB for ; Tue, 28 Feb 2017 07:06:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C34E284E7 for ; Tue, 28 Feb 2017 07:06:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E638284EC; Tue, 28 Feb 2017 07:06:53 +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=ham 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 7663B284E7 for ; Tue, 28 Feb 2017 07:06:50 +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=6u9f8EmLekGesisWMIjc1Lbbp25zlTLNceeCTtALdvE=; b=iiUtDDRuPIZqQu 9F6ITd7HwkQ0AFbtbzb3F4wEWy3Xr5dLiYn6esn29v3TG69R3jvzJboZAPskPd8amscssR2HL0lrk Hxq3FV13hy/4AL01mMCPjrrfOJ8I2Yir61O/oqxF0HZcfMiOXf8FOl2tpDXbYXcSERPgWJmERg3b/ mtJsdlySlxpLvNmYYezlpIABvXaUYQ6sXEyxVAsHZLG50fLqnah1DBRaln3YV6GdUBIWLCoYVQ0Ty sklSZj0uTA43FXPzy8BO9KFRvsXnKpjlLZsCduEv46CAw6ZFlbQzO6oISwAljSeBdKTv9nyt/XpJS y+OemkEPCrN9UZMmr8Cg==; 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 1cibrp-0005Xf-Tm; Tue, 28 Feb 2017 07:06:42 +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-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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]) {