Skip to content

Commit 5e59637

Browse files
[CCA] Add a section on MEC.
This also update the LP to use the same stack as other Learning Paths (CCA essential, CCA device assignment, CCA with Kata containers, ...).
1 parent 837f850 commit 5e59637

File tree

4 files changed

+303
-168
lines changed

4 files changed

+303
-168
lines changed

content/learning-paths/servers-and-cloud-computing/cca-container/_index.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@ learning_objectives:
1010
- Create a virtual machine in a Realm running guest Linux using a pre-built docker container.
1111
- Run a simple application in a Realm running guest Linux.
1212
- Obtain a CCA attestation token from the virtual guest in a Realm.
13+
- Run the CCA software stack using MEC (Memory Encryption Contexts)
1314

1415
prerequisites:
15-
- An AArch64 or x86_64 computer running Linux. You can use cloud instances, refer to the list of [Arm cloud service providers](/learning-paths/servers-and-cloud-computing/csp/).
16+
- An AArch64 or x86_64 computer running Linux or MacOS. You can use cloud instances, refer to the list of [Arm cloud service providers](/learning-paths/servers-and-cloud-computing/csp/).
1617

17-
author: Pareena Verma
18+
author:
19+
- Pareena Verma
20+
- Arnaud de Grandmaison
1821

1922
### Tags
2023
skilllevels: Introductory
2124
subjects: Performance and Architecture
2225
armips:
23-
- Neoverse
26+
- Neoverse
2427
operatingsystems:
25-
- Linux
28+
- Linux
2629
tools_software_languages:
2730
- GCC
2831
- FVP
@@ -31,8 +34,12 @@ tools_software_languages:
3134
- Docker
3235
- Runbook
3336

34-
37+
3538
further_reading:
39+
- resource:
40+
title: Learn the architecture - Introducing Arm Confidential Compute Architecture
41+
link: https://developer.arm.com/documentation/den0125
42+
type: documentation
3643
- resource:
3744
title: Arm Confidential Compute Architecture
3845
link: https://www.arm.com/architecture/security-features/arm-confidential-compute-architecture

content/learning-paths/servers-and-cloud-computing/cca-container/cca-container.md

Lines changed: 94 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ layout: "learningpathall"
99
---
1010
## Download the docker image
1111

12-
Start by downloading the docker container image.
12+
Start by downloading the docker container image.
1313

14-
This docker image contains the pre-built binaries for the Arm CCA reference software stack and the Armv-A Base Architecture Envelope Model (AEM) FVP with support for RME extensions.
14+
This docker image contains the pre-built binaries for the Arm CCA reference software stack and the Armv-A Base Architecture Envelope Model (AEM) FVP with support for RME extensions.
1515

1616
Install [docker engine](/install-guides/docker/docker-engine) on your machine.
1717

1818
Pull the docker image from DockerHub:
1919

2020
```console
21-
docker pull armswdev/aemfvp-cca-v2-image
21+
docker pull armswdev/cca-learning-path:cca-simulation-v3
2222
```
2323
Confirm that the docker container image was downloaded successfully:
2424

@@ -29,31 +29,34 @@ docker image list
2929
The output should be similar to:
3030

3131
```output
32-
REPOSITORY TAG IMAGE ID CREATED SIZE
33-
armswdev/aemfvp-cca-v2-image latest e1c36b91d3d7 5 weeks ago 1.34GB
32+
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
33+
34+
...
35+
armswdev/cca-learning-path:cca-simulation-v3 21500198bb93 1.18GB 0B
36+
...
3437
```
3538
Run the docker container:
3639

3740
```console
38-
docker run -it armswdev/aemfvp-cca-v2-image /bin/bash
41+
docker run --rm -it armswdev/cca-learning-path:cca-simulation-v3
3942
```
40-
You are now inside the `/tmp/cca-stack` directory of the running `armswdev/aemfvp-cca-v2-image` container.
43+
You are now inside the home directory (`/home/cca`) of user `cca` in the running `armswdev/cca-learning-path:cca-simulation-v3` container.
4144

4245
```output
43-
ubuntu@84eb170a69b9:/tmp/cca-stack$
46+
cca@a9866f863546:~$
4447
```
4548

4649
## Run the software stack
4750

