* [PATCH] hide guard page for stacks that grow upwards
@ 2010-08-24 22:03 ` Luck, Tony
0 siblings, 0 replies; 4+ messages in thread
From: Luck, Tony @ 2010-08-24 22:03 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-parisc, linux-ia64
pa-risc and ia64 have stacks that grow upwards. Don't
show the guard page on upward growing vma in /proc/$$/maps
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
This looks useful too ... but I can't see where the code is that
made vm_start be PAGE_SIZE lower to begin with. I'd expect to have
to make a matching change to make vm_end PAGE_SIZE higher for the
VM_GROWSUP areas.
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 439fc1f..ef262f6 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -210,7 +210,7 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
int flags = vma->vm_flags;
unsigned long ino = 0;
unsigned long long pgoff = 0;
- unsigned long start;
+ unsigned long start, end;
dev_t dev = 0;
int len;
@@ -223,12 +223,15 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
/* We don't show the stack guard page in /proc/maps */
start = vma->vm_start;
+ end = vma->vm_end;
if (vma->vm_flags & VM_GROWSDOWN)
start += PAGE_SIZE;
+ if (vma->vm_flags & VM_GROWSUP)
+ end -= PAGE_SIZE;
seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
start,
- vma->vm_end,
+ end,
flags & VM_READ ? 'r' : '-',
flags & VM_WRITE ? 'w' : '-',
flags & VM_EXEC ? 'x' : '-',
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] hide guard page for stacks that grow upwards
@ 2010-08-24 22:03 ` Luck, Tony
0 siblings, 0 replies; 4+ messages in thread
From: Luck, Tony @ 2010-08-24 22:03 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-parisc, linux-ia64
pa-risc and ia64 have stacks that grow upwards. Don't
show the guard page on upward growing vma in /proc/$$/maps
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
This looks useful too ... but I can't see where the code is that
made vm_start be PAGE_SIZE lower to begin with. I'd expect to have
to make a matching change to make vm_end PAGE_SIZE higher for the
VM_GROWSUP areas.
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 439fc1f..ef262f6 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -210,7 +210,7 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
int flags = vma->vm_flags;
unsigned long ino = 0;
unsigned long long pgoff = 0;
- unsigned long start;
+ unsigned long start, end;
dev_t dev = 0;
int len;
@@ -223,12 +223,15 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
/* We don't show the stack guard page in /proc/maps */
start = vma->vm_start;
+ end = vma->vm_end;
if (vma->vm_flags & VM_GROWSDOWN)
start += PAGE_SIZE;
+ if (vma->vm_flags & VM_GROWSUP)
+ end -= PAGE_SIZE;
seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
start,
- vma->vm_end,
+ end,
flags & VM_READ ? 'r' : '-',
flags & VM_WRITE ? 'w' : '-',
flags & VM_EXEC ? 'x' : '-',
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] hide guard page for stacks that grow upwards
2010-08-24 22:03 ` Luck, Tony
@ 2010-08-24 22:23 ` Linus Torvalds
-1 siblings, 0 replies; 4+ messages in thread
From: Linus Torvalds @ 2010-08-24 22:23 UTC (permalink / raw)
To: Luck, Tony; +Cc: linux-kernel, linux-parisc, linux-ia64
On Tue, Aug 24, 2010 at 3:03 PM, Luck, Tony <tony.luck@intel.com> wrote:
>
> This looks useful too ... but I can't see where the code is that
> made vm_start be PAGE_SIZE lower to begin with. I'd expect to have
> to make a matching change to make vm_end PAGE_SIZE higher for the
> VM_GROWSUP areas.
That's the fault path - the very check_stack_guard_page() logic itself.
In other words, nowhere do we _explicitly_ make the stack larger by
one page, but nowhere do we explicitly size the stack in the first
place! The stack grows by being populated, and every time a new page
is populated, check_stack_guard_page() will have expanded the stack
vma by one extra page.
Linus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hide guard page for stacks that grow upwards
@ 2010-08-24 22:23 ` Linus Torvalds
0 siblings, 0 replies; 4+ messages in thread
From: Linus Torvalds @ 2010-08-24 22:23 UTC (permalink / raw)
To: Luck, Tony; +Cc: linux-kernel, linux-parisc, linux-ia64
On Tue, Aug 24, 2010 at 3:03 PM, Luck, Tony <tony.luck@intel.com> wrote:
>
> This looks useful too ... but I can't see where the code is that
> made vm_start be PAGE_SIZE lower to begin with. I'd expect to have
> to make a matching change to make vm_end PAGE_SIZE higher for the
> VM_GROWSUP areas.
That's the fault path - the very check_stack_guard_page() logic itself.
In other words, nowhere do we _explicitly_ make the stack larger by
one page, but nowhere do we explicitly size the stack in the first
place! The stack grows by being populated, and every time a new page
is populated, check_stack_guard_page() will have expanded the stack
vma by one extra page.
Linus
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-24 22:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-24 22:03 [PATCH] hide guard page for stacks that grow upwards Luck, Tony
2010-08-24 22:03 ` Luck, Tony
2010-08-24 22:23 ` Linus Torvalds
2010-08-24 22:23 ` Linus Torvalds
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.