Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp21003lql; Fri, 12 Apr 2024 02:14:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUav46UKIfGSxN/6gmDrkQgI+P6wrOKVh68Gwqcl7JHPo8ecMbWqfTsF+qkcxPBG6l0O6DIinLATZjF2YwEH1SoJHWJLkjuzf0VEACdyQ== X-Google-Smtp-Source: AGHT+IHQtf6If7nUbnSCZje6fCe79KfWy6sn3HR8dYd5JfIx0T/EVVMlXL25sSLEq0O7YnCufe6E X-Received: by 2002:a17:902:7616:b0:1dd:bf6a:2b97 with SMTP id k22-20020a170902761600b001ddbf6a2b97mr1656320pll.60.1712913279957; Fri, 12 Apr 2024 02:14:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712913279; cv=pass; d=google.com; s=arc-20160816; b=njC+aA3krgRfQJCEozcKLx6AmgHVuK3E73hKs4bXvHoP3bbp5zJaKitvoL0RcpKj2t qD90TWRvELJWrZ9cnTup3IAb15uG1hZI/MY31RI37BPicIQ43rpKl9DdDMPQlIaBU62s ZXgWpcz42hGmNZbKVtvxT+bDD2z5qDHxN68FOQTV0Hii+y0HKZ9D1p4/3YJk5C80Qyo8 KuZxwyDeAtzDmOvqLofSfroKxa1lmTDa4aQfWbWG9o90awfhSae57RAmRc84dKsOssm/ FlM4t687H87PnFXMz2yMA1QYLIOueJHY1WZ6L46fgWf5oql/xychS6OBzNJ5mLrGscU7 3tDA== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=BKk3SJNlaRyiPMsyrmveH9ZdUGra8oXvrbmnoShglS4=; fh=NDCPdPn2hiqHaiIRDYQAzsW9PK20CTia4nECGof6enU=; b=aj6LgS2yyAqnndlhTTJpw/Z3knNLSuk9wioE7CopZYfUwL68KGvCeJzJEGBGc68Ce+ VNWdOv4P1kxYh66vL1rjkDfdXHT1nFWh2Jwtq5RK/kGCWF7c2XkuNsOSDR8Cg+6D9fZM nEoIeAYENmUBtMIKCZXt0jIA7fOiyS8pNz48lBbtpqX7yHYotm16KcIPHB3V1X3bYNb4 Qjhz0SpzuRTNIhVPmEUFqNgPHmJg6w7/YafYBcG3Cx5b06pKvG213SbpHe44F8m/rJR6 yDvX/dVIAFPHabi0nTC85rJeWHalVpOEG2+6niY67R65bBv0cDqIH2D0F3zRZ00xKa2h AzGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-142296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142296-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 q12-20020a170902dacc00b001e433763b5fsi2861208plx.590.2024.04.12.02.14.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 02:14:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142296-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; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-142296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142296-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 D5610B228C3 for ; Fri, 12 Apr 2024 08:56:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D49F86146; Fri, 12 Apr 2024 08:44:21 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAA2554901; Fri, 12 Apr 2024 08:44:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712911461; cv=none; b=PD1VSRncCco1wQ4vH0jIGo6XbxkPpyvwQkufwo1PuleANLkfvhPLJVjNdxsz+NdWQKU7kw4lkqfNloYtRU/lyqkvLeicLw7qQhT40sO2GWTGxAbLsDpEb0lco7McMuyruQfpIn256Qd0i7SZ58lxZdyip42HIuTExavfXWLXcPw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712911461; c=relaxed/simple; bh=AAZ7KwRadho06sOIvrpNoa0AgAyOkuF1mCTkwi4BTLE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DsgkiG1zN9srj+oYGc5AFoXOYELryUJVjAw4Qw/77C8w/QiFLLQT/4yruNVkJKqSDb1GV0OK6myfJi95YHlilhxztIx5+fBSqWHchAgiiJwy2ktQ9i3YFkVhcR+5wNZVgO4PWdsRtOvdfZ3uKdCx/JFou8zYWsPfxs2rbjJFnBk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BF106339; Fri, 12 Apr 2024 01:44:48 -0700 (PDT) Received: from e112269-lin.cambridge.arm.com (e112269-lin.cambridge.arm.com [10.1.194.51]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 634793F6C4; Fri, 12 Apr 2024 01:44:17 -0700 (PDT) From: Steven Price To: kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Steven Price , Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni Subject: [PATCH v2 26/43] arm64: Don't expose stolen time for realm guests Date: Fri, 12 Apr 2024 09:42:52 +0100 Message-Id: <20240412084309.1733783-27-steven.price@arm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240412084309.1733783-1-steven.price@arm.com> References: <20240412084056.1733704-1-steven.price@arm.com> <20240412084309.1733783-1-steven.price@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit It doesn't make much sense and with the ABI as it is it's a footgun for the VMM which makes fatal granule protection faults easy to trigger. Signed-off-by: Steven Price --- arch/arm64/kvm/arm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index a0dcae0391d0..f2279ab45add 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -339,7 +339,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) r = system_supports_mte(); break; case KVM_CAP_STEAL_TIME: - r = kvm_arm_pvtime_supported(); + if (kvm && kvm_is_realm(kvm)) + r = 0; + else + r = kvm_arm_pvtime_supported(); break; case KVM_CAP_ARM_EL1_32BIT: r = cpus_have_final_cap(ARM64_HAS_32BIT_EL1); -- 2.34.1