Message ID | 20231103023257.58199-1-chentao@kylinos.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp766840vqu; Thu, 2 Nov 2023 19:33:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCmnrpq3NUeklGXdpgDkj+0Ji59Jp2OylPQkn3+QcyKK/S+pwRVGNxyUAxz1M/eeoO3l07 X-Received: by 2002:a17:902:d481:b0:1cc:50f6:7fca with SMTP id c1-20020a170902d48100b001cc50f67fcamr13668690plg.24.1698978823164; Thu, 02 Nov 2023 19:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698978823; cv=none; d=google.com; s=arc-20160816; b=kGPnVwYdUyToqyojEnJgQViGesCSxqutbAJLmqkMV+UiF3P2hEn+W16RsP5bWK3+Yi a8iXnuMO5ZHJwGwStG3jCx55Kfh9mbhqkLBIaQMT55AqM4StJtgNGmz1XPihzWZOgNQM x5eti+LQe5paIofyPjcYxC49bRu4kpzOjEgOPSVONAFZtlMkQ3auSEVkBq+jxQlxNKfg p9pojUk42hBgsPSVyxIih+5917Q/MmxrSzYXel8DhJgRB8zgyMulwLUjNguJuQ1N1XL7 t+Y6z0cfg1EF8Bx3NjFDZ9dJ7tXgW9GuUeDgYls9GkqOVKzRQKAuYKFDypQ6OliJ2bMo qC+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=GRW9zG0IB/fSGCtCbLC+3PQfEOZlH8101jC5mptPKFs=; fh=G4F3UhRisIagsSxDGzsAU7cNBL74FaQmb6eEpiCgTpY=; b=N9p7w3gTtd7Xzz3n/kUozIAGp24RWxkWPJUHxuBlZ6JZcrbRFTL3GYUP67jZh/qErw L/F/K4NbMvfMbhxf5EuZY+M1RAZsRTAduyaRDexA6DYna63WHdJFPt9GOrQzna/h8Q/w DzKTYx2FNEhPZm5sseMxorWA4vJN0DBp6aYZTdxGqsjxFNqyCAoldyiH9BdNJAoWG90a LVNVE7b9wGzbx7pTqopy10nH4yU2y4tNq60lJ1LLuooWPa8IqiMLOz7r0N2iFudSF1l/ 8tQc6YhEzm4FHmSj+rUMURZlHtDRtM/Q6lj3KMaB0LCgedJrYasGXkAJGQQAcx9PHznu czAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id j7-20020a170902da8700b001c73626a1ffsi697420plx.412.2023.11.02.19.33.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 19:33:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 1FFBB82D8792; Thu, 2 Nov 2023 19:33:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234800AbjKCCd1 (ORCPT <rfc822;jaysivo@gmail.com> + 37 others); Thu, 2 Nov 2023 22:33:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjKCCdX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 2 Nov 2023 22:33:23 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4A661A3; Thu, 2 Nov 2023 19:33:15 -0700 (PDT) X-UUID: a1b81360ae14479ebb8ae7d3bb98ee0b-20231103 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:6ab78e64-c05c-4841-bd7d-646fd518aa52,IP:10, URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:-10 X-CID-INFO: VERSION:1.1.32,REQID:6ab78e64-c05c-4841-bd7d-646fd518aa52,IP:10,UR L:0,TC:0,Content:-5,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-10 X-CID-META: VersionHash:5f78ec9,CLOUDID:38acf594-10ce-4e4b-85c2-c9b5229ff92b,B ulkID:231103103311LO8N2NZS,BulkQuantity:0,Recheck:0,SF:66|24|17|19|44|102, TC:nil,Content:0,EDM:-3,IP:-2,URL:1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI, TF_CID_SPAM_ULS X-UUID: a1b81360ae14479ebb8ae7d3bb98ee0b-20231103 X-User: chentao@kylinos.cn Received: from vt.. [(116.128.244.171)] by mailgw (envelope-from <chentao@kylinos.cn>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 885977007; Fri, 03 Nov 2023 10:33:08 +0800 From: Kunwu Chan <chentao@kylinos.cn> To: tvrtko.ursulin@linux.intel.com Cc: airlied@gmail.com, alan.previn.teres.alexis@intel.com, andi.shyti@linux.intel.com, andrzej.hajda@intel.com, chentao@kylinos.cn, chris.p.wilson@intel.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, jani.nikula@linux.intel.com, jonathan.cavitt@intel.com, joonas.lahtinen@linux.intel.com, kunwu.chan@hotmail.com, linux-kernel@vger.kernel.org, robdclark@chromium.org, rodrigo.vivi@intel.com, stable@vger.kernel.org Subject: [PATCH v2] drm/i915: Fix potential spectre vulnerability Date: Fri, 3 Nov 2023 10:32:57 +0800 Message-Id: <20231103023257.58199-1-chentao@kylinos.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <d300506c-ab82-4cc1-b750-61e54ec2ad9e@linux.intel.com> References: <d300506c-ab82-4cc1-b750-61e54ec2ad9e@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 02 Nov 2023 19:33:37 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781447010481952227 X-GMAIL-MSGID: 1781508418014742590 |
Series |
[v2] drm/i915: Fix potential spectre vulnerability
|
|
Commit Message
Kunwu Chan
Nov. 3, 2023, 2:32 a.m. UTC
Fix smatch warning: drivers/gpu/drm/i915/gem/i915_gem_context.c:847 set_proto_ctx_sseu() warn: potential spectre issue 'pc->user_engines' [r] (local cap) Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)") Cc: <stable@vger.kernel.org> # v5.15+ Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Link: https://lore.kernel.org/all/20231102101642.52988-1-chentao@kylinos.cn --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 1 + 1 file changed, 1 insertion(+)
Comments
On 03/11/2023 03:32, Kunwu Chan wrote: > Fix smatch warning: > drivers/gpu/drm/i915/gem/i915_gem_context.c:847 set_proto_ctx_sseu() > warn: potential spectre issue 'pc->user_engines' [r] (local cap) > > Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)") > Cc: <stable@vger.kernel.org> # v5.15+ > Signed-off-by: Kunwu Chan <chentao@kylinos.cn> > Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> > Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Where did you receive this tag? There is nothing under link below. > Link: https://lore.kernel.org/all/20231102101642.52988-1-chentao@kylinos.cn Best regards, Krzysztof
On 03/11/2023 06:56, Krzysztof Kozlowski wrote: > On 03/11/2023 03:32, Kunwu Chan wrote: >> Fix smatch warning: >> drivers/gpu/drm/i915/gem/i915_gem_context.c:847 set_proto_ctx_sseu() >> warn: potential spectre issue 'pc->user_engines' [r] (local cap) >> >> Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)") >> Cc: <stable@vger.kernel.org> # v5.15+ >> Signed-off-by: Kunwu Chan <chentao@kylinos.cn> >> Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> >> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> > > Where did you receive this tag? There is nothing under link below. >> Link: https://lore.kernel.org/all/20231102101642.52988-1-chentao@kylinos.cn It is fine, I gave the conditional r-b in https://lore.kernel.org/all/d300506c-ab82-4cc1-b750-61e54ec2ad9e@linux.intel.com/. Suggested-by I did not and it is not true so I can drop it while applying. Regards, Tvrtko
Hi Kunwu, On Fri, Nov 03, 2023 at 10:32:57AM +0800, Kunwu Chan wrote: > Fix smatch warning: > drivers/gpu/drm/i915/gem/i915_gem_context.c:847 set_proto_ctx_sseu() > warn: potential spectre issue 'pc->user_engines' [r] (local cap) > > Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)") > Cc: <stable@vger.kernel.org> # v5.15+ > Signed-off-by: Kunwu Chan <chentao@kylinos.cn> > Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> > Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> > Link: https://lore.kernel.org/all/20231102101642.52988-1-chentao@kylinos.cn > --- > drivers/gpu/drm/i915/gem/i915_gem_context.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c > index 9a9ff84c90d7..e38f06a6e56e 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c > @@ -844,6 +844,7 @@ static int set_proto_ctx_sseu(struct drm_i915_file_private *fpriv, > if (idx >= pc->num_user_engines) > return -EINVAL; > > + idx = array_index_nospec(idx, pc->num_user_engines); you ignored my comment, though. Andi > pe = &pc->user_engines[idx]; > > /* Only render engine supports RPCS configuration. */ > -- > 2.34.1
On 06/11/2023 09:57, Andi Shyti wrote: > Hi Kunwu, > > On Fri, Nov 03, 2023 at 10:32:57AM +0800, Kunwu Chan wrote: >> Fix smatch warning: >> drivers/gpu/drm/i915/gem/i915_gem_context.c:847 set_proto_ctx_sseu() >> warn: potential spectre issue 'pc->user_engines' [r] (local cap) >> >> Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)") >> Cc: <stable@vger.kernel.org> # v5.15+ >> Signed-off-by: Kunwu Chan <chentao@kylinos.cn> >> Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> >> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> >> Link: https://lore.kernel.org/all/20231102101642.52988-1-chentao@kylinos.cn >> --- >> drivers/gpu/drm/i915/gem/i915_gem_context.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c >> index 9a9ff84c90d7..e38f06a6e56e 100644 >> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c >> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c >> @@ -844,6 +844,7 @@ static int set_proto_ctx_sseu(struct drm_i915_file_private *fpriv, >> if (idx >= pc->num_user_engines) >> return -EINVAL; >> >> + idx = array_index_nospec(idx, pc->num_user_engines); > > you ignored my comment, though. Sorry it was me, I considered it fine as is given it is the same pattern as elsewhere in the file. I've merged the patch btw. Regards, Tvrtko > > Andi > >> pe = &pc->user_engines[idx]; >> >> /* Only render engine supports RPCS configuration. */ >> -- >> 2.34.1
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c index 9a9ff84c90d7..e38f06a6e56e 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c @@ -844,6 +844,7 @@ static int set_proto_ctx_sseu(struct drm_i915_file_private *fpriv, if (idx >= pc->num_user_engines) return -EINVAL; + idx = array_index_nospec(idx, pc->num_user_engines); pe = &pc->user_engines[idx]; /* Only render engine supports RPCS configuration. */