fanquake
commented at 1:43 PM on January 21, 2022:
member
Arm Pointer Authentication (PAC) is a method of hardening code from Return Oriented Programming (ROP) attacks. It uses a tag in a pointer to sign and verify pointers. Branch Target Identification (BTI) is another code hardening method, where the branch/jump target is identified with a special landing pad instruction. Outside of some system support in glibc+kernel, packages gain the additional hardening by compiling with the -mbranch-protection=flag available in recent versions of GCC. In particular -mbranch-protection=standard enables both BTI and PAC, with backwards compatible to armv8.0 code sequences that activate on v8.3 (PAC) & v8.5 (BTI) enabled Arm machines. (taken from Fedora).
Creation of a BTI enabled binary also requires that everything being linked in be BTI enabled. This means you currently cannot, for example, cross-compile using a Ubuntu based aarch64 toolchain, if you're wanting to use this feature. This can be shown using -Wl,z,force-bti, which will emit warnings for linked objects that are not BTI enabled (this is used in configure to detect when to disable using the flags). i.e:
int main() { return 0; }
# aarch64-linux-gnu-g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0
aarch64-linux-gnu-g++ test.cpp -mbranch-protection=standard -Wl,-z,force-bti
/usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: /usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/lib/../lib/Scrt1.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
#33537 ([wip] A more static bitcoin-qt by fanquake)
#33181 (guix: build for Linux HOSTS with -static-libgcc by fanquake)
#25573 (guix: produce a -static-pie bitcoind by fanquake)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
hebasto
commented at 10:25 PM on January 22, 2022:
member
Concept ACK.
From reading docs it's still unclear to me whether -mbranch-protection=standard implies -mbranch-protection=bti?
$ ./test/lint/lint-git-commit-check.sh
The subject line of commit hash f799135959461079a220c5ddc97ea9a6b0056b2b is followed by a non-empty line. Subject lines should always be followed by a blank line.
fanquake force-pushed on Jan 23, 2022
laanwj
commented at 4:00 PM on January 25, 2022:
member
Concept ACK.
We might want to wait with doing this until hardware supporting BTI and PAC is available to test on, though.
DrahtBot removed the label DrahtBot Guix build requested on May 17, 2022
fanquake force-pushed on Jun 27, 2022
fanquake force-pushed on Jun 28, 2022
fanquake
commented at 10:43 AM on June 28, 2022:
member
I've changed the approach here, and this is now based on #25437 and parts of #25484.
This adds --enable-standard-branch-protection to the configure flags when building GCC, which turns on the usage of branch-protection features by default. I've also added a commit that switches to using glibc 2.33 for the aarch64 build. glibc 2.32 was the first to ship with support for aarch64 branch protection features when built with a compatible compiler (see commit message for details). We couldn't actually use this for Guix builds, because it would break out back compat requires (the symbol checks fail), so this is still just for demonstration.
kristapsk
commented at 10:54 AM on June 28, 2022:
contributor
Concept ACK
fanquake force-pushed on Jun 29, 2022
fanquake force-pushed on Jun 30, 2022
fanquake force-pushed on Jul 19, 2022
fanquake force-pushed on Jul 19, 2022
fanquake force-pushed on Jul 19, 2022
fanquake force-pushed on Jul 19, 2022
fanquake force-pushed on Jul 19, 2022
lish2099 approved
fanquake referenced this in commit 8e37afcb13 on Jul 30, 2022
fanquake force-pushed on Jul 30, 2022
fanquake force-pushed on Aug 2, 2022
fanquake force-pushed on Aug 19, 2022
fanquake
commented at 3:10 PM on August 19, 2022:
member
Rebased on master & #25861. Please review that PR first.
fanquake renamed this: [POC] build: enable Pointer Authentication and Branch Target Identification for aarch64 (Linux) build: Pointer Authentication and Branch Target Identification for aarch64 Linux (Guix) on Aug 24, 2022
fanquake force-pushed on Sep 4, 2022
fanquake force-pushed on Oct 11, 2022
DrahtBot added the label Needs rebase on Feb 17, 2023
fanquake force-pushed on Feb 17, 2023
fanquake
commented at 11:07 AM on February 17, 2023:
member
Rebased past #27029. Might split some more of this out.
DrahtBot removed the label Needs rebase on Feb 17, 2023
DrahtBot added the label Needs rebase on Feb 28, 2023
fanquake force-pushed on Feb 28, 2023
fanquake
commented at 12:10 PM on February 28, 2023:
member
Note that the branch protection option being added to libevent here, can now exist inside the NO_HARDEN clause.
DrahtBot removed the label Needs rebase on Apr 5, 2023
fanquake force-pushed on Apr 14, 2023
fanquake force-pushed on Aug 14, 2023
fanquake
commented at 12:27 PM on August 14, 2023:
member
Rebased onto #27897, which simplifies the actual changes here, and dropped no-longer needed commits.
fanquake force-pushed on Aug 14, 2023
DrahtBot added the label CI failed on Aug 14, 2023
DrahtBot added the label Needs rebase on Aug 22, 2023
fanquake force-pushed on Aug 30, 2023
DrahtBot removed the label Needs rebase on Aug 30, 2023
DrahtBot removed the label CI failed on Aug 30, 2023
fanquake referenced this in commit 3045d0a063 on Sep 12, 2023
fanquake force-pushed on Sep 12, 2023
fanquake referenced this in commit 8f48576f11 on Oct 2, 2023
fanquake force-pushed on Oct 2, 2023
DrahtBot added the label CI failed on Oct 2, 2023
fanquake referenced this in commit fd5f9cb888 on Oct 3, 2023
fanquake referenced this in commit 61a6c3b0e9 on Oct 10, 2023
fanquake referenced this in commit 9e068f9612 on Oct 13, 2023
fanquake force-pushed on Oct 13, 2023
DrahtBot removed the label CI failed on Oct 13, 2023
Frank-GER referenced this in commit ed1be98396 on Oct 13, 2023
DrahtBot added the label Needs rebase on Nov 13, 2023
fanquake force-pushed on Nov 13, 2023
DrahtBot removed the label Needs rebase on Nov 13, 2023
fanquake force-pushed on Dec 5, 2023
fanquake force-pushed on Dec 8, 2023
DrahtBot added the label CI failed on Jan 14, 2024
DrahtBot added the label Needs rebase on Mar 14, 2024
fanquake force-pushed on Mar 14, 2024
DrahtBot removed the label Needs rebase on Mar 14, 2024
DrahtBot removed the label CI failed on Mar 14, 2024
fanquake force-pushed on Mar 22, 2024
fanquake referenced this in commit 8189f87151 on Mar 22, 2024
fanquake referenced this in commit 555a386824 on Mar 22, 2024
fanquake referenced this in commit fa8398b5b1 on Mar 26, 2024
fanquake referenced this in commit 144ba43995 on Mar 26, 2024
fanquake referenced this in commit 1a5416a1b0 on Mar 26, 2024
fanquake referenced this in commit d4dc8cb660 on Mar 26, 2024
fanquake referenced this in commit d04324a705 on Mar 26, 2024
fanquake renamed this: build: Pointer Authentication and Branch Target Identification for aarch64 Linux (Guix) guix: Pointer Authentication and Branch Target Identification for aarch64 Linux (Guix) on Mar 26, 2024
fanquake force-pushed on Mar 26, 2024
fanquake force-pushed on Apr 1, 2024
DrahtBot added the label CI failed on Apr 1, 2024
DrahtBot removed the label CI failed on Apr 5, 2024
fanquake force-pushed on Apr 26, 2024
fanquake force-pushed on May 16, 2024
fanquake
commented at 4:26 AM on May 16, 2024:
member
DrahtBot added the label CI failed on Jun 26, 2024
DrahtBot
commented at 5:49 PM on June 26, 2024:
contributor
<!--85328a0da195eb286784d51f73fa0af9-->
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.
Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
Leave a comment here, if you need help tracking down a confusing failure.
DrahtBot removed the label CI failed on Jul 11, 2024
hebasto added the label Needs CMake port on Aug 16, 2024
fanquake force-pushed on Aug 23, 2024
fanquake
commented at 12:25 PM on August 23, 2024:
member
Rebased on master and dropped a commit, also bumped the glibc 2.33 branch to the latest commit. Still based on #30433, but the main blocker here remains the glibc bump.
fanquake
commented at 12:28 PM on August 23, 2024:
member
For now, the Guix built bins could be inspected with:
hebasto
commented at 2:20 PM on August 27, 2024:
member
It would be helpful if someone with BTI-enabled hardware could test the binaries and verified BTI during runtime.
Unfortunately, I'm unable to do it by myself, as my hardware supports only PAC, not BTI.
fanquake force-pushed on Aug 28, 2024
fanquake removed the label Needs CMake port on Aug 28, 2024
fanquake force-pushed on Aug 28, 2024
fanquake renamed this: guix: Pointer Authentication and Branch Target Identification for aarch64 Linux (Guix) guix: Pointer Authentication and Branch Target Identification for aarch64 Linux on Sep 13, 2024
fanquake referenced this in commit 06a9f7789e on Sep 13, 2024
fanquake force-pushed on Sep 13, 2024
fanquake force-pushed on Sep 13, 2024
fanquake
commented at 3:27 PM on September 13, 2024:
member
Rebased for #30433, and updated to add an export allowance for __libc_single_threaded.
PastaPastaPasta referenced this in commit f711370123 on Oct 24, 2024
PastaPastaPasta referenced this in commit 6c262329f7 on Oct 24, 2024
PastaPastaPasta referenced this in commit f007abd19d on Oct 24, 2024
fanquake force-pushed on Nov 27, 2024
DrahtBot added the label Needs rebase on Dec 20, 2024
fanquake force-pushed on Jan 6, 2025
DrahtBot removed the label Needs rebase on Jan 6, 2025
fanquake force-pushed on Feb 19, 2025
fanquake force-pushed on Mar 12, 2025
DrahtBot added the label Needs rebase on May 12, 2025
fanquake force-pushed on May 12, 2025
DrahtBot removed the label Needs rebase on May 12, 2025
DrahtBot added the label Needs rebase on Jun 11, 2025
fanquake force-pushed on Jun 11, 2025
DrahtBot removed the label Needs rebase on Jun 11, 2025
fanquake force-pushed on Jul 24, 2025
fanquake force-pushed on Aug 13, 2025
fanquake marked this as ready for review on Oct 21, 2025
fanquake force-pushed on Oct 21, 2025
DrahtBot added the label Needs rebase on Oct 28, 2025
fanquake force-pushed on Oct 28, 2025
DrahtBot removed the label Needs rebase on Oct 28, 2025
guix: use glibc 2.33
glibc 2.32 was the first to ship with support for branch protection when
compiled with a compatible compiler, see below. However a number of
bugfixes/improvements shipped in glibc 2.33, so use that, rather than
trying to backport all relevant changes.
glibc 2.32 release notes: https://lwn.net/Articles/828210/
* AArch64 now supports standard branch protection security hardening
in glibc when it is built with a GCC that is configured with
--enable-standard-branch-protection (or if -mbranch-protection=standard
flag is passed when building both GCC target libraries and glibc,
in either case a custom GCC is needed). This includes branch target
identification (BTI) and pointer authentication for return addresses
(PAC-RET). They require armv8.5-a and armv8.3-a architecture
extensions respectively for the protection to be effective,
otherwise the used instructions are nops. User code can use PAC-RET
without libc support, but BTI requires a libc that is built with BTI
support, otherwise runtime objects linked into user code will not be
BTI compatible.
`__libc_single_threaded` added as it is now exported from at least
`bitcoin-wallet` and `test_bitcoin`.
f6ca2b20f0
fanquake force-pushed on Oct 28, 2025
fanquake
commented at 12:49 PM on November 7, 2025:
member
Ideally #25573 will happen soon, which essentially includes this. So closing for now.
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-05-02 15:14 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me