Matthew Brost
75cbe49f9e
drm/xe: Fix UBSAN splat in add_preempt_fences()
add_preempt_fences() calls dma_resv_reserve_fences() with num_fences ==
0 resulting in the below UBSAN splat. Short circuit add_preempt_fences()
if num_fences == 0.
[ 58.652241] ================================================================================
[ 58.660736] UBSAN: shift-out-of-bounds in ./include/linux/log2.h:57:13
[ 58.667281] shift exponent 64 is too large for 64-bit type 'long unsigned int'
[ 58.674539] CPU: 2 PID: 1170 Comm: xe_gpgpu_fill Not tainted 6.6.0-rc3-guc+ #630
[ 58.674545] Hardware name: Intel Corporation Tiger Lake Client Platform/TigerLake U DDR4 SODIMM RVP, BIOS TGLSFWI1.R00.3243.A01.2006102133 06/10/2020
[ 58.674547] Call Trace:
[ 58.674548] <TASK>
[ 58.674550] dump_stack_lvl+0x92/0xb0
[ 58.674555] __ubsan_handle_shift_out_of_bounds+0x15a/0x300
[ 58.674559] ? rcu_is_watching+0x12/0x60
[ 58.674564] ? software_resume+0x141/0x210
[ 58.674575] ? new_vma+0x44b/0x600 [xe]
[ 58.674606] dma_resv_reserve_fences.cold+0x40/0x66
[ 58.674612] new_vma+0x4b3/0x600 [xe]
[ 58.674638] xe_vm_bind_ioctl+0xffd/0x1e00 [xe]
[ 58.674663] ? __pfx_xe_vm_bind_ioctl+0x10/0x10 [xe]
[ 58.674680] drm_ioctl_kernel+0xc1/0x170
[ 58.674686] ? __pfx_xe_vm_bind_ioctl+0x10/0x10 [xe]
[ 58.674703] drm_ioctl+0x247/0x4c0
[ 58.674709] ? find_held_lock+0x2b/0x80
[ 58.674716] __x64_sys_ioctl+0x8c/0xb0
[ 58.674720] do_syscall_64+0x3c/0x90
[ 58.674723] entry_SYSCALL_64_after_hwframe+0x6e/0xd8
[ 58.674727] RIP: 0033:0x7fce4bd1aaff
[ 58.674730] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 77 1f 48 8b 44 24 18 64 48 2b 04 25 28 00
[ 58.674731] RSP: 002b:00007ffc57434050 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 58.674734] RAX: ffffffffffffffda RBX: 00007ffc574340e0 RCX: 00007fce4bd1aaff
[ 58.674736] RDX: 00007ffc574340e0 RSI: 0000000040886445 RDI: 0000000000000003
[ 58.674737] RBP: 0000000040886445 R08: 0000000000000002 R09: 00007ffc574341b0
[ 58.674739] R10: 000055de43eb3780 R11: 0000000000000246 R12: 00007ffc574340e0
[ 58.674740] R13: 0000000000000003 R14: 00007ffc574341b0 R15: 0000000000000001
[ 58.674747] </TASK>
[ 58.674748] ================================================================================
Fixes: dd08ebf6c3 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20231215230203.719244-1-matthew.brost@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2023-12-26 12:51:41 -05:00
..
2023-12-19 11:09:44 +02:00
2023-10-05 13:34:05 +02:00
2023-12-07 21:38:21 +01:00
2023-10-17 13:37:35 -05:00
2023-11-03 14:51:08 -10:00
2023-12-02 06:27:20 +09:00
2023-11-02 14:05:18 -10:00
2023-11-29 12:20:44 +01:00
2023-12-09 12:44:10 -08:00
2023-11-21 07:42:04 -07:00
2023-10-23 11:04:51 -07:00
2023-11-01 14:46:51 -10:00
2023-10-26 09:42:37 +02:00
2023-10-02 20:04:58 -06:00
2023-11-03 14:51:08 -10:00
2023-12-06 10:08:41 +01:00
2023-11-01 14:46:51 -10:00
2023-11-10 09:23:17 -08:00
2023-10-05 13:34:05 +02:00
2023-10-24 10:53:45 +02:00
2023-10-02 13:13:15 +02:00
2023-11-29 22:04:15 +01:00
2023-09-29 14:48:31 -07:00
2023-10-27 18:04:29 +08:00
2023-11-02 14:09:01 -07:00
2023-11-02 19:38:47 -10:00
2023-10-19 21:21:16 +09:00
2023-11-03 18:56:51 -10:00
2023-12-12 13:06:29 +09:00
2023-11-21 17:41:20 -08:00
2023-10-30 19:09:55 -10:00
2023-10-17 17:38:57 +09:00
2023-12-03 09:03:07 +09:00
2023-12-08 08:58:39 -08:00
2023-11-03 14:51:08 -10:00
2023-12-01 10:44:48 +01:00
2023-12-26 12:51:41 -05:00
2023-12-05 09:10:01 +09:00
2023-11-29 12:20:25 +01:00
2023-10-31 18:32:51 -10:00
2023-11-03 15:44:25 -10:00
2023-12-08 10:36:02 -08:00
2023-11-16 10:00:14 +00:00
2023-11-13 12:43:42 -05:00
2023-11-04 16:25:36 -10:00
2023-10-07 11:33:28 +02:00
2023-11-03 14:51:08 -10:00
2023-12-04 20:02:41 -04:00
2023-11-09 14:18:42 -08:00
2023-10-19 00:50:03 +03:00
2023-12-05 06:54:52 +09:00
2023-11-19 13:49:32 -08:00
2023-10-30 19:09:55 -10:00
2023-12-06 07:36:55 -08:00
2023-11-03 10:07:39 -10:00
2023-11-05 18:45:32 -08:00
2023-10-21 23:04:02 +02:00
2023-12-08 12:36:45 -08:00
2023-12-12 13:06:29 +09:00
2023-11-09 13:37:28 -08:00
2023-09-27 12:13:18 +02:00
2023-10-24 22:36:39 -04:00
2023-11-02 14:40:51 -10:00
2023-11-27 13:38:29 +00:00
2023-11-23 18:04:17 +01:00
2023-11-10 09:19:46 -08:00
2023-12-07 10:03:17 -08:00
2023-11-22 10:55:48 +00:00
2023-10-18 09:48:05 -07:00
2023-12-07 08:53:20 -08:00
2023-12-07 11:19:32 +09:00
2023-12-07 12:22:36 -08:00
2023-10-17 11:11:28 +05:30
2023-11-18 18:59:30 +01:00
2023-12-07 11:10:44 +09:00
2023-11-04 16:20:36 -10:00
2023-11-07 16:40:42 -08:00
2023-11-10 12:22:14 -08:00
2023-12-04 16:07:29 +02:00
2023-11-24 10:39:20 +01:00
2023-12-13 15:22:29 -05:00
2023-12-02 09:01:00 +09:00
2023-10-20 19:50:40 +02:00
2023-11-03 16:00:42 -10:00
2023-12-05 20:51:24 +01:00
2023-11-13 20:51:37 -08:00
2023-11-21 11:09:32 +01:00
2023-10-05 13:51:35 +02:00
2023-10-30 13:14:27 +00:00
2023-10-16 11:24:34 -06:00
2023-10-24 14:10:04 -07:00
2023-10-23 13:11:07 -06:00
2023-11-05 18:49:40 -08:00
2023-11-23 17:40:15 -08:00
2023-12-05 20:38:26 -05:00
2023-10-25 16:50:11 +02:00
2023-12-04 16:07:29 +02:00
2023-11-03 19:10:41 -10:00
2023-11-10 11:44:38 -08:00
2023-11-01 10:02:18 +00:00
2023-10-19 10:26:26 +03:00
2023-11-29 12:20:41 +01:00
2023-11-02 15:13:50 -10:00
2023-12-06 16:15:26 +01:00
2023-10-31 15:28:37 -10:00
2023-11-17 13:05:57 +02:00
2023-12-07 10:48:56 +09:00
2023-11-24 20:35:24 -05:00
2023-12-19 17:07:32 +10:00
2023-12-01 09:55:01 -05:00
2023-11-27 09:29:03 -07:00
2023-11-16 07:39:37 -05:00
2023-11-29 12:20:53 +01:00
2023-11-04 15:58:13 -10:00
2023-11-16 07:39:37 -05:00
2023-10-21 19:19:06 +02:00
2023-11-10 09:19:46 -08:00
2023-11-28 12:48:27 +01:00
2023-11-10 09:19:46 -08:00
2023-11-10 09:19:46 -08:00