Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp611824pxb; Tue, 1 Feb 2022 07:00:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqC42DUXh8CgfDwuZx79GHq1cX5f8MNWvP1SjjnKgQ2lE3PfDViW0C4v46+4R48D9EK4BM X-Received: by 2002:aa7:d7c8:: with SMTP id e8mr26029587eds.110.1643727652813; Tue, 01 Feb 2022 07:00:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643727652; cv=none; d=google.com; s=arc-20160816; b=hjJUZh9nvGltmbbMu1Zn1ENUehxaWVCj8H1ZzwQP35PJbJrURS2Fh9aFUaxhjmVrZo jlasc/2ePkNSQRGN3vmgi9vgqUCsb/2ls8wjhsw8BmlNpS2CxdPinqb+4HtL69IzLOIa +6a6T6GzA35DEgn9aNRrNCosF0jsDOp2hC+FIiUinRH3RKLsQQqN2vdyOKa5RNr5w+Yx 5ryxBaA+Xzwo8WQgEHk4YEuF1BwJT61ZyyEdudYMi68AY9JYJu6CsowXJn6AxJfAzIUz riYGzenLyBtKVA1LbjXAuSQINHt5/F7H1jzj2rozhuEXdWpYE6/iZQgPZ/FVl7PsWHDu wySw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=utrHAzHrcnkh3sdpYycz2bL8iJlVURjgNVgno2kFJgs=; b=NiFB3CtPRhsg9tCGaL+927bjgnZri+LJjVk4l3wnvZtL1RI/iCLC+tg2hGgD3WHgTJ HpzA2SprDs4r2Px7k7QGpAe/F0oDlQGyChL436GhF4scfidOdc2JGmkxwRZ5+/MzWobt 5lf5pLsT0M1IGq8lGK7bMcB+ZR8+YfzoAI328JhajLeqwAUIIRWJ0guDME0xN60YUQG7 NKDmLBhrJUaHQ6Gs2YexmLJBUk/IjNkoS82fr7UV2EFHfdci/737F5/sXFcZ+LlRMn3V YQrn6KwS15+r4b9UcjAXP9lHT3YHXKsi75tJyvvAmqc/LHoHFaBiVqxN5fyNXTsA+DY2 UDyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MmpQdk6v; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x2si5494070edd.151.2022.02.01.07.00.26; Tue, 01 Feb 2022 07:00:52 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MmpQdk6v; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230398AbiA3Tzw (ORCPT + 99 others); Sun, 30 Jan 2022 14:55:52 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57208 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbiA3Tzv (ORCPT ); Sun, 30 Jan 2022 14:55:51 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3FF21B82990; Sun, 30 Jan 2022 19:55:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A452AC340E4; Sun, 30 Jan 2022 19:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643572548; bh=4zb5UhaLqOlfRtVbPkkYmuMWAyxQjIa7QavGlkoM4eY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MmpQdk6vxwUc5/7Me6VbFqowflhqyb21APAhIUHdRbQqNByAIP3Yy97ZJuFCKVCl8 Fdu3jHEYvu9313W7EalsU8hopwAMfD07RixFPkXR3EZrvhFppLmdf0E/KgMUqWHnx/ 05jS6ZyQeyl9kZYjBqmsy1vTis38vM0FsZMN2C6QHyls0JtlXYqynIHzaQ2K8/lNWP PrCDa/B+FI6ywZO77WLb//H/6Rgy3x/DhycYIX2O6VwTq3sHNQ67+V9C68Ix2GLr/0 Sen4s7oAuED/2zCfpUeN7xh704ZRLehX9H/mvdN3QdxZJiD7t6JMzoIZs0/6LZ0ZyG covhJhvsAIvSw== Date: Sun, 30 Jan 2022 12:55:44 -0700 From: Nathan Chancellor To: Kees Cook Cc: Nick Desaulniers , linux-hardening@vger.kernel.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fortify: Update compile-time tests for Clang 14 Message-ID: References: <20220130181616.420092-1-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220130181616.420092-1-keescook@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 30, 2022 at 10:16:16AM -0800, Kees Cook wrote: > Clang 14 introduces support for compiletime_assert(). Update the > compile-time warning regex to catch Clang's variant of the warning text > in preparation for Clang supporting CONFIG_FORTIFY_SOURCE. > > Cc: Nathan Chancellor > Cc: Nick Desaulniers > Cc: linux-hardening@vger.kernel.org > Cc: llvm@lists.linux.dev > Signed-off-by: Kees Cook Reviewed-by: Nathan Chancellor > --- > I'm splitting this patch out of the main Clang FORTIFY enabling patch. > --- > scripts/test_fortify.sh | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/scripts/test_fortify.sh b/scripts/test_fortify.sh > index a4da365508f0..c2688ab8281d 100644 > --- a/scripts/test_fortify.sh > +++ b/scripts/test_fortify.sh > @@ -46,8 +46,12 @@ if "$@" -Werror -c "$IN" -o "$OUT".o 2> "$TMP" ; then > status="warning: unsafe ${FUNC}() usage lacked '$WANT' symbol in $IN" > fi > else > - # If the build failed, check for the warning in the stderr (gcc). > - if ! grep -q -m1 "error: call to .\b${WANT}\b." "$TMP" ; then > + # If the build failed, check for the warning in the stderr. > + # GCC: > + # ./include/linux/fortify-string.h:316:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning] > + # Clang 14: > + # ./include/linux/fortify-string.h:316:4: error: call to __write_overflow_field declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror,-Wattribute-warning] > + if ! grep -Eq -m1 "error: call to .?\b${WANT}\b.?" "$TMP" ; then > status="warning: unsafe ${FUNC}() usage lacked '$WANT' warning in $IN" > fi > fi > -- > 2.30.2 >