From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3056D70 for ; Tue, 27 Jul 2021 21:47:25 +0000 (UTC) Received: by mail-pl1-f173.google.com with SMTP id d17so110982plh.10 for ; Tue, 27 Jul 2021 14:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RmWu5L4XF1JSf6SMuIfCAjF4w7lZ2j3Pm51HCxVaooA=; b=kT5nbH7QT643iQGqVSJxPNGwwBlfdxw5cCyQX6gaBzOcqz4ajIPGMOczsYHolmn62d eW8ICZNFrJ1d3HiFUcApnGkXgvWlWnUUGLsdAOvKSLOBSwaj/BB+s0Fa9Bal55XOCrIt E/hihwg5GtX2PF8wCIvqM4CT8+GGunjYl5M0k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RmWu5L4XF1JSf6SMuIfCAjF4w7lZ2j3Pm51HCxVaooA=; b=gB2Ji5rfOdenA5vrCsN3WjQvCilAcHES6YxnL/Sy2DmfashMkm5EmmPdQ66G4zk1TA Hgd/1AWRpLBtaj18Pzvss+cOCfd7/QuqzN4QC68nRihx1+OV/OZ2zW7JyXBnUNLIAqmG 5uMihYFryxilLXjU7PaGQXSV5W0UY5Q7rYoMzokxP5fAKfUPKHSlo76ondcsdgNA91mB 8IP55/27bhvLVYIG9eNxfWTfOFNvQx4iLN6v+FFMqdE+ue+15RC7lvu0omFNFne0KEf7 XuZY+529H3VXpO28NsRoFOZ8lX6CVqYSslIH4fjb3Jeax/50FjldOMsQEBvAtSE54YVW MLiA== X-Gm-Message-State: AOAM533BpcG7TrIIr1eYXPXhH435yao4sy60bloWxB/f1d7xcNJTeYOH rwHBlJYwQqyb7ce7b7utRzS9Tw== X-Google-Smtp-Source: ABdhPJwYpkbqYJB6T9w906hSU82h1v3vr+z3zO2Lp7j72zPJyvd83IHc+CMakx8xlv5Jq50O8i9yVw== X-Received: by 2002:a17:902:a513:b029:11a:9be6:f1b9 with SMTP id s19-20020a170902a513b029011a9be6f1b9mr20025348plq.55.1627422444596; Tue, 27 Jul 2021 14:47:24 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id t37sm4805774pfg.14.2021.07.27.14.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 14:47:23 -0700 (PDT) Date: Tue, 27 Jul 2021 14:47:22 -0700 From: Kees Cook To: Nathan Chancellor Cc: linux-hardening@vger.kernel.org, "Gustavo A. R. Silva" , Keith Packard , Greg Kroah-Hartman , Andrew Morton , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-block@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH 31/64] fortify: Explicitly disable Clang support Message-ID: <202107271434.039A9777@keescook> References: <20210727205855.411487-1-keescook@chromium.org> <20210727205855.411487-32-keescook@chromium.org> Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Jul 27, 2021 at 02:18:58PM -0700, Nathan Chancellor wrote: > On 7/27/2021 1:58 PM, Kees Cook wrote: > > Clang has never correctly compiled the FORTIFY_SOURCE defenses due to > > a couple bugs: > > > > Eliding inlines with matching __builtin_* names > > https://bugs.llvm.org/show_bug.cgi?id=50322 > > > > Incorrect __builtin_constant_p() of some globals > > https://bugs.llvm.org/show_bug.cgi?id=41459 > > > > In the process of making improvements to the FORTIFY_SOURCE defenses, the > > first (silent) bug (coincidentally) becomes worked around, but exposes > > the latter which breaks the build. As such, Clang must not be used with > > CONFIG_FORTIFY_SOURCE until at least latter bug is fixed (in Clang 13), > > and the fortify routines have been rearranged. > > > > Update the Kconfig to reflect the reality of the current situation. > > > > Signed-off-by: Kees Cook > > --- > > security/Kconfig | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/security/Kconfig b/security/Kconfig > > index 0ced7fd33e4d..8f0e675e70a4 100644 > > --- a/security/Kconfig > > +++ b/security/Kconfig > > @@ -191,6 +191,9 @@ config HARDENED_USERCOPY_PAGESPAN > > config FORTIFY_SOURCE > > bool "Harden common str/mem functions against buffer overflows" > > depends on ARCH_HAS_FORTIFY_SOURCE > > + # https://bugs.llvm.org/show_bug.cgi?id=50322 > > + # https://bugs.llvm.org/show_bug.cgi?id=41459 > > + depends on !CONFIG_CC_IS_CLANG > > Should be !CC_IS_CLANG, Kconfig is hard :) /me shakes fist at sky Thank you! Fixed locally. :) -Kees > > > help > > Detect overflows of buffers in common string and memory functions > > where the compiler can determine and validate the buffer sizes. > > > > Cheers, > Nathan -- Kees Cook 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=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 BC22EC432BE for ; Tue, 27 Jul 2021 21:47:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8CC2560F91 for ; Tue, 27 Jul 2021 21:47:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8CC2560F91 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A2C86EACA; Tue, 27 Jul 2021 21:47:27 +0000 (UTC) Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by gabe.freedesktop.org (Postfix) with ESMTPS id 19AE66EACA for ; Tue, 27 Jul 2021 21:47:25 +0000 (UTC) Received: by mail-pl1-x632.google.com with SMTP id i1so117685plr.9 for ; Tue, 27 Jul 2021 14:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RmWu5L4XF1JSf6SMuIfCAjF4w7lZ2j3Pm51HCxVaooA=; b=kT5nbH7QT643iQGqVSJxPNGwwBlfdxw5cCyQX6gaBzOcqz4ajIPGMOczsYHolmn62d eW8ICZNFrJ1d3HiFUcApnGkXgvWlWnUUGLsdAOvKSLOBSwaj/BB+s0Fa9Bal55XOCrIt E/hihwg5GtX2PF8wCIvqM4CT8+GGunjYl5M0k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RmWu5L4XF1JSf6SMuIfCAjF4w7lZ2j3Pm51HCxVaooA=; b=dXghBijDLWS/PzVq9NO9XJtdh/Do3VjNMt2tpxFzRxeNa9RoVYkkvhN95w4JqGCdlK PiPj/dCC74phjehmaaEPf4P0v+5uXm51b1NQcDD2aHZbOg90cieVMNUbW3d1iwPCIidi 01PUA6VNZxaX9iitdaoVuDqwHv1k5/ewZeSLgB2sddCL+7JtfI/k2E3qgaC/najjEhbB wys3xoggCaTXjNSV2FbihQLgUmgsb1M/1+hG0wCWE+qBM0wrOZRiZEjtAkEA6duOgAMn NqJ7VDlqHMAOlWxz32ObOnSfonIaymZ7OEsljIoWaeaTy8v4WZpph3WM+68EoJfXt9/u AXGQ== X-Gm-Message-State: AOAM530wvrsfHRLFyY3wQ+vLImAru+eNYgGKhdGRJNNvRSl2EQ5oBmdn rw7x531s9rey9ecaRqnw7KKs5w== X-Google-Smtp-Source: ABdhPJwYpkbqYJB6T9w906hSU82h1v3vr+z3zO2Lp7j72zPJyvd83IHc+CMakx8xlv5Jq50O8i9yVw== X-Received: by 2002:a17:902:a513:b029:11a:9be6:f1b9 with SMTP id s19-20020a170902a513b029011a9be6f1b9mr20025348plq.55.1627422444596; Tue, 27 Jul 2021 14:47:24 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id t37sm4805774pfg.14.2021.07.27.14.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 14:47:23 -0700 (PDT) Date: Tue, 27 Jul 2021 14:47:22 -0700 From: Kees Cook To: Nathan Chancellor Subject: Re: [PATCH 31/64] fortify: Explicitly disable Clang support Message-ID: <202107271434.039A9777@keescook> References: <20210727205855.411487-1-keescook@chromium.org> <20210727205855.411487-32-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kbuild@vger.kernel.org, Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, "Gustavo A. R. Silva" , linux-block@vger.kernel.org, clang-built-linux@googlegroups.com, Keith Packard , linux-hardening@vger.kernel.org, netdev@vger.kernel.org, Andrew Morton Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Jul 27, 2021 at 02:18:58PM -0700, Nathan Chancellor wrote: > On 7/27/2021 1:58 PM, Kees Cook wrote: > > Clang has never correctly compiled the FORTIFY_SOURCE defenses due to > > a couple bugs: > > > > Eliding inlines with matching __builtin_* names > > https://bugs.llvm.org/show_bug.cgi?id=50322 > > > > Incorrect __builtin_constant_p() of some globals > > https://bugs.llvm.org/show_bug.cgi?id=41459 > > > > In the process of making improvements to the FORTIFY_SOURCE defenses, the > > first (silent) bug (coincidentally) becomes worked around, but exposes > > the latter which breaks the build. As such, Clang must not be used with > > CONFIG_FORTIFY_SOURCE until at least latter bug is fixed (in Clang 13), > > and the fortify routines have been rearranged. > > > > Update the Kconfig to reflect the reality of the current situation. > > > > Signed-off-by: Kees Cook > > --- > > security/Kconfig | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/security/Kconfig b/security/Kconfig > > index 0ced7fd33e4d..8f0e675e70a4 100644 > > --- a/security/Kconfig > > +++ b/security/Kconfig > > @@ -191,6 +191,9 @@ config HARDENED_USERCOPY_PAGESPAN > > config FORTIFY_SOURCE > > bool "Harden common str/mem functions against buffer overflows" > > depends on ARCH_HAS_FORTIFY_SOURCE > > + # https://bugs.llvm.org/show_bug.cgi?id=50322 > > + # https://bugs.llvm.org/show_bug.cgi?id=41459 > > + depends on !CONFIG_CC_IS_CLANG > > Should be !CC_IS_CLANG, Kconfig is hard :) /me shakes fist at sky Thank you! Fixed locally. :) -Kees > > > help > > Detect overflows of buffers in common string and memory functions > > where the compiler can determine and validate the buffer sizes. > > > > Cheers, > Nathan -- Kees Cook