From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (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 C886E107B8 for ; Mon, 25 Sep 2023 17:50:04 +0000 (UTC) Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-1c0fcbf7ae4so4661414fac.0 for ; Mon, 25 Sep 2023 10:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695664204; x=1696269004; darn=lists.linux.dev; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=LrNZUYK9GVon3CstC3PAw8y74HnTAoBSBfYauDl4OzM=; b=fj5SxOtfGwZaBg0LvExh5vDJ7HsafIhh6TSKFo5V1Ta0y/GdaDT8by29c/R0kPcrcp 4VfyiK47fUs3LDJlQcPxnbU4ivwY0h+X0DWKi5+PCuUYVjYMPZ9JoveKwXgwCNDEheMh 3ygeikqbd1uTiy+YpP3e350mipmV+txxZ1kS0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695664204; x=1696269004; h=in-reply-to: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=LrNZUYK9GVon3CstC3PAw8y74HnTAoBSBfYauDl4OzM=; b=qK38Gwp6m4ucr8l0eXr8yzFZuP2r2Lt6X1DgxSHAb2jlAfTmSQvQvOGIGhqqedgOup b8Nnmm5NAksVJ8OygNw79wBL3OilX7cLU+IkNNcDRRBkir5H22wOAWto9lWK7FWBFONC 8Y9fLqLSy07v+4dclUSJ+/s5eBO6vrpriBnVXmrB/L+jbLZxwOdzl08pbSZlJ7BQ2KI3 H3yiK6bcTZrE52rhtqkl4pT2efpprfOxJHY1nkPzoX34m7jomf/3pb+kSu5xHk7AN797 hmwUkzrNkQf6mUwwhut+wknSwVkgV4ytWiz3FHTaMVO4bK8enCl1/1v97wA/I5mIYRbI nYRw== X-Gm-Message-State: AOJu0YydNksjOGkm5Sf7eQzeRw7TObWivq8QK7RQswsb9xIa0GsupwHC JZOtvln+URh+Ire6N50LPSjLeQ== X-Google-Smtp-Source: AGHT+IEnVXJWnUtJ+JjUoJ2wutCIFPzVwQv9Kt/j17reyYiG5PztEKwn4JCr3bhZYPWh/NJDzvVOfA== X-Received: by 2002:a05:6870:3323:b0:1d5:5a83:22b7 with SMTP id x35-20020a056870332300b001d55a8322b7mr9920226oae.51.1695664203813; Mon, 25 Sep 2023 10:50:03 -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 p19-20020a639513000000b00578afd8e012sm7498975pgd.92.2023.09.25.10.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 10:50:03 -0700 (PDT) Date: Mon, 25 Sep 2023 10:50:02 -0700 From: Kees Cook To: Andrzej Hajda Cc: David Airlie , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Daniel Vetter , Chris Wilson , John Harrison , Andi Shyti , Matthew Brost , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Emma Anholt , Evan Quan , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , Xiaojian Du , Huang Rui , Kevin Wang , Hawking Zhang , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Bjorn Andersson , Ben Skeggs , Karol Herbst , Lyude Paul , Maxime Ripard , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Zack Rusin , VMware Graphics Reviewers , Melissa Wen , Nathan Chancellor , Nick Desaulniers , Tom Rix , Le Ma , Lijo Lazar , Yifan Zhang , Prike Liang , Lang Yu , Tejas Upadhyay , Nirmoy Das , Neil Armstrong , Kuogee Hsieh , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, virtualization@lists.linux-foundation.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by Message-ID: <202309251043.2D1F7D08@keescook> References: <20230922173110.work.084-kees@kernel.org> <20230922173216.3823169-3-keescook@chromium.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: On Mon, Sep 25, 2023 at 12:08:36PM +0200, Andrzej Hajda wrote: > > > On 22.09.2023 19:32, 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 checking 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 perf_series. > > > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > > > Cc: Jani Nikula > > Cc: Joonas Lahtinen > > Cc: Rodrigo Vivi > > Cc: Tvrtko Ursulin > > Cc: David Airlie > > Cc: Daniel Vetter > > Cc: Chris Wilson > > Cc: John Harrison > > Cc: Andi Shyti > > Cc: Matthew Brost > > Cc: intel-gfx@lists.freedesktop.org > > Cc: dri-devel@lists.freedesktop.org > > Signed-off-by: Kees Cook > > I am surprised this is the only finding in i915, I would expected more. I'm sure there are more, but it's likely my Coccinelle pattern didn't catch it. There are many many flexible arrays in drm. :) $ grep -nRH '\[\];$' drivers/gpu/drm include/uapi/drm | grep -v :extern | wc -l 122 If anyone has some patterns I can add to the Coccinelle script, I can take another pass at it. > Anyway: > > Reviewed-by: Andrzej Hajda Thank you! -Kees -- Kees Cook