Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp520895lqt; Mon, 18 Mar 2024 15:12:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV+kGrmBLQKrccgGzF2uyXLqJgZsb4apohLQiCw8L3+AFZYFxXXoPFPrnA/7p2xBplwZpKeYkdy/c8q5fv2Q7Q0h2dI5zpi0y406Vut7Q== X-Google-Smtp-Source: AGHT+IF23IHhxms6tJsq6OTEUivL6r9QtxIaly6d/LYtCUofKZpHBZveR9UMI+PkzP+i1WKwZtIs X-Received: by 2002:a05:6402:1945:b0:566:fbf5:a279 with SMTP id f5-20020a056402194500b00566fbf5a279mr9891698edz.20.1710799943329; Mon, 18 Mar 2024 15:12:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710799943; cv=pass; d=google.com; s=arc-20160816; b=fHNsed/3L1KdFsWFOxGw2kz7Cl1+V1Do40L5a7kt+pdfGdVNhKk8oREze9mg/4tZhg v185RKCYWTPNBgPj89QqQR2m36+zPyyhhMW0/4F+tFvk/N936Lk4yce6/4YUDKXcAkqW h/0QldKJDL85k/5pO6ZOlenpibQc1abkm02+29s9DfguG6jrvtreQMZuqddh6JKoEl0F 0hE1dykLuatHqFI/RBqjjCud5A4vfKwzrrHsP5ExPTBpHiuIjDS7EqhwPp14KbqlT1Pj ZXH7o/x8WTapDOHQepP4zL+o6+/6P2aftfOrg+5Ehhzgd5fRFTITbmsZtahoVBF9IkwA 9wlg== 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:dkim-signature; bh=dlbCs/oY8pq5Hz3ScnLWN4ip71+tL2nCn+OgiiJ657w=; fh=mEiK6EAhppHSBdiFS0K/9nMLnF0aV9z5zIH12LDm4u0=; b=k9BN47Y296jL250clD5vmCT6aAFL33RXGFxp6KQjyAizTXKwSM7HoZbSKQp0NDqb/r B06z+oDkpqjOtWtQRdDu3vuYcGDQcaeeq+8m3HyLj+8AAGdjsUFWbhBZ3u+QcDt/2rfR 3jvwHLU+tN6T3vWPHzv59CWOKnk9uit88H+kvBkQm1EaxybutzyeWGZGn5biKxkk9bjJ 9OJtj/hRc2pDsYkkv9SBRpw3kXWRe/CXULrnwiOUqssdWu9Vqh5Uv37Afp3TryNpwcvM aKBlf5BpCHSRdr6EXC3gONr8ejEfPiXFxETg63qlL+ddji5nun/6UQdsB3GzSpkIbcu3 ginQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W7TZgBg9; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-106745-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106745-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i16-20020a05640242d000b0056b8454693bsi565049edc.42.2024.03.18.15.12.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 15:12:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106745-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=W7TZgBg9; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-106745-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106745-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 13F9D1F222B5 for ; Mon, 18 Mar 2024 22:12:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 367425C8F1; Mon, 18 Mar 2024 22:10:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="W7TZgBg9" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D241E5A7A7 for ; Mon, 18 Mar 2024 22:10:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710799812; cv=none; b=M6YL5ClHoiJ4lANAQyHq3OFx/Sj9XhY8P5RR937r37M0Rt3F/EKIg4CVZJbPJO5w4IQkmgVrBSYK9TbpUQg3bSn91Aqs3QUHsP4i8wD2axqJ8CHcdpFOnpG2gOVPqdAB/OC0doogXomiSEjtxnvusb5eHndyo/5BtMdbfEZcEbk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710799812; c=relaxed/simple; bh=WDJgBGpsjfapdQHO9gSdZJmkJ2P8LFMBkWTD21ibKpc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=g8GPfle2DiBVvXSQi8oXXkRP/EkMsPqYFghpjZzvF/tWjaIVw5/wGZIs8I1OYRqRl4y+INbOdZF9ggTx+JKqJexEMhAXdWbOmWY4Aup7Hw7rEHMmS6mVsRYbXT6ebUP/bGabOx/1MgRo2D//L3kYdalOdD9vsbGxmThmv1Sgc2Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=W7TZgBg9; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710799809; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dlbCs/oY8pq5Hz3ScnLWN4ip71+tL2nCn+OgiiJ657w=; b=W7TZgBg9VfEPBrELDCNUn6w12yFF8DfVK97AtDvZVxkQEb/Rz6qPPdP3YuAVbC7gzSRVrT e/HVTdRFKqOulcpHwo4ijjttOjCxHi5EqBKSJuqsgeyLFW3kIIMPvajIPvf1YCsM2VV4cG oc6P1EL57gOusRucJyQoSHV4j/x3Y8Q= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-Chlckh1nNliuyWf8NiOs8Q-1; Mon, 18 Mar 2024 18:10:04 -0400 X-MC-Unique: Chlckh1nNliuyWf8NiOs8Q-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 840623C0BE2D; Mon, 18 Mar 2024 22:10:04 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 618F2492BC8; Mon, 18 Mar 2024 22:10:04 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: seanjc@google.com, Michael Roth Subject: [PATCH 5/7] KVM: SEV: fix compat ABI for KVM_MEMORY_ENCRYPT_OP Date: Mon, 18 Mar 2024 18:10:00 -0400 Message-ID: <20240318221002.2712738-6-pbonzini@redhat.com> In-Reply-To: <20240318221002.2712738-1-pbonzini@redhat.com> References: <20240318221002.2712738-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 The data structs for KVM_MEMORY_ENCRYPT_OP have different sizes for 32- and 64-bit userspace, but they do not make any attempt to convert from one ABI to the other when 32-bit userspace is running on 64-bit kernels. This configuration never worked, and SEV is only for 64-bit kernels so we're not breaking ABI on 32-bit kernels. Fix this by adding the appropriate padding; no functional change intended for 64-bit userspace. Reviewed-by: Michael Roth Reviewed-by: Sean Christopherson Signed-off-by: Paolo Bonzini --- arch/x86/include/uapi/asm/kvm.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h index ad29984d5e39..ef11aa4cab42 100644 --- a/arch/x86/include/uapi/asm/kvm.h +++ b/arch/x86/include/uapi/asm/kvm.h @@ -694,6 +694,7 @@ enum sev_cmd_id { struct kvm_sev_cmd { __u32 id; + __u32 pad0; __u64 data; __u32 error; __u32 sev_fd; @@ -704,28 +705,35 @@ struct kvm_sev_launch_start { __u32 policy; __u64 dh_uaddr; __u32 dh_len; + __u32 pad0; __u64 session_uaddr; __u32 session_len; + __u32 pad1; }; struct kvm_sev_launch_update_data { __u64 uaddr; __u32 len; + __u32 pad0; }; struct kvm_sev_launch_secret { __u64 hdr_uaddr; __u32 hdr_len; + __u32 pad0; __u64 guest_uaddr; __u32 guest_len; + __u32 pad1; __u64 trans_uaddr; __u32 trans_len; + __u32 pad2; }; struct kvm_sev_launch_measure { __u64 uaddr; __u32 len; + __u32 pad0; }; struct kvm_sev_guest_status { @@ -738,33 +746,43 @@ struct kvm_sev_dbg { __u64 src_uaddr; __u64 dst_uaddr; __u32 len; + __u32 pad0; }; struct kvm_sev_attestation_report { __u8 mnonce[16]; __u64 uaddr; __u32 len; + __u32 pad0; }; struct kvm_sev_send_start { __u32 policy; + __u32 pad0; __u64 pdh_cert_uaddr; __u32 pdh_cert_len; + __u32 pad1; __u64 plat_certs_uaddr; __u32 plat_certs_len; + __u32 pad2; __u64 amd_certs_uaddr; __u32 amd_certs_len; + __u32 pad3; __u64 session_uaddr; __u32 session_len; + __u32 pad4; }; struct kvm_sev_send_update_data { __u64 hdr_uaddr; __u32 hdr_len; + __u32 pad0; __u64 guest_uaddr; __u32 guest_len; + __u32 pad1; __u64 trans_uaddr; __u32 trans_len; + __u32 pad2; }; struct kvm_sev_receive_start { @@ -772,17 +790,22 @@ struct kvm_sev_receive_start { __u32 policy; __u64 pdh_uaddr; __u32 pdh_len; + __u32 pad0; __u64 session_uaddr; __u32 session_len; + __u32 pad1; }; struct kvm_sev_receive_update_data { __u64 hdr_uaddr; __u32 hdr_len; + __u32 pad0; __u64 guest_uaddr; __u32 guest_len; + __u32 pad1; __u64 trans_uaddr; __u32 trans_len; + __u32 pad2; }; #define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0) -- 2.43.0