@@ -8,7 +8,7 @@ category: Standard
8
8
type : Core
9
9
status : Review
10
10
created : 2025-01-06
11
- feature : GJVDwRkUPNdk9QaK4VsU4g1N41QNxhy1hevjf8kz45Mq
11
+ feature : C37iaPi6VE4CZDueU1vL8y6pGp5i8amAbEsF31xzz723
12
12
---
13
13
14
14
## Summary
@@ -73,45 +73,51 @@ The virtual address space of the stack frames must become consecutive:
73
73
This goes for all programs globally and is not opt-in.
74
74
Thus, this change is independent of SIMD-0166.
75
75
76
- ### VM write access
76
+ ### VM memory access
77
77
78
- When a write access to the input region (` 0x400000000..0x500000000 ` ) happens,
79
- which overlaps with a range in which an accounts payload, including its resize
80
- padding but not its metadata, was serialized it must be checked that:
78
+ The payload address space of an account is the range in the serialized input
79
+ region (` 0x400000000..0x500000000 ` ) which covers the payload and optionally the
80
+ 10 KiB resize padding (if not a loader-v1 program), but not the accounts
81
+ metadata.
82
+
83
+ For loads / read accesses to an accounts payload address space check that:
84
+
85
+ - The access is completely within the current length of the account,
86
+ otherwise ` InstructionError::AccountDataTooSmall ` must be thrown.
87
+
88
+ For stores / write accesses to an accounts payload address space check that:
81
89
82
90
- The account is flagged as writable,
83
91
otherwise ` InstructionError::ReadonlyDataModified ` must be thrown
84
92
- The account is owned by the currently executed program,
85
- otherwise ` InstructionError::ExternalAccountDataModified ` must be thrown
86
-
87
- Thus, changing and later restoring data in unowned accounts is prohibited.
93
+ otherwise ` InstructionError::ExternalAccountDataModified ` must be thrown.
94
+ - The access is completely within the current length of the account,
95
+ otherwise grow the account length and fill it with zeros up to the end of the
96
+ access or the end of the payload address space, which ever is lower.
88
97
89
98
### Syscall slice parameters
90
99
91
- When a range in virtual address space which:
92
-
93
- - starts in any account data (including its resize padding) and leaves it
94
- - starts outside account data and enters it
95
-
96
- is passed to ` memcpy ` , ` memmove ` , ` memset ` , or ` memcmp ` , it must throw
97
- ` SyscallError::InvalidLength ` .
98
-
99
100
Except for CPI, all other syscalls which
100
101
act on ranges in the virtual address space are confined to a single
101
- memory region for now . Meaning they have to stay within one of:
102
+ memory region. Meaning they have to stay within one of:
102
103
103
- - Readonly data
104
- - Stack
105
- - Heap
104
+ - Readonly data (` 0x100000000..0x200000000 ` )
105
+ - Stack (` 0x200000000..0x300000000 ` )
106
+ - Heap (` 0x300000000..0x400000000 ` )
107
+ - Instruction meta data
106
108
- Account meta data
107
- - Account data without resize padding
108
- - Account resize padding
109
+ - Account payload address space
110
+ - Instruction payload
109
111
110
- And can not cross into any other region. This restriction is planned to
111
- be lifted in another SIMD.
112
+ And can not cross into any other region.
112
113
113
114
## Impact
114
115
116
+ Changing and later restoring data in unowned accounts is now prohibited.
117
+ The same goes for growing an unowned account and later truncating it to its
118
+ original length. Or reading from the uninitialized memory beyond the current
119
+ length of any account.
120
+
115
121
These restrictions have been extensively tested by replay against MNB.
116
122
Most of the dApps devs whose dApps would fail have been contacted and had
117
123
their dApps fixed already.
0 commit comments