Re: How to read-protect a vm_area?

Linus Torvalds (torvalds@transmeta.com)
14 Feb 1998 23:55:23 GMT


In article <m0y3fyk-0005FsC@lightning.swansea.linux.org.uk>,
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>> I looked in an i386 book. It has a Present bit and a Read/Write bit as
>> part of its page protection system. I think it is simply not possible
>> to read-protect a page without swapping it!
>
>You just mark it "not present". Its up to you to remember its really around
>somewhere ;)

Actually, the way Linux does it is to mark it "supervisor mode only"
(clear the "US" bit) - which essentially read-protects it from user
mode.

If the original poster meant that you can't mark a page write-only
(protect it from reads but not from writes), then he's of course right
(you can do it by protecting the page and emulating any faulting write
instruction, but you can't do it "for real").

Linus

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