From: Dave McCracken <dmccr@us.ibm.com>
To: Andrew Morton <akpm@digeo.com>
Cc: Linux Memory Management <linux-mm@kvack.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.5.66-mm2] Fix page_convert_anon locking issues
Date: Wed, 02 Apr 2003 11:13:02 -0600 [thread overview]
Message-ID: <8910000.1049303582@baldur.austin.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 445 bytes --]
I came up with a scheme for accessing the page tables in page_convert_anon
that should work without requiring locks. Hugh has looked at it and agrees
it addresses the problems he found. Anyway, here's the patch.
Dave McCracken
======================================================================
Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
dmccr@us.ibm.com T/L 678-3059
[-- Attachment #2: objlock-2.5.66-mm2-1.diff --]
[-- Type: text/plain, Size: 1116 bytes --]
--- 2.5.66-mm2/./mm/rmap.c 2003-04-01 11:23:35.000000000 -0600
+++ 2.5.66-mm2-fix/./mm/rmap.c 2003-04-01 11:30:21.000000000 -0600
@@ -95,7 +95,9 @@ find_pte(struct vm_area_struct *vma, str
{
struct mm_struct *mm = vma->vm_mm;
pgd_t *pgd;
+ pgd_t pgdval;
pmd_t *pmd;
+ pmd_t pmdval;
pte_t *pte;
unsigned long loffset;
unsigned long address;
@@ -106,17 +108,27 @@ find_pte(struct vm_area_struct *vma, str
goto out;
pgd = pgd_offset(mm, address);
- if (!pgd_present(*pgd))
+ pgdval = *pgd;
+ if (!pgd_present(pgdval))
goto out;
- pmd = pmd_offset(pgd, address);
- if (!pmd_present(*pmd))
+ pmd = pmd_offset(&pgdval, address);
+ pmdval = *pmd;
+ if (!pmd_present(pmdval))
goto out;
- pte = pte_offset_map(pmd, address);
+ /* Double check to make sure the pmd page hasn't been freed */
+ if (!pgd_present(*pgd))
+ goto out;
+
+ pte = pte_offset_map(&pmdval, address);
if (!pte_present(*pte))
goto out_unmap;
+ /* Double check to make sure the pte page hasn't been freed */
+ if (!pmd_present(*pmd))
+ goto out_unmap;
+
if (page_to_pfn(page) != pte_pfn(*pte))
goto out_unmap;
next reply other threads:[~2003-04-02 17:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-02 17:13 Dave McCracken [this message]
2003-04-02 21:29 ` Andrew Morton
2003-04-02 21:56 ` Dave McCracken
2003-04-02 23:09 ` Andrew Morton
2003-04-02 23:23 ` Dave McCracken
2003-04-02 23:38 ` Andrew Morton
2003-04-02 23:42 ` Dave McCracken
2003-04-02 23:52 ` Andrew Morton
2003-04-02 23:58 ` Dave McCracken
2003-04-03 14:49 ` Dave McCracken
2003-04-03 15:38 ` Hugh Dickins
2003-04-03 16:00 ` Dave McCracken
2003-04-03 16:33 ` Hugh Dickins
2003-04-03 16:39 ` Dave McCracken
2003-04-03 20:00 ` Andrew Morton
2003-04-03 20:06 ` Andrew Morton
2003-04-03 20:56 ` Andrew Morton
2003-04-03 21:01 ` Dave McCracken
2003-04-02 23:59 ` Hugh Dickins
2003-04-03 0:06 ` Hugh Dickins
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=8910000.1049303582@baldur.austin.ibm.com \
--to=dmccr@us.ibm.com \
--cc=akpm@digeo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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