From nobody Thu May 2 18:25:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591180182; cv=none; d=zohomail.com; s=zohoarc; b=ihAT5BlhrZsmHASz/CKG3AA3oczVPV+lfFmIxQSvP3HBHjyZYsD1kgmxCSj3p2zoC4eZdpQ5+SrLKvlie2qSbrG+v1NJlOOMaZojvBo9kg4BWGYv0O51ssg63mVVHhW5CPPwDg/RcsNJVpGwghI/gDyTSdquluxCMNnUoPc6z6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591180182; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=j1IKrR261CR07hz4uXTFccwYPx76G2C9QDrzderQrWw=; b=HnibIOs8wo0vFPBg2GZD+xwik6l6cs4QgPFluVeWeqhek/NbhLvAsfWW2FvDAPCRsTsBdwvJ9H5klpGzBfTtjJQLwv6WmR9+GkU72KTT8Ge6lB8Js9EEWr3fpImRq6+2b9juLuujq3iPOBwd33Hs2Sme1NCBbuRiXo6hHl0xcWE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1591180182018942.4970500446741; Wed, 3 Jun 2020 03:29:42 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-25-zjRwLi8OO3SEYBWJ7zx2Jg-1; Wed, 03 Jun 2020 06:29:38 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F3A88107ACCD; Wed, 3 Jun 2020 10:29:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B2185C240; Wed, 3 Jun 2020 10:29:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5A0E01809543; Wed, 3 Jun 2020 10:29:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 053ATP1Q005052 for ; Wed, 3 Jun 2020 06:29:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0FBF3610AF; Wed, 3 Jun 2020 10:29:25 +0000 (UTC) Received: from catbus.gsslab.fab.redhat.com (mustard.gsslab.fab.redhat.com [10.33.8.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F90D60C81; Wed, 3 Jun 2020 10:29:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591180180; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=j1IKrR261CR07hz4uXTFccwYPx76G2C9QDrzderQrWw=; b=iLYepDh+lMAmDTzIK5HYEmMVkUvefE8UNHwjdoTOO1owICH7BB+ph+4PW0dolP/eC7CxA1 CTfWtw9oKHGVblv2AycSOTkaUwdejxJGfy2jt+e85uLNWf3k+cSa5lhVtqj5hCam1NLwQM EN1n19ufk5LDBuHt0djWnE85DErK7YQ= X-MC-Unique: zjRwLi8OO3SEYBWJ7zx2Jg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [PATCH] conf: force 8 byte alignment for virObjectEvent Date: Wed, 3 Jun 2020 11:22:47 +0100 Message-Id: <20200603102247.881817-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) We need to be able to cast from virObjectEventPtr to one of its many subclasses. Some of these subclasses have 8 byte alignment on 32-bit platforms, but virObjectEventPtr only has 4 byte alignment. Previously the virObject base class had 8 byte alignment but this dropped to 4 byte when converted to inherit from GObject. This introduces cast alignment warnings on 32-bit: ../../src/conf/domain_event.c: In function 'virDomainEventDispatchDefaultFu= nc': ../../src/conf/domain_event.c:1656:30: error: cast increases required align= ment of target type [-Werror=3Dcast-align] 1656 | rtcChangeEvent =3D (virDomainEventRTCChangePtr)event; | ^ ../../src/conf/domain_event.c:1785:34: error: cast increases required align= ment of target type [-Werror=3Dcast-align] 1785 | balloonChangeEvent =3D (virDomainEventBalloonChangePtr)= event; | ^ ../../src/conf/domain_event.c:1896:35: error: cast increases required align= ment of target type [-Werror=3Dcast-align] 1896 | blockThresholdEvent =3D (virDomainEventBlockThresholdPt= r)event; | ^ ../../src/conf/domain_event.c: In function 'virDomainQemuMonitorEventDispat= chFunc': ../../src/conf/domain_event.c:1974:24: error: cast increases required align= ment of target type [-Werror=3Dcast-align] 1974 | qemuMonitorEvent =3D (virDomainQemuMonitorEventPtr)event; | ^ ../../src/conf/domain_event.c: In function 'virDomainQemuMonitorEventFilter= ': ../../src/conf/domain_event.c:2179:20: error: cast increases required align= ment of target type [-Werror=3Dcast-align] 2179 | monitorEvent =3D (virDomainQemuMonitorEventPtr) event; | ^ Forcing 8-byte alignment on virObjectEventPtr removes the alignment increase during casts to subclasses. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik Reviewed-by: Pavel Hrdina --- Technically a build-breaker, but since we don't have any existing usage of __attribute__((aligned)), I wanted to get a second opinion on this approach. One alternative approach would be to switch one of the current "int" fields in virObjectEvent to "long long". src/conf/object_event_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/object_event_private.h b/src/conf/object_event_privat= e.h index b31441c53a..126464a9a5 100644 --- a/src/conf/object_event_private.h +++ b/src/conf/object_event_private.h @@ -42,7 +42,7 @@ typedef void virConnectObjectEventGenericCallback cb, void *cbopaque); =20 -struct _virObjectEvent { +struct __attribute__((aligned(4))) _virObjectEvent { virObject parent; int eventID; virObjectMeta meta; --=20 2.24.1