github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/mm/mm_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package mm 4 5 import ( 6 "context" 7 8 "github.com/metacubex/gvisor/pkg/state" 9 ) 10 11 func (a *aioManager) StateTypeName() string { 12 return "pkg/sentry/mm.aioManager" 13 } 14 15 func (a *aioManager) StateFields() []string { 16 return []string{ 17 "contexts", 18 } 19 } 20 21 func (a *aioManager) beforeSave() {} 22 23 // +checklocksignore 24 func (a *aioManager) StateSave(stateSinkObject state.Sink) { 25 a.beforeSave() 26 stateSinkObject.Save(0, &a.contexts) 27 } 28 29 func (a *aioManager) afterLoad(context.Context) {} 30 31 // +checklocksignore 32 func (a *aioManager) StateLoad(ctx context.Context, stateSourceObject state.Source) { 33 stateSourceObject.Load(0, &a.contexts) 34 } 35 36 func (i *ioResult) StateTypeName() string { 37 return "pkg/sentry/mm.ioResult" 38 } 39 40 func (i *ioResult) StateFields() []string { 41 return []string{ 42 "data", 43 "ioEntry", 44 } 45 } 46 47 func (i *ioResult) beforeSave() {} 48 49 // +checklocksignore 50 func (i *ioResult) StateSave(stateSinkObject state.Sink) { 51 i.beforeSave() 52 stateSinkObject.Save(0, &i.data) 53 stateSinkObject.Save(1, &i.ioEntry) 54 } 55 56 func (i *ioResult) afterLoad(context.Context) {} 57 58 // +checklocksignore 59 func (i *ioResult) StateLoad(ctx context.Context, stateSourceObject state.Source) { 60 stateSourceObject.Load(0, &i.data) 61 stateSourceObject.Load(1, &i.ioEntry) 62 } 63 64 func (aio *AIOContext) StateTypeName() string { 65 return "pkg/sentry/mm.AIOContext" 66 } 67 68 func (aio *AIOContext) StateFields() []string { 69 return []string{ 70 "results", 71 "maxOutstanding", 72 "outstanding", 73 } 74 } 75 76 func (aio *AIOContext) beforeSave() {} 77 78 // +checklocksignore 79 func (aio *AIOContext) StateSave(stateSinkObject state.Sink) { 80 aio.beforeSave() 81 if !state.IsZeroValue(&aio.dead) { 82 state.Failf("dead is %#v, expected zero", &aio.dead) 83 } 84 stateSinkObject.Save(0, &aio.results) 85 stateSinkObject.Save(1, &aio.maxOutstanding) 86 stateSinkObject.Save(2, &aio.outstanding) 87 } 88 89 // +checklocksignore 90 func (aio *AIOContext) StateLoad(ctx context.Context, stateSourceObject state.Source) { 91 stateSourceObject.Load(0, &aio.results) 92 stateSourceObject.Load(1, &aio.maxOutstanding) 93 stateSourceObject.Load(2, &aio.outstanding) 94 stateSourceObject.AfterLoad(func() { aio.afterLoad(ctx) }) 95 } 96 97 func (m *aioMappable) StateTypeName() string { 98 return "pkg/sentry/mm.aioMappable" 99 } 100 101 func (m *aioMappable) StateFields() []string { 102 return []string{ 103 "aioMappableRefs", 104 "fr", 105 } 106 } 107 108 func (m *aioMappable) beforeSave() {} 109 110 // +checklocksignore 111 func (m *aioMappable) StateSave(stateSinkObject state.Sink) { 112 m.beforeSave() 113 stateSinkObject.Save(0, &m.aioMappableRefs) 114 stateSinkObject.Save(1, &m.fr) 115 } 116 117 // +checklocksignore 118 func (m *aioMappable) StateLoad(ctx context.Context, stateSourceObject state.Source) { 119 stateSourceObject.Load(0, &m.aioMappableRefs) 120 stateSourceObject.Load(1, &m.fr) 121 stateSourceObject.AfterLoad(func() { m.afterLoad(ctx) }) 122 } 123 124 func (r *aioMappableRefs) StateTypeName() string { 125 return "pkg/sentry/mm.aioMappableRefs" 126 } 127 128 func (r *aioMappableRefs) StateFields() []string { 129 return []string{ 130 "refCount", 131 } 132 } 133 134 func (r *aioMappableRefs) beforeSave() {} 135 136 // +checklocksignore 137 func (r *aioMappableRefs) StateSave(stateSinkObject state.Sink) { 138 r.beforeSave() 139 stateSinkObject.Save(0, &r.refCount) 140 } 141 142 // +checklocksignore 143 func (r *aioMappableRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) { 144 stateSourceObject.Load(0, &r.refCount) 145 stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) }) 146 } 147 148 func (l *ioList) StateTypeName() string { 149 return "pkg/sentry/mm.ioList" 150 } 151 152 func (l *ioList) StateFields() []string { 153 return []string{ 154 "head", 155 "tail", 156 } 157 } 158 159 func (l *ioList) beforeSave() {} 160 161 // +checklocksignore 162 func (l *ioList) StateSave(stateSinkObject state.Sink) { 163 l.beforeSave() 164 stateSinkObject.Save(0, &l.head) 165 stateSinkObject.Save(1, &l.tail) 166 } 167 168 func (l *ioList) afterLoad(context.Context) {} 169 170 // +checklocksignore 171 func (l *ioList) StateLoad(ctx context.Context, stateSourceObject state.Source) { 172 stateSourceObject.Load(0, &l.head) 173 stateSourceObject.Load(1, &l.tail) 174 } 175 176 func (e *ioEntry) StateTypeName() string { 177 return "pkg/sentry/mm.ioEntry" 178 } 179 180 func (e *ioEntry) StateFields() []string { 181 return []string{ 182 "next", 183 "prev", 184 } 185 } 186 187 func (e *ioEntry) beforeSave() {} 188 189 // +checklocksignore 190 func (e *ioEntry) StateSave(stateSinkObject state.Sink) { 191 e.beforeSave() 192 stateSinkObject.Save(0, &e.next) 193 stateSinkObject.Save(1, &e.prev) 194 } 195 196 func (e *ioEntry) afterLoad(context.Context) {} 197 198 // +checklocksignore 199 func (e *ioEntry) StateLoad(ctx context.Context, stateSourceObject state.Source) { 200 stateSourceObject.Load(0, &e.next) 201 stateSourceObject.Load(1, &e.prev) 202 } 203 204 func (mm *MemoryManager) StateTypeName() string { 205 return "pkg/sentry/mm.MemoryManager" 206 } 207 208 func (mm *MemoryManager) StateFields() []string { 209 return []string{ 210 "p", 211 "layout", 212 "users", 213 "vmas", 214 "brk", 215 "usageAS", 216 "lockedAS", 217 "dataAS", 218 "defMLockMode", 219 "pmas", 220 "curRSS", 221 "maxRSS", 222 "dumpability", 223 "argv", 224 "envv", 225 "auxv", 226 "executable", 227 "aioManager", 228 "sleepForActivation", 229 "vdsoSigReturnAddr", 230 "membarrierPrivateEnabled", 231 "membarrierRSeqEnabled", 232 } 233 } 234 235 func (mm *MemoryManager) beforeSave() {} 236 237 // +checklocksignore 238 func (mm *MemoryManager) StateSave(stateSinkObject state.Sink) { 239 mm.beforeSave() 240 if !state.IsZeroValue(&mm.active) { 241 state.Failf("active is %#v, expected zero", &mm.active) 242 } 243 if !state.IsZeroValue(&mm.captureInvalidations) { 244 state.Failf("captureInvalidations is %#v, expected zero", &mm.captureInvalidations) 245 } 246 stateSinkObject.Save(0, &mm.p) 247 stateSinkObject.Save(1, &mm.layout) 248 stateSinkObject.Save(2, &mm.users) 249 stateSinkObject.Save(3, &mm.vmas) 250 stateSinkObject.Save(4, &mm.brk) 251 stateSinkObject.Save(5, &mm.usageAS) 252 stateSinkObject.Save(6, &mm.lockedAS) 253 stateSinkObject.Save(7, &mm.dataAS) 254 stateSinkObject.Save(8, &mm.defMLockMode) 255 stateSinkObject.Save(9, &mm.pmas) 256 stateSinkObject.Save(10, &mm.curRSS) 257 stateSinkObject.Save(11, &mm.maxRSS) 258 stateSinkObject.Save(12, &mm.dumpability) 259 stateSinkObject.Save(13, &mm.argv) 260 stateSinkObject.Save(14, &mm.envv) 261 stateSinkObject.Save(15, &mm.auxv) 262 stateSinkObject.Save(16, &mm.executable) 263 stateSinkObject.Save(17, &mm.aioManager) 264 stateSinkObject.Save(18, &mm.sleepForActivation) 265 stateSinkObject.Save(19, &mm.vdsoSigReturnAddr) 266 stateSinkObject.Save(20, &mm.membarrierPrivateEnabled) 267 stateSinkObject.Save(21, &mm.membarrierRSeqEnabled) 268 } 269 270 // +checklocksignore 271 func (mm *MemoryManager) StateLoad(ctx context.Context, stateSourceObject state.Source) { 272 stateSourceObject.Load(0, &mm.p) 273 stateSourceObject.Load(1, &mm.layout) 274 stateSourceObject.Load(2, &mm.users) 275 stateSourceObject.Load(3, &mm.vmas) 276 stateSourceObject.Load(4, &mm.brk) 277 stateSourceObject.Load(5, &mm.usageAS) 278 stateSourceObject.Load(6, &mm.lockedAS) 279 stateSourceObject.Load(7, &mm.dataAS) 280 stateSourceObject.Load(8, &mm.defMLockMode) 281 stateSourceObject.Load(9, &mm.pmas) 282 stateSourceObject.Load(10, &mm.curRSS) 283 stateSourceObject.Load(11, &mm.maxRSS) 284 stateSourceObject.Load(12, &mm.dumpability) 285 stateSourceObject.Load(13, &mm.argv) 286 stateSourceObject.Load(14, &mm.envv) 287 stateSourceObject.Load(15, &mm.auxv) 288 stateSourceObject.Load(16, &mm.executable) 289 stateSourceObject.Load(17, &mm.aioManager) 290 stateSourceObject.Load(18, &mm.sleepForActivation) 291 stateSourceObject.Load(19, &mm.vdsoSigReturnAddr) 292 stateSourceObject.Load(20, &mm.membarrierPrivateEnabled) 293 stateSourceObject.Load(21, &mm.membarrierRSeqEnabled) 294 stateSourceObject.AfterLoad(func() { mm.afterLoad(ctx) }) 295 } 296 297 func (v *vma) StateTypeName() string { 298 return "pkg/sentry/mm.vma" 299 } 300 301 func (v *vma) StateFields() []string { 302 return []string{ 303 "mappable", 304 "off", 305 "realPerms", 306 "dontfork", 307 "mlockMode", 308 "numaPolicy", 309 "numaNodemask", 310 "id", 311 "hint", 312 "lastFault", 313 } 314 } 315 316 func (v *vma) beforeSave() {} 317 318 // +checklocksignore 319 func (v *vma) StateSave(stateSinkObject state.Sink) { 320 v.beforeSave() 321 var realPermsValue int 322 realPermsValue = v.saveRealPerms() 323 stateSinkObject.SaveValue(2, realPermsValue) 324 stateSinkObject.Save(0, &v.mappable) 325 stateSinkObject.Save(1, &v.off) 326 stateSinkObject.Save(3, &v.dontfork) 327 stateSinkObject.Save(4, &v.mlockMode) 328 stateSinkObject.Save(5, &v.numaPolicy) 329 stateSinkObject.Save(6, &v.numaNodemask) 330 stateSinkObject.Save(7, &v.id) 331 stateSinkObject.Save(8, &v.hint) 332 stateSinkObject.Save(9, &v.lastFault) 333 } 334 335 func (v *vma) afterLoad(context.Context) {} 336 337 // +checklocksignore 338 func (v *vma) StateLoad(ctx context.Context, stateSourceObject state.Source) { 339 stateSourceObject.Load(0, &v.mappable) 340 stateSourceObject.Load(1, &v.off) 341 stateSourceObject.Load(3, &v.dontfork) 342 stateSourceObject.Load(4, &v.mlockMode) 343 stateSourceObject.Load(5, &v.numaPolicy) 344 stateSourceObject.Load(6, &v.numaNodemask) 345 stateSourceObject.Load(7, &v.id) 346 stateSourceObject.Load(8, &v.hint) 347 stateSourceObject.Load(9, &v.lastFault) 348 stateSourceObject.LoadValue(2, new(int), func(y any) { v.loadRealPerms(ctx, y.(int)) }) 349 } 350 351 func (p *pma) StateTypeName() string { 352 return "pkg/sentry/mm.pma" 353 } 354 355 func (p *pma) StateFields() []string { 356 return []string{ 357 "file", 358 "off", 359 "translatePerms", 360 "effectivePerms", 361 "maxPerms", 362 "needCOW", 363 "private", 364 } 365 } 366 367 func (p *pma) beforeSave() {} 368 369 // +checklocksignore 370 func (p *pma) StateSave(stateSinkObject state.Sink) { 371 p.beforeSave() 372 var fileValue string 373 fileValue = p.saveFile() 374 stateSinkObject.SaveValue(0, fileValue) 375 stateSinkObject.Save(1, &p.off) 376 stateSinkObject.Save(2, &p.translatePerms) 377 stateSinkObject.Save(3, &p.effectivePerms) 378 stateSinkObject.Save(4, &p.maxPerms) 379 stateSinkObject.Save(5, &p.needCOW) 380 stateSinkObject.Save(6, &p.private) 381 } 382 383 func (p *pma) afterLoad(context.Context) {} 384 385 // +checklocksignore 386 func (p *pma) StateLoad(ctx context.Context, stateSourceObject state.Source) { 387 stateSourceObject.Load(1, &p.off) 388 stateSourceObject.Load(2, &p.translatePerms) 389 stateSourceObject.Load(3, &p.effectivePerms) 390 stateSourceObject.Load(4, &p.maxPerms) 391 stateSourceObject.Load(5, &p.needCOW) 392 stateSourceObject.Load(6, &p.private) 393 stateSourceObject.LoadValue(0, new(string), func(y any) { p.loadFile(ctx, y.(string)) }) 394 } 395 396 func (s *pmaSet) StateTypeName() string { 397 return "pkg/sentry/mm.pmaSet" 398 } 399 400 func (s *pmaSet) StateFields() []string { 401 return []string{ 402 "root", 403 } 404 } 405 406 func (s *pmaSet) beforeSave() {} 407 408 // +checklocksignore 409 func (s *pmaSet) StateSave(stateSinkObject state.Sink) { 410 s.beforeSave() 411 var rootValue []pmaFlatSegment 412 rootValue = s.saveRoot() 413 stateSinkObject.SaveValue(0, rootValue) 414 } 415 416 func (s *pmaSet) afterLoad(context.Context) {} 417 418 // +checklocksignore 419 func (s *pmaSet) StateLoad(ctx context.Context, stateSourceObject state.Source) { 420 stateSourceObject.LoadValue(0, new([]pmaFlatSegment), func(y any) { s.loadRoot(ctx, y.([]pmaFlatSegment)) }) 421 } 422 423 func (n *pmanode) StateTypeName() string { 424 return "pkg/sentry/mm.pmanode" 425 } 426 427 func (n *pmanode) StateFields() []string { 428 return []string{ 429 "nrSegments", 430 "parent", 431 "parentIndex", 432 "hasChildren", 433 "maxGap", 434 "keys", 435 "values", 436 "children", 437 } 438 } 439 440 func (n *pmanode) beforeSave() {} 441 442 // +checklocksignore 443 func (n *pmanode) StateSave(stateSinkObject state.Sink) { 444 n.beforeSave() 445 stateSinkObject.Save(0, &n.nrSegments) 446 stateSinkObject.Save(1, &n.parent) 447 stateSinkObject.Save(2, &n.parentIndex) 448 stateSinkObject.Save(3, &n.hasChildren) 449 stateSinkObject.Save(4, &n.maxGap) 450 stateSinkObject.Save(5, &n.keys) 451 stateSinkObject.Save(6, &n.values) 452 stateSinkObject.Save(7, &n.children) 453 } 454 455 func (n *pmanode) afterLoad(context.Context) {} 456 457 // +checklocksignore 458 func (n *pmanode) StateLoad(ctx context.Context, stateSourceObject state.Source) { 459 stateSourceObject.Load(0, &n.nrSegments) 460 stateSourceObject.Load(1, &n.parent) 461 stateSourceObject.Load(2, &n.parentIndex) 462 stateSourceObject.Load(3, &n.hasChildren) 463 stateSourceObject.Load(4, &n.maxGap) 464 stateSourceObject.Load(5, &n.keys) 465 stateSourceObject.Load(6, &n.values) 466 stateSourceObject.Load(7, &n.children) 467 } 468 469 func (p *pmaFlatSegment) StateTypeName() string { 470 return "pkg/sentry/mm.pmaFlatSegment" 471 } 472 473 func (p *pmaFlatSegment) StateFields() []string { 474 return []string{ 475 "Start", 476 "End", 477 "Value", 478 } 479 } 480 481 func (p *pmaFlatSegment) beforeSave() {} 482 483 // +checklocksignore 484 func (p *pmaFlatSegment) StateSave(stateSinkObject state.Sink) { 485 p.beforeSave() 486 stateSinkObject.Save(0, &p.Start) 487 stateSinkObject.Save(1, &p.End) 488 stateSinkObject.Save(2, &p.Value) 489 } 490 491 func (p *pmaFlatSegment) afterLoad(context.Context) {} 492 493 // +checklocksignore 494 func (p *pmaFlatSegment) StateLoad(ctx context.Context, stateSourceObject state.Source) { 495 stateSourceObject.Load(0, &p.Start) 496 stateSourceObject.Load(1, &p.End) 497 stateSourceObject.Load(2, &p.Value) 498 } 499 500 func (m *SpecialMappable) StateTypeName() string { 501 return "pkg/sentry/mm.SpecialMappable" 502 } 503 504 func (m *SpecialMappable) StateFields() []string { 505 return []string{ 506 "SpecialMappableRefs", 507 "fr", 508 "name", 509 } 510 } 511 512 func (m *SpecialMappable) beforeSave() {} 513 514 // +checklocksignore 515 func (m *SpecialMappable) StateSave(stateSinkObject state.Sink) { 516 m.beforeSave() 517 stateSinkObject.Save(0, &m.SpecialMappableRefs) 518 stateSinkObject.Save(1, &m.fr) 519 stateSinkObject.Save(2, &m.name) 520 } 521 522 // +checklocksignore 523 func (m *SpecialMappable) StateLoad(ctx context.Context, stateSourceObject state.Source) { 524 stateSourceObject.Load(0, &m.SpecialMappableRefs) 525 stateSourceObject.Load(1, &m.fr) 526 stateSourceObject.Load(2, &m.name) 527 stateSourceObject.AfterLoad(func() { m.afterLoad(ctx) }) 528 } 529 530 func (r *SpecialMappableRefs) StateTypeName() string { 531 return "pkg/sentry/mm.SpecialMappableRefs" 532 } 533 534 func (r *SpecialMappableRefs) StateFields() []string { 535 return []string{ 536 "refCount", 537 } 538 } 539 540 func (r *SpecialMappableRefs) beforeSave() {} 541 542 // +checklocksignore 543 func (r *SpecialMappableRefs) StateSave(stateSinkObject state.Sink) { 544 r.beforeSave() 545 stateSinkObject.Save(0, &r.refCount) 546 } 547 548 // +checklocksignore 549 func (r *SpecialMappableRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) { 550 stateSourceObject.Load(0, &r.refCount) 551 stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) }) 552 } 553 554 func (s *vmaSet) StateTypeName() string { 555 return "pkg/sentry/mm.vmaSet" 556 } 557 558 func (s *vmaSet) StateFields() []string { 559 return []string{ 560 "root", 561 } 562 } 563 564 func (s *vmaSet) beforeSave() {} 565 566 // +checklocksignore 567 func (s *vmaSet) StateSave(stateSinkObject state.Sink) { 568 s.beforeSave() 569 var rootValue []vmaFlatSegment 570 rootValue = s.saveRoot() 571 stateSinkObject.SaveValue(0, rootValue) 572 } 573 574 func (s *vmaSet) afterLoad(context.Context) {} 575 576 // +checklocksignore 577 func (s *vmaSet) StateLoad(ctx context.Context, stateSourceObject state.Source) { 578 stateSourceObject.LoadValue(0, new([]vmaFlatSegment), func(y any) { s.loadRoot(ctx, y.([]vmaFlatSegment)) }) 579 } 580 581 func (n *vmanode) StateTypeName() string { 582 return "pkg/sentry/mm.vmanode" 583 } 584 585 func (n *vmanode) StateFields() []string { 586 return []string{ 587 "nrSegments", 588 "parent", 589 "parentIndex", 590 "hasChildren", 591 "maxGap", 592 "keys", 593 "values", 594 "children", 595 } 596 } 597 598 func (n *vmanode) beforeSave() {} 599 600 // +checklocksignore 601 func (n *vmanode) StateSave(stateSinkObject state.Sink) { 602 n.beforeSave() 603 stateSinkObject.Save(0, &n.nrSegments) 604 stateSinkObject.Save(1, &n.parent) 605 stateSinkObject.Save(2, &n.parentIndex) 606 stateSinkObject.Save(3, &n.hasChildren) 607 stateSinkObject.Save(4, &n.maxGap) 608 stateSinkObject.Save(5, &n.keys) 609 stateSinkObject.Save(6, &n.values) 610 stateSinkObject.Save(7, &n.children) 611 } 612 613 func (n *vmanode) afterLoad(context.Context) {} 614 615 // +checklocksignore 616 func (n *vmanode) StateLoad(ctx context.Context, stateSourceObject state.Source) { 617 stateSourceObject.Load(0, &n.nrSegments) 618 stateSourceObject.Load(1, &n.parent) 619 stateSourceObject.Load(2, &n.parentIndex) 620 stateSourceObject.Load(3, &n.hasChildren) 621 stateSourceObject.Load(4, &n.maxGap) 622 stateSourceObject.Load(5, &n.keys) 623 stateSourceObject.Load(6, &n.values) 624 stateSourceObject.Load(7, &n.children) 625 } 626 627 func (v *vmaFlatSegment) StateTypeName() string { 628 return "pkg/sentry/mm.vmaFlatSegment" 629 } 630 631 func (v *vmaFlatSegment) StateFields() []string { 632 return []string{ 633 "Start", 634 "End", 635 "Value", 636 } 637 } 638 639 func (v *vmaFlatSegment) beforeSave() {} 640 641 // +checklocksignore 642 func (v *vmaFlatSegment) StateSave(stateSinkObject state.Sink) { 643 v.beforeSave() 644 stateSinkObject.Save(0, &v.Start) 645 stateSinkObject.Save(1, &v.End) 646 stateSinkObject.Save(2, &v.Value) 647 } 648 649 func (v *vmaFlatSegment) afterLoad(context.Context) {} 650 651 // +checklocksignore 652 func (v *vmaFlatSegment) StateLoad(ctx context.Context, stateSourceObject state.Source) { 653 stateSourceObject.Load(0, &v.Start) 654 stateSourceObject.Load(1, &v.End) 655 stateSourceObject.Load(2, &v.Value) 656 } 657 658 func init() { 659 state.Register((*aioManager)(nil)) 660 state.Register((*ioResult)(nil)) 661 state.Register((*AIOContext)(nil)) 662 state.Register((*aioMappable)(nil)) 663 state.Register((*aioMappableRefs)(nil)) 664 state.Register((*ioList)(nil)) 665 state.Register((*ioEntry)(nil)) 666 state.Register((*MemoryManager)(nil)) 667 state.Register((*vma)(nil)) 668 state.Register((*pma)(nil)) 669 state.Register((*pmaSet)(nil)) 670 state.Register((*pmanode)(nil)) 671 state.Register((*pmaFlatSegment)(nil)) 672 state.Register((*SpecialMappable)(nil)) 673 state.Register((*SpecialMappableRefs)(nil)) 674 state.Register((*vmaSet)(nil)) 675 state.Register((*vmanode)(nil)) 676 state.Register((*vmaFlatSegment)(nil)) 677 }