Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C34EF38FA6 for ; Fri, 6 Oct 2023 21:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dticagAh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696626177; x=1728162177; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=G5qi6qjPHLO8785ySsNeRiEUjzb2UW4Fd5UOqVqDpg0=; b=dticagAhn3CFbrBdpuFV8j8CSqDxnaKIokqzTW+FFwdKO3sSsc/1ocF7 3x3rOrhhYiBhT7McQqXM/KGpwsjXF+UUfLY8fs8IxYJcNepWGqsSj3vuQ 3pmewab1/Lw/f3f2jOYsRuoNv+kfPorpTjg86YnL0KJ93EsUhjAx4lt+H g2hrj0ADxQ8fhSjTGIOp0BXEOvsDVZj/8F3rSdkf7jgmca/TBcJQvy1pw a3OyXOTfj/8sgqUOpsz1sYKnatB3D2sWJPNnMjPEKBRXjvEf3e3ju0S7T 92/VdsPf77Qktagh1TSYlp4VyKtGsHQL9Pa3yf/qJ5Hpc/9itljw5MtZn A==; X-IronPort-AV: E=McAfee;i="6600,9927,10855"; a="381109601" X-IronPort-AV: E=Sophos;i="6.03,204,1694761200"; d="scan'208";a="381109601" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2023 14:02:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10855"; a="755980699" X-IronPort-AV: E=Sophos;i="6.03,204,1694761200"; d="scan'208";a="755980699" Received: from pmanogar-mobl.gar.corp.intel.com (HELO intel.com) ([10.213.157.100]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2023 14:02:35 -0700 Date: Fri, 6 Oct 2023 23:02:29 +0200 From: Andi Shyti To: Kees Cook Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , "Gustavo A. R. Silva" , John Harrison , Matthew Brost , Michal Wajdeczko , Matt Roper , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-hardening@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Tom Rix , Andi Shyti , Nirmoy Das , Jonathan Cavitt , Fei Yang , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] drm/i915/guc: Annotate struct ct_incoming_msg with __counted_by Message-ID: References: <20231006201744.work.135-kees@kernel.org> Precedence: bulk X-Mailing-List: llvm@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: <20231006201744.work.135-kees@kernel.org> Hi Kees, On Fri, Oct 06, 2023 at 01:17:45PM -0700, Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for > array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > As found with Coccinelle[1], add __counted_by for struct ct_incoming_msg. > > Cc: Jani Nikula > Cc: Joonas Lahtinen > Cc: Rodrigo Vivi > Cc: Tvrtko Ursulin > Cc: David Airlie > Cc: Daniel Vetter > Cc: "Gustavo A. R. Silva" > Cc: John Harrison > Cc: Matthew Brost > Cc: Michal Wajdeczko > Cc: Matt Roper > Cc: intel-gfx@lists.freedesktop.org > Cc: dri-devel@lists.freedesktop.org > Cc: linux-hardening@vger.kernel.org > Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1] > Signed-off-by: Kees Cook Reviewed-by: Andi Shyti Andi