From owner-freebsd-emulation@freebsd.org Sun Jan 6 01:14:42 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 1CEE7142C9E3 for ; Sun, 6 Jan 2019 01:14:42 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic305-22.consmr.mail.ne1.yahoo.com (sonic305-22.consmr.mail.ne1.yahoo.com [66.163.185.148]) (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 60332803BC for ; Sun, 6 Jan 2019 01:14:41 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: rqlVTQkVM1mle7vVVQHzbBati3W4pbVhylEbVBIRWZj9txFuvti4ZZGSjZ0iIl1 ut_oXcnNnjT9Tv3iA6ZjnDdAMqo7cOn0LtdiaRne2JMDQTQ1RaUzCcb4wNkbNkVJQ0Gb6TMYloi5 1oSGgrxdctx6LjWbcDvHh7RgjUkEXvNVS4XPs1wyrBifmePJ8_Fj.CrGOrZzvcSULpA6bSWmYg_y GkaFUk63AUvmSJpX.aKDpVxEtSXepjegapKuM7jB7tPjpgCoO5Pz6AH..MJQ6sah4aob3gvKoMt7 Dxn64J9Sckv1O2W0au5HNMP3I16jJbOexrjBib_FnpYV1LoC0uKrIis76tTMVx4nzRb5NTmbF3ex Ugf5eRtCeYqJKE_OjnnJruIIsc9bst7S3HED7Y9RCvxtaYkBUOU6UpKTyNngeajhz5RAEzToVq6s TeX2ozfB0yN.j1sEHvkMqjpB8YDPQMX.xM7jZixa8vuk4iYzlMInRN3zJM.0zmaq23VyWgSs65HN jwd_yh0lJExMcnavjvM7KouOxsjq_AXwa__0KPspf2qdhjvuhZmeqxWSXIAwJrsNP8rYA7wbNHF2 NglM2pd2cvqNJwv1iPFEqisN6IvY_yJWVKTf.XSYXpd57K5MeCI71Mo_40gqPFjic4B80yiccY.c R85FqwbGEXMXzdU6bSxABow4JyeQOeFRCl8Kmp0BZquQLSvU5CBYCeZ0e1DXZtrEIdyPxoY6SB3_ 9FMgNdcga_HCsTc2myeTn_rZrNaq1AHLiXrC4jo29VoV62J71TfTD482sFYJGwanLwwVprV6hdf5 aA80rr9jLzwMeYB9dMfCSif__R1foIfHaVs2Nrze8FpewLf8.2_MbjlSrE0l0ROPz2Vs1YZt7Ahw D5k6zzFurAXdTCslSt4K6Iv_8_cBgzF_UWSvyus8nCntKQun7tMoTBdIJvl.uUo4TdX6bbK7J34I OMDo0uvWv3vcMvnmfbT6r7B9m22Ix0SSt_6eztmk3b1K6hN6g3akG4OVPWGGaGN59drndQQ9UUKO K1aBaOdtenLGWZM0qoOwMksgfNXU_SNvIszlLYyj5Lk1Kiotk_MVTnDcVDX.yxn9ykbbs6xOD5r9 6AQ5aD7nct0o- Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Sun, 6 Jan 2019 01:14:34 +0000 Received: from c-67-170-167-181.hsd1.or.comcast.net (EHLO [192.168.1.109]) ([67.170.167.181]) by smtp415.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 963a94ea3428a8a4c9e56e4a682cf370; Sun, 06 Jan 2019 01:14:30 +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_shmd_ds too small vs. arm native's shmid_ds Message-Id: <6B222E96-A644-46A7-9D1C-D164ED465631@yahoo.com> Date: Sat, 5 Jan 2019 17:14:27 -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: 60332803BC X-Spamd-Bar: + X-Spamd-Result: default: False [1.13 / 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]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; DKIM_TRACE(0.00)[yahoo.com:+]; 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:36646, ipnet:66.163.184.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)[]; NEURAL_SPAM_SHORT(0.95)[0.945,0]; NEURAL_HAM_LONG(-0.47)[-0.469,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.93)[ip: (2.77), ipnet: 66.163.184.0/21(1.09), asn: 36646(0.87), country: US(-0.08)]; NEURAL_SPAM_MEDIUM(0.23)[0.230,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[148.185.163.66.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 01:14:42 -0000 [The context here is FreeBSD head -r341836 based and ports head -r488859 = based.] Note: I assume that "struct target_shmd_ds" is meant to match the memory = layout of the target's native "struct shmid_ds". Otherwise the reported = differences below could be irrelevant. For armv7 (and likely armv6) the following code: printf("sizeof(struct shmid_ds) =3D %lu\n", (unsigned long) = sizeof(struct shmid_ds)); printf("shm_perm %lu\n", (unsigned long) offsetof(struct = shmid_ds, shm_perm)); printf("shm_segsz %lu\n", (unsigned long) offsetof(struct = shmid_ds, shm_segsz)); printf("shm_lpid %lu\n", (unsigned long) offsetof(struct = shmid_ds, shm_lpid)); printf("shm_cpid %lu\n", (unsigned long) offsetof(struct = shmid_ds, shm_cpid)); printf("shm_nattch %lu\n", (unsigned long) offsetof(struct = shmid_ds, shm_nattch)); printf("shm_atime %lu\n", (unsigned long) offsetof(struct = shmid_ds, shm_atime)); printf("shm_dtime %lu\n", (unsigned long) offsetof(struct = shmid_ds, shm_dtime)); printf("shm_ctime %lu\n", (unsigned long) offsetof(struct = shmid_ds, shm_ctime)); produces: sizeof(struct shmid_ds) =3D 64 shm_perm 0 shm_segsz 24 shm_lpid 28 shm_cpid 32 shm_nattch 36 shm_atime 40 shm_dtime 48 shm_ctime 56 However gdb reports for qemu-arm-static (on amd64): (gdb) p/d &((struct target_shmid_ds *)0)->shm_perm $33 =3D 0 (gdb) p/d &((struct target_shmid_ds *)0)->shm_segsz $34 =3D 24 (gdb) p/d &((struct target_shmid_ds *)0)->shm_lpid=20 $35 =3D 28 (gdb) p/d &((struct target_shmid_ds *)0)->shm_cpid $36 =3D 32 (gdb) p/d &((struct target_shmid_ds *)0)->shm_nattch $37 =3D 36 (gdb) p/d &((struct target_shmid_ds *)0)->shm_atime=20 $38 =3D 40 (gdb) p/d &((struct target_shmid_ds *)0)->shm_dtime $39 =3D 44 (gdb) p/d &((struct target_shmid_ds *)0)->shm_ctime $40 =3D 48 so after shm_atime the offsets are different. /usr/include/sys/shm.h has: struct shmid_ds { struct ipc_perm shm_perm; /* operation permission = structure */ size_t shm_segsz; /* size of segment in bytes */ pid_t shm_lpid; /* process ID of last shared memory = op */ pid_t shm_cpid; /* process ID of creator */ shmatt_t shm_nattch; /* number of current attaches */ time_t shm_atime; /* time of last shmat() */ time_t shm_dtime; /* time of last shmdt() */ time_t shm_ctime; /* time of last change by = shmctl() */ }; = /wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-4ef7d07/b= sd-user/syscall_defs.h has: struct target_shmid_ds { struct target_ipc_perm shm_perm; /* peration permission structure = */ abi_ulong shm_segsz; /* size of segment in bytes */ int32_t shm_lpid; /* process ID of last shared memory op */ int32_t shm_cpid; /* process ID of creator */ int32_t shm_nattch; /* number of current attaches */ abi_ulong shm_atime; /* time of last shmat() */ abi_ulong shm_dtime; /* time of last shmdt() */ abi_ulong shm_ctime; /* time of last change by shmctl() */ }; abi_ulong's for shm_atime, shm_dtime, and shm_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)