Skip to contentSkip to conversation

nss: Explicitly link with libssp on musl/ppc

PATCH In review Khem Raj 2 participants 4 messages Mar 24, 2016 – Mar 28, 2016

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 nss: Explicitly link with libssp on musl/ppc

---
 meta/recipes-support/nss/nss_3.21.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-support/nss/nss_3.21.bb +1 -0
index d2e2411..9f2626b 100644
@@ -41,6 +41,7 @@ TD = "${S}/tentative-dist"
 TDS = "${S}/tentative-dist-staging"
 
 TARGET_CC_ARCH += "${LDFLAGS}"
+SECURITY_LDFLAGS_append_powerpc = " -lssp_nonshared -lssp"
 
 do_configure_prepend_libc-musl () {
     sed -i -e '/-DHAVE_SYS_CDEFS_H/d' ${S}/nss/lib/dbm/config/config.mk
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 1 line · Khem Raj

This is all a bit obscure.  Please add an explanation of why this is needed specifically by ppc (and not other architectures) to the commit message.

Also, the subject says "musl" but the patch doesn't seem to be obviously specific to musl.  Is SECURITY_LDFLAGS not used at all by other libcs?

p.

Quoted 21 lines

---
 meta/recipes-support/nss/nss_3.21.bb | 1 +

 1 file changed, 1 insertion(+)
meta/recipes- renamed from meta/recipes-support/nss/nss_3.21.bb +0 -0

support/nss/nss_3.21.bb
index d2e2411..9f2626b 100644

meta/recipes-support/nss/nss_3.21.bb +0 -0
@@ -41,6 +41,7 @@ TD = "${S}/tentative-dist"

 TDS = "${S}/tentative-dist-staging"

 TARGET_CC_ARCH += "${LDFLAGS}" +SECURITY_LDFLAGS_append_powerpc = " -lssp_nonshared -lssp"
 do_configure_prepend_libc-musl () {
     sed -i -e '/-DHAVE_SYS_CDEFS_H/d' ${S}/nss/lib/dbm/config/config.mk
--
1.8.3.1

author
#2 lore raw
Quoted 9 lines · Phil Blundell
Quoted 1 line · Khem Raj

This is all a bit obscure. Please add an explanation of why this is needed specifically by ppc (and not other architectures) to the commit message.

It is using nodefaultlib on linker cmdline and as a result, it was complaining about missing __stack_chk_fail_local which was being added by compiler due to -fstack-protector-strong being in CFLAGS, I did not look into roots as to why it was showing up on ppc only.

Quoted 4 lines

Also, the subject says "musl" but the patch doesn't seem to be obviously specific to musl. Is SECURITY_LDFLAGS not used at all by other libcs?

It does not harm others.

Quoted 24 lines

p.

Quoted 21 lines
---
 meta/recipes-support/nss/nss_3.21.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes- renamed from meta/recipes-support/nss/nss_3.21.bb +0 -0

support/nss/nss_3.21.bb
index d2e2411..9f2626b 100644

meta/recipes-support/nss/nss_3.21.bb +1 -0
@@ -41,6 +41,7 @@ TD = "${S}/tentative-dist"
 TDS = "${S}/tentative-dist-staging"
 
 TARGET_CC_ARCH += "${LDFLAGS}"
+SECURITY_LDFLAGS_append_powerpc = " -lssp_nonshared -lssp"
 
 do_configure_prepend_libc-musl () {
     sed -i -e '/-DHAVE_SYS_CDEFS_H/d'

${S}/nss/lib/dbm/config/config.mk
--
1.8.3.1

author
#3 lore raw
In reply to Phil Blundell
Quoted 11 lines · Phil Blundell
Quoted 1 line · Khem Raj

This is all a bit obscure. Please add an explanation of why this is needed specifically by ppc (and not other architectures) to the commit message.

Also, the subject says "musl" but the patch doesn't seem to be obviously specific to musl. Is SECURITY_LDFLAGS not used at all by other libcs?

This patch is not required anymore.

I took another dig at it and it turned out to be a bug in gcc for musl, where it did not
detect libc's support for ssp correctly during configure as a result, it would generate
wrong calls for __stack_chk_guard which were then marked with absolute relocations
that linker could not resolve and spewed errors

See the latest pull request for more details.

http://patchwork.openembedded.org/patch/118829/

Thanks for raising concerns for this patch.

Quoted 23 lines

p.

Quoted 21 lines
---
 meta/recipes-support/nss/nss_3.21.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes- renamed from meta/recipes-support/nss/nss_3.21.bb +0 -0

support/nss/nss_3.21.bb
index d2e2411..9f2626b 100644

meta/recipes-support/nss/nss_3.21.bb +1 -0
@@ -41,6 +41,7 @@ TD = "${S}/tentative-dist"
 TDS = "${S}/tentative-dist-staging"
 
 TARGET_CC_ARCH += "${LDFLAGS}"
+SECURITY_LDFLAGS_append_powerpc = " -lssp_nonshared -lssp"
 
 do_configure_prepend_libc-musl () {
     sed -i -e '/-DHAVE_SYS_CDEFS_H/d'

${S}/nss/lib/dbm/config/config.mk
--
1.8.3.1