Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp180779pxb; Thu, 14 Jan 2021 03:12:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzamV7HQdeBd160EHq/X+ameA4OG57c9oVHuzFdHxB3zR4fdC5EHBDUZimdGVpzEsOK2bSc X-Received: by 2002:a05:6402:b79:: with SMTP id cb25mr5247440edb.346.1610622741082; Thu, 14 Jan 2021 03:12:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610622741; cv=none; d=google.com; s=arc-20160816; b=pSCqCMSZ2MTB4+5mX+eq9PmXTCJPovYEGzOYCgXkjUKwNvjyXhCqkNzc0jW7eGDWYm O6Tg8p3BEghM5L0AGb75AADcIB4c9YrEiEz8YNgExHCq+1OABRp+7IYodDyWc/WSaG0s LeBDQIoTd+5OwuXQ5AVWh1HgZTvJ5Gs882KJdwN4v752R5668pN8gqWdzPngrhSeyDB1 xD6FSOvRZs/nmdVFayQNIyStpe3bacFi2DAn5QNT9G/GILnrVCYpEAPidk/LJY0pyfFX C+1Y5rIsKirLnCrzE3Vo4sStScBtYR5GzCXoPD08YbJpys14f5O2ik7/iZU2m03Nu4MJ Tjbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=S7nUfDoXbOPpvixWjAIjjJHR2dPLAPKksJl0KfjX9mo=; b=kF8BA0RXCSRIjARYc7MRqiPkjTVVmMkWZgG4kTEOkcuHlJk/NzXrwletxZTQrVZK1j 3ccG6tdoPgUm82MA6pfbZaVKWchfh3GweW9SLRUf7MbIT/8oPVTaluJdui48goVuA6gD fIcgY+aNwjxMA7Lk29HpzjT6vDKQAeAWjk+3idIv3KXjohRJCp2Kw5GKqSvwCxVt8NnS BucB7kr8UxJGEhfHJRfLUBsmjEkTRpl04/gTvuUxC524uF02ehVEJX2fjEXajy8lLVTc y2wKarRA9bdXVp2YMh++rJHM9yritrh24wuFsJA3w7livJ1JLaFXG9/Up0Xd0tAC25gt me6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oi22si2554268ejb.631.2021.01.14.03.11.56; Thu, 14 Jan 2021 03:12:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726259AbhANLKl (ORCPT + 99 others); Thu, 14 Jan 2021 06:10:41 -0500 Received: from relay.sw.ru ([185.231.240.75]:57388 "EHLO relay3.sw.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726008AbhANLKl (ORCPT ); Thu, 14 Jan 2021 06:10:41 -0500 Received: from [192.168.15.122] by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1l00UX-00GZr9-GL; Thu, 14 Jan 2021 14:08:37 +0300 Subject: Re: [PATCH] ubsan: Require GCC-8+ or Clang to use UBSAN To: Peter Zijlstra , Josh Poimboeuf Cc: Alexander Viro , linux-kernel@vger.kernel.org, Randy Dunlap , dvyukov@google.com, keescook@chromium.org References: <590998aa9cc50f431343f76cae72b2abf8ac1fdd.1608699683.git.jpoimboe@redhat.com> <20210104151317.GR3021@hirez.programming.kicks-ass.net> From: Andrey Ryabinin Message-ID: Date: Thu, 14 Jan 2021 14:09:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/14/21 1:59 PM, Peter Zijlstra wrote: > On Mon, Jan 04, 2021 at 04:13:17PM +0100, Peter Zijlstra wrote: >> On Tue, Dec 22, 2020 at 11:04:54PM -0600, Josh Poimboeuf wrote: >>> GCC 7 has a known bug where UBSAN ignores '-fwrapv' and generates false >>> signed-overflow-UB warnings. The type mismatch between 'i' and >>> 'nr_segs' in copy_compat_iovec_from_user() is causing such a warning, >>> which also happens to violate uaccess rules: >>> >>> lib/iov_iter.o: warning: objtool: iovec_from_user()+0x22d: call to __ubsan_handle_add_overflow() with UACCESS enabled >>> >>> Fix it by making the variable types match. >>> >>> This is similar to a previous commit: >>> >>> 29da93fea3ea ("mm/uaccess: Use 'unsigned long' to placate UBSAN warnings on older GCC versions") >> >> Maybe it's time we make UBSAN builds depend on GCC-8+ ? > > --- > Subject: ubsan: Require GCC-8+ or Clang to use UBSAN > > Just like how we require GCC-8.2 for KASAN due to compiler bugs, require > a sane version of GCC for UBSAN. > > Specifically, before GCC-8 UBSAN doesn't respect -fwrapv and thinks > signed arithmetic is buggered. > Actually removing CONFIG_UBSAN_SIGNED_OVERFLOW would give us the same effect without restricting GCC versions.