unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org
Cc: Alex Branham <alex.branham@gmail.com>, 34235@debbugs.gnu.org
Subject: bug#34235: 0e334db6bb4b1fd1e2d72c1f3d8f004313cd9f94 (posix-timers: Fix division by zero bug). Problems with glibc.
Date: Fri, 1 Feb 2019 21:47:00 +0000	[thread overview]
Message-ID: <20190201214700.GA4950@ACM> (raw)
In-Reply-To: <87o9807ht0.fsf@gmail.com>

Hello, Thomas, Hello Linux.

0e334db6bb4b1fd1e2d72c1f3d8f004313cd9f94
posix-timers: Fix division by zero bug
Committed: 2018-12-17 17:35:45 +0100

With this patch in place I am seeing problems with glibc's function
timer_create.  I am an Emacs maintainer, and saw these problems whilst
investigating Emacs bug #34235 "27.0.50; lisp profiler does not work".
Full details of this bug are at
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34235.

Emacs's profiler fails in kernel 4.19.13, but works in a version of
4.19.13 with the patch reversed, otherwise unchanged.  My current version
of glibc is 2.27-r6 (I think the "-r6" comes from Gentoo, my distro).

The Emacs profiler works by a signal handler being repeatedly triggered
by the SIGPROF signal every 1 millisecond.  In the bug scenario, this
signal gets triggered precisely once each time the Emacs profiler is
started, rather than continually.

The core of the code in Emacs which initialises the glibc timer is:

      int i;
      struct sigevent sigev;
      sigev.sigev_value.sival_ptr = &profiler_timer;
      sigev.sigev_signo = SIGPROF;
      sigev.sigev_notify = SIGEV_SIGNAL;

      for (i = 0; i < ARRAYELTS (system_clock); i++)
        if (timer_create (system_clock[i], &sigev, &profiler_timer) == 0)
          {
            profiler_timer_ok = 1;
            break;
          }
    }

  if (profiler_timer_ok)
    {
      struct itimerspec ispec;
      ispec.it_value = ispec.it_interval = interval;
      if (timer_settime (profiler_timer, 0, &ispec, 0) == 0)
        return TIMER_SETTIME_RUNNING;
    }

The variable `interval' has been checked as non-zero.  This code is in
.../emacs/src/profiler.c

It seems either that the patch has uncovered some invalid call between
Emacs and glibc, or between glibc and Linux, or that there is some
intrinsic problem with the patch.

I have very little familiarity with glibc and Linux source code, so I
would be greatful if you could help me investigate the bug scenario.
Naturally, I will help as I can in this process.

Thanks in advance!

-- 
Alan Mackenzie (Nuremberg, Germany).





  parent reply	other threads:[~2019-02-01 21:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 18:34 bug#34235: 27.0.50; lisp profiler does not work Alex Branham
2019-01-29 16:06 ` Eli Zaretskii
2019-01-30 13:33   ` Alan Mackenzie
2019-01-30 15:40     ` Alex Branham
2019-01-30 16:15       ` Alan Mackenzie
2019-01-30 16:23         ` Alex Branham
2019-01-30 16:43           ` Eli Zaretskii
2019-01-30 20:47             ` Alex Branham
2019-01-30 16:41         ` Eli Zaretskii
2019-01-30 15:48     ` Eli Zaretskii
2019-02-01 21:47 ` Alan Mackenzie [this message]
2019-02-01 22:04   ` bug#34235: 0e334db6bb4b1fd1e2d72c1f3d8f004313cd9f94 (posix-timers: Fix division by zero bug). Problems with glibc Thomas Gleixner
     [not found]   ` <alpine.DEB.2.21.1902012301310.8200@nanos.tec.linutronix.de>
2019-02-02 10:44     ` Alan Mackenzie
     [not found]     ` <20190202104404.GA1067@ACM>
2019-02-04 17:25       ` Thomas Gleixner
     [not found]       ` <alpine.DEB.2.21.1902041724200.3006@nanos.tec.linutronix.de>
2019-02-05 13:54         ` Alan Mackenzie
2019-02-02  2:07 ` bug#34235: 0e334db6bb4b1fd1e2d72c1f3d8f004313cd9f94 (posix-timers: Fix, " Paul Eggert
2019-02-02  9:21   ` Thomas Gleixner
2019-02-02 14:02   ` Alex Branham
     [not found]   ` <alpine.DEB.2.21.1902021020020.8200@nanos.tec.linutronix.de>
2019-02-03  6:28     ` Paul Eggert

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/emacs/

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

  git send-email \
    --in-reply-to=20190201214700.GA4950@ACM \
    --to=acm@muc.de \
    --cc=34235@debbugs.gnu.org \
    --cc=alex.branham@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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.savannah.gnu.org/cgit/emacs.git

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