public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Blackwood <john.blackwood@ccur.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] include/asm-x86_64/pgtable.h pgd_offset_gate()
Date: Tue, 14 Dec 2004 09:59:08 -0500	[thread overview]
Message-ID: <41BEFFBC.2040700@ccur.com> (raw)
In-Reply-To: <cpd69c$7m1$1@trex.ccur.com>

Please ignore my previous posting.

It turns out that there is already a fix for this problem by Andi Kleen:

# ChangeSet
#   2004/11/15 19:53:40-08:00 ak@suse.de
#   [PATCH] x86-64: Fix get_user_pages access to vsyscall page
#
#   The current kernel oopses on x86-64 when gdb steps into the vsyscall 
page.
#   This patch fixes it.
#
#   I also removed the bogus NULL checks of *_offset and replaced them with
#   proper _none checks.  I made them BUGs because vsyscall pages should be
#   always mapped.
#
#   Signed-off-by: Andi Kleen <ak@suse.de>
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
#
# mm/memory.c
#   2004/11/15 19:29:06-08:00 ak@suse.de +7 -11
#   x86-64: Fix get_user_pages access to vsyscall page
#
diff -Nru a/mm/memory.c b/mm/memory.c
--- a/mm/memory.c       2004-12-14 05:20:10 -08:00
+++ b/mm/memory.c       2004-12-14 05:20:10 -08:00
@@ -739,19 +739,15 @@
                         pte_t *pte;
                         if (write) /* user gate pages are read-only */
                                 return i ? : -EFAULT;
-                       pgd = pgd_offset_gate(mm, pg);
-                       if (!pgd)
-                               return i ? : -EFAULT;
+                       if (pg > TASK_SIZE)
+                               pgd = pgd_offset_k(pg);
+                       else
+                               pgd = pgd_offset_gate(mm, pg);
+                       BUG_ON(pgd_none(*pgd));
                         pmd = pmd_offset(pgd, pg);
-                       if (!pmd)
-                               return i ? : -EFAULT;
+                       BUG_ON(pmd_none(*pmd));
                         pte = pte_offset_map(pmd, pg);
-                       if (!pte)
-                               return i ? : -EFAULT;
-                       if (!pte_present(*pte)) {
-                               pte_unmap(pte);
-                               return i ? : -EFAULT;
-                       }
+                       BUG_ON(pte_none(*pte));
                         if (pages) {
                                 pages[i] = pte_page(*pte);
                                 get_page(pages[i]);


       reply	other threads:[~2004-12-14 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cpd69c$7m1$1@trex.ccur.com>
2004-12-14 14:59 ` John Blackwood [this message]
2004-12-10 21:45 [PATCH] include/asm-x86_64/pgtable.h pgd_offset_gate() John Blackwood

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=41BEFFBC.2040700@ccur.com \
    --to=john.blackwood@ccur.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox