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 E469CCE7AB1 for ; Mon, 25 Sep 2023 17:52:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6BFCA10E2BE; Mon, 25 Sep 2023 17:52:31 +0000 (UTC) Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD61F10E2BA for ; Mon, 25 Sep 2023 17:50:04 +0000 (UTC) Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-1c0fcbf7ae4so4661410fac.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.freedesktop.org; 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=UObhHPgR2L04POINaxBQMaW/6y+Gwt2fRE8Q5AKWh0mBM4mkgx3NEroLSbHtvX6f/O v0rI2XjI/kEFlxVduBTRexEbUMObOpVoNXE+G7pqxfotoJO3VP/fy8rqotmR7VrJxKef 44kIBtWWxEXHs8yQjcrbgUoz6Pldb9Apdv4Dw= 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=jBiGyoxQuuSs3cpgBUdQof0Slc4sZeG1J1K21Qg592KgDcrFfT3ddcaAmtakWQO6WX BB77X1zy3L7RqT/bAk+Th2J25FxWdyBjbcqLEYlz+fipD8LZ/cHp5ETt/1DPgkDrB9TU glU4CMRWe6iX+P5kMxxz90XHDNAB7DQ7/Hy8CuZzCoBHKzVDQv1UiKHcYcOJPLDX2F84 INNzhwEeg6JFP0bllIllwAhS2t5i4SFX/o7aLS1FdbztgZQaSDp3dvpg0cXuAPb05p0O 7qOsk6t43XJU6DZOWfxI6R9wNWQQZcVh20MVJbQye5T/2owL1p10PN0YpE5okQLLSKrJ i/jw== X-Gm-Message-State: AOJu0Yzj/wUqtli0dA/OweVspy39sXExWHSz9q5gkNvx0aR5ns34BVaC vKcXtc7YTe7iyovIwegmtJw+Lw== 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 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Mon, 25 Sep 2023 17:52:29 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tejas Upadhyay , Emma Anholt , Tom Rix , Joonas Lahtinen , llvm@lists.linux.dev, dri-devel@lists.freedesktop.org, Chris Wilson , Prike Liang , Huang Rui , Gerd Hoffmann , Marijn Suijten , David Airlie , Matthew Brost , Karol Herbst , Neil Armstrong , amd-gfx@lists.freedesktop.org, Kuogee Hsieh , Nathan Chancellor , VMware Graphics Reviewers , Ben Skeggs , Andi Shyti , nouveau@lists.freedesktop.org, David Airlie , virtualization@lists.linux-foundation.org, Chia-I Wu , linux-hardening@vger.kernel.org, Lijo Lazar , Yifan Zhang , linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, Kevin Wang , Abhinav Kumar , Jani Nikula , Melissa Wen , Dmitry Baryshkov , Gurchetan Singh , Maxime Ripard , Rodrigo Vivi , Evan Quan , Sean Paul , Tvrtko Ursulin , Xiaojian Du , Le Ma , freedreno@lists.freedesktop.org, Bjorn Andersson , "Pan, Xinhui" , Nick Desaulniers , linux-kernel@vger.kernel.org, Rob Clark , Zack Rusin , Daniel Vetter , Alex Deucher , Nirmoy Das , Lang Yu , Christian =?iso-8859-1?Q?K=F6nig?= , John Harrison , Hawking Zhang Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" 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 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 527DECE7AB2 for ; Mon, 25 Sep 2023 17:50:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 498B210E2BD; Mon, 25 Sep 2023 17:50:08 +0000 (UTC) Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by gabe.freedesktop.org (Postfix) with ESMTPS id BBE3210E2BC for ; Mon, 25 Sep 2023 17:50:04 +0000 (UTC) Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-1d651ab1d77so4652641fac.1 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.freedesktop.org; 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=UObhHPgR2L04POINaxBQMaW/6y+Gwt2fRE8Q5AKWh0mBM4mkgx3NEroLSbHtvX6f/O v0rI2XjI/kEFlxVduBTRexEbUMObOpVoNXE+G7pqxfotoJO3VP/fy8rqotmR7VrJxKef 44kIBtWWxEXHs8yQjcrbgUoz6Pldb9Apdv4Dw= 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=Mpq639H0TCLMwA387B5cBd4+/m+w1HLd8Hn7J6wu2iadbsWE8vbQ7JKTINtsprKPhZ k0z0O7xiIAkB4pLJ1GcDVSHO8bCEb7wiGOYgTowLEBpCHzq09tqG8yqOwcS901sZw0t3 lx8SuCrwxldLi0JH8u5ZuJNE+ZdJ6SPllvixMAOdmjCPCKeQKtmTH6vM/YSnYDJ1y3wL CILpG4JsI+/bNfmZLgyn0XlNh/ChbR3l28R19F7sfWP/gsQcO2iGnnbe33ZQgGBC73Mq dNVMEph0RaO5S8XyHRwFmvECcvocBzJBDPXnkHWrrVDBDqpT62BVhDaimA86KQyC/Bbu S1qA== X-Gm-Message-State: AOJu0Yz+YnxidZ38SUzKKe6wel4OAQWkRmy2CasRq1gAmd+MO4YSRB/y wcHERvSJ9ytQYasv720yIBnd/w== 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 Message-ID: <202309251043.2D1F7D08@keescook> References: <20230922173110.work.084-kees@kernel.org> <20230922173216.3823169-3-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Intel-gfx] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by 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: , Cc: Emma Anholt , Tom Rix , llvm@lists.linux.dev, dri-devel@lists.freedesktop.org, Chris Wilson , Prike Liang , Huang Rui , Gerd Hoffmann , Marijn Suijten , David Airlie , Karol Herbst , Neil Armstrong , amd-gfx@lists.freedesktop.org, Kuogee Hsieh , Nathan Chancellor , VMware Graphics Reviewers , Ben Skeggs , nouveau@lists.freedesktop.org, David Airlie , virtualization@lists.linux-foundation.org, Chia-I Wu , linux-hardening@vger.kernel.org, Lijo Lazar , Yifan Zhang , linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, Kevin Wang , Abhinav Kumar , Melissa Wen , Dmitry Baryshkov , Gurchetan Singh , Maxime Ripard , Rodrigo Vivi , Evan Quan , Xiaojian Du , Le Ma , freedreno@lists.freedesktop.org, Bjorn Andersson , "Pan, Xinhui" , Nick Desaulniers , linux-kernel@vger.kernel.org, Zack Rusin , Daniel Vetter , Alex Deucher , Nirmoy Das , Lang Yu , Christian =?iso-8859-1?Q?K=F6nig?= , Hawking Zhang Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 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 6A856CE7AB1 for ; Mon, 25 Sep 2023 17:50:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbjIYRuL (ORCPT ); Mon, 25 Sep 2023 13:50:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbjIYRuK (ORCPT ); Mon, 25 Sep 2023 13:50:10 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D04101 for ; Mon, 25 Sep 2023 10:50:04 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3aca1543608so4515233b6e.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=vger.kernel.org; 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=PLobzVaKliHwG+r2YWO73hENA1yrUAsyTU/h9lAFy5hCMYuhBPCLFuzyJDn0oVEo35 2NuL8BcoSHqKwUDhJY1ahZePrb9yaJ7Hl6HYrxPCuVrQz7nNRmTHc6f6zFFSdu+Unw7G lpHY5BJz0LK1Kq0/TpHF7nyWypBj3pd07ViJ4= 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=lrY9J6+fGAi3FvOgrdl8i5ZI03ojEcAOm9fnrq7/BuZ43ZR4x9g49S/rW3cn7nhPj9 g17Vxi6iJdyLcl6crWFFvWBH/anxRdJgAa7RlA4rck5pLDBQ3MbfbGRih4U9BgPQUSZq Qu5DTv4tQ5nn+AUYwqOdZ5fxUloIusYEBhi6oVc/Des5QfWrtuE+lzGGBIBDkzidf8TD dESIMeDOOoL8Y4MCuEwWQptybxLBix6zpNm5jwP/35gKCcXAvC/AajrKqvNo/8fwHka/ ocMzhODHers3ahhg1R+CDMvf22bnOYiXJZNrn04IKdgsZgzPujGicY+2lZfTFazvR+pl 2LPQ== X-Gm-Message-State: AOJu0YzQMh1TqwVRsSc9JG/T0px6DwcQOT1kxZs2rXIla7qAyvtjX2Fc q8FDzNO7V6ahGLJrh5wLDb4oHQ== X-Google-Smtp-Source: AGHT+IGie+Z/VwhJ6V3LKWh5OI/Dj3Px8pRaI7N33JgrgsWWDGZ81eWlnH9NeD8qxw1CQkfx2CSwHA== X-Received: by 2002:a05:6808:351:b0:3ad:fcd4:275e with SMTP id j17-20020a056808035100b003adfcd4275emr9044080oie.35.1695664203734; 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 j12-20020a63b60c000000b00577d53c50f7sm7143781pgf.75.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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 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 49D39CE7AB1 for ; Mon, 25 Sep 2023 17:50:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA1C310E2BC; Mon, 25 Sep 2023 17:50:07 +0000 (UTC) Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by gabe.freedesktop.org (Postfix) with ESMTPS id DB54A10E2BE for ; Mon, 25 Sep 2023 17:50:04 +0000 (UTC) Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1d651ab1d77so4652649fac.1 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.freedesktop.org; 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=UObhHPgR2L04POINaxBQMaW/6y+Gwt2fRE8Q5AKWh0mBM4mkgx3NEroLSbHtvX6f/O v0rI2XjI/kEFlxVduBTRexEbUMObOpVoNXE+G7pqxfotoJO3VP/fy8rqotmR7VrJxKef 44kIBtWWxEXHs8yQjcrbgUoz6Pldb9Apdv4Dw= 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=BnRh9Lec7x1tKJ+9b63eDYLn4Tpn7KVmOb+1boeC8BQO4PK5D94Ljr+useK+PPElzF KbXAK6nsjCnJPwLwRNjBGETi9ZKfPsI3tIv9FnvxlkwuA0nk1PWAWAwahn+akdkpJ1yG bPhTrzuZXl/dqyt2IM0ScYLRzF/R6nRsAcVBLEOb5GX5kF+Rxtu/aC7IFHJFTf6/gRUn jid5MlN0zq01JQaZ4tf2+Sqaivw1PSmrA/k9tVr+6Y/I7sGX0hQsApk7Lb2naNLjpODp UFNNs9uJbIbU8jZX2oNdqhkDO5Ml4ti1konOpzL5qHM2XJ0ZsAWLCn17jnD69JeBd403 8ujg== X-Gm-Message-State: AOJu0YxftNjcSE0YrCofisPrWVzc4KMvGzg1lNOWbWha48yANx5ukxmU q4VXI6V+gK/KSWvoiNKZMDMV0A== 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 Message-ID: <202309251043.2D1F7D08@keescook> References: <20230922173110.work.084-kees@kernel.org> <20230922173216.3823169-3-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Nouveau] [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tejas Upadhyay , Emma Anholt , Tom Rix , Joonas Lahtinen , llvm@lists.linux.dev, dri-devel@lists.freedesktop.org, Chris Wilson , Prike Liang , Huang Rui , Gerd Hoffmann , Marijn Suijten , Matthew Brost , Neil Armstrong , amd-gfx@lists.freedesktop.org, Kuogee Hsieh , Nathan Chancellor , VMware Graphics Reviewers , Ben Skeggs , Andi Shyti , nouveau@lists.freedesktop.org, David Airlie , virtualization@lists.linux-foundation.org, Chia-I Wu , linux-hardening@vger.kernel.org, Lijo Lazar , Yifan Zhang , linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, Kevin Wang , Abhinav Kumar , Jani Nikula , Melissa Wen , Dmitry Baryshkov , Gurchetan Singh , Maxime Ripard , Rodrigo Vivi , Evan Quan , Sean Paul , Tvrtko Ursulin , Xiaojian Du , Le Ma , freedreno@lists.freedesktop.org, Bjorn Andersson , "Pan, Xinhui" , Nick Desaulniers , linux-kernel@vger.kernel.org, Rob Clark , Zack Rusin , Daniel Vetter , Alex Deucher , Nirmoy Das , Lang Yu , Christian =?iso-8859-1?Q?K=F6nig?= , John Harrison , Hawking Zhang Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" 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 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 smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 0C331CE7AB5 for ; Mon, 25 Sep 2023 17:50:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8C621416A2; Mon, 25 Sep 2023 17:50:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 8C621416A2 Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=n1ATiAGl X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iiMy01HqFD_t; Mon, 25 Sep 2023 17:50:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id E6994409E6; Mon, 25 Sep 2023 17:50:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E6994409E6 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C7B0BC0039; Mon, 25 Sep 2023 17:50:07 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 47575C0032 for ; Mon, 25 Sep 2023 17:50:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 13C2940A87 for ; Mon, 25 Sep 2023 17:50:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 13C2940A87 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G5OIhz4crEVP for ; Mon, 25 Sep 2023 17:50:05 +0000 (UTC) Received: from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com [IPv6:2001:4860:4864:20::2b]) by smtp2.osuosl.org (Postfix) with ESMTPS id 053CF409E6 for ; Mon, 25 Sep 2023 17:50:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 053CF409E6 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-1d651ab1d77so4652655fac.1 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-foundation.org; 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=n1ATiAGlrtv54YHB8K2CqDqle5cAtu5sLwgCTMKyTEsCQ+ryiclKMgWoo6pDHZhfKe MTn0Y+EzeCCgR1tGQRYr81YjM94xQcsNC24C/bqT+PJ6156KZ3ADMS6snCOyC3o6A8Cs 2Ifc93LlfPwSMAGd4owfx+nR+IYtlxxtkTt/E= 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=pEdQtSs3TE0RPpCrcVFRvEW1QfP4dJsyhn6JmeAdJslp/ThQ9v/zU7+olEOpZCldHG SmIG3PPHtGDbELBBhTmgEwuEoVbfDnWFa4NkoaHomMsZgr2x0H5V301GQ1yaAbgVPscD FAtoeQpUUl2e9UD5Hd0k2a6JafHmGcq0z7v33MoD8Sf05U1uGGs/tzA1E8ZP8fthG5eI Nt2zBnvUNeoy0HkYxF+Ud404RLZux2WZrZJswZzZTJeCzlqU37m0gK1+xnSvTfRWleNk SNFdgPnRCO1nBv/sNijeAnAH7sDRxbnVvN3J0BDq2Mo+ek4+zeoboju6VRTrVBq+BudA N/9Q== X-Gm-Message-State: AOJu0YysKnRuX3kxRVXiylE4HNynyTM5OPNAv7XHbUfnfWbAIF/o4q9I 8k740mSqCUzJvVhknAVwe74zxg== 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 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: Tejas Upadhyay , Emma Anholt , Tom Rix , Joonas Lahtinen , llvm@lists.linux.dev, dri-devel@lists.freedesktop.org, Chris Wilson , Prike Liang , Huang Rui , Marijn Suijten , David Airlie , Matthew Brost , Karol Herbst , Neil Armstrong , amd-gfx@lists.freedesktop.org, Kuogee Hsieh , Nathan Chancellor , VMware Graphics Reviewers , Ben Skeggs , Andi Shyti , nouveau@lists.freedesktop.org, David Airlie , virtualization@lists.linux-foundation.org, Chia-I Wu , linux-hardening@vger.kernel.org, Lijo Lazar , Lyude Paul , Yifan Zhang , linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, Kevin Wang , Abhinav Kumar , Jani Nikula , Melissa Wen , Dmitry Baryshkov , Gurchetan Singh , Maxime Ripard , Rodrigo Vivi , Evan Quan , Sean Paul , Tvrtko Ursulin , Xiaojian Du , Le Ma , freedreno@lists.freedesktop.org, Bjorn Andersson , "Pan, Xinhui" , Nick Desaulniers , linux-kernel@vger.kernel.org, Rob Clark , Zack Rusin , Daniel Vetter , Alex Deucher , Nirmoy Das , Lang Yu , Christian =?iso-8859-1?Q?K=F6nig?= , John Harrison , Hawking Zhang X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" 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 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization 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 9362ACE7AB3 for ; Mon, 25 Sep 2023 17:50:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5905D10E2BA; Mon, 25 Sep 2023 17:50:07 +0000 (UTC) Received: from mail-oa1-x29.google.com (mail-oa1-x29.google.com [IPv6:2001:4860:4864:20::29]) by gabe.freedesktop.org (Postfix) with ESMTPS id B43E510E2BB for ; Mon, 25 Sep 2023 17:50:04 +0000 (UTC) Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-1d651ab1d77so4652645fac.1 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.freedesktop.org; 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=UObhHPgR2L04POINaxBQMaW/6y+Gwt2fRE8Q5AKWh0mBM4mkgx3NEroLSbHtvX6f/O v0rI2XjI/kEFlxVduBTRexEbUMObOpVoNXE+G7pqxfotoJO3VP/fy8rqotmR7VrJxKef 44kIBtWWxEXHs8yQjcrbgUoz6Pldb9Apdv4Dw= 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=JFk71UFsL5BGAzrGSxui/mKmd1Jcrvw3BfGNcBu46nQqxPcoMluCyCp5V8Sn0uajST jmzVOfWDjgZ8uL6qv/YURNAeMOEl4ds8KAY80fsDCTjKCpiHelI/kKZPmLwPicpuwjMK 3H6feLvVgrXwXAcZLnATwYkekv2BpwkfVe1FIMIov2k6TQf/OCTiF4a6/TEVSkRNv+A7 fShpisUsB/EKwSvKIQyyF6RC2n3K36ttT5QEPEU5ZCITVQJ+IyXzEjVlW1MK1nCmzgJ3 fLiJvOLVic4DaExkYriDTatmPcvkq6Gilo+eKy2qV2u9qp8NwMij/rxNUKeh9BRg/wi8 lYLQ== X-Gm-Message-State: AOJu0YxtWUoPCWcLrH6SnlgJ+Ly1azYuArESYwkRgjw9x68uWUHVDGN4 Pihj4aZn9vMSpSRTlaFX6jJYmw== 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 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tejas Upadhyay , Emma Anholt , Tom Rix , llvm@lists.linux.dev, dri-devel@lists.freedesktop.org, Chris Wilson , Prike Liang , Huang Rui , Gerd Hoffmann , Marijn Suijten , Matthew Brost , Karol Herbst , Neil Armstrong , amd-gfx@lists.freedesktop.org, Kuogee Hsieh , Nathan Chancellor , VMware Graphics Reviewers , Ben Skeggs , Andi Shyti , nouveau@lists.freedesktop.org, David Airlie , virtualization@lists.linux-foundation.org, linux-hardening@vger.kernel.org, Lijo Lazar , Yifan Zhang , linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, Kevin Wang , Abhinav Kumar , Melissa Wen , Dmitry Baryshkov , Gurchetan Singh , Maxime Ripard , Rodrigo Vivi , Evan Quan , Sean Paul , Tvrtko Ursulin , Xiaojian Du , Le Ma , freedreno@lists.freedesktop.org, Bjorn Andersson , "Pan, Xinhui" , Nick Desaulniers , linux-kernel@vger.kernel.org, Alex Deucher , Nirmoy Das , Lang Yu , Christian =?iso-8859-1?Q?K=F6nig?= , John Harrison , Hawking Zhang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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