All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: xen-devel@lists.xensource.com
Subject: x86-64 machine_to_phys vs NX bit
Date: Thu, 24 Aug 2006 15:25:09 -0400	[thread overview]
Message-ID: <44EDFD15.4030900@redhat.com> (raw)

On x86-64 machine_to_phys looks like it should never succeed, yet I'm
guessing it must somehow be lucky...

The problem would be that the NX bit is bit 63 of the pte, meaning that
when pte_val is called we are working with a value 2^63 higher than we
should be.

#define pte_val(x)      (((x).pte & 1) ? machine_to_phys((x).pte) : \
                          (x).pte)

static inline paddr_t machine_to_phys(maddr_t machine)
{
         paddr_t phys = mfn_to_pfn(machine >> PAGE_SHIFT);
         phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
         return phys;
}

Should we mask the 'machine' variable with PHYSICAL_MASK at
some point so we cut off the NX bit and other reserved bits?

Say, something like the following?

-    paddr_t phys = mfn_to_pfn(machine >> PAGE_SHIFT);
+    paddr_t phys = mfn_to_pfn((machine >> PAGE_SHIFT) & PHYSICAL_MASK);

I'm still thinking I may have missed something in the code
somewhere, but I've been looking at this for over an hour now
and can't seem to find it...

Any ideas?

-- 
What is important?  What you want to be true, or what is true?

             reply	other threads:[~2006-08-24 19:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-24 19:25 Rik van Riel [this message]
2006-08-25  7:32 ` x86-64 machine_to_phys vs NX bit Keir Fraser
2006-08-25 13:11   ` Jan Beulich
2006-08-25 13:54   ` Rik van Riel
  -- strict thread matches above, loose matches on Subject: below --
2006-08-25 14:46 Nakajima, Jun
2006-08-25 15:10 ` Keir Fraser
2006-08-25 15:19   ` Rik van Riel
2006-08-25 15:27     ` Keir Fraser
2006-08-25 15:37 Nakajima, Jun
2006-08-25 15:56 Ian Pratt
2006-08-25 17:02 Nakajima, Jun
2006-11-11  4:30 John Byrne
2006-11-11  9:56 ` John Byrne
2006-11-13  8:07   ` Jan Beulich
2006-11-13  8:16     ` Keir Fraser
2006-11-13 20:45       ` John Byrne
2006-11-14  1:15         ` John Byrne
2006-11-14  8:05           ` Jan Beulich
2006-11-14  8:17             ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44EDFD15.4030900@redhat.com \
    --to=riel@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.