Skip to contentSkip to conversation

arm64: remove redundant 'if HAVE_ARCH_KASAN' in Kconfig

PATCH Superseded Masahiro Yamada 4 participants 9 messages Jul 14, 2024 – Jul 15, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: remove redundant 'if HAVE_ARCH_KASAN' in Kconfig

The condition 'select HAVE_ARCH_KASAN' is always true because there is 'select HAVE_ARCH_KASAN' statement above.

---

 arch/arm64/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/Kconfig +3 -3
index c87d16b12e9b..d37cbfc3031e 100644
@@ -167,9 +167,9 @@ config ARM64
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE
 	select HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
+	select HAVE_ARCH_KASAN_VMALLOC
+	select HAVE_ARCH_KASAN_SW_TAGS
+	select HAVE_ARCH_KASAN_HW_TAGS if ARM64_MTE
 	# Some instrumentation may be unsound, hence EXPERT
 	select HAVE_ARCH_KCSAN if EXPERT
 	select HAVE_ARCH_KFENCE
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Masahiro Yamada

The condition 'select HAVE_ARCH_KASAN' is always true because there is 'select HAVE_ARCH_KASAN' statement above.

Thanks.

Quoted 22 lines

---

 arch/arm64/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/Kconfig +3 -3
index c87d16b12e9b..d37cbfc3031e 100644
@@ -167,9 +167,9 @@ config ARM64
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE
 	select HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
+	select HAVE_ARCH_KASAN_VMALLOC
+	select HAVE_ARCH_KASAN_SW_TAGS
+	select HAVE_ARCH_KASAN_HW_TAGS if ARM64_MTE
 	# Some instrumentation may be unsound, hence EXPERT
 	select HAVE_ARCH_KCSAN if EXPERT
 	select HAVE_ARCH_KFENCE
Signature · 1 line
~Randy
#2 lore raw
In reply to Masahiro Yamada
Quoted 28 lines · Masahiro Yamada

The condition 'select HAVE_ARCH_KASAN' is always true because there is 'select HAVE_ARCH_KASAN' statement above.

---

 arch/arm64/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/Kconfig +3 -4
index c87d16b12e9b..d37cbfc3031e 100644
@@ -167,9 +167,9 @@ config ARM64
        select HAVE_ARCH_JUMP_LABEL
        select HAVE_ARCH_JUMP_LABEL_RELATIVE
        select HAVE_ARCH_KASAN
-       select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
-       select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
-       select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
+       select HAVE_ARCH_KASAN_VMALLOC
+       select HAVE_ARCH_KASAN_SW_TAGS
+       select HAVE_ARCH_KASAN_HW_TAGS if ARM64_MTE
        # Some instrumentation may be unsound, hence EXPERT
        select HAVE_ARCH_KCSAN if EXPERT
        select HAVE_ARCH_KFENCE
--
Quoted 2 lines

2.43.0

I expect this patch will go through the arm64 tree.

(I just sent it to the kbuild ML by mistake)

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw
In reply to Masahiro Yamada
Quoted 2 lines · Masahiro Yamada

The condition 'select HAVE_ARCH_KASAN' is always true because

This is a typo.

I meant,
The condition 'if HAVE_ARCH_KASAN' is always true because

Quoted 26 lines

there is 'select HAVE_ARCH_KASAN' statement above.

---

 arch/arm64/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/Kconfig +3 -4
index c87d16b12e9b..d37cbfc3031e 100644
@@ -167,9 +167,9 @@ config ARM64
        select HAVE_ARCH_JUMP_LABEL
        select HAVE_ARCH_JUMP_LABEL_RELATIVE
        select HAVE_ARCH_KASAN
-       select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
-       select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
-       select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
+       select HAVE_ARCH_KASAN_VMALLOC
+       select HAVE_ARCH_KASAN_SW_TAGS
+       select HAVE_ARCH_KASAN_HW_TAGS if ARM64_MTE
        # Some instrumentation may be unsound, hence EXPERT
        select HAVE_ARCH_KCSAN if EXPERT
        select HAVE_ARCH_KFENCE
--
Quoted 2 lines

2.43.0

--
Best Regards
Masahiro Yamada

#4 lore raw
In reply to Masahiro Yamada
Quoted 16 lines · Masahiro Yamada

The condition 'select HAVE_ARCH_KASAN' is always true because there is 'select HAVE_ARCH_KASAN' statement above.

