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 69A72C02198 for ; Tue, 18 Feb 2025 14:11:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1D47910E3BF; Tue, 18 Feb 2025 14:11:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pRpcnqxe"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5E76910E3BF for ; Tue, 18 Feb 2025 14:11:45 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 5ADD4A40C65; Tue, 18 Feb 2025 14:09:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68F12C4CEE2; Tue, 18 Feb 2025 14:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739887903; bh=/K+M0FzxWjpLP8ZASsmFSYGhXIy2q5oECud0hUmFuNs=; h=Subject:To:Cc:From:Date:From; b=pRpcnqxeU1uKWmija9Duttbhzt2Msc7rJdVoHpczi7gU2O5+76wUfct90eENqa6aU 6zrJODqqEH7yBABnbgWx5sDePA01ffOw4aEIvzvZuMmlN8zpOQ+LNE669qJX/Yxh7I eCqmUhblPGzOiouk6K8aYHbiU7b655dgAwKcP0V0= Subject: Patch "drm/xe/tracing: Fix a potential TP_printk UAF" has been added to the 6.13-stable tree To: gregkh@linuxfoundation.org, gustavo.sousa@intel.com, intel-xe@lists.freedesktop.org, jonathan.cavitt@intel.com, lucas.demarchi@intel.com, matthew.d.roper@intel.com, radhakrishna.sripada@intel.com, rodrigo.vivi@intel.com, thomas.hellstrom@linux.intel.com Cc: From: Date: Tue, 18 Feb 2025 15:11:14 +0100 Message-ID: <2025021814-aghast-bronze-6829@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" This is a note to let you know that I've just added the patch titled drm/xe/tracing: Fix a potential TP_printk UAF to the 6.13-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-xe-tracing-fix-a-potential-tp_printk-uaf.patch and it can be found in the queue-6.13 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From 07089083a526ea19daa72a1edf9d6e209615b77c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= Date: Mon, 23 Dec 2024 14:42:50 +0100 Subject: drm/xe/tracing: Fix a potential TP_printk UAF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Thomas Hellström commit 07089083a526ea19daa72a1edf9d6e209615b77c upstream. The commit afd2627f727b ("tracing: Check "%s" dereference via the field and not the TP_printk format") exposes potential UAFs in the xe_bo_move trace event. Fix those by avoiding dereferencing the xe_mem_type_to_name[] array at TP_printk time. Since some code refactoring has taken place, explicit backporting may be needed for kernels older than 6.10. Fixes: e46d3f813abd ("drm/xe/trace: Extract bo, vm, vma traces") Cc: Gustavo Sousa Cc: Lucas De Marchi Cc: Radhakrishna Sripada Cc: Matt Roper Cc: "Thomas Hellström" Cc: Rodrigo Vivi Cc: intel-xe@lists.freedesktop.org Cc: # v6.11+ Signed-off-by: Thomas Hellström Reviewed-by: Jonathan Cavitt Link: https://patchwork.freedesktop.org/patch/msgid/20241223134250.14345-1-thomas.hellstrom@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/xe/xe_trace_bo.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/gpu/drm/xe/xe_trace_bo.h +++ b/drivers/gpu/drm/xe/xe_trace_bo.h @@ -55,8 +55,8 @@ TRACE_EVENT(xe_bo_move, TP_STRUCT__entry( __field(struct xe_bo *, bo) __field(size_t, size) - __field(u32, new_placement) - __field(u32, old_placement) + __string(new_placement_name, xe_mem_type_to_name[new_placement]) + __string(old_placement_name, xe_mem_type_to_name[old_placement]) __string(device_id, __dev_name_bo(bo)) __field(bool, move_lacks_source) ), @@ -64,15 +64,15 @@ TRACE_EVENT(xe_bo_move, TP_fast_assign( __entry->bo = bo; __entry->size = bo->size; - __entry->new_placement = new_placement; - __entry->old_placement = old_placement; + __assign_str(new_placement_name); + __assign_str(old_placement_name); __assign_str(device_id); __entry->move_lacks_source = move_lacks_source; ), TP_printk("move_lacks_source:%s, migrate object %p [size %zu] from %s to %s device_id:%s", __entry->move_lacks_source ? "yes" : "no", __entry->bo, __entry->size, - xe_mem_type_to_name[__entry->old_placement], - xe_mem_type_to_name[__entry->new_placement], __get_str(device_id)) + __get_str(old_placement_name), + __get_str(new_placement_name), __get_str(device_id)) ); DECLARE_EVENT_CLASS(xe_vma, Patches currently in stable-queue which might be from thomas.hellstrom@linux.intel.com are queue-6.13/drm-xe-tracing-fix-a-potential-tp_printk-uaf.patch