Re: How to read-protect a vm_area?

Linus Torvalds (torvalds@transmeta.com)
Mon, 16 Feb 1998 13:19:55 -0800 (PST)


On Mon, 16 Feb 1998, Linus Torvalds wrote:
>
> Anyway, I haven't even tried compiling this, but this very small patch
> (I'd call it trivial if it wasn't so subtle) MAY work. Would somebody like
> to test it?

At least part of it is bogus: if you do decide to test it, you should
undo the change to _PAGE_CHG_MASK:

> --- v2.1.86/linux/include/asm-i386/pgtable.h Fri Feb 6 15:32:54 1998
> +++ linux/include/asm-i386/pgtable.h Mon Feb 16 12:37:25 1998
> @@ -211,9 +212,9 @@
>
> #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
> #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
> -#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
> +#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PRESENT)

The correct _PAGE_CHG_MASK is the same old mask that it used to be:
_PAGE_PRESENT should not be part of the mask (just a thinko on my part,
the semantics of _PAGE_CHG_MASK is not which bits you should be able to
change, but which bits are carried over a change in protection).

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu