[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZLFFGLQ6H/9RCaVf@casper.infradead.org>
Date: Fri, 14 Jul 2023 13:52:40 +0100
From: Matthew Wilcox <willy@...radead.org>
To: linke li <lilinke99@...il.com>
Cc: David Hildenbrand <david@...hat.com>,
Linke Li <lilinke99@...mail.com>, linux-mm@...ck.org,
llvm@...ts.linux.dev, linux-kernel@...r.kernel.org,
trix@...hat.com, ndesaulniers@...gle.com, nathan@...nel.org,
muchun.song@...ux.dev, mike.kravetz@...cle.com
Subject: Re: [PATCH] hugetlbfs: Fix integer overflow check in
hugetlbfs_file_mmap()
On Thu, Jul 13, 2023 at 03:55:55PM +0800, linke li wrote:
> > So we're adding code to handle eventual future compiler bugs? That sounds
> > wrong, but maybe I misunderstood the problem you are trying to solve?
>
> Sorry for not making it clear. My focus is the presence of undefined
> behavior in kernel code.
> Compilers can generate any code for undefined behavior and compiler
> developers will not
> take this as compiler bugs. In my option, kernel should not have
> undefined behavior.
The point that several people have tried to make to you is that
*this is not undefined behaviour*. The kernel is compiled with
-fno-strict-overflow which causes the compiler to define signed arithmetic
overflow to behave as twos-complement. Check the gcc documentation.
Powered by blists - more mailing lists