Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7392060ybp; Wed, 16 Oct 2019 08:02:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPJzGIumqpv5/YzPzw0NmN6NxhhOQtDsrxCHQGM19rH+5gAX3dsNPfCOqLRgTYG1YLho79 X-Received: by 2002:a17:906:7c57:: with SMTP id g23mr40167790ejp.116.1571238137054; Wed, 16 Oct 2019 08:02:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571238137; cv=none; d=google.com; s=arc-20160816; b=ahLDQXfMGKV4IhSfY89BF4xzSXRuuyMFSIwv0GEPKAGq1yGwzct4mh4u+FvmeSXegf 9J/9LqB9u2afqqdWUVAsVxen9qAj69oC4sJjBzvAp1hTn5w1KiSNlj+YEhPjMIf2H3Eg SMiwY/gTypGwjZksFO6XdEHCTLiIY6bKNJhfRmQ4Tf67YwzEoHC7QZm+qsbzAatVVuSb 512Ogce+gWTWi+auQ8pN7ipXMbFnEIm/TsnO4yel9IurBR/URsqojtnKLBL3YZWd+3AX bBwftj0+fqbREkjLdA2H4JcriClB+jB9EDQzQuVkObSv80gqePVS8yG4bijYr+HyHnsF kCPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject; bh=AmDD8rV/4ss55aPkIj/Kxa/elLa9S+t5SdIR+jVrE6Y=; b=Mjbd6i66BDv98pMGko4xVxAckcY/3BID91bfwVH9x/Dw/bnl0Krshwf7pf1Ob9qIlI dlT9HbiH6MfRkVwqAvR7XwhCeX+lQrFEN6Za8YHaWO2sW5xy92GumQ1vxU5hgKIYEGxJ 4kJmexhk7a1GlQ0UOwlaliP9IhGJfMveo1bFRzC9C9/U4ygP1TS/dWd3kgyEU3QsVc3z rzmdOmvOKLiz8fThDMDdk+GjiCjVUvd0qCIEaWHt35/wMtv/MzY1OQ21TEWSHP2TJlsq jAXpdFrpCLn3P9fYgsCWo2zg9bsaxQhvMjJZjgrciQfMhj5AsNe1+mWMMwAlJE5Gkng8 HK3Q== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si15555980ejf.28.2019.10.16.08.01.52; Wed, 16 Oct 2019 08:02: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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404915AbfJPL0j (ORCPT + 99 others); Wed, 16 Oct 2019 07:26:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53537 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731902AbfJPL0i (ORCPT ); Wed, 16 Oct 2019 07:26:38 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BDD7E19CF92 for ; Wed, 16 Oct 2019 11:26:37 +0000 (UTC) Received: by mail-wr1-f72.google.com with SMTP id m14so11581264wru.17 for ; Wed, 16 Oct 2019 04:26:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=AmDD8rV/4ss55aPkIj/Kxa/elLa9S+t5SdIR+jVrE6Y=; b=c4jF/rGdr9XSQsLs3vWJuEQ/leTD50RFQNoUx5HZ90eVBVUytwY5Rzsv0zu0VgJB9p ysEflia/n8cZs6nblfbZBSj59FaSN3OobM09RZSGscYGxLvPkCNIHfqLxgN7pl8OqFxJ iW5e7YQTpuJNqW+Ry3fdUwrq2ZTVNhlkqvcU/A4YCDIGGPL/KLVbG9p85NiRZiq99QW0 gTBd6JCmJS5XwdmQjk9eDGGsWQez/JjBKNmd+fir0ysJY4sQ17Zf7z83/hMrT00eohBU XYV+wBazPNRSFtB2qu7BrIpeO5XOecvUoJS/dPyzAUCA5K8q2uLtciLDHhY1wSTKEzEI gJvA== X-Gm-Message-State: APjAAAVsNN3PpMgtDW7IjGt2ocb+pzLw0v0j0834F/MSwwAfdHLpG3Bi tyHZZtBqyTeF5uRDoyV/epgec3tkCVPt42WNgpEwRTS1XxfnkxEnpBUkj7VfNdv+3ghTYYtNGNe VfHdyQDBxhsxmr6cHklOhtT+q X-Received: by 2002:a5d:4a87:: with SMTP id o7mr2366015wrq.374.1571225196188; Wed, 16 Oct 2019 04:26:36 -0700 (PDT) X-Received: by 2002:a5d:4a87:: with SMTP id o7mr2365992wrq.374.1571225195888; Wed, 16 Oct 2019 04:26:35 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:d001:591b:c73b:6c41? ([2001:b07:6468:f312:d001:591b:c73b:6c41]) by smtp.gmail.com with ESMTPSA id n22sm2163146wmk.19.2019.10.16.04.26.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Oct 2019 04:26:35 -0700 (PDT) Subject: Re: [PATCH v9 09/17] x86/split_lock: Handle #AC exception for split lock To: Xiaoyao Li , Thomas Gleixner Cc: Sean Christopherson , Fenghua Yu , Ingo Molnar , Borislav Petkov , H Peter Anvin , Peter Zijlstra , Andrew Morton , Dave Hansen , Radim Krcmar , Ashok Raj , Tony Luck , Dan Williams , Sai Praneeth Prakhya , Ravi V Shankar , linux-kernel , x86 , kvm@vger.kernel.org References: <1560897679-228028-1-git-send-email-fenghua.yu@intel.com> <1560897679-228028-10-git-send-email-fenghua.yu@intel.com> <20190626203637.GC245468@romley-ivt3.sc.intel.com> <20190925180931.GG31852@linux.intel.com> <3ec328dc-2763-9da5-28d6-e28970262c58@redhat.com> <57f40083-9063-5d41-f06d-fa1ae4c78ec6@redhat.com> From: Paolo Bonzini Openpgp: preference=signencrypt Message-ID: Date: Wed, 16 Oct 2019 13:26:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/10/19 13:23, Xiaoyao Li wrote: > KVM always traps #AC, and only advertises split-lock detection to guest > when the global variable split_lock_detection_enabled in host is true. > > - If guest enables #AC (CPL3 alignment check or split-lock detection > enabled), injecting #AC back into guest since it's supposed capable of > handling it. > - If guest doesn't enable #AC, KVM reports #AC to userspace (like other > unexpected exceptions), and we can print a hint in kernel, or let > userspace (e.g., QEMU) tell the user guest is killed because there is a > split-lock in guest. > > In this way, malicious guests always get killed by userspace and old > sane guests cannot survive as well if it causes split-lock. If we do > want old sane guests work we have to disable the split-lock detection > (through booting parameter or debugfs) in the host just the same as we > want to run an old and split-lock generating userspace binary. Old guests are prevalent enough that enabling split-lock detection by default would be a big usability issue. And even ignoring that, you would get the issue you describe below: > But there is an issue that we advertise split-lock detection to guest > based on the value of split_lock_detection_enabled to be true in host, > which can be turned into false dynamically when split-lock happens in > host kernel. ... which means that supposedly safe guests become unsafe, and that is bad. > This causes guest's capability changes at run time and I > don't if there is a better way to inform guest? Maybe we need a pv > interface? Even a PV interface would not change the basic fact that a supposedly safe configuration becomes unsafe. Paolo