mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-11 08:55:23 +03:00
Merge pull request #6127 from urbit/jb/guard-always-again
u3: re-enforce guard page invariants.
This commit is contained in:
commit
867f0621a7
@ -860,6 +860,19 @@ _ce_loom_protect_north(c3_w pgs_w, c3_w old_w)
|
|||||||
c3_assert(0);
|
c3_assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// protect guard page if clobbered
|
||||||
|
//
|
||||||
|
// NB: < pgs_w is precluded by assertion in _ce_patch_compose()
|
||||||
|
//
|
||||||
|
if ( (gar_pag_p >> u3a_page) < old_w ) {
|
||||||
|
fprintf(stderr, "loom: guard on reprotect\r\n");
|
||||||
|
if ( 0 != mprotect(u3a_into(gar_pag_p), pag_siz_i, PROT_NONE) ) {
|
||||||
|
fprintf(stderr, "loom: failed to protect guard page: %s\r\n",
|
||||||
|
strerror(errno));
|
||||||
|
c3_assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_ce_loom_track_north(pgs_w, dif_w);
|
_ce_loom_track_north(pgs_w, dif_w);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -895,6 +908,19 @@ _ce_loom_protect_south(c3_w pgs_w, c3_w old_w)
|
|||||||
c3_assert(0);
|
c3_assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// protect guard page if clobbered
|
||||||
|
//
|
||||||
|
// NB: > pgs_w is precluded by assertion in _ce_patch_compose()
|
||||||
|
//
|
||||||
|
if ( (gar_pag_p >> u3a_page) >= (u3a_pages - (old_w + 1)) ) {
|
||||||
|
fprintf(stderr, "loom: guard on reprotect\r\n");
|
||||||
|
if ( 0 != mprotect(u3a_into(gar_pag_p), pag_siz_i, PROT_NONE) ) {
|
||||||
|
fprintf(stderr, "loom: failed to protect guard page: %s\r\n",
|
||||||
|
strerror(errno));
|
||||||
|
c3_assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_ce_loom_track_south(pgs_w, dif_w);
|
_ce_loom_track_south(pgs_w, dif_w);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -943,6 +969,19 @@ _ce_loom_mapf_north(c3_i fid_i, c3_w pgs_w, c3_w old_w)
|
|||||||
c3_assert(0);
|
c3_assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// protect guard page if clobbered
|
||||||
|
//
|
||||||
|
// NB: < pgs_w is precluded by assertion in _ce_patch_compose()
|
||||||
|
//
|
||||||
|
if ( (gar_pag_p >> u3a_page) < old_w ) {
|
||||||
|
fprintf(stderr, "loom: guard on remap\r\n");
|
||||||
|
if ( 0 != mprotect(u3a_into(gar_pag_p), pag_siz_i, PROT_NONE) ) {
|
||||||
|
fprintf(stderr, "loom: failed to protect guard page: %s\r\n",
|
||||||
|
strerror(errno));
|
||||||
|
c3_assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_ce_loom_track_north(pgs_w, dif_w);
|
_ce_loom_track_north(pgs_w, dif_w);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user