qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Master cannot execute MTE instructions


From: Derrick McKee
Subject: Master cannot execute MTE instructions
Date: Thu, 10 Sep 2020 11:05:00 -0400

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;
}

--
Derrick McKee
Phone: (703) 957-9362
Email: derrick.mckee@gmail.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]