---

 arch/arm64/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/Kconfig +0 -0
index c87d16b12e9b..d37cbfc3031e 100644
@@ -167,9 +167,9 @@ config ARM64
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE

arch/arm64/Kconfig config ARM64 · line 175

Quoted 10 lines
arch/arm64/Kconfig +3 -3
 	select HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
+	select HAVE_ARCH_KASAN_VMALLOC
+	select HAVE_ARCH_KASAN_SW_TAGS
+	select HAVE_ARCH_KASAN_HW_TAGS if ARM64_MTE
 	# Some instrumentation may be unsound, hence EXPERT
 	select HAVE_ARCH_KCSAN if EXPERT
 	select HAVE_ARCH_KFENCE

There is another similar instance with HAVE_FUNCTION_GRAPH_TRACER as well. Just wondering if the following change should be folded in here ?

arch/arm64/Kconfig +1 -1
@@ -210,8 +210,8 @@ config ARM64
        select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_TRACER
        select HAVE_FUNCTION_ERROR_INJECTION
-       select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_GRAPH_TRACER
+       select HAVE_FUNCTION_GRAPH_RETVAL
        select HAVE_GCC_PLUGINS
        select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && \
                HW_PERF_EVENTS && HAVE_PERF_EVENTS_NMI
reviewer Acked-by on v1 1/1
#7 lore raw
In reply to Masahiro Yamada
Quoted 4 lines · Masahiro Yamada

The condition 'select HAVE_ARCH_KASAN' is always true because there is 'select HAVE_ARCH_KASAN' statement above.

Looks like we forgot to simplify this in commit:

0383808e4d99ac31 ("arm64: kasan: Reduce minimum shadow alignment and enable 5 level paging")

... where we began selecting HAVE_ARCH_KASAN unconditionally.

FWIW:

Mark.

Quoted 26 lines

---

 arch/arm64/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/Kconfig +3 -3
index c87d16b12e9b..d37cbfc3031e 100644
@@ -167,9 +167,9 @@ config ARM64
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE
 	select HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
+	select HAVE_ARCH_KASAN_VMALLOC
+	select HAVE_ARCH_KASAN_SW_TAGS
+	select HAVE_ARCH_KASAN_HW_TAGS if ARM64_MTE
 	# Some instrumentation may be unsound, hence EXPERT
 	select HAVE_ARCH_KCSAN if EXPERT
 	select HAVE_ARCH_KFENCE
Signature · 1 line
2.43.0
reviewer
#5 lore raw
In reply to Anshuman Khandual
Quoted 34 lines · Anshuman Khandual
Quoted 16 lines · Masahiro Yamada

The condition 'select HAVE_ARCH_KASAN' is always true because there is 'select HAVE_ARCH_KASAN' statement above.

---

 arch/arm64/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/Kconfig +0 -0
index c87d16b12e9b..d37cbfc3031e 100644
@@ -167,9 +167,9 @@ config ARM64
 	select HAVE_ARCH_JUMP_LABEL
 	select HAVE_ARCH_JUMP_LABEL_RELATIVE

arch/arm64/Kconfig config ARM64 · line 175

Quoted 10 lines
arch/arm64/Kconfig +3 -3
 	select HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
-	select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
+	select HAVE_ARCH_KASAN_VMALLOC
+	select HAVE_ARCH_KASAN_SW_TAGS
+	select HAVE_ARCH_KASAN_HW_TAGS if ARM64_MTE
 	# Some instrumentation may be unsound, hence EXPERT
 	select HAVE_ARCH_KCSAN if EXPERT
 	select HAVE_ARCH_KFENCE

There is another similar instance with HAVE_FUNCTION_GRAPH_TRACER as well. Just wondering if the following change should be folded in here ?

arch/arm64/Kconfig config ARM64 · line 217

Quoted 9 lines
arch/arm64/Kconfig +1 -1
@@ -210,8 +210,8 @@ config ARM64
        select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_TRACER
        select HAVE_FUNCTION_ERROR_INJECTION
-       select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_GRAPH_TRACER
+       select HAVE_FUNCTION_GRAPH_RETVAL
        select HAVE_GCC_PLUGINS
        select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && \
                HW_PERF_EVENTS && HAVE_PERF_EVENTS_NMI

That looks like a sensible cleanup, but I think it'd be better as a separate patch.

It looks like that has always been redundant since it was introduced in commit

