2 * Memory tagging, unaligned access crossing pages.
3 * https://gitlab.com/qemu-project/qemu/-/issues/403
5 * Copyright (c) 2021 Linaro Ltd
6 * SPDX-License-Identifier: GPL-2.0-or-later
11 int main(int ac
, char **av
)
15 enable_mte(PR_MTE_TCF_SYNC
);
16 p
= alloc_mte_mem(2 * 0x1000);
18 /* Tag the pointer. */
19 p
= (void *)((unsigned long)p
| (1ul << 56));
21 /* Store tag in sequential granules. */
22 asm("stg %0, [%0]" : : "r"(p
+ 0x0ff0));
23 asm("stg %0, [%0]" : : "r"(p
+ 0x1000));
26 * Perform an unaligned store with tag 1 crossing the pages.
27 * Failure dies with SIGSEGV.
29 asm("str %0, [%0]" : : "r"(p
+ 0x0ffc));