From: Andi Kleen <andi@firstfloor.org>
To: akpm@linux-foundation.org, x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [5/5] Avoid theoretical vmalloc fault loop
Date: Mon, 5 Jan 2009 00:36:42 +0100 (CET) [thread overview]
Message-ID: <20090104233642.745CF3E6653@basil.firstfloor.org> (raw)
In-Reply-To: <200901051236.281008835@firstfloor.org>
Ajith Kumar noticed:
I was going through the vmalloc fault handling for x86_64 and am unclear
about the following lines in the vmalloc_fault() function.
pgd = pgd_offset(current->mm ?: &init_mm, address);
pgd_ref = pgd_offset_k(address);
Here the intention is to get the pgd corresponding to the current
process and sync it up with the pgd in init_mm(obtained from
pgd_offset_k). However, for kernel threads current->mm is NULL and hence
pgd = pgd_offset(init_mm, address) = pgd_ref which means the fault
handler returns without setting the pgd entry in the MM structure in
the context of which the kernel thread has faulted. This could lead to
never-ending faults and busy looping of kernel threads like pdflush.
So, shouldn't the pgd = pgd_offset(current->mm ?: &init_mm, address);
be
pgd = pgd_offset(current->active_mm ?: &init_mm, address);
AK: We can use active_mm unconditionally because it should
be always set. Do that.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
arch/x86/mm/fault.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6.28-test/arch/x86/mm/fault.c
===================================================================
--- linux-2.6.28-test.orig/arch/x86/mm/fault.c 2008-10-24 13:34:41.000000000 +0200
+++ linux-2.6.28-test/arch/x86/mm/fault.c 2009-01-02 16:01:11.000000000 +0100
@@ -533,7 +533,7 @@
happen within a race in page table update. In the later
case just flush. */
- pgd = pgd_offset(current->mm ?: &init_mm, address);
+ pgd = pgd_offset(current->active_mm, address);
pgd_ref = pgd_offset_k(address);
if (pgd_none(*pgd_ref))
return -1;
next prev parent reply other threads:[~2009-01-04 23:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-04 23:36 [PATCH] [0/5] Couple of x86 patches for 2.6.29 Andi Kleen
2009-01-04 23:36 ` [PATCH] [1/5] Only scan the root bus in early PCI quirks Andi Kleen
2009-01-04 23:51 ` Yinghai Lu
2009-01-05 1:46 ` Andi Kleen
2009-01-04 23:36 ` [PATCH] [2/5] Allow HPET force enable on ICH10 HPET Andi Kleen
2009-01-04 23:36 ` [PATCH] [3/5] Mark complex bitops.h inlines as __always_inline Andi Kleen
2009-01-06 0:03 ` Andrew Morton
2009-01-06 10:17 ` Ingo Molnar
2009-01-06 14:32 ` Andi Kleen
2009-01-07 13:26 ` Ingo Molnar
2009-01-07 19:46 ` Andi Kleen
2009-01-06 19:17 ` Hugh Dickins
2009-01-07 13:18 ` Ingo Molnar
2009-01-08 2:16 ` Hugh Dickins
2009-01-08 5:07 ` Andi Kleen
2009-01-08 8:04 ` H. Peter Anvin
2009-01-04 23:36 ` [PATCH] [4/5] Use asm stubs for 32bit sigreturn codes Andi Kleen
2009-01-05 0:08 ` H. Peter Anvin
2009-01-04 23:36 ` Andi Kleen [this message]
2009-01-05 11:47 ` [PATCH] [5/5] Avoid theoretical vmalloc fault loop Nick Piggin
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=20090104233642.745CF3E6653@basil.firstfloor.org \
--to=andi@firstfloor.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@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