3646970322464c21 ("arm64: ftrace: Enable HAVE_FUNCTION_GRAPH_RETVAL")

... would you mind spinning a patch?

Mark.

#8 lore raw
In reply to Mark Rutland
Quoted 5 lines · Mark Rutland
Quoted 3 lines · Masahiro Yamada

The condition 'select HAVE_ARCH_KASAN' is always true because there is 'select HAVE_ARCH_KASAN' statement above.

Quoted 7 lines
Quoted 1 line

Looks like we forgot to simplify this in commit:

0383808e4d99ac31 ("arm64: kasan: Reduce minimum shadow alignment and enable 5 level paging")

... where we began selecting HAVE_ARCH_KASAN unconditionally.

Good point. This may be worth recording in the description.

I will send v2 with a typo fixed.

Thanks.

Quoted 34 lines

FWIW:

Mark.

Quoted 26 lines

---

 arch/arm64/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/Kconfig +3 -4
index c87d16b12e9b..d37cbfc3031e 100644
@@ -167,9 +167,9 @@ config ARM64
      select HAVE_ARCH_JUMP_LABEL
      select HAVE_ARCH_JUMP_LABEL_RELATIVE
      select HAVE_ARCH_KASAN
-     select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
-     select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
-     select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
+     select HAVE_ARCH_KASAN_VMALLOC
+     select HAVE_ARCH_KASAN_SW_TAGS
+     select HAVE_ARCH_KASAN_HW_TAGS if ARM64_MTE
      # Some instrumentation may be unsound, hence EXPERT
      select HAVE_ARCH_KCSAN if EXPERT
      select HAVE_ARCH_KFENCE
--

2.43.0

Signature · 2 lines
Best Regards
Masahiro Yamada
#6 lore raw
In reply to Mark Rutland
Quoted 49 lines · Mark Rutland
Quoted 34 lines · Anshuman Khandual
Quoted 16 lines · Masahiro Yamada

The condition 'select HAVE_ARCH_KASAN' is always true because there is 'select HAVE_ARCH_KASAN' statement above.

---

 arch/arm64/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/Kconfig +0 -0
index c87d16b12e9b..d37cbfc3031e 100644
@@ -167,9 +167,9 @@ config ARM64
    select HAVE_ARCH_JUMP_LABEL
    select HAVE_ARCH_JUMP_LABEL_RELATIVE

arch/arm64/Kconfig config ARM64 · line 175

Quoted 10 lines
arch/arm64/Kconfig +3 -3
    select HAVE_ARCH_KASAN
-   select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
-   select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
-   select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
+   select HAVE_ARCH_KASAN_VMALLOC
+   select HAVE_ARCH_KASAN_SW_TAGS
+   select HAVE_ARCH_KASAN_HW_TAGS if ARM64_MTE
    # Some instrumentation may be unsound, hence EXPERT
    select HAVE_ARCH_KCSAN if EXPERT
    select HAVE_ARCH_KFENCE

There is another similar instance with HAVE_FUNCTION_GRAPH_TRACER as well. Just wondering if the following change should be folded in here ?

arch/arm64/Kconfig config ARM64 · line 217

Quoted 9 lines
arch/arm64/Kconfig +1 -1
@@ -210,8 +210,8 @@ config ARM64
        select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_TRACER
        select HAVE_FUNCTION_ERROR_INJECTION
-       select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_GRAPH_TRACER
+       select HAVE_FUNCTION_GRAPH_RETVAL
        select HAVE_GCC_PLUGINS
        select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && \
                HW_PERF_EVENTS && HAVE_PERF_EVENTS_NMI

That looks like a sensible cleanup, but I think it'd be better as a separate patch.

Quoted 8 lines

It looks like that has always been redundant since it was introduced in commit

3646970322464c21 ("arm64: ftrace: Enable HAVE_FUNCTION_GRAPH_RETVAL")

... would you mind spinning a patch?

Mark.

Agree.

We can have a separate patch.

I can see more redundant 'if' and 'depends on'.

For example, KERNEL_MODE_NEON is always 'y'.

config KERNEL_MODE_NEON
def_bool y

So, I can see redundancy in

select ARCH_HAS_KERNEL_FPU_SUPPORT if KERNEL_MODE_NEON

and

config EFI
bool "UEFI runtime support"
depends on OF && !CPU_BIG_ENDIAN
depends on KERNEL_MODE_NEON

Signature · 2 lines
Best Regards
Masahiro Yamada