From owner-freebsd-ports@freebsd.org Sat Jan 5 04:51:52 2019 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 228F6148A12D for ; Sat, 5 Jan 2019 04:51:52 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic306-4.consmr.mail.bf2.yahoo.com (sonic306-4.consmr.mail.bf2.yahoo.com [74.6.132.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFC8A97566 for ; Sat, 5 Jan 2019 04:51:50 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: 5EEnYjoVM1lcW0_6Vd0_vnRyjZ0A1GWnCp8cxHhvdqhMJosdb5gc5Z3xlqmyeh_ doNpfTebbEl9a_2V_1aV6FcAu4ndI8a49MnHO4ClnAWWCvIa6oMvQTs.oWlbxrRzBpzETG.32C.N vjpVsq4o7Qp9cf1HISuk.4DAtcSdunxf8PpIuCPPRIfhYBFvILEXkuagYpnu.uiVo.Em2ur8SbST kA3DBUBRkkg0VYG5oOLtD6AxcPLoD4ojNOdiYFL5UUODjnhQy1NInxrBypFerX163ZtPplyUshF_ 2J1_gwynOJSuCh8R1Tt8bQi8EmvDvIesH67xhRpfjIKbAOquLdQGpn.bzR.rUUAr5Pb0ga019wfB vKALVjpabQHgdC0GGkkR5lNiYEdZh5IuFeHr7Mh7OVkG9vepqsCCfj44Zn.qEelv_j6kTqbr7xY3 Xazw6wTEZB5FyusTQRGLa7xRqjubTsmgOPeh3YPguTWiYqTE1esxalFwBj6zn9W9Vc3dOHMsjNvJ iD2gF.iHS4hOZ4otcEzgCe9k2lae_h9SK0_rRxb_pD5f_0XWx.PlX4izaZJn0z6DvzdVYszrJjby eyHQfUANcDMO814d7dR4DptDfjxbX52_ZNrbzThtEbI7VxameJw8yZ4PbLpTJOfHp9tL6TWMKU.d yocXvTk8bD2MMiYXp08ssmZ_QWFh_.K.29HB4bQbdpqXMsKOXxhHsWfHrpBjAcjITHXF.fLG7Eqw I95yxI_X980.75YKqlxVHJCbanpFwi3a3QqN1XsE0Cu2_CE0dbUTM_dDUDjh4gyZ1h9r1dyFrfx_ 6_H14DQkLe6GE4mdsI1ZTX6RE8nqrgwV4KlU8pu88lNiYkoDdp_ZZ_dMefAEdzYpbCHXKa5n1wO1 bLNLDDs8WIQLxDA9wt3Ta.GpKz9I_iLiQurKlEXw.x.VOIx0Iq3xF5dV_8Bop2WeDSFeO0IK3qSc YJs5852GsYWrx9JGVnxnaVuxMnMLO_Ve55aZ753Rb4VXMfFTGDh0OstoW7.D4Ob__evkQrCcKHYn AQsXUyWT2Mm3Rx6RFJh7PX3ssQu4b4XyP4gVj5YPwsu0nQAUp5PtYdzTmkwUDx2gSkD_kWQnJiV0 .RBo5Cw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.bf2.yahoo.com with HTTP; Sat, 5 Jan 2019 04:51:49 +0000 Received: from c-67-170-167-181.hsd1.or.comcast.net (EHLO [192.168.1.109]) ([67.170.167.181]) by smtp425.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 5bf61e0d685139587818b98ba0a82985; Sat, 05 Jan 2019 04:51:48 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: qemu-x86_64-static has target_freebsd_flock being too small (__packed use issue) [subject correction: fixed to be "too small"] From: Mark Millard In-Reply-To: <1139EAD0-FED3-428C-AA0E-00ABB8BD111D@yahoo.com> Date: Fri, 4 Jan 2019 20:51:46 -0800 Cc: Sean Bruno Content-Transfer-Encoding: quoted-printable Message-Id: References: <1139EAD0-FED3-428C-AA0E-00ABB8BD111D@yahoo.com> To: Kyle Evans , freebsd-emulation@freebsd.org, ports-list freebsd X-Mailer: Apple Mail (2.3445.102.3) X-Rspamd-Queue-Id: BFC8A97566 X-Spamd-Bar: + X-Spamd-Result: default: False [1.46 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MV_CASE(0.50)[]; FREEMAIL_FROM(0.00)[yahoo.com]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[yahoo.com:+]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:26101, ipnet:74.6.128.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_SPAM_SHORT(0.78)[0.780,0]; NEURAL_HAM_LONG(-0.32)[-0.321,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(1.31)[ip: (3.98), ipnet: 74.6.128.0/21(1.47), asn: 26101(1.17), country: US(-0.08)]; NEURAL_SPAM_MEDIUM(0.21)[0.207,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[43.132.6.74.list.dnswl.org : 127.0.5.0] X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jan 2019 04:51:52 -0000 [Just correcting the "larger" to be "smaller".] On 2019-Jan-4, at 19:29, Mark Millard wrote: [qemu-aarch64-static has the same problem but qemu-armv7-sstatic does = not. The context here is FreeBSD head -r341836 based and ports head -r488859 based.] Note: I assume that "struct target_freebsd_flock" is meant to match the = memory layout of the target's native "struct flock". Otherwise the reported = differences below could be irrelevant. For amd64 and aarch64 the following code: printf("sizeof(struct flock) =3D %lu\n", (unsigned long) = sizeof(struct flock)); printf("l_start %lu\n", (unsigned long) offsetof(struct flock, = l_start)); printf("l_len %lu\n", (unsigned long) offsetof(struct flock, = l_len)); printf("l_pid %lu\n", (unsigned long) offsetof(struct flock, = l_pid)); printf("l_type %lu\n", (unsigned long) offsetof(struct flock, = l_type)); printf("l_whence %lu\n", (unsigned long) offsetof(struct flock, = l_whence)); printf("l_sysid %lu\n", (unsigned long) offsetof(struct flock, = l_sysid)); produces: sizeof(struct flock) =3D 32 l_start 0 l_len 8 l_pid 16 l_type 20 l_whence 22 l_sysid 24 However gdb reports for qemu-x86_64-static and qemu-aarch64-static and qemu-arm-static: (gdb) p/d sizeof(struct target_freebsd_flock) $10 =3D 28 (gdb) p/d &((struct target_freebsd_flock *)0)->l_start =20 $11 =3D 0 (gdb) p/d &((struct target_freebsd_flock *)0)->l_len =20 $12 =3D 8 (gdb) p/d &((struct target_freebsd_flock *)0)->l_pid $13 =3D 16 (gdb) p/d &((struct target_freebsd_flock *)0)->l_type $14 =3D 20 (gdb) p/d &((struct target_freebsd_flock *)0)->l_whence $15 =3D 22 (gdb) p/d &((struct target_freebsd_flock *)0)->l_sysid=20 $16 =3D 24 So only the overall size is different for this information. But: struct target_freebsd_flock { int64_t l_start; int64_t l_len; int32_t l_pid; int16_t l_type; int16_t l_whence; int32_t l_sysid; } QEMU_PACKED; with a potential packed vs. /usr/include/sys/fcntl.h : struct flock { off_t l_start; /* starting offset */ off_t l_len; /* len =3D 0 means until end of file */ pid_t l_pid; /* lock owner */ short l_type; /* lock type: read/write, etc. */ short l_whence; /* type of l_start */ int l_sysid; /* remote system id or zero for local */ }; with no potential __packed. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)