public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: Re: [PATCH v2] Add public function syscall_no_errno
Date: Mon, 12 Feb 2024 14:55:22 -0300	[thread overview]
Message-ID: <c6dd2c8d-e7f0-4d10-9455-c506d321bc35@linaro.org> (raw)
In-Reply-To: <a8f5649d-5a66-4a79-840f-ffa513bc2d28@app.fastmail.com>



On 12/02/24 14:25, Zack Weinberg wrote:
> On Mon, Feb 12, 2024, at 11:16 AM, Askar Safin wrote:
>> ---- On Mon, 12 Feb 2024 18:44:31 +0400  Rich Felker  wrote ---
>>  > Yes, there are a very small number of such syscalls -- getuid and
>>  > getgid are the only relevant ones AFAICT -- but the author of this
>>  > proposal is missing the point
>>
>> Okay, I declare defeat
> 
> I have a question for you: Do glibc's existing getuid() and getgid()
> functions correctly handle IDs in the [-4095, -1] range (perhaps better
> described as the [4294963201, 4294967295] range) ?  It appears to me
> from binary code inspection that they do -- here's the assembly dump of
> getuid() on x86-64:
> 
> (gdb) disas getuid
> Dump of assembler code for function __GI_getuid:
>    0x00000000000cf940 <+0>:	mov    $0x66,%eax
>    0x00000000000cf945 <+5>:	syscall
>    0x00000000000cf947 <+7>:	ret
> End of assembler dump.

Afaiu this is not an issue for x86_64, or any other 64-bit architecture,
because uid_t/gid_t are exported as an uint32_t (__UID_T_TYPE/__U32_TYPE),
and the invalid return valid are in the range of [-4096UL,-1UL].

> 
> But I am not having any luck figuring out what bit of glibc's *source*
> code tells the syscall stub generator not to emit the code to check for
> error returns for these syscalls, so it's plausible to me that there is
> a bug in here somewhere, possibly only on lesser-used architectures.  If
> you know of a case where we get this wrong, please tell us about it so
> we can fix it.
> 
> zw

  parent reply	other threads:[~2024-02-12 17:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-28 16:39 [PATCH, RFC] " Askar Safin
2024-02-01 17:53 ` Adhemerval Zanella Netto
2024-02-01 18:18   ` Rich Felker
2024-02-01 19:32   ` Askar Safin
2024-02-01 20:16     ` dalias
2024-02-01 20:57       ` Adhemerval Zanella Netto
2024-02-08 15:02         ` [PATCH v2] " Askar Safin
2024-02-08 17:48           ` Szabolcs Nagy
2024-02-12 14:24           ` Florian Weimer
2024-02-12 14:44             ` Rich Felker
2024-02-12 16:16               ` Askar Safin
2024-02-12 17:25                 ` Zack Weinberg
2024-02-12 17:43                   ` Andreas Schwab
2024-02-12 18:22                     ` Zack Weinberg
2024-02-13  9:10                       ` Andreas Schwab
2024-02-13 11:57                         ` Adhemerval Zanella Netto
2024-02-12 17:55                   ` Adhemerval Zanella Netto [this message]
2024-02-12 18:34                   ` Askar Safin
2024-02-07  0:59       ` [PATCH, RFC] " Askar Safin
2024-02-07 20:59         ` dalias
2024-02-08 17:08           ` Askar Safin
2024-02-07  1:57 ` Mike Frysinger
2024-02-07 12:55   ` Askar Safin

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=c6dd2c8d-e7f0-4d10-9455-c506d321bc35@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).