linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-05 23:39 Ying Han
  2009-01-09  2:40 ` Ying Han
  2009-01-12 22:59 ` Andrew Morton
  0 siblings, 2 replies; 10+ messages in thread
From: Ying Han @ 2009-01-05 23:39 UTC (permalink / raw)
  To: linux-mm, linux-kernel, Mike Waychison, Rohit Seth

From: Ying Han <yinghan@google.com>

Fix 32bit binary get 64bit stack vma offset.

32bit binary running on 64bit system, the /proc/pid/maps shows for the
vma represents stack get a 64bit adress:
ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]

Signed-off-by:	Ying Han <yinghan@google.com>

fs/exec.c                     |    5 +-

diff --git a/fs/exec.c b/fs/exec.c
index 4e834f1..8c3eff4 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -517,6 +517,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, uns
 	unsigned long length = old_end - old_start;
 	unsigned long new_start = old_start - shift;
 	unsigned long new_end = old_end - shift;
+	unsigned long new_pgoff = new_start >> PAGE_SHIFT;
 	struct mmu_gather *tlb;

 	BUG_ON(new_start > new_end);
@@ -531,7 +532,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, uns
 	/*
 	 * cover the whole range: [new_start, old_end)
 	 */
-	vma_adjust(vma, new_start, old_end, vma->vm_pgoff, NULL);
+	vma_adjust(vma, new_start, old_end, new_pgoff, NULL);

 	/*
 	 * move the page tables downwards, on failure we rely on
@@ -564,7 +565,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, uns
 	/*
 	 * shrink the vma to just the new range.
 	 */
-	vma_adjust(vma, new_start, new_end, vma->vm_pgoff, NULL);
+	vma_adjust(vma, new_start, new_end, new_pgoff, NULL);

 	return 0;
 }

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-01-13 17:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-05 23:39 [PATCH]Fix: 32bit binary has 64bit address of stack vma Ying Han
2009-01-09  2:40 ` Ying Han
2009-01-10  0:27   ` Ying Han
2009-01-10  0:37     ` Andrew Morton
2009-01-10  1:32       ` Ying Han
2009-01-12 22:59 ` Andrew Morton
2009-01-12 23:05   ` Mike Waychison
2009-01-12 23:10     ` Andrew Morton
2009-01-13 17:59       ` Hugh Dickins
2009-01-12 23:06   ` Ying Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).