Re: ia64 hang/mca running gdb 'make check'

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Hugh Dickins
Date: Thursday, July 29, 2010 - 7:01 pm

On Thu, 29 Jul 2010, dann frazier wrote:

Thanks a lot, dann.  But it was the [vdso] line in foo's /proc/<pid>/maps
which you sent me privately, that set me thinking on the right track.
Here's what I believe is the appropriate patch: please give it a try
and let us know...

[PATCH] mm: fix ia64 crash when gcore reads gate area

Debian's ia64 autobuilders have been seeing kernel freeze or reboot
when running the gdb testsuite (Debian bug 588574): dannf bisected to
2.6.32 62eede62dafb4a6633eae7ffbeb34c60dba5e7b1 "mm: ZERO_PAGE without
PTE_SPECIAL"; and reproduced it with gdb's gcore on a simple target.

I'd missed updating the gate_vma handling in __get_user_pages(): that
happens to use vm_normal_page() (nowadays failing on the zero page),
yet reported success even when it failed to get a page - boom when
access_process_vm() tried to copy that to its intermediate buffer.

Fix this, resisting cleanups: in particular, leave it for now reporting
success when not asked to get any pages - very probably safe to change,
but let's not risk it without testing exposure.

Why did ia64 crash with 16kB pages, but succeed with 64kB pages?
Because setup_gate() pads each 64kB of its gate area with zero pages.

Reported-by: Andreas Barth <aba@not.so.argh.org>
Bisected-by: dann frazier <dannf@debian.org>
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: stable@kernel.org
---

 mm/memory.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

--- 2.6.35-rc6/mm/memory.c	2010-05-30 17:58:57.000000000 -0700
+++ linux/mm/memory.c	2010-07-29 17:57:29.000000000 -0700
@@ -1394,10 +1394,20 @@ int __get_user_pages(struct task_struct
 				return i ? : -EFAULT;
 			}
 			if (pages) {
-				struct page *page = vm_normal_page(gate_vma, start, *pte);
+				struct page *page;
+
+				page = vm_normal_page(gate_vma, start, *pte);
+				if (!page) {
+					if (!(gup_flags & FOLL_DUMP) &&
+					     is_zero_pfn(pte_pfn(*pte)))
+						page = pte_page(*pte);
+					else {
+						pte_unmap(pte);
+						return i ? : -EFAULT;
+					}
+				}
 				pages[i] = page;
-				if (page)
-					get_page(page);
+				get_page(page);
 			}
 			pte_unmap(pte);
 			if (vmas)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ia64 hang/mca running gdb 'make check', dann frazier, (Tue Jul 20, 10:35 am)
Re: ia64 hang/mca running gdb 'make check', KAMEZAWA Hiroyuki, (Tue Jul 20, 6:51 pm)
Re: ia64 hang/mca running gdb 'make check', dann frazier, (Tue Jul 20, 8:06 pm)
Re: ia64 hang/mca running gdb 'make check', Hugh Dickins, (Tue Jul 20, 9:19 pm)
Re: ia64 hang/mca running gdb 'make check', KOSAKI Motohiro, (Wed Jul 21, 5:54 am)
Re: ia64 hang/mca running gdb 'make check', dann frazier, (Tue Jul 27, 12:19 am)
Re: ia64 hang/mca running gdb 'make check', KAMEZAWA Hiroyuki, (Tue Jul 27, 2:03 am)
Re: ia64 hang/mca running gdb 'make check', dann frazier, (Tue Jul 27, 7:43 am)
Re: ia64 hang/mca running gdb 'make check', Hugh Dickins, (Wed Jul 28, 8:50 pm)
Re: ia64 hang/mca running gdb 'make check', Luming Yu, (Thu Jul 29, 12:38 am)
Re: ia64 hang/mca running gdb 'make check', KAMEZAWA Hiroyuki, (Thu Jul 29, 12:58 am)
Re: ia64 hang/mca running gdb 'make check', Luming Yu, (Thu Jul 29, 1:40 am)
Re: ia64 hang/mca running gdb 'make check', KAMEZAWA Hiroyuki, (Thu Jul 29, 1:44 am)
Re: ia64 hang/mca running gdb 'make check', dann frazier, (Thu Jul 29, 12:22 pm)
Re: ia64 hang/mca running gdb 'make check', KAMEZAWA Hiroyuki, (Thu Jul 29, 5:41 pm)
Re: ia64 hang/mca running gdb 'make check', Hugh Dickins, (Thu Jul 29, 7:01 pm)
Re: ia64 hang/mca running gdb 'make check', dann frazier, (Thu Jul 29, 9:34 pm)
Re: ia64 hang/mca running gdb 'make check', Hugh Dickins, (Fri Jul 30, 10:52 am)
[PATCH] mm: fix ia64 crash when gcore reads gate area, Hugh Dickins, (Fri Jul 30, 10:58 am)