[PATCH] bpf, btf: switch CONFIG_CFI_CLANG to CONFIG_CFI

Carlos Llamas posted 1 patch 3 weeks, 4 days ago
kernel/bpf/btf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] bpf, btf: switch CONFIG_CFI_CLANG to CONFIG_CFI
Posted by Carlos Llamas 3 weeks, 4 days ago
This was renamed in commit 23ef9d439769 ("kcfi: Rename CONFIG_CFI_CLANG
to CONFIG_CFI") as it is now a compiler-agnostic option. Using the wrong
name results in the code getting compiled out. Meaning the CFI failures
for btf_dtor_kfunc_t would still trigger.

Fixes: 99fde4d06261 ("bpf, btf: Enforce destructor kfunc type with CFI")
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
 kernel/bpf/btf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 4872d2a6c42d..84665f76a3c6 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -9003,7 +9003,7 @@ static int btf_check_dtor_kfuncs(struct btf *btf, const struct btf_id_dtor_kfunc
 		if (!t || !btf_type_is_ptr(t))
 			return -EINVAL;
 
-		if (IS_ENABLED(CONFIG_CFI_CLANG)) {
+		if (IS_ENABLED(CONFIG_CFI)) {
 			/* Ensure the destructor kfunc type matches btf_dtor_kfunc_t */
 			t = btf_type_by_id(btf, t->type);
 			if (!btf_type_is_void(t))
-- 
2.53.0.880.g73c4285caa-goog
Re: [PATCH] bpf, btf: switch CONFIG_CFI_CLANG to CONFIG_CFI
Posted by Yonghong Song 3 weeks, 4 days ago

On 3/12/26 11:38 AM, Carlos Llamas wrote:
> This was renamed in commit 23ef9d439769 ("kcfi: Rename CONFIG_CFI_CLANG
> to CONFIG_CFI") as it is now a compiler-agnostic option. Using the wrong
> name results in the code getting compiled out. Meaning the CFI failures
> for btf_dtor_kfunc_t would still trigger.
>
> Fixes: 99fde4d06261 ("bpf, btf: Enforce destructor kfunc type with CFI")
> Signed-off-by: Carlos Llamas <cmllamas@google.com>

Acked-by: Yonghong Song <yonghong.song@linux.dev>
Re: [PATCH] bpf, btf: switch CONFIG_CFI_CLANG to CONFIG_CFI
Posted by Sami Tolvanen 3 weeks, 4 days ago
Hi Carlos,

On Thu, Mar 12, 2026 at 11:38 AM Carlos Llamas <cmllamas@google.com> wrote:
>
> This was renamed in commit 23ef9d439769 ("kcfi: Rename CONFIG_CFI_CLANG
> to CONFIG_CFI") as it is now a compiler-agnostic option. Using the wrong
> name results in the code getting compiled out. Meaning the CFI failures
> for btf_dtor_kfunc_t would still trigger.
>
> Fixes: 99fde4d06261 ("bpf, btf: Enforce destructor kfunc type with CFI")
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
> ---
>  kernel/bpf/btf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 4872d2a6c42d..84665f76a3c6 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -9003,7 +9003,7 @@ static int btf_check_dtor_kfuncs(struct btf *btf, const struct btf_id_dtor_kfunc
>                 if (!t || !btf_type_is_ptr(t))
>                         return -EINVAL;
>
> -               if (IS_ENABLED(CONFIG_CFI_CLANG)) {
> +               if (IS_ENABLED(CONFIG_CFI)) {
>                         /* Ensure the destructor kfunc type matches btf_dtor_kfunc_t */
>                         t = btf_type_by_id(btf, t->type);
>                         if (!btf_type_is_void(t))

Thanks for the fix!

Reviewed-by: Sami Tolvanen <samitolvanen@google.com>

Sami