From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs,gmane.linux.kernel Subject: bug#34235: 0e334db6bb4b1fd1e2d72c1f3d8f004313cd9f94 (posix-timers: Fix division by zero bug). Problems with glibc. Date: Fri, 1 Feb 2019 21:47:00 +0000 Message-ID: <20190201214700.GA4950@ACM> References: <87o9807ht0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="49935"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Alex Branham , 34235@debbugs.gnu.org To: Thomas Gleixner , linux-kernel@vger.kernel.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 01 22:49:21 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpgga-000Cjf-0k for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Feb 2019 22:49:20 +0100 Original-Received: from localhost ([127.0.0.1]:33771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpggT-00057e-Tz for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Feb 2019 16:49:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpggN-00056q-P6 for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2019 16:49:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gpggL-0003OY-7D for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2019 16:49:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56041) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gpggI-0003KP-1h for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2019 16:49:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gpggH-00046k-PS for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2019 16:49:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87o9807ht0.fsf@gmail.com> Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Feb 2019 21:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34235 X-GNU-PR-Package: emacs Original-Received: via spool by 34235-submit@debbugs.gnu.org id=B34235.154905771015737 (code B ref 34235); Fri, 01 Feb 2019 21:49:01 +0000 Original-Received: (at 34235) by debbugs.gnu.org; 1 Feb 2019 21:48:30 +0000 Original-Received: from localhost ([127.0.0.1]:55322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gpgfl-00045l-S1 for submit@debbugs.gnu.org; Fri, 01 Feb 2019 16:48:30 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:19126 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1gpgfj-00045b-QP for 34235@debbugs.gnu.org; Fri, 01 Feb 2019 16:48:28 -0500 Original-Received: (qmail 43782 invoked by uid 3782); 1 Feb 2019 21:48:23 -0000 Original-Received: from acm.muc.de (p4FE15ED8.dip0.t-ipconnect.de [79.225.94.216]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 01 Feb 2019 22:48:21 +0100 Original-Received: (qmail 5451 invoked by uid 1000); 1 Feb 2019 21:47:00 -0000 Content-Disposition: inline X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154987 gmane.linux.kernel:2997015 Archived-At: 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).