48-
The pre-built binaries for the Arm CCA reference software stack are present in the `output/aemfvp-a-rme` directory.
51+
The pre-built binaries for the Arm CCA reference software stack are present in the `cca-3world/` directory.
4952

5053
```console
51-
ls output/aemfvp-a-rme/
54+
ls cca-3world/
5255
```
53-
This includes the Trusted Firmware binaries, the host root filesystem and the host Linux kernel image:
56+
This includes the Realm Management Monitor (`rmm.img`), the host root filesystem (`host-rootfs.ext2`) and the host Linux kernel image (`Image`) and the trusted firmware binaries:
5457

5558
```output
56-
Image KVMTOOL_EFI.fd bl1-uefi.bin bl1.bin fip-std-tests.bin fip-uefi.bin fip.bin host-fs.ext4
59+
FVP_AARCH64_EFI.fd Image bl1.bin bl2.bin bl31.bin dt_bootargs.dtb fip.bin host-rootfs.ext2 kselftests.tgz modules.tgz rmm.img
5760
```
5861

5962
These binaries can run on an Armv-A Base Architecture Envelope Model (AEM) FVP with support for RME extensions. AEM FVPs are fixed configuration virtual platforms of Armv8-A and Armv9-A architectures with comprehensive system IP. The FVP is also contained within this docker container.
@@ -68,71 +71,75 @@ Launch the `run-cca-fvp.sh` script to run the Arm CCA pre-built binaries on the
6871
A number of `Info` and `Warning` messages will be emitted by the FVP. These can safely be ignored.
6972
{{% /notice %}}
7073

71-
The `run-cca-fvp.sh` script uses the `screen` command to connect to the different UARTs in the FVP.
74+
The `run-cca-fvp.sh` script uses the `screen` command to connect to the different UARTs in the FVP.
7275

7376
You should see the host Linux kernel boot on your terminal:
7477

7578
```output
76-
udhcpc: started, v1.31.1
77-
udhcpc: sending discover
78-
udhcpc: sending select for 172.20.51.1
79-
udhcpc: lease of 172.20.51.1 obtained, lease time 86400
79+
udhcpc: started, v1.36.1
80+
udhcpc: broadcasting discover
81+
udhcpc: broadcasting select for 172.20.51.1, server 172.20.51.254
82+
udhcpc: lease of 172.20.51.1 obtained from 172.20.51.254, lease time 86400
8083
deleting routers
8184
adding dns 172.20.51.254
82-
FAIL
83-
Starting dropbear sshd: OK
85+
OK
86+
Starting chrony: OK
87+
Starting crond: OK
88+
Setting up macvtap... [ 16.681271] smc91x 1a000000.ethernet eth0: entered promiscuous mode
89+
OK
8490
85-
Welcome to Buildroot
86-
buildroot login:
91+
Welcome to the CCA host
92+
host login:
8793
```
8894

89-
You will be prompted to log in to buildroot. Enter `root` as both the username and password.
95+
You will be prompted to log in to the CCA host. Enter `root` as the username (no password is required).
9096

91-
You have successfully booted four worlds (Root, Secure, Non-secure and Realm) on the FVP at this point:
97+
You have successfully booted 3 worlds (Root, Non-secure and Realm) on the FVP at this point:
9298

9399
* Trusted Firmware-A is running in Root.
94100
* Realm Management Monitor (RMM) in Realm.
95101
* Host Linux in Non-secure.
96-
* Hafnium in Secure.
97102

98103
## Create a virtual guest in a Realm
99104

100-
Guest VMs can be launched in a Realm using `kvmtool` from your host Linux prompt. The kernel `Image` and filesystem `realm-fs.ext4` for the Realm are packaged into the buildroot host file system.
105+
Guest VMs can be launched in a Realm using `kvmtool` from your host Linux prompt. The realm disk image `guest-disk.img` is included into the host file system.
101106

102107
Use `kvmtool` to launch guest Linux in a Realm:
103108

