public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "matthias.gerstner at nefkom dot net" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug time/26833] New: adjtime() with delta == NULL segfaults on armv7 32bit platform
Date: Mon, 02 Nov 2020 17:14:47 +0000	[thread overview]
Message-ID: <bug-26833-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=26833

            Bug ID: 26833
           Summary: adjtime() with delta == NULL segfaults on armv7 32bit
                    platform
           Product: glibc
           Version: 2.32
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: time
          Assignee: unassigned at sourceware dot org
          Reporter: matthias.gerstner at nefkom dot net
  Target Milestone: ---

I recently updated glibc from release 2.31 to release 2.32 on Gentoo Linux
running on a 32-bit armv7 machine. Ever since that the ntpd from openntpd
doesn't startup any more.

Digging deeper I found that the forked 'ntp_main' instance of ntpd dies with a
SIGSEGV when executing the the adjtime() glibc function call in the following
function:


```
double                                                                          
getoffset(void)                                                                 
{                                                                               
        struct timeval  tv;                                                     
>>>>    if (adjtime(NULL, &tv) == -1)                                             
                return (0.0);                                                   
        return (tv.tv_sec + 1.0e-6 * tv.tv_usec);                               
}
```

The issue seems to stem from glibc git commit
0308077e3a4ff1c123cdddd311f55a2ecdd3115c where the newly introduced __adjtime
32-bit wrapper cannot handle a NULL pointer itv input parameter.

```
+#if __TIMESIZE != 64
+libc_hidden_def (__adjtime64)
+
+int
+__adjtime (const struct timeval *itv, struct timeval *otv)
+{
+  struct __timeval64 itv64, otv64;
+  int retval;
+
+  itv64 = valid_timeval_to_timeval64 (*itv);
+  retval = __adjtime64 (&itv64, otv != NULL ? &otv64 : NULL);
+  if (otv != NULL)
+    *otv = valid_timeval64_to_timeval (otv64);
+
+  return retval;
+}
+#endif
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2020-11-02 17:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 17:14 matthias.gerstner at nefkom dot net [this message]
2020-11-02 17:24 ` [Bug time/26833] " adhemerval.zanella at linaro dot org
2020-11-09 14:20 ` adhemerval.zanella at linaro dot org
2020-11-10 12:20 ` fweimer at redhat dot com

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=bug-26833-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@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).