From: Andrew Morton <akpm@linux-foundation.org>
To: Mike Waychison <mikew@google.com>
Cc: yinghan@google.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, rohitseth@google.com
Subject: Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
Date: Mon, 12 Jan 2009 15:10:29 -0800 [thread overview]
Message-ID: <20090112151029.9e810ade.akpm@linux-foundation.org> (raw)
In-Reply-To: <496BCCCF.70202@google.com>
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;
}
_
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Mike Waychison <mikew@google.com>
Cc: yinghan@google.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, rohitseth@google.com
Subject: Re: [PATCH]Fix: 32bit binary has 64bit address of stack vma
Date: Mon, 12 Jan 2009 15:10:29 -0800 [thread overview]
Message-ID: <20090112151029.9e810ade.akpm@linux-foundation.org> (raw)
In-Reply-To: <496BCCCF.70202@google.com>
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>
next prev parent reply other threads:[~2009-01-12 23:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-05 23:39 [PATCH]Fix: 32bit binary has 64bit address of stack vma Ying Han
2009-01-05 23:39 ` Ying Han
[not found] ` <604427e00901051539x52ab85bcua94cd8036e5b619a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-01-09 2:40 ` Ying Han
2009-01-09 2:40 ` Ying Han
2009-01-09 2:40 ` Ying Han
[not found] ` <604427e00901081840pa6dcc41u9a7a5c69302c7b60-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-01-10 0:27 ` 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
[not found] ` <20090109163725.11294fb1.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2009-01-10 1:32 ` Ying Han
2009-01-10 1:32 ` Ying Han
2009-01-10 1:32 ` 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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090112151029.9e810ade.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mikew@google.com \
--cc=rohitseth@google.com \
--cc=yinghan@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.