public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Askar Safin <safinaskar@zohomail.com>
To: "Zack Weinberg" <zack@owlfolio.org>
Cc: "GNU libc development" <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2] Add public function syscall_no_errno
Date: Mon, 12 Feb 2024 22:34:13 +0400	[thread overview]
Message-ID: <18d9e992755.acbdc13046260.2085489331463195884@zohomail.com> (raw)
In-Reply-To: <a8f5649d-5a66-4a79-840f-ffa513bc2d28@app.fastmail.com>

 ---- On Mon, 12 Feb 2024 21:25:27 +0400  Zack Weinberg  wrote --- 
 > 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) ?

Yes.

 > here's the assembly dump of
 > getuid() on x86-64:

Even "incorrect" getuid implementation will work correctly on x86_64,
because uids are 32 bit on Linux. Whole this problem matters for 32-bit
architectures, not 64-bit ones.

 > 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.

getuid is defined in ./sysdeps/unix/sysv/linux/i386/syscalls.list (and similar
files). In 4th column we see "E". This means that getuid never fails and we
should pass raw syscall result to userspace.

"E" gets processed here:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/make-syscalls.sh;h=4f6c3490a20bc3eb34f11f1e7aab0ddec7e82e5d;hb=155bb9d036646138348fee0ac045de601811e0c5#l169

Then here:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/make-syscalls.sh;h=4f6c3490a20bc3eb34f11f1e7aab0ddec7e82e5d;hb=155bb9d036646138348fee0ac045de601811e0c5#l273

--
Askar Safin
https://types.pl/@safinaskar


  parent reply	other threads:[~2024-02-12 18:34 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
2024-02-12 18:34                   ` Askar Safin [this message]
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=18d9e992755.acbdc13046260.2085489331463195884@zohomail.com \
    --to=safinaskar@zohomail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=zack@owlfolio.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).