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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DA1BFC36008 for ; Tue, 25 Mar 2025 19:25:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6BEA410E5E7; Tue, 25 Mar 2025 19:25:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="u09sutxW"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D81410E5E1; Tue, 25 Mar 2025 19:25:15 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 7957343F92; Tue, 25 Mar 2025 19:25:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F170C4CEE8; Tue, 25 Mar 2025 19:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742930715; bh=gWkyMtHS0xcBwH8pzvQMA99qjRWL1D1RwXbikwYpbbQ=; h=Date:From:To:Subject:References:In-Reply-To:From; b=u09sutxWpIKsjUQ+MH69yUowYtWZxZ4KGn3wLnw2xE7v6LvUD3MAoZ2hewgTTWe63 mHH3gj2ujyiTyWwt+r1P4IkG2/xiKiB6aQrZAXbIayd49rgkfOkX/McMC8hCKOXQ1x cvEnMZRvBkWfWFWbYGE9iig2CQ886gNfIsYhBZYEMvxWrXdZocp+KQOsu+FLqIzqbS IW/Z+eqdXx8NJ70r2DBL+IUinTSJ/oqgO0lQko7jQDf/0T+znkW2bGXGuBS6vCFnmI 6tyJWdCoEdHWsXRGCTmRCWNcP0vGV2zrpa4T/w+1ObsWUYMoRdZ3+UPy/7MIHQYvje aDBUBdfEP0a9Q== Date: Tue, 25 Mar 2025 12:25:12 -0700 From: Kees Cook To: Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] drm/i915/gvt: Add __nonstring annotations for unterminated strings Message-ID: <202503251224.F128AE971@keescook> References: <20250310222355.work.417-kees@kernel.org> <01070195c306db7f-9f28efdd-9456-4db3-b6c6-343298bd571b-000000@eu-central-1.amazonses.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01070195c306db7f-9f28efdd-9456-4db3-b6c6-343298bd571b-000000@eu-central-1.amazonses.com> X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Sun, Mar 23, 2025 at 12:42:41PM +0000, Damian Tometzki wrote: > On Mon, 10. Mar 15:23, Kees Cook wrote: > > When a character array without a terminating NUL character has a static > > initializer, GCC 15's -Wunterminated-string-initialization will only > > warn if the array lacks the "nonstring" attribute[1]. Mark the arrays > > with __nonstring to and correctly identify the char array as "not a C > > string" and thereby eliminate the warning. > > > > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178 [1] > > Cc: Zhenyu Wang > > Cc: Zhi Wang > > Cc: Jani Nikula > > Cc: Joonas Lahtinen > > Cc: Rodrigo Vivi > > Cc: Tvrtko Ursulin > > Cc: David Airlie > > Cc: Simona Vetter > > Cc: intel-gvt-dev@lists.freedesktop.org > > Cc: intel-gfx@lists.freedesktop.org > > Cc: dri-devel@lists.freedesktop.org > > Signed-off-by: Kees Cook > > --- > > drivers/gpu/drm/i915/gvt/opregion.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/gvt/opregion.c b/drivers/gpu/drm/i915/gvt/opregion.c > > index 509f9ccae3a9..f701638d3145 100644 > > --- a/drivers/gpu/drm/i915/gvt/opregion.c > > +++ b/drivers/gpu/drm/i915/gvt/opregion.c > > @@ -43,7 +43,7 @@ > > #define DEVICE_TYPE_EFP4 0x10 > > > > struct opregion_header { > > - u8 signature[16]; > > + u8 signature[16] __nonstring; > > u32 size; > > u32 opregion_ver; > > u8 bios_ver[32]; > > @@ -222,7 +222,7 @@ int intel_vgpu_init_opregion(struct intel_vgpu *vgpu) > > u8 *buf; > > struct opregion_header *header; > > struct vbt v; > > - const char opregion_signature[16] = OPREGION_SIGNATURE; > > + const char opregion_signature[16] __nonstring = OPREGION_SIGNATURE; > > > > gvt_dbg_core("init vgpu%d opregion\n", vgpu->id); > > vgpu_opregion(vgpu)->va = (void *)__get_free_pages(GFP_KERNEL | > > -- > > 2.34.1 > > > Hello together, > > it doesnt resolve the build issue with gcc15 gcc (GCC) 15.0.1 20250228 This was a recent enhancement to GCC, and that 20250228 build does not include it. (GCC 15 is not actually released yet...) -- Kees Cook