From: "Arnd Bergmann" <arnd@arndb.de>
To: "YunQiang Su" <yunqiang.su@cipunited.com>,
"Xi Ruoyao" <libc-alpha@sourceware.org>
Cc: aurelien@aurel32.net,
"Adhemerval Zanella Netto" <adhemerval.zanella@linaro.org>,
"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, 08 Nov 2022 11:39:26 +0100 [thread overview]
Message-ID: <652b5ea3-2305-4a1e-b1b5-de81864a844c@app.fastmail.com> (raw)
In-Reply-To: <20221108044945.2173509-1-yunqiang.su@cipunited.com>
On Tue, Nov 8, 2022, at 05:49, YunQiang Su wrote:
> Currently glibc uses in_time_t_range to detects time_t overflow,
> and if it occurs fallbacks to 64 bit syscall version.
>
> The function name is confusing because internally time_t might be
> either 32 bits or 64 bits (depending on __TIMESIZE).
>
> This patch refactors the in_time_t_range by replacing it with
> in_int32_t_range for the case to check if the 64 bit time_t syscall
> should be used.
>
> The in_time_t range is used to detect overflow of the
> syscall return value.
It looks like the fallback logic has another flaw, I don't
see how this works on kernels with COMPAT_32BIT_TIME disabled,
as these only have the time64 syscalls available.
I think for the syscall wrappers implementing the time64
interfaces, there should not be any in_time_t_range()
check, but instead they can just call the time64 syscall
first and only fall back to the time32 version if that
fails with ENOSYS on pre-5.1 kernels. As a side-effect that
would also make it slightly faster on modern kernels
(skipping the pointless range check), at the cost of
being a bit slower on old kernels that require the fallback.
Arnd
next prev parent reply other threads:[~2022-11-08 10:39 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 [this message]
2022-11-08 11:17 ` Florian Weimer
2022-11-08 11:33 ` Arnd Bergmann
2022-11-08 11:39 ` Florian Weimer
2022-11-08 11:55 ` Adhemerval Zanella Netto
2022-11-08 12:28 ` Arnd Bergmann
2022-11-08 12:51 ` Adhemerval Zanella Netto
2022-11-08 13:27 ` Arnd Bergmann
2022-11-08 13:49 ` Adhemerval Zanella Netto
2022-11-08 14:07 ` Arnd Bergmann
2022-11-08 14:27 ` Adhemerval Zanella Netto
2022-11-08 19:47 ` Adhemerval Zanella Netto
2022-11-08 23:29 ` Rich Felker
2022-11-17 17:35 ` Adhemerval Zanella Netto
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=652b5ea3-2305-4a1e-b1b5-de81864a844c@app.fastmail.com \
--to=arnd@arndb.de \
--cc=adhemerval.zanella@linaro.org \
--cc=aurelien@aurel32.net \
--cc=jiaxun.yang@flygoat.com \
--cc=libc-alpha@sourceware.org \
--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).