From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4059 invoked from network); 23 Aug 2023 13:57:25 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 23 Aug 2023 13:57:25 -0000 Received: (qmail 21878 invoked by uid 550); 23 Aug 2023 13:57:22 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 21842 invoked from network); 23 Aug 2023 13:57:21 -0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ODuCFWnYFtiAx8olFMp2x90FHA6e4CJ+hBjJGw6dxtA01mtAgbhaQg8RXu/UQLuC4PuqcaKeBrAFFpY3cMjP5DUkwiaLrBPW7zJqjfJKBsIA7HFAOCnOFMPo1TOg3VfPo+2RF7GSjJR4/i6BuDEFu178yjoZsDa/bcG2nUgVJ6QlwQeniwiuJHccxg0APrMeocr8c6mbqrzd6Z99aIlkTrf3C4TBUPhX0ih8cm6Si4vDuhrWQL04xzAU1JsOQnn0BZtAEPJVpfJG5mq/7qm9+TyfvwNx7eRe8ssqp2KHy5Q6FUsgbn1l9+uyFwXFtJ2/tKHAhzbNeYywQ3Yzw2/YlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a4mQ3fm7lbi1+C1j84IODOHsP91imt+on2mSdGiSFdY=; b=ZOaRY+7H22ajiY2v96ZnaJTEBssAkfHCSdb/FONllBOjeOKtfI0z2Zxzc5YQ2p3yZ0fBxnk/OlfSee5fwT2BS4G9cWoZIGV3unbqdoFv2b3O6E6Y4xSv8ENeMknoyr4s0r9PJncwJhmubopMqgFL647/9KJtfCIUVDQ1p4b7K3Ladsx91PEk4w9Ow7NyLATKSb+6DAQPubJxRYc+7NifnSL4ynn9YZzCsQQsdEBf5vQFMzX6AAYe0rfyeDUvlnnXnWxOnvrKkVWxPyjN4mCVSsUjpp8y9tGRyjaeWTILjvH00F9Xbbjhsu/5/gl7l+m5khPUPVTvkXhHjtaKzvM+oQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mikeg.net; dmarc=pass action=none header.from=mikeg.net; dkim=pass header.d=mikeg.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mikeg.net; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a4mQ3fm7lbi1+C1j84IODOHsP91imt+on2mSdGiSFdY=; b=U6MlHdy/tu0zb0WdsVZVf6ZbH03iP5Ty6roIuzIiDhWol/v2rkcwBoNQdRpOL20xPkm0/K8zIzF6WY6bh/5pN+y4t4qqIFCc3EgVEPVR51fgXdQg//Jf95GQZV1ek+ENPn4eFSuR70k+XEVbcSwH3W03aqcZw3IMdrmd29Mu73Y= From: Mike Granby To: Rich Felker CC: "musl@lists.openwall.com" Thread-Topic: [musl] sizeof(pthread_mutex_t) on aarch64 Thread-Index: AdnVZZpf/0N5T0QOS+SGYkFPDsqHqAAYEjAAAACmceA= Date: Wed, 23 Aug 2023 13:57:04 +0000 Message-ID: References: <20230823132948.GX4163@brightrain.aerifal.cx> In-Reply-To: <20230823132948.GX4163@brightrain.aerifal.cx> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mikeg.net; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3087:EE_|SJ2PR12MB8953:EE_ x-ms-office365-filtering-correlation-id: 1676a74a-80da-4a89-a62d-08dba3e0d537 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PfEwzqO0DE0YCBT7U/uXriqDqnDEGX3mIwVixLnsXvEeJRMqHVc3LIlOambjtOHaHIz78y7Timyll0o5ZmfCckXMn/moiOCBTVGyHWtyAhLp3OYSylVK4CFaD5tpFt+TLjXb8ANAd9DpJ9VfFRLKTLY4WhMgLFY6ncMYNO2tq8Kjw2h6PDePOIkma3LyZhOD1IykkNwzmO3PKCC0lc9WLLIIxt8eX8arECG3+BUA/lYO3/O68rQOEvOre3OSmHoKMWb1wYcShZxetmx5AEuYo7aJi6FVZQiKWo94XiR+WetwYxjRj0xdquTFL5ReeoGrdIcxKUJlPRMC/vv3ufzUsSaIRVwCuqh7cYX5FJWnOBPp1qlBQulnqdNGyFwSS8LfcNphVrdNqI2+uc7z9toAoLchQFGBknTRwzsyOQ9pBou0V6Ra5Z1cdW42OIE4wYSRCunyS4McHH8PskUx1jGhHD/ZAqYi7UdLAOBqGCtU3iwyp+yNdLQMuQ1PjAA/8sOgQiJGJqoupwhlUSSMkvSAZgn4KKf9xOpNnYFsNrzxQ5serYZRA6HAm5ITKnMJU+YnEAjEcfvIE6DtQHPCNqrywNvClYdGZiiFpvhvP+MldmA5GMhCW+pJ/4/x1iHh5Zgf x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3087.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39830400003)(396003)(376002)(346002)(366004)(186009)(1800799009)(451199024)(33656002)(86362001)(55016003)(122000001)(316002)(478600001)(41300700001)(66476007)(66946007)(66556008)(6916009)(64756008)(66446008)(38070700005)(76116006)(9686003)(38100700002)(6506007)(71200400001)(2906002)(26005)(53546011)(7696005)(8936002)(8676002)(52536014)(4326008)(5660300002)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?COeKnQM+j9XZ611Wm+ntCsqet7g5te26yzMgeipx+MQ9iHRyYn1RmSLeTht3?= =?us-ascii?Q?jJaLKIdk7bzZUcqvmNI8beUFiUEnJ9Wu4MkiY+bMxNUF3wm0SWTE3wE66yXt?= =?us-ascii?Q?4BgzMtvta0twz+cG5lKqwHM077eg4fy+jykc6VAAcnurPl9NgVXBa7mpaGn7?= =?us-ascii?Q?c4E53+QyX3ZL1Gl4mmOD5iXJdOXeevJwfEuvD7Bnn5npZsPn06045IL52HnK?= =?us-ascii?Q?ckrotcX/r0sxU5h6Zyx0+ZF2wK/54tA5pwJ4/RAZMfI/1MlUjp0LNk9I8LDZ?= =?us-ascii?Q?K/1tNQjpdsB9egnCh0kAEVUUsgdETT6D+EJokzBXcAoUKBhyIzPvOAg75pLv?= =?us-ascii?Q?FSq3OG5kohjTXsUcEaOTZoPLuRjiRsm04LKfMpIegqu/Z7Vaa+EMPWB/FwR7?= =?us-ascii?Q?GS/7tusqr+C+V066kBQHq26emwZZTdehFSYXF6+i0Zsnm0+3GhEtU42RLtch?= =?us-ascii?Q?YqIvqXfT3jkNSk101kfP9K6d4EzvBqa5Oj8ICvfwMcqiX8mhRt0wWy8l+/pE?= =?us-ascii?Q?Amy5WHMmsm/E6vEciJGWmN0o/YbJn7SEQLARdIk/sWBe6m1L+3pngJdIvz3H?= =?us-ascii?Q?OiqaSx4fRqFhzyOihf8EQp7kkmykc+iqF71HFAmqtSV4NLcvyQOyTmoN/zGD?= =?us-ascii?Q?IJZCYCfaPjMOomKf00zh86p2GJU8iPaztYS1/64gD4jNLFaJ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8m9As+QA=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: mikeg.net X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3087.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1676a74a-80da-4a89-a62d-08dba3e0d537 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Aug 2023 13:57:04.7974 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: badcd713-31c2-4746-8caa-6d9c50127dc4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: czXsC53j9B1Be8p+hc/WcryNW2GMwPN+jy4/dnLH94Cu3HkovEFxp83JThw+lP+H X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8953 Subject: RE: [musl] sizeof(pthread_mutex_t) on aarch64 Yeah, that all makes sense. I suspected that would be the case, but I figur= ed I'd memorialize the issue in case someone else came across it. This way,= they might at least find it via a search. Just for my interest, I'm going = to have a quick look to figure out why glibc ends up with the different siz= e on aarch64: It seems like it is the outlie, although my sample size is no= t large. Re gcompat, that didn't fix this particular issue and in any case,= I really didn't like what it did to cmdline in procfs with its shimming, b= ut I'll certainly keep an eye on its development. Thanks for the prompt res= ponse... -----Original Message----- From: Rich Felker =20 Sent: Wednesday, August 23, 2023 9:30 AM To: Mike Granby Cc: musl@lists.openwall.com Subject: Re: [musl] sizeof(pthread_mutex_t) on aarch64 On Wed, Aug 23, 2023 at 02:09:35AM +0000, Mike Granby wrote: > I've been running glibc-compiled programs on Alpine and thus on musl=20 > with a high level of success, but I just hit the wall when working on=20 > a Raspberry PI running aarch64 Alpine. I tracked the issue down to a=20 > difference in the size of pthread_mutex_t. It appears that musl uses 6=20 > ints for platforms with 32-bit longs, and 10 ints for those with=20 > 64-bit longs, and this seems to match glibc on all of the platforms=20 > I've played with to date. But on aarch64, it appears that glibc is=20 > using 48 bytes rather than 40 bytes that musl expects. This doesn't=20 > actually cause an issue in many cases as the application just=20 > allocates too much space, but if you're using inlining and=20 > std::ofstream, for example, you end up with the inline code in the=20 > application having a different layout for the file buffer object=20 > compared to that implemented on the target platform. Now, perhaps the=20 > answer is just, well, stop expecting to run glibc code on musl, but=20 > given that aarch64 seems to be an outlier in my experience to date, I=20 > thought I'd mention it. I guess that's interesting to know, but not something actionable. It's not = like we can change and break ABI for the sake of glibc-ABI-compat, nor like= we'd want to make every program use even more excess memory space for mute= xes than they're already using. At some point the decision was made, based = on our existing practice at the time and possibly loosely on glibc doing th= e same, to have the pthread types be arch-independent and only depend on wo= rdsize, and this determined the ABI for all archs added later, without the = types getting evaluated for glibc-ABI-compat since they were no longer arch= types. FWIW I think the program would likely "work" with a glibc version of libstdc++. However, there are a lot of other places the ABI-compat breaks down, like mismatching stat structs, ipc structs, etc. The future ro= admap is for glibc-ABI-compat handling to be shifted out of libc to the gco= mpat package, which could do some sort of shims (and which musl ldso would = assist it in shimming by letting a delegated library interpose on modules t= hat have libc.so.6 dep) and perhaps make something like this work.. Rich