public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Rowand <frank.rowand@am.sony.com>
To: "tglx@linutronix.de" <tglx@linutronix.de>,
	<linux-kernel@vger.kernel.org>, <peterz@infradead.org>
Subject: [PATCH] PREEMPT_RT_FULL: arm coredump fails for cpu >= 4
Date: Tue, 27 Sep 2011 20:02:13 -0700	[thread overview]
Message-ID: <4E828E35.6070801@am.sony.com> (raw)


ARM can not use SPLIT_PTLOCK_CPUS if PREEMPT_RT_FULL because
vectors_user_mapping() creates a VM_ALWAYSDUMP mapping of the vector page,
but no ptl->lock has been allocated for the page.  An attempt to coredump
that page will result in a kernel NULL pointer dereference when
follow_page() attempts to lock the page.

The call tree to the NULL pointer dereference is:

   do_notify_resume()
      get_signal_to_deliver()
         do_coredump()
            elf_core_dump()
               get_dump_page()
                  __get_user_pages()
                     follow_page()
                        pte_offset_map_lock() <----- a #define
                           ...
                              rt_spin_lock()

This patch is needed only if mm-shrink-the-page-frame-to-rt-size.patch is
applied.

Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
---
 mm/Kconfig |    9 	9 +	0 -	0 !
 1 file changed, 9 insertions(+)

Index: b/mm/Kconfig
===================================================================
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -172,13 +172,22 @@ config PAGEFLAGS_EXTENDED
 # page_table_lock, so that faults on different parts of the user address
 # space can be handled with less contention: split it at this NR_CPUS.
 # Default to 4 for wider testing, though 8 might be more appropriate.
+#
 # ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
+#
+# ARM can not use SPLIT_PTLOCK_CPUS if PREEMPT_RT_FULL because
+# vectors_user_mapping() creates a VM_ALWAYSDUMP mapping of the vector page,
+# but no ptl->lock has been allocated for the page.  An attempt to coredump
+# that page will result in a kernel NULL pointer dereference when
+# follow_page() attempts to lock the page.
+#
 # PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
 # DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
 #
 config SPLIT_PTLOCK_CPUS
 	int
 	default "999999" if ARM && !CPU_CACHE_VIPT
+	default "999999" if ARM && PREEMPT_RT_FULL
 	default "999999" if PARISC && !PA20
 	default "999999" if DEBUG_SPINLOCK || DEBUG_LOCK_ALLOC
 	default "4"


             reply	other threads:[~2011-09-28  3:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-28  3:02 Frank Rowand [this message]
2011-09-28 13:03 ` [PATCH] PREEMPT_RT_FULL: arm coredump fails for cpu >= 4 Peter Zijlstra
2011-09-28 18:33   ` Frank Rowand
2011-10-02  1:58     ` Frank Rowand

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=4E828E35.6070801@am.sony.com \
    --to=frank.rowand@am.sony.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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