Commit 04bfcd6
committed
src: support V8 sandbox memory cage in allocators
When V8_ENABLE_SANDBOX is enabled, all ArrayBuffer backing
stores must be allocated within the V8 memory cage — external
pointers cannot be directly wrapped and must be copied into
V8-managed memory instead. This commit refactors allocators in
node_buffer.cc, node_serdes.cc, and node_trace_events.cc to
route allocations through ArrayBuffer::Allocator::NewDefaultAllocator()
when the sandbox is enabled, ensuring memory lands inside the cage.
In node_serdes.cc, ValueSerializer::Delegate is also extended with
ReallocateBufferMemory/FreeBufferMemory overrides so the serializer's
internal buffer is cage-allocated from the start.1 parent 488a854 commit 04bfcd6
File tree
4 files changed
+103
-9
lines changed- src
- api
4 files changed
+103
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | | - | |
309 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
310 | 314 | | |
311 | 315 | | |
312 | 316 | | |
313 | | - | |
| 317 | + | |
314 | 318 | | |
315 | 319 | | |
316 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
532 | | - | |
| 532 | + | |
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
| |||
1452 | 1452 | | |
1453 | 1453 | | |
1454 | 1454 | | |
1455 | | - | |
| 1455 | + | |
1456 | 1456 | | |
1457 | 1457 | | |
1458 | 1458 | | |
| |||
1475 | 1475 | | |
1476 | 1476 | | |
1477 | 1477 | | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
1478 | 1496 | | |
1479 | 1497 | | |
1480 | 1498 | | |
| |||
1485 | 1503 | | |
1486 | 1504 | | |
1487 | 1505 | | |
| 1506 | + | |
1488 | 1507 | | |
1489 | 1508 | | |
1490 | 1509 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
32 | 52 | | |
33 | 53 | | |
34 | 54 | | |
| |||
37 | 57 | | |
38 | 58 | | |
39 | 59 | | |
| 60 | + | |
40 | 61 | | |
41 | 62 | | |
42 | 63 | | |
43 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
44 | 69 | | |
45 | 70 | | |
46 | 71 | | |
| |||
61 | 86 | | |
62 | 87 | | |
63 | 88 | | |
| 89 | + | |
64 | 90 | | |
65 | 91 | | |
66 | 92 | | |
| |||
145 | 171 | | |
146 | 172 | | |
147 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
148 | 192 | | |
149 | 193 | | |
150 | 194 | | |
| |||
208 | 252 | | |
209 | 253 | | |
210 | 254 | | |
211 | | - | |
212 | | - | |
213 | 255 | | |
| 256 | + | |
214 | 257 | | |
215 | 258 | | |
216 | 259 | | |
217 | 260 | | |
218 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
219 | 274 | | |
220 | 275 | | |
221 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
133 | 147 | | |
134 | 148 | | |
135 | | - | |
| 149 | + | |
136 | 150 | | |
137 | 151 | | |
| 152 | + | |
| 153 | + | |
138 | 154 | | |
139 | 155 | | |
140 | 156 | | |
| |||
0 commit comments