104109
```console
105-
lkvm run --realm --restricted_mem -c 2 -m 256 -k /realm/Image -d /realm/realm-fs.ext4 -p earlycon
110+
cd /cca
111+
./lkvm run --realm --disable-sve --irqchip=gicv3-its --firmware KVMTOOL_EFI.fd -c 1 -m 512 --no-pvtime --force-pci --disk guest-disk.img --measurement-algo=sha256 --restricted_mem
106112
```
113+
107114
You should see the guest Linux kernel starting to boot in a Realm. This step can take several minutes.
108115

109-
After boot up, you will be prompted to log in at the guest Linux buildroot prompt. Use `root` again as both the username and password.
116+
After boot up, you will be prompted to log in at the guest Linux prompt, use the `root` username (no password required):
110117

111118
```output
112-
Starting network: udhcpc: started, v1.31.1
113-
udhcpc: sending discover
114-
udhcpc: sending select for 192.168.33.15
115-
udhcpc: lease of 192.168.33.15 obtained, lease time 14400
119+
udhcpc: started, v1.36.1
120+
udhcpc: broadcasting discover
121+
udhcpc: broadcasting select for 192.168.33.15, server 192.168.33.1
122+
udhcpc: lease of 192.168.33.15 obtained from 192.168.33.1, lease time 14400
116123
deleting routers
117124
adding dns 172.20.51.254
118-
OK
119-
Starting dropbear sshd: OK
125+
FAIL
126+
Starting chrony: OK
127+
Starting crond: OK
128+
Setting up macvtap... OK
120129
121-
Welcome to Buildroot
122-
buildroot login:
130+
Welcome to the CCA realm
131+
realm login:
123132
```
133+
124134
You have successfully created a virtual guest in a Realm using the Arm CCA reference software stack.
125135

126136
## Obtain a CCA attestation token from the virtual guest in a Realm
127137

128-
Attestation tokens are small reports that are produced by a device upon request. Those tokens are composed of key/value pairs called claims. A CCA attestation token is a collection of claims about the state of a Realm and the CCA platform on which the Realm is running.
138+
Attestation tokens are small reports that are produced by a device upon request. Those tokens are composed of key/value pairs called claims. A CCA attestation token is a collection of claims about the state of a Realm and the CCA platform on which the Realm is running.
129139

