Re: unify pagetable accessors patch causes double fault II

Andi Kleen
2008-01-14T22:28:51Z

> OK, I see the problem. The problem is that the _PAGE_X defines are
> defined with _AC(UL, 1 << _PAGE_BIT_X), which has unsigned long type.
> This means that ~_PAGE_X also has unsigned long type, and so when cast
> to 64-bit in pte_mkX, it ends up &ing the pte with 0x00000000ffffffxxx,
> with predictable results.

Actually I fixed some of that -- see the pgtable-nx patch on firstfloor -- but
it still doesn't work. Or maybe my patch was not complete.
>
> The original code just used signed constants for the _PAGE_X
> definitions, which will sign-extend when cast to 64-bit, and so have the
> upper bits set when masking. (Well, actually, the old code just
> operated on pte_low, so the problem didn't arise; however, pgtable_64.h
> also uses integers for its _PAGE_X, which has the same sign-extended
> 32->64 casting property).
>
> I'll put together a fixup patch now.

I'm leaving now but can test later.

-Andi