[kernel] r16752 - in dists/sid/linux-2.6/debian/patches: bugfix/all debian features/all/openvz series

Ben Hutchings benh at alioth.debian.org
Mon Jan 3 05:30:20 UTC 2011


Author: benh
Date: Mon Jan  3 05:30:15 2011
New Revision: 16752

Log:
exec: Get rid of linux_binprm::vma_pages

Adding linux_binprm::vma_pages is an ABI-breaker and we can't hide it
because the structure is allocated directly by modules.

Added:
   dists/sid/linux-2.6/debian/patches/debian/exec-Get-rid-of-linux_binprm-vma_pages.patch
Deleted:
   dists/sid/linux-2.6/debian/patches/bugfix/all/exec-make-argv-envp-memory-visible-to-oom-killer-abi-change.patch
Modified:
   dists/sid/linux-2.6/debian/patches/features/all/openvz/openvz.patch
   dists/sid/linux-2.6/debian/patches/series/30

Added: dists/sid/linux-2.6/debian/patches/debian/exec-Get-rid-of-linux_binprm-vma_pages.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/debian/exec-Get-rid-of-linux_binprm-vma_pages.patch	Mon Jan  3 05:30:15 2011	(r16752)
@@ -0,0 +1,123 @@
+From 5e91f59665165f91f97746439e53cc520bb42b97 Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Mon, 3 Jan 2011 03:31:58 +0000
+Subject: [PATCH] exec: Get rid of linux_binprm::vma_pages
+
+Adding linux_binprm::vma_pages is an ABI-breaker and we can't hide it
+because the structure is allocated directly by modules.  However it's
+just a cache of vma_pages(bprm->vma), so:
+
+- We can work out and pass in the old value from get_arg_page()
+- The calls to acct_arg_size(bprm, 0) are redundant, since
+  neither the cache nor the dead mm need to be updated
+
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+---
+ fs/compat.c             |    1 -
+ fs/exec.c               |   16 ++++++++--------
+ include/linux/binfmts.h |    2 --
+ 3 files changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/fs/compat.c b/fs/compat.c
+index d1e2411..a6e27ae 100644
+--- a/fs/compat.c
++++ b/fs/compat.c
+@@ -1543,7 +1543,6 @@ int compat_do_execve(char * filename,
+ 
+ out:
+ 	if (bprm->mm) {
+-		acct_arg_size(bprm, 0);
+ 		mmput(bprm->mm);
+ 	}
+ 
+diff --git a/fs/exec.c b/fs/exec.c
+index d335948..51c1a77 100644
+--- a/fs/exec.c
++++ b/fs/exec.c
+@@ -159,16 +159,15 @@ out:
+ 
+ #ifdef CONFIG_MMU
+ 
+-void acct_arg_size(struct linux_binprm *bprm, unsigned long pages)
++static void acct_arg_size(struct linux_binprm *bprm, unsigned long pages,
++			  unsigned long old_pages)
+ {
+ 	struct mm_struct *mm = current->mm;
+-	long diff = (long)(pages - bprm->vma_pages);
++	long diff = (long)(pages - old_pages);
+ 
+ 	if (!mm || !diff)
+ 		return;
+ 
+-	bprm->vma_pages = pages;
+-
+ 	down_write(&mm->mmap_sem);
+ 	mm->total_vm += diff;
+ 	up_write(&mm->mmap_sem);
+@@ -177,6 +176,8 @@ void acct_arg_size(struct linux_binprm *bprm, unsigned long pages)
+ struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
+ 		int write)
+ {
++	unsigned long old_vma_pages =
++		(bprm->vma->vm_end - bprm->vma->vm_start) / PAGE_SIZE;
+ 	struct page *page;
+ 	int ret;
+ 
+@@ -196,7 +197,7 @@ struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
+ 		unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start;
+ 		struct rlimit *rlim;
+ 
+-		acct_arg_size(bprm, size / PAGE_SIZE);
++		acct_arg_size(bprm, size / PAGE_SIZE, old_vma_pages);
+ 
+ 		/*
+ 		 * We've historically supported up to 32 pages (ARG_MAX)
+@@ -286,7 +287,8 @@ static bool valid_arg_len(struct linux_binprm *bprm, long len)
+ 
+ #else
+ 
+-void acct_arg_size(struct linux_binprm *bprm, unsigned long pages)
++static void acct_arg_size(struct linux_binprm *bprm, unsigned long pages,
++			  unsigned long old_pages)
+ {
+ }
+ 
+@@ -997,7 +999,6 @@ int flush_old_exec(struct linux_binprm * bprm)
+ 	/*
+ 	 * Release all of the old mmap stuff
+ 	 */
+-	acct_arg_size(bprm, 0);
+ 	retval = exec_mmap(bprm->mm);
+ 	if (retval)
+ 		goto out;
+@@ -1426,7 +1427,6 @@ int do_execve(char * filename,
+ 
+ out:
+ 	if (bprm->mm) {
+-		acct_arg_size(bprm, 0);
+ 		mmput(bprm->mm);
+ 	}
+ 
+diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
+index a3d802e..c64c497 100644
+--- a/include/linux/binfmts.h
++++ b/include/linux/binfmts.h
+@@ -29,7 +29,6 @@ struct linux_binprm{
+ 	char buf[BINPRM_BUF_SIZE];
+ #ifdef CONFIG_MMU
+ 	struct vm_area_struct *vma;
+-	unsigned long vma_pages;
+ #else
+ # define MAX_ARG_PAGES	32
+ 	struct page *page[MAX_ARG_PAGES];
+@@ -60,7 +59,6 @@ struct linux_binprm{
+ 	unsigned long loader, exec;
+ };
+ 
+-extern void acct_arg_size(struct linux_binprm *bprm, unsigned long pages);
+ extern struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
+ 					int write);
+ 
+-- 
+1.7.2.3
+

Modified: dists/sid/linux-2.6/debian/patches/features/all/openvz/openvz.patch
==============================================================================
--- dists/sid/linux-2.6/debian/patches/features/all/openvz/openvz.patch	Sun Jan  2 23:27:09 2011	(r16751)
+++ dists/sid/linux-2.6/debian/patches/features/all/openvz/openvz.patch	Mon Jan  3 05:30:15 2011	(r16752)
@@ -16474,9 +16474,9 @@
  		tsk->group_leader = tsk;
  		leader->group_leader = tsk;
 @@ -998,12 +1030,10 @@ int flush_old_exec(struct linux_binprm *
+ 	/*
  	 * Release all of the old mmap stuff
  	 */
- 	acct_arg_size(bprm, 0);
 -	retval = exec_mmap(bprm->mm);
 +	retval = exec_mmap(bprm);
  	if (retval)

Modified: dists/sid/linux-2.6/debian/patches/series/30
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/30	Sun Jan  2 23:27:09 2011	(r16751)
+++ dists/sid/linux-2.6/debian/patches/series/30	Mon Jan  3 05:30:15 2011	(r16752)
@@ -20,8 +20,8 @@
 + bugfix/all/drm-radeon-kms-don-t-apply-7xx-hdp-flush-workaround-on-agp.patch
 + bugfix/all/irda-prevent-integer-underflow-in-IRLMP_ENUMDEVICES.patch
 + bugfix/all/exec-make-argv-envp-memory-visible-to-oom-killer.patch
-+ bugfix/all/exec-make-argv-envp-memory-visible-to-oom-killer-abi-change.patch
 + bugfix/all/exec-copy-and-paste-the-fixes-into-compat_do_execve-paths.patch
++ debian/exec-Get-rid-of-linux_binprm-vma_pages.patch
 + features/all/rt28x0-Add-ieee80211_regdom-module-parameter.patch
 + bugfix/all/btrfs-Require-CAP_SYS_ADMIN-for-filesystem-rebalance.patch
 + features/x86/dell-laptop-Add-Dell-Computer-type-8-to-DMI-whitelist.patch



More information about the Kernel-svn-changes mailing list