blob: 90fe41f021e4dd6013af9d2bdc735bca8ef8a6b5 (
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
|
qemu-system-arm regression: NonSecure World can change Secure World MMU mapping.
Description of problem:
A NonSecure execution context is able to override MMU L1 translation table
flags set by Secure context on Secure World memory.
This is not consistent with the same code running on real hardware and it's a
regression over past qemu releases as 9.0.0 behaves correctly.
Steps to reproduce:
This has been tested with
[GoTEE-example](https://github.com/usbarmory/GoTEE-example) as follows:
```
# building tamago
wget https://github.com/usbarmory/tamago-go/archive/refs/tags/latest.zip
unzip latest.zip
cd tamago-go-latest/src && ./all.bash
cd ../bin && export TAMAGO=`pwd`/go
# building and running GoTEE-example
wget https://github.com/usbarmory/GoTEE-example/archive/refs/heads/master.zip
unzip master.zip
cd GoTEE-example
export TARGET=usbarmory && make clean && make nonsecure_os_go && make trusted_applet_go && make trusted_os && make qemu
```
#
Additional information:
The issue relates to the fact that the NonSecure World, at startup, configures
the MMU with the NX bit for the entire address space not belonging to its
firmware .text area.
On real hardware this MMU configuration by NonSecure world does not affect the
Secure World translation tables.
On qemu 9.1.0, however it does and this is inconsistent with real hardware
behavior. On qemu 9.0.0 the behaviour is correct so the issue has been
introduced between these two releases.
The switch between Secure and NonSecure is done
[here](https://github.com/usbarmory/GoTEE/blob/7e62563c0628fed3ee0aebb4702e22be9bb636e3/monitor/exec_arm.s#L73).
The MMU first level address table which sets the NX bit is done
[here](https://github.com/usbarmory/tamago/blob/273d67cd811dfcb1782c0fe596ac14d43d0ce117/arm/mmu.go#L85).
|