Skip to contentSkip to conversation

Config.in: security hardening: disable FORTIFY_SOURCE for gcc < 6

PATCH New Romain Naour 3 participants 8 messages Nov 5, 2018 – Nov 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Config.in: security hardening: disable FORTIFY_SOURCE for gcc < 6

As reported in the bug report [1], gcc < 6 doesn't build when FORTIFY_SOURCE is set to 1 or 2. The issue is related to the upstream bug report [2] but the patch fixing the issue for gcc 6 has not been backported to earlier gcc versions.

Add a dependency on gcc at least version 6 to BR2_FORTIFY_SOURCE_1 and BR2_FORTIFY_SOURCE_2.

[1] https://bugs.busybox.net/show_bug.cgi?id=11476
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61164
[3] https://github.com/gcc-mirror/gcc/commit/55f12fce4ccf77513644a247f9c401a5b1fa2402

Cc Matthew Weber <[email protected]>
Cc Peter Korsgaard <[email protected]>

---
To be backported up to Buildroot 2018.02.x.

---
 Config.in | 4 ++++
 1 file changed, 4 insertions(+)
Config.in +4 -0
index 584a1f087f..6176433fc0 100644
@@ -798,6 +798,8 @@ config BR2_FORTIFY_SOURCE_NONE
 
 config BR2_FORTIFY_SOURCE_1
 	bool "Conservative"
+	# gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61164
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_6
 	help
 	  This option sets _FORTIFY_SOURCE to 1 and only introduces
 	  checks that shouldn't change the behavior of conforming
@@ -805,6 +807,8 @@ config BR2_FORTIFY_SOURCE_1
 
 config BR2_FORTIFY_SOURCE_2
 	bool "Aggressive"
+	# gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61164
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_6
 	help
 	  This option sets _FORTIFY_SOURCES to 2 and some more
 	  checking is added, but some conforming programs might fail.
Signature · 1 line
2.14.5
#1 lore raw

PATCH 1/1 Config.in: security hardening: disable FORTIFY_SOURCE for gcc < 6

Romain ,

Quoted 8 lines · On Mon, Nov 5, 2018, 14:07 Romain Naour <[email protected] wrote:

As reported in the bug report [1], gcc < 6 doesn't build when FORTIFY_SOURCE is set to 1 or 2. The issue is related to the upstream bug report [2] but the patch fixing the issue for gcc 6 has not been backported to earlier gcc versions.

Add a dependency on gcc at least version 6 to BR2_FORTIFY_SOURCE_1 and BR2_FORTIFY_SOURCE_2.

Sorry about the HTML email.

Could this dependency be conditional on if a internal toolchain is used?

Quoted 37 lines

[1] https://bugs.busybox.net/show_bug.cgi?id=11476
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61164
[3]
https://github.com/gcc-mirror/gcc/commit/55f12fce4ccf77513644a247f9c401a5b1fa2402

Cc Matthew Weber <[email protected]>
Cc Peter Korsgaard <[email protected]>

---
To be backported up to Buildroot 2018.02.x.

---
 Config.in | 4 ++++
 1 file changed, 4 insertions(+)
Config.in +4 -1
index 584a1f087f..6176433fc0 100644
@@ -798,6 +798,8 @@ config BR2_FORTIFY_SOURCE_NONE
 
 config BR2_FORTIFY_SOURCE_1
        bool "Conservative"
+       # gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61164
+       depends on BR2_TOOLCHAIN_GCC_AT_LEAST_6
        help
          This option sets _FORTIFY_SOURCE to 1 and only introduces
          checks that shouldn't change the behavior of conforming
@@ -805,6 +807,8 @@ config BR2_FORTIFY_SOURCE_1
 
 config BR2_FORTIFY_SOURCE_2
        bool "Aggressive"
+       # gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61164
+       depends on BR2_TOOLCHAIN_GCC_AT_LEAST_6
        help
          This option sets _FORTIFY_SOURCES to 2 and some more
          checking is added, but some conforming programs might fail.
--
Quoted 3 lines

2.14.5

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181105/39860aad/attachment.html>

