mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Stefan O'Rear" <sorear@fastmail.com>
To: musl@lists.openwall.com
Subject: Re: [musl] [PATCH 02/14] time64: Don't make aliases to nonexistent syscalls
Date: Thu, 03 Sep 2020 15:36:00 -0400	[thread overview]
Message-ID: <05292d85-1bcf-4967-8c48-276d5d82e91b@www.fastmail.com> (raw)
In-Reply-To: <20200903155615.GC3265@brightrain.aerifal.cx>

On Thu, Sep 3, 2020, at 11:56 AM, Rich Felker wrote:
> On Thu, Sep 03, 2020 at 07:22:57AM -0400, Stefan O'Rear wrote:
> > riscv32 and future architectures lack the _time32 variants entirely, so
> > don't try to use their numbers.
> > ---
> >  src/internal/syscall.h | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/src/internal/syscall.h b/src/internal/syscall.h
> > index d5f294d4..66fc4e5c 100644
> > --- a/src/internal/syscall.h
> > +++ b/src/internal/syscall.h
> > @@ -201,6 +201,7 @@ static inline long __alt_socketcall(int sys, int sock, int cp, long a, long b, l
> >  #define SYS_sendfile SYS_sendfile64
> >  #endif
> >  
> > +#ifdef SYS_timer_settime32
> >  #ifndef SYS_timer_settime
> >  #define SYS_timer_settime SYS_timer_settime32
> >  #endif
> > @@ -240,6 +241,7 @@ static inline long __alt_socketcall(int sys, int sock, int cp, long a, long b, l
> >  #ifndef SYS_settimeofday
> >  #define SYS_settimeofday SYS_settimeofday_time32
> >  #endif
> > +#endif
> 
> The existing expectation internally in musl is that archs that lack
> legacy time32 syscalls have both the unadorned and _time64 macros
> defined to the same value. The public headers don't have to be like
> that but the internal ones do. See arch/x32/syscall_arch.h which does
> it but in the opposite direction. This logic is all tested for x32 and
> a big part of the point of that was preparing for rv32 and future
> 32-bit archs.
> 
> I'm actually missing how this patch worked as-written, since for
> example timer_settime.c unconditionally assumes SYS_timer_settime is
> defined, and if it's defined to anything other than the same value as
> the time64 version, it will use the value as a fallback.

src/internal/syscall.h has two groups of conditional definitions of unadorned
syscall numbers, the first of which sets undefined syscalls to the _time32
version, the second of which sets to the _time64 version.  So for instance I
see no way for the #define SYS_clock_gettime SYS_clock_gettime64
(https://git.musl-libc.org/cgit/musl/tree/src/internal/syscall.h#n250) to execute.

-s

  reply	other threads:[~2020-09-03 19:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 11:22 [musl] [PATCH 00/14] riscv32 support Stefan O'Rear
2020-09-03 11:22 ` [musl] [PATCH 01/14] Remove ARMSUBARCH relic from configure Stefan O'Rear
2020-09-03 11:22 ` [musl] [PATCH 02/14] time64: Don't make aliases to nonexistent syscalls Stefan O'Rear
2020-09-03 15:56   ` Rich Felker
2020-09-03 19:36     ` Stefan O'Rear [this message]
2020-09-03 21:17       ` Rich Felker
2020-09-03 11:22 ` [musl] [PATCH 03/14] time64: Only getrlimit/setrlimit if they exist Stefan O'Rear
2020-09-03 11:22 ` [musl] [PATCH 04/14] time64: Only gettimeofday/settimeofday if exist Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 05/14] Add src/internal/statx.h Stefan O'Rear
2020-09-03 15:39   ` Arnd Bergmann
2020-09-03 15:51     ` Rich Felker
2020-09-03 18:08       ` Arnd Bergmann
2020-09-03 11:23 ` [musl] [PATCH 06/14] Only call fstatat if defined Stefan O'Rear
2020-09-03 16:05   ` Rich Felker
2020-09-04  1:47     ` Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 07/14] Emulate wait4 using waitid Stefan O'Rear
2020-09-03 14:56   ` Stefan O'Rear
2020-09-03 15:36     ` Arnd Bergmann
2020-09-03 15:40       ` Stefan O'Rear
2020-09-03 18:08         ` Arnd Bergmann
2020-09-03 15:49   ` Rich Felker
2020-09-03 16:25     ` Stefan O'Rear
2020-09-03 16:38       ` Rich Felker
2020-09-03 11:23 ` [musl] [PATCH 08/14] riscv: Fall back to syscall __riscv_flush_icache Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 09/14] riscv32: Target and subtarget detection Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 10/14] riscv32: add arch headers Stefan O'Rear
2020-09-03 15:49   ` Arnd Bergmann
2020-09-03 11:23 ` [musl] [PATCH 11/14] riscv32: Add fenv and math Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 12/14] riscv32: Add dlsym Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 13/14] riscv32: Add jmp_buf and sigreturn Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 14/14] riscv32: Add thread support Stefan O'Rear

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=05292d85-1bcf-4967-8c48-276d5d82e91b@www.fastmail.com \
    --to=sorear@fastmail.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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