Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1341616lqd; Thu, 25 Apr 2024 12:28:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBVmw3kKrL5hgL/tZVPgofl5cBiPOeG1hxakQIUSrCBjQhlII0RjuYTVIiTRLKHwz/ENfb+cXdPO5SjwvjenLGJotPHFurCn+pPkyDjQ== X-Google-Smtp-Source: AGHT+IEQonM+i3RXypAckueFHmgGmr1P6qvYT7rM+imTi66aw3oLRekE2Ftc9+q9yXIEK970jO9g X-Received: by 2002:a05:6359:65ca:b0:18a:5c27:7032 with SMTP id ym10-20020a05635965ca00b0018a5c277032mr545279rwb.13.1714073280428; Thu, 25 Apr 2024 12:28:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714073280; cv=pass; d=google.com; s=arc-20160816; b=Yw8yNr2xWq2rjadzt8zSMXwYjsPKjxO+g8Y8iCwQoAMJdqkNohIxwMi7EtgKr9xb4I ioFgdnhhgMeh3bk/TE3mogoA4BKr6ogVxw6sv/fqSY4vvVooEDiboPBd/kNlWcctJrIA rAy2LC7eLC2FiSiQRkgogbKoVaMNADc7JkRLGZMIE3b9Q3ROEYLdsLRhjJRvpx5fyPH0 P/LQuyToMp843PlyRUaSwn3jSUCBw1Qm+iyWIPolk8Wz+5SxP97xqh85W/XbHig6jLSO g4/MFpHc3CHt1bKS8Q4exQW/MCDUWSCYE+FoLYL8D7fJjucyRhjshSrKZUcbLoceMo3h pTLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=xRfxLogI9T4CmFpA/Ru6xajlEXu5NliZz/2sLYlz8bo=; fh=R3B7Zi0pUeg53ENk/EMwe6ZhfSgvzWF8VIX3CWc0Puk=; b=E1ItF8XHfUJESPqO2TDVTB155Pk/cwAEXLzRHUtj3k0OoB3jT/BGNLhQhgeHLjuexR bPytwzehykNFs0ePIUvViXMeuKRCiivwb+cNjdAyOO/vfjU213xQNVXmi8eytK38dRpN UNd3/zifOh5rZkxL6QXeu874Ov8LKFyLj9la4AvHXd96ZIF1IBLvfQvpMkwk+Xyx6ipv rYniBYE8Eq2mCLfNTGW442NHVdCR2IXvdsEomk1F3qCDuy4E8Tp4+V2+BuNbel76Zjb3 4/msW65udZ8PEsDNcNh71vzLNojQqt6H/ONFQEqlsvN0sgkaomgrTVk1N7PiDi1lemBU APoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Wx6BXBqY; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-159077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id eq1-20020ad45961000000b006a081d977bbsi9710270qvb.209.2024.04.25.12.28.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 12:28:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Wx6BXBqY; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-159077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1BFA81C2197F for ; Thu, 25 Apr 2024 19:28:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD02E15219E; Thu, 25 Apr 2024 19:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Wx6BXBqY" Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E0E32135A for ; Thu, 25 Apr 2024 19:27:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714073273; cv=none; b=pnodU0hkMpPfdQ6J74l+V1vjLQQnYK3O39BhgOkNfx0c4abZd0fIyw/rKTIZB4uUeljTCqiINXMLHOjCuWepNzdnAWftRpo/Ht/rW9IruXuSYdPiaCsazBj6iNIDWlJHOd9cUMs9WdIruF244WS8XJwqRhJ/ErQS6D8NRBgIsF8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714073273; c=relaxed/simple; bh=9zUGvtPYESFL93IQuZWZqwV2EmLmIRwNFPqf2JM2j3Q=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=WKnEK+447NDtbbiX8pVO1S0GueV9R9MEMpd9y9yS0V4bidPa1/81C5eEkoiHVbAWEtUp3MYCEfGI1BIqDOVbcs0oBGe7Z4G1oqDI3ITaxoX+Ty7Q90V1wl8mDV6MiDxOsNiLojAdBtn4usSQG9TkzWVEbEfYgocldZ9/rluJq7A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Wx6BXBqY; arc=none smtp.client-ip=209.85.222.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: by mail-ua1-f44.google.com with SMTP id a1e0cc1a2514c-7eb23f807b5so273819241.1 for ; Thu, 25 Apr 2024 12:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1714073271; x=1714678071; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xRfxLogI9T4CmFpA/Ru6xajlEXu5NliZz/2sLYlz8bo=; b=Wx6BXBqYAXL03L5j1u7tuT6AFEwV26Is/tb8riQ7q/8YrnJqPe/jkcmgN80qeMfw2A XzMO0nRv+pCjXyXz3T7HPkA8AWcKylGG2o37hkKbiOASBCUyoOI06A1x3hpD1aSrQIVL zKFFdyo+kNnOnlYWCavh+9mC2Kp72tPl+QF6I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714073271; x=1714678071; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xRfxLogI9T4CmFpA/Ru6xajlEXu5NliZz/2sLYlz8bo=; b=C1ruQ76GDxxaGSEGf7JgHJXsTgOezwX4uHZYBdUeJPeNxRX+FzZ7k49ofXu3/mkVxf BlVo381qiK5WJjG9ESwH/bgyBmkKoMEdLTRbDi42i/1boCT/u43wi6S5kexlEq4EeaJG IVueOAHq/G94hgjYq2V52RkdIGmHl0rJ22dpdEo+TGq8KmrbnmK4MvCHRkTDkXXaKAqb fN7PedNriO/8xjJCBEhm44OJGlqXlNM3ZRASGpinh3kfeqJIaUNmZcrY63D7pGD6uFHl Ul7SsrKArS72QRs79tZ69lekDTnCMlreTjLQmqP/YVulH3PEVmeayJ73kZIQTQ/a1DyE IWsA== X-Forwarded-Encrypted: i=1; AJvYcCVOXD5vDBLY3ksIrE6YMtTDtPtPMjO2hrBqlsofTvRVI85T33qXIpWvuqWHXZIPgYALnQglWafaPgEqXICSIpraYWLZTi5CuhI3k9Iv X-Gm-Message-State: AOJu0YyR5xyXKFviTQ8P2uuGtU/CThqtzF+XjhWZBxao/1QEI/NugHZ/ LSVtnksl04LIYPRiufSjt8j31kM/jYtsxDvoVXel4SC6Rz7dLWLDUIaZxhIPTQ== X-Received: by 2002:a67:fad2:0:b0:47c:1c1b:59be with SMTP id g18-20020a67fad2000000b0047c1c1b59bemr446547vsq.33.1714073271249; Thu, 25 Apr 2024 12:27:51 -0700 (PDT) Received: from vertex.localdomain (pool-173-49-113-140.phlapa.fios.verizon.net. [173.49.113.140]) by smtp.gmail.com with ESMTPSA id b4-20020a0cf044000000b0069b1e2f3074sm7258689qvl.98.2024.04.25.12.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 12:27:50 -0700 (PDT) From: Zack Rusin To: dri-devel@lists.freedesktop.org Cc: Broadcom internal kernel review list , ian.forbes@broadcom.com, martin.krastev@broadcom.com, maaz.mombasawala@broadcom.com, Zack Rusin , zdi-disclosures@trendmicro.com, David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] drm/vmwgfx: Fix invalid reads in fence signaled events Date: Thu, 25 Apr 2024 15:27:48 -0400 Message-Id: <20240425192748.1761522-1-zack.rusin@broadcom.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Correctly set the length of the drm_event to the size of the structure that's actually used. The length of the drm_event was set to the parent structure instead of to the drm_vmw_event_fence which is supposed to be read. drm_read uses the length parameter to copy the event to the user space thus resuling in oob reads. Signed-off-by: Zack Rusin Fixes: 8b7de6aa8468 ("vmwgfx: Rework fence event action") Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-23566 Cc: David Airlie CC: Daniel Vetter Cc: Zack Rusin Cc: Broadcom internal kernel review list Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Cc: # v3.4+ --- drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c index 2a0cda324703..5efc6a766f64 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c @@ -991,7 +991,7 @@ static int vmw_event_fence_action_create(struct drm_file *file_priv, } event->event.base.type = DRM_VMW_EVENT_FENCE_SIGNALED; - event->event.base.length = sizeof(*event); + event->event.base.length = sizeof(event->event); event->event.user_data = user_data; ret = drm_event_reserve_init(dev, file_priv, &event->base, &event->event.base); -- 2.40.1