#2 lore raw

PATCH 1/1 Config.in: security hardening: disable FORTIFY_SOURCE for gcc < 6

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Matthew" == Matthew Weber <[email protected]> writes:

Romain ,

Quoted 5 lines · On Mon, Nov 5, 2018, 14:07 Romain Naour <[email protected] wrote:

As reported in the bug report [1], gcc < 6 doesn't build when FORTIFY_SOURCE is set to 1 or 2. The issue is related to the upstream bug report [2] but the patch fixing the issue for gcc 6 has not been backported to earlier gcc versions.

Quoted 7 lines
Quoted 3 lines

Add a dependency on gcc at least version 6 to BR2_FORTIFY_SOURCE_1 and BR2_FORTIFY_SOURCE_2.

Sorry about the HTML email.

Could this dependency be conditional on if a internal toolchain is used?

Ahh yes, if this is really about *building* gcc, then it should be

depends on !BR2_TOOLCHAIN_BUILDROOT || BR2_TOOLCHAIN_GCC_AT_LEAST_6

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/1 Config.in: security hardening: disable FORTIFY_SOURCE for gcc < 6

Peter/Romain,

Quoted 15 lines · Peter Korsgaard
Quoted 14 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

"Matthew" == Matthew Weber <[email protected]> writes:

Romain ,

Quoted 8 lines · On Mon, Nov 5, 2018, 14:07 Romain Naour <[email protected] wrote:

As reported in the bug report [1], gcc < 6 doesn't build when FORTIFY_SOURCE is set to 1 or 2. The issue is related to the upstream bug report [2] but the patch fixing the issue for gcc 6 has not been backported to earlier gcc versions.

Add a dependency on gcc at least version 6 to BR2_FORTIFY_SOURCE_1 and BR2_FORTIFY_SOURCE_2.

Quoted 8 lines
Quoted 3 lines

Sorry about the HTML email.

Could this dependency be conditional on if a internal toolchain is used?

Ahh yes, if this is really about *building* gcc, then it should be

depends on !BR2_TOOLCHAIN_BUILDROOT || BR2_TOOLCHAIN_GCC_AT_LEAST_6

Correct. I'll have to dig a bit and see what the minimum supported external toolchain version is. I believe 5.4.x

Matt

Signature · 8 lines
Matthew L Weber / Pr Software Engineer
Airborne Information Systems / RC Linux Secure Platforms
MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA
www.rockwellcollins.com

Note: Any Export License Required Information and License Restricted
Third Party Intellectual Property (TPIP) content must be encrypted and
sent to matthew.weber at corp.rockwellcollins.com.
#4 lore raw

PATCH 1/1 Config.in: security hardening: disable FORTIFY_SOURCE for gcc < 6

All,

Quoted 24 lines · Matthew Weber

Peter/Romain,

Quoted 19 lines · Peter Korsgaard
Quoted 18 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

"Matthew" == Matthew Weber <[email protected]> writes:

Romain ,

Quoted 8 lines · On Mon, Nov 5, 2018, 14:07 Romain Naour <[email protected] wrote:

As reported in the bug report [1], gcc < 6 doesn't build when FORTIFY_SOURCE is set to 1 or 2. The issue is related to the upstream bug report [2] but the patch fixing the issue for gcc 6 has not been backported to earlier gcc versions.

Add a dependency on gcc at least version 6 to BR2_FORTIFY_SOURCE_1 and BR2_FORTIFY_SOURCE_2.

Sorry about the HTML email.

Could this dependency be conditional on if a internal toolchain is used?

Quoted 7 lines
Quoted 4 lines

Ahh yes, if this is really about *building* gcc, then it should be

depends on !BR2_TOOLCHAIN_BUILDROOT || BR2_TOOLCHAIN_GCC_AT_LEAST_6

Correct. I'll have to dig a bit and see what the minimum supported external toolchain version is. I believe 5.4.x

