Skip to content

Conversation

laanwj
Copy link
Member

@laanwj laanwj commented Nov 23, 2019

This export was introduced in #17270 which added

//! Necessary on some platforms
extern char** environ;

This should (finally) make the gitian build pass again (fix issue #17525.).

Built on top of #17538 which should be merged first.

laanwj and others added 4 commits November 22, 2019 15:38
Ever since statically linking Qt, we've been linking the C++ library
statically too (-static-libstdc++). Take this into
account in the symbol checker.
Debian 8 (Jessie) has:
- g++ version 4.9.2
- libc version 2.19

Ubuntu 16.04.4 (Xenial) has:
- g++ version 5.3.1
- libc version 2.23.0

CentOS 7 has:
- g++ version 4.8.5
- libc version 2.17

Taking the minimum of these as our target.
According to the GNU ABI document this corresponds to:

- GCC 4.8.5: GCC_4.8.0
- (glibc)    GLIBC_2_17

Co-Authored-By: fanquake <fanquake@gmail.com>
This export was introduced in bitcoin#17270 which added
```
//! Necessary on some platforms
extern char** environ;
```
@laanwj
Copy link
Member Author

laanwj commented Nov 23, 2019

I also think it'd be OK to remove the exports check completely. It was introduced back in the day because of symbol collisions between dynamically-linked Qt and the built-in statically built OpenSSL which could have scary implications.

This hasn't been the case for ages—ever since Qt5 and before, we've statically linked Qt—and we don't even use OpenSSL anymore. I don't think a binary that exports symbols can usually cause problems (exporting excessive numbers of symbols would be an indication that something is going wrong in the link, but besides that).

The check is already being skipped for some architectures.

@laanwj
Copy link
Member Author

laanwj commented Nov 23, 2019

It looks like there is a third problem that needs to be fixed before gitian passes again, the RISC-V binaries fail on the NX (non-executable stack) check.

I'm really confused as to what could cause this. Will try to bisect. I suspect it's another unexpected by-effect of #17270, because it passes with 1baf7d1.

Edit: no, it's not #17270, I don't have the issue with 0bb37e4

Edit: bisected it to b49b6b0 . Seems that linking to OpenSSL was the only thing that made it set noexecstack, on RISC-V. I'm not sure why yet, although we do explicitly pass -Wa,--noexecstack" CFLAGS there.
(removed "needs gitian build" for now as i'm sure it will fail, will add it back after fixing this)

@laanwj
Copy link
Member Author

laanwj commented Nov 23, 2019

Added a workaround to force noexecstack on RISC-V (I can't find any reason why this is different from other platforms, so blaming it on the immaturity of the toolchain, FWIW: gcc 9.2.1 on native Fedora RISC-V does get this right):

    # Workaround for Ubuntu's g++ compiler for RV64, which
    # doesn't add .note.GNU-stack sections automatically unlike other platforms,
    # resulting in a NX failure of the binary in security-check.py
    # TODO: remove this when no longer needed
    if [ "${i}" = "riscv64-linux-gnu" ]; then
      HOST_LDFLAGS="${HOST_LDFLAGS_BASE} -Wl,-z,noexecstack"
    else
      HOST_LDFLAGS="${HOST_LDFLAGS_BASE}"
    fi

This is necessary now that the flag is no longer "inherited" through OpenSSL's build settings.

I think this should be it.

@DrahtBot
Copy link
Contributor

Gitian builds

File commit 0b79caf
(master)
commit 3287054
(master and this pull)
bitcoin-0.19.99-osx-unsigned.dmg 2f8db30ccf876813... 82343ad664875e96...
bitcoin-0.19.99-osx64.tar.gz e692e7414fd60d08... eb1e8c377377a213...
bitcoin-0.19.99-win64-debug.zip d5aac0d177e3dd19... b34cd515f1dbb637...
bitcoin-0.19.99-win64-setup-unsigned.exe 99e74ad4f140b9f8... ea20a481f8622076...
bitcoin-0.19.99-win64.zip 5ee17a36809deed3... 66f3245a53c8ada3...
bitcoin-0.19.99.tar.gz 60c0d2b9351b2072... 4cd8c5397c650f69...
bitcoin-core-osx-0.20-res.yml 496ef99b99af9cbc... 48332aaaa2c60e36...
bitcoin-core-win-0.20-res.yml e59bdc5fb20fdf13... 309ecb699ef99f07...
linux-build.log 3a0ebaaea4f04719... 82589ac811ca3239...
osx-build.log ac5e595f7863b747... b34943c2650f8d33...
win-build.log 0e887a344ee447e9... 7d58d84db71362f8...
bitcoin-core-osx-0.20-res.yml.diff 895a4bab149fe1af...
bitcoin-core-win-0.20-res.yml.diff f1ed4819b157fd5c...
linux-build.log.diff 061419aa8adac16c...
osx-build.log.diff 8cec15944eb98c34...
win-build.log.diff c57597d6d218619c...

@laanwj
Copy link
Member Author

laanwj commented Nov 24, 2019

Issue (hopefully correctly) reported upstream: https://bugs.launchpad.net/ubuntu/+source/gcc-8-cross-ports/+bug/1853740
(updated commit message and comment for upstream issue)

@laanwj laanwj changed the title build: Allow export of environ symbols build: Allow export of environ symbols and work around rv64 toolchain issue Nov 24, 2019
@DrahtBot
Copy link
Contributor

Gitian builds

File commit 2eeacdf
(master)
commit 144cfba
(master and this pull)
bitcoin-0.19.99-osx-unsigned.dmg 9d05f23d3ce7ffd1... 782f72b90f18c7c0...
bitcoin-0.19.99-osx64.tar.gz 14fde6d21fa0df03... 053715c9149fbd25...
bitcoin-0.19.99-win64-debug.zip c78aee8a8c2c4ae0... a52a8f036f1df958...
bitcoin-0.19.99-win64-setup-unsigned.exe 8156ba3b081bf2c4... d7ce63f9714aa678...
bitcoin-0.19.99-win64.zip cad87205c28ae17d... bf51d177625cdb7d...
bitcoin-0.19.99.tar.gz 46dfa562551072cb... 5040ad08bc1e402a...
bitcoin-core-osx-0.20-res.yml 43eae47a941ba34d... 80317d208000be54...
bitcoin-core-win-0.20-res.yml 3e08f7574e6f4f8d... febd388c91ac60c2...
linux-build.log 45da2e115d050f5d... e0cc8fd1cd1d3bcf...
osx-build.log b4b31f4eab66517d... ea6285cfdd1ddfd3...
win-build.log f7628df4d0e3626e... 4af0bea034cf10e0...
bitcoin-0.19.99-aarch64-linux-gnu-debug.tar.gz a1864a0a0db049fa...
bitcoin-0.19.99-aarch64-linux-gnu.tar.gz 16f123fd5ecb608f...
bitcoin-0.19.99-arm-linux-gnueabihf-debug.tar.gz fe966ae938727336...
bitcoin-0.19.99-arm-linux-gnueabihf.tar.gz 3c4527f935d82e9f...
bitcoin-0.19.99-i686-pc-linux-gnu-debug.tar.gz a33a46e5bb9aee2a...
bitcoin-0.19.99-i686-pc-linux-gnu.tar.gz cf61a9ce3a1da558...
bitcoin-0.19.99-riscv64-linux-gnu-debug.tar.gz 7aa8c7d73913d990...
bitcoin-0.19.99-riscv64-linux-gnu.tar.gz e72e23083959b56f...
bitcoin-0.19.99-x86_64-linux-gnu-debug.tar.gz e3583adbf8616184...
bitcoin-0.19.99-x86_64-linux-gnu.tar.gz be927699aacba560...
bitcoin-core-linux-0.20-res.yml 31194810f698f0cb...
bitcoin-core-osx-0.20-res.yml.diff 56c1281a4cddb0ce...
bitcoin-core-win-0.20-res.yml.diff 47177a1074bd1ea2...
linux-build.log.diff ca6a1e0fbd16a1fa...
osx-build.log.diff 499fece744e01854...
win-build.log.diff 0cb56cc3f2779056...

maflcko pushed a commit that referenced this pull request Nov 25, 2019
…rv64 toolchain issue

eafd259 build: Add NX workaround for RV64 (Wladimir J. van der Laan)
f6e4225 build: Allow export of environ symbols (Wladimir J. van der Laan)

Pull request description:

  This export was introduced in #17270 which added
  ```
  //! Necessary on some platforms
  extern char** environ;
  ```
  This should (finally) make the gitian build pass again (fix issue #17525.).

  Built on top of #17538 which should be merged first.

Top commit has no ACKs.

Tree-SHA512: 5c2054d52d0957aec3dc945b76d8e219187d22dc03889e7a88fb76049bf8e4a3e9f4da00dd1e9dd0351211f8e70d1a1b8ad7244f0348dab698e9d14b9d0c0bd4
@maflcko maflcko merged commit eafd259 into bitcoin:master Nov 25, 2019
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Nov 25, 2019
…around rv64 toolchain issue

eafd259 build: Add NX workaround for RV64 (Wladimir J. van der Laan)
f6e4225 build: Allow export of environ symbols (Wladimir J. van der Laan)

Pull request description:

  This export was introduced in bitcoin#17270 which added
  ```
  //! Necessary on some platforms
  extern char** environ;
  ```
  This should (finally) make the gitian build pass again (fix issue bitcoin#17525.).

  Built on top of bitcoin#17538 which should be merged first.

Top commit has no ACKs.

Tree-SHA512: 5c2054d52d0957aec3dc945b76d8e219187d22dc03889e7a88fb76049bf8e4a3e9f4da00dd1e9dd0351211f8e70d1a1b8ad7244f0348dab698e9d14b9d0c0bd4
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Feb 18, 2020
This export was introduced in bitcoin#17270 which added
```
//! Necessary on some platforms
extern char** environ;
```

Github-Pull: bitcoin#17569
Rebased-From: f6e4225
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Feb 18, 2020
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Feb 18, 2020
This export was introduced in bitcoin#17270 which added
```
//! Necessary on some platforms
extern char** environ;
```

Github-Pull: bitcoin#17569
Rebased-From: f6e4225
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Feb 18, 2020
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Feb 18, 2020
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Feb 18, 2020
@fanquake
Copy link
Member

I'm going to untag this as needing backport to 0.19, as per my comments here:

Is backporting either of these really required?

The changes that necessitated f6e4225 (1025476 here) are not in the 0.19 branch.

As for eafd259, the 0.19.1rc2 RISCV binaries still have GNU_STACK marked as RW, because we're still receiving it from OpenSSL:

sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
…around rv64 toolchain issue

eafd259 build: Add NX workaround for RV64 (Wladimir J. van der Laan)
f6e4225 build: Allow export of environ symbols (Wladimir J. van der Laan)

Pull request description:

  This export was introduced in bitcoin#17270 which added
  ```
  //! Necessary on some platforms
  extern char** environ;
  ```
  This should (finally) make the gitian build pass again (fix issue bitcoin#17525.).

  Built on top of bitcoin#17538 which should be merged first.

Top commit has no ACKs.

Tree-SHA512: 5c2054d52d0957aec3dc945b76d8e219187d22dc03889e7a88fb76049bf8e4a3e9f4da00dd1e9dd0351211f8e70d1a1b8ad7244f0348dab698e9d14b9d0c0bd4
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 17, 2021
…around rv64 toolchain issue

eafd259 build: Add NX workaround for RV64 (Wladimir J. van der Laan)
f6e4225 build: Allow export of environ symbols (Wladimir J. van der Laan)

Pull request description:

  This export was introduced in bitcoin#17270 which added
  ```
  //! Necessary on some platforms
  extern char** environ;
  ```
  This should (finally) make the gitian build pass again (fix issue bitcoin#17525.).

  Built on top of bitcoin#17538 which should be merged first.

Top commit has no ACKs.

Tree-SHA512: 5c2054d52d0957aec3dc945b76d8e219187d22dc03889e7a88fb76049bf8e4a3e9f4da00dd1e9dd0351211f8e70d1a1b8ad7244f0348dab698e9d14b9d0c0bd4
thelazier pushed a commit to thelazier/dash that referenced this pull request Sep 25, 2021
…around rv64 toolchain issue

eafd259 build: Add NX workaround for RV64 (Wladimir J. van der Laan)
f6e4225 build: Allow export of environ symbols (Wladimir J. van der Laan)

Pull request description:

  This export was introduced in bitcoin#17270 which added
  ```
  //! Necessary on some platforms
  extern char** environ;
  ```
  This should (finally) make the gitian build pass again (fix issue bitcoin#17525.).

  Built on top of bitcoin#17538 which should be merged first.

Top commit has no ACKs.

Tree-SHA512: 5c2054d52d0957aec3dc945b76d8e219187d22dc03889e7a88fb76049bf8e4a3e9f4da00dd1e9dd0351211f8e70d1a1b8ad7244f0348dab698e9d14b9d0c0bd4
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants