]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Apr 2013 18:40:15 +0000 (11:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Apr 2013 18:40:15 +0000 (11:40 -0700)
added patches:
hugetlbfs-add-swap-entry-check-in-follow_hugetlb_page.patch
kernel-signal.c-stop-info-leak-via-the-tkill-and-the-tgkill-syscalls.patch

queue-3.4/hugetlbfs-add-swap-entry-check-in-follow_hugetlb_page.patch [new file with mode: 0644]
queue-3.4/kernel-signal.c-stop-info-leak-via-the-tkill-and-the-tgkill-syscalls.patch [new file with mode: 0644]
queue-3.4/series

diff --git a/queue-3.4/hugetlbfs-add-swap-entry-check-in-follow_hugetlb_page.patch b/queue-3.4/hugetlbfs-add-swap-entry-check-in-follow_hugetlb_page.patch
new file mode 100644 (file)
index 0000000..7b64b83
--- /dev/null
@@ -0,0 +1,75 @@
+From 9cc3a5bd40067b9a0fbd49199d0780463fc2140f Mon Sep 17 00:00:00 2001
+From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Date: Wed, 17 Apr 2013 15:58:30 -0700
+Subject: hugetlbfs: add swap entry check in follow_hugetlb_page()
+
+From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+
+commit 9cc3a5bd40067b9a0fbd49199d0780463fc2140f upstream.
+
+With applying the previous patch "hugetlbfs: stop setting VM_DONTDUMP in
+initializing vma(VM_HUGETLB)" to reenable hugepage coredump, if a memory
+error happens on a hugepage and the affected processes try to access the
+error hugepage, we hit VM_BUG_ON(atomic_read(&page->_count) <= 0) in
+get_page().
+
+The reason for this bug is that coredump-related code doesn't recognise
+"hugepage hwpoison entry" with which a pmd entry is replaced when a memory
+error occurs on a hugepage.
+
+In other words, physical address information is stored in different bit
+layout between hugepage hwpoison entry and pmd entry, so
+follow_hugetlb_page() which is called in get_dump_page() returns a wrong
+page from a given address.
+
+The expected behavior is like this:
+
+  absent   is_swap_pte   FOLL_DUMP   Expected behavior
+  -------------------------------------------------------------------
+   true     false         false       hugetlb_fault
+   false    true          false       hugetlb_fault
+   false    false         false       return page
+   true     false         true        skip page (to avoid allocation)
+   false    true          true        hugetlb_fault
+   false    false         true        return page
+
+With this patch, we can call hugetlb_fault() and take proper actions (we
+wait for migration entries, fail with VM_FAULT_HWPOISON_LARGE for
+hwpoisoned entries,) and as the result we can dump all hugepages except
+for hwpoisoned ones.
+
+Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Cc: Rik van Riel <riel@redhat.com>
+Acked-by: Michal Hocko <mhocko@suse.cz>
+Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
+Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+Acked-by: David Rientjes <rientjes@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/hugetlb.c |   12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -2906,7 +2906,17 @@ int follow_hugetlb_page(struct mm_struct
+                       break;
+               }
+-              if (absent ||
++              /*
++               * We need call hugetlb_fault for both hugepages under migration
++               * (in which case hugetlb_fault waits for the migration,) and
++               * hwpoisoned hugepages (in which case we need to prevent the
++               * caller from accessing to them.) In order to do this, we use
++               * here is_swap_pte instead of is_hugetlb_entry_migration and
++               * is_hugetlb_entry_hwpoisoned. This is because it simply covers
++               * both cases, and because we can't follow correct pages
++               * directly from any kind of swap entries.
++               */
++              if (absent || is_swap_pte(huge_ptep_get(pte)) ||
+                   ((flags & FOLL_WRITE) && !pte_write(huge_ptep_get(pte)))) {
+                       int ret;
diff --git a/queue-3.4/kernel-signal.c-stop-info-leak-via-the-tkill-and-the-tgkill-syscalls.patch b/queue-3.4/kernel-signal.c-stop-info-leak-via-the-tkill-and-the-tgkill-syscalls.patch
new file mode 100644 (file)
index 0000000..762e009
--- /dev/null
@@ -0,0 +1,50 @@
+From b9e146d8eb3b9ecae5086d373b50fa0c1f3e7f0f Mon Sep 17 00:00:00 2001
+From: Emese Revfy <re.emese@gmail.com>
+Date: Wed, 17 Apr 2013 15:58:36 -0700
+Subject: kernel/signal.c: stop info leak via the tkill and the tgkill syscalls
+
+From: Emese Revfy <re.emese@gmail.com>
+
+commit b9e146d8eb3b9ecae5086d373b50fa0c1f3e7f0f upstream.
+
+This fixes a kernel memory contents leak via the tkill and tgkill syscalls
+for compat processes.
+
+This is visible in the siginfo_t->_sifields._rt.si_sigval.sival_ptr field
+when handling signals delivered from tkill.
+
+The place of the infoleak:
+
+int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
+{
+        ...
+        put_user_ex(ptr_to_compat(from->si_ptr), &to->si_ptr);
+        ...
+}
+
+Signed-off-by: Emese Revfy <re.emese@gmail.com>
+Reviewed-by: PaX Team <pageexec@freemail.hu>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Cc: Oleg Nesterov <oleg@redhat.com>
+Cc: "Eric W. Biederman" <ebiederm@xmission.com>
+Cc: Serge Hallyn <serge.hallyn@canonical.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/signal.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/signal.c
++++ b/kernel/signal.c
+@@ -2867,7 +2867,7 @@ do_send_specific(pid_t tgid, pid_t pid,
+ static int do_tkill(pid_t tgid, pid_t pid, int sig)
+ {
+-      struct siginfo info;
++      struct siginfo info = {};
+       info.si_signo = sig;
+       info.si_errno = 0;
index 6659be4bfcd0eabe0f27bb4e1d3109c1a439fef6..408a9ec0437544385db32ce5dc4b874959f31c3a 100644 (file)
@@ -1,3 +1,5 @@
 arm-do-15e0d9e37c-arm-pm-let-platforms-select-cpu_suspend-support-properly.patch
 hrtimer-don-t-reinitialize-a-cpu_base-lock-on-cpu_up.patch
 can-sja1000-fix-handling-on-dt-properties-on-little-endian-systems.patch
+hugetlbfs-add-swap-entry-check-in-follow_hugetlb_page.patch
+kernel-signal.c-stop-info-leak-via-the-tkill-and-the-tgkill-syscalls.patch