public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Noah Goldstein <goldstein.w.n@gmail.com>
Cc: Joe Simmons-Talbott <josimmon@redhat.com>,
	 Noah Goldstein via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH v6 1/3] x86_64: Set the syscall register right before doing the syscall.
Date: Tue, 30 May 2023 12:13:39 +0200	[thread overview]
Message-ID: <87sfbeunxo.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAFUsyf+qCZLBhQgJdd3wVarQ4J6u2V62gjRB7T-aMHPwR0v-Zw@mail.gmail.com> (Noah Goldstein's message of "Fri, 26 May 2023 14:18:14 -0700")

* Noah Goldstein:

> On Fri, May 26, 2023 at 5:59 AM Joe Simmons-Talbott <josimmon@redhat.com> wrote:
>>
>> On Fri, May 26, 2023 at 09:04:06AM +0200, Florian Weimer wrote:
>> > * Noah Goldstein via Libc-alpha:
>> >
>> > > I'm minorly opposed to this patch. Even if GLIBC guarantees all
>> > > syscalls will set the number the instruction before, that's no guarantee
>> > > for the entire program. Furthermore in the event of:
>> > >    `movl $VAL, %eax; syscall`
>> > > It's still not safe to *always* assume that `VAL` correspond to the
>> > > syscall number as a jump (direct or indirect) could still go between
>> > > the instructions (i.e there is no guarantee in the assembly that the
>> > > `mov` dominates the `syscall).
>> > > So at the end of the day, we are bloating the library without, AFAICT,
>> > > providing any real guarantee. Maybe I'm missing something?
>> >
>> > Joe, is there a size change to libc.so.6 as the result of this change?
>>
>> No, the size is the same with and with out this patchset on x86_64.
>>
> There aren't many syscalls so it's only a minor cost (hence the only
> minor opposition), but I don't see the value this provides given that it
> still won't be safe to assume the syscall number is always set the
> instruction beforehand for any robust purpose. So it still feels like
> why take any cost at all?

I think there is any run-time cost at all, only the increased source
complexity.

It's much easier to change glibc than to add full register tracking to a
the static analysis tool that discovers system calls in the disassembly.

Thanks,
Florian


  reply	other threads:[~2023-05-30 10:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 15:03 [PATCH v6 0/3] x86_64: aarch64: Set call number just before syscall Joe Simmons-Talbott
2023-04-24 15:03 ` [PATCH v6 1/3] x86_64: Set the syscall register right before doing the syscall Joe Simmons-Talbott
2023-05-15 14:15   ` Joe Simmons-Talbott
2023-05-15 16:20     ` H.J. Lu
2023-05-25 18:07   ` Joe Simmons-Talbott
2023-05-25 18:40     ` Noah Goldstein
2023-05-26  7:04       ` Florian Weimer
2023-05-26 12:59         ` Joe Simmons-Talbott
2023-05-26 21:18           ` Noah Goldstein
2023-05-30 10:13             ` Florian Weimer [this message]
2023-05-31 18:23               ` Noah Goldstein
2023-06-28 19:17                 ` Joe Simmons-Talbott
2023-04-24 15:03 ` [PATCH v6 2/3] aarch64: " Joe Simmons-Talbott
2023-05-09  7:47   ` Szabolcs Nagy
2023-04-24 15:03 ` [PATCH v6 3/3] nptl: Use direct syscall numbers in setxid Joe Simmons-Talbott
2023-04-24 15:17   ` Xi Ruoyao
2023-04-26  9:46     ` Szabolcs Nagy
2023-04-28 10:52       ` Florian Weimer
2023-04-26 12:39     ` Cristian Rodríguez
2023-04-26 13:24       ` Szabolcs Nagy
2023-05-25 18:07   ` Joe Simmons-Talbott
2023-05-08 14:13 ` [PATCH v6 0/3] x86_64: aarch64: Set call number just before syscall Joe Simmons-Talbott

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=87sfbeunxo.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=goldstein.w.n@gmail.com \
    --cc=josimmon@redhat.com \
    --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).