public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: Joe Simmons-Talbott via Libc-alpha <libc-alpha@sourceware.org>,
	Joe Simmons-Talbott <josimmon@redhat.com>
Subject: Re: [PATCH 2/2] aarch64: Set the syscall register right before doing the syscall.
Date: Tue, 11 Apr 2023 13:39:31 -0300	[thread overview]
Message-ID: <d09c14d0-c099-017c-3fe5-25ee190231fa@linaro.org> (raw)
In-Reply-To: <87a5zeieym.fsf@oldenburg.str.redhat.com>



On 11/04/23 13:03, Florian Weimer wrote:
> * Adhemerval Zanella Netto:
> 
>> On 11/04/23 10:50, Florian Weimer via Libc-alpha wrote:
>>> * Joe Simmons-Talbott via Libc-alpha:
>>>
>>>>    ({ long _sys_result;						\
>>>>       {								\
>>>>         LOAD_ARGS_##nr (args)					\
>>>>         register long _x8 asm ("x8") = (name);			\
>>>> +       if (__builtin_constant_p(name))				\
>>>> +         asm volatile ("mov	x8, " MSTR(name) ";"		\
>>>> +                       : /* no output */ : "i" (name) : "x8");	\
>>>>         asm volatile ("svc	0	// syscall " # name     \
>>>>  		     : "=r" (_x0) : "r"(_x8) ASM_ARGS_##nr : "memory");	\
>>>>         _sys_result = _x0;					\
>>>
>>> I think you should do this in a single assembler statement, load the
>>> constant only once.
>>
>> Is this required because compiler is free to reorganize the argument
>> list? I think it should me it clear on the commit message.
> 
> Yes, that's the reason.  It's a bit tricky to recover the system call
> number using static analysis otherwise.  I suggested to Joe that we
> should put something into glibc, rather than improving that static
> analysis tool so that it's fully reliable.

Direct syscalls are done by different projects, like sanitizer, libgomp,
etc; so imho improving the static analysis tool could potentially catch
a wide range of usages than trying to fix only on glibc.

  reply	other threads:[~2023-04-11 16:39 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11 13:30 [PATCH 0/2] x86_64: aarch64: Set call number just before syscall Joe Simmons-Talbott
2023-04-11 13:30 ` [PATCH 1/2] x86_64: Set the syscall register right before doing the syscall Joe Simmons-Talbott
2023-04-17 22:35   ` Noah Goldstein
2023-04-17 22:36     ` Noah Goldstein
2023-04-11 13:30 ` [PATCH 2/2] aarch64: " Joe Simmons-Talbott
2023-04-11 13:50   ` Florian Weimer
2023-04-11 14:15     ` Adhemerval Zanella Netto
2023-04-11 15:43       ` Szabolcs Nagy
2023-04-11 16:03       ` Florian Weimer
2023-04-11 16:39         ` Adhemerval Zanella Netto [this message]
2023-04-12 15:27           ` Joe Simmons-Talbott
2023-04-12 21:11 ` [PATCH v2 0/2] x86_64: aarch64: Set call number just before syscall Joe Simmons-Talbott
2023-04-12 21:11   ` [PATCH v2 1/2] x86_64: Set the syscall register right before doing the syscall Joe Simmons-Talbott
2023-04-12 21:11   ` [PATCH v2 2/2] aarch64: " Joe Simmons-Talbott
2023-04-17 15:34 ` [PATCH v3 0/2] x86_64: aarch64: Set call number just before syscall Joe Simmons-Talbott
2023-04-17 15:34   ` [PATCH v3 1/2] x86_64: Set the syscall register right before doing the syscall Joe Simmons-Talbott
2023-04-17 15:54     ` H.J. Lu
2023-04-17 16:00       ` Joe Simmons-Talbott
2023-04-17 18:38         ` H.J. Lu
2023-04-17 15:34   ` [PATCH v3 2/2] aarch64: " Joe Simmons-Talbott
2023-04-17 21:20 ` [PATCH v4 0/2] x86_64: aarch64: Set call number just before syscall Joe Simmons-Talbott
2023-04-17 21:20   ` [PATCH v4 1/2] x86_64: Set the syscall register right before doing the syscall Joe Simmons-Talbott
2023-04-17 21:20   ` [PATCH v4 2/2] aarch64: " Joe Simmons-Talbott
2023-04-18 12:57     ` Szabolcs Nagy
2023-04-18 19:33       ` Joe Simmons-Talbott
2023-04-19 13:58 ` [PATCH v5 0/3] x86_64: aarch64: Set call number just before syscall Joe Simmons-Talbott
2023-04-19 13:58   ` [PATCH v5 1/3] x86_64: Set the syscall register right before doing the syscall Joe Simmons-Talbott
2023-04-19 15:35     ` H.J. Lu
2023-04-19 15:48       ` Joe Simmons-Talbott
2023-04-19 13:58   ` [PATCH v5 2/3] aarch64: " Joe Simmons-Talbott
2023-04-19 14:56     ` Szabolcs Nagy
2023-04-19 15:21       ` Joe Simmons-Talbott
2023-04-19 13:58   ` [PATCH v5 3/3] nptl: Use direct syscall numbers in setxid 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=d09c14d0-c099-017c-3fe5-25ee190231fa@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.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).