Commit dc6a698
committed
fix: address code review findings
H1: Add null check after MapViewOfFileNuma2 in SurrogateProcess::map
H2: Store SurrogateMapping in HandleMapping, add debug_assert_eq on reuse
M1: Clean up surrogate mapping on VirtualProtectEx failure (pre-existing)
M2: Use checked_sub for ref count, log error on underflow
M5: Early return with clear error for empty (0-byte) files
L1: Fix incorrect Send/Sync safety comment on OwnedFileMapping
L3: Rename _fp/_guest_base to file_path/guest_base
L4: Use usize::try_from(file_size) instead of silent truncation
N2: Use page_size::get() in test helper instead of magic 4096
N3: Change SurrogateMapping and surrogate_mapping field to pub(crate)
N4: Replace low-value derive trait test with meaningful variant test
Also: Change MemoryRegionType::Heap to Code for file mappings,
add tracing::error in release-mode vacant unmap path.
All 266 tests pass, 0 failures.
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>1 parent ebe9ee0 commit dc6a698
3 files changed
Lines changed: 74 additions & 26 deletions
File tree
- src/hyperlight_host/src
- hypervisor
- mem
- sandbox
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| |||
79 | 82 | | |
80 | 83 | | |
81 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
82 | 93 | | |
83 | 94 | | |
84 | 95 | | |
| |||
105 | 116 | | |
106 | 117 | | |
107 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
108 | 126 | | |
109 | 127 | | |
110 | 128 | | |
| |||
122 | 140 | | |
123 | 141 | | |
124 | 142 | | |
| 143 | + | |
125 | 144 | | |
126 | 145 | | |
127 | 146 | | |
| |||
137 | 156 | | |
138 | 157 | | |
139 | 158 | | |
| 159 | + | |
140 | 160 | | |
141 | 161 | | |
142 | 162 | | |
143 | 163 | | |
144 | 164 | | |
145 | 165 | | |
146 | 166 | | |
| 167 | + | |
147 | 168 | | |
148 | 169 | | |
149 | 170 | | |
| |||
153 | 174 | | |
154 | 175 | | |
155 | 176 | | |
156 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
157 | 184 | | |
158 | 185 | | |
159 | 186 | | |
160 | 187 | | |
161 | 188 | | |
162 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
163 | 194 | | |
164 | | - | |
| 195 | + | |
165 | 196 | | |
166 | 197 | | |
167 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
508 | 510 | | |
509 | 511 | | |
510 | 512 | | |
| |||
Lines changed: 29 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
621 | 622 | | |
622 | 623 | | |
623 | 624 | | |
624 | | - | |
625 | | - | |
| 625 | + | |
| 626 | + | |
626 | 627 | | |
627 | 628 | | |
628 | 629 | | |
| |||
632 | 633 | | |
633 | 634 | | |
634 | 635 | | |
635 | | - | |
| 636 | + | |
636 | 637 | | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
637 | 641 | | |
638 | | - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
639 | 648 | | |
640 | 649 | | |
641 | 650 | | |
| |||
680 | 689 | | |
681 | 690 | | |
682 | 691 | | |
683 | | - | |
| 692 | + | |
684 | 693 | | |
685 | | - | |
| 694 | + | |
686 | 695 | | |
687 | 696 | | |
688 | 697 | | |
| |||
702 | 711 | | |
703 | 712 | | |
704 | 713 | | |
705 | | - | |
| 714 | + | |
706 | 715 | | |
707 | 716 | | |
708 | 717 | | |
| |||
711 | 720 | | |
712 | 721 | | |
713 | 722 | | |
714 | | - | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
715 | 727 | | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
716 | 731 | | |
717 | 732 | | |
718 | 733 | | |
| |||
729 | 744 | | |
730 | 745 | | |
731 | 746 | | |
732 | | - | |
| 747 | + | |
733 | 748 | | |
734 | | - | |
| 749 | + | |
735 | 750 | | |
736 | 751 | | |
737 | 752 | | |
| |||
1767 | 1782 | | |
1768 | 1783 | | |
1769 | 1784 | | |
1770 | | - | |
| 1785 | + | |
1771 | 1786 | | |
1772 | 1787 | | |
1773 | 1788 | | |
| |||
0 commit comments