interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / crates / aienos-artifact-tool / fixtures / p2_6 / p26seed / probe.S

131 lines · 3695 bytes Raw Blame History
1// P2-6B first SEED-0B capability artifact: AArch64 EL0, position
2// independent, no relocations. It requests exactly one capability: READ on
3// SEED object 1, bytes [0, 32). Entry (task_runtime ABI): x0 = handle array,
4// x1 = handle count, x2 = data base, x3 = data memory length.
5//
6// Exit 0 only if every allow/deny result is exactly as expected; otherwise
7// each set bit names one failed expectation:
8// 0x001 handle count != 1
9// 0x002 authenticated data word missing
10// 0x004 READ(handle, 0) != SEED word 0 (authorized read)
11// 0x008 READ(handle, 24) != SEED word 3 (authorized read)
12// 0x010 WRITE(handle, 0) not denied (WRITE never granted)
13// 0x020 READ(handle, 0) changed after the denied write
14// 0x040 forged-generation handle not denied
15// 0x080 never-issued slot handle not denied
16// 0x100 zero handle not denied (no ambient authority)
17// 0x200 READ(handle, 32) past the grant not denied
18 .text
19 .global _start
20_start:
21 mov x19, x0 // handle array
22 mov x20, x1 // handle count
23 mov x21, x2 // data base
24 mov x22, xzr // failure bitmask
25
26 // SEED word 0 = 0xa1e05eed00000001 in x24, word 3 in x25.
27 movz x24, #0x0001
28 movk x24, #0x5eed, lsl #32
29 movk x24, #0xa1e0, lsl #48
30 movz x25, #0x0004
31 movk x25, #0x5eed, lsl #32
32 movk x25, #0xa1e0, lsl #48
33
34 cmp x20, #1
35 b.eq 1f
36 orr x22, x22, #0x001
37 b 90f // no handle: nothing else is meaningful
381:
39 // 0x002: data section is "SEED0B-1" = 0x312d423044454553
40 ldr x9, [x21]
41 movz x10, #0x4553
42 movk x10, #0x4445, lsl #16
43 movk x10, #0x4230, lsl #32
44 movk x10, #0x312d, lsl #48
45 cmp x9, x10
46 b.eq 2f
47 orr x22, x22, #0x002
482:
49 ldr x23, [x19] // the one granted handle
50
51 // 0x004: authorized READ at offset 0
52 mov x0, x23
53 mov x1, #0
54 mov x8, #6
55 svc #0
56 cmp x0, x24
57 b.eq 3f
58 orr x22, x22, #0x004
593:
60 // 0x008: authorized READ at offset 24
61 mov x0, x23
62 mov x1, #24
63 mov x8, #6
64 svc #0
65 cmp x0, x25
66 b.eq 4f
67 orr x22, x22, #0x008
684:
69 // 0x010: WRITE through the READ-only handle must be denied
70 mov x0, x23
71 mov x1, #0
72 mov x2, #0x57
73 mov x8, #7
74 svc #0
75 cmn x0, #1
76 b.eq 5f
77 orr x22, x22, #0x010
785:
79 // 0x020: the denied write had no effect
80 mov x0, x23
81 mov x1, #0
82 mov x8, #6
83 svc #0
84 cmp x0, x24
85 b.eq 6f
86 orr x22, x22, #0x020
876:
88 // 0x040: forged generation (flip generation bit 0)
89 mov x9, #1
90 lsl x9, x9, #32
91 eor x0, x23, x9
92 mov x1, #0
93 mov x8, #6
94 svc #0
95 cmn x0, #1
96 b.eq 7f
97 orr x22, x22, #0x040
987:
99 // 0x080: slot 1 was never issued (index 1, generation 1)
100 mov x9, #1
101 lsl x9, x9, #32
102 orr x0, x9, #1
103 mov x1, #0
104 mov x8, #6
105 svc #0
106 cmn x0, #1
107 b.eq 8f
108 orr x22, x22, #0x080
1098:
110 // 0x100: no ambient authority — the zero handle names nothing
111 mov x0, xzr
112 mov x1, #0
113 mov x8, #6
114 svc #0
115 cmn x0, #1
116 b.eq 9f
117 orr x22, x22, #0x100
1189:
119 // 0x200: offset 32 is outside the granted byte range [0, 32)
120 mov x0, x23
121 mov x1, #32
122 mov x8, #6
123 svc #0
124 cmn x0, #1
125 b.eq 90f
126 orr x22, x22, #0x200
12790:
128 mov x0, x22
129 mov x8, #2
130 svc #0
13191: b 91b