blob: 647ca44c2ed64794ef6d4c61fa4d35a581f7da72 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
architecture: 0.981
register: 0.894
performance: 0.860
graphic: 0.821
boot: 0.809
semantic: 0.738
device: 0.730
TCG: 0.709
arm: 0.707
debug: 0.680
mistranslation: 0.585
assembly: 0.543
ppc: 0.530
network: 0.505
vnc: 0.500
x86: 0.499
PID: 0.491
files: 0.488
risc-v: 0.474
VMM: 0.455
i386: 0.438
peripherals: 0.433
socket: 0.425
user-level: 0.405
permissions: 0.396
virtual: 0.366
hypervisor: 0.216
kernel: 0.162
KVM: 0.068
--------------------
arm: 0.958
TCG: 0.864
boot: 0.835
debug: 0.762
kernel: 0.489
architecture: 0.476
assembly: 0.220
files: 0.161
register: 0.111
semantic: 0.089
performance: 0.024
user-level: 0.021
PID: 0.019
hypervisor: 0.017
device: 0.015
VMM: 0.010
KVM: 0.008
virtual: 0.008
risc-v: 0.007
socket: 0.005
vnc: 0.004
ppc: 0.004
peripherals: 0.003
permissions: 0.002
network: 0.002
graphic: 0.001
x86: 0.001
mistranslation: 0.001
i386: 0.001
[AARCH64] STGP instruction is not writing the value of the second register to memory
Description of problem:
My application is built with Clang 16 and the option -fsanitize=memtag-stack.
It means the the MTE protection is activated for the stack.
The local variables are tagged and the compiler is often using the STGP instruction "Store Allocation Tag and Pair of registers" in order to transfer the value of two 64-bit registers to memory.
The following instruction was not working as expected:
18004: 69000895 stgp x21, x2, [x4]
The value of the second register x2 is not transferred to the memory.
Only x21 is written.
I think that the issue is in trans_STGP().
We don't call finalize_memop_pair() like we do for in the general trans_STP().
```
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index 7d0c8f79a7..f599f3e136 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -3034,6 +3034,8 @@ static bool trans_STGP(DisasContext *s, arg_ldstpair *a)
tcg_rt = cpu_reg(s, a->rt);
tcg_rt2 = cpu_reg(s, a->rt2);
+ mop = a->sz + 1;
+ mop = finalize_memop_pair(s, mop);
assert(a->sz == 3);
```
With this fix, my OS (Kinibi) is now able to boot.
|