Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1420033rdh; Mon, 25 Sep 2023 12:11:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFIVRLQ0zdraSd5tjzY86XfYW4WRQ8d2kQdYeR9iutpVMkKoIGF9SdvZKCPQLou3LFeAfz/ X-Received: by 2002:a05:6a21:99a0:b0:13e:fb5e:b460 with SMTP id ve32-20020a056a2199a000b0013efb5eb460mr752972pzb.0.1695669079000; Mon, 25 Sep 2023 12:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695669078; cv=none; d=google.com; s=arc-20160816; b=Dy9aCv/Hxu84NRIkydFm0DgKyP+Xx6Z0Gd9bNtNwk7r0Bppn5PNFvxzsEwscpx0pgQ ggXQIztvrDcii63W+mhmDVatZ8tPIs6c9M9Jo3thYc2zeD2M28+3SBR6T+DBKhPeqLis slyJgKUr0gIXZtAGYzAmZ1hiNcDEaRBZCJwMq1lC4wU8k2PtagEcYbLYjKwZZz+YCq+m FEt6+6NGj5JRt6Hl4Cffi1aW2Vony3W8zdH6KpINHZnq1YFLJQHPMzdhTLosATXusdhN D/RYGeX7SadujjbF6p9v8GDyA8OT1X9/0du/j/MNDYJi7alBUM4leGhQhw3q+MaZRb0o lmaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=aqAz07K4BaSeAcOBH5q3NZaOfYMhKC0WftgYp7/aZ0I=; fh=rIEm3DYiJTsNTBEFZHSDLwmKeXtz9Ya0YY7hBzlTkL4=; b=Ve123KTsPpu52FXPhmukwDqlUPixVjIk5zZB8JXk8sADjaFIGRp0wXlxhEEZ9sWDNs IRhs2OjTyf7vtmBhLeeum7vxY5K0ryc/N/2Wif6dTQna0drqzPXpu0bpPdI0xC8RN9jQ VU05x8T89LDScafXjEBI5UROFTgOhou00G80XypHtEY31SC81LnqJcGqpRzln8+m2A8v luE1BswOa6/VOGdSGJyNj9h5zFH9lrL9tEsVfRM+sRM50BhX7ODoSaWjJrIPtaAWh7G7 IoEk2iUMNHe9yvyxfnp4TQ3s3SStWO2r9nwafJ/30oNFJPtzsHj6IiRoMzjmZLOJX6Ho tZPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aUtCH1SP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id g18-20020a631112000000b00563d9ff5158si10460745pgl.350.2023.09.25.12.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 12:11:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aUtCH1SP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 936808122894; Mon, 25 Sep 2023 03:09:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230394AbjIYKJW (ORCPT + 99 others); Mon, 25 Sep 2023 06:09:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbjIYKJA (ORCPT ); Mon, 25 Sep 2023 06:09:00 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10465CC0; Mon, 25 Sep 2023 03:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695636533; x=1727172533; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=9SzzmhaLPWx2xAIJWkDOyEqBDTZ2PvwdNCWiw1GRUAs=; b=aUtCH1SPxLrSzpRlMSC+CI/5cgQ9MR8Fn8CCf9UmmS16+w2aggFPpdws omgH/+1TqYioXg6F7e2Z0m79UomMNOad/4hCBXZzB06k7CL1rMtW9giqw Nyyqn6HBkcQDFaMJOPdzJhLBF3vt2QornJaZvkL/n4Xa5HPSF9YKB7wfu LPZ6zKpzrgBzgMHb3FUx8GNxSR8Ve8sCERd4yDkOVkDgEioCsIg9Tz8HQ d49ZQd+fvaZ/5fYWdMxQQibmPoXCX7+PeuWUDxjuUJADiaOwoD9/a6Nrg sfUN8FTKXQSNZuaaIjJtbhLWEXWQLtHqzAtC2u9MHh1wTJoRUnsqtcA4y w==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="467501544" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="467501544" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 03:08:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="777606983" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="777606983" Received: from ahajda-mobl.ger.corp.intel.com (HELO [10.213.8.144]) ([10.213.8.144]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 03:08:37 -0700 Message-ID: Date: Mon, 25 Sep 2023 12:08:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.15.1 Subject: Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by Content-Language: en-US To: Kees Cook , David Airlie Cc: 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 , =?UTF-8?Q?Christian_K=c3=b6nig?= , "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 References: <20230922173110.work.084-kees@kernel.org> <20230922173216.3823169-3-keescook@chromium.org> From: Andrzej Hajda Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 In-Reply-To: <20230922173216.3823169-3-keescook@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 25 Sep 2023 03:09:28 -0700 (PDT) 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. Anyway: Reviewed-by: Andrzej Hajda Regards Andrzej > --- > drivers/gpu/drm/i915/selftests/i915_request.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c > index a9b79888c193..acae30a04a94 100644 > --- a/drivers/gpu/drm/i915/selftests/i915_request.c > +++ b/drivers/gpu/drm/i915/selftests/i915_request.c > @@ -1924,7 +1924,7 @@ struct perf_stats { > struct perf_series { > struct drm_i915_private *i915; > unsigned int nengines; > - struct intel_context *ce[]; > + struct intel_context *ce[] __counted_by(nengines); > }; > > static int cmp_u32(const void *A, const void *B)