Found an old post.... https://access.redhat.com/blogs/766093/posts/1976213
Looks like the FORTIFY options should work from GCC 4.0+ and is more dependent on GLIBC being new enough (which we won't run into). Macros are supported since GLIBC2.3.4 -
http://man7.org/linux/man-pages/man7/feature_test_macros.7.html

Matt

#5 lore raw

PATCH 1/1 Config.in: security hardening: disable FORTIFY_SOURCE for gcc < 6

Le 06/11/2018 ? 13:27, Matthew Weber a ?crit?:

Quoted 33 lines

All,

Quoted 29 lines · Matthew Weber

Peter/Romain,

Quoted 23 lines · Peter Korsgaard
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

"Matthew" == Matthew Weber <[email protected]> writes:

Romain ,

Quoted 5 lines · On Mon, Nov 5, 2018, 14:07 Romain Naour <[email protected] wrote:

As reported in the bug report [1], gcc < 6 doesn't build when FORTIFY_SOURCE is set to 1 or 2. The issue is related to the upstream bug report [2] but the patch fixing the issue for gcc 6 has not been backported to earlier gcc versions.

Quoted 7 lines
Quoted 3 lines

Add a dependency on gcc at least version 6 to BR2_FORTIFY_SOURCE_1 and BR2_FORTIFY_SOURCE_2.

Sorry about the HTML email.

Could this dependency be conditional on if a internal toolchain is used?

Ahh yes, if this is really about *building* gcc, then it should be

depends on !BR2_TOOLCHAIN_BUILDROOT || BR2_TOOLCHAIN_GCC_AT_LEAST_6

Quoted 8 lines
Quoted 2 lines

Correct. I'll have to dig a bit and see what the minimum supported external toolchain version is. I believe 5.4.x

Found an old post.... https://access.redhat.com/blogs/766093/posts/1976213
Looks like the FORTIFY options should work from GCC 4.0+ and is more dependent on GLIBC being new enough (which we won't run into). Macros are supported since GLIBC2.3.4 -
http://man7.org/linux/man-pages/man7/feature_test_macros.7.html

Maybe it worth to backport this patch?

https://github.com/gcc-mirror/gcc/commit/55f12fce4ccf77513644a247f9c401a5b1fa2402

Best regards,
Romain

Quoted 3 lines

Matt

#6 lore raw

PATCH 1/1 Config.in: security hardening: disable FORTIFY_SOURCE for gcc < 6

In reply to Romain Naour
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

As reported in the bug report [1], gcc < 6 doesn't build when FORTIFY_SOURCE is set to 1 or 2. The issue is related to the upstream bug report [2] but the patch fixing the issue for gcc 6 has not been backported to earlier gcc versions.

Add a dependency on gcc at least version 6 to BR2_FORTIFY_SOURCE_1 and BR2_FORTIFY_SOURCE_2.

[1] https://bugs.busybox.net/show_bug.cgi?id=11476
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61164
[3] https://github.com/gcc-mirror/gcc/commit/55f12fce4ccf77513644a247f9c401a5b1fa2402

Quoted 5 lines
Cc Matthew Weber <[email protected]>
Cc Peter Korsgaard <[email protected]>

---
To be backported up to Buildroot 2018.02.x.

Committed after adding the internal toolchain dependency as pointed out by Matthew, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH 1/1 Config.in: security hardening: disable FORTIFY_SOURCE for gcc < 6

In reply to Romain Naour
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

As reported in the bug report [1], gcc < 6 doesn't build when FORTIFY_SOURCE is set to 1 or 2. The issue is related to the upstream bug report [2] but the patch fixing the issue for gcc 6 has not been backported to earlier gcc versions.

Add a dependency on gcc at least version 6 to BR2_FORTIFY_SOURCE_1 and BR2_FORTIFY_SOURCE_2.

[1] https://bugs.busybox.net/show_bug.cgi?id=11476
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61164
[3] https://github.com/gcc-mirror/gcc/commit/55f12fce4ccf77513644a247f9c401a5b1fa2402

Quoted 5 lines
Cc Matthew Weber <[email protected]>
Cc Peter Korsgaard <[email protected]>

---
To be backported up to Buildroot 2018.02.x.

Committed to 2018.02.x and 2018.08.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard