Skip to contentSkip to conversation

Config.in: disable Fortify Source for microblaze

PATCH Applied Romain Naour 4 participants 7 messages Aug 20, 2021 – Sep 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Config.in: disable Fortify Source for microblaze

As reported by Toolchain-builder project [1], the system doesn't boot when Fortify Source is enabled for glibc based toolchain (the init process hang).

Also, hardening features may not be wanted or possible for such slow soft-core cpus [2].

[1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
[2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html

Cc Thomas Petazzoni <[email protected]>
Cc Giulio Benetti <[email protected]>

---
With BR2_RELRO_PARTIAL enabled, the system boot.

---
 Config.in | 7 +++++++
 1 file changed, 7 insertions(+)
Config.in +7 -0
index 2ef5d407e4..84f7fa6e8d 100644
@@ -853,9 +853,16 @@ endchoice
 comment "RELocation Read Only (RELRO) needs shared libraries"
 	depends on !BR2_SHARED_LIBS
 
+config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
+	bool
+	default y
+	# Microblaze glibc toolchains don't work with Fortify Source enabled
+	depends on !BR2_microblaze
+
 choice
 	bool "Buffer-overflow Detection (FORTIFY_SOURCE)"
 	default BR2_FORTIFY_SOURCE_1
+	depends on BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_USES_GLIBC
 	depends on !BR2_OPTIMIZE_0
 	help
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
#1 lore raw

Hi Romain, All,

Quoted 24 lines · Romain Naour

As reported by Toolchain-builder project [1], the system doesn't boot when Fortify Source is enabled for glibc based toolchain (the init process hang).

Also, hardening features may not be wanted or possible for such slow soft-core cpus [2].

[1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
[2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html

Cc Thomas Petazzoni <[email protected]>
Cc Giulio Benetti <[email protected]>

---
With BR2_RELRO_PARTIAL enabled, the system boot.

---
  Config.in | 7 +++++++
  1 file changed, 7 insertions(+)
Config.in +0 -0
index 2ef5d407e4..84f7fa6e8d 100644

Config.in endchoice · line 859

Quoted 7 lines
Config.in +4 -0
@@ -853,9 +853,16 @@ endchoice
  comment "RELocation Read Only (RELRO) needs shared libraries"
  	depends on !BR2_SHARED_LIBS
 
+config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
+	bool
+	default y
+	# Microblaze glibc toolchains don't work with Fortify Source enabled > +	depends on !BR2_microblaze

here you say it doesn't work with glibc toolchains, so you could add '&& !BR2_TOOLCHAIN_USES_GLIBC'. I think it's worth if it works with uclibc and musl.

What do you think about it?

Best regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas

Config.in endchoice · line 868

Quoted 9 lines
Config.in +2 -0
+
  choice
  	bool "Buffer-overflow Detection (FORTIFY_SOURCE)"
  	default BR2_FORTIFY_SOURCE_1
+	depends on BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
  	depends on BR2_TOOLCHAIN_USES_GLIBC
  	depends on !BR2_OPTIMIZE_0
  	help

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#2 lore raw
Quoted 30 lines · Giulio Benetti

Hi Romain, All,

Quoted 27 lines · Romain Naour

As reported by Toolchain-builder project [1], the system doesn't boot when Fortify Source is enabled for glibc based toolchain (the init process hang).

Also, hardening features may not be wanted or possible for such slow soft-core cpus [2].

[1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
[2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html

Cc Thomas Petazzoni <[email protected]>
Cc Giulio Benetti <[email protected]>

---
With BR2_RELRO_PARTIAL enabled, the system boot.

---
   Config.in | 7 +++++++
   1 file changed, 7 insertions(+)
Config.in +0 -0
index 2ef5d407e4..84f7fa6e8d 100644
@@ -853,9 +853,16 @@ endchoice
   comment "RELocation Read Only (RELRO) needs shared libraries"
   	depends on !BR2_SHARED_LIBS
 
Quoted 8 lines

Config.in endchoice

Quoted 4 lines
Config.in +4 -0
+config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
+	bool
+	default y
+	# Microblaze glibc toolchains don't work with Fortify Source enabled > +	depends on !BR2_microblaze

here you say it doesn't work with glibc toolchains, so you could add '&& !BR2_TOOLCHAIN_USES_GLIBC'. I think it's worth if it works with uclibc and musl.

Of course between parenthesis like:

```
depends on (!BR2_microblaze && !BR2_TOOLCHAIN_USES_GLIBC)
```

otherwise every toolchain which uses glibc doesn't use Fortify anymore.

Quoted 4 lines

What do you think about it?

Best regards

Signature · 6 lines
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
#3 lore raw

Hello Giulio,

Le 21/08/2021 à 01:09, Giulio Benetti a écrit :

Quoted 40 lines · Giulio Benetti
Quoted 22 lines

Hi Romain, All,

Quoted 19 lines · Romain Naour

As reported by Toolchain-builder project [1], the system doesn't boot when Fortify Source is enabled for glibc based toolchain (the init process hang).

Also, hardening features may not be wanted or possible for such slow soft-core cpus [2].

[1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
[2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html

Cc Thomas Petazzoni <[email protected]>
Cc Giulio Benetti <[email protected]>

---
With BR2_RELRO_PARTIAL enabled, the system boot.
---
   Config.in | 7 +++++++

   1 file changed, 7 insertions(+)
Quoted 16 lines
Quoted 5 lines
Config.in +0 -0
index 2ef5d407e4..84f7fa6e8d 100644
@@ -853,9 +853,16 @@ endchoice
Quoted 7 lines

   comment "RELocation Read Only (RELRO) needs shared libraries" depends on !BR2_SHARED_LIBS
   +config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
+    bool
+    default y
+    # Microblaze glibc toolchains don't work with Fortify Source enabled > +    depends on !BR2_microblaze

here you say it doesn't work with glibc toolchains, so you could add '&& !BR2_TOOLCHAIN_USES_GLIBC'. I think it's worth if it works with uclibc and musl.

Quoted 7 lines

Of course between parenthesis like:

```
depends on (!BR2_microblaze && !BR2_TOOLCHAIN_USES_GLIBC)
```

otherwise every toolchain which uses glibc doesn't use Fortify anymore.

Quoted 1 line

What do you think about it?

Fortify Source is disabled for the same reason as for PIC/PIE even for uClibc-ng or musl:

https://git.buildroot.net/buildroot/commit/?id=d120f844604da2295bb7bd8fc6c1f4efbe8b5792

I want to avoid the maintenance burden on such platform.

Best regards,
Romain

Quoted 4 lines
Quoted 3 lines

Best regards

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw
Quoted 52 lines

Il giorno 21 ago 2021, alle ore 14:47, Romain Naour <[email protected]> ha scritto:

Hello Giulio,

Quoted 47 lines · Giulio Benetti
Quoted 23 lines · Giulio Benetti

Hi Romain, All,

Quoted 19 lines · Romain Naour

As reported by Toolchain-builder project [1], the system doesn't boot when Fortify Source is enabled for glibc based toolchain (the init process hang).

Also, hardening features may not be wanted or possible for such slow soft-core cpus [2].

[1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
[2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html

Cc Thomas Petazzoni <[email protected]>
Cc Giulio Benetti <[email protected]>

---
With BR2_RELRO_PARTIAL enabled, the system boot.

---
   Config.in | 7 +++++++
   1 file changed, 7 insertions(+)
Quoted 16 lines

Config.in endchoice · line 859

Quoted 12 lines
Config.in +4 -0
index 2ef5d407e4..84f7fa6e8d 100644
@@ -853,9 +853,16 @@ endchoice
   comment "RELocation Read Only (RELRO) needs shared libraries"
       depends on !BR2_SHARED_LIBS
   +config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
+    bool
+    default y
+    # Microblaze glibc toolchains don't work with Fortify Source enabled >
+    depends on !BR2_microblaze

here you say it doesn't work with glibc toolchains, so you could add '&& !BR2_TOOLCHAIN_USES_GLIBC'. I think it's worth if it works with uclibc and musl.

Of course between parenthesis like:

```
depends on (!BR2_microblaze && !BR2_TOOLCHAIN_USES_GLIBC)
```

otherwise every toolchain which uses glibc doesn't use Fortify anymore.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

What do you think about it?

Fortify Source is disabled for the same reason as for PIC/PIE even for uClibc-ng or musl:

https://git.buildroot.net/buildroot/commit/?id=d120f844604da2295bb7bd8fc6c1f4efbe8b5792

I want to avoid the maintenance burden on such platform.

Ah ok, I’ve understood wrongly by the comment mentioning glibc only.

No problem then.

Best regards
Giulio Benetti

Quoted 9 lines

Best regards,
Romain

Quoted 4 lines
Quoted 3 lines

Best regards

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#5 lore raw
In reply to Romain Naour
Quoted 7 lines · Romain Naour

As reported by Toolchain-builder project [1], the system doesn't boot when Fortify Source is enabled for glibc based toolchain (the init process hang).

Also, hardening features may not be wanted or possible for such slow soft-core cpus [2].

Quoted 6 lines

[1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
[2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html

Cc Thomas Petazzoni <[email protected]>
Cc Giulio Benetti <[email protected]>

Applied to master, thanks. I reworded the commit message to avoid Giulio's
confusion.

Also, I added a dependency on BR2_FORTIFY_SOURCE_ARCH_SUPPORTS in the comment
that glibc and optimisation are needed.

Regards,
Arnout

Quoted 18 lines

---
With BR2_RELRO_PARTIAL enabled, the system boot.

---
 Config.in | 7 +++++++
 1 file changed, 7 insertions(+)
Config.in +3 -0
index 2ef5d407e4..84f7fa6e8d 100644
@@ -853,9 +853,16 @@ endchoice
 comment "RELocation Read Only (RELRO) needs shared libraries"
 	depends on !BR2_SHARED_LIBS
 
+config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
+	bool
+	default y

Config.in endchoice · line 868

Quoted 10 lines
Config.in +4 -0
+	# Microblaze glibc toolchains don't work with Fortify Source enabled
+	depends on !BR2_microblaze
+
 choice
 	bool "Buffer-overflow Detection (FORTIFY_SOURCE)"
 	default BR2_FORTIFY_SOURCE_1
+	depends on BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_USES_GLIBC
 	depends on !BR2_OPTIMIZE_0
 	help

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#6 lore raw
In reply to Romain Naour
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

As reported by Toolchain-builder project [1], the system doesn't boot when Fortify Source is enabled for glibc based toolchain (the init process hang).

Also, hardening features may not be wanted or possible for such slow soft-core cpus [2].

Quoted 6 lines

[1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
[2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html

Cc Thomas Petazzoni <[email protected]>
Cc Giulio Benetti <[email protected]>

Committed to 2021.02.x and 2021.05.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot