Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp364190pxb; Thu, 5 Nov 2020 02:02:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfDHAuKFMRm65ODLO8pAJz/MH/kDzYuQpeXKf/pg9ymg/TmFs6hPefBV3LLHFd5tsKAggk X-Received: by 2002:a17:906:3fc1:: with SMTP id k1mr1426773ejj.287.1604570570150; Thu, 05 Nov 2020 02:02:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604570570; cv=none; d=google.com; s=arc-20160816; b=nKtzhslSEe/cXVVLm7r1MvXrq4wxQqJvjWEvxDWYKVLNqVaODakRTq0hoOS6HRdvqW BHOBh/nlrQe3ekixMk7OtHFmtD/pgI7HHDYHu2iSGdBmPQ4wqtS6QdFUxhDD+freuSGb rRaPcFbDzeB8czZmyvzeBghpN3/tfI9e8e/yGYj20Jqp3IJDdqF/CZM4XFU/LJcbryL2 sIdMNXiPCo+Aq0NOuYurcBGLveO/eyaznlvreaqMmedhuAID2PXtO4EVtQK/R4hNf2kV 1J5UsJAndsZDWxJqaO4UyrBjJ/uwHk8xxe4kAB6dbvDtFluWxOgrgzX7suJnZ+JNkpbX 4MLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=jS3AjLIwPCzBea4FOzHlbb/BUo9e06PlXidc5fhBDDE=; b=K4s6urydgkCtIuW2oybby3+yD0aDY9NJiwkGYHGodDFmWz9iraFD/viav8Am70JKxJ ordhV/o+cnrFBPfN+HCFmZfgNKIDeoUsQws8f6HVW6BGj0+7MoVArCWDdIeLarc2lgpE RO3ToLU1i2UZIlrEOIMbyMA2H2XFul+H68qFOUF81voihsoXnSRMU0oKiOPMhgxPCBhW DBTZUvY/4ZvAyd13f8Hp5HAoL+qKZyHItzIbuHWqgA2dVgPHeMaIr2AB1ZG4TsOscyOt g48JE8Yy7NjvPg/f+FxsQQK//VD9mDiVdJcpmEchPbZNSCHDQxYJq+2K0hFNHvz8aabo 76+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HlgXFWTj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si795716edw.337.2020.11.05.02.02.27; Thu, 05 Nov 2020 02:02:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HlgXFWTj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728320AbgKEKBG (ORCPT + 99 others); Thu, 5 Nov 2020 05:01:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbgKEKBG (ORCPT ); Thu, 5 Nov 2020 05:01:06 -0500 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB56CC0613CF; Thu, 5 Nov 2020 02:01:04 -0800 (PST) Received: by mail-io1-xd44.google.com with SMTP id r9so1188632ioo.7; Thu, 05 Nov 2020 02:01:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jS3AjLIwPCzBea4FOzHlbb/BUo9e06PlXidc5fhBDDE=; b=HlgXFWTj9dK17aJo0PyuS0+lAp810EmKbUjZngqXK7B2xZQiAE/UijxaVqVhazE160 3Tgq5eXWEdMdOveC+WkWC2ZvAUDW8BPxEFK/WRJhS45sPRVOuXBnemAUQIXg8OJhlEpN 3O3O1uB3oOPWRWFKxCBKRLz+kUNB2oK16sX8Xs5sA4dTMNi5F0XV0oVQx4YFWeAXkQxN +yb17klsF1hwclTZIOiae76fPHY7UqiLZff0Zw5WtMh7ItK5RBwlzRPWKPSD1Fc4fucc avjmNyLSrXbMr8bxy68iHH5HyXrgYXbEAsnATK4eaieEKL3sPfPs6OH6ImXpaBL5gL3u GFKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jS3AjLIwPCzBea4FOzHlbb/BUo9e06PlXidc5fhBDDE=; b=Oeg4Aem11kDkpZZYPnSnu8DbkJA4JtcN0pLmXKd2EPe8zCP1+oMVm1YGortDSsiszi c9UjRQ3yn38euRpfGeWYFbLf4Y5u42WCIa8MHfMG8HFjDFtmaYND62vU+9lQYvwiOjUk IvALOYQIkxKQZTRMxFBM72BBhKlELc7UAWdWnGQUs8MmtuBsHOfeyj5SqEw5vhcniCGG wRP5zYOLWre0EBLfbRJ+ajgSwO4RNp2Q0DseSff9RUue55FjsuY9e3bt9iOL7zaewvBj 4qxKaoKybDdKvOO/nfCQhcqomhr50bahKzb/IIFOmY6xnH0bQDBXEUdHNol+GU3kjWe0 X6jg== X-Gm-Message-State: AOAM530pRoQaAKzz0Wp5I9WqNjnqNqwR+E6S9SgI8/jC3MGbbkJxb2Je P9ObupryesyyJkSm75a4qvO3vKCFqtUq3IAYB+s= X-Received: by 2002:a6b:9089:: with SMTP id s131mr1191374iod.36.1604570464223; Thu, 05 Nov 2020 02:01:04 -0800 (PST) MIME-Version: 1.0 References: <20201101115523.115780-1-mlevitsk@redhat.com> In-Reply-To: From: Pankaj Gupta Date: Thu, 5 Nov 2020 11:00:53 +0100 Message-ID: Subject: Re: [PATCH] KVM: x86: use positive error values for msr emulation that causes #GP To: Maxim Levitsky Cc: kvm@vger.kernel.org, Borislav Petkov , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Paolo Bonzini , Thomas Gleixner , Vitaly Kuznetsov , Joerg Roedel , "H. Peter Anvin" , Sean Christopherson , Wanpeng Li , Jim Mattson , Ingo Molnar , Qian Cai Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > This looks good to me. This should solve "-EPERM" return by "__kvm_set_msr" . > > > > A question I have, In the case of "kvm_emulate_rdmsr()", for "r" we > > are injecting #GP. > > Is there any possibility of this check to be hit and still result in #GP? > > When I wrote this patch series I assumed that msr reads usually don't have > side effects so they shouldn't fail, and fixed only the msr write code path > to deal with negative errors. Now that you put this in this light, > I do think that you are right and I should have added code for both msr reads and writes > especially to catch cases in which negative errors are returned by mistake > like this one (my mistake in this case since my patch series was merged > after the userspace msrs patch series). > > What do you think? > > I can prepare a separate patch for this, which should go to the next > kernel version since this doesn't fix a regression. Patch on the top should be okay. I think. Thanks, Pankaj