Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753199AbdLSWSK (ORCPT ); Tue, 19 Dec 2017 17:18:10 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:43743 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751524AbdLSWSH (ORCPT ); Tue, 19 Dec 2017 17:18:07 -0500 X-Google-Smtp-Source: ACJfBotP9KEt+4fa8hB9UQvawZgMo8bmqZLAya/cLNRviIf2ATV4KwI8tvKcD03CluDmuLHywngxsw== Subject: Re: [PATCH] arm64: Stop printing the virtual memory layout To: Kees Cook Cc: Will Deacon , Mark Rutland , Catalin Marinas , linux-arm-kernel@lists.infradead.org, LKML , Ard Biesheuvel References: <20171219192810.22537-1-labbott@redhat.com> From: Laura Abbott Message-ID: <8b6ff575-9ac3-6d43-2da8-e3c4c69baea1@redhat.com> Date: Tue, 19 Dec 2017 14:18:04 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3647 Lines: 88 On 12/19/2017 01:04 PM, Kees Cook wrote: > On Tue, Dec 19, 2017 at 11:28 AM, Laura Abbott wrote: >> Printing kernel addresses should be done in limited circumstances, mostly >> for debugging purposes. Printing out the virtual memory layout at every >> kernel bootup doesn't really fall into this category so delete the prints. >> There are other ways to get the same information. > > In looking at this patch, I wonder: is there anything listed here that > is _missing_ from CONFIG_PTDUMP? I would expect all of these to > already be listed there, but I thought I'd ask... > It doesn't print the .text etc. but those can be calculated other ways. > Regardless: > > Acked-by: Kees Cook > > -Kees > >> >> Signed-off-by: Laura Abbott >> --- >> Follow up to my previous proposal to switch all these to %px >> --- >> arch/arm64/mm/init.c | 43 ------------------------------------------- >> 1 file changed, 43 deletions(-) >> >> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c >> index 5960bef0170d..672094ed7e07 100644 >> --- a/arch/arm64/mm/init.c >> +++ b/arch/arm64/mm/init.c >> @@ -599,49 +599,6 @@ void __init mem_init(void) >> >> mem_init_print_info(NULL); >> >> -#define MLK(b, t) b, t, ((t) - (b)) >> 10 >> -#define MLM(b, t) b, t, ((t) - (b)) >> 20 >> -#define MLG(b, t) b, t, ((t) - (b)) >> 30 >> -#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K) >> - >> - pr_notice("Virtual kernel memory layout:\n"); >> -#ifdef CONFIG_KASAN >> - pr_notice(" kasan : 0x%16lx - 0x%16lx (%6ld GB)\n", >> - MLG(KASAN_SHADOW_START, KASAN_SHADOW_END)); >> -#endif >> - pr_notice(" modules : 0x%16lx - 0x%16lx (%6ld MB)\n", >> - MLM(MODULES_VADDR, MODULES_END)); >> - pr_notice(" vmalloc : 0x%16lx - 0x%16lx (%6ld GB)\n", >> - MLG(VMALLOC_START, VMALLOC_END)); >> - pr_notice(" .text : 0x%p" " - 0x%p" " (%6ld KB)\n", >> - MLK_ROUNDUP(_text, _etext)); >> - pr_notice(" .rodata : 0x%p" " - 0x%p" " (%6ld KB)\n", >> - MLK_ROUNDUP(__start_rodata, __init_begin)); >> - pr_notice(" .init : 0x%p" " - 0x%p" " (%6ld KB)\n", >> - MLK_ROUNDUP(__init_begin, __init_end)); >> - pr_notice(" .data : 0x%p" " - 0x%p" " (%6ld KB)\n", >> - MLK_ROUNDUP(_sdata, _edata)); >> - pr_notice(" .bss : 0x%p" " - 0x%p" " (%6ld KB)\n", >> - MLK_ROUNDUP(__bss_start, __bss_stop)); >> - pr_notice(" fixed : 0x%16lx - 0x%16lx (%6ld KB)\n", >> - MLK(FIXADDR_START, FIXADDR_TOP)); >> - pr_notice(" PCI I/O : 0x%16lx - 0x%16lx (%6ld MB)\n", >> - MLM(PCI_IO_START, PCI_IO_END)); >> -#ifdef CONFIG_SPARSEMEM_VMEMMAP >> - pr_notice(" vmemmap : 0x%16lx - 0x%16lx (%6ld GB maximum)\n", >> - MLG(VMEMMAP_START, VMEMMAP_START + VMEMMAP_SIZE)); >> - pr_notice(" 0x%16lx - 0x%16lx (%6ld MB actual)\n", >> - MLM((unsigned long)phys_to_page(memblock_start_of_DRAM()), >> - (unsigned long)virt_to_page(high_memory))); >> -#endif >> - pr_notice(" memory : 0x%16lx - 0x%16lx (%6ld MB)\n", >> - MLM(__phys_to_virt(memblock_start_of_DRAM()), >> - (unsigned long)high_memory)); >> - >> -#undef MLK >> -#undef MLM >> -#undef MLK_ROUNDUP >> - >> /* >> * Check boundaries twice: Some fundamental inconsistencies can be >> * detected at build time already. >> -- >> 2.14.3 >> > > >