-/* $OpenBSD: loader.c,v 1.199 2022/11/06 11:43:19 deraadt Exp $ */
+/* $OpenBSD: loader.c,v 1.200 2022/11/06 12:00:20 deraadt Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
}
}
+ /*
+ * TEXTREL binaries are loaded without immutable on un-writeable sections.
+ * After text relocations are finished, these regions can become
+ * immutable. OPENBSD_MUTABLE section always overlaps writeable LOADs,
+ * so don't be afraid.
+ */
+ if (object->dyn.textrel) {
+ for (llist = object->load_list; llist != NULL; llist = llist->next)
+ if ((llist->prot & PROT_WRITE) == 0)
+ _dl_mimmutable(llist->start, llist->size);
+ }
+
if (fails == 0)
object->status |= STAT_RELOC_DONE;