Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp8094157rdb; Thu, 4 Jan 2024 20:04:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEx3dZvKGhsYuWiDcP7LfqMzOs3S3485Lw4TA3k3Ir84RxSrhY7CvtaMKPjNATGdxNWJy1s X-Received: by 2002:aa7:8887:0:b0:6d9:b9ba:fc7b with SMTP id z7-20020aa78887000000b006d9b9bafc7bmr2156207pfe.33.1704427445573; Thu, 04 Jan 2024 20:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704427445; cv=none; d=google.com; s=arc-20160816; b=vhEDFCN2658MhvxHVbyz8162K2UFwPpe0pTPoglDLQpf4sA0xiEFHo24eveygWQlr7 oUBAM32xTdMyoADpTBwBD0oHi1G//BpO/detTwfDlkSrI3qwfIuBBpLNmnTzoT5+K/Oi k6BtOTVaD/0r5K0MGq93y2E6rEDl1++FHzz7R+FGSlk4Tj7Xbml4gxW+tGE2S2Lb94zD fxJUdlmLv66bQTJjBdx9xNlaMtBSPUSax3Ogxs8W+lCXD4Q+tAowD//H3ns5ur5hraPh mnVgN5KNo4sYqdHM1GFIQvvmMu/JhGiRbQADpkR4ExbAUaEDKkqm0aBrl8JxppQPz3rM Id6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:references:in-reply-to :user-agent:subject:cc:to:from:date:dkim-signature:dkim-filter; bh=SnC/4SLOc+IpabTEpVg7for4AVHORb87ZuavsdwBIiw=; fh=av1SaxfIU2uqQ0znReiv9eUh79KjtiJnDzNp8hAl/Jw=; b=XB+4E+JX/biM0ZoBABbM29ql+Ojyicjmg6o3pRIURB6YqwnKBtYNkFd+EiVcVjKPpm 1hK0wFvyMyUVDNRsbo07vxWV3orbirdjldCtb5hSHmiLg/tOjZYF96A8Kv0tNkvd9zsI G4vBtx9SSt9EohguRuGlAQpULmS5Lv1KV8yz0fnAsNRehiB79XQ+2tV3BOnH/Km9diS2 Q+dB7kF5Zk4LJDb0v6oRIPfv5s9i2vdYrQxsdVu+c8g5jOkaxw+GUq9SWJBA2cmbVbgc YRmV9DRqOOBHq86a164eo+wIADrEgfxc2BBoiHhY4bRuT85eLu6RVPeI6/Yhsdm5Zijl A4zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2023121201 header.b=PZYwagwf; spf=pass (google.com: domain of linux-kernel+bounces-17462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17462-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z41-20020a056a001da900b006d9b8af64c8si634053pfw.70.2024.01.04.20.04.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 20:04:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2023121201 header.b=PZYwagwf; spf=pass (google.com: domain of linux-kernel+bounces-17462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17462-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4AB2BB24152 for ; Fri, 5 Jan 2024 04:04:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 345FA53A1; Fri, 5 Jan 2024 04:03:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="PZYwagwf" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (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 B9218538B for ; Fri, 5 Jan 2024 04:03:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from [127.0.0.1] ([76.133.66.138]) (authenticated bits=0) by mail.zytor.com (8.17.2/8.17.1) with ESMTPSA id 4054370r073557 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Thu, 4 Jan 2024 20:03:08 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 4054370r073557 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2023121201; t=1704427389; bh=SnC/4SLOc+IpabTEpVg7for4AVHORb87ZuavsdwBIiw=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=PZYwagwfnTHkUuqtMtJ0f9g4OK3BPi3qGGjWyb8EGPj9WSKXLe4fcPrchnbk1hfNE CT5xHDQHuz8tA81bRhtynwIefw7uBn/C5Xz/JYKVMMDFO4OQsOYtms81RimGnaPZIe 22r9y23pEBQVoFWgD5Btc0Qf23NmaAP3GvgzBKfVoO2ypWmQHBPgOWEIdpAobQ343d IoLAMBwrbRfD3/e9uk7OVNpCO15sQdrJWN0osZ1C3sukbs5RaSyZbiN4bQT3w/Y3Sp rOcJRhVE/Sa+XmCfjzuM2JopvxEOWOX75mWHVMPBueT/BZonm1pNHEv1Y/V7BslbO1 zPhIIzTMhlIow== Date: Thu, 04 Jan 2024 20:03:05 -0800 From: "H. Peter Anvin" To: Andrew Cooper , Elizabeth Figura , Sean Christopherson CC: x86@kernel.org, Linux Kernel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Ricardo Neri , wine-devel@winehq.org Subject: Re: x86 SGDT emulation for Wine User-Agent: K-9 Mail for Android In-Reply-To: <11f2135c-2b64-4a90-95ee-358c3f6117b5@citrix.com> References: <2285758.taCxCBeP46@uriel> <1C37C311-CF8A-44EC-89B5-D826EF458708@zytor.com> <2451911.jE0xQCEvom@uriel> <11f2135c-2b64-4a90-95ee-358c3f6117b5@citrix.com> Message-ID: 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=utf-8 Content-Transfer-Encoding: quoted-printable On January 4, 2024 6:47:04 PM PST, Andrew Cooper wrote: >On 05/01/2024 1:02 am, H=2E Peter Anvin wrote: >> Note that there is no fundamental reason you cannot run the Unix user s= pace code inside the VM container, too; you only need to vmexit on an actua= l system call=2E > >I know this is going on a tangent, but getting a VMExit on the SYSCALL >instruction is surprisingly difficult=2E > >The "easy" way is to hide EFER=2ESCE behind the guests back, intercept #U= D >and emulate both the SYSCALL and SYSRET instructions=2E=C2=A0 It's slow, = but it >works=2E > >However, FRED completely prohibits tricks like this, because what you >cannot reasonably do is clear CR4=2EFRED behind the back of a guest >kernel=2E=C2=A0 You'd have to intercept and emulate all event sources in = order >to catch SYSCALL=2E > >I raised this as a concern during early review, but Intel has no >official feature to take a VMExit on privilege change, and FRED >(rightly) wasn't an appropriate vehicle to add such a feature, so it was >deemed not an issue that the FRED design would break the unofficial ways >that people were using to intercept/monitor/etc system calls=2E > >~Andrew > >P=2ES=2E Yes, there are more adventurous tricks like injecting a thunk in= to >the guest kernel and editing MSR_LSTAR behind the guest's back=2E=C2=A0 I= n >principle a similar trick works with FRED, but in order to do this to >Windows, you also need to hook checkpatch to blind it to the thunk, and >this is horribly invasive=2E *In this case* it shouldn't be a problem, since the "guest operating syste= m" would be virtually nonexistent and entirely puppeted by Wine=2E