gcc: enable branch protection by standard
PATCH 1/1 gcc: enable branch protection by standard
Pass --enable-standard-branch-protection. This is an aarch64-specific option (currently) which does nothing on other targets. On aarch64 this generates code uses BTI/PAC instructions to mitigate Return Orientated Programming attacks. This approach is backwards compatible and the code size/performance impact is typically negliable.
More details can be found at
https://events.static.linuxfound.org/sites/events/files/slides/slides_23.pdf
--- meta/recipes-devtools/gcc/gcc-configure-common.inc | 1 + 1 file changed, 1 insertion(+)
meta/recipes-devtools/gcc/gcc-configure-common.inc +1 -0
@@ -40,6 +40,7 @@ EXTRA_OECONF = "\ ${@get_gcc_mips_plt_setting(bb, d)} \ ${@get_gcc_ppc_plt_settings(bb, d)} \ ${@get_gcc_multiarch_setting(bb, d)} \ + --enable-standard-branch-protection \ " # glibc version is a minimum controlling whether features are enabled.
Signature · 1 line
2.25.1
Quoted 19 lines · Ross Burton
Pass --enable-standard-branch-protection. This is an aarch64-specific option (currently) which does nothing on other targets. On aarch64 this generates code uses BTI/PAC instructions to mitigate Return Orientated Programming attacks. This approach is backwards compatible and the code size/performance impact is typically negliable.
More details can be found at
https://events.static.linuxfound.org/sites/events/files/slides/slides_23.pdfSigned-off-by Ross Burton <[email protected]>--- meta/recipes-devtools/gcc/gcc-configure-common.inc | 1 + 1 file changed, 1 insertion(+)meta/recipes-devtools/gcc/gcc-configure-common.inc +0
-0
meta/recipes-devtools/gcc/gcc-configure-common.inc EXTRA_OECONF = "\ · line 45
Quoted 6 lines
meta/recipes-devtools/gcc/gcc-configure-common.inc +1
-0@@ -40,6 +40,7 @@ EXTRA_OECONF = "\ ${@get_gcc_mips_plt_setting(bb, d)} \ ${@get_gcc_ppc_plt_settings(bb, d)} \ ${@get_gcc_multiarch_setting(bb, d)} \ + --enable-standard-branch-protection \ "
lgtm
Quoted 6 lines
meta/recipes-devtools/gcc/gcc-configure-common.inc +0
-0# glibc version is a minimum controlling whether features are enabled.
Hi,
Quoted 8 lines · Ross Burton
Pass --enable-standard-branch-protection. This is an aarch64-specific option (currently) which does nothing on other targets. On aarch64 this generates code uses BTI/PAC instructions to mitigate Return Orientated Programming attacks. This approach is backwards compatible and the code size/performance impact is typically negliable.
More details can be found at
https://events.static.linuxfound.org/sites/events/files/slides/slides_23.pdf
Do you recommend this for dunfell and other stable releases? Any requirements to gcc version? What about clang?
Cheers,
-Mikko
Quoted 24 lines
Signed-off-by Ross Burton <[email protected]>--- meta/recipes-devtools/gcc/gcc-configure-common.inc | 1 + 1 file changed, 1 insertion(+)meta/recipes-devtools/gcc/gcc-configure-common.inc +1
-0@@ -40,6 +40,7 @@ EXTRA_OECONF = "\ ${@get_gcc_mips_plt_setting(bb, d)} \ ${@get_gcc_ppc_plt_settings(bb, d)} \ ${@get_gcc_multiarch_setting(bb, d)} \ + --enable-standard-branch-protection \ " # glibc version is a minimum controlling whether features are enabled.Signature · 1 line
2.25.1
Quoted 9 lines · Mikko Rapeli
Hi,
Quoted 6 lines · Ross Burton
Pass --enable-standard-branch-protection. This is an aarch64-specific option (currently) which does nothing on other targets. On aarch64 this generates code uses BTI/PAC instructions to mitigate Return Orientated Programming attacks. This approach is backwards compatible and the code size/performance impact is typically negliable.
Quoted 5 lines
Quoted 2 lines
More details can be found at
https://events.static.linuxfound.org/sites/events/files/slides/slides_23.pdfDo you recommend this for dunfell and other stable releases? Any requirements to gcc version? What about clang?
it can be backported to dunfell, but I would not recommend it unless we run whole set of testing.
clang does not have convenient configure switch like gcc, so you bring up a good point, if we added this via cmdline options instead via SECURITY_CFLAGS
then it will work homogeneously across clang and gcc, perhaps that might be a better approach as it will also extend to other prebuilt toolchains which may support this option but arent configured to default to them.
Ross, some thought might be needed.
Quoted 33 lines
Cheers,
-Mikko
Quoted 28 lines
Signed-off-by Ross Burton <[email protected]>--- meta/recipes-devtools/gcc/gcc-configure-common.inc | 1 + 1 file changed, 1 insertion(+)meta/recipes-devtools/gcc/gcc-configure-common.inc +1
-0@@ -40,6 +40,7 @@ EXTRA_OECONF = "\ ${@get_gcc_mips_plt_setting(bb, d)} \ ${@get_gcc_ppc_plt_settings(bb, d)} \ ${@get_gcc_multiarch_setting(bb, d)} \ + --enable-standard-branch-protection \ " # glibc version is a minimum controlling whether features are enabled.Signature · 1 line
2.25.1