Skip to content

Commit e688ba3

Browse files
nathanchancealexdeucher
authored andcommitted
drm/amdkfd: Fix type of reset_type parameter in hqd_destroy() callback
When booting a kernel compiled with CONFIG_CFI_CLANG on a machine with an RX 6700 XT, there is a CFI failure in kfd_destroy_mqd_cp(): [ 12.894543] CFI failure at kfd_destroy_mqd_cp+0x2a/0x40 [amdgpu] (target: hqd_destroy_v10_3+0x0/0x260 [amdgpu]; expected type: 0x8594d794) Clang's kernel Control Flow Integrity (kCFI) makes sure that all indirect call targets have a type that exactly matches the function pointer prototype. In this case, hqd_destroy()'s third parameter, reset_type, should have a type of 'uint32_t' but every implementation of this callback has a third parameter type of 'enum kfd_preempt_type'. Update the function pointer prototype to match reality so that there is no more CFI violation. Link: ClangBuiltLinux#1738 Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 8a70b2d commit e688ba3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpu/drm/amd/include/kgd_kfd_interface.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,9 @@ struct kfd2kgd_calls {
262262
uint32_t queue_id);
263263

264264
int (*hqd_destroy)(struct amdgpu_device *adev, void *mqd,
265-
uint32_t reset_type, unsigned int timeout,
266-
uint32_t pipe_id, uint32_t queue_id);
265+
enum kfd_preempt_type reset_type,
266+
unsigned int timeout, uint32_t pipe_id,
267+
uint32_t queue_id);
267268

268269
bool (*hqd_sdma_is_occupied)(struct amdgpu_device *adev, void *mqd);
269270

0 commit comments

Comments
 (0)