Received: by 10.223.185.116 with SMTP id b49csp6251911wrg; Wed, 28 Feb 2018 06:29:19 -0800 (PST) X-Google-Smtp-Source: AH8x226leCOSkgbBYYnM0y+eayUW8QCQ4CXriJCfKjxoz+oEQ/0pPkRNzPdlUKUEJXJbVAuIlf8Z X-Received: by 2002:a17:902:8488:: with SMTP id c8-v6mr18252011plo.155.1519828159201; Wed, 28 Feb 2018 06:29:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519828159; cv=none; d=google.com; s=arc-20160816; b=o7zr3+NGxqvd+maUlYxt6ExklM17KNwpPFb1k1SKlbgNMQL2qrVDs0VbD+iRL0oDao oKwCUwek1SLhV50uWU0xtuU1PnXxR7Y1b7CGzADrpMiZ4Vst9Cczfc53+4yAoBrQajIZ wZ12bEkpPl1Rq+G9aAyYLj7XE4UzBNLDXpmxZ9VFFShDbiT19H83p/Z6uTzKpKGK5z4R TaK0XkAjLOiA5wG76weaYk0lQ5VJQqjpccb2+LT/3E9DR3A3cG7mbxUG8yKfrgUmzJ58 QHu0LjsOXEs3gMRiBJvNuFUYUHrNgqtgbJGl6Q2d0q7Lwn4AQB8LJtYoLCPLTF/Dm9bt GKvw== 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=VJ2yNPJCy/G5kkuX5/eLQFJ+PGQkXFvRmD+IwYk0Mz8=; b=clspAJvtdVvcar7bUllevUAowwNJqwh0N2APjk0xvg6kOzLlwINTru/msEEPtHwDOL e4pTDXJ1dZVt1RWTiusXBHA0xEAlvGxKsMF4wxikUcJwbaT68qhVHGlM6RkIy+yQex+i xADUQK0fLmqCZmtuH6QjLn1vOeuzTmgAGLCEEml5Ons98gobSMtNtmggunW2ijojPHif rlqxu9OA86LpQv9kei0gmTs+aTJc6q0gjX6BGMFxF8+e1HWD6XrRnqObEx9jcZwuDzr1 H99tN8SEh4+1neb8TQoP85+i7tliXNT7G9D3un5EBtO1X9U0/xhW9MbGIHGwQmlWyjUw nlNQ== 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 71-v6si1366483plf.575.2018.02.28.06.29.04; Wed, 28 Feb 2018 06:29:19 -0800 (PST) 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 S1752718AbeB1O2K (ORCPT + 99 others); Wed, 28 Feb 2018 09:28:10 -0500 Received: from terminus.zytor.com ([198.137.202.136]:36355 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752447AbeB1O2I (ORCPT ); Wed, 28 Feb 2018 09:28:08 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w1SERl87026587; Wed, 28 Feb 2018 06:27:47 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w1SERkot026583; Wed, 28 Feb 2018 06:27:46 -0800 Date: Wed, 28 Feb 2018 06:27:46 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Tom Lendacky Message-ID: Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, thomas.lendacky@amd.com, hpa@zytor.com, kirill.shutemov@linux.intel.com, bp@alien8.de, bp@suse.de, mingo@kernel.org, torvalds@linux-foundation.org Reply-To: kirill.shutemov@linux.intel.com, bp@alien8.de, bp@suse.de, mingo@kernel.org, torvalds@linux-foundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, thomas.lendacky@amd.com, hpa@zytor.com In-Reply-To: <20180226232554.14108.16881.stgit@tlendack-t1.amdoffice.net> References: <20180226232554.14108.16881.stgit@tlendack-t1.amdoffice.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/mm/sme: Disable stack protection for mem_encrypt_identity.c Git-Commit-ID: ae8d1d0061ad7996c2c5e769e809a593544fa145 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 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: ae8d1d0061ad7996c2c5e769e809a593544fa145 Gitweb: https://git.kernel.org/tip/ae8d1d0061ad7996c2c5e769e809a593544fa145 Author: Tom Lendacky AuthorDate: Mon, 26 Feb 2018 17:25:54 -0600 Committer: Thomas Gleixner CommitDate: Wed, 28 Feb 2018 15:24:12 +0100 x86/mm/sme: Disable stack protection for mem_encrypt_identity.c Stack protection is not compatible with early boot code. All of the early SME boot code is now isolated in a separate file, mem_encrypt_identity.c, so arch/x86/mm/Makefile can be updated to turn off stack protection for the entire file. This eliminates the need to worry about other functions within the file being instrumented with stack protection (as was seen when a newer version of GCC instrumented sme_encrypt_kernel() where an older version hadn't). It also allows removal of the __nostackprotector attribute from individual functions. Signed-off-by: Tom Lendacky Signed-off-by: Thomas Gleixner Reviewed-by: Borislav Petkov Acked-by: Kirill A. Shutemov Cc: Linus Torvalds Cc: Borislav Petkov Link: https://lkml.kernel.org/r/20180226232554.14108.16881.stgit@tlendack-t1.amdoffice.net --- arch/x86/mm/Makefile | 1 + arch/x86/mm/mem_encrypt_identity.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile index 03c6c8561623..4b101dd6e52f 100644 --- a/arch/x86/mm/Makefile +++ b/arch/x86/mm/Makefile @@ -19,6 +19,7 @@ obj-y := init.o init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \ nostackp := $(call cc-option, -fno-stack-protector) CFLAGS_physaddr.o := $(nostackp) CFLAGS_setup_nx.o := $(nostackp) +CFLAGS_mem_encrypt_identity.o := $(nostackp) CFLAGS_fault.o := -I$(src)/../include/asm/trace diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c index b4139c5ab972..1b2197d13832 100644 --- a/arch/x86/mm/mem_encrypt_identity.c +++ b/arch/x86/mm/mem_encrypt_identity.c @@ -266,7 +266,7 @@ static unsigned long __init sme_pgtable_calc(unsigned long len) return entries + tables; } -void __init __nostackprotector sme_encrypt_kernel(struct boot_params *bp) +void __init sme_encrypt_kernel(struct boot_params *bp) { unsigned long workarea_start, workarea_end, workarea_len; unsigned long execute_start, execute_end, execute_len; @@ -468,7 +468,7 @@ void __init __nostackprotector sme_encrypt_kernel(struct boot_params *bp) native_write_cr3(__native_read_cr3()); } -void __init __nostackprotector sme_enable(struct boot_params *bp) +void __init sme_enable(struct boot_params *bp) { const char *cmdline_ptr, *cmdline_arg, *cmdline_on, *cmdline_off; unsigned int eax, ebx, ecx, edx;