Messages in this thread | | | Subject | Re: time: signed integer overflow in ktime_add_safe | From | Sasha Levin <> | Date | Fri, 4 Dec 2015 07:49:09 -0500 |
| |
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
| |