All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-05 23:39 ` Ying Han
  0 siblings, 0 replies; 23+ 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;
 }

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

* [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-05 23:39 ` Ying Han
  0 siblings, 0 replies; 23+ 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] 23+ messages in thread

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-09  2:40   ` Ying Han
  0 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-09  2:40 UTC (permalink / raw)
  To: linux-mm, linux-kernel, Mike Waychison, Rohit Seth,
	Andrew Morton, linux-api

On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan@google.com> wrote:
> 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;
>  }
>

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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-09  2:40   ` Ying Han
  0 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-09  2:40 UTC (permalink / raw)
  To: linux-mm, linux-kernel, Mike Waychison, Rohit Seth, Andrew Morton

On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> wrote:
> From: Ying Han <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>
> 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-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>
> 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 from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-09  2:40   ` Ying Han
  0 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-09  2:40 UTC (permalink / raw)
  To: linux-mm, linux-kernel, Mike Waychison, Rohit Seth,
	Andrew Morton, linux-api

On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan@google.com> wrote:
> 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	[flat|nested] 23+ messages in thread

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
  2009-01-09  2:40   ` Ying Han
@ 2009-01-10  0:27     ` Ying Han
  -1 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-10  0:27 UTC (permalink / raw)
  To: linux-mm, linux-kernel, Mike Waychison, Rohit Seth,
	Andrew Morton, linux-api, Oleg Nesterov

friendly ping...

On Thu, Jan 8, 2009 at 6:40 PM, Ying Han <yinghan@google.com> wrote:
> On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan@google.com> wrote:
>> 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;
>>  }
>>
>

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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
       [not found]   ` <604427e00901081840pa6dcc41u9a7a5c69302c7b60-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-01-10  0:27     ` Ying Han
  0 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-10  0:27 UTC (permalink / raw)
  To: linux-mm, linux-kernel, Mike Waychison, Rohit Seth, Andrew Morton

friendly ping...

On Thu, Jan 8, 2009 at 6:40 PM, Ying Han <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> wrote:
> On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> wrote:
>> From: Ying Han <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>>
>> 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-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>>
>> 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 from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-10  0:27     ` Ying Han
  0 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-10  0:27 UTC (permalink / raw)
  To: linux-mm, linux-kernel, Mike Waychison, Rohit Seth,
	Andrew Morton, linux-api, Oleg Nesterov

friendly ping...

On Thu, Jan 8, 2009 at 6:40 PM, Ying Han <yinghan@google.com> wrote:
> On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan@google.com> wrote:
>> 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	[flat|nested] 23+ messages in thread

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
  2009-01-10  0:27     ` Ying Han
@ 2009-01-10  0:37       ` Andrew Morton
  -1 siblings, 0 replies; 23+ messages in thread
From: Andrew Morton @ 2009-01-10  0:37 UTC (permalink / raw)
  To: Ying Han; +Cc: linux-mm, linux-kernel, mikew, rohitseth, linux-api, oleg

On Fri, 9 Jan 2009 16:27:07 -0800
Ying Han <yinghan@google.com> wrote:

> friendly ping...

We'll get there.  We're in the merge window now, so I tend to defer
non-serious bugfixes until things are a bit quieter.

> On Thu, Jan 8, 2009 at 6:40 PM, Ying Han <yinghan@google.com> wrote:
> > On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan@google.com> wrote:
> >> 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]

That changelog hurts my brain.

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

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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-10  0:37       ` Andrew Morton
  0 siblings, 0 replies; 23+ messages in thread
From: Andrew Morton @ 2009-01-10  0:37 UTC (permalink / raw)
  To: Ying Han; +Cc: linux-mm, linux-kernel, mikew, rohitseth, linux-api, oleg

On Fri, 9 Jan 2009 16:27:07 -0800
Ying Han <yinghan@google.com> wrote:

> friendly ping...

We'll get there.  We're in the merge window now, so I tend to defer
non-serious bugfixes until things are a bit quieter.

> On Thu, Jan 8, 2009 at 6:40 PM, Ying Han <yinghan@google.com> wrote:
> > On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan@google.com> wrote:
> >> 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]

That changelog hurts my brain.

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

--
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	[flat|nested] 23+ messages in thread

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-10  1:32         ` Ying Han
  0 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-10  1:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linux-kernel, mikew, rohitseth, linux-api, oleg

