Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1375967pxa; Thu, 20 Aug 2020 09:39:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlrNqOaInbti8tBXhgGVqyjzbVSFaQiOUyyznqt8AfAclvkDUbfFwk2l0lH9SRf2zZvppm X-Received: by 2002:a17:906:b110:: with SMTP id u16mr4014739ejy.483.1597941577119; Thu, 20 Aug 2020 09:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597941577; cv=none; d=google.com; s=arc-20160816; b=eqU9KfHD3yuNHAweav0CNhOe1t8yThVUgb1EM2S4ustAdSapPfT+wLDo7Jq9dBaiu/ Jt33PL29XbkQeg4KtuPQVqasfcmWt1iFdLpFm9VDFLVjbyMbzSil5AOxzNYEugUB/m8A UMxc7/w1pQU36C9aAGAecMH//Ej8RbA9fjVA/42l5v7l6IibFzf/zsi4Am1P2G9zoE+m Susf+CLOCnwyZqdHVP2fJWlskC3fqiLnqDkJRreqteKOnDsG1oHR5mng22M35M+xsv99 PPK+OriJlFgFrfxMqRr9SiOZA1OWTBeBhhzuJsIZw8hZSdoz+8NkwFmpU0R84qBL1fNl QvlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=54AtJ/Z+1wgzVKTU0mKW+7cYlSiorqqUjGWxJ5bBDmI=; b=O0Wpi9ZEjgjyNrSEVTe9m6Z3d1U1gdmwu8k5k0YqKWZPjyd1frxIp50vlT6oi3KQi1 OYpcumCcHz12SoBxn7pr3b4aIO227cp27zTtzKrus9C6wSKXm+lmeWBV//xen4C2vb6/ 0ccHTo2k/B9jvEoKIDLEAxf5nmJmTVl6TcbjEAUGMQODJgM3lOuzOJYwr47bc14+rbD1 xx8LIMGKB/pEAA4Of6TEOJa0QMmMQWQeR4o1MolD4ZqHvDGKoQrmWXMP0VvudcUeO1hn 5tJ0eMM6aWUDMdmHWkznoiQWjTHQIQ38lWtkwON6BzXWj6vdxDcY3SXX238df3eLm2lN b9yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="SUYH0F/B"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yj16si1786013ejb.59.2020.08.20.09.39.13; Thu, 20 Aug 2020 09:39:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="SUYH0F/B"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729125AbgHTPbY (ORCPT + 99 others); Thu, 20 Aug 2020 11:31:24 -0400 Received: from mail.skyhub.de ([5.9.137.197]:51070 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726852AbgHTPbX (ORCPT ); Thu, 20 Aug 2020 11:31:23 -0400 Received: from zn.tnic (p200300ec2f0c060044fc628f6f806d19.dip0.t-ipconnect.de [IPv6:2003:ec:2f0c:600:44fc:628f:6f80:6d19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 2E1271EC0281; Thu, 20 Aug 2020 17:31:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1597937481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=54AtJ/Z+1wgzVKTU0mKW+7cYlSiorqqUjGWxJ5bBDmI=; b=SUYH0F/BgHK+Zray8T/gBWoF8HjiAYbQa5ZymCVvGslwRo9zc3xIsy7apDyBb/J0JukQ8n 5HOVja4BXYL+ALUEAWDUFcnD8uUfKEUa3RtvmxDSyWCCwoq/RwsEajIsaSVM/OdBtR4+dg 2tmax/x94xs2xHeWRU2kdKMvLdNFncM= Date: Thu, 20 Aug 2020 17:31:14 +0200 From: Borislav Petkov To: Jarkko Sakkinen Cc: x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , Jethro Beekman , akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com, asapek@google.com, cedric.xing@intel.com, chenalexchen@google.com, conradparker@google.com, cyhanish@google.com, dave.hansen@intel.com, haitao.huang@intel.com, josh@joshtriplett.org, kai.huang@intel.com, kai.svahn@intel.com, kmoy@google.com, ludloff@google.com, luto@kernel.org, nhorman@redhat.com, npmccallum@redhat.com, puiterwijk@redhat.com, rientjes@google.com, tglx@linutronix.de, yaozhangx@google.com Subject: Re: [PATCH v36 03/24] x86/mm: x86/sgx: Signal SIGSEGV with PF_SGX Message-ID: <20200820153114.GA17271@zn.tnic> References: <20200716135303.276442-1-jarkko.sakkinen@linux.intel.com> <20200716135303.276442-4-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200716135303.276442-4-jarkko.sakkinen@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 16, 2020 at 04:52:42PM +0300, Jarkko Sakkinen wrote: > From: Sean Christopherson > > Include SGX bit to the PF error codes and throw SIGSEGV with PF_SGX when > a #PF with SGX set happens. > > CPU throws a #PF with the SGX set in the event of Enclave Page Cache Map > (EPCM) conflict. The EPCM is a CPU-internal table, which describes the > properties for a enclave page. Enclaves are measured and signed software > entities, which SGX hosts. [1] > > Although the primary purpose of the EPCM conflict checks is to prevent > malicious accesses to an enclave, an illegit access can happen also for > legit reasons. > > All SGX reserved memory, including EPCM is encrypted with a transient key > that does not survive from the power transition. Throwing a SIGSEGV allows > user space software to react when this happens (e.g. recreate the enclave, > which was invalidated). > > [1] Intel SDM: 36.5.1 Enclave Page Cache Map (EPCM) > > Acked-by: Jethro Beekman > Signed-off-by: Sean Christopherson > Signed-off-by: Jarkko Sakkinen > --- > arch/x86/include/asm/traps.h | 14 ++++++++------ > arch/x86/mm/fault.c | 13 +++++++++++++ > 2 files changed, 21 insertions(+), 6 deletions(-) Reviewed-by: Borislav Petkov -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette