* [PATCH] drm/amdkfd: Fix type of reset_type parameter in hqd_destroy() callback
@ 2022-10-17 16:28 ` Nathan Chancellor
0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2022-10-17 16:28 UTC (permalink / raw)
To: Felix Kuehling, Alex Deucher, Christian König, Pan, Xinhui
Cc: Kees Cook, Tom Rix, llvm, Nick Desaulniers, patches, dri-devel,
Nathan Chancellor, amd-gfx, Sami Tolvanen
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: https://github.com/ClangBuiltLinux/linux/issues/1738
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
No Fixes tag, as I could not pin down exactly when this started. I
suspect it is
Fixes: 70539bd79500 ("drm/amd: Update MEC HQD loading code for KFD")
but I did not want to add that without a second look. Feel free to add
it during patch application if it makes sense.
drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
index e85364dff4e0..5cb3e8634739 100644
--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
@@ -262,8 +262,9 @@ struct kfd2kgd_calls {
uint32_t queue_id);
int (*hqd_destroy)(struct amdgpu_device *adev, void *mqd,
- uint32_t reset_type, unsigned int timeout,
- uint32_t pipe_id, uint32_t queue_id);
+ enum kfd_preempt_type reset_type,
+ unsigned int timeout, uint32_t pipe_id,
+ uint32_t queue_id);
bool (*hqd_sdma_is_occupied)(struct amdgpu_device *adev, void *mqd);
base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
--
2.38.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] drm/amdkfd: Fix type of reset_type parameter in hqd_destroy() callback
@ 2022-10-17 16:28 ` Nathan Chancellor
0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2022-10-17 16:28 UTC (permalink / raw)
To: Felix Kuehling, Alex Deucher, Christian König, Pan, Xinhui
Cc: Nick Desaulniers, Tom Rix, Kees Cook, Sami Tolvanen, amd-gfx,
dri-devel, llvm, patches, Nathan Chancellor
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: https://github.com/ClangBuiltLinux/linux/issues/1738
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
No Fixes tag, as I could not pin down exactly when this started. I
suspect it is
Fixes: 70539bd79500 ("drm/amd: Update MEC HQD loading code for KFD")
but I did not want to add that without a second look. Feel free to add
it during patch application if it makes sense.
drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
index e85364dff4e0..5cb3e8634739 100644
--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
@@ -262,8 +262,9 @@ struct kfd2kgd_calls {
uint32_t queue_id);
int (*hqd_destroy)(struct amdgpu_device *adev, void *mqd,
- uint32_t reset_type, unsigned int timeout,
- uint32_t pipe_id, uint32_t queue_id);
+ enum kfd_preempt_type reset_type,
+ unsigned int timeout, uint32_t pipe_id,
+ uint32_t queue_id);
bool (*hqd_sdma_is_occupied)(struct amdgpu_device *adev, void *mqd);
base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
--
2.38.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdkfd: Fix type of reset_type parameter in hqd_destroy() callback
2022-10-17 16:28 ` Nathan Chancellor
@ 2022-10-17 16:56 ` Alex Deucher
-1 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2022-10-17 16:56 UTC (permalink / raw)
To: Nathan Chancellor
Cc: llvm, Kees Cook, Tom Rix, Felix Kuehling, Pan, Xinhui,
Nick Desaulniers, patches, dri-devel, amd-gfx, Sami Tolvanen,
Alex Deucher, Christian König
Applied. Thanks!
Alex
On Mon, Oct 17, 2022 at 12:30 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> 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: https://github.com/ClangBuiltLinux/linux/issues/1738
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> No Fixes tag, as I could not pin down exactly when this started. I
> suspect it is
>
> Fixes: 70539bd79500 ("drm/amd: Update MEC HQD loading code for KFD")
>
> but I did not want to add that without a second look. Feel free to add
> it during patch application if it makes sense.
>
> drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
> index e85364dff4e0..5cb3e8634739 100644
> --- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
> +++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
> @@ -262,8 +262,9 @@ struct kfd2kgd_calls {
> uint32_t queue_id);
>
> int (*hqd_destroy)(struct amdgpu_device *adev, void *mqd,
> - uint32_t reset_type, unsigned int timeout,
> - uint32_t pipe_id, uint32_t queue_id);
> + enum kfd_preempt_type reset_type,
> + unsigned int timeout, uint32_t pipe_id,
> + uint32_t queue_id);
>
> bool (*hqd_sdma_is_occupied)(struct amdgpu_device *adev, void *mqd);
>
>
> base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
> --
> 2.38.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdkfd: Fix type of reset_type parameter in hqd_destroy() callback
@ 2022-10-17 16:56 ` Alex Deucher
0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2022-10-17 16:56 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Felix Kuehling, Alex Deucher, Christian König, Pan, Xinhui,
Kees Cook, Tom Rix, llvm, Nick Desaulniers, patches, dri-devel,
amd-gfx, Sami Tolvanen
Applied. Thanks!
Alex
On Mon, Oct 17, 2022 at 12:30 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> 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: https://github.com/ClangBuiltLinux/linux/issues/1738
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> No Fixes tag, as I could not pin down exactly when this started. I
> suspect it is
>
> Fixes: 70539bd79500 ("drm/amd: Update MEC HQD loading code for KFD")
>
> but I did not want to add that without a second look. Feel free to add
> it during patch application if it makes sense.
>
> drivers/gpu/drm/amd/include/kgd_kfd_interface.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
> index e85364dff4e0..5cb3e8634739 100644
> --- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
> +++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
> @@ -262,8 +262,9 @@ struct kfd2kgd_calls {
> uint32_t queue_id);
>
> int (*hqd_destroy)(struct amdgpu_device *adev, void *mqd,
> - uint32_t reset_type, unsigned int timeout,
> - uint32_t pipe_id, uint32_t queue_id);
> + enum kfd_preempt_type reset_type,
> + unsigned int timeout, uint32_t pipe_id,
> + uint32_t queue_id);
>
> bool (*hqd_sdma_is_occupied)(struct amdgpu_device *adev, void *mqd);
>
>
> base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780
> --
> 2.38.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-10-17 16:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17 16:28 [PATCH] drm/amdkfd: Fix type of reset_type parameter in hqd_destroy() callback Nathan Chancellor
2022-10-17 16:28 ` Nathan Chancellor
2022-10-17 16:56 ` Alex Deucher
2022-10-17 16:56 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.