From patchwork Fri Feb 9 18:37:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 199061 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1055104dyd; Fri, 9 Feb 2024 10:42:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdEUh8YzhtyMXlr0JPvvYPuKXh1C49RyIC5/k+dp1lKgJTP72jUfQ/hnUJ1eKg01I/f+sR X-Received: by 2002:a05:651c:2114:b0:2d0:d609:d2 with SMTP id a20-20020a05651c211400b002d0d60900d2mr2268066ljq.5.1707504162429; Fri, 09 Feb 2024 10:42:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707504162; cv=pass; d=google.com; s=arc-20160816; b=iemSvQyzbK4Dlch5Q/O1AqcBHzgjTe+j98bw0v2cjO0j1YIITHhg364BMPx1yQYmJD pWkulKjXn1Ux//CIYETV7mo4mqhqZp1PPag02WqKcCEXzoffYtxkbhJLzhWJR2BeagcY slQgvSeq7PMnlwWmBq8AORF7mnXv9teaxakYQAgg+ijSnKwd7hZO8zL0iYdOVKU1BidL y/G1gqVJhJfrulYDVQUOsj6oEtcLuAbEh/GNUuY7adZNYqZwsYDzd0rCDpQU1VuksS3R zvzxlxkwRfaDD9liVW7MK6KNppv6IN2eLnNunE2zzCBMn5zu2BLPaLbdG+t4wMfunWjr Yo2w== 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=JKkYDmGY73Td6rgzpl/wuBQjFppyMsRM8qHK/Ed+sVo=; fh=4D0Y7H1fNoOrxNrYgEPuIwF0UOv/BEz4Y/50ZwjotVE=; b=SoMVRbGFxAxTYw6NjGyjxUBp/xnpVW/MUro2Hg645F2m/pO2XxU0Uzl77/N3UWVEm1 AEu4buF1wajKntL97U70WDUDPJRsJsNxnMrXM/k3rDVL//pWmyoycNCnL2Znt+Wqjh8C 2lGF2vkdKpHktgzzibfWKcI3hN9s5e2gvLMX2Rubl7AUtflWV1KUrS0szGwJZ9qjVDVD oUzQTWU1Tm5lndp1V4ohMCUomw/e5jQfbeYf6DyeUxkhpFZpOGSBtCfc/HzGEiRXE6oi TiQTIi2TBliM1JNP+dkuuwtUigzOXregc6o7PK1dQAVVB2E9UoIWKK8S8EzVlJZhO84v xeFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CvGa4QYN; 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-59816-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59816-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCXWL9XX+D7a0rA8BS2Ft3yMzFWlzVkBvNBFRKkJbiI3Htyyj+ej6ELbKd+z7ATGpK8FyTWZrUpZ42C9SXNrlqatxtb0bw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i13-20020a056402054d00b0055f8efcea96si1091953edx.499.2024.02.09.10.42.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 10:42:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59816-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CvGa4QYN; 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-59816-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59816-ouuuleilei=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 388531F290E6 for ; Fri, 9 Feb 2024 18:42:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2C8A12BE81; Fri, 9 Feb 2024 18:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CvGa4QYN" 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 0429B81ACB for ; Fri, 9 Feb 2024 18:37:50 +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=1707503873; cv=none; b=VMq60ENmSEW3niJs8waOD7tNVSHIPHdy+pBghLVxfuCp5HO29tYAt9B2GQvBTt7iVAVWaXBKuYp7ai3J+6uPUVvZ3VR796kXTKj9CC063r7SKbL0H68RLEkI6cG+Bb1Wpyuqtsbx9auneG03jVXHIQyamvMY41XcTs0nTcEWhrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707503873; c=relaxed/simple; bh=RxLLfzATPd8CcL00JsXxdxAVXGNsjasSdMTb1hKqlkw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=ryDLKCQYLdXviOv7Ce7jZYIksIyhR90lYhgL8lKZx3704uF/9l4h035nVTCyiAhyytEDmzpJDji2kDiciKgyhEm9ETjJIRsd3ZxwmsMHxW0s0YufqN+qOtyD4fNvTsiRfHdgw4GtZZr1hFxTIAoxtTErx15qlv+0gngORY8Df6A= 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=CvGa4QYN; 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=1707503870; 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=JKkYDmGY73Td6rgzpl/wuBQjFppyMsRM8qHK/Ed+sVo=; b=CvGa4QYN98VdeqNdHwMIEnfbe4dB26NLGB7Fw/dC0GRntbHCVrEFUHr79vnToi597cEXPk RuMXPR75cckF6WPgqUvIfWMVHcrIwAhzqCa/OQv2XXTTD+E46SwjBAiis2MdhJ8h8H+ze+ Szy4xmlGs1VyA/0Q2B3uH9UXfYgC9Jc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-473-IZfBK3ZGPgeFnIlnfZE0gg-1; Fri, 09 Feb 2024 13:37:44 -0500 X-MC-Unique: IZfBK3ZGPgeFnIlnfZE0gg-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 265B584F9D2; Fri, 9 Feb 2024 18:37:44 +0000 (UTC) Received: from virtlab511.virt.lab.eng.bos.redhat.com (virtlab511.virt.lab.eng.bos.redhat.com [10.19.152.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC9CC492BC6; Fri, 9 Feb 2024 18:37:43 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: seanjc@google.com, michael.roth@amd.com, aik@amd.com, isaku.yamahata@intel.com Subject: [PATCH 01/10] KVM: SEV: fix compat ABI for KVM_MEMORY_ENCRYPT_OP Date: Fri, 9 Feb 2024 13:37:33 -0500 Message-Id: <20240209183743.22030-2-pbonzini@redhat.com> In-Reply-To: <20240209183743.22030-1-pbonzini@redhat.com> References: <20240209183743.22030-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790447884700596498 X-GMAIL-MSGID: 1790447884700596498 The data structs for KVM_MEMORY_ENCRYPT_OP have different sizes for 32- and 64-bit kernels, but they do not make any attempt to convert from one ABI to the other. Fix this by adding the appropriate padding. No functional change intended for 64-bit userspace. Signed-off-by: Paolo Bonzini Reviewed-by: Michael Roth --- 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 0ad6bda1fc39..b305daff056e 100644 --- a/arch/x86/include/uapi/asm/kvm.h +++ b/arch/x86/include/uapi/asm/kvm.h @@ -687,6 +687,7 @@ enum sev_cmd_id { struct kvm_sev_cmd { __u32 id; + __u32 pad0; __u64 data; __u32 error; __u32 sev_fd; @@ -697,28 +698,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 { @@ -731,33 +739,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 { @@ -765,17 +783,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)