From the sound of it, there is a situation where a store to a protected page gets handled in the sigsegv handler by unprotecting the page and marking it as touched for GC, then resuming at the faulting instruction, which gets another fault right away, forever. It is as if page fault handling does not work until after the main thread is fully initialized in Lisp, which we can confirm via the following diff. Mind you this "should not" make a difference, but I think it will:
diff --git a/src/runtime/immobile-space.c b/src/runtime/immobile-space.c
index 95d6acee7..f231f680f 100644
--- a/src/runtime/immobile-space.c
+++ b/src/runtime/immobile-space.c
@@ -1185,8 +1185,6 @@ void immobile_space_coreparse(uword_t fixedobj_len, sword_t size = object_size2(obj, header); fixedobj_pages[page].attr.parts.obj_align = size; fixedobj_pages[page].gens |= 1 << immobile_obj_gen_bits(obj);
- if (gen != 0 && ENABLE_PAGE_PROTECTION)
- fixedobj_pages[page].attr.parts.flags = WRITE_PROTECT; break;
}
}
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c
index 274687c8f..ea1315bb8 100644
--- a/src/runtime/runtime.c
+++ b/src/runtime/runtime.c
@@ -778,10 +778,6 @@ initialize_lisp(int argc, char *argv[], char *envp[])
extern void callback_wrapper_trampoline();
SYMBOL(CALLBACK_WRAPPER_TRAMPOLINE)->value = (lispobj)callback_wrapper_trampoline;
#endif
- /* Delayed until after dynamic space has been mapped, fixups made,
- * and/or immobile-space linkage entries written,
- * since it was too soon earlier to handle write faults. */
- write_protect_immobile_space();
#endif
/* Requires STATIC_SPACE_START to have been calculated. */
yes I'm running 14.5
From the sound of it, there is a situation where a store to a protected page gets handled in the sigsegv handler by unprotecting the page and marking it as touched for GC, then resuming at the faulting instruction, which gets another fault right away, forever. It is as if page fault handling does not work until after the main thread is fully initialized in Lisp, which we can confirm via the following diff. Mind you this "should not" make a difference, but I think it will:
diff --git a/src/runtime/ immobile- space.c b/src/runtime/ immobile- space.c .f231f680f 100644 immobile- space.c immobile- space.c space_coreparse (uword_ t fixedobj_len,
sword_ t size = object_size2(obj, header);
fixedobj_ pages[page] .attr.parts. obj_align = size;
fixedobj_ pages[page] .gens |= 1 << immobile_ obj_gen_ bits(obj) ; PAGE_PROTECTION ) pages[page] .attr.parts. flags = WRITE_PROTECT;
break; runtime. c b/src/runtime/ runtime. c .ea1315bb8 100644 runtime. c runtime. c wrapper_ trampoline( ); CALLBACK_ WRAPPER_ TRAMPOLINE) ->value = (lispobj) callback_ wrapper_ trampoline; immobile_ space() ;
index 95d6acee7.
--- a/src/runtime/
+++ b/src/runtime/
@@ -1185,8 +1185,6 @@ void immobile_
- if (gen != 0 && ENABLE_
- fixedobj_
}
}
diff --git a/src/runtime/
index 274687c8f.
--- a/src/runtime/
+++ b/src/runtime/
@@ -778,10 +778,6 @@ initialize_lisp(int argc, char *argv[], char *envp[])
extern void callback_
SYMBOL(
#endif
- /* Delayed until after dynamic space has been mapped, fixups made,
- * and/or immobile-space linkage entries written,
- * since it was too soon earlier to handle write faults. */
- write_protect_
#endif
/* Requires STATIC_SPACE_START to have been calculated. */