Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1757006rwb; Wed, 5 Oct 2022 04:29:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zSqnoHMIXHBGQwlRFtxbo2bjA+pAfE1zTNIpJNiqgx+NwBQz390Rf7ZlaxeD8Szr9NptD X-Received: by 2002:a17:902:d2c3:b0:179:ff70:2a15 with SMTP id n3-20020a170902d2c300b00179ff702a15mr31415848plc.77.1664969368949; Wed, 05 Oct 2022 04:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664969368; cv=none; d=google.com; s=arc-20160816; b=Q8TzXqhvUE8WC3Bc9F1Swjo8ZxqDVT7VDF0dRkVZryssVVHYMhBxQ+7SABDHd+ndtW syzQgfouA6FHSXIsde9ub1azjjKcVdfO/Hens2wEDbNFsWNswhIxECEY1mnvRC0vdOkE VscsxAsRuAn8z3rhqAmDSmYHDdBOZW6AltrpggT9ry3vuYPDJGREm8jMxmUw82AzO3fV TFSvli7xf+aKKoB0HCqNACrrTDM28OTt/4nImksJEX+Sl2Hd3BTbBX0n1iUNfpcC4VQe T6jL6imHQ0k2x/B2pgm/Ez40FEGr7MWid0FaPlWAEF49ZMEIUdDuKhTxy+Ieo/fwolsM 4rpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Mn2ERzJt4xEctpaemvG4sO9hC3a9tpeTQ3BtEW76vKI=; b=V8nSK4LLlSBKvhVA8MZWfPKaqKK8EIok1xLU6yJYSkM+10tEefb/iWF8fo/p4353k+ c4/BeuS41QTKhfhvW3kh5NMQ0lUrqvFdcP2z5BVuvniD6XH+aIKzOw8+3NYNIxm9ANDR Z94J9noD0Aj9dUbZTB0R0vpTZ/mpUlliD/x6lq7gIcGcRpzJFNvh8m4452zL4ZXFJ9Hk Y5FWxFRc9vvpz6M/OzFQDfrOTfbAryI16I1Nr/XDAM5xXXBnsGUw0Uwe0iOdxRZb2Fi1 sGsr1x8tSwiXcviBLzIknW4rN1ZcnVojWmsfFxvDMwvMgD0koEHX/Up3gTZPWVHQNTVx 2dlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="PfVG4z/1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020a63e307000000b0043954dec8c1si14199347pgh.615.2022.10.05.04.29.16; Wed, 05 Oct 2022 04:29:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="PfVG4z/1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229715AbiJELDM (ORCPT + 99 others); Wed, 5 Oct 2022 07:03:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbiJELDK (ORCPT ); Wed, 5 Oct 2022 07:03:10 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6448B6CF4F; Wed, 5 Oct 2022 04:03:07 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0FDCB218FE; Wed, 5 Oct 2022 11:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1664967785; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Mn2ERzJt4xEctpaemvG4sO9hC3a9tpeTQ3BtEW76vKI=; b=PfVG4z/1OzaVpXpTB/EtYtDvm0Clx6Ojw24ScC8wkwrg3FX8MZ8CHsTfH1GXTTEqfOLljI 152mpZVrMGozo3d/l+uCpTkGfqL//JcoKMWw2bvXKyPv1mgILh/FNFjVO1X1o+Cwc253iA 3zrdguoCBHG1ytezJtEmFNBAJURdWzg= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B03A313345; Wed, 5 Oct 2022 11:03:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id dt+zKWhkPWPbQgAAMHmgww (envelope-from ); Wed, 05 Oct 2022 11:03:04 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-doc@vger.kernel.org Cc: Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , xen-devel@lists.xenproject.org, Jonathan Corbet Subject: [PATCH v3 0/4] xen/pv: sanitize xen pv guest msr accesses Date: Wed, 5 Oct 2022 13:02:58 +0200 Message-Id: <20221005110302.13455-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Historically when running as Xen PV guest all MSR accesses have been silently swallowing any GP faults, even when the kernel was using not the *msr_safe() access functions. Change that by making the behavior controllable via kernel config and via a boot parameter. This will help finding paths where MSRs are being accessed under Xen which are not emulated by the hypervisor. Changes in V3: - new patch 2 - addressed comments Juergen Gross (4): xen/pv: add fault recovery control to pmu msr accesses xen/pv: fix vendor checks for pmu emulation xen/pv: refactor msr access functions to support safe and unsafe accesses xen/pv: support selecting safe/unsafe msr accesses .../admin-guide/kernel-parameters.txt | 6 ++ arch/x86/xen/Kconfig | 9 ++ arch/x86/xen/enlighten_pv.c | 99 +++++++++++++------ arch/x86/xen/pmu.c | 71 +++++++------ 4 files changed, 127 insertions(+), 58 deletions(-) -- 2.35.3