From patchwork Thu Mar 5 15:01:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Sankar X-Patchwork-Id: 11422025 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB5FA92A for ; Thu, 5 Mar 2020 15:02:09 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id C642120801 for ; Thu, 5 Mar 2020 15:02:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C642120801 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alum.mit.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-18071-patchwork-kernel-hardening=patchwork.kernel.org@lists.openwall.com Received: (qmail 1828 invoked by uid 550); 5 Mar 2020 15:02:06 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 1796 invoked from network); 5 Mar 2020 15:02:05 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G+99kCRYMzeEWVxPvUrg7nF1DV74zPu+cLQl+vuE6tE=; b=ikgQK95PV7J6MqEfek1UMDx4AAwvahztyM5/jz0wszEI97hC02/dpziXlCFKkpJ5uO tQcb645funOi/zSyniOq4xolxmXfPnTKWvPPaUilyy1xlffNZaiNHUB8ced6CErT1yFp barwGAlqA63ZLicUOKjeDdHwNH2L7yz1fiCLPbaaCTRtg8+cy7xcJ0WvGJC8qHuD2RtO xByC2RE/yKK0nlQjuBG2HAeduyCZ50qPAlb6eHJ+8hmLGllYoC9y8pceZek7rXNAe/Ss l+dt0pOD+0m6eBeW9G7NqtvBs7BHIpP+nZVbfoMRhrP8m7lcdnRWrzb0Vfosv/xY8krq LG6Q== X-Gm-Message-State: ANhLgQ1pEOXTaOm1OQ/6QTGBf+Z1gkGBChfg+J5EZEqTo7qXkrJHvkE1 bmCdeR2w8QDnwzo+6o24Hbc= X-Google-Smtp-Source: ADFU+vun+lE3H+kFlVWifa921exuOdYo+CsuSTA28nIHTavPtrQtBcLZ/jpFo/8YRdLeTKv6qbbgJg== X-Received: by 2002:a37:a14a:: with SMTP id k71mr8329570qke.321.1583420513686; Thu, 05 Mar 2020 07:01:53 -0800 (PST) From: Arvind Sankar To: Kees Cook Cc: "Tobin C . Harding" , Tycho Andersen , kernel-hardening@lists.openwall.com, Dave Hansen , Andy Lutomirski , Peter Zijlstra , x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] x86/mm/init_32: Stop printing the virtual memory layout Date: Thu, 5 Mar 2020 10:01:52 -0500 Message-Id: <20200305150152.831697-1-nivedita@alum.mit.edu> X-Mailer: git-send-email 2.24.1 In-Reply-To: <202003021039.257258E1B@keescook> References: <202003021039.257258E1B@keescook> MIME-Version: 1.0 For security, don't display the kernel's virtual memory layout. Kees Cook points out: "These have been entirely removed on other architectures, so let's just do the same for ia32 and remove it unconditionally." 071929dbdd86 ("arm64: Stop printing the virtual memory layout") 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout") 31833332f798 ("m68k/mm: Stop printing the virtual memory layout") fd8d0ca25631 ("parisc: Hide virtual kernel memory layout") adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()") Signed-off-by: Arvind Sankar Acked-by: Kees Cook Acked-by: Tycho Andersen --- arch/x86/mm/init_32.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 23df4885bbed..8ae0272c1c51 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c @@ -788,44 +788,6 @@ void __init mem_init(void) x86_init.hyper.init_after_bootmem(); mem_init_print_info(NULL); - printk(KERN_INFO "virtual kernel memory layout:\n" - " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" - " cpu_entry : 0x%08lx - 0x%08lx (%4ld kB)\n" -#ifdef CONFIG_HIGHMEM - " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n" -#endif - " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" - " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n" - " .init : 0x%08lx - 0x%08lx (%4ld kB)\n" - " .data : 0x%08lx - 0x%08lx (%4ld kB)\n" - " .text : 0x%08lx - 0x%08lx (%4ld kB)\n", - FIXADDR_START, FIXADDR_TOP, - (FIXADDR_TOP - FIXADDR_START) >> 10, - - CPU_ENTRY_AREA_BASE, - CPU_ENTRY_AREA_BASE + CPU_ENTRY_AREA_MAP_SIZE, - CPU_ENTRY_AREA_MAP_SIZE >> 10, - -#ifdef CONFIG_HIGHMEM - PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE, - (LAST_PKMAP*PAGE_SIZE) >> 10, -#endif - - VMALLOC_START, VMALLOC_END, - (VMALLOC_END - VMALLOC_START) >> 20, - - (unsigned long)__va(0), (unsigned long)high_memory, - ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20, - - (unsigned long)&__init_begin, (unsigned long)&__init_end, - ((unsigned long)&__init_end - - (unsigned long)&__init_begin) >> 10, - - (unsigned long)&_etext, (unsigned long)&_edata, - ((unsigned long)&_edata - (unsigned long)&_etext) >> 10, - - (unsigned long)&_text, (unsigned long)&_etext, - ((unsigned long)&_etext - (unsigned long)&_text) >> 10); /* * Check boundaries twice: Some fundamental inconsistencies can