Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp284850rwl; Wed, 9 Aug 2023 14:41:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/FqIQ53pIxch+YFAVMX5pmaHmpsnyOwg6xp/8dk9mLIPFaPBvLowbergVeJpbIhzgyb6v X-Received: by 2002:a2e:958e:0:b0:2b5:8a21:5627 with SMTP id w14-20020a2e958e000000b002b58a215627mr331758ljh.51.1691617275731; Wed, 09 Aug 2023 14:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691617275; cv=none; d=google.com; s=arc-20160816; b=ZZYnSyTdWsQ6kpLLWLKXIRgNogOnW9tVGMFdW47klMTOaHY5tMsHwH207TZ6dcZQSf i3el9oJOAHuPJaP3Zw+z11AbN/8MDPObd2KbSbBtajk+S8A3MVP+sXlwHS6CbrHnXD/d EuTDuS+gu3WIaJQm8i6kHTw6fse5BZoMrrZ5SIRoxsmCmJvXiKNw9jnaywCpJ3DM16to /9Q5Earx4VagutNFhvZeYEIeL9qi7R1q+HMi2i7x0QL08S+hl9Ylu9YCgOw06XwKqIYP fScsMWKqpqCaqe6SXUXUaM3Yt57u65F5qYdD1uPutocS0y9PEfAnZ6mq6SiI9tClONb2 c4dQ== 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=JpA3RFdMht7iBEs06qI33SwAayiTbeDZD4PgWl3Pj98=; fh=Jwapm4lq68h1feOUtcYIIIrxRv5RQSItvJsoua3O5Rw=; b=CtKJLM6u2dOJwKjZ1w+zSSYTTStf6YTz7JL3jD8+/sJM0CLetlT4qWbm9XTy9PAF3R GDcXzJD+cTAUBLB3nkVoDg4HBGz9AXq4D4KeLRZfBHufrtnAxbEjvN3cY+/zNI1Bg6sM Te6ReP500PtV8KTu05Pj2I3yOef9+WS0ja3bXCGjlYuYzFP2LBbUeX3XSltWQ5zIPt1f ST79vULtKa1dbFfTW33/ogXJegjqghF64h2eWf3JUD/4GuawuVKrNqA18hu9s725bdKF SZsIYHQrInSm6vbJ5MnSyvhMb6/OygiK9W4w/XLFwSduXOXPrJMoUHa4Utmxh0XRa2V4 G8Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LlhWwa8v; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e21-20020a170906375500b0099bcf3c0ac6si78358ejc.472.2023.08.09.14.40.51; Wed, 09 Aug 2023 14:41:15 -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=@redhat.com header.s=mimecast20190719 header.b=LlhWwa8v; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230446AbjHIVEH (ORCPT + 99 others); Wed, 9 Aug 2023 17:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbjHIVEF (ORCPT ); Wed, 9 Aug 2023 17:04:05 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80CE0B3 for ; Wed, 9 Aug 2023 14:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691614999; 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; bh=JpA3RFdMht7iBEs06qI33SwAayiTbeDZD4PgWl3Pj98=; b=LlhWwa8v8mQxSf+PJPSnO54AFFqTQ9k7OHr7n1TOhghLFpjlKH3CPJ0zvxaTy2nbB3f987 yv2hPZ4EKvdLWr7IJqFNGx8X0HSrQUHhLaq+BSRe18pq8V3dQcdz8oSPK10iEiJUn4MWNq fyNPbD/+tzlCpleAam5zNpW/SeveiUg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-391-iZaueV4sNduKqMdVnyN6EQ-1; Wed, 09 Aug 2023 17:03:16 -0400 X-MC-Unique: iZaueV4sNduKqMdVnyN6EQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2619A101A59A; Wed, 9 Aug 2023 21:03:16 +0000 (UTC) Received: from localhost (unknown [10.39.192.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E7065CBFF; Wed, 9 Aug 2023 21:02:50 +0000 (UTC) From: Stefan Hajnoczi To: kvm@vger.kernel.org Cc: Jason Gunthorpe , "Tian, Kevin" , linux-kernel@vger.kernel.org, Alex Williamson , Stefan Hajnoczi Subject: [PATCH 0/4] vfio: use __aligned_u64 for ioctl structs Date: Wed, 9 Aug 2023 17:02:44 -0400 Message-ID: <20230809210248.2898981-1-stefanha@redhat.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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 Jason Gunthorpe pointed out that u64 VFIO ioctl struct fields have architecture-dependent alignment. iommufd already uses __aligned_u64 to avoid this problem. Reasons for using __aligned_u64 include avoiding potential information leaks due to architecture-specific holes in structs and 32-bit userspace on 64-bit kernel ioctl compatibility issues. See the __aligned_u64 typedef in for details. This series modifies the VFIO ioctl structs to use __aligned_u64. Some of the changes preserve the existing memory layout on all architectures, so I put them together into the first patch. The remaining patches are for structs where explanation is necessary about why changing the memory layout does not break the uapi. Stefan Hajnoczi (4): vfio: trivially use __aligned_u64 for ioctl structs vfio: use __aligned_u64 in struct vfio_device_gfx_plane_info vfio: use __aligned_u64 in struct vfio_iommu_type1_info vfio: use __aligned_u64 in struct vfio_device_ioeventfd include/uapi/linux/vfio.h | 27 +++++++++++++++------------ drivers/gpu/drm/i915/gvt/kvmgt.c | 4 +++- drivers/vfio/vfio_iommu_type1.c | 11 ++--------- samples/vfio-mdev/mbochs.c | 6 ++++-- samples/vfio-mdev/mdpy.c | 4 +++- 5 files changed, 27 insertions(+), 25 deletions(-) -- 2.41.0