lkml.org 
[lkml]   [1998]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How to read-protect a vm_area?


On Tue, 17 Feb 1998, Itai Nahshon wrote:
>
> I do not know if any modern hardware has a similar "feature", on some
> systems it is really necessary to have two "present" bits, one interpreted
> by the MMU hardware and the other interpreted by the OS.

Well, that's essentially how my patch set things up: in order to make it
work on the hardware, I just had to make sure that the real hardware
present bit was the "and" of the two bits (which is why I got three cases
rather than four out of two bits - but that was all I needed).

> The VAX architecture did not have an "accessed" bit on the page table
> entry (it did have a "dirty" bit).
> The OS had to simulate the missing "accessed" bit.

Linux already does this for various architectures: the alpha, for example,
has neither accessed nor dirty bits (the alpha instead has a fairly
interesting multi-bit protection scheme that makes it very easy to do the
accessed and dirty bits in software - but even without that multibit setup
it can be done by software without undue hardship: it is just easier with
some minimal support from the OS).

> When free memory became low the pager started to mark pages as "not present"
> for the hardware (but not swap them out yet), and put these pages on the
> free page list. A separate bit tells the software that the page is still
> there. If such page is accessed, it causes a page fault trap. The trap
> handler just needs to turn on the "present" and the simulated "accessed"
> bits, (some list manipulation was also involved). these events are counted as
> "reclaims" by vmstat.

Linux does some similar tricks with the dirty bits and the "swap cache".
Not the same, but the basic ideas are fairly similar.

Anyway, I've just verified that my patches do seem to work, and I'll be
releasing a 2.1.87 soon that has the PROT_NONE thing fixed when it comes
to kernel space accesses..

Linus


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

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.121 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site