Skip to contentSkip to conversation

arm64: make STACKPROTECTOR_PER_TASK configurable.

PATCH In review Michal Suchanek 3 participants 9 messages Mar 9, 2021 – Mar 10, 2021 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: make STACKPROTECTOR_PER_TASK configurable.

When using dummy-tools STACKPROTECTOR_PER_TASK is unconditionally selected. This defeats the purpose of the all-enabled tool.

Description copied from arm

---
 arch/arm64/Kconfig | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/Kconfig +12 -1
index a8ff7cd5f096..f59d391e31a4 100644
@@ -1549,9 +1549,20 @@ config RANDOMIZE_MODULE_REGION_FULL
 config CC_HAVE_STACKPROTECTOR_SYSREG
 	def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)
 
+
 config STACKPROTECTOR_PER_TASK
-	def_bool y
+	bool "Use a unique stack canary value for each task"
 	depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_SYSREG
+	default y
+	help
+	  Due to the fact that GCC uses an ordinary symbol reference from
+	  which to load the value of the stack canary, this value can only
+	  change at reboot time on SMP systems, and all tasks running in the
+	  kernel's address space are forced to use the same canary value for
+	  the entire duration that the system is up.
+
+	  Enable this option to switch to a different method that uses a
+	  different canary value for each task.
 
 endmenu
 
Signature · 1 line
2.26.2
#1 lore raw
Quoted 4 lines · Michal Suchanek

When using dummy-tools STACKPROTECTOR_PER_TASK is unconditionally selected. This defeats the purpose of the all-enabled tool.

What is dummy-tools and why should we care about it?

Quoted 42 lines

Description copied from arm

---
 arch/arm64/Kconfig | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/Kconfig +12 -2
index a8ff7cd5f096..f59d391e31a4 100644
@@ -1549,9 +1549,20 @@ config RANDOMIZE_MODULE_REGION_FULL
 config CC_HAVE_STACKPROTECTOR_SYSREG
        def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)
 
+
 config STACKPROTECTOR_PER_TASK
-       def_bool y
+       bool "Use a unique stack canary value for each task"
        depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_SYSREG
+       default y
+       help
+         Due to the fact that GCC uses an ordinary symbol reference from
+         which to load the value of the stack canary, this value can only
+         change at reboot time on SMP systems, and all tasks running in the
+         kernel's address space are forced to use the same canary value for
+         the entire duration that the system is up.
+
+         Enable this option to switch to a different method that uses a
+         different canary value for each task.
 
 endmenu
 
--

2.26.2

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw
In reply to Michal Suchanek
Quoted 8 lines · Michal Suchanek

When using dummy-tools STACKPROTECTOR_PER_TASK is unconditionally selected. This defeats the purpose of the all-enabled tool.

Description copied from arm

Could you explain what problem
this patch is trying to solve?

Quoted 33 lines
---
 arch/arm64/Kconfig | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/Kconfig +12 -2
index a8ff7cd5f096..f59d391e31a4 100644
@@ -1549,9 +1549,20 @@ config RANDOMIZE_MODULE_REGION_FULL
 config CC_HAVE_STACKPROTECTOR_SYSREG
        def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)
 
+
 config STACKPROTECTOR_PER_TASK
-       def_bool y
+       bool "Use a unique stack canary value for each task"
        depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_SYSREG
+       default y
+       help
+         Due to the fact that GCC uses an ordinary symbol reference from
+         which to load the value of the stack canary, this value can only
+         change at reboot time on SMP systems, and all tasks running in the
+         kernel's address space are forced to use the same canary value for
+         the entire duration that the system is up.
+
+         Enable this option to switch to a different method that uses a
+         different canary value for each task.
 
 endmenu
 
--

2.26.2

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw
Quoted 5 lines · Masahiro Yamada
Quoted 4 lines · Michal Suchanek

When using dummy-tools STACKPROTECTOR_PER_TASK is unconditionally selected. This defeats the purpose of the all-enabled tool.

Quoted 8 lines
Quoted 4 lines

Description copied from arm

Could you explain what problem
this patch is trying to solve?

The option cannot be disabled when compiler has the required capability.

Thanks

Michal

Quoted 40 lines
Quoted 35 lines

---
 arch/arm64/Kconfig | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/Kconfig +12 -2
index a8ff7cd5f096..f59d391e31a4 100644
@@ -1549,9 +1549,20 @@ config RANDOMIZE_MODULE_REGION_FULL
 config CC_HAVE_STACKPROTECTOR_SYSREG
        def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)
 
+
 config STACKPROTECTOR_PER_TASK
-       def_bool y
+       bool "Use a unique stack canary value for each task"
        depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_SYSREG
+       default y
+       help
+         Due to the fact that GCC uses an ordinary symbol reference from
+         which to load the value of the stack canary, this value can only
+         change at reboot time on SMP systems, and all tasks running in the
+         kernel's address space are forced to use the same canary value for
+         the entire duration that the system is up.
+
+         Enable this option to switch to a different method that uses a
+         different canary value for each task.
 
 endmenu
 
--

2.26.2

Signature · 2 lines
Best Regards
Masahiro Yamada
#4 lore raw
Quoted 9 lines · Michal Suchánek
Quoted 7 lines · Masahiro Yamada
Quoted 6 lines · Michal Suchanek

