unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto via Libc-alpha <libc-alpha@sourceware.org>
To: Arnd Bergmann <arnd@arndb.de>, Florian Weimer <fweimer@redhat.com>
Cc: YunQiang Su <yunqiang.su@cipunited.com>,
	Xi Ruoyao <libc-alpha@sourceware.org>,
	aurelien@aurel32.net, Jiaxun Yang <jiaxun.yang@flygoat.com>,
	"Maciej W. Rozycki" <macro@orcam.me.uk>,
	syq@debian.org
Subject: Re: [PATCH v3] Define in_int32_t_range to check if the 64 bit time_t syscall should be used
Date: Tue, 8 Nov 2022 09:51:57 -0300	[thread overview]
Message-ID: <0e823c53-a93f-8ecf-6e83-84b1b78057c8@linaro.org> (raw)
In-Reply-To: <177e1cb4-7952-484c-8838-f3c41c6c1441@app.fastmail.com>



On 08/11/22 09:28, Arnd Bergmann wrote:
> On Tue, Nov 8, 2022, at 12:39, Florian Weimer wrote:
>>> On Tue, Nov 8, 2022, at 12:17, Florian Weimer wrote:
>>>> * Arnd Bergmann:
>>>>> On Tue, Nov 8, 2022, at 05:49, YunQiang Su wrote:
>>>>
>>>> Isn't that an invalid kernel configuration?
>>>
>>> No, this is what we will use anyway after 2038 (possibly
>>> earlier), so the option is useful to ensure that all userspace
>>> has been converted away from the time32 interfaces.
>>
>> What happened to not breaking userspace?
> 
> It's a configuration option that makes sense for some users
> but not others, just like a lot of other conditional system
> calls that we have (UID16, IPC, SGETMASK_SYSCALL, FUTEX, EVENTPOLL,
> INOTIFY, IO_URING, AIO, TIMERFD, QUOTA, MODULES).
> 
> If you turn these compile-time symbols off, you naturally break
> compatibility with any applications and libraries that call the
> corresponding syscalls, but nevertheless there are embedded
> systems that never need to call them and prefer to leave the
> symbols disabled.
> 
> If you know you run a modern glibc, you probably don't
> care about uid16 syscalls or sgetmask/ssetmask and can
> leave them disabled. Similarly, system calls that have
> not been used for a long time eventually get removed
> completely, with extreme caution. Examples include prof(),
> lock(), afs_syscall(), pkey_set(), or ftime(). uselib() may
> be next on the list.
> 
> For embedded systems, being able to turn off the broken
> time32 interfaces right now is fairly important, otherwise
> it is excessively hard to validate that a system is not
> accidentally calling the wrong interfaces or relying on
> fallbacks that no longer work after 2038.
> 
> For a desktop distro, that obviously does not apply, as
> users need to be able to run arbitrary binaries that
> were built for time32 or uid16.

Sigh, I have added the use of 64 bit syscall if required for some
sysmbols because I assumed that 32 bit time_t syscall would be always
available.  This is small optimization to avoid issuing a lot of
64 bit syscall, specially for syscall like futex.

But if kernel does indeed assume that COMPAT_32BIT_TIME is a supported
configuration I think we will need to roll out the optimization and
always issue the 64 bit time_t syscalls anyway.  From a glibc point of
view it should not matter much besides some small overhead for newer
glibc running on older kernels (we might add a global to disable the
64-bit call if kernel does not support, as we do for some specific
syscalls).

> 
>> Those with 32-bit applications will want to run their legacy stuff in a
>> time-shifted environment, so these system calls must remain supported
>> outside specialized applications.
> 
> We have had several discussions about adding time-shifting
> for CLOCK_REALTIME to the kernel, and always concluded that
> the added complexity is not worth the possible benefit
> (unlike shifting CLOCK_MONOTONIC, which has use cases for
> checkpoint/restart).
> 
> Clearly one can do the same thing using some LD_PRELOAD
> library or a virtual machine, but then again if you do this,
> you can also have that LD_PRELOAD library do the conversion
> to the time64 interfaces, or have the VM run a kernel with
> the time32 syscalls still present.
> 
>      Arnd

  reply	other threads:[~2022-11-08 12:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04  1:39 [PATCH] Use in_int32_t_range to check need 64bit syscall YunQiang Su
2022-11-08  4:49 ` [PATCH v3] Define in_int32_t_range to check if the 64 bit time_t syscall should be used YunQiang Su
2022-11-08 10:39   ` Arnd Bergmann
2022-11-08 11:17     ` Florian Weimer via Libc-alpha
2022-11-08 11:33       ` Arnd Bergmann
2022-11-08 11:39         ` Florian Weimer via Libc-alpha
2022-11-08 11:55           ` Adhemerval Zanella Netto via Libc-alpha
2022-11-08 12:28           ` Arnd Bergmann
2022-11-08 12:51             ` Adhemerval Zanella Netto via Libc-alpha [this message]
2022-11-08 13:27               ` Arnd Bergmann
2022-11-08 13:49                 ` Adhemerval Zanella Netto via Libc-alpha
2022-11-08 14:07                   ` Arnd Bergmann
2022-11-08 14:27                     ` Adhemerval Zanella Netto via Libc-alpha
2022-11-08 19:47                       ` Adhemerval Zanella Netto via Libc-alpha
2022-11-08 23:29                         ` Rich Felker
2022-11-17 17:35   ` Adhemerval Zanella Netto via Libc-alpha

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

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e823c53-a93f-8ecf-6e83-84b1b78057c8@linaro.org \
    --to=libc-alpha@sourceware.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=arnd@arndb.de \
    --cc=aurelien@aurel32.net \
    --cc=fweimer@redhat.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=macro@orcam.me.uk \
    --cc=syq@debian.org \
    --cc=yunqiang.su@cipunited.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.
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).