public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Dan Christensen <opello@opello.org>
To: libc-help@sourceware.org
Subject: clock_gettime after 2.31 and reused syscall numbers
Date: Thu, 22 Dec 2022 12:18:05 -0600	[thread overview]
Message-ID: <CAKUTJ2sciOs-SDjfv_G-wesqr9c5tfEN88COUFSAcDG6LdgX3w@mail.gmail.com> (raw)

Hello,

My understanding is that after glibc 2.31 clock_gettime can call
clock_gettime64 from a 32-bit process to get a 64-bit time_t if the
underlying kernel supports such a thing.  The problem I ran into was
that a particular Synology kernel version (3.10.77) included their own
system calls for whatever product specific purpose they may have
wanted, including one at 403 (SYNOArchiveBit) which is where Linux 5.1
added clock_gettime64.

This resulted in glibc >= 2.31 trying to call that proprietary
function instead of falling back to clock_gettime.  Which in a trivial
test case saw both struct timespec members be 0.  But in the actual
application that triggered digging into this issue saw a thread hit
99% CPU usage and not be able to yield due to clock_gettime64 (but
really SYNOArchiveBit) returning EINVAL.

In glibc <= 2.28 clock_gettime is called and no problem nor loss of
time_t precision is realized.

I'm curious if glibc should even try to handle this case?
Part of why I ask is because [1] seems to suggest that it may have
been most appropriate to examine the vDSO for the presence of a
clock_gettime64 symbol before trying to go down the path of invoking
that function.
Or is all of that out of scope because "a vendor deviated from
mainline, and such things are impossible to predict or support"?  I
don't mean to suggest that to be an unreasonable position.

Thanks for your time,
Dan

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=ec138c67cbda8b5826a0a2a7ba456408117996dc

             reply	other threads:[~2022-12-22 18:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 18:18 Dan Christensen [this message]
2022-12-22 19:04 ` Florian Weimer

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=CAKUTJ2sciOs-SDjfv_G-wesqr9c5tfEN88COUFSAcDG6LdgX3w@mail.gmail.com \
    --to=opello@opello.org \
    --cc=libc-help@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).