When using dummy-tools STACKPROTECTOR_PER_TASK is unconditionally selected. This defeats the purpose of the all-enabled tool.

Description copied from arm

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Could you explain what problem
this patch is trying to solve?

The option cannot be disabled when compiler has the required capability.

Yes.
Currently, this symbol claims "def_bool y",
so there is no way to disable it.

But, it comes from the nature of Kconfig in general.

dummy-tools is completely unrelated here.

Signature · 2 lines
Best Regards
Masahiro Yamada
#5 lore raw
Quoted 20 lines · Masahiro Yamada
Quoted 9 lines · Michal Suchánek
Quoted 7 lines · Masahiro Yamada
Quoted 6 lines · Michal Suchanek

When using dummy-tools STACKPROTECTOR_PER_TASK is unconditionally selected. This defeats the purpose of the all-enabled tool.

Description copied from arm

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Could you explain what problem
this patch is trying to solve?

The option cannot be disabled when compiler has the required capability.

Quoted 7 lines

Yes.
Currently, this symbol claims "def_bool y",
so there is no way to disable it.

But, it comes from the nature of Kconfig in general.

dummy-tools is completely unrelated here.

dummy-tools makes all configuration options available in order to be able to author configuration files on system different from the one where the kernel is built. This prevents authoring a configuration file with this option disabled.

Thanks

Michal

#6 lore raw
Quoted 26 lines · Michal Suchánek
Quoted 24 lines · Masahiro Yamada
Quoted 9 lines · Michal Suchánek
Quoted 7 lines · Masahiro Yamada
Quoted 6 lines · Michal Suchanek

When using dummy-tools STACKPROTECTOR_PER_TASK is unconditionally selected. This defeats the purpose of the all-enabled tool.

Description copied from arm

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Could you explain what problem
this patch is trying to solve?

The option cannot be disabled when compiler has the required capability.

Yes.
Currently, this symbol claims "def_bool y",
so there is no way to disable it.

Quoted 8 lines
Quoted 3 lines

But, it comes from the nature of Kconfig in general.

dummy-tools is completely unrelated here.

dummy-tools makes all configuration options available in order to be able to author configuration files on system different from the one where the kernel is built. This prevents authoring a configuration file with this option disabled.

No.
dummy-tools enables as many $(cc-option, ...) and $(shell, ...) as possible. That's it.

In my understanding, STACKPROTECTOR_PER_TASK should not be user-configurable.
That is why 'def_bool y'.

--
Best Regards
Masahiro Yamada

#7 lore raw
Quoted 37 lines · Masahiro Yamada
Quoted 26 lines · Michal Suchánek
Quoted 24 lines · Masahiro Yamada
Quoted 9 lines · Michal Suchánek
Quoted 7 lines · Masahiro Yamada
Quoted 6 lines · Michal Suchanek

When using dummy-tools STACKPROTECTOR_PER_TASK is unconditionally selected. This defeats the purpose of the all-enabled tool.

Description copied from arm

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Could you explain what problem
this patch is trying to solve?

The option cannot be disabled when compiler has the required capability.

Yes.
Currently, this symbol claims "def_bool y",
so there is no way to disable it.

Quoted 8 lines
Quoted 3 lines

But, it comes from the nature of Kconfig in general.

dummy-tools is completely unrelated here.

dummy-tools makes all configuration options available in order to be able to author configuration files on system different from the one where the kernel is built. This prevents authoring a configuration file with this option disabled.

Quoted 8 lines

No.
dummy-tools enables as many $(cc-option, ...) and $(shell, ...) as possible. That's it.

In my understanding, STACKPROTECTOR_PER_TASK should not be user-configurable.
That is why 'def_bool y'.

How do you author a specific configuration with dummy-tools when options are allowed to unconditionally follow these options that dummy-tools enables?

Thanks

Michal

#8 lore raw
In reply to Masahiro Yamada
Quoted 37 lines · Masahiro Yamada
Quoted 26 lines · Michal Suchánek
Quoted 24 lines · Masahiro Yamada
Quoted 9 lines · Michal Suchánek
Quoted 7 lines · Masahiro Yamada
Quoted 6 lines · Michal Suchanek

When using dummy-tools STACKPROTECTOR_PER_TASK is unconditionally selected. This defeats the purpose of the all-enabled tool.

Description copied from arm

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Could you explain what problem
this patch is trying to solve?

The option cannot be disabled when compiler has the required capability.

Yes.
Currently, this symbol claims "def_bool y",
so there is no way to disable it.

Quoted 8 lines
Quoted 3 lines

But, it comes from the nature of Kconfig in general.

dummy-tools is completely unrelated here.

dummy-tools makes all configuration options available in order to be able to author configuration files on system different from the one where the kernel is built. This prevents authoring a configuration file with this option disabled.

Quoted 8 lines

No.
dummy-tools enables as many $(cc-option, ...) and $(shell, ...) as possible. That's it.

In my understanding, STACKPROTECTOR_PER_TASK should not be user-configurable.
That is why 'def_bool y'.

And that's wrong. Either it's a required copiler feature and then it should be always enabled. Or it is optional and then it should be possible to disable - one or the other.

When it is optional you should be able to

- (de) select in randconfig
- test/bisect the old code path without crippling your toolchain
- author configuration file that does not have the option enabled for build on system that uses older toolchain

Thanks

Michal