Received: by 10.223.185.116 with SMTP id b49csp3205425wrg; Mon, 5 Mar 2018 16:30:44 -0800 (PST) X-Google-Smtp-Source: AG47ELsOKiFg/DZ+oM1WsUf3SSXktfndLpvq+tQSHEJB3r3bx+MRPWmUdPFnLMH1JeHnSSxRc+W0 X-Received: by 2002:a17:902:600e:: with SMTP id r14-v6mr15084232plj.200.1520296243976; Mon, 05 Mar 2018 16:30:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520296243; cv=none; d=google.com; s=arc-20160816; b=etAPusT7G2G5pdEPPq9gZ9QoenVdkkCD9Ewx8qC5oxzQ21mro3UPeX822oH9PCFhFn MPzU3+rlNRAb/+NqCtpf09JEStJbVJe2+e7gWT1RUKchmfs3yizELQ1qm+zCF47pc9w9 RZO/Z/X99frszemk3YXIhKX4TRLzNPOkNp6ljv/ZwM4D7cOK4XZbb2AOlNye7liQTFO7 +PN0+FtgbyM3kG9Ok0h0Vd50Nu8yYE0qjDNkrYzYzBYjptgs7YXx+wdQBgJlZoPWXmyj LsLeO6Fxt1G0bbvubQsnh4uKBQiNnvuQCGecbz8o4XdB6Zk6CnWvNDwKzlMi0+kMk1pl 94ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=UVNG4HagMrisyQniJEhR90qzoHHYVktKgQwjwBvcE2g=; b=S2tU0HeE55Dm6aRZuCjXkoxJ267ef6oB/gwmZ1Sj0COtrEhsO0YE4o+DGJroxXLB8I fnwx7bGXaBwYBjUdBCu6XOEED6twWuBIz9N0VVm7/aU/oqkMYr3Pfz73P2tvyHWV9nOY Wv7h2QqxxwNE0da/rb2THWmVtHtlZJwDYJQf0NiGD1UnZTivcpndp+rlugGQj1tuDyxC CPRHWGzuxA2F4WDDl6Blatiag7ShUOJgaAamBAwa4Zl45oraIfOR5HBg94lzrh54BYei YpoWMGIBNoOb/4+oM2WCRIJv6XarI6mrWMGcS0EudmdluXVsa8j1eMHGFiRtGNYg6Bea 7k1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=TRRDUzza; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v133si9011043pgb.740.2018.03.05.16.30.29; Mon, 05 Mar 2018 16:30:43 -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=@oracle.com header.s=corp-2017-10-26 header.b=TRRDUzza; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933713AbeCFA2p (ORCPT + 99 others); Mon, 5 Mar 2018 19:28:45 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:56696 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933534AbeCFA1A (ORCPT ); Mon, 5 Mar 2018 19:27:00 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w260QuqL038129; Tue, 6 Mar 2018 00:26:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=UVNG4HagMrisyQniJEhR90qzoHHYVktKgQwjwBvcE2g=; b=TRRDUzzaYeWGz9b/m9DwVRSWtGU1AgJhWW9cGkqE4kRf7E/y8DLPb0yf+NevvhZ82oTS z7WtQ2/vjBDS01GLUiX8pM1/7Ev2QzdFzzAGHCpBaFky+KlzvuHHPdCfjGmACFudNQiQ l7OvHW3GuDTkoMPhEp50cugEjDjhN6NRuBmmmKhF5KygzW+a0JInpEP2P28NCrYyk8H/ EI/NCrKifuVYUYdtgsajRhhEq/N0hftDM1tkkXF+DEqKN0R3zgHviU2h0x4jbf8SMfqe lktIS7YQEoqFnrenjPHIJ81tU1tkyXHU9Mu0kXe5dE4MGuLvID+acdSjTB1qAF+0vex7 Jg== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2ghe3kgg4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:26:56 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w260Qt2K026665 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:26:55 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w260QsWb029271; Tue, 6 Mar 2018 00:26:54 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:26:54 -0800 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, Alexander.Levin@microsoft.com, dan.j.williams@intel.com, sathyanarayanan.kuppuswamy@intel.com, pankaj.laxminarayan.bharadiya@intel.com, akuster@mvista.com, cminyard@mvista.com, pasha.tatashin@oracle.com, gregkh@linuxfoundation.org, stable@vger.kernel.org Subject: [PATCH 4.1 62/65] PTI: unbreak EFI old_memmap Date: Mon, 5 Mar 2018 19:25:35 -0500 Message-Id: <20180306002538.1761-63-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306002538.1761-1-pasha.tatashin@oracle.com> References: <20180306002538.1761-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8823 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=859 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803060005 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Kosina old_memmap's efi_call_phys_prolog() calls set_pgd() with swapper PGD that has PAGE_USER set, which makes PTI set NX on it, and therefore EFI can't execute it's code. Fix that by forcefully clearing _PAGE_NX from the PGD (this can't be done by the pgprot API). _PAGE_NX will be automatically reintroduced in efi_call_phys_epilog(), as _set_pgd() will again notice that this is _PAGE_USER, and set _PAGE_NX on it. Signed-off-by: Jiri Kosina Signed-off-by: Pavel Tatashin --- arch/x86/platform/efi/efi_64.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 18dfaad71c99..12118bae3caf 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -90,6 +90,12 @@ pgd_t * __init efi_call_phys_prolog(void) save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE); vaddress = (unsigned long)__va(pgd * PGDIR_SIZE); set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress)); + /* + * pgprot API doesn't clear it for PGD + * + * Will be brought back automatically in _epilog() + */ + pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX; } out: __flush_tlb_all(); -- 2.16.2