lkml.org 
[lkml]   [2008]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [BUG + PATCH/Bugfix] x86/lguest: fix pgdir pmd index calculation
    From
    On Tue, Mar 04, 2008 at 11:55:10PM +1100, Rusty Russell wrote:
    > On Monday 25 February 2008 02:55:15 Ahmed S. Darwish wrote:
    > > Hi all,
    > >
    > > Beginning from commits close to v2.6.25-rc2, running lguest always oopses
    > > the host kernel. Oops is at [1].
    >
    > OK, whatever the guest does should not break the host. So your patch can't be
    > the whole solution.
    >
    > > static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval)
    > > {
    > > *pmdp = pmdval;
    > > lazy_hcall(LHCALL_SET_PMD, __pa(pmdp)&PAGE_MASK,
    > > (__pa(pmdp)&(PAGE_SIZE-1))/4, 0);
    > > }
    > >
    > > The first hcall parameter is global pgdir which looks fine. The second
    > > parameter is the pmd index in the pgdir which is suspectful.
    > >
    > > AFAIK, calculating the index of pmd does not need a divisoin over four.
    > > Removing the division made lguest work fine again . Patch is at [2].
    >
    > Each pmd is 4 bytes long, so the divide by 4 gives the index into the (top
    > level) page. ie. a number in the range 0 to 1023.
    >

    aha, now it's clear.

    >
    > Indeed, here's the correct fix. Does it work for you?
    >

    Yes it does (after removing the unrelated TSC-if-pentium+ checks).

    Thank you

    --

    "Better to light a candle, than curse the darkness"

    Ahmed S. Darwish
    Homepage: http://darwish.07.googlepages.com
    Blog: http://darwish-07.blogspot.com



    \
     
     \ /
      Last update: 2008-03-04 16:17    [W:0.022 / U:30.148 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site