Don't follow non lisp pointers in prepare_readonly_space.

Otherwise it might trip up on bad DX pointers (disregarding how
actually bad it is to have such pointers).

Reported by pve.
This commit is contained in:
Stas Boukarev 2022-10-15 18:46:36 +03:00
parent 14813ede89
commit d6fcfb861a

View file

@ -33,7 +33,7 @@ void move_rospace_to_dynamic(__attribute__((unused)) int print) {}
static void visit_pointer_words(lispobj* object, lispobj (*func)(lispobj, uword_t), uword_t arg)
{
#define FIX(what) { lispobj ptr = what; \
if (is_lisp_pointer(ptr)) { lispobj new = func(ptr, arg); if (new != ptr) what = new; } }
if (is_lisp_pointer(ptr) && gc_managed_heap_space_p(ptr)) { lispobj new = func(ptr, arg); if (new != ptr) what = new; } }
if (is_cons_half(*object)) {
FIX(object[0]);
@ -55,7 +55,7 @@ static void visit_pointer_words(lispobj* object, lispobj (*func)(lispobj, uword_
int rehash = 0;
for (i=0; i<len; ++i) {
lispobj old = v->data[i];
if (!is_lisp_pointer(old)) continue;
if (!(is_lisp_pointer(old) && gc_managed_heap_space_p(old))) continue;
lispobj new = func(old, arg);
if (new != old) v->data[i] = new, rehash = 1;
}