Hi,
As of commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a compiled with the default configuration, softmmu-aarch64 issues an illegal instruction fault when executing a memory tag instruction. Below is a minimal code example that triggers the bug.
#include <sys/mman.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define ADDRESS_TAG_START 56
#define PROT_MTE 0x20 /* Taken from arm Linux commit df9d7a22dd21c926e8175ccc6e176cb45fc7cb09 */
int main(int argc, char** argv) {
uintptr_t m = (uintptr_t)mmap(NULL, 16, PROT_MTE | PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if(!m) {
printf("mmap failed\n");
exit(1);
}
uintptr_t tagged_addr = m | (1ul << ADDRESS_TAG_START);
asm("stg %[tag], [%[addr]]"
:
: [tag] "r"(tagged_addr), [addr] "r"(m)
:
);
printf("Tag completed\n");
return 0;
}