[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181101214529.GB3339@worktop.programming.kicks-ass.net>
Date: Thu, 1 Nov 2018 22:45:29 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: "Paul E. McKenney" <paulmck@...ux.ibm.com>,
Trond Myklebust <trondmy@...merspace.com>,
"mark.rutland@....com" <mark.rutland@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"ralf@...ux-mips.org" <ralf@...ux-mips.org>,
"jlayton@...nel.org" <jlayton@...nel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"bfields@...ldses.org" <bfields@...ldses.org>,
"linux-mips@...ux-mips.org" <linux-mips@...ux-mips.org>,
"linux@...ck-us.net" <linux@...ck-us.net>,
"linux-nfs@...r.kernel.org" <linux-nfs@...r.kernel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"will.deacon@....com" <will.deacon@....com>,
"boqun.feng@...il.com" <boqun.feng@...il.com>,
"paul.burton@...s.com" <paul.burton@...s.com>,
"anna.schumaker@...app.com" <anna.schumaker@...app.com>,
"jhogan@...nel.org" <jhogan@...nel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"arnd@...db.de" <arnd@...db.de>,
"paulus@...ba.org" <paulus@...ba.org>,
"mpe@...erman.id.au" <mpe@...erman.id.au>,
"benh@...nel.crashing.org" <benh@...nel.crashing.org>,
Andrey Ryabinin <aryabinin@...tuozzo.com>
Subject: Re: [RFC PATCH] lib: Introduce generic __cmpxchg_u64() and use it
where needed
On Thu, Nov 01, 2018 at 06:46:50PM +0100, Dmitry Vyukov wrote:
> If there is a warning that we don't want to see at all, then we can
> disable it. It supposed to be a useful tool, rather than a thing in
> itself that lives own life. We already I think removed 1 particularly
> noisy warning and made another optional via a config.
> But the thing with overflows is that, even if it's defined, it's not
> necessary the intended behavior. For example, take allocation size
> calculation done via unsigned size_t. If it overflows it does not help
> if C defines result or not, it still gives a user controlled write
> primitive. We've seen similar cases with timeout/deadline calculation
> in kernel, we really don't want it to just wrap modulo-2, right. Some
> user-space projects even test with unsigned overflow warnings or
> implicit truncation warnings, which are formally legal, but frequently
> bugs.
Sure; but then don't call it UB.
If we want to have an additional integer over/underflow checker (ideally
with a gcc plugin that has explicit annotations like __wrap to make it
go away) that is fine; and it can be done on unsigned and signed.
Powered by blists - more mailing lists