private void setReadOnlyMemory(AddressRange range) {
		AddressSet set = new AddressSet(range);
		set = set.intersect(memory.getLoadedAndInitializedAddressSet());
		if (set.isEmpty()) {
			log("Ignored attempt to set non-loaded memory as read-only: " + range);
			return;
		}
		try {
			while (!set.isEmpty()) {
				AddressRange subrange = set.getFirstRange();
				Address startAddr = set.getMinAddress();
				MemoryBlock block = memory.getBlock(startAddr);
				block = setReadOnlyBlockRange(block, subrange);
				set.delete(startAddr, block.getEnd());
			}
		}
		catch (MemoryBlockException | LockException | NotFoundException e) {
			throw new AssertException(e); // unexpected
		}
	}
Transition memory range to read-only
@param range constrained read-only region or null for entire load segment
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/ElfProgramBuilder.java