Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1358788lqa; Mon, 29 Apr 2024 06:33:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVCN5LQyj+rJbtANbpBBuhp17ncXdA9jS/tTNonQMHf6EUNrCtRQ8TmxPvq5JsQxP6FI6QzIFpD+dn+cUAdysRoH7etB1B20NL4sukLWw== X-Google-Smtp-Source: AGHT+IHaRTy1ymC/YI65JxkDhpaPuRdUUy1Qxr77bNfFA5KU812nRdzDuzPp8jCkRElyUBSem7z5 X-Received: by 2002:a05:6a21:811b:b0:1ac:c8dc:3e5e with SMTP id pc27-20020a056a21811b00b001acc8dc3e5emr10527957pzb.24.1714397609006; Mon, 29 Apr 2024 06:33:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714397608; cv=pass; d=google.com; s=arc-20160816; b=rQU1yvG8NeBUcFYASLhY2v6EyYDEwHlPnO6Kwtw83/h2C411oT1nt+NpAQMx6cOprZ k/SPsOVzT21a7QGyh92pAXa15wycYyHGIRJF4PEoIWxbtFzhVG1BczuQgc0U5NzZ/vRZ pPT1W+VqkDub4khR6yLB6qNlpTJqvhBccNq6IaU86glGgSOZ4ZeRNF6DueI+Kj5tfQYG 67rfoWxaexILlLohauaEg5CyxNoXreEZ9W4IF3gPyy7rRKX6nM+j7ZJvy0oyllFdLVlu cguLuXZ5S3W0M6siiA2FSJtGdp1e7fMjAtgqJmwpGP5rAlpxG/nTr7wvS8GV1Zx4ETCA i12Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=0iGZhh+y6263lgeqrhY9RIljh9ZAAzgpP8vZKYNQA80=; fh=O/0f6OYSrnLpalSta6hbWUnoo3PBvjfkTqP6CFGZquk=; b=P5yX+2FNbfrk9F5LHAVxhaCAxtZTAB12uM+m7E6YjUoQoS+FgLrsMX+m57eGYqxhIs s5gNEa9+NK/apEYWz7QM6EPexXNV1iHV3KKwN1aZ4wqoAH5sJYTKOw/mZzLNjP+iCpnR T5VaIGayBDSjA3NU/mxETZuLf2xs/uNvCkY773Zy4Vu/l8LySv7R/SlaDU9o51GZ03FV c/yCkERLJ/QjOB0vkWRFHg1Tsi+5J5CxwcCLCRMwkkYaPhDnA3a11rzFVGYIPdnsM0hU g4ueSnwZFrZDWH9X+Usz6PyL0bE7PI7fFGrAmQWlrkYz7uem9nb6dJSPSJRRmU82MyS2 XciQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UBTHOBa4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-162362-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lr48-20020a056a0073b000b006ea8b233549si19382347pfb.328.2024.04.29.06.33.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 06:33:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162362-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UBTHOBa4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-162362-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9B36A2890DC for ; Mon, 29 Apr 2024 13:24:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 724216F061; Mon, 29 Apr 2024 13:24:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UBTHOBa4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95EAA56B69; Mon, 29 Apr 2024 13:24:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714397049; cv=none; b=IDnYx7SR2PvUf79v+p2OyJe5LIoYIBLz0rDvIZHa5aw5pa/5LCtcGy9oLHdeVzZniSRV1iKQzy7O/GC7WQkpfBnd4uewzGgJMKTuluo6Lr4yAasnaQvWxv5jdpegupVTxUI6VqfF7ZMZwWpk2ZJEaNUlkrGIo9xbR++7kFqwCWE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714397049; c=relaxed/simple; bh=0iGZhh+y6263lgeqrhY9RIljh9ZAAzgpP8vZKYNQA80=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=pBp/ADzf8FZqLp4vMNz7Zv3tHAqLSBxrDb5JodOV2xfsTIKB8gWFwWA2m25ZPa2Q3nGC2RLV4gHek2rZdj/u7sA08bcirjJwCKqbMUIYueBvZXMpJdm6lD4Q3IM+Jl9ThYU9GF+abTDfb/XpOjs6ZXCTZopsOkAJ1rfym0bruj4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UBTHOBa4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD472C113CD; Mon, 29 Apr 2024 13:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714397049; bh=0iGZhh+y6263lgeqrhY9RIljh9ZAAzgpP8vZKYNQA80=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=UBTHOBa4pSCJq07jjcpv1aF418HzWkPXOnDyYDs1wEILs6ixgimOhxxBRwzq9Y3KZ lplpqQCoPc7BDJ3gO98UeNtrcwZWSqJuGKaETlxeZRVBNbGombo0Oiomdlz0kvL+Uw /7vkNF7Wxru6yZx9MOKTPKkCfiYmLN6oou6tnerxsO5JkKFOtOvHDmSTnwDwCUiSKl Wm61RPVlFMcXUmo5NP8yGqX2cQJ5+JnQoJHZo3iIArxbLXA+bq2nGTiCBKfc0h6asZ sZFafLXCQiQqZIaFw38BVMH83KWEbjvWzEpWYV/uoi1NkBgVZXKh1FjYBOFqiyB5yQ ijCvrG4BRYGdA== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 29 Apr 2024 16:24:04 +0300 Message-Id: Cc: , , , =?utf-8?q?Marcelina_Ko=C5=9Bcielnicka?= Subject: Re: [PATCH 1/2] x86/sgx: Resolve EAUG race where losing thread returns SIGBUS From: "Jarkko Sakkinen" To: "Jarkko Sakkinen" , "Dmitrii Kuvaiskii" , , , , , , X-Mailer: aerc 0.17.0 References: <20240429104330.3636113-1-dmitrii.kuvaiskii@intel.com> <20240429104330.3636113-2-dmitrii.kuvaiskii@intel.com> In-Reply-To: On Mon Apr 29, 2024 at 4:22 PM EEST, Jarkko Sakkinen wrote: > On Mon Apr 29, 2024 at 4:04 PM EEST, Jarkko Sakkinen wrote: > > > Fix these two bugs (1) by returning VM_FAULT_NOPAGE to the generic Li= nux > > > fault handler so that no signal is sent to userspace, and (2) by > > > replacing sgx_encl_free_epc_page() with sgx_free_epc_page() so that n= o > > > EREMOVE is performed. > > > > What is the collateral damage caused by ENCLS[EREMOVE]? > > Have you measured cost of eremove on an empty page? > > I tried to lookup for a thread from lore because I have a faint memory > that it was concluded that its cost irrelevant. Please correct if I'm > wrong. Also pseudocode for EREMOVE supports this as it just returns without actually doing anything. BR, Jarkko