Re: only kernel can access copy_area ?

Raphael Neider <[email protected]> Tue, 14 Oct 2008 10:29:35 +0200
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Message-ID <[email protected]>
On 2008-10-14 at 00:33, lion wrote:
> 
> Still uncleanly about that...
> About the copy_area's implemention.
> 
> >      About the copy_area,

The copy area is a temporary mapping of a part of B's address space (the
destination of the string transfer) into the kernel region in order to
make B's memory accessible while A's address space is active (otherwise
there would be no name, i.e., virtual address in A's address space, to
access that memory).
In principle, both A and B could access the mapping area: it is not protected
by means of page protections (the page is user accessible due to its page
table entry being copied from B and the page being user accessible there) nor
by means of segmentation (on x86, due to L4 not using segments for protection
at all except with small spaces).

But: The copy area is unmapped
    (a) before A returns to user mode after the IPC and/or
    (b) at the next thread switch (whichever occurs first),
so neither A nor B (nor any other thread at user level) has a chance of
actually accessing B's memory by means of the copy area.

Now back to answering your questions:
> > when A sends a message to B, only kernel A and user B can access 
> > the copy_area. But user A can not. Is these correct ? And why ?
That's not correct. Theoretically, user A, user B, kernel A, and kernel B
can access the copy area, but due to kernel guarantees as to which thread
actually runs, only kernel A gets the chance to do so.
The `why' should have been answered above.

> >      In my opinion, the page table of A's copy_area is copyed from B which
> > is user accessiable.
> > So,user A can access the copy_area. Is that right?
Again: Yes, but only in theory as user A never runs while the mapping exists.

Hoping that helped to clear things up a bit,
Raphael