Regarding using the MTE option for LLDB Testing

Hello,

So I came across this nicely written tutorial on how to get started on LLDB: Testing LLDB using QEMU — The LLDB Debugger (llvm.org)

I have been able to follow all of the instructions provided in the above link, and I was able to test QEMU working without MTE option. Therefore, I was wondering if anyone was able to get the above tutorial working by enabling the MTE feature. I have created a custom kernel image with the MTE feature enabled

~/llvm-project-13/lldb/scripts/lldb-test-qemu/linux.build/arm64 » grep -Hnri MTE .config                                                                                                                                                                                                                  
.config:486:CONFIG_ARM64_AS_HAS_MTE=y
.config:487:CONFIG_ARM64_MTE=y

For instance, if I were to run the command shown in tutorial:

sudo bash run-qemu.sh --arch arm64 --rootfs ./buster-arm64-rootfs.img --kernel ./linux.build/arm64/arch/arm64/boot/Image --qemu ./qemu.git/build/qemu-system-aarch64 --mte 

I get an output that states:

qemu-system-aarch64: MTE requested, but not supported by the guest CPU

I have tried searching through websites to see whether I can find a solution, but haven’t been able to find anything. Has anyone got this tutorial to work with MTE? I was hoping to follow the steps provided Debugging Memory Tagging with LLDB 13 upon getting the LLDB to work.

Kind regards,

My guess is --mte hasn’t been tested without --sve and also needs -cpu max like SVE, i.e. QEMU_CPU=“max” in run-qemu.sh.

1 Like

Wow… didn’t even think about this.

I just tried

sudo bash run-qemu.sh --arch arm64 --rootfs ./buster-arm64-rootfs.img --kernel ./linux.build/arm64_MTE/arch/arm64/boot/Image --qemu ./qemu.git/build/qemu-system-aarch64 --sve --mte 

as you suggested and it worked.

[    0.000000] CPU features: detected: Address authentication (architected QARMA5 algorithm)
[    0.000000] CPU features: detected: Hardware dirty bit management
[    0.000000] CPU features: detected: Memory Tagging Extension
[    0.000000] CPU features: detected: Asymmetric MTE Tag Check Fault
[    0.000000] CPU features: detected: Spectre-v4

Thank you very much.

The guess was spot on, I usually have all of the things enabled.

I’ve fixed the script in [lldb][AArch64] Fix run-qemu.sh when only MTE is enabled. · llvm/llvm-project@5193c4a · GitHub.

1 Like

Thank you very much!