Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752575AbbLDMtm (ORCPT ); Fri, 4 Dec 2015 07:49:42 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:41181 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750899AbbLDMtk (ORCPT ); Fri, 4 Dec 2015 07:49:40 -0500 Subject: Re: time: signed integer overflow in ktime_add_safe To: Dmitry Vyukov , Andrey Ryabinin References: <566179D1.2050107@gmail.com> <56617CB7.8050909@gmail.com> Cc: Hannes Frederic Sowa , Thomas Gleixner , LKML , syzkaller , Kostya Serebryany , Alexander Potapenko , Eric Dumazet , Linus Torvalds From: Sasha Levin Message-ID: <56618BC5.6020400@oracle.com> Date: Fri, 4 Dec 2015 07:49:09 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1169 Lines: 27 On 12/04/2015 06:49 AM, Dmitry Vyukov wrote: >> I'm not so sure. It finds real bugs, e.g. 32a8df4e0b33f ("sched: Fix odd values in effective_load() calculations") >> > was caught by UBSAN >> > I guess that we could fix most signed overflows simply by casting to unsigned type. > > Yeah, overflows can be just unexpected in some places (not an intended > reliance on defined overflow). If we want to continue finding real > bugs, we need to start fixing the false positives. Right, this check finds real bugs, but quite a few false positives because we tell gcc specifically that this overflow is really okay, and people have relied on that. On the other hand, we can't "fix" the code that's triggering it since nothing is actually broken - in ktime_add_safe() for example we'd overflow, but then we're checking for overflow, so the code is perfectly fine. Maybe UBSAN annotations are the way to go here? Thanks, Sasha -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/