Re: [PATCH] drm/i915: Fix potential spectre vulnerability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thu, Nov 02, 2023 at 11:32:43AM +0000, Tvrtko Ursulin wrote:
> On 02/11/2023 10:16, chentao 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)
> > 
> > Signed-off-by: chentao <chentao@xxxxxxxxxx>
> 
> I don't know if this is actually exploitable given the time deltas between the index is read from userspace and acted upon here, which is at least two ioctls apart. But I suppose no harm in fixing and for safety so we need to add:
> 
> Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)")
> Cc: <stable@xxxxxxxxxxxxxxx> # v5.15+

Is this a real fix? I don't mind adding it, though.

> > ---
> >   drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > index 9a9ff84c90d7..b2fdfc7ca4de 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > @@ -843,7 +843,7 @@ static int set_proto_ctx_sseu(struct drm_i915_file_private *fpriv,
> >   		if (idx >= pc->num_user_engines)
> >   			return -EINVAL;
> > -
> 
> Just please refrain from random whitespace modifications like this blank line removal. If you resend without that you can add my r-b.
> 
> Regards,
> 
> Tvrtko
> 
> > +		idx = array_index_nospec(idx, pc->num_user_engines);

idx has been assigned earlier, can we make it one single
assignment at the declaration?

Andi



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux