Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1888513ybb; Thu, 2 Apr 2020 09:08:17 -0700 (PDT) X-Google-Smtp-Source: APiQypIxrvLOZNA5fUIveUlH6gT1PDzNrDbxbI1aDuVfq5L3+eYUMJbz33+sUILVuuKEwzlrjFdw X-Received: by 2002:aca:484c:: with SMTP id v73mr2624685oia.138.1585843697478; Thu, 02 Apr 2020 09:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585843697; cv=none; d=google.com; s=arc-20160816; b=aGDJo0lpkAxI9a8tQ95QtGc23oKq90Q0lIAUXlqc/L0Vo1FrlEG934B+9bm/ZShUs7 rf51FWtL/gdHb8cu107O1RsB3TFoqY/Xl6W4CU6dZXQe/pxaf3rhuJ20kZy+UnfGKwfd nUFyeMNInl1F53ill3v0J0qBfY6uXxiJfHKbdbmLFWGp/Zn2Wi8SlTSmTC57hCVRtrA6 yZkLThZkhWEhXdXDfTc2c+PGM4dxKR6MuH/P42gkqpGrUxVXHlspPj3lbNEv7M1+343p 6zVQQ6KmukeNyndHSkc57Msvrrjc4Uuw/8flt3RijcYYtxq5vffuItuBD17VDqXUUmSX QuWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=RhoL9etOuFmUSmnU4eZRkL2kfFXSt56S4C5rTX/JX/c=; b=XSee8cDBmKXftt4xuwGgmcylc5OjgaiMN4MSCRv8+jVWbr00oN673785GFhP/ACDXZ emteekfYam7HE/47u32znwXxPtH/LjH1o95am+Zh34h6sAWD4WpR/Imuu0C2wJitRqFR VUELynxdHSZL7+8u59KFDetv79hsX0XBDgddv3fQYjULApCo9wK/WlLxdJ3/wyVjBkBn ZUXfLH46XzxoeB4BwoGO5qbYE2Uad51y6MTBGXphCTY1Mlufdh6ka8rygqki3QTMKMZ3 P5+ChvzJPczIY6EaC4kJF5DS3pcSD6gWx3/6Kr7JLN4OmWpOh/M+FK79LbUmuXFR37Ff sewA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r5si2356090otp.241.2020.04.02.09.08.03; Thu, 02 Apr 2020 09:08:17 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389704AbgDBQEr (ORCPT + 99 others); Thu, 2 Apr 2020 12:04:47 -0400 Received: from mga01.intel.com ([192.55.52.88]:25129 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389366AbgDBQEq (ORCPT ); Thu, 2 Apr 2020 12:04:46 -0400 IronPort-SDR: G6lCr/ChClYeDwu/UcCfaQXiFIj3jpTKOEkAPmDd6VSHhmkd8cYbylfo7i/htRbHuh6Wli/YfF wENCiD0mgw1w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:04:45 -0700 IronPort-SDR: xXopAMbwED65cgcHn/XV5riG9MCGiV77AhEOJoUYw/GrgiJObmU7Dj4Vfu5JiSp4A3s8wb7oys 9giyn2aINrvQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,336,1580803200"; d="scan'208";a="253048381" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by orsmga006.jf.intel.com with ESMTP; 02 Apr 2020 09:04:44 -0700 Date: Thu, 2 Apr 2020 09:04:43 -0700 From: Sean Christopherson To: Nadav Amit Cc: Thomas Gleixner , LKML , x86 , "Kenneth R. Crudup" , Paolo Bonzini , Fenghua Yu , Xiaoyao Li , Thomas Hellstrom , Tony Luck , "Peter Zijlstra (Intel)" , Jessica Yu , Steven Rostedt Subject: Re: [patch 2/2] x86/kvm/vmx: Prevent split lock detection induced #AC wreckage Message-ID: <20200402160443.GC13879@linux.intel.com> References: <20200402123258.895628824@linutronix.de> <20200402124205.334622628@linutronix.de> <20200402153035.GA13879@linux.intel.com> <18758F52-BB97-4F47-9481-F66AF4465A06@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18758F52-BB97-4F47-9481-F66AF4465A06@vmware.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 02, 2020 at 03:44:00PM +0000, Nadav Amit wrote: > > On Apr 2, 2020, at 8:30 AM, Sean Christopherson wrote: > > > > On Thu, Apr 02, 2020 at 02:33:00PM +0200, Thomas Gleixner wrote: > >> Without at least minimal handling for split lock detection induced #AC, VMX > >> will just run into the same problem as the VMWare hypervisor, which was > >> reported by Kenneth. > >> > >> It will inject the #AC blindly into the guest whether the guest is prepared > >> or not. > >> > >> Add the minimal required handling for it: > >> > >> - Check guest state whether CR0.AM is enabled and EFLAGS.AC is set. If > >> so, then the #AC originated from CPL3 and the guest has is prepared to > >> handle it. In this case it does not matter whether the #AC is due to a > >> split lock or a regular unaligned check. > >> > >> - Invoke a minimal split lock detection handler. If the host SLD mode is > >> sld_warn, then handle it in the same way as user space handling works: > >> Emit a warning, disable SLD and mark the current task with TIF_SLD. > >> With that resume the guest without injecting #AC. > >> > >> If the host mode is sld_fatal or sld_off, emit a warning and deliver > >> the exception to user space which can crash and burn itself. > >> > >> Mark the module with MOD_INFO(sld_safe, "Y") so the module loader does not > >> force SLD off. > > > > Some comments below. But, any objection to taking Xiaoyao's patches that > > do effectively the same things, minus the MOD_INFO()? I'll repost them in > > reply to this thread. > > IIUC they also deal with emulated split-lock accesses in the host, during > instruction emulation [1]. This seems also to be required, although I am not > sure the approach that he took once emulation encounters a split-lock is > robust. Yep. It's "robust" in the sense that KVM won't panic the host. It's not robust from the perspective that it could possibly hose the guest. But, no sane, well-behaved guest should reach that particular emulator path on a split-lock enabled system. > [1] https://lore.kernel.org/lkml/20200324151859.31068-5-xiaoyao.li@intel.com/