From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85458C433E0 for ; Thu, 14 Jan 2021 11:10:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D8B7238A1 for ; Thu, 14 Jan 2021 11:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbhANLKm (ORCPT ); Thu, 14 Jan 2021 06:10:42 -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.