From owner-freebsd-emulation@freebsd.org Sat Jan 5 23:48:55 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 A0B8A1427CC6 for ; Sat, 5 Jan 2019 23:48:55 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic310-22.consmr.mail.gq1.yahoo.com (sonic310-22.consmr.mail.gq1.yahoo.com [98.137.69.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 CF35673B15 for ; Sat, 5 Jan 2019 23:48:54 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: 440pLakVM1mwTNukkh8Z3zTk4n8ZbzYHbRWBi53CvaYoNBiPLvrdRyWxfygZvFW zDQ4CSAsjGdujTnrkS9QxF5qMDTXgc9sLWo_M6z4XwYBuVD3oiFTYfVaOSW0YLY3LaB27_jt2fGp qPDtJ9mE2KpSVXWSYg_seEq0j1snwTk5ddMYNvOn75DwFNT_f5d7zT_8NxA1ngYoNI3riwGQXDt4 WzhQ16SZGXHpsj.XlhGmJeH52j6bQr1SI8iiV357YzwFI7XQQwk_MFJ1EF0yHZAoRDwYbrQpt0Iu eZPAb.deK5cmJfAn2_gj74.ZOb1MAGlFdkSqH3LFjlyYTIoAjbokbJqqx_pPpUnxGG85.CLE_RGm VuuqaluYblFO.p80yiTWwfDT439V.t_e869IHoahlaVhqRmbm_8Nwh2ZWKLn3VonVWvHGfT3AZ6s KWodahIsu3h7WvRlydD1ANgrklJ3NPjV0bfLNCBLUcuyJvvVRtkNt5NIXj6FmBB2SqlxreEDmyRb lN6FSHF1l5GP889IDaImmtGqtCAlqI3N3_tX4RzVe.uRpWeHt0qIurJFJhGJ8cIGSJqQKGMoh8jO bp8zYQoHzey32.Dt69PK_.t8ER9Mf_UeDcQ95HimwkDDeVlNrydhVCWamhsEYxn5tCr.yK99Y8Ap zjjQg60Ywm0e0LwUTmbTCHc1s.c_DjhXyY8be4k5REFW3loowpY16fkUVbZ22PCeUuhikkp3N6sz R1Je6j2B1XAS46yFKgLR1AwhmX.HJvA3bIMbXaXpMRfu54LQcY7dsaQ8joazU1lxbyWfS1poPfwo yQNFoALydphA6k7Gf6pd1ChU9G3gnJotV7rcXVrukE_jNLmAgu.OKlvq.ulkJQnHiciAO9Lc3pZg S2T9Uq2WkWP7eFEhjCzefJxJxLpXnd_Uikyi63efnz7gFK3QNgWFfH3ZEd1fUwi1fA9FP0qS2FJc SN32RCqXekFitAdgeAmIa3rEO9hE_9viQUaCw8DbRT33.LEvYWyx9jNsg903k8XlyYHO6WGGMRtE RygYLm5tBMUptmVT0FQiPJRC0ITGIRKjRJjMnYmEjwC4G7sx_X2eny7d8e5qKIIpP2MFXVpUx7sv FBQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.gq1.yahoo.com with HTTP; Sat, 5 Jan 2019 23:48:47 +0000 Received: from c-67-170-167-181.hsd1.or.comcast.net (EHLO [192.168.1.109]) ([67.170.167.181]) by smtp402.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 00b4e2a428433f4617b80ddce139b2f3; Sat, 05 Jan 2019 23:48:47 +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_prpsinfo missing pr_pid field so target_prpsinfo is too small Message-Id: <5C2E8937-23A5-4899-B3CE-8468697D8923@yahoo.com> Date: Sat, 5 Jan 2019 15:48:46 -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: CF35673B15 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.96 / 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.97)[-0.973,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(-1.48)[ip: (-8.39), 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)[148.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: Sat, 05 Jan 2019 23:48:55 -0000 [The context here is FreeBSD head -r341836 based and ports head -r488859 = based.] Note: I assume that "struct target_prpsinfo" is meant to match the = memory layout of the target's native "struct prpsinfo". Otherwise the reported = differences below could be irrelevant. Note: struct target_prpsinfo is in (for my context): = /wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-4ef7d07/b= sd-user/elfload.c For armv7 (and likely armv6) the following code: printf("sizeof(struct prpsinfo) =3D %lu\n", (unsigned long) = sizeof(struct prpsinfo)); printf("pr_version %lu\n", (unsigned long) offsetof(struct = prpsinfo, pr_version)); printf("pr_psinfosz %lu\n", (unsigned long) offsetof(struct = prpsinfo, pr_psinfosz)); printf("pr_fname %lu\n", (unsigned long) offsetof(struct = prpsinfo, pr_fname)); printf("pr_psargs %lu\n", (unsigned long) offsetof(struct = prpsinfo, pr_psargs)); printf("pr_pid %lu\n", (unsigned long) offsetof(struct prpsinfo, = pr_pid)); produces: sizeof(struct prpsinfo) =3D 112 pr_version 0 pr_psinfosz 4 pr_fname 8 pr_psargs 25 pr_pid 108 However gdb reports for qemu-arm-static (on amd64): (gdb) p/d sizeof(struct target_prpsinfo) $7 =3D 108 (gdb) p/d &((struct target_prpsinfo *)0)->pr_version $8 =3D 0 (gdb) p/d &((struct target_prpsinfo *)0)->pr_psinfosz $9 =3D 4 (gdb) p/d &((struct target_prpsinfo *)0)->pr_fname =20 $10 =3D 8 (gdb) p/d &((struct target_prpsinfo *)0)->pr_psargs $11 =3D 25 (gdb) p/d &((struct target_prpsinfo *)0)->pr_pid =20 There is no member named pr_pid. So the fields prior to pr_pid have matching offsets and there is no extra padding added before pr_pid for native armv7. /usr/include/sys/procinfo.h has: typedef struct prpsinfo { int pr_version; /* Version number of struct (1) */ size_t pr_psinfosz; /* sizeof(prpsinfo_t) (1) */ char pr_fname[PRFNAMESZ+1]; /* Command name, null terminated = (1) */ char pr_psargs[PRARGSZ+1]; /* Arguments, null terminated = (1) */ pid_t pr_pid; /* Process ID (1a) */ } prpsinfo_t; pr_pid was added in -r308009 (2016-oct-28) and is in 11.2 . = /wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-4ef7d07/b= sd-user/elfload.c has: typedef struct target_prpsinfo { int32_t pr_version; /* Version number of struct (1) */ abi_ulong pr_psinfosz; /* sizeof(prpsinfo_t) (1) */ char pr_fname[TARGET_PRFNAMESZ+1]; /* Command name + NULL (1) = */ char pr_psargs[TARGET_PRARGSZ+1]; /* Arguments + NULL (1) */ } target_prpsinfo_t; =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)