summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-kernel/xbox-sources/files/xbox-sources-2.6.10.77666.patch')
-rw-r--r--sys-kernel/xbox-sources/files/xbox-sources-2.6.10.77666.patch79
1 files changed, 55 insertions, 24 deletions
diff --git a/sys-kernel/xbox-sources/files/xbox-sources-2.6.10.77666.patch b/sys-kernel/xbox-sources/files/xbox-sources-2.6.10.77666.patch
index 2fc42f237429..035a396a8057 100644
--- a/sys-kernel/xbox-sources/files/xbox-sources-2.6.10.77666.patch
+++ b/sys-kernel/xbox-sources/files/xbox-sources-2.6.10.77666.patch
@@ -1,6 +1,47 @@
---- linux-2.6.9/mm/mmap.c 2005-03-16 21:06:42.000000000 +0000
-+++ linux-2.6.9-plasmaroo/mm/mmap.c 2005-03-16 21:09:26.000000000 +0000
-@@ -1316,13 +1316,57 @@ out:
+# ChangeSet #3
+# 2005/01/12 08:09:20-08:00 torvalds@ppc970.osdl.org
+# Handle two threads both trying to expand their stack simultaneously.
+#
+# We had all the locking right, but we didn't check whether one of the
+# threads now no longer needed to expand, so we could incorrectly _shrink_
+# the stack in the other thread instead (not only causing segfaults, but
+# since we didn't do a proper unmap, we'd possibly leak pages too).
+#
+# So re-check the need for expand after getting the lock.
+#
+# Noticed by Paul Starzetz.
+#
+# ChangeSet #2
+# 2005/01/10 11:23:42-08:00 torvalds@ppc970.osdl.org
+# Clean up stack growth checks and move them into a common function.
+#
+# The grows-up and grows-down cases had all the same issues, but
+# differered in the details. Additionlly, historical evolution of
+# the tests had caused the result to be pretty unreadable with some
+# rather long and complex conditionals.
+#
+# Fix it all up in a more readable helper function.
+#
+# This also adds the missing RLIMIT_MEMLOCK test.
+#
+# ChangeSet #1
+# 2005/01/11 07:40:07-08:00 chrisw@osdl.org
+# [PATCH] acct_stack_growth nitpicks
+#
+# - allow CAP_IPC_LOCK to override mlock rlimit during stack expansion as
+# in all other cases
+#
+# Signed-off-by: Chris Wright <chrisw@osdl.org>
+# Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+#
+# mm/mmap.c
+# 2005/01/10 19:34:05-08:00 chrisw@osdl.org +1 -1
+# acct_stack_growth nitpicks
+#
+diff -urNp linux-2.6.10/mm/mmap.c linux-2.6.10.plasmaroo/mm/mmap.c
+--- linux-2.6.10/mm/mmap.c 2004-12-24 21:35:00.000000000 +0000
++++ linux-2.6.10.plasmaroo/mm/mmap.c 2005-01-15 21:49:26.000000000 +0000
+@@ -1319,13 +1319,57 @@ out:
return prev ? prev->vm_next : vma;
}
@@ -12,10 +53,10 @@
+static int acct_stack_growth(struct vm_area_struct * vma, unsigned long size, unsigned long grow)
+{
+ struct mm_struct *mm = vma->vm_mm;
-+ struct rlimit *rlim = current->rlim;
++ struct rlimit *rlim = current->signal->rlim;
+
+ /* address space limit tests */
-+ rlim = current->rlim;
++ rlim = current->signal->rlim;
+ if (mm->total_vm + grow > rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT)
+ return -ENOMEM;
+
@@ -59,7 +100,7 @@
if (!(vma->vm_flags & VM_GROWSUP))
return -EFAULT;
-@@ -1342,20 +1386,18 @@ int expand_stack(struct vm_area_struct *
+@@ -1345,28 +1389,25 @@ int expand_stack(struct vm_area_struct *
*/
address += 4 + PAGE_SIZE - 1;
address &= PAGE_MASK;
@@ -89,27 +130,23 @@
+ if (!error)
+ vma->vm_end = address;
}
- if ((vma->vm_flags & VM_LOCKED) && !capable(CAP_IPC_LOCK) &&
- ((vma->vm_mm->locked_vm + grow) << PAGE_SHIFT) >
-@@ -1364,13 +1406,12 @@ int expand_stack(struct vm_area_struct *
- vm_unacct_memory(grow);
- return -ENOMEM;
- }
- vma->vm_end = address;
- vma->vm_mm->total_vm += grow;
- if (vma->vm_flags & VM_LOCKED)
- vma->vm_mm->locked_vm += grow;
+- __vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, grow);
+- anon_vma_unlock(vma);
+- return 0;
++
+ error = acct_stack_growth(vma, size, grow);
+ if (!error)
+ vma->vm_end = address;
- __vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, grow);
- anon_vma_unlock(vma);
-- return 0;
++ anon_vma_unlock(vma);
+ return error;
}
struct vm_area_struct *
-@@ -1395,7 +1436,7 @@ find_extend_vma(struct mm_struct *mm, un
+@@ -1391,7 +1432,7 @@ find_extend_vma(struct mm_struct *mm, un
*/
int expand_stack(struct vm_area_struct *vma, unsigned long address)
{
@@ -118,7 +155,7 @@
/*
* We must make sure the anon_vma is allocated
-@@ -1411,20 +1452,20 @@ int expand_stack(struct vm_area_struct *
+@@ -1407,29 +1448,23 @@ int expand_stack(struct vm_area_struct *
* anon_vma lock to serialize against concurrent expand_stacks.
*/
address &= PAGE_MASK;
@@ -150,18 +187,12 @@
+ vma->vm_pgoff -= grow;
+ }
}
- if ((vma->vm_flags & VM_LOCKED) && !capable(CAP_IPC_LOCK) &&
- ((vma->vm_mm->locked_vm + grow) << PAGE_SHIFT) >
-@@ -1433,14 +1474,9 @@ int expand_stack(struct vm_area_struct *
- vm_unacct_memory(grow);
- return -ENOMEM;
- }
- vma->vm_start = address;
- vma->vm_pgoff -= grow;
- vma->vm_mm->total_vm += grow;
- if (vma->vm_flags & VM_LOCKED)
- vma->vm_mm->locked_vm += grow;
- __vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, grow);
+- __vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, grow);
anon_vma_unlock(vma);
- return 0;
+ return error;