util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>, "H.J. Lu" <hjl.tools@gmail.com>
Cc: "Alejandro Colomar" <alx@kernel.org>,
	"Thomas Weißschuh" <thomas@t-8ch.de>,
	util-linux@vger.kernel.org, "Xi Ruoyao" <xry111@xry111.site>,
	"GNU C Library" <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2] x32: Implement prctl in assembly
Date: Mon, 8 Dec 2025 08:47:27 -0300	[thread overview]
Message-ID: <ad7ac28b-fa81-48a1-b3f5-e2ab21f83c51@linaro.org> (raw)
In-Reply-To: <lhuqzt5l4pk.fsf@oldenburg.str.redhat.com>



On 08/12/25 06:09, Florian Weimer wrote:
> * H. J. Lu:
> 
>> On Mon, Dec 8, 2025 at 4:11 PM Florian Weimer <fweimer@redhat.com> wrote:
>>>
>>> * H. J. Lu:
>>>> Here is the v2 patch to implement prctl in assembly for x32.
>>>>
>>>> Since the variadic prctl function takes at most 5 integer arguments which
>>>> are passed in the same integer registers on x32 as the function with 5
>>>> integer arguments, we can use assembly for prctl.  Since upper 32-bits in
>>>> the last 4 arguments of prctl must be cleared to match the x32 prctl
>>>> syscall interface where the last 4 arguments are unsigned 64 bit longs,
>>>> implement prctl in assembly to clear upper 32-bits in the last 4 arguments
>>>> and add a test to verify it.
>>>
>>> What's the advantage of the assembler implementation over the C
>>> implementation?  I'm missing the context for this change.
>>>
>>
>> It is inspired by
>>
>> commit 6a04404521ac4119ae36827eeb288ea84eee7cf6
>> Author: Florian Weimer <fweimer@redhat.com>
>> Date:   Sat Feb 17 09:17:04 2024 +0100
>>
>>     Linux: Switch back to assembly syscall wrapper for prctl (bug 29770)
> 
> The justification for that does not apply to x32, though, because prctl
> doesn't take floating point arguments.  I don't have a strong opinion,
> the C and assembler versions are of similar complexity.

The main justification is UB to va_args *all* the arguments without taking
in the consideration which option is passed.  If x32 requires additional
argument handling to clear the upper 32-bits, there is no advantage of
using the assembly wrapper.

  reply	other threads:[~2025-12-08 11:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-01  9:31 [PATCH v1] Call prctl(2) with long integers, specify 5 arguments, and avoid casts Alejandro Colomar
2024-06-01 11:05 ` Thomas Weißschuh
2024-06-01 12:23   ` Alejandro Colomar
2024-06-01 19:32     ` Alejandro Colomar
2025-12-04 14:06     ` Adhemerval Zanella Netto
2025-12-07  3:52       ` [PATCH] x32: Switch back to assembly syscall wrapper for prctl H.J. Lu
2025-12-07  9:41         ` Florian Weimer
2025-12-08  1:48           ` [PATCH v2] x32: Implement prctl in assembly H.J. Lu
2025-12-08  8:10             ` Florian Weimer
2025-12-08  9:01               ` H.J. Lu
2025-12-08  9:09                 ` Florian Weimer
2025-12-08 11:47                   ` Adhemerval Zanella Netto [this message]
2025-12-08 14:25                     ` Florian Weimer
2025-12-08 22:41                       ` [PATCH v3] " H.J. Lu
2025-12-07 12:34         ` [PATCH] x32: Switch back to assembly syscall wrapper for prctl Alejandro Colomar
2024-06-06  7:21 ` [PATCH v1] Call prctl(2) with long integers, specify 5 arguments, and avoid casts Karel Zak
2025-12-03 20:50 ` [PATCH v2 0/1] Call prctl(2) with signed long integers, " Alejandro Colomar
2025-12-03 20:50   ` [PATCH v2 1/1] " Alejandro Colomar
2025-12-03 21:01   ` [PATCH v2 0/1] " Alejandro Colomar
2025-12-03 22:12     ` Thomas Weißschuh
2025-12-03 22:36       ` Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad7ac28b-fa81-48a1-b3f5-e2ab21f83c51@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=alx@kernel.org \
    --cc=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=thomas@t-8ch.de \
    --cc=util-linux@vger.kernel.org \
    --cc=xry111@xry111.site \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).