Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2840021imm; Sun, 5 Aug 2018 13:35:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdDySNcK8ctRa0UWCpPrZHUNkBITu8rrnt7hl6QRPAX5c8uViLY9jWBFvSobmjGWDgRfW+D X-Received: by 2002:a63:4924:: with SMTP id w36-v6mr12043081pga.143.1533501302497; Sun, 05 Aug 2018 13:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533501302; cv=none; d=google.com; s=arc-20160816; b=WZuJsvMwLROWwBZWHA6zM9jza3Mme1Rep/brYEbn/djhyDTiHefan3o0Q2+WZ+QDh5 vXy/E4/mY2nqW9/w5YgWf429OHSnZUfJ28Mnhe0aFfiPYfwxv8YqkOGvLZ3cTbOhtdQ0 Ibvwkd8pHwINKeqqQ9YWcWPWjb69uj9aQSG+vIZZe9YRI7EoZ4pqiE9EK3DJcltv20AO MTMmU5W00bl5SsQ4+XSMA6NpTu701v18UBmMmY3sYbUFT64OOVfmw+XQFNg4ICpgj1mz GPb8JBFj7XB1kTiUGJqO3CiMB4zAh4zXCz0KkvHHG3FzB+kg/e67WWx80+YoHsT0+gwr OMbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=fivngLRXcLtAhH/7R+GGNGN0kBKXix4Z+6/J1Jg+5mY=; b=DOTOt+ziyNvrR59Ktf3rlrJH027/gP54GV93uxE636b0ka9FKo0+ncKxqwfZC3aNF5 4yH17tmzQ8sPnDmtRFdVdsMYk/rrk276O0xgsnQ1BDzgxx4eEZoNLiYCLq3NenHVIHl5 YeVK13OyGAZbm2+BAJOPXtUiDYaYUWOUURjSf7xdfEyxCk4JtRhdmn3GT2rZX3w1w3Tc jxmXICjgnUyQfEzKShK7BU2NKsnq4j65SjKMhlXcBTo0gd1StKJbbifSWVgyyBrctQ5p S1RS+wlVZg7Kxl5sP3KmTDDF2WJ8vTFp4nW+66z2zQKxXzw7LMXJ1JUYrOa61i+Tiget Anyw== 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 t11-v6si8368295plq.265.2018.08.05.13.34.28; Sun, 05 Aug 2018 13:35:02 -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 S1727580AbeHEWi0 (ORCPT + 99 others); Sun, 5 Aug 2018 18:38:26 -0400 Received: from terminus.zytor.com ([198.137.202.136]:47941 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726769AbeHEWi0 (ORCPT ); Sun, 5 Aug 2018 18:38:26 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w75KVtWH590214 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 5 Aug 2018 13:31:55 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w75KVteL590211; Sun, 5 Aug 2018 13:31:55 -0700 Date: Sun, 5 Aug 2018 13:31:55 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Dave Hansen Message-ID: Cc: hpa@zytor.com, aarcange@redhat.com, keescook@google.com, linux-kernel@vger.kernel.org, mingo@kernel.org, gregkh@linuxfoundation.org, luto@kernel.org, hughd@google.com, torvalds@linux-foundation.org, dave.hansen@linux.intel.com, peterz@infradead.org, jgross@suse.com, jpoimboe@redhat.com, tglx@linutronix.de, ak@linux.intel.com, bp@alien8.de Reply-To: keescook@google.com, hpa@zytor.com, aarcange@redhat.com, linux-kernel@vger.kernel.org, mingo@kernel.org, hughd@google.com, luto@kernel.org, gregkh@linuxfoundation.org, torvalds@linux-foundation.org, dave.hansen@linux.intel.com, peterz@infradead.org, jgross@suse.com, jpoimboe@redhat.com, tglx@linutronix.de, bp@alien8.de, ak@linux.intel.com In-Reply-To: <20180802225828.89B2D0E2@viggo.jf.intel.com> References: <20180802225828.89B2D0E2@viggo.jf.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/mm/init: Pass unconverted symbol addresses to free_init_pages() Git-Commit-ID: 9f515cdb411ef34f1aaf4c40bb0c932cf6db5de1 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 9f515cdb411ef34f1aaf4c40bb0c932cf6db5de1 Gitweb: https://git.kernel.org/tip/9f515cdb411ef34f1aaf4c40bb0c932cf6db5de1 Author: Dave Hansen AuthorDate: Thu, 2 Aug 2018 15:58:28 -0700 Committer: Thomas Gleixner CommitDate: Sun, 5 Aug 2018 22:21:02 +0200 x86/mm/init: Pass unconverted symbol addresses to free_init_pages() The x86 code has several places where it frees parts of kernel image: 1. Unused SMP alternative 2. __init code 3. The hole between text and rodata 4. The hole between rodata and data We call free_init_pages() to do this. Strangely, we convert the symbol addresses to kernel direct map addresses in some cases (#3, #4) but not others (#1, #2). The virt_to_page() and the other code in free_reserved_area() now works fine for for symbol addresses on x86, so don't bother converting the addresses to direct map addresses before freeing them. Signed-off-by: Dave Hansen Signed-off-by: Thomas Gleixner Cc: keescook@google.com Cc: aarcange@redhat.com Cc: jgross@suse.com Cc: jpoimboe@redhat.com Cc: gregkh@linuxfoundation.org Cc: peterz@infradead.org Cc: hughd@google.com Cc: torvalds@linux-foundation.org Cc: bp@alien8.de Cc: luto@kernel.org Cc: ak@linux.intel.com Cc: Kees Cook Cc: Andrea Arcangeli Cc: Juergen Gross Cc: Josh Poimboeuf Cc: Greg Kroah-Hartman Cc: Peter Zijlstra Cc: Hugh Dickins Cc: Linus Torvalds Cc: Borislav Petkov Cc: Andy Lutomirski Cc: Andi Kleen Link: https://lkml.kernel.org/r/20180802225828.89B2D0E2@viggo.jf.intel.com --- arch/x86/mm/init_64.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index a688617c727e..73158655c4a7 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1283,12 +1283,8 @@ void mark_rodata_ro(void) set_memory_ro(start, (end-start) >> PAGE_SHIFT); #endif - free_init_pages("unused kernel", - (unsigned long) __va(__pa_symbol(text_end)), - (unsigned long) __va(__pa_symbol(rodata_start))); - free_init_pages("unused kernel", - (unsigned long) __va(__pa_symbol(rodata_end)), - (unsigned long) __va(__pa_symbol(_sdata))); + free_init_pages("unused kernel", text_end, rodata_start); + free_init_pages("unused kernel", rodata_end, _sdata); debug_checkwx();