Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1378874imd; Thu, 1 Nov 2018 14:48:01 -0700 (PDT) X-Google-Smtp-Source: AJdET5eIjTExHK1l3zXl7WHpBeF2tcamEVIsn/GVYUF69OPBDhBVYDQ8whDFB3Ykgy95CeUJi+cF X-Received: by 2002:a63:2447:: with SMTP id k68-v6mr8471060pgk.156.1541108881568; Thu, 01 Nov 2018 14:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541108881; cv=none; d=google.com; s=arc-20160816; b=ZmAL/JC99ZvjMog/vkhmhT71jHBFc2s1PKpqiEG26UYYJGtOuasFKywhF1SNkQ+LV2 BHFeNkjvUBMKFYi7ItrtfAIvh88o+O3xKkWRW174wyOoInwk1QJj5sSLXZPHmXv3gbBA HMvVOI9RjCjqux8ZNhH2HXGYzN3VkNucDTcy99Ow4G520l5GRrjhNPgzYUZ4CJIIT4zJ POa/RvYxNUWG6TBWTpVfmbfuEcbvEv278umKTZ3lKnQ2rUkVj1bL+k9+RfSlsRCbtJng I1zNYIcln5SWMG/2ur4Zg/t0Ssd8kVXKFu9opw31hCP66TboMx3nu9rfbR3zcip50Voj TUCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MEJyokPYI7oa2A6Ix9ONUmGbnct/Kvmgb/sJnQOStxc=; b=TYLiHRdW88CP2YweclKztdxAEBG/hhbYlxuU4iAVcbjBi9aoa1r7jG2ZRwQxPb4Y5m aiAx+l1q1XdsxEEZ7+SVvlXgdOgnQe9INfFIQc7BB/oXaKRUNaSG6uAgr7wXZ3cpNHy5 0WnfklQ5ax9qRv53DN1CZEIUyxRkRiZvyFRnuMqTKV2SsxJhpQbv4C1xGMr3W8dTxGmo FaMsxzEsrzoq/+SD6WOnaZbb0rhivr3+wlnLBPlUM0ksYyz7/Ks4n1KGBfD+qNuvHJ4O CY6rJ+MqUYR94iQEWkeISvtHyojeEBHHnV2ezbuVxNQXjVxLrkKSgMZHdLlBx+RcriY4 ZiIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ls+xdu4o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o22-v6si28372651pfi.279.2018.11.01.14.47.47; Thu, 01 Nov 2018 14:48:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ls+xdu4o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727830AbeKBGuq (ORCPT + 99 others); Fri, 2 Nov 2018 02:50:46 -0400 Received: from merlin.infradead.org ([205.233.59.134]:57064 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727151AbeKBGuq (ORCPT ); Fri, 2 Nov 2018 02:50:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MEJyokPYI7oa2A6Ix9ONUmGbnct/Kvmgb/sJnQOStxc=; b=ls+xdu4ozQ7c4yvsm9ovqZ/4f fiFuSHac7Q2elKhmdle5qz3kdC0phtzafFsg4Fo2K2xfxrjjRsDtWE8XnThq8D8sZp3qGvjfpHNYJ KPaE2XjSwPvKGaCuIvf0YpWpc37Hen7TUH95ZQP0r4vzo5jp+Nq2MzUx1YnyYOG061j3OHyzTmnlr s4Jw3VZyfp0csnbleNLXSg2xp268RVktS0DawCGK+9p+MdaTrMQynXvZgyztm7d70YjSIr84TKOug 92DT3I1mDBUZhew+WI6z8TpS90qReNeQaT3Sba2tf1zJwoV+RlbOUgr7lAc/5xwwbeYpK4YRYEmbD 9zqkC8MRw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gIKmR-00079A-Uh; Thu, 01 Nov 2018 21:45:32 +0000 Received: by worktop (Postfix, from userid 1000) id 4A4CE6E07D9; Thu, 1 Nov 2018 22:45:29 +0100 (CET) Date: Thu, 1 Nov 2018 22:45:29 +0100 From: Peter Zijlstra To: Dmitry Vyukov Cc: "Paul E. McKenney" , Trond Myklebust , "mark.rutland@arm.com" , "linux-kernel@vger.kernel.org" , "ralf@linux-mips.org" , "jlayton@kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "bfields@fieldses.org" , "linux-mips@linux-mips.org" , "linux@roeck-us.net" , "linux-nfs@vger.kernel.org" , "akpm@linux-foundation.org" , "will.deacon@arm.com" , "boqun.feng@gmail.com" , "paul.burton@mips.com" , "anna.schumaker@netapp.com" , "jhogan@kernel.org" , "netdev@vger.kernel.org" , "davem@davemloft.net" , "arnd@arndb.de" , "paulus@samba.org" , "mpe@ellerman.id.au" , "benh@kernel.crashing.org" , Andrey Ryabinin Subject: Re: [RFC PATCH] lib: Introduce generic __cmpxchg_u64() and use it where needed Message-ID: <20181101214529.GB3339@worktop.programming.kicks-ass.net> References: <20181031220253.GA15505@roeck-us.net> <20181031233235.qbedw3pinxcuk7me@pburton-laptop> <4e2438a23d2edf03368950a72ec058d1d299c32e.camel@hammerspace.com> <20181101131846.biyilr2msonljmij@lakrids.cambridge.arm.com> <20181101145926.GE3178@hirez.programming.kicks-ass.net> <20181101163212.GF3159@hirez.programming.kicks-ass.net> <20181101170146.GQ4170@linux.ibm.com> <20181101171846.GI3178@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.