130140
Refer to [section A7.2 of the Realm Management Monitor Specification](https://developer.arm.com/documentation/den0137/latest/) to learn about the details of the CCA attestation token.
131141

132-
To retrieve a CCA attestation token from the running guest, mount the `configfs` filesystem:
133-
```console
134-
mount -t configfs none /sys/kernel/config
135-
```
142+
The retrieval of a CCA attestation token from a running guest is done by reading from `/sys/kernel/config/tsm/report/`. This is available when linux's `configfs` has been mounted, which has been done automatically as part of the guest boot process --- if you are curious, this is the `configfs /sys/kernel/config configfs defaults 0 0` line in `/etc/fstab`.
136143

137144
You can now generate an attestation token by running the following commands:
138145

@@ -145,62 +152,73 @@ hexdump -C $report/outblob
145152

146153
The output should look like:
147154
```output
148-
00000340 00 00 00 00 19 ac cd 58 61 04 76 f9 88 09 1b e5 |.......Xa.v.....|
149-
00000350 85 ed 41 80 1a ec fa b8 58 54 8c 63 05 7e 16 b0 |..A.....XT.c.~..|
150-
00000360 e6 76 12 0b bd 0d 2f 9c 29 e0 56 c5 d4 1a 01 30 |.v..../.).V....0|
151-
00000370 eb 9c 21 51 78 99 dc 23 14 6b 28 e1 b0 62 bd 3e |..!Qx..#.k(..b.>|
152-
00000380 a4 b3 15 fd 21 9f 1c bb 52 8c b6 e7 4c a4 9b e1 |....!...R...L...|
153-
00000390 67 73 73 4f 61 a1 ca 61 03 1b 2b bf 3d 91 8f 2f |gssOa..a..+.=../|
154-
000003a0 94 ff c4 22 8e 50 91 95 44 ae 19 ac cc 67 73 68 |...".P..D....gsh|
155-
000003b0 61 2d 32 35 36 19 ac d0 67 73 68 61 2d 32 35 36 |a-256...gsha-256|
156-
000003c0 19 ac ce 58 20 d7 6c b0 e0 f4 d1 00 4d 51 5f e6 |...X .l.....MQ_.|
157-
000003d0 c9 20 a8 e4 72 9d 26 61 0c cd 53 6b 8f 37 a3 65 |. ..r.&a..Sk.7.e|
158-
000003e0 aa 03 b0 a2 2c 19 ac cf 84 58 20 00 00 00 00 00 |....,....X .....|
159-
000003f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
160-
00000400 00 00 00 00 00 00 00 00 00 00 00 58 20 00 00 00 |...........X ...|
161-
00000410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
162-
00000420 00 00 00 00 00 00 00 00 00 00 00 00 00 58 20 00 |.............X .|
163-
00000430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
164-
00000440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 |...............X|
165-
00000450 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ...............|
166-
00000460 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
167-
00000470 00 58 60 7c 2e 85 d2 b5 ba d8 ee e1 43 0c 5d f9 |.X`|........C.].|
168-
00000480 38 b8 83 64 a0 75 8d d5 02 a2 43 56 53 ba 2f bc |8..d.u....CVS./.|
169-
00000490 f1 a9 c7 82 b4 d5 b4 63 15 45 71 5c 50 ea eb a0 |.......c.Eq\P...|
170-
000004a0 21 68 c4 7f 1a e5 00 b6 9a a5 3a 78 38 80 c6 96 |!h........:x8...|
171-
000004b0 c8 f6 eb 92 62 f8 80 43 fe dd 7b e6 af 16 f0 04 |....b..C..{.....|
172-
000004c0 54 95 6e 87 aa 53 4a bc e2 a4 ab 4d 84 10 b1 c8 |T.n..SJ....M....|
173-
000004d0 84 0e 06 |...|
174-
000004d3
155+
00000000 d9 01 8f a2 19 ac ca 59 05 ee d2 84 44 a1 01 38 |.......Y....D..8|
156+
00000010 22 a0 59 05 81 a9 19 01 09 78 23 74 61 67 3a 61 |".Y......x#tag:a|
157+
00000020 72 6d 2e 63 6f 6d 2c 32 30 32 33 3a 63 63 61 5f |rm.com,2023:cca_|
158+
00000030 70 6c 61 74 66 6f 72 6d 23 31 2e 30 2e 30 0a 58 |platform#1.0.0.X|
159+
00000040 20 0d 22 e0 8a 98 46 90 58 48 63 18 28 34 89 bd | ."...F.XHc.(4..|
160+
00000050 b3 6f 09 db ef eb 18 64 df 43 3f a6 e5 4e a2 d7 |.o.....d.C?..N..|
161+
00000060 11 19 09 5c 58 20 7f 45 4c 46 02 01 01 00 00 00 |...\X .ELF......|
162+
00000070 00 00 00 00 00 00 03 00 3e 00 01 00 00 00 50 58 |........>.....PX|
163+
00000080 00 00 00 00 00 00 19 01 00 58 21 01 07 06 05 04 |.........X!.....|
164+
00000090 03 02 01 00 0f 0e 0d 0c 0b 0a 09 08 17 16 15 14 |................|
165+
000000a0 13 12 11 10 1f 1e 1d 1c 1b 1a 19 18 19 09 61 44 |..............aD|
166+
000000b0 cf cf cf cf 19 09 5b 19 30 03 19 09 62 67 73 68 |......[.0...bgsh|
167+
000000c0 61 2d 32 35 36 19 09 60 78 3a 68 74 74 70 73 3a |a-256..`x:https:|
168+
000000d0 2f 2f 76 65 72 61 69 73 6f 6e 2e 65 78 61 6d 70 |//veraison.examp|
169+
000000e0 6c 65 2f 2e 77 65 6c 6c 2d 6b 6e 6f 77 6e 2f 76 |le/.well-known/v|
170+
000000f0 65 72 61 69 73 6f 6e 2f 76 65 72 69 66 69 63 61 |eraison/verifica|
171+
00000100 74 69 6f 6e 19 09 5f 8d a4 01 69 52 53 45 5f 42 |tion.._...iRSE_B|
172+
00000110 4c 31 5f 32 05 58 20 53 78 79 63 07 53 5d f3 ec |L1_2.X Sxyc.S]..|
173+
00000120 8d 8b 15 a2 e2 dc 56 41 41 9c 3d 30 60 cf e3 22 |......VAA.=0`.."|
174+
00000130 38 c0 fa 97 3f 7a a3 02 58 20 9a 27 1f 2a 91 6b |8...?z..X .'.*.k|
175+
00000140 0b 6e e6 ce cb 24 26 f0 b3 20 6e f0 74 57 8b e5 |.n...$&.. n.tW..|
176+
00000150 5d 9b c9 4f 6f 3f e3 ab 86 aa 06 67 73 68 61 2d |]..Oo?.....gsha-|
177+
00000160 32 35 36 a4 01 67 52 53 45 5f 42 4c 32 05 58 20 |256..gRSE_BL2.X |
178+
00000170 53 78 79 63 07 53 5d f3 ec 8d 8b 15 a2 e2 dc 56 |Sxyc.S]........V|
179+
...
180+
00000800 88 cf 5b 66 ce b5 30 59 0a d4 81 79 3d e5 02 dc |..[f..0Y...y=...|
181+
00000810 ac 70 bc dc b7 05 b2 cc 40 f1 b6 05 a5 52 57 04 |.p......@....RW.|
182+
00000820 26 7a 24 c5 2e 88 6e a7 b6 18 59 2e 9f e8 58 8d |&z$...n...Y...X.|
183+
00000830 a6 ea 0b 9b 18 90 62 62 07 f0 17 90 b4 27 04 e3 |......bb.....'..|
184+
00000840 ec 89 dd 67 5f 6b 07 47 55 4d a9 7b c1 be d2 03 |...g_k.GUM.{....|
185+
00000850 4f 5d d1 d0 55 d1 |O]..U.|
186+
00000856
175187
```
188+
176189
The output is a CCA attestation token from the guest in the Realm. The CCA attestation token is a Concise Binary Object Representation (CBOR) map, in which the map values are the Realm token and the CCA platform token.
177190

178-
You have successfully generated a CCA attestation token from the guest. In later learning paths, you will learn how to use these tokens as part of the Arm CCA attestation flow.
191+
You have successfully generated a CCA attestation token from the guest. In later learning paths, you will learn how to use these tokens as part of the Arm CCA attestation flow.
179192

180193
You can now shutdown the guest. Use the `poweroff` command.
181194

182195
You should see the following output from the guest:
183196

184197
```output
185-
Stopping dropbear sshd: OK
186-
Stopping network: OK
187-
Saving random seed: OK
198+
(realm) # Destroying macvtap... OK
199+
Stopping crond: stopped /usr/sbin/crond (pid 120) OK
200+
Stopping chrony: OK
201+
Stopping network: ifdown: interface lo not configured OK
188202
Stopping klogd: OK
189-
Stopping syslogd: OK
203+
Stopping syslogd: stopped /sbin/syslogd (pid 66) OK
190204
umount: devtmpfs busy - remounted read-only
191-
[ 42.595975] EXT4-fs (vda): re-mounted 9e9fa588-c41f-404a-a627-6616bb8491b1 ro. Quota mode: none.
205+
[ 1172.990117] EXT4-fs (vda2): re-mounted b984c902-aed2-4217-bbf0-da44ee66446c ro.
192206
The system is going down NOW!
193207
Sent SIGTERM to all processes
194-
logout
195208
Sent SIGKILL to all processes
196209
Requesting system poweroff
197-
[ 44.697156] reboot: Power down
210+
[ 1175.167522] reboot: Power down
198211
Info: KVM session ended normally.
199212
```
213+
200214
The guest has shut down and you are back at the host Linux kernel prompt.
201215

202-
To exit the simulation, use `Ctrl-a + d`. You will be placed back into the running docker container.
216+
To exit the host session and the simulation, use `poweroff`. You will be placed back into the running docker container.
203217

204218
To exit the docker container, run `exit`.
205219

206220
In the next section, you will learn how to run a simple application inside the Realm.
221+
222+
{{% notice Note %}}
223+
The docker session has been started with the `--rm` option, which means the container will be destroyed when it is exited, allowing you to experiment with the images without fear: at the next session, you will get working pristine images ! If you intend your changes to persist across docker sessions, omit the `--rm` option to docker.
224+
{{% /notice %}}

0 commit comments

Comments
 (0)