From nobody Tue Aug 08 14:10:41 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RKw8214tQz4mPVc; Tue, 8 Aug 2023 14:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RKw820f2Vz3Px3; Tue, 8 Aug 2023 14:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691503842; h=from:from: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; bh=aNSFIf4RWi0tEaa/C9tcQfXXxaUugOPLUDW1CedmJhE=; b=M7V3egbTNhyvX7RxxeUX6I17jcQWE81ndg5c1wOxjln1SoM3eE0vQqUEt8EtClCuDLk2aq EUvhPwxz90l66Fh/h3teYL4JrR8iivVDpalbKsYxvSJCxm6J3k13SsOBTEl4dmJ47g6wAr 6NN5oOhcGwdtsr166MfunNXhidC2mtiUMsAfeHGNAMN5n7+36vtcN37/Wf60tDcDwGH0eW xGlEEaMogXfPen+JxoltIOjmgOqToAH7ljcYIVi1PgvENjucIiHlV/PEDMeZhy6SDIb3bk cREjus/svIzSesI5lA+ZR2sRR3xba0u7hNpuNF0+2XEK8Gtk9c2MpJThDN0QmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691503842; h=from:from: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; bh=aNSFIf4RWi0tEaa/C9tcQfXXxaUugOPLUDW1CedmJhE=; b=pFabr+1Q1Ih/WDbdAMS7ZCCt/3YlkzpMjvpadNBNzrE1u/d4bYqHum4onvOd62jikaeeIm HJldAh+ZGtbsiTFSRf+zGQyDgCJz1OIDJeFU3l38X5oCJJ7nlSwZXjruXDYKcLJ/csiJOG b7c1jlksumKdK5SvBB0owid5yzyizDvwW/yb4I/eQYKmI4dzilJ+e4RGYpuQBhfQZDatnc +x88EZP3DqjFWgZ6K4or7oG58opZx6uOY4GRL7k6BS1G1BZe4pySvRzmGVpXQFmUwTJtvQ yBPSBQQf3BzTuWiqE0lu+NKzZ0G5Sse99tx8TWodcCoWEaO5GIRDbBLNOHgaZQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691503842; a=rsa-sha256; cv=none; b=orDPM8ctxgcpAnIxSWN5xH/P6SW/kLhOby8HE/TN32tQtTluAldNAjmXwgx+dfSvfwgB33 P0oXFOCcQ9ioOcAKi+NheMBwO2PiCZPsgp7/tTvC20R0UunLQ7/qn6+i7Rz0kra0Uf8Sn/ wwRVOd6PnbaGA/g1hZOxqaeZQWtEcTvT3KdrcKtQ7L7SZsPNQ6bZpZumN6g5gTWiYBS9Fk v2yzlBAizXNZfaPbDDZGikuOnYnFhgF+7jx1zmdqwrSnRHzmU3sXKxUlstUEwwRVBxoDrq QASeJlpwzepN67JP7e1s0KU4dHqZ0zZM40e58SJsj1GT0VYzMm08OSOys72+rw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RKw816kMnzd3K; Tue, 8 Aug 2023 14:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 378EAfWi000261; Tue, 8 Aug 2023 14:10:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 378EAfmJ000260; Tue, 8 Aug 2023 14:10:41 GMT (envelope-from git) Date: Tue, 8 Aug 2023 14:10:41 GMT Message-Id: <202308081410.378EAfmJ000260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mike Karels Subject: git: 58a46cfd751a - main - md driver compat32: fix structure padding for arm, powerpc List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 58a46cfd751ac726ddca8544bf73a290b0154a57 Auto-Submitted: auto-generated The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=58a46cfd751ac726ddca8544bf73a290b0154a57 commit 58a46cfd751ac726ddca8544bf73a290b0154a57 Author: Mike Karels AuthorDate: 2023-08-08 14:09:03 +0000 Commit: Mike Karels CommitDate: 2023-08-08 14:09:03 +0000 md driver compat32: fix structure padding for arm, powerpc Because the 32-bit md_ioctl structure contains 64-bit members, arm and powerpc add padding to a multiple of 8. i386 doesn't do this. The md_ioctl32 definition was correct for amd64/i386 without padding, but wrong for arm64 and powerpc64. Make __packed__ conditional on __amd64__, and test for the expected size on non-amd64. Note that mdconfig is used in the ATF test suite. Note, I verified the structure size for powerpc, but was unable to test. MFC after: 1 week Reviewed by: jrtc27 Differential Revision: https://reviews.freebsd.org/D41339 Discussed with: jhibbits --- sys/dev/md/md.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index a719dccb1955..8215995a3455 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -147,8 +147,16 @@ struct md_ioctl32 { int md_fwsectors; uint32_t md_label; int md_pad[MDNPAD]; -} __attribute__((__packed__)); +} +#ifdef __amd64__ +__attribute__((__packed__)) +#endif +; +#ifndef __amd64__ +CTASSERT((sizeof(struct md_ioctl32)) == 440); +#else CTASSERT((sizeof(struct md_ioctl32)) == 436); +#endif #define MDIOCATTACH_32 _IOC_NEWTYPE(MDIOCATTACH, struct md_ioctl32) #define MDIOCDETACH_32 _IOC_NEWTYPE(MDIOCDETACH, struct md_ioctl32)