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 1913BC7618A for ; Mon, 20 Mar 2023 17:36:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9810C10E5FE; Mon, 20 Mar 2023 17:36:27 +0000 (UTC) Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F3DA10E5FE for ; Mon, 20 Mar 2023 17:36:26 +0000 (UTC) Received: by mail-pl1-x630.google.com with SMTP id u5so13259924plq.7 for ; Mon, 20 Mar 2023 10:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679333785; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:subject:cc:to:from:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=hpUGiYeox1kWl4OfAxGx9LTy4s9lwzAPEC2LintUMTc=; b=BtCwXN29zeO1Y2JubkxnqAj2y9r5ppxzyhIYMyUQ+7kjvqpqF6WoKT4KRHH7v86VmB cmGLns+Rn5mdrrdVa8FbMLj4dwKKemEB/I3XQ3Dg2L5CNV/jfELfU6YlYE1BR0yw8z0K lVe9NTGAOFCpmqwTdASeFMuSLzz2DXBQENOss= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679333785; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:subject:cc:to:from:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hpUGiYeox1kWl4OfAxGx9LTy4s9lwzAPEC2LintUMTc=; b=2QZpo0Kyknk3aBfrQpMW9RgvNucnZzW8qqJY1/IlDK3lMFAp6W0LGOAV/BB0zy4ffa H3eUpHzkmrNq1MmK/4BaPFyBgIZML2sKAn+RF0vZMKHpZCaWGvg8xkHZovJfEcYkI2yJ Lv9YP39ijViwbbfBD4kE0Gn9SI0XM5Jk2Cta71mSw81J/ECq10/OMswEY4jvDdBlMchI +tScwV/d85pS3Sf8NSji45XsJVed3feDKRSILQ9dPs90OPwXYTa6kq++3bxIvKO3toDi b0tOC2YCoomV1mOxy/IALvsMeJ2C60J665e1g03NsfnnLnIdJ2ETXyRM1x2OhIdGPE9N D6dQ== X-Gm-Message-State: AO0yUKVlqbKGfOJ/10TZmQWc0rIo9FMYs+MYdx7eInwztrcidNdDVFB1 g4ZSkI7T+zUTzF9oPY3+cmp29g== X-Google-Smtp-Source: AK7set9t390bG2K3Xo5adX8F8Bk16FfVLogcMGAN0o6Fz61VzJapYPhoEvZSKsa75t3/lr7IoM3W2g== X-Received: by 2002:a17:903:120f:b0:1a0:549d:39a1 with SMTP id l15-20020a170903120f00b001a0549d39a1mr20418380plh.32.1679333785667; Mon, 20 Mar 2023 10:36:25 -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 k23-20020a170902ba9700b0019a95baaaa6sm6979664pls.222.2023.03.20.10.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 10:36:25 -0700 (PDT) Message-ID: <64189999.170a0220.fa1d9.c3f5@mx.google.com> X-Google-Original-Message-ID: <202303201036.@keescook> Date: Mon, 20 Mar 2023 10:36:24 -0700 From: Kees Cook To: "Gustavo A. R. Silva" References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Intel-gfx] [PATCH][next] drm/i915/uapi: Replace fake flex-array with flexible-array member 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: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Daniel Vetter , Rodrigo Vivi , David Airlie , linux-hardening@vger.kernel.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, Mar 17, 2023 at 12:18:01PM -0600, Gustavo A. R. Silva wrote: > Zero-length arrays as fake flexible arrays are deprecated and we are > moving towards adopting C99 flexible-array members instead. > > Address the following warning found with GCC-13 and > -fstrict-flex-arrays=3 enabled: > drivers/gpu/drm/i915/gem/i915_gem_context.c: In function ‘set_proto_ctx_engines.isra’: > drivers/gpu/drm/i915/gem/i915_gem_context.c:769:41: warning: array subscript n is outside array bounds of ‘struct i915_engine_class_instance[0]’ [-Warray-bounds=] > 769 | if (copy_from_user(&ci, &user->engines[n], sizeof(ci))) { > | ^~~~~~~~~~~~~~~~~ > ./include/uapi/drm/i915_drm.h:2494:43: note: while referencing ‘engines’ > 2494 | struct i915_engine_class_instance engines[0]; > > This helps with the ongoing efforts to tighten the FORTIFY_SOURCE > routines on memcpy() and help us make progress towards globally > enabling -fstrict-flex-arrays=3 [1]. > > Link: https://github.com/KSPP/linux/issues/21 > Link: https://github.com/KSPP/linux/issues/271 > Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook -- 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 757F0C7618A for ; Mon, 20 Mar 2023 17:41:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233510AbjCTRlQ (ORCPT ); Mon, 20 Mar 2023 13:41:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233781AbjCTRkb (ORCPT ); Mon, 20 Mar 2023 13:40:31 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8246B31E22 for ; Mon, 20 Mar 2023 10:36:51 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id j13so12940037pjd.1 for ; Mon, 20 Mar 2023 10:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679333785; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:subject:cc:to:from:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=hpUGiYeox1kWl4OfAxGx9LTy4s9lwzAPEC2LintUMTc=; b=BtCwXN29zeO1Y2JubkxnqAj2y9r5ppxzyhIYMyUQ+7kjvqpqF6WoKT4KRHH7v86VmB cmGLns+Rn5mdrrdVa8FbMLj4dwKKemEB/I3XQ3Dg2L5CNV/jfELfU6YlYE1BR0yw8z0K lVe9NTGAOFCpmqwTdASeFMuSLzz2DXBQENOss= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679333785; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:subject:cc:to:from:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hpUGiYeox1kWl4OfAxGx9LTy4s9lwzAPEC2LintUMTc=; b=bvi8gTKcRgOxe0S9Rn0RJtovI5ioVNhIBrZ0OYyxBSloblwj+pU/f0ZnvnltMZoNpt TXIqVcAJWrs8mH0YofKpP/MRcE7k1CBEU84I5U+XV2co3XrUm/u8dIPOtKXB3aUlLowa VK6s4EMA7tzHJvmyjLD4ElTYT59YhBiONb1/smqTLveDNl+YJqpwiDGP5hi3UReR+yrv ZtbVBgFCEGs4NilUL0OowMSARlqithhfKvtmc9e4fmwVEiHXmmrSLn6e4XGpkVtcB1MQ 4geIk5zgU1OfHKFswDrrMtDZYNTq9BYnlcGlQw9M1gGl5EbN5E4UVErrcRwhVubd+Mmz lRXA== X-Gm-Message-State: AO0yUKWUZuNHnS/bfK36mBtEVTeHA1wOUE1BnN9jxm16SjTiWuQlj8yV DJB4WYlTmMsnMuolDGPDzjDxlw== X-Google-Smtp-Source: AK7set9t390bG2K3Xo5adX8F8Bk16FfVLogcMGAN0o6Fz61VzJapYPhoEvZSKsa75t3/lr7IoM3W2g== X-Received: by 2002:a17:903:120f:b0:1a0:549d:39a1 with SMTP id l15-20020a170903120f00b001a0549d39a1mr20418380plh.32.1679333785667; Mon, 20 Mar 2023 10:36:25 -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 k23-20020a170902ba9700b0019a95baaaa6sm6979664pls.222.2023.03.20.10.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 10:36:25 -0700 (PDT) Message-ID: <64189999.170a0220.fa1d9.c3f5@mx.google.com> X-Google-Original-Message-ID: <202303201036.@keescook> Date: Mon, 20 Mar 2023 10:36:24 -0700 From: Kees Cook To: "Gustavo A. R. Silva" Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] drm/i915/uapi: Replace fake flex-array with flexible-array member References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org On Fri, Mar 17, 2023 at 12:18:01PM -0600, Gustavo A. R. Silva wrote: > Zero-length arrays as fake flexible arrays are deprecated and we are > moving towards adopting C99 flexible-array members instead. > > Address the following warning found with GCC-13 and > -fstrict-flex-arrays=3 enabled: > drivers/gpu/drm/i915/gem/i915_gem_context.c: In function ‘set_proto_ctx_engines.isra’: > drivers/gpu/drm/i915/gem/i915_gem_context.c:769:41: warning: array subscript n is outside array bounds of ‘struct i915_engine_class_instance[0]’ [-Warray-bounds=] > 769 | if (copy_from_user(&ci, &user->engines[n], sizeof(ci))) { > | ^~~~~~~~~~~~~~~~~ > ./include/uapi/drm/i915_drm.h:2494:43: note: while referencing ‘engines’ > 2494 | struct i915_engine_class_instance engines[0]; > > This helps with the ongoing efforts to tighten the FORTIFY_SOURCE > routines on memcpy() and help us make progress towards globally > enabling -fstrict-flex-arrays=3 [1]. > > Link: https://github.com/KSPP/linux/issues/21 > Link: https://github.com/KSPP/linux/issues/271 > Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook -- 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 62BCAC7618A for ; Mon, 20 Mar 2023 17:36:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5706E10E051; Mon, 20 Mar 2023 17:36:27 +0000 (UTC) Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 16B0E10E051 for ; Mon, 20 Mar 2023 17:36:26 +0000 (UTC) Received: by mail-pj1-x102a.google.com with SMTP id qe8-20020a17090b4f8800b0023f07253a2cso13242331pjb.3 for ; Mon, 20 Mar 2023 10:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679333785; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:subject:cc:to:from:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=hpUGiYeox1kWl4OfAxGx9LTy4s9lwzAPEC2LintUMTc=; b=BtCwXN29zeO1Y2JubkxnqAj2y9r5ppxzyhIYMyUQ+7kjvqpqF6WoKT4KRHH7v86VmB cmGLns+Rn5mdrrdVa8FbMLj4dwKKemEB/I3XQ3Dg2L5CNV/jfELfU6YlYE1BR0yw8z0K lVe9NTGAOFCpmqwTdASeFMuSLzz2DXBQENOss= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679333785; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:subject:cc:to:from:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hpUGiYeox1kWl4OfAxGx9LTy4s9lwzAPEC2LintUMTc=; b=Kfscl0C2XfVrFb+vA+KMMiFfH05H6VzeF8kLKP0uHbzh2O9UbDN647fF7ztP/qZbjF siCBA41xD7En2nO2hpmX9W9xxA5i6cBHbf6qARGZektW21yfPtoBnRobwTAAMfOCLKAB QLbEipGOMcn7eDR6jOP0UVekJqUiDsPo3EANvhKwhDiSKa1XkXRxGxocXpOQOsBxCRcf aHucAc2BshMdMyz9ra/4d9e/eRW2w2q+1ixSEQxVmfzFvdwy4URx130uBTftlBXmDe/A jUOWDN+O8oxpy9M4f+mhNmIn6tmGleoPkolZNN4m6Qba9KG6x9gIJ2AkB76jAJ2DJegt NyAg== X-Gm-Message-State: AO0yUKUfefsThT8JrTRvgTlI+8rQu04G09CqQku1FS2knWZrp8YQmefG iwxLPw0utSZVWA4GM+UcbILbmA== X-Google-Smtp-Source: AK7set9t390bG2K3Xo5adX8F8Bk16FfVLogcMGAN0o6Fz61VzJapYPhoEvZSKsa75t3/lr7IoM3W2g== X-Received: by 2002:a17:903:120f:b0:1a0:549d:39a1 with SMTP id l15-20020a170903120f00b001a0549d39a1mr20418380plh.32.1679333785667; Mon, 20 Mar 2023 10:36:25 -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 k23-20020a170902ba9700b0019a95baaaa6sm6979664pls.222.2023.03.20.10.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 10:36:25 -0700 (PDT) Message-ID: <64189999.170a0220.fa1d9.c3f5@mx.google.com> X-Google-Original-Message-ID: <202303201036.@keescook> Date: Mon, 20 Mar 2023 10:36:24 -0700 From: Kees Cook To: "Gustavo A. R. Silva" Subject: Re: [PATCH][next] drm/i915/uapi: Replace fake flex-array with flexible-array member References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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: Tvrtko Ursulin , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Rodrigo Vivi , linux-hardening@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Mar 17, 2023 at 12:18:01PM -0600, Gustavo A. R. Silva wrote: > Zero-length arrays as fake flexible arrays are deprecated and we are > moving towards adopting C99 flexible-array members instead. > > Address the following warning found with GCC-13 and > -fstrict-flex-arrays=3 enabled: > drivers/gpu/drm/i915/gem/i915_gem_context.c: In function ‘set_proto_ctx_engines.isra’: > drivers/gpu/drm/i915/gem/i915_gem_context.c:769:41: warning: array subscript n is outside array bounds of ‘struct i915_engine_class_instance[0]’ [-Warray-bounds=] > 769 | if (copy_from_user(&ci, &user->engines[n], sizeof(ci))) { > | ^~~~~~~~~~~~~~~~~ > ./include/uapi/drm/i915_drm.h:2494:43: note: while referencing ‘engines’ > 2494 | struct i915_engine_class_instance engines[0]; > > This helps with the ongoing efforts to tighten the FORTIFY_SOURCE > routines on memcpy() and help us make progress towards globally > enabling -fstrict-flex-arrays=3 [1]. > > Link: https://github.com/KSPP/linux/issues/21 > Link: https://github.com/KSPP/linux/issues/271 > Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook -- Kees Cook