[mpg123-devel] Opened GH-#15: aarch64: enable PAC/BTI [billatarm]
Brought to you by:
sobukus
From: <ano...@gm...> - 2024-09-06 16:11:18
|
A pull request by billatarm was opened at 2024-09-06 15:17:54+00:00. Please visit https://github.com/madebr/mpg123/pull/15 to give feedback and review the code. --- Enable Pointer Authentication Codes (PAC) and Branch Target Identification (BTI) support for ARM 64 targets. PAC works by signing the LR with either an A key or B key and verifying the return address. Since the assembly code does not push and pop the link register to the stack, and it remains in the register file, their is no need to sign the LR, so PAC is essentially just adding it to the GNU notes section for auditing purposes. BTI works by marking all call and jump positions with bti c and bti j instructions. If execution control transfers via an indirect branch or call to an instruction other than a BTI instruction, the execution is killed via SIGILL. For BTI to work, all object files linked for a unit of execution, whether an executable or a library must have the GNU Notes section of the ELF file marked to indicate BTI support. This is so loader/linkers can apply the proper permission bits (PROT_BRI) on the memory region. PAC can also be annotated in the GNU ELF notes section, but it's not required for enablement, as interleaved PAC and non-pac code works as expected since it's the callee that performs all the checking. Becuase the aarch64 assembly code does not make use of pushing the LR to the stack, only BTI targets were needed to be instrumented and the GNU notes section indicating support for BTU. Thus for PAC the only requirement was to mark the GNU notes section as supporting PAC. Testing was done under the following CFLAGS: 1. -mbranch-protection=none 2. -mbranch-protection=standard 3. -mbranch-protection=pac-ret 4. -mbranch-protection=pac-ret+b-key 5. -mbranch-protection=bti <!-- Please write a little about the why and how of this pull request A mail should automatically get sent to the mpg123-devel mailing list. Before submitting, please check the following: - [ ] Set target branch to `master` - [ ] Write a little text above --> --- patch details: - url: https://github.com/madebr/mpg123/pull/15 - patch: https://github.com/madebr/mpg123/pull/15.patch url details: - user name: billatarm - user url: https://github.com/billatarm |