Skip to contentSkip to conversation

gcc: powerpc32 transition to secureplt

PATCH New Matt Weber 3 participants 4 messages Sep 23, 2020 – Sep 29, 2020

lore
Share & tools
lore

Matt Weber

author
#0 lore raw

PATCH 1/1 gcc: powerpc32 transition to secureplt

PowerPC has two PLT models: BSS-PLT and Secure-PLT. BSS-PLT uses runtime code generation to generate the PLT stubs. Secure-PLT was introduced with GCC 4.1 and Binutils 2.17 (base has GCC 4.2.1 and Binutils 2.17), and is a more secure PLT format, using a read-only linkage table, with the dynamic linker populating a non-executable index table.

Ref to other distro/BSD transitions
https://patchwork.openembedded.org/patch/106621/
https://reviews.freebsd.org/D20598

Fixes a bug observed when creating SELinux policy where all apps require execmem because the heap requires execute before this change.

---
 package/gcc/gcc.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/gcc/gcc.mk +7 -0
index b834269adc..df5bf22b96 100644
@@ -223,6 +223,13 @@ HOST_GCC_COMMON_CONF_OPTS += \
 	--with-long-double-128
 endif
 
+# Set default to Secure-PLT to prevent run-time
+# generation of PLT stubs (supports RELRO and
+# SELinux non-exemem capabilities)
+ifeq ($(BR2_powerpc),y)
+HOST_GCC_COMMON_CONF_OPTS += --enable-secureplt
+endif
+
 # PowerPC64 big endian by default uses the elfv1 ABI, and PowerPC 64
 # little endian by default uses the elfv2 ABI. However, musl has
 # decided to use the elfv2 ABI for both, so we force the elfv2 ABI for
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 gcc: powerpc32 transition to secureplt

Quoted 11 lines · On Wed, 23 Sep 2020 10:29:08 -0500 Matt Weber…

PowerPC has two PLT models: BSS-PLT and Secure-PLT. BSS-PLT uses runtime code generation to generate the PLT stubs. Secure-PLT was introduced with GCC 4.1 and Binutils 2.17 (base has GCC 4.2.1 and Binutils 2.17), and is a more secure PLT format, using a read-only linkage table, with the dynamic linker populating a non-executable index table.

Ref to other distro/BSD transitions
https://patchwork.openembedded.org/patch/106621/
https://reviews.freebsd.org/D20598

Quoted 8 lines

Fixes a bug observed when creating SELinux policy where all apps require execmem because the heap requires execute before this change.

---
 package/gcc/gcc.mk | 7 +++++++
 1 file changed, 7 insertions(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 gcc: powerpc32 transition to secureplt

In reply to Matt Weber

Peter,

Quoted 8 lines · Matt Weber

PowerPC has two PLT models: BSS-PLT and Secure-PLT. BSS-PLT uses runtime code generation to generate the PLT stubs. Secure-PLT was introduced with GCC 4.1 and Binutils 2.17 (base has GCC 4.2.1 and Binutils 2.17), and is a more secure PLT format, using a read-only linkage table, with the dynamic linker populating a non-executable index table.

Quoted 8 lines

Ref to other distro/BSD transitions
https://patchwork.openembedded.org/patch/106621/
https://reviews.freebsd.org/D20598

Fixes a bug observed when creating SELinux policy where all apps require execmem because the heap requires execute before this change.

This also applies to 2020.02.x and the previous release 2020.08.

Best Regards,
Matt

#3 lore raw

PATCH 1/1 gcc: powerpc32 transition to secureplt

Quoted 17 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

Peter,

Quoted 12 lines · Matt Weber

PowerPC has two PLT models: BSS-PLT and Secure-PLT. BSS-PLT uses runtime code generation to generate the PLT stubs. Secure-PLT was introduced with GCC 4.1 and Binutils 2.17 (base has GCC 4.2.1 and Binutils 2.17), and is a more secure PLT format, using a read-only linkage table, with the dynamic linker populating a non-executable index table.

Ref to other distro/BSD transitions
https://patchwork.openembedded.org/patch/106621/
https://reviews.freebsd.org/D20598

Quoted 6 lines
Quoted 4 lines

Fixes a bug observed when creating SELinux policy where all apps require execmem because the heap requires execute before this change.

This also applies to 2020.02.x and the previous release 2020.08.

Committed to 2020.02.x, 2020.05.x and 2020.08.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard