Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp963091ima; Fri, 1 Feb 2019 13:55:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN4DvbtXZW1J1iqSOHeLgl1BOwS5luH6KDJwaaR0cznawh0kNl6AteS+rbjY6iM93FOXmAFF X-Received: by 2002:a17:902:14e:: with SMTP id 72mr41645087plb.287.1549058133788; Fri, 01 Feb 2019 13:55:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549058133; cv=none; d=google.com; s=arc-20160816; b=vSddb1dSYE6fj2D7A0N1gmp3SgdwV/6SpMlw1Ya7hJJKLNp7oQBjtPWNiYq3zm/XYr Hv4BF4Z5p5NuonSoS4xHDXNZYj69mK+BuPbANlHENdUQsdrmbIaZveGvkGz6vxktPrTr VO248FcI+0PSzGT/wYH/qS6LoPkujQbDPrBIu3PkDhk8N5/ZFKLECRXqKfs2laBHyADO 9YOQeZUzpSBg19Sm4pNpcfWUnXiteJkF/j+5FDoIoB+P1AjVvqXG8BB6y3rR2ytagcL2 Wg5cKKzm5USWXVbethHsdN3hUlE/J9oitU6H2VLSxanNVZjvU1glhcB+yKw61tbPdpt1 eKYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:from:user-agent:content-disposition :mime-version:message-id:subject:cc:to:date; bh=++w46FEFaJGFSATFPWm78/3r7HwcKCrHd9UG1elONuA=; b=s2zS2M+n7XZ+Lz25ye2dmfMq0+ax5jSwVup95vkU6AHMeLaFYFnki6XrAK5+l/IQZg QSfccrg/zWTDqGahNqv7ruuWiPml4TXZV8xrPdPRUv0aoc5NiFniBew6tp2yLXE/t50q xb2OLwx+/qsq+HPWN77QwpfiVPvfWtCygOY6kPHF28VHWCaLujQK7PBEb9nFT2pleBjB 1SackAUGWhgwWF5UtBzdd96SU+rcfZXwZRPB9V7n5MV89rtRLA+7CYpHOKEwfAsluGmZ 8529RoH3U5b88dtUrMMCNhEuEJq/wcZxJOT4wcl6qv8lAbDzqN6lmf+2PDdwBXfw6uW3 7oCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f34si8643139ple.280.2019.02.01.13.55.18; Fri, 01 Feb 2019 13:55:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726637AbfBAVzG (ORCPT + 99 others); Fri, 1 Feb 2019 16:55:06 -0500 Received: from colin.muc.de ([193.149.48.1]:63785 "HELO mail.muc.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with SMTP id S1726116AbfBAVzF (ORCPT ); Fri, 1 Feb 2019 16:55:05 -0500 X-Greylist: delayed 400 seconds by postgrey-1.27 at vger.kernel.org; Fri, 01 Feb 2019 16:55:05 EST Received: (qmail 43792 invoked by uid 3782); 1 Feb 2019 21:48:23 -0000 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 Received: (qmail 5451 invoked by uid 1000); 1 Feb 2019 21:47:00 -0000 Date: Fri, 1 Feb 2019 21:47:00 +0000 To: Thomas Gleixner , linux-kernel@vger.kernel.org Cc: 34235@debbugs.gnu.org, Eli Zaretskii , Alex Branham Subject: 0e334db6bb4b1fd1e2d72c1f3d8f004313cd9f94 (posix-timers: Fix division by zero bug). Problems with glibc. Message-ID: <20190201214700.GA4950@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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).