Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp238400pxb; Sat, 11 Sep 2021 03:45:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGt58LM0kK+GLvmyBjwOa/AhGV8sGlBCrAFqDiqx6Gp16TN1DNWgOtB71lVrpYQkBAiuop X-Received: by 2002:a17:907:9723:: with SMTP id jg35mr2238069ejc.187.1631357145647; Sat, 11 Sep 2021 03:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631357145; cv=none; d=google.com; s=arc-20160816; b=U9+BfzyEZXlyOsnBbgMxtAwxiAWCGyxq1ouU9UzYj76uvGJMFkx3NdjPYltIpyvwXx 01SfS6xOpJQ5VuYkpka1E4jNqDTzcEj/d8/LnkSPfEMFtR9mgyUDYw//uhKo83f/L2y9 QNEhRmTq4WCRdHhGjr6AzreFnah1N14hkhAgp1aQbpge1CyyV5QmZaV4JIZ58eAizkto qB+jV+nNVjML8sMDMeY8IseuO2YHh/fBYBDXYF8xs9KiSZ/YY9PNjTRiFF9YiykMDNAD psPYR2bsPUFd1sLeGYUcpVMsyAjYn4b/d4pBdUUjvGMr1L8ou+KN+ii6813UciX4/U5Y j54Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=ExdD//zcgrodB2nrIV/KTQK4Gb50UScEXZVTgad6v/4=; b=Q63pIfqznIyCafeQjkuABD/J7ASZbH1VBk3s3Ij/B9T6N7nNczi0qS3NZTJa9PoWi+ tl3bUj/EKKQwhBbUMmKPIStmTNXCNu/r1Nk2a/O0OlvK4tDUoXZ15WOBY4YabkV+wAwS yVRcBya7IboEE1MLmP/eP0LFB+oWTpfo1rDJI4R9P9dyXsA1RI3GchWH+CAX/8fSGP4s 2aX6WNESaAUlkEYExY0GreK4u4llNpAb1zeb3D30MIC8h9ZVP2jFb2iYenqH4DPJqdxF DyPDNKlsrvrKxlfXjosQ2ml/XwZeimtnFn3GqWofVxl0dPRHAAbp2f5z6bunEbVrVOzd l4ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=ioe1x8uO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p22si1393967edx.454.2021.09.11.03.45.21; Sat, 11 Sep 2021 03:45:45 -0700 (PDT) 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; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=ioe1x8uO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235659AbhIKKoM (ORCPT + 99 others); Sat, 11 Sep 2021 06:44:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235443AbhIKKoL (ORCPT ); Sat, 11 Sep 2021 06:44:11 -0400 Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 565FFC061574 for ; Sat, 11 Sep 2021 03:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1631356975; bh=ExdD//zcgrodB2nrIV/KTQK4Gb50UScEXZVTgad6v/4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ioe1x8uO/2B8IYF6K1rTcBPWXLQBlAeM9QmH6xaRSjWXuHJQ2DySUrfS7WiBwOLOM Pgz7y5Ss8RX/px06Dy2CLLVcmX7NjXjpXeJBYYddxUboKFvCghkZkKJ3eIpyq+vaIU 2XfBmZ7yBjbD487jA+hS9gky4w1awB5BTo7BsQutZ2ychG4BJSVqliQQ9Pistc43od 6zajpCy1cuHtXZWS9uBxpBLiCfu560IbMlB1AT7rj0ISwliUtIkHnYA2/t2+gV4IDZ Rrdya6r05/L+NpaUAcyDHwSr0e6zqAePE4Nyvc0m7t8MrI9TXg+5NkZSAALDRCwKbM WVMQVQlPdiDww== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4H68TT0mbkz9sVq; Sat, 11 Sep 2021 20:42:52 +1000 (AEST) From: Michael Ellerman To: Kees Cook , Nick Desaulniers Cc: Andrew Morton , Linus Torvalds , Rasmus Villemoes , Nathan Chancellor , Masahiro Yamada , Joe Perches , Arnd Bergmann , Stephen Rothwell , llvm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 00/10] raise minimum GCC version to 5.1 In-Reply-To: <202109101917.5BA95B87E0@keescook> References: <20210910234047.1019925-1-ndesaulniers@google.com> <202109101917.5BA95B87E0@keescook> Date: Sat, 11 Sep 2021 20:42:49 +1000 Message-ID: <8735qbmlzq.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kees Cook writes: > On Fri, Sep 10, 2021 at 04:40:37PM -0700, Nick Desaulniers wrote: >> commit fad7cd3310db ("nbd: add the check to prevent overflow in >> __nbd_ioctl()") >>=20 >> raised an issue from the fallback helpers added in >>=20 >> commit f0907827a8a9 ("compiler.h: enable builtin overflow checkers and a= dd fallback code") >>=20 >> Specifically, the helpers for checking whether the results of a >> multiplication overflowed (__unsigned_mul_overflow, >> __signed_add_overflow) use the division operator when >> !COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW. This is problematic for 64b >> operands on 32b hosts. >>=20 >> Also, because the macro is type agnostic, it is very difficult to write >> a similarly type generic macro that dispatches to one of: >> * div64_s64 >> * div64_u64 >> * div_s64 >> * div_u64 > > Given that it's all compile-time type-aware goo, this isn't so bad. The > gist[1] you linked off the bug report is pretty close. Needs some > bikeshedding. ;) > >> Raising the minimum supported versions allows us to remove all of the >> fallback helpers for !COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW, instead >> dispatching the compiler builtins. >>=20 >> arm64 has already raised the minimum supported GCC version to 5.1, do >> this for all targets now. See the link below for the previous >> discussion. > > That said, I'd much prefer raising the minimum GCC -- no one appears > to actually be building on 4.9 -- there are close to 200 errors (ne=C3=A9 > warnings) on x86_64 allmodconfig there currently. I still do 4.9 builds on kisskb, but I agree there are a lot of warnings, and no one ever has time to fix any. cheers