From: Greg Kroah-Hartman Date: Tue, 15 Oct 2013 18:49:40 +0000 (-0700) Subject: 3.4-stable patches X-Git-Tag: v3.10.17~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c2b430be511fab010c0bdadd0ccb812aa04abd6b;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: drm-radeon-fix-hw-contexts-for-sumo2-asics.patch mm-mmap-check-for-rlimit_as-before-unmapping.patch --- diff --git a/queue-3.4/drm-radeon-fix-hw-contexts-for-sumo2-asics.patch b/queue-3.4/drm-radeon-fix-hw-contexts-for-sumo2-asics.patch new file mode 100644 index 00000000000..98c2af54c94 --- /dev/null +++ b/queue-3.4/drm-radeon-fix-hw-contexts-for-sumo2-asics.patch @@ -0,0 +1,33 @@ +From 50b8f5aec04ebec7dbdf2adb17220b9148c99e63 Mon Sep 17 00:00:00 2001 +From: wojciech kapuscinski +Date: Tue, 1 Oct 2013 19:54:33 -0400 +Subject: drm/radeon: fix hw contexts for SUMO2 asics + +From: wojciech kapuscinski + +commit 50b8f5aec04ebec7dbdf2adb17220b9148c99e63 upstream. + +They have 4 rather than 8. + +Fixes: +https://bugs.freedesktop.org/show_bug.cgi?id=63599 + +Signed-off-by: wojciech kapuscinski +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/evergreen.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/radeon/evergreen.c ++++ b/drivers/gpu/drm/radeon/evergreen.c +@@ -1912,7 +1912,7 @@ static void evergreen_gpu_init(struct ra + rdev->config.evergreen.sx_max_export_size = 256; + rdev->config.evergreen.sx_max_export_pos_size = 64; + rdev->config.evergreen.sx_max_export_smx_size = 192; +- rdev->config.evergreen.max_hw_contexts = 8; ++ rdev->config.evergreen.max_hw_contexts = 4; + rdev->config.evergreen.sq_num_cf_insts = 2; + + rdev->config.evergreen.sc_prim_fifo_size = 0x40; diff --git a/queue-3.4/mm-mmap-check-for-rlimit_as-before-unmapping.patch b/queue-3.4/mm-mmap-check-for-rlimit_as-before-unmapping.patch new file mode 100644 index 00000000000..151d85a0c03 --- /dev/null +++ b/queue-3.4/mm-mmap-check-for-rlimit_as-before-unmapping.patch @@ -0,0 +1,130 @@ +From e8420a8ece80b3fe810415ecf061d54ca7fab266 Mon Sep 17 00:00:00 2001 +From: Cyril Hrubis +Date: Mon, 29 Apr 2013 15:08:33 -0700 +Subject: mm/mmap: check for RLIMIT_AS before unmapping + +From: Cyril Hrubis + +commit e8420a8ece80b3fe810415ecf061d54ca7fab266 upstream. + +Fix a corner case for MAP_FIXED when requested mapping length is larger +than rlimit for virtual memory. In such case any overlapping mappings +are unmapped before we check for the limit and return ENOMEM. + +The check is moved before the loop that unmaps overlapping parts of +existing mappings. When we are about to hit the limit (currently mapped +pages + len > limit) we scan for overlapping pages and check again +accounting for them. + +This fixes situation when userspace program expects that the previous +mappings are preserved after the mmap() syscall has returned with error. +(POSIX clearly states that successfull mapping shall replace any +previous mappings.) + +This corner case was found and can be tested with LTP testcase: + +testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c + +In this case the mmap, which is clearly over current limit, unmaps +dynamic libraries and the testcase segfaults right after returning into +userspace. + +I've also looked at the second instance of the unmapping loop in the +do_brk(). The do_brk() is called from brk() syscall and from vm_brk(). +The brk() syscall checks for overlapping mappings and bails out when +there are any (so it can't be triggered from the brk syscall). The +vm_brk() is called only from binmft handlers so it shouldn't be +triggered unless binmft handler created overlapping mappings. + +Signed-off-by: Cyril Hrubis +Reviewed-by: Mel Gorman +Reviewed-by: Wanpeng Li +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Cc: Xishi Qiu +Signed-off-by: Greg Kroah-Hartman + +--- + mm/mmap.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 46 insertions(+), 4 deletions(-) + +--- a/mm/mmap.c ++++ b/mm/mmap.c +@@ -6,6 +6,7 @@ + * Address space accounting code + */ + ++#include + #include + #include + #include +@@ -392,6 +393,34 @@ find_vma_prepare(struct mm_struct *mm, u + return vma; + } + ++static unsigned long count_vma_pages_range(struct mm_struct *mm, ++ unsigned long addr, unsigned long end) ++{ ++ unsigned long nr_pages = 0; ++ struct vm_area_struct *vma; ++ ++ /* Find first overlaping mapping */ ++ vma = find_vma_intersection(mm, addr, end); ++ if (!vma) ++ return 0; ++ ++ nr_pages = (min(end, vma->vm_end) - ++ max(addr, vma->vm_start)) >> PAGE_SHIFT; ++ ++ /* Iterate over the rest of the overlaps */ ++ for (vma = vma->vm_next; vma; vma = vma->vm_next) { ++ unsigned long overlap_len; ++ ++ if (vma->vm_start > end) ++ break; ++ ++ overlap_len = min(end, vma->vm_end) - vma->vm_start; ++ nr_pages += overlap_len >> PAGE_SHIFT; ++ } ++ ++ return nr_pages; ++} ++ + void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma, + struct rb_node **rb_link, struct rb_node *rb_parent) + { +@@ -1245,6 +1274,23 @@ unsigned long mmap_region(struct file *f + unsigned long charged = 0; + struct inode *inode = file ? file->f_path.dentry->d_inode : NULL; + ++ /* Check against address space limit. */ ++ if (!may_expand_vm(mm, len >> PAGE_SHIFT)) { ++ unsigned long nr_pages; ++ ++ /* ++ * MAP_FIXED may remove pages of mappings that intersects with ++ * requested mapping. Account for the pages it would unmap. ++ */ ++ if (!(vm_flags & MAP_FIXED)) ++ return -ENOMEM; ++ ++ nr_pages = count_vma_pages_range(mm, addr, addr + len); ++ ++ if (!may_expand_vm(mm, (len >> PAGE_SHIFT) - nr_pages)) ++ return -ENOMEM; ++ } ++ + /* Clear old maps */ + error = -ENOMEM; + munmap_back: +@@ -1255,10 +1301,6 @@ munmap_back: + goto munmap_back; + } + +- /* Check against address space limit. */ +- if (!may_expand_vm(mm, len >> PAGE_SHIFT)) +- return -ENOMEM; +- + /* + * Set 'VM_NORESERVE' if we should not account for the + * memory use of this mapping. diff --git a/queue-3.4/series b/queue-3.4/series index 15db212a378..5e38a20e5c4 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -6,3 +6,5 @@ ext4-fix-memory-leak-in-xattr.patch kvm-ppc-book3s-hv-fix-typo-in-saving-dscr.patch parisc-fix-interruption-handler-to-respect-pagefault_disable.patch watchdog-ts72xx_wdt-locking-bug-in-ioctl.patch +drm-radeon-fix-hw-contexts-for-sumo2-asics.patch +mm-mmap-check-for-rlimit_as-before-unmapping.patch