From nobody Fri Aug 18 12:40:13 2023 X-Original-To: dev-commits-src-branches@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 4RS1g14GQlz4qT0X; Fri, 18 Aug 2023 12:40:13 +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 4RS1g11yNgz4N81; Fri, 18 Aug 2023 12:40:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692362413; 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=/D81kOTt3MVJzxB0LUvEaqOleexI1ASsstJomVVmwJU=; b=Lp9cwlUUQSjXNMpnvi123lqODhI5IyFL3fe+Rp8Ai+76cFi5OQfgm0ZoW+vVG2v91ZFZCn OXUVAC+SR36TJyK6U1gWZt1vVnZ252BZ9dK9f4xPc82eOOS+eU78+n9egtgJODq5gI0tM3 MJTYBcWyAB62OAr9qqY/gWsWl7LTxrqdkjCFawOp52dU7dOv0kRE/KlWtg2ZjvcfIENYq/ 21I7PBvll/jxQTGM1MgiGz1vGKFvBUoKUI9sBqV0tDM3lGdE8yYb0wt+sQT7SgzztIh4ss yjGSLG6KAN1LyZEft29b17P4DLxXFZ2vO+D2z2mmU0GllNdAFJElsF9gK7vjHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692362413; 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=/D81kOTt3MVJzxB0LUvEaqOleexI1ASsstJomVVmwJU=; b=rjj98mO2xpGWft5vKymWxREn93qrKJQklTParyRcjzHjwZ1g9wW2iuls+9rrAf5nxNhKpk OZZi6pova/pU2ncPnFWiRfsuOOlvBZrG2+uejIbxy99W9H2G7cO6s1uLp8rcN0AvfqDY4g 6LRMAsfHUGXgkCDIuPUcpkEUV+J11N9xzdCXRGbpzSwBMJX4ltP4JKIp5gozQ9kpksH/tY a9YVde4opObvulyjC667zBsTXlM/eDBjXuH/1OMzMduch1WIC44DyGTGwWplsX3lHm3sLB 37W9BPUH6RlsdpdiX1O7xkFO9Oh31y4JinlP/VGLqGkdMGKaWGUbEYJUrZ09mw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692362413; a=rsa-sha256; cv=none; b=kFSzEJxY2d1/m1EVHvDoB1+gUpMNRHzkeHjGUN0/P5alqOfajwTiIFyMp5KKNxj0lhZsH1 ut0YDoEeKIy6X/cDSEoxf7B8U3Tq3MabyXpGeVjRj7UV8k5zv44EofbxVXMa9EAFgSPPR4 LYAK3PbLsl/tPXgzQ4CDmo0GF/GwL+SmFCxOAGacFHOLfZew62vrD3KaPS7E7BclnIyUUy +79N+gl4O+sBIJ8zklFlmPfKQdSfCxfA/WFq5/eRhn/MM0Hyz/yPVpgtfXKhJe4zfKTHV9 YU+EcWekwS40/M22FOIrG/SIFKnr0bGkZZCbLvAts/Ha+5WZThUKwk1Lrd8gOA== 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 4RS1g10vsTz1M6; Fri, 18 Aug 2023 12:40:13 +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 37ICeDQe056750; Fri, 18 Aug 2023 12:40:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37ICeD9T056740; Fri, 18 Aug 2023 12:40:13 GMT (envelope-from git) Date: Fri, 18 Aug 2023 12:40:13 GMT Message-Id: <202308181240.37ICeD9T056740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mike Karels Subject: git: 4aead44fa14f - stable/13 - md driver compat32: fix structure padding for arm, powerpc List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4aead44fa14fd089b8e3eeb48c24c2c14aea8f93 Auto-Submitted: auto-generated The branch stable/13 has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=4aead44fa14fd089b8e3eeb48c24c2c14aea8f93 commit 4aead44fa14fd089b8e3eeb48c24c2c14aea8f93 Author: Mike Karels AuthorDate: 2023-08-08 14:09:03 +0000 Commit: Mike Karels CommitDate: 2023-08-18 12:39:55 +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. Reviewed by: jrtc27 Differential Revision: https://reviews.freebsd.org/D41339 Discussed with: jhibbits (cherry picked from commit 58a46cfd751ac726ddca8544bf73a290b0154a57) --- 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 52d64d6721cd..6878eb387fda 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -146,8 +146,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)