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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A32BC41513 for ; Thu, 17 Aug 2023 03:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347916AbjHQDpb (ORCPT ); Wed, 16 Aug 2023 23:45:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347900AbjHQDp0 (ORCPT ); Wed, 16 Aug 2023 23:45:26 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1CF726AB for ; Wed, 16 Aug 2023 20:45:14 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-565334377d0so5404310a12.2 for ; Wed, 16 Aug 2023 20:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1692243914; x=1692848714; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=l1BgjUd4XeLDjePWLEkR6YV2AiwpHk7vLupAQf6XJLQ=; b=TvgxcjKypMfJeopGsUNlMXTiUHcfuLHQ/y2jvog9XzAJ3arUvziwgeymTbDVDXJFON 0zVyTwy7OJQhGWjYkMs5oK6URxYhyfHYxv+HkNPWZiNeTZm59BxVAP0jhM/FrkTRO/gh g0uGDl27dEWbKesbWcwe80Fu9ixMwAbcyLO7Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692243914; x=1692848714; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=l1BgjUd4XeLDjePWLEkR6YV2AiwpHk7vLupAQf6XJLQ=; b=Dj4KM8YwwftfA41TXrthumApaQqmihGY8Kurh6Pz32CuKpYRCi9vprPQW7sjazAeaq NELiyIdpUTETZKhtVTK/7nldYh7dVn6IxDXqrUEQI2+uvCtvigWihysn0PD+oFqqE9Sx 33pB2+34Gi0fzXFHtUS/4t552ANkKnDrIOEHDeFWSnefZ/DrFQb2xr2DC4U+TP3jPOXm zcFVkJ19MzB/fmkjd4wkJqq7Gti18zwlp6hVNSSaKfy6rGaGeA2kmLn6J31xs5yk8sqW R4k6HdDbBXRL2DY+HX4dRM6al9DXKQGzyDpSTRdn6DQBH0OofPoIuKdrVm5X0ct26101 SLpA== X-Gm-Message-State: AOJu0YyGzEAfrw3TvCSxPbpy2QoxIbPb8wcF2dBlZKKZjzUXHbKnbtxk 9yd1o0q712wxRPxNsWlGSunD3A== X-Google-Smtp-Source: AGHT+IH8lolk4W+WcKJ1Kxtt09L5YGzywK1Nuph+YXsBY0VuP/2D2X85rls5K/9b24WwiohRWWW+PQ== X-Received: by 2002:a05:6a20:748b:b0:133:6219:15e2 with SMTP id p11-20020a056a20748b00b00133621915e2mr5072261pzd.21.1692243914250; Wed, 16 Aug 2023 20:45:14 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id s22-20020aa78d56000000b006765cb32558sm4292519pfe.139.2023.08.16.20.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Aug 2023 20:45:13 -0700 (PDT) Date: Wed, 16 Aug 2023 20:45:12 -0700 From: Kees Cook To: Miguel Ojeda Cc: Andrea Righi , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , "Gustavo A . R . Silva" , Masahiro Yamada , rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Nick Desaulniers , Nathan Chancellor Subject: Re: [PATCH] rust: fix bindgen build error with fstrict-flex-arrays Message-ID: <202308162043.3D267E19D2@keescook> References: <20230815065346.131387-1-andrea.righi@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org On Tue, Aug 15, 2023 at 02:06:36PM +0200, Miguel Ojeda wrote: > On Tue, Aug 15, 2023 at 8:54 AM Andrea Righi wrote: > > > > Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") enabled > > '-fstrict-flex-arrays=3' globally, but bindgen does not recognized this > > It may be more accurate to say libclang here (bindgen forwards the options). > > Also, df8fc4e934c1 did it so only conditionally (if the C compiler > supports it). This explains what you are seeing: if I am right, you > are compiling with a modern enough GCC, which enables the option, but > with an old enough Clang. > > > compiler option, triggering the following build error: > > > > error: unknown argument: '-fstrict-flex-arrays=3', err: true > > This should only be true with libclang < 16, since Clang 16 > implemented the option, right? > > In fact, Clang 15 seems to work too -- it seems the compiler does not > error if the option is not within [0,3] (unlike GCC). > > Kees: this should only affect `__builtin_object_size` and not `sizeof`, right? That's correct. It would affect __builtin_object_size, __builtin_dynamic_object_size, and -fsantize=bounds instrumentation. -- Kees Cook