KhronosGroup/Vulkan-Loader

`unknown_ext_chain_gas_aarch64.S` does not support PAC/BTI

ggardet opened this issue · 1 comments

Describe the bug
On aarch64/arm64, when we build with -mbranch-protection=standard to enable Pointer Authentication (PAC) and Branch Target Identification (BTI), the final link disable them, because unknown_ext_chain_gas_aarch64.S does not support PAC and BTI.

The following warning message shows the issue:

[   22s] /usr/lib64/gcc/aarch64-suse-linux/13/../../../../aarch64-suse-linux/bin/ld: CMakeFiles/vulkan.dir/unknown_ext_chain_gas_aarch64.S.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.

This is a matter to add paciasp/autiasp in start/end of functions for PAC and BTI C (or hint #34) as landing pad on branches for BTI.

More information on :

Environment (please complete the following information):

  • OS: openSUSE Tumbleweed aarch64
  • Bitdepth: 64-bit
  • GPU: N/A
  • Graphics Driver: N/A
  • SDK or header version if building from repo: N/A
  • Enabled layers: N/A

To Reproduce
Steps to reproduce the behavior:

  1. Build with -mbranch-protection=standard and add -z force-bti to LD_FLAGS
  2. See the warning message above

VK_LOADER_DEBUG output
N/A

Additional context

Thank you for reporting this bug.

Unfortunately, I did not write the aarch64 assembly code nor do I have the requisite skills to make this change, not without investing a large amount of time into the issue. (And my current priorities do not let me invest that time right now).

The assembly code the loader uses is to handle 'unknown' functions, which is necessary because the loader wraps the VkPhysicalDevice handle returned by the driver. As such, the code mostly just dereferences the first parameter (wrapped VkPhysicalDevice), offsets into the structure that the handle to get the drivers VkPhysicalDevice which is used to overwrite the first parameter before calling the driver's function.

The assembly code doesn't make use of functions as far as I can tell. Because I am unfamiliar with PAC/BTI, I am unsure what consequence this has on any potential implementation.