Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp362828lqp; Mon, 10 Jun 2024 06:34:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUEwze/G34MiwBF2meBtm1svB51w88iksau6TVdM+Ai/9skvLORvh6JkOj52/TeCnEEkvFXwlFHnlnxU2P1YroOZZSAw29Y3JgY/Pqmjg== X-Google-Smtp-Source: AGHT+IEDKiYpchqnfLwXBFgbgx+8dd43ahZ0iDTHiUs4Nhc+G7pFx5e9YKmbpQFFwRwj6DgWPQNF X-Received: by 2002:a0d:cb08:0:b0:62c:e939:2ffe with SMTP id 00721157ae682-62ce9393058mr63884657b3.7.1718026486610; Mon, 10 Jun 2024 06:34:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718026486; cv=pass; d=google.com; s=arc-20160816; b=UQa/B+Ga2U5MIZl+Ec6u8GrbXWAGFwOTATLr+Vqyw2ACJy4PAUVm5JEBKDbOLHWWj8 ORqaz145BrTxT9ZAJeNqXrpZvc+UcjNrkGGPN6c0NphPS+Ufw52xdsyQbgDL2jtpOvxz Q0LpqUGC4eYqKf91LUcnA8YqlQ/zXgX6fa/zYfm6pY+MQdKEauu1LHmWiZlmPwmWaR/k U/8mPjv5HhUfCJm0h5CpvF7TjbSQdu761GqaexygTfyxURlQvV3ZaIDB3ucYUz0gRVlb yC5MSM99JEiKsC42XdxsAyiHujyIaovSblmqe1oreNe3JYKA8h0p2DXE0/YtybyORFX7 /JKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wA1nTTx7J2f7UQCO3goxnE4805ZonfPVcMT9rE2FWAY=; fh=3Q0QjmI0Tvbut3cmyhiqh+Xrl3oyDQTunBVO1X46xq4=; b=1FVZSdWa2DBJ/9QC5iKe/DOcndEL/gTgO1LZu0IIswOYSNcp1LUPuIAp4nxU+JL+fa AsAwJWqPqdI6WpYwbmQNBXCbZSueNZgncF+05oRYa5QsLS+otJ8i0A+fYvLzQuL5B082 vnY6m019MvKpkvJpS8q4nFg49yjy9OgRP+yIYjFMbMsqJ14cAFa5qPgmcb5WHDFnuniP 9IWBi9YABRknGF0tDQUQDuZkvXq4C4AcaiY0B2onOFjfHoX+is+vk6H+HxLJFB1B1uTq EmDwI/nmKG7XQOrWPw28Vbc8Fsne0QYBEBC7nnNA9tHWrhU3LnF367ICnt6NfAvTsXWV 4xxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=geDeJaHi; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-208240-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208240-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ada2fe7eead31-48c3968d5f1si1176063137.98.2024.06.10.06.34.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 06:34:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208240-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=geDeJaHi; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-208240-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208240-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 423111C21C69 for ; Mon, 10 Jun 2024 13:34:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 166857E767; Mon, 10 Jun 2024 13:34:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="geDeJaHi" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 AB01B1E489 for ; Mon, 10 Jun 2024 13:34:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718026479; cv=none; b=B69uZUOAHCMU0LTu5uD2AUkCMXvF0bfPY+Ldfhpe0K3MDB31hn/5G3/riPgFj+1k9uX6HoE0ICm6CTa7p7OzVJIAW0EmNRvBrjrzCgESz80py40jhM++KstJffwUxAyXtmlWHNYoKwnQDFYQhTFysdYCvbfIkHu/Qjb9AoOYQpE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718026479; c=relaxed/simple; bh=pBvR9McWmov7Rp1pdAQ23EgPGal3SUA9rAXjWP/q4hI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=L9HuElV88PPi8Fai/U0nI7uD8ya9rpnrU3HaKiXh0CMoU8YuiYOPvr+2diKwnG+N3OXR/5ox2ygG3LVP5a2xrRgLQwTCR8GhNOtvk6cI27zW7ewd5x2Qz+VobMyEpC/RNSBdb4NVFO0Qw71omOS1XWCPdWyWOCaAMdMn5fl6SEQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=geDeJaHi; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718026478; x=1749562478; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=pBvR9McWmov7Rp1pdAQ23EgPGal3SUA9rAXjWP/q4hI=; b=geDeJaHir/XCeEBJm7OFl3PNJf1A+lSsBEGGITVGd0XCHSNpVc1zljxZ NKGiIVmAPj3BS/M0tfCILvKy2zMzYxgBJWgzpQTGSzRqTxPhLICx4bLCp BQy/h96AtSOw+tmd8HJdjMQ+AbogsP9nbQdDCBETITysFkXwXuXHi+nu3 KzObExr7Ka6HRDMDbdkbWHtWPjW97+m1vCzBE4BXfenPKWEIV4oflYpES al8MRY87X6Sn0kFrTBaRN3VrGza7tk3srMIYHl3C05kv3ldMsaGy4sa3m s7MZuMTr/Xw4fl2fkkR4xdg/e+O1WGgSR3ojKQfXwuETWNWO+zcOUTt3e g==; X-CSE-ConnectionGUID: 6ygCGE+OTRSPu+UF0S4fyw== X-CSE-MsgGUID: 4n7JtOhERXCXU8rprEH98w== X-IronPort-AV: E=McAfee;i="6600,9927,11099"; a="14858569" X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="14858569" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2024 06:34:19 -0700 X-CSE-ConnectionGUID: O5yUHhQhS7CSCilTyKpjfw== X-CSE-MsgGUID: dsZ5qsK+RWa+0bz7LZirEw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="43503465" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa005.fm.intel.com with ESMTP; 10 Jun 2024 06:34:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 6C95A1FD; Mon, 10 Jun 2024 16:34:15 +0300 (EEST) Date: Mon, 10 Jun 2024 16:34:15 +0300 From: "Kirill A. Shutemov" To: Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Cc: linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, cho@microsoft.com, decui@microsoft.com, John.Starks@microsoft.com Subject: Re: [PATCH] x86/tdx: Generate SIGBUS on userspace MMIO Message-ID: References: <20240528100919.520881-1-kirill.shutemov@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240528100919.520881-1-kirill.shutemov@linux.intel.com> On Tue, May 28, 2024 at 01:09:19PM +0300, Kirill A. Shutemov wrote: > Currently, attempting to perform MMIO from userspace in a TDX guest > leads to a warning about an unexpected #VE and SIGSEGV being delivered > to the process. > > Enlightened userspace may choose to handle MMIO on their own if the > kernel does not emulate it. > > Handle the EPT_VIOLATION exit reason for userspace and deliver SIGBUS > instead of SIGSEGV. SIGBUS is more appropriate for the MMIO situation. > > Signed-off-by: Kirill A. Shutemov Any feedback? -- Kiryl Shutsemau / Kirill A. Shutemov