Skip to content

[AARCH64] GP bit (BTI) lost during two stages translation

Host environment

  • Operating system: Ubuntu 20.04.6 LTS
  • OS/kernel version: Linux 5.4.0-153-generic #170-Ubuntu SMP Fri Jun 16 13:43:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
  • Architecture:
  • QEMU flavor: qemu-system-aarch64
  • QEMU version: ec6f9f13

Emulated/Virtualized environment

  • Operating system: Kinibi (SEL1)
  • Hafnium (SEL2)
  • OS/kernel version: latest
  • Architecture: AARCH64

Description of problem

I noticed that the BTI faults were not reported. That's because the GP (guarded page) information is lost during the two stages translation in get_phys_addr_twostage(). The "guarded" information is correctly retrieved by the first call to get_phys_addr_nogpc() but overwritten by the the second call to get_phys_addr_nogpc(). The call to combine_cacheattrs() copies cacheattrs1.guarded but this field is never modified.

The attached patch fixes the issue for me. get_phys_addr_twostage_bti_gp_bit_lost_master.patch

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information