Re: [PATCH] m68k: Implement kernel memory protection

From: Michael Schmitz
Date: Mon Nov 17 2025 - 18:14:31 EST


Daniel,

it might be possible to fix up the last (partially used) descriptor from C code, if there's a limit field. I find the head.S assembly too much of a headache to change, but that would certainly be safer.

Wasting up to 256 kB is a pain on 030. Maybe rather skip protecting the last section?

(* ducks ... *)

Cheers,

    Michael

On 18/11/25 11:01, Daniel Palmer wrote:
Hi Michael,

On Tue, 18 Nov 2025 at 02:41, Michael Schmitz <schmitzmic@xxxxxxxxx> wrote:
Daniel,

take a look at arch/m68k/kernel/head.S - 030 MMU setup uses early
termination descriptors for kernel memory, _not_ regular page tables.
Yeah, so when setting write protect on the last bit of either the text
or the rodata the end is getting rounded up to the next 256KB and
write protecting too much.
I worked that out and adding some alignment in the linker script so
that everything after the places getting write protected is pushed off
to the next 256KB does fix it but wastes some memory.
Looking at the manual for the 68030 it seems like early termination
descriptors can have a limit so I could set the alignment, fix up the
limit and then give the wasted memory back. But we are using the short
format that doesn't have the limit field.

Cheers,

Daniel