On Fri, Jan 9, 2009 at 4:37 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 9 Jan 2009 16:27:07 -0800
> Ying Han <yinghan@google.com> wrote:
>
>> friendly ping...
>
> We'll get there.  We're in the merge window now, so I tend to defer
> non-serious bugfixes until things are a bit quieter.
Thank you Andrew .

>
>> On Thu, Jan 8, 2009 at 6:40 PM, Ying Han <yinghan@google.com> wrote:
>> > On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan@google.com> wrote:
>> >> 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]
>
> That changelog hurts my brain.
hm, i will change it for better reading.
>
>> >> Signed-off-by:  Ying Han <yinghan@google.com>
>

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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-10  1:32         ` Ying Han
  0 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-10  1:32 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	mikew-hpIqsD4AKlfQT0dZR+AlfA, rohitseth-hpIqsD4AKlfQT0dZR+AlfA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, oleg-H+wXaHxf7aLQT0dZR+AlfA

On Fri, Jan 9, 2009 at 4:37 PM, Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> wrote:
> On Fri, 9 Jan 2009 16:27:07 -0800
> Ying Han <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> wrote:
>
>> friendly ping...
>
> We'll get there.  We're in the merge window now, so I tend to defer
> non-serious bugfixes until things are a bit quieter.
Thank you Andrew .

>
>> On Thu, Jan 8, 2009 at 6:40 PM, Ying Han <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> wrote:
>> > On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> wrote:
>> >> From: Ying Han <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>> >>
>> >> 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]
>
> That changelog hurts my brain.
hm, i will change it for better reading.
>
>> >> Signed-off-by:  Ying Han <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-10  1:32         ` Ying Han
  0 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-10  1:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linux-kernel, mikew, rohitseth, linux-api, oleg

On Fri, Jan 9, 2009 at 4:37 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 9 Jan 2009 16:27:07 -0800
> Ying Han <yinghan@google.com> wrote:
>
>> friendly ping...
>
> We'll get there.  We're in the merge window now, so I tend to defer
> non-serious bugfixes until things are a bit quieter.
Thank you Andrew .

>
>> On Thu, Jan 8, 2009 at 6:40 PM, Ying Han <yinghan@google.com> wrote:
>> > On Mon, Jan 5, 2009 at 3:39 PM, Ying Han <yinghan@google.com> wrote:
>> >> 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]
>
> That changelog hurts my brain.
hm, i will change it for better reading.
>
>> >> Signed-off-by:  Ying Han <yinghan@google.com>
>

--
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	[flat|nested] 23+ messages in thread

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
  2009-01-05 23:39 ` Ying Han
@ 2009-01-12 22:59   ` Andrew Morton
  -1 siblings, 0 replies; 23+ messages in thread
From: Andrew Morton @ 2009-01-12 22:59 UTC (permalink / raw)
  To: Ying Han; +Cc: linux-mm, linux-kernel, mikew, rohitseth

On Mon, 5 Jan 2009 15:39:07 -0800
Ying Han <yinghan@google.com> wrote:

> 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;

I rewrote the chagnelog as below.  Please confirm that it makes sense?


Subject: fs/exec.c: fix value of vma->vm_pgoff for the stack VMA of 32-bit processes
From: Ying Han <yinghan@google.com>

With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
the [stack] VMA displays a 64-bit address:

ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]

This is because vma->vm_pgoff for that VMA is incorrectly being stored in
units of offset-in-bytes.  It should be stored in units of offset-in-pages.

Signed-off-by: Ying Han <yinghan@google.com>
Cc: Mike Waychison <mikew@google.com>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/exec.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes fs/exec.c
--- a/fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes
+++ a/fs/exec.c
@@ -509,6 +509,7 @@ static int shift_arg_pages(struct vm_are
 	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);
