Received: by 10.223.185.116 with SMTP id b49csp4316971wrg; Mon, 26 Feb 2018 15:26:59 -0800 (PST) X-Google-Smtp-Source: AH8x225irEZ/kdgdynhir/CLEdtQXDtFFtpG7JKjJX756J/8sdYT9qfI+llYAaVqiKRt6SOIsTEn X-Received: by 10.98.76.215 with SMTP id e84mr12286126pfj.45.1519687619547; Mon, 26 Feb 2018 15:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519687619; cv=none; d=google.com; s=arc-20160816; b=Gtx8AVLgc/vz/F3VFMMbhlTmWYbT3zrEIdrIdbQ3iEeF+SAW1daJlCXe6YyWbFM9kg Kh911gPdM7Zutcb+WKXHbkpQvKtjsAfGN6hKCX6uTRCy9m0c3ROQSQHEgOJhtpCt1rC7 BgLhTIdGOXzL/pkDx3jb1pH7yMvi3q9izI1McKaFCEKUfT+WpeXesaKPZr0aLdVEI8T/ ycmQ54dNSJZUBzyZ5qZoc/0rIWOsFPjA1TZJ32PnRSv0q2nDE7sYQZqFhqm425ukUk4M viREs8DhV2ixgfGJuYp1Bru/AIShEMaBzlHrqhDtMarc35R3qWiR11OxcA6KRr27SVl8 QgLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:subject:from:dkim-signature :arc-authentication-results; bh=juE2IbrSJYkoHbIijHHxNmdf9ioFJ24kziMPajws4OY=; b=ULYGjRkz0wU3HTQ7/JYd/gN60mHZrJoP3zyCdc/KLIk7sN1PTjVPLdzmeulq9iyR0q bHbNTgDPMcPCztO7KSy0FjWZV9Swh4tvF2o9hRRDU2bDclQqTlj2xlSmT5pPa47OY+w8 /7GazskQRAXdg8FIY0Z5yWBFyXYbFZ+PTM8NEmFd9gE/6r4mIDYzMxH3qYuKsvA+ozDS LvqUk8+2na2eXfyknaTLBLqNbyAUKTU9/hVYeqLX+E3HioLFRNVxAkngJhyNO+LFU9st 7XeMrDDEz+kv6G0USYnBDhe9+jIq8ledQzqDzi8v0Jx/q6b2IqjdcBUNznEEIIg6F2FE LGOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=unzAlgIM; 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 k6si6118025pgp.709.2018.02.26.15.26.43; Mon, 26 Feb 2018 15:26:59 -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; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=unzAlgIM; 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 S1751518AbeBZX0C (ORCPT + 99 others); Mon, 26 Feb 2018 18:26:02 -0500 Received: from mail-by2nam03on0069.outbound.protection.outlook.com ([104.47.42.69]:10832 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751245AbeBZX0A (ORCPT ); Mon, 26 Feb 2018 18:26:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=juE2IbrSJYkoHbIijHHxNmdf9ioFJ24kziMPajws4OY=; b=unzAlgIMbG9DWz4GWrbctI4FXl7sN6R0AlFv2iJRb6wmmkePm5Zwk1+HNTKAXhT/klZFv22qeV7buZ9aTUkZ9r8kYxb6GycUsj1yHDYkAsB6f67XVQLhzBWxqhrSAeEkHbYqNS/wONKVKQRNHnJJZMhC8gj9Cmzf5/qjTDKb0i0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from tlendack-t1.amdoffice.net (165.204.77.1) by MWHPR12MB1152.namprd12.prod.outlook.com (2603:10b6:300:e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Mon, 26 Feb 2018 23:25:57 +0000 From: Tom Lendacky Subject: [PATCH] x86/mm/sme: Disable stack protection for mem_encrypt_identity.c To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Borislav Petkov , "H. Peter Anvin" , Thomas Gleixner , Linus Torvalds , Ingo Molnar , "Kirill A. Shutemov" Date: Mon, 26 Feb 2018 17:25:54 -0600 Message-ID: <20180226232554.14108.16881.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0401CA0006.namprd04.prod.outlook.com (2603:10b6:803:21::16) To MWHPR12MB1152.namprd12.prod.outlook.com (2603:10b6:300:e::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 30e85099-7172-4d76-5a60-08d57d704a88 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:MWHPR12MB1152; X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1152;3:Y4LZCDMmVqgsh5NGAAT9DqfRhCwXPHavM4bsPQzhDOas63oituPxG+MZnItmM5jkYRz7vrdyidBQe0537OfvHkm4LgiZBYA40wQFaa2hCWMTkuLHT4MN0ev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Vg7Raju39Qd59gsR2Ltu29KyYzwW2xvO4eNHju/V7FkT2WOaUQDc/1A0e/y58Y/s74J92vXcneaPAoM3uABC8psnU1flBBWUpMJaHd+2EK8+qGVRFMe0/s29i63L33Th8C/9ZUeou5/SDB4dxq4/OftF79bGYc80dF7gdBlmmKrIE/ues4eBsoybHsViBKA25gjnZAdW026/qCAOPJgL9;4:ubwp2mGqEErhtOabpCvjqfB4rSN4IGkC5s3XvebiWYFhTiawMNCT+14jXSQvW1Sgg0oRPvmfzIX3SNSdMeGM6EBkawxYb6uHHWNGhWGo2MxJas8omXW/TBGkSlCssKcKn5n3WSIzXXqEMYnEhY+6XZUqKmlKAVfqj6zwNv7VXplF6tvs5jHnWIIHoouW99S8ubBQyCX0it6RThwDVGDpEJVuyD7ybtrpPyIsN3WcLwDk63mc5epMU0S/RtOXd/qY88GQrY7aA15/RwPHUPRWDZkrcXcMuNlg3JIcYUiCOAM5QLU+m68hMo8leK/GplBX X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231220)(944501161)(93006095)(93001095)(6055026)(6041288)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011);SRVR:MWHPR12MB1152;BCL:0;PCL:0;RULEID:;SRVR:MWHPR12MB1152; X-Forefront-PRVS: 05954A7C45 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(346002)(376002)(39860400002)(39380400002)(396003)(366004)(189003)(199004)(86362001)(5660300001)(68736007)(316002)(50466002)(4326008)(97746001)(1857600001)(69596002)(386003)(6506007)(3846002)(230700001)(25786009)(2906002)(1076002)(16526019)(186003)(6116002)(105586002)(26005)(6666003)(7696005)(53416004)(305945005)(55016002)(478600001)(53936002)(9686003)(47776003)(72206003)(97736004)(7736002)(8936002)(8676002)(81156014)(103116003)(2486003)(23676004)(52116002)(66066001)(54906003)(106356001)(58126008)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR12MB1152;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjEyTUIxMTUyOzIzOjdVcm96RHNEL05UUTJ1Q0dWYTZ2RXp3c1Rz?= =?utf-8?B?T3E4RVBkdktlOHJWcGZaelE2di9qUC9ka2k3ZG1ONzZlSTd5eDBEcGZLcmpy?= =?utf-8?B?R1pLVCtOU3NFODlNVkNKMktXNjM3MW1aTjRLYkNxL1JmaXFOQzVYbDB1UXh3?= =?utf-8?B?NUJ5L1pkZUljNDkrZjRSMFV2NDhndTVMb1ZOY05SNlh6bjFaT3lVVmZWVy9h?= =?utf-8?B?MUlId2hhYUljZGFHRXNQQUtGY2EzUU05MHVYZ3JYclNtUTJnbWpIdTIyR1Vs?= =?utf-8?B?SnFyN0d5ZUo5aGM1c3ZSNkdENjVqOW5NRjJPTnZOdGQwYitCMFZGdDBxOERs?= =?utf-8?B?eDlTdXdoRnNkRDVkWmZZVG85dE1LekxVM0oybHRoZWlwOHBSNzZuMXNkcGtv?= =?utf-8?B?UWo2YncyZTVLd3Fwa01KU3pZM1NNMFUyQ0Q4Sjc1YkFzTzNuckdGNTRyVzE0?= =?utf-8?B?YkFTbWVwMFUxZHIxekpIZUVDdmR4ODA2S2FpUGg0QktkWU9JOXY3bFB2YStq?= =?utf-8?B?UERrLzl2R0JuY1k5VWxXbzBsLzlEWGxKMG1JMktmaVJ2M3F6YVVwNWNsdUQw?= =?utf-8?B?MnpoWlVLNjBLZlhtUHM3YnNaT2tBOVVCcStKZ3BMRy9ZYW16cDNyVlgvNmlk?= =?utf-8?B?REtTbEJLNjAvejQ4YXdFOHNtMU83bEgyaWFaT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12MB1152;20:lPw+R3ZrCUpm8chCzsQbXAY+E1kc+MKzTHqy3ECFqlrFuyCUHn4GtFbpaMe3JMsLseMbdRuKUVx+7iRJRuXONN5iNX1Sxqf9zt5dmgV6DUiyOCYolByeTLPlKqPP8Ju6VrLAji3Fy1WYpuSmEGTRNjbpkuYt1LOxnUDcuEvRYIKBqFw7Y9ZCQByS8zYUWAo1LOCSBoAohp/Y1E76kZprp75mDp71TUOSW4JHUuwPFuOy2AnudkxKqgZZ/Etpy6yM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2018 23:25:57.6333 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30e85099-7172-4d76-5a60-08d57d704a88 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1152 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 03c6c85..4b101dd 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 b4139c5..1b2197d 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;