From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.99]:42688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726595AbeKIBWb (ORCPT ); Thu, 8 Nov 2018 20:22:31 -0500 Date: Thu, 8 Nov 2018 10:46:25 -0500 From: Sasha Levin To: Thomas Gleixner Cc: Florian Fainelli , linux-kernel@vger.kernel.org, John Stultz , stable@vger.kernel.org, gregkh@linuxfoundation.org, Peter Zijlstra , Michael Kerrisk Subject: Re: [PATCH stable 4.9] posix-timers: Sanitize overrun handling Message-ID: <20181108154625.GC8097@sasha-vm> References: <1541102558-14839-1-git-send-email-f.fainelli@gmail.com> <6341cf9e-b2aa-9447-88e9-ad89ab42a641@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: On Thu, Nov 08, 2018 at 07:48:16AM +0100, Thomas Gleixner wrote: >Florian, > >On Wed, 7 Nov 2018, Florian Fainelli wrote: >> On 11/1/18 1:02 PM, Florian Fainelli wrote: >> > From: Thomas Gleixner >> > >> > [ Upstream commit 78c9c4dfbf8c04883941445a195276bb4bb92c76 ] >> > >> > The posix timer overrun handling is broken because the forwarding functions >> > can return a huge number of overruns which does not fit in an int. As a >> > consequence timer_getoverrun(2) and siginfo::si_overrun can turn into >> > random number generators. >> > >> > The k_clock::timer_forward() callbacks return a 64 bit value now. Make >> > k_itimer::ti_overrun[_last] 64bit as well, so the kernel internal >> > accounting is correct. 3Remove the temporary (int) casts. >> > >> > Add a helper function which clamps the overrun value returned to user space >> > via timer_getoverrun(2) or siginfo::si_overrun limited to a positive value >> > between 0 and INT_MAX. INT_MAX is an indicator for user space that the >> > overrun value has been clamped. >> > >> > Reported-by: Team OWL337 >> > Signed-off-by: Thomas Gleixner >> > Acked-by: John Stultz >> > Cc: Peter Zijlstra >> > Cc: Michael Kerrisk >> > Link: https://lkml.kernel.org/r/20180626132705.018623573@linutronix.de >> > [florian: Make patch apply to v4.9.135] >> > Signed-off-by: Florian Fainelli >> > --- >> > Thomas, can you review for correctness? Thanks! >> >> Thomas, John, does that look like a reasonable backport for 4.9? > >Looks correct. Queued for 4.9, thanks all. -- Thanks, Sasha