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=-7.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 13CCFC433E0 for ; Thu, 7 Jan 2021 00:07:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBA6323332 for ; Thu, 7 Jan 2021 00:07:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727771AbhAGAHu (ORCPT ); Wed, 6 Jan 2021 19:07:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbhAGAHu (ORCPT ); Wed, 6 Jan 2021 19:07:50 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07D70C06136B for ; Wed, 6 Jan 2021 16:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=1QZxiN2Y8LEelG7OpYOldYUkGlfcW+4VFUmTA5CQW+c=; b=XK/J1qNFzLJxho9wHgBcVIyrJr qIXGdrmGZWYJSw6/YqYmrGDdvkSMoNyVmoG8DiOnOTDFvcb5YIrGvMdLqb/70a0QFOu0H2M5/OoLh DHtl9liIWd4xLDKLIhu77cklm1aJRpHLx0NlmQ5TqDJlgpCbdHMzJf9RoAMXPPwKaL4195HHDi1bQ emzwiWqJv6pdrN7bK9zeRG1Wj9zuyqGVbNymOW+ECbL+2PHQRBwOdUiWgOp6dmlcolFoeEVN7pozV pTDs+gXxSJ5I1z8qTpQxCwh5e0kNLMxDEf1h4nPl/Jom4eQxQRLN+5wLDlf/2LYsYFT/IqCJ5f2vb iQ7dGFiA==; Received: from [2601:1c0:6280:3f0::79df] by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxIpU-000816-69; Thu, 07 Jan 2021 00:07:04 +0000 Subject: Re: [PATCH] mm/uaccess: Use 'unsigned long' to placate UBSAN warnings, again To: Kees Cook , Peter Zijlstra Cc: Josh Poimboeuf , Alexander Viro , linux-kernel@vger.kernel.org, aryabinin@virtuozzo.com, dvyukov@google.com References: <590998aa9cc50f431343f76cae72b2abf8ac1fdd.1608699683.git.jpoimboe@redhat.com> <20210104151317.GR3021@hirez.programming.kicks-ass.net> <202101061536.C4A93132@keescook> From: Randy Dunlap Message-ID: Date: Wed, 6 Jan 2021 16:06:57 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <202101061536.C4A93132@keescook> 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/6/21 3:37 PM, Kees Cook 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+ ? > > I would be totally fine with that. The only thing I can think of that > might care is syzbot. Dmitry, does syzbot use anything older than gcc 8? I use UBSAN successfully with GCC 7.5.0. However, I can revert whatever future patch someone adds for this... -- ~Randy