public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paolo 'Blaisorblade' Giarrusso" <blaisorblade@yahoo.it>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: Jeff Dike <jdike@addtoit.com>,
	linux-kernel@vger.kernel.org,
	user-mode-linux-devel@lists.sourceforge.net
Subject: [PATCH 2/9] uml: remove bogus WARN_ON, triggerable harmlessly on a page fault race
Date: Sat, 12 Nov 2005 19:07:18 +0100	[thread overview]
Message-ID: <20051112180716.20133.92227.stgit@zion.home.lan> (raw)
In-Reply-To: <20051112180711.20133.68166.stgit@zion.home.lan>

From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

The below warning was added in place of pte_mkyoung(); if (is_write)
pte_mkdirty();

In fact, if the PTE is not marked young/dirty, our dirty/accessed bit emulation
would cause the TLB permission not to be changed, and so we'd loop, and given we
don't support preemption yet, we'd busy-hang here.

However, I've seen this warning trigger without crashes during a loop of
concurrent kernel builds, at random times (i.e. like a race condition), and I
realized that two concurrent faults on the same page, one on read and one on
write, can trigger it. The read fault gets serviced and the PTE gets marked
writable but clean (it's possible on a shared-writable mapping), while the
generic code sees the PTE was already installed and returns without action. In
this case, we'll see another fault and service it normally.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 arch/um/kernel/trap_kern.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c
index 95c8f87..0d4c10a 100644
--- a/arch/um/kernel/trap_kern.c
+++ b/arch/um/kernel/trap_kern.c
@@ -95,7 +95,16 @@ survive:
 		pte = pte_offset_kernel(pmd, address);
 	} while(!pte_present(*pte));
 	err = 0;
+	/* The below warning was added in place of
+	 *	pte_mkyoung(); if (is_write) pte_mkdirty();
+	 * If it's triggered, we'd see normally a hang here (a clean pte is
+	 * marked read-only to emulate the dirty bit).
+	 * However, the generic code can mark a PTE writable but clean on a
+	 * concurrent read fault, triggering this harmlessly. So comment it out.
+	 */
+#if 0
 	WARN_ON(!pte_young(*pte) || (is_write && !pte_dirty(*pte)));
+#endif
 	flush_tlb_page(vma, address);
 out:
 	up_read(&mm->mmap_sem);


  reply	other threads:[~2005-11-12 18:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-12 18:07 [PATCH 1/9] Kbuild: index asm-$(SUBARCH) headers for UML Paolo 'Blaisorblade' Giarrusso
2005-11-12 18:07 ` Paolo 'Blaisorblade' Giarrusso [this message]
2005-11-12 18:07 ` [PATCH 3/9] uml: micro fixups to arch Kconfig Paolo 'Blaisorblade' Giarrusso
2005-11-12 18:07 ` [PATCH 4/9] uml - fixups for "reuse i386 cpu-specific tuning" Paolo 'Blaisorblade' Giarrusso
2005-11-12 18:07 ` [PATCH 5/9] uml: fix mcast network driver error handling Paolo 'Blaisorblade' Giarrusso
2005-11-12 18:07 ` [PATCH 6/9] uml console channels: remove console_write wrappers Paolo 'Blaisorblade' Giarrusso
2005-11-12 18:07 ` [PATCH 7/9] uml console channels: fix the API of console_write Paolo 'Blaisorblade' Giarrusso
2005-11-12 18:07 ` [PATCH 8/9] Uml: fix access_ok Paolo 'Blaisorblade' Giarrusso
2005-11-12 18:08 ` [PATCH 9/9] uml: fix daemon transport exit path bug Paolo 'Blaisorblade' Giarrusso
2005-11-12 22:20   ` [uml-devel] " Jeff Dike

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=20051112180716.20133.92227.stgit@zion.home.lan \
    --to=blaisorblade@yahoo.it \
    --cc=akpm@osdl.org \
    --cc=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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