From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 13596385829B for ; Tue, 13 Feb 2024 11:54:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 13596385829B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 13596385829B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707825292; cv=none; b=OyTEby3TVjfL7+Z7W9WZT3Yr2w2kHjWl74WRezYaLGKVPNCdmIcfF/LgtiQ2q6JKVlfeptcyHrez+pbA1W/I1vCWubqlL43OASRb//eTiLEjT+Igp8Ovpiw6WCaS8PP0e8Su7Syoalfw/t4ubBbm4z91zQxfLtZj3i1I9vfa5+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707825292; c=relaxed/simple; bh=9bQdt3uCYI6Rrjy+/lVlsCQhKWZ0MRRb5nENuPzdE+E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vHnrCeN/dVQRKIsTFLhGwUBw3sGJrigxlDs6k/Ms/pj6zqDU9NcPDk46XoqQ6QpeP6V58m1ACWke/deoheUreQOmhZgNL6NFYuzfnrlsI4Dzif2JFUDvvkdua4GS9JUBzaFW3AxjPiV6smEpVL8kLs4cLTWBRjwtge8jy7g1VyI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707825290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qJLUqczvMehp6iQGUkm3TeR1/z6+39M5NbUjjI3/0ko=; b=Hn22TYyBH3NNnJt5WaeuhpsPrphthYXFfBZXzewocK4L4lc/sFgPdIM1eQteYul4YY5Et5 9UvitiiT8rlWtVDfRT05kBw6LTyJKoTh6xQL17nDI0//fboMSi72B/lNtLH4rc2nw3CdYB uCELT4qnQ1pgWSkSywEy6MztTA47X6c= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-100-3TIju3dROSaTUwMhlXDQpQ-1; Tue, 13 Feb 2024 06:54:47 -0500 X-MC-Unique: 3TIju3dROSaTUwMhlXDQpQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C747280AA25; Tue, 13 Feb 2024 11:54:47 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99FE740149AB; Tue, 13 Feb 2024 11:54:46 +0000 (UTC) From: Florian Weimer To: Simon Chopin Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Linux: Switch back to assembly syscall wrapper for prctl (bug 29770) References: <87mssir1u6.fsf@oldenburg.str.redhat.com> Date: Tue, 13 Feb 2024 12:54:45 +0100 In-Reply-To: (Simon Chopin's message of "Tue, 13 Feb 2024 03:35:03 -0800") Message-ID: <87jzn8inp6.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Simon Chopin: > Hi Florian, > > On ven. 02 f=C3=A9vr. 2024 22:30:25, Florian Weimer wrote: >> Commit ff026950e280bc3e9487b41b460fb31bc5b57721 ("Add a C wrapper for >> prctl [BZ #25896]") replaced the assembler wrapper with a C function. >> However, the C variadic function implementation has a different ABI >> on powerpc64le-linux-gnu. Switch back to the assembler implementation >> on most targets and only keep the C implementation for x86-64 x32. >> >> Also add the __prctl_time64 alias from commit >> b39ffab860cd743a82c91946619f1b8158b0b65e ("Linux: Add time64 alias for >> prctl") to sysdeps/unix/sysv/linux/syscalls.list; it was not yet >> present in commit ff026950e280bc3e9487b41b460fb31bc5b57721. >> >> This restores the old ABI on powerpc64le-linux-gnu, thus fixing >> bug 29770. > > Codewise it all looks good to me, but I have a perhaps dumb question: > at this point, aren't we breaking ABI again? Presumably, binaries have > been compiled against the varargs ABI, which AFAICT has been shipped in > RHEL 9 and Ubuntu 22.04 among others, which have been out for a while > now. It's possible to call functions with the parameter save area present that do not actually need it. The issue is in the other direction only. I believe the ABI was designed this way that it's possible to compile lots of legacy software that uses implicit function declarations, where the compiler has no information whether the function is defined variadic or not. Therefore, it creates the parameter save area for all such calls. I could probably word the commit message better, maybe like this: =E2=80=9C Commit ff026950e280bc3e9487b41b460fb31bc5b57721 ("Add a C wrapper for prctl [BZ #25896]") replaced the assembler wrapper with a C function. However, on powerpc64le-linux-gnu, the C variadic function implementation requires extra work in the caller to set up the parameter save area. Calling a function that needs a parameter save area without one (because the prototype used indicates the function is not variadic) corrupts the caller's stack. Switch back to the assembler implementation on most targets and only keep the C implementation for x86-64 x32. =E2=80=9D Thanks, Florian