From owner-freebsd-emulation@freebsd.org Sun Jan 6 00:38:12 2019 Return-Path: Delivered-To: freebsd-emulation@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 8F1AE142AE59 for ; Sun, 6 Jan 2019 00:38:12 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic316-9.consmr.mail.gq1.yahoo.com (sonic316-9.consmr.mail.gq1.yahoo.com [98.137.69.33]) (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 A12C276293 for ; Sun, 6 Jan 2019 00:38:10 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: HxWLYuEVM1kIblDh8KxYkwwohrGVBoQ.JbX7UCObAprJG6D8szlCUPyK_mJJp8a h7BT6aFwTK4_2LvmwKTGTsJSgJoDOudaYq.2xf9.vvMx.LOaTbWwb.yyFxBozz3AqyMNlna6u3F2 4wguU59P4v5AlLJzxie1IHF_WwmcjhlOhIqCn6bawJrlrI59p1O6pd1UUBIsdnrW3j1kBM5ok3Ow 7sTSasJKFhjL2GM4VQxBdfFakhc.VXuGCPvzwis6oU4QaHL8cmzcBRr144lLbIw9j24cOjcjFr5V yEv5YLSCo5reN8QbwSwgTl0ugSfQjoy9D37xNhyfHZtvOGtTmeP651rHIsK4Pt1P9AFe7PhZWTJs JC7P4AS3c0LtYVl_3R11VAMofCxupYGh83.qZgUCDd5iFvIc3TNWmJfOo_Z_LyA8H_0XX2C1VV_g o87KbtCaFMv943drc5A14yAIPdvr0QvjP1NBiG0DKCEzHfURqXYfySJY26TqTp1h_83d6hASNTc5 5T0w.PlvR7izOE3.I.q9CpF8gUvp9zdvGZ6tft0O7azEmxiy7JV99rbsp94nF13GfRDe96WBBwlh Gt8taq_XI5HUtvrogFi3HLdvme.fajEHlX1AyxjblIX4HgYq4zoCvDE6sVxejYdW83T1OFim.rNO YqFUddwnhndb2VnyYUtQKdtAR2NSffvA3roNKZmVv15f5yp7lg7YSoukaF6Q7OdUE0inVtOq4G6l 0UPQXGkpiLtaXDObLkT1xKnZFSBQgnS6.dZNNBhjgqUKo7bhxfBbC3Bkwe86p0SzkeXB0Xq.pNzY gO9RQIw3lNAUnxpnZWtUZ9cuxZmLPcMtpOMyi8bdnTa.AzUq0.ZFlgu2vs3T.y.B1zfFIUNXhkaO QHmO.MP.IbJJIw1MhC_uBVIGL1QFyt1f5F6ykK7lUEqR89xTpbscogdLUAIAG9urvePET57_fN68 so2vRhE2Jf7EDxUvjZ5H4REr_m0gAMwIKtaI9o3Vz1oq78m7D3kYGMY9eZtvuekW.tiXPEaLA7ZA .7pYdrqvZpWZuPhUURas4mND702lPCcfPtgeC7PZyvu0r1IsUwQNR4ISLC_2JlE8BtmPdh7k0Jp7 2TmS.RQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.gq1.yahoo.com with HTTP; Sun, 6 Jan 2019 00:38:03 +0000 Received: from c-67-170-167-181.hsd1.or.comcast.net (EHLO [192.168.1.109]) ([67.170.167.181]) by smtp403.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 38d7065d9c12fa5f9f3ace1278fddde8; Sun, 06 Jan 2019 00:38:00 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: qemu-arm-static has target_msqid_ds too small vs. arm natives msqid_ds Message-Id: Date: Sat, 5 Jan 2019 16:37:59 -0800 Cc: Sean Bruno , freebsd-arm To: Kyle Evans , freebsd-emulation@freebsd.org, ports-list freebsd X-Mailer: Apple Mail (2.3445.102.3) X-Rspamd-Queue-Id: A12C276293 X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.90 / 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]; RCPT_COUNT_FIVE(0.00)[5]; 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]; NEURAL_HAM_SHORT(-0.74)[-0.736,0]; 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:36647, ipnet:98.137.64.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)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(-0.66)[ip: (-4.28), ipnet: 98.137.64.0/21(0.60), asn: 36647(0.48), country: US(-0.08)]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[33.69.137.98.list.dnswl.org : 127.0.5.0] X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2019 00:38:12 -0000 [The context here is FreeBSD head -r341836 based and ports head -r488859 = based.] Note: I assume that "struct target_msqid_ds" is meant to match the = memory layout of the target's native "struct msqid_ds". Otherwise the reported = differences below could be irrelevant. For armv7 (and likely armv6) the following code: printf("sizeof(struct msqid_ds) =3D %lu\n", (unsigned long) = sizeof(struct msqid_ds)); printf("msg_perm %lu\n", (unsigned long) offsetof(struct = msqid_ds, msg_perm)); printf("__msg_first %lu\n", (unsigned long) offsetof(struct = msqid_ds, __msg_first)); printf("__msg_last %lu\n", (unsigned long) offsetof(struct = msqid_ds, __msg_last)); printf("msg_cbytes %lu\n", (unsigned long) offsetof(struct = msqid_ds, msg_cbytes)); printf("msg_qnum %lu\n", (unsigned long) offsetof(struct = msqid_ds, msg_qnum)); printf("msg_qbytes %lu\n", (unsigned long) offsetof(struct = msqid_ds, msg_qbytes)); printf("msg_lspid %lu\n", (unsigned long) offsetof(struct = msqid_ds, msg_lspid)); printf("msg_lrpid %lu\n", (unsigned long) offsetof(struct = msqid_ds, msg_lrpid)); printf("msg_stime %lu\n", (unsigned long) offsetof(struct = msqid_ds, msg_stime)); printf("msg_rtime %lu\n", (unsigned long) offsetof(struct = msqid_ds, msg_rtime)); printf("msg_ctime %lu\n", (unsigned long) offsetof(struct = msqid_ds, msg_ctime)); produces: sizeof(struct msqid_ds) =3D 80 msg_perm 0 __msg_first 24 __msg_last 28 msg_cbytes 32 msg_qnum 36 msg_qbytes 40 msg_lspid 44 msg_lrpid 48 msg_stime 56 msg_rtime 64 msg_ctime 72 However gdb reports for qemu-arm-static (on amd64): (gdb) p/d sizeof(struct target_msqid_ds) $14 =3D 64 (gdb) p/d &((struct target_msqid_ds *)0)->msg_first $15 =3D 24 (gdb) p/d &((struct target_msqid_ds *)0)->msg_last=20 $16 =3D 28 (gdb) p/d &((struct target_msqid_ds *)0)->msg_cbytes $17 =3D 32 (gdb) p/d &((struct target_msqid_ds *)0)->msg_qnum =20 $18 =3D 36 (gdb) p/d &((struct target_msqid_ds *)0)->msg_qbytes $19 =3D 40 (gdb) p/d &((struct target_msqid_ds *)0)->msg_lspid=20 $20 =3D 44 (gdb) p/d &((struct target_msqid_ds *)0)->msg_lrpid $21 =3D 48 (gdb) p/d &((struct target_msqid_ds *)0)->msg_stime $22 =3D 52 (gdb) p/d &((struct target_msqid_ds *)0)->msg_rtime $23 =3D 56 (gdb) p/d &((struct target_msqid_ds *)0)->msg_ctime $24 =3D 60 so after msg_lrpid the offsets are different. /usr/include/sys/msg.h has: struct msqid_ds { struct ipc_perm msg_perm; /* msg queue permission bits */ struct msg *__msg_first; /* first message in the queue */ struct msg *__msg_last; /* last message in the queue */ msglen_t msg_cbytes; /* number of bytes in use on the queue = */ msgqnum_t msg_qnum; /* number of msgs in the queue */ msglen_t msg_qbytes; /* max # of bytes on the queue */ pid_t msg_lspid; /* pid of last msgsnd() */ pid_t msg_lrpid; /* pid of last msgrcv() */ time_t msg_stime; /* time of last msgsnd() */ time_t msg_rtime; /* time of last msgrcv() */ time_t msg_ctime; /* time of last msgctl() */ }; = /wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-4ef7d07/b= sd-user/syscall_defs.h has: struct target_msqid_ds { struct target_ipc_perm msg_perm; /* msg queue permission bits */ abi_ulong msg_first; /* first message in the queue */ abi_ulong msg_last; /* last message in the queue */ abi_ulong msg_cbytes; /* # of bytes in use on the queue */ abi_ulong msg_qnum; /* number of msgs in the queue */ abi_ulong msg_qbytes; /* max # of bytes on the queue */ int32_t msg_lspid; /* pid of last msgsnd() */ int32_t msg_lrpid; /* pid of last msgrcv() */ abi_ulong msg_stime; /* time of last msgsnd() */ abi_ulong msg_rtime; /* time of last msgrcv() */ abi_ulong msg_ctime; /* time of last msgctl() */ }; abi_ulong's for msg_stime, msg_rtime, and msg_ctime are the wrong size for armv7: arm uses 64-bit time_t. As of 12+ only i386 uses 32-bit time_t if I understand right. In 11.x 32-bit powerpc also uses 32-bit time_t. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)