@@ -523,7 +524,7 @@ static int shift_arg_pages(struct vm_are
 	/*
 	 * 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
@@ -556,7 +557,7 @@ static int shift_arg_pages(struct vm_are
 	/*
 	 * 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;
 }
_


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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-12 22:59   ` Andrew Morton
  0 siblings, 0 replies; 23+ messages in thread
From: Andrew Morton @ 2009-01-12 22:59 UTC (permalink / raw)
  To: Ying Han; +Cc: linux-mm, linux-kernel, mikew, rohitseth

On Mon, 5 Jan 2009 15:39:07 -0800
Ying Han <yinghan@google.com> wrote:

> 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;

I rewrote the chagnelog as below.  Please confirm that it makes sense?


Subject: fs/exec.c: fix value of vma->vm_pgoff for the stack VMA of 32-bit processes
From: Ying Han <yinghan@google.com>

With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
the [stack] VMA displays a 64-bit address:

ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]

This is because vma->vm_pgoff for that VMA is incorrectly being stored in
units of offset-in-bytes.  It should be stored in units of offset-in-pages.

Signed-off-by: Ying Han <yinghan@google.com>
Cc: Mike Waychison <mikew@google.com>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/exec.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes fs/exec.c
--- a/fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes
+++ a/fs/exec.c
@@ -509,6 +509,7 @@ static int shift_arg_pages(struct vm_are
 	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);
@@ -523,7 +524,7 @@ static int shift_arg_pages(struct vm_are
 	/*
 	 * 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
@@ -556,7 +557,7 @@ static int shift_arg_pages(struct vm_are
 	/*
 	 * 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	[flat|nested] 23+ messages in thread

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
  2009-01-12 22:59   ` Andrew Morton
@ 2009-01-12 23:05     ` Mike Waychison
  -1 siblings, 0 replies; 23+ messages in thread
From: Mike Waychison @ 2009-01-12 23:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ying Han, linux-mm, linux-kernel, rohitseth

Andrew Morton wrote:
> On Mon, 5 Jan 2009 15:39:07 -0800
> Ying Han <yinghan@google.com> wrote:
> 
>> 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;
> 
> I rewrote the chagnelog as below.  Please confirm that it makes sense?
> 
> 
> Subject: fs/exec.c: fix value of vma->vm_pgoff for the stack VMA of 32-bit processes
> From: Ying Han <yinghan@google.com>
> 
> With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
> the [stack] VMA displays a 64-bit address:
> 
> ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]
> 
> This is because vma->vm_pgoff for that VMA is incorrectly being stored in
> units of offset-in-bytes.  It should be stored in units of offset-in-pages.
> 

The problem is that the offset was stored without taking into account 
the shift.

> Signed-off-by: Ying Han <yinghan@google.com>
> Cc: Mike Waychison <mikew@google.com>
> Cc: Hugh Dickins <hugh@veritas.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  fs/exec.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff -puN fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes fs/exec.c
> --- a/fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes
> +++ a/fs/exec.c
> @@ -509,6 +509,7 @@ static int shift_arg_pages(struct vm_are
>  	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);
> @@ -523,7 +524,7 @@ static int shift_arg_pages(struct vm_are
>  	/*
>  	 * 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
> @@ -556,7 +557,7 @@ static int shift_arg_pages(struct vm_are
>  	/*
>  	 * 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;
>  }
> _
> 


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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-12 23:05     ` Mike Waychison
  0 siblings, 0 replies; 23+ messages in thread
From: Mike Waychison @ 2009-01-12 23:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ying Han, linux-mm, linux-kernel, rohitseth

Andrew Morton wrote:
> On Mon, 5 Jan 2009 15:39:07 -0800
> Ying Han <yinghan@google.com> wrote:
> 
>> 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;
> 
> I rewrote the chagnelog as below.  Please confirm that it makes sense?
> 
> 
> Subject: fs/exec.c: fix value of vma->vm_pgoff for the stack VMA of 32-bit processes
> From: Ying Han <yinghan@google.com>
> 
> With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
> the [stack] VMA displays a 64-bit address:
> 
> ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]
> 
> This is because vma->vm_pgoff for that VMA is incorrectly being stored in
> units of offset-in-bytes.  It should be stored in units of offset-in-pages.
> 

The problem is that the offset was stored without taking into account 
the shift.

> Signed-off-by: Ying Han <yinghan@google.com>
> Cc: Mike Waychison <mikew@google.com>
> Cc: Hugh Dickins <hugh@veritas.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  fs/exec.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff -puN fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes fs/exec.c
> --- a/fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes
> +++ a/fs/exec.c
> @@ -509,6 +509,7 @@ static int shift_arg_pages(struct vm_are
>  	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);
> @@ -523,7 +524,7 @@ static int shift_arg_pages(struct vm_are
>  	/*
>  	 * 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
> @@ -556,7 +557,7 @@ static int shift_arg_pages(struct vm_are
>  	/*
>  	 * 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	[flat|nested] 23+ messages in thread

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
  2009-01-12 22:59   ` Andrew Morton
@ 2009-01-12 23:06     ` Ying Han
  -1 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-12 23:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linux-kernel, mikew, rohitseth

Thanks Andrew.

On Mon, Jan 12, 2009 at 2:59 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Mon, 5 Jan 2009 15:39:07 -0800
> Ying Han <yinghan@google.com> wrote:
>
>> 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;
>
> I rewrote the chagnelog as below.  Please confirm that it makes sense?
>
>
> Subject: fs/exec.c: fix value of vma->vm_pgoff for the stack VMA of 32-bit processes
> From: Ying Han <yinghan@google.com>
>
> With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
> the [stack] VMA displays a 64-bit address:
>
> ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]
looks good.
>
> This is because vma->vm_pgoff for that VMA is incorrectly being stored in
> units of offset-in-bytes.  It should be stored in units of offset-in-pages.
that is not the problem. the real problem here is that the
vma->vm_pgoff is initialized as 64bit address. When
it is doing the shift_arg_pages, it supposed to be readjust to 32bit.
It did for newstart and newend, but still
used the old vma->start(64bit) for vma->pgoff. Here i make the change
to get the newpgoff based on the newstart.
> Signed-off-by: Ying Han <yinghan@google.com>
> Cc: Mike Waychison <mikew@google.com>
> Cc: Hugh Dickins <hugh@veritas.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
>  fs/exec.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff -puN fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes fs/exec.c
> --- a/fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes
> +++ a/fs/exec.c
> @@ -509,6 +509,7 @@ static int shift_arg_pages(struct vm_are
>        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);
> @@ -523,7 +524,7 @@ static int shift_arg_pages(struct vm_are
>        /*
>         * 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
> @@ -556,7 +557,7 @@ static int shift_arg_pages(struct vm_are
>        /*
>         * 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;
>  }
> _
>
>

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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-12 23:06     ` Ying Han
  0 siblings, 0 replies; 23+ messages in thread
From: Ying Han @ 2009-01-12 23:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linux-kernel, mikew, rohitseth

Thanks Andrew.

On Mon, Jan 12, 2009 at 2:59 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Mon, 5 Jan 2009 15:39:07 -0800
> Ying Han <yinghan@google.com> wrote:
>
>> 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;
>
> I rewrote the chagnelog as below.  Please confirm that it makes sense?
>
>
> Subject: fs/exec.c: fix value of vma->vm_pgoff for the stack VMA of 32-bit processes
> From: Ying Han <yinghan@google.com>
>
> With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
> the [stack] VMA displays a 64-bit address:
>
> ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]
looks good.
>
> This is because vma->vm_pgoff for that VMA is incorrectly being stored in
> units of offset-in-bytes.  It should be stored in units of offset-in-pages.
that is not the problem. the real problem here is that the
vma->vm_pgoff is initialized as 64bit address. When
it is doing the shift_arg_pages, it supposed to be readjust to 32bit.
It did for newstart and newend, but still
used the old vma->start(64bit) for vma->pgoff. Here i make the change
to get the newpgoff based on the newstart.
> Signed-off-by: Ying Han <yinghan@google.com>
> Cc: Mike Waychison <mikew@google.com>
> Cc: Hugh Dickins <hugh@veritas.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
>  fs/exec.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff -puN fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes fs/exec.c
> --- a/fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes
> +++ a/fs/exec.c
> @@ -509,6 +509,7 @@ static int shift_arg_pages(struct vm_are
>        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);
> @@ -523,7 +524,7 @@ static int shift_arg_pages(struct vm_are
>        /*
>         * 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
> @@ -556,7 +557,7 @@ static int shift_arg_pages(struct vm_are
>        /*
>         * 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	[flat|nested] 23+ messages in thread

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
  2009-01-12 23:05     ` Mike Waychison
@ 2009-01-12 23:10       ` Andrew Morton
  -1 siblings, 0 replies; 23+ messages in thread
From: Andrew Morton @ 2009-01-12 23:10 UTC (permalink / raw)
  To: Mike Waychison; +Cc: yinghan, linux-mm, linux-kernel, rohitseth

On Mon, 12 Jan 2009 15:05:51 -0800
Mike Waychison <mikew@google.com> wrote:

> > Subject: fs/exec.c: fix value of vma->vm_pgoff for the stack VMA of 32-bit processes
> > From: Ying Han <yinghan@google.com>
> > 
> > With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
> > the [stack] VMA displays a 64-bit address:
> > 
> > ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]
> > 
> > This is because vma->vm_pgoff for that VMA is incorrectly being stored in
> > units of offset-in-bytes.  It should be stored in units of offset-in-pages.
> > 
> 
> The problem is that the offset was stored without taking into account 
> the shift.

Sigh.  Is it efficient to have me sitting here reverse-engineering the
code, writing your changelog?



From: Ying Han <yinghan@google.com>

With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
the [stack] VMA displays a 64-bit address:

ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]

This is because vma->vm_pgoff for that VMA is not being updated for the
shift of the stack VMA.

Signed-off-by: Ying Han <yinghan@google.com>
Cc: Mike Waychison <mikew@google.com>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/exec.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes fs/exec.c
--- a/fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes
+++ a/fs/exec.c
@@ -509,6 +509,7 @@ static int shift_arg_pages(struct vm_are
 	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);
@@ -523,7 +524,7 @@ static int shift_arg_pages(struct vm_are
 	/*
 	 * 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
@@ -556,7 +557,7 @@ static int shift_arg_pages(struct vm_are
 	/*
 	 * 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;
 }
_


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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-12 23:10       ` Andrew Morton
  0 siblings, 0 replies; 23+ messages in thread
From: Andrew Morton @ 2009-01-12 23:10 UTC (permalink / raw)
  To: Mike Waychison; +Cc: yinghan, linux-mm, linux-kernel, rohitseth

On Mon, 12 Jan 2009 15:05:51 -0800
Mike Waychison <mikew@google.com> wrote:

> > Subject: fs/exec.c: fix value of vma->vm_pgoff for the stack VMA of 32-bit processes
> > From: Ying Han <yinghan@google.com>
> > 
> > With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
> > the [stack] VMA displays a 64-bit address:
> > 
> > ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]
> > 
> > This is because vma->vm_pgoff for that VMA is incorrectly being stored in
> > units of offset-in-bytes.  It should be stored in units of offset-in-pages.
> > 
> 
> The problem is that the offset was stored without taking into account 
> the shift.

Sigh.  Is it efficient to have me sitting here reverse-engineering the
code, writing your changelog?



From: Ying Han <yinghan@google.com>

With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
the [stack] VMA displays a 64-bit address:

ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]

This is because vma->vm_pgoff for that VMA is not being updated for the
shift of the stack VMA.

Signed-off-by: Ying Han <yinghan@google.com>
Cc: Mike Waychison <mikew@google.com>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/exec.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes fs/exec.c
--- a/fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes
+++ a/fs/exec.c
@@ -509,6 +509,7 @@ static int shift_arg_pages(struct vm_are
 	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);
@@ -523,7 +524,7 @@ static int shift_arg_pages(struct vm_are
 	/*
 	 * 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
@@ -556,7 +557,7 @@ static int shift_arg_pages(struct vm_are
 	/*
 	 * 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	[flat|nested] 23+ messages in thread

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
  2009-01-12 23:10       ` Andrew Morton
@ 2009-01-13 17:59         ` Hugh Dickins
  -1 siblings, 0 replies; 23+ messages in thread
From: Hugh Dickins @ 2009-01-13 17:59 UTC (permalink / raw)
  To: Andrew Morton
  Cc: KAMEZAWA Hiroyuki, Mike Waychison, yinghan, linux-mm,
	linux-kernel, rohitseth

On Mon, 12 Jan 2009, Andrew Morton wrote:
> On Mon, 12 Jan 2009 15:05:51 -0800
> Mike Waychison <mikew@google.com> wrote:
> 
> > > Subject: fs/exec.c: fix value of vma->vm_pgoff for the stack VMA of 32-bit processes
> > > From: Ying Han <yinghan@google.com>
> > > 
> > > With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
> > > the [stack] VMA displays a 64-bit address:
> > > 
> > > ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]
> > > 
> > > This is because vma->vm_pgoff for that VMA is incorrectly being stored in
> > > units of offset-in-bytes.  It should be stored in units of offset-in-pages.
> > > 
> > 
> > The problem is that the offset was stored without taking into account 
> > the shift.
> 
> Sigh.  Is it efficient to have me sitting here reverse-engineering the
> code, writing your changelog?
> 
> 
> 
> From: Ying Han <yinghan@google.com>
> 
> With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
> the [stack] VMA displays a 64-bit address:
> 
> ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]
> 
> This is because vma->vm_pgoff for that VMA is not being updated for the
> shift of the stack VMA.
> 
> Signed-off-by: Ying Han <yinghan@google.com>
> Cc: Mike Waychison <mikew@google.com>
> Cc: Hugh Dickins <hugh@veritas.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---

Sorry for all the waste of your time, but
I'm afraid this is entirely bogus, as Kamezawa-san has kindly
discovered for us (in: Re: mmotm 2009-01-12-16-53 uploaded thread).

The code was correct before, there was no shifting issue, and you
cannot muck around with the vm_pgoff of a vma like this patch does.
Thank Nick for the CONFIG_DEBUG_VM BUG_ON which warns that this
patch has inadvertently made these stack pages unreclaimable
(because their indexes no longer match up with vm_pgoff).

All there is here is a cosmetic issue: we're used to seeing 8-hex-
digit offsets in the /proc/pid/maps of a 32-bit process.  Though it
could perfectly well mmap() a large file from a very high offset and
show more hex digits there, couldn't it?

Because this 32-bit process has been started by a 64-bit kernel, it
started off working with the 64-bit stack position before moving into
place, and that happens to get reflected in the final vm_pgoff.

You prefer only to see 8-hex-digit offsets for anonymous vmas of 32-bit
processes?  If so, then perhaps Ying Han could supply a cosmetic patch
for /proc/pid/maps to mask off the upper bits in that case.

Hugh

> 
>  fs/exec.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff -puN fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes fs/exec.c
> --- a/fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes
> +++ a/fs/exec.c
> @@ -509,6 +509,7 @@ static int shift_arg_pages(struct vm_are
>  	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);
> @@ -523,7 +524,7 @@ static int shift_arg_pages(struct vm_are
>  	/*
>  	 * 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
> @@ -556,7 +557,7 @@ static int shift_arg_pages(struct vm_are
>  	/*
>  	 * 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;
>  }
> _

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

* Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
@ 2009-01-13 17:59         ` Hugh Dickins
  0 siblings, 0 replies; 23+ messages in thread
From: Hugh Dickins @ 2009-01-13 17:59 UTC (permalink / raw)
  To: Andrew Morton
  Cc: KAMEZAWA Hiroyuki, Mike Waychison, yinghan, linux-mm,
	linux-kernel, rohitseth

On Mon, 12 Jan 2009, Andrew Morton wrote:
> On Mon, 12 Jan 2009 15:05:51 -0800
> Mike Waychison <mikew@google.com> wrote:
> 
> > > Subject: fs/exec.c: fix value of vma->vm_pgoff for the stack VMA of 32-bit processes
> > > From: Ying Han <yinghan@google.com>
> > > 
> > > With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
> > > the [stack] VMA displays a 64-bit address:
> > > 
> > > ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]
> > > 
> > > This is because vma->vm_pgoff for that VMA is incorrectly being stored in
> > > units of offset-in-bytes.  It should be stored in units of offset-in-pages.
> > > 
> > 
> > The problem is that the offset was stored without taking into account 
> > the shift.
> 
> Sigh.  Is it efficient to have me sitting here reverse-engineering the
> code, writing your changelog?
> 
> 
> 
> From: Ying Han <yinghan@google.com>
> 
> With a 32 bit binary running on a 64 bit system, the /proc/pid/maps for
> the [stack] VMA displays a 64-bit address:
> 
> ff96c000-ff981000 rwxp 7ffffffea000 00:00 0 [stack]
> 
> This is because vma->vm_pgoff for that VMA is not being updated for the
> shift of the stack VMA.
> 
> Signed-off-by: Ying Han <yinghan@google.com>
> Cc: Mike Waychison <mikew@google.com>
> Cc: Hugh Dickins <hugh@veritas.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---

Sorry for all the waste of your time, but
I'm afraid this is entirely bogus, as Kamezawa-san has kindly
discovered for us (in: Re: mmotm 2009-01-12-16-53 uploaded thread).

The code was correct before, there was no shifting issue, and you
cannot muck around with the vm_pgoff of a vma like this patch does.
Thank Nick for the CONFIG_DEBUG_VM BUG_ON which warns that this
patch has inadvertently made these stack pages unreclaimable
(because their indexes no longer match up with vm_pgoff).

All there is here is a cosmetic issue: we're used to seeing 8-hex-
digit offsets in the /proc/pid/maps of a 32-bit process.  Though it
could perfectly well mmap() a large file from a very high offset and
show more hex digits there, couldn't it?

Because this 32-bit process has been started by a 64-bit kernel, it
started off working with the 64-bit stack position before moving into
place, and that happens to get reflected in the final vm_pgoff.

You prefer only to see 8-hex-digit offsets for anonymous vmas of 32-bit
processes?  If so, then perhaps Ying Han could supply a cosmetic patch
for /proc/pid/maps to mask off the upper bits in that case.

Hugh

> 
>  fs/exec.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff -puN fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes fs/exec.c
> --- a/fs/exec.c~fs-execc-fix-value-of-vma-vm_pgoff-for-the-stack-vma-of-32-bit-processes
> +++ a/fs/exec.c
> @@ -509,6 +509,7 @@ static int shift_arg_pages(struct vm_are
>  	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);
> @@ -523,7 +524,7 @@ static int shift_arg_pages(struct vm_are
>  	/*
>  	 * 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
> @@ -556,7 +557,7 @@ static int shift_arg_pages(struct vm_are
>  	/*
>  	 * 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	[flat|nested] 23+ messages in thread

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

Thread overview: 23+ 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-05 23:39 ` Ying Han
2009-01-09  2:40 ` Ying Han
2009-01-09  2:40   ` Ying Han
2009-01-09  2:40   ` Ying Han
2009-01-10  0:27   ` Ying Han
2009-01-10  0:27     ` Ying Han
2009-01-10  0:37     ` Andrew Morton
2009-01-10  0:37       ` Andrew Morton
2009-01-10  1:32       ` Ying Han
2009-01-10  1:32         ` Ying Han
2009-01-10  1:32         ` Ying Han
     [not found]   ` <604427e00901081840pa6dcc41u9a7a5c69302c7b60-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-01-10  0:27     ` Ying Han
2009-01-12 22:59 ` Andrew Morton
2009-01-12 22:59   ` Andrew Morton
2009-01-12 23:05   ` Mike Waychison
2009-01-12 23:05     ` Mike Waychison
2009-01-12 23:10     ` Andrew Morton
2009-01-12 23:10       ` Andrew Morton
2009-01-13 17:59       ` Hugh Dickins
2009-01-13 17:59         ` Hugh Dickins
2009-01-12 23:06   ` Ying Han
2009-01-12 23:06     ` Ying Han

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.