Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4558025imu; Tue, 29 Jan 2019 03:46:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN4u5u1l2KAKAyh5Bg+xbiTDiA5BwETRyOpqhjAV7tPH9ZgjFj3WmLL0AeCFlTLHSBpHNQOr X-Received: by 2002:a63:4819:: with SMTP id v25mr23164016pga.308.1548762391224; Tue, 29 Jan 2019 03:46:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548762391; cv=none; d=google.com; s=arc-20160816; b=Qna+Hp4dj70qDvsbvHEbDsBphNwlQNJOsx8wiIHwgVnpT9pMIyHu18fTJkJp3UEUtv APAJC0zv5+PXiwKITxprsxseOvLrUBAE7GKn3UMm/waQK0cLZ5TNQN/kt2k8HD3MHgSs 9tkEcrnVd7VboXj5m5X33uvKerQMLUU1xDh5bT8kUd1kqCWWUdXFuIVXvRh/S5P80klg nuZ/NTIPFf30RaKzIhiid7fTrllS/btmMT8gyWb3ooHmmdO5Us8mJ+o/q7jA729U24xW kOj9bBgpNCZNeQ1I63cBuU+so9XXAzchFefJxPVJlv7Jun2Mp32NGtEr7ysTWsynOZhv chlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H+68Zse6zJ30/DP5v0bm9uzN1EFvJZN1vwLMeq7LAP4=; b=L7kcaxEA1bU9/VeLlNasWDUa0nAuur0KXzWbPF9ERod3QbvSVY/8sSL945PMyALrQ5 o0ACxaDngHupJuxt6FQSffUvTTrHfq2sDFacxDCX5kyHYMf1jz/zfNaLs8EO+1pI+5HC 25GVo+VQlHSVdpRUPlhYaJ6rDORyXPnOZJwIKL2muwlRIAIGQT8Go5/VgeoHs+wFWyZC vf+Ac3giIp83s/MkMG92ZAj2CXucLQz7mJAMXk7kLS9iw+Ph61/Qzti7rDBinyiXhWvs 59xmCZstGGrw3nkerUX796jCKcORregJuamm1CiCwwixi4K1pXDNi95xHRbbYOjKPi9C Nxpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DJaVBNlw; 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 q5si31978672pgg.204.2019.01.29.03.46.15; Tue, 29 Jan 2019 03:46:31 -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; dkim=pass header.i=@kernel.org header.s=default header.b=DJaVBNlw; 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 S1730836AbfA2Lpr (ORCPT + 99 others); Tue, 29 Jan 2019 06:45:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:36242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730814AbfA2Lpp (ORCPT ); Tue, 29 Jan 2019 06:45:45 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0A2662086C; Tue, 29 Jan 2019 11:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548762344; bh=K1cWySP/nOG5nUcyXCvHk0wW/pV85vbinJXM9KwOnyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DJaVBNlwfvTZQk1ZFSdER162KRILh0llSID+HkkeRATVIn870dHJb/+dCS3Iz197X 7L2eRQDzKZLRbM/mrvzWbY9BEHu82IdaT6m17q8UzS2E2UhaaXAIRKmYGEx4UuvP0L bMh+K9qYrunfY4pkyYONJe7SLQEwByvI/tdFu7rY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "H.J. Lu" , Thomas Gleixner , John Stultz , Peter Zijlstra Subject: [PATCH 4.19 076/103] posix-cpu-timers: Unbreak timer rearming Date: Tue, 29 Jan 2019 12:35:53 +0100 Message-Id: <20190129113205.455382845@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129113159.567154026@linuxfoundation.org> References: <20190129113159.567154026@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner commit 93ad0fc088c5b4631f796c995bdd27a082ef33a6 upstream. The recent commit which prevented a division by 0 issue in the alarm timer code broke posix CPU timers as an unwanted side effect. The reason is that the common rearm code checks for timer->it_interval being 0 now. What went unnoticed is that the posix cpu timer setup does not initialize timer->it_interval as it stores the interval in CPU timer specific storage. The reason for the separate storage is historical as the posix CPU timers always had a 64bit nanoseconds representation internally while timer->it_interval is type ktime_t which used to be a modified timespec representation on 32bit machines. Instead of reverting the offending commit and fixing the alarmtimer issue in the alarmtimer code, store the interval in timer->it_interval at CPU timer setup time so the common code check works. This also repairs the existing inconistency of the posix CPU timer code which kept a single shot timer armed despite of the interval being 0. The separate storage can be removed in mainline, but that needs to be a separate commit as the current one has to be backported to stable kernels. Fixes: 0e334db6bb4b ("posix-timers: Fix division by zero bug") Reported-by: H.J. Lu Signed-off-by: Thomas Gleixner Cc: John Stultz Cc: Peter Zijlstra Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20190111133500.840117406@linutronix.de Signed-off-by: Greg Kroah-Hartman --- kernel/time/posix-cpu-timers.c | 1 + 1 file changed, 1 insertion(+) --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -685,6 +685,7 @@ static int posix_cpu_timer_set(struct k_ * set up the signal and overrun bookkeeping. */ timer->it.cpu.incr = timespec64_to_ns(&new->it_interval); + timer->it_interval = ns_to_ktime(timer->it.cpu.incr); /* * This acts as a modification timestamp for the timer,