On Thu, Sep 07, 2000 at 02:34:33PM -0700, Roel Schroeven wrote:
> 
> --- [EMAIL PROTECTED] wrote:
> 
> > #define virt_to_page(kaddr)     (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
> > ...
> > 
> > So why is a pointer to a structure getting into pointer arithmetic?
> 
> I suppose mem_map is a pointer to an array of mem_map_t structures, and
> __pa(kaddr) >> PAGE_SHIFT is the index of the page with the virtual
> address.

Didn't think about that... but then again, it does no more bounds checking
than __pa() does, and that could be causing the user to get a segfault.

MAP_NR was:
#define MAP_NR(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
(2.2 kernel hackers: is that right? just from memory...)

So it would seem that if this array is not set up properly (and since plex86
messes with stuff at a low level, this seems possible), that segfault could
happen easily.

> Disclaimer: I'm not a kernel hacker of any kind; I'm just reading the
> plex86 mailing list for a while. I saw your question and hope my answer is
> a help to you.

I'm not a kernel hacker either... maybe _aspiring_ kernel hacker...

Reply via email to