All of lore.kernel.org
 help / color / mirror / Atom feed
* userspace stack start and end
@ 2014-07-27 16:52 Xin Tong
  2014-07-28  3:32 ` anupam kapoor
  2014-08-01 16:22 ` Peter Teoh
  0 siblings, 2 replies; 7+ messages in thread
From: Xin Tong @ 2014-07-27 16:52 UTC (permalink / raw)
  To: kernelnewbies

I am trying to find the start and end address of the userspace stack. I see
in the task_struct there is start_stack. But I could not find end_start
anywhere in the kernel code ?

Can someone please tell me how to find the end of the stack ?

Thanks,
Xin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140727/37754afe/attachment.html 

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

* userspace stack start and end
  2014-07-27 16:52 userspace stack start and end Xin Tong
@ 2014-07-28  3:32 ` anupam kapoor
  2014-07-28  3:35   ` Xin Tong
  2014-08-01 16:22 ` Peter Teoh
  1 sibling, 1 reply; 7+ messages in thread
From: anupam kapoor @ 2014-07-28  3:32 UTC (permalink / raw)
  To: kernelnewbies

>>>>> [Sun, 27 Jul 2014 11:52:27 -0500]: "Xin Tong" (xin-tong):

,----[ xin-tong ]
| I am trying to find the start and end address of the userspace stack.
| I see in the task_struct there is start_stack. But I could not find
| end_start anywhere in the kernel code ?
| 
| Can someone please tell me how to find the end of the stack ?
`----
but that should be computable right e.g.
    user:stack-end = user:stack-start + user:stack-segment-size * number-of-pages

kind regards
anupam

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

* userspace stack start and end
  2014-07-28  3:32 ` anupam kapoor
@ 2014-07-28  3:35   ` Xin Tong
  2014-07-28  3:51     ` anupam kapoor
  0 siblings, 1 reply; 7+ messages in thread
From: Xin Tong @ 2014-07-28  3:35 UTC (permalink / raw)
  To: kernelnewbies

where is user:stack-segment-size defined ?
Thanks,
Xin


On Sun, Jul 27, 2014 at 10:32 PM, anupam kapoor <anupam.kapoor@gmail.com>
wrote:

> >>>>> [Sun, 27 Jul 2014 11:52:27 -0500]: "Xin Tong" (xin-tong):
>
> ,----[ xin-tong ]
> | I am trying to find the start and end address of the userspace stack.
> | I see in the task_struct there is start_stack. But I could not find
> | end_start anywhere in the kernel code ?
> |
> | Can someone please tell me how to find the end of the stack ?
> `----
> but that should be computable right e.g.
>     user:stack-end = user:stack-start + user:stack-segment-size *
> number-of-pages
>
> kind regards
> anupam
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140727/e4b24fab/attachment.html 

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

* userspace stack start and end
  2014-07-28  3:35   ` Xin Tong
@ 2014-07-28  3:51     ` anupam kapoor
  2014-07-29  0:44       ` Xin Tong
  0 siblings, 1 reply; 7+ messages in thread
From: anupam kapoor @ 2014-07-28  3:51 UTC (permalink / raw)
  To: kernelnewbies

>>>>> [Sun, 27 Jul 2014 22:35:22 -0500]: "Xin Tong" (xin-tong):

,----[ xin-tong ]
| where is user:stack-segment-size defined ? 
`----
that is computable once again :) (assuming x86, and 1+3 split)
  user:stack-segment-size = ((unsigned long)(0xc0000000 - user:start-stack)) >> PAGE_SHIFT

kind regards
anupam

    
,----[ anupam ]
| ,----[ xin-tong ]
| | I am trying to find the start and end address of the userspace
| stack.
| | I see in the task_struct there is start_stack. But I could not
| find
| | end_start anywhere in the kernel code ?
| |
| | Can someone please tell me how to find the end of the stack ?
| 
| `----
| but that should be computable right e.g.
| user:stack-end = user:stack-start + user:stack-segment-size *
| number-of-pages
`----

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

* userspace stack start and end
  2014-07-28  3:51     ` anupam kapoor
@ 2014-07-29  0:44       ` Xin Tong
  0 siblings, 0 replies; 7+ messages in thread
From: Xin Tong @ 2014-07-29  0:44 UTC (permalink / raw)
  To: kernelnewbies

so the stack  always starts at 0xc0000000 on x86 32bit and stack-start is
pointing to the smaller address of stack ie growing downwards
xin
On Sunday, July 27, 2014, anupam kapoor <anupam.kapoor@gmail.com> wrote:

> >>>>> [Sun, 27 Jul 2014 22:35:22 -0500]: "Xin Tong" (xin-tong):
>
> ,----[ xin-tong ]
> | where is user:stack-segment-size defined ?
> `----
> that is computable once again :) (assuming x86, and 1+3 split)
>   user:stack-segment-size = ((unsigned long)(0xc0000000 -
> user:start-stack)) >> PAGE_SHIFT
>
> kind regards
> anupam
>
>
> ,----[ anupam ]
> | ,----[ xin-tong ]
> | | I am trying to find the start and end address of the userspace
> | stack.
> | | I see in the task_struct there is start_stack. But I could not
> | find
> | | end_start anywhere in the kernel code ?
> | |
> | | Can someone please tell me how to find the end of the stack ?
> |
> | `----
> | but that should be computable right e.g.
> | user:stack-end = user:stack-start + user:stack-segment-size *
> | number-of-pages
> `----
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140728/cb09c0a3/attachment.html 

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

* userspace stack start and end
  2014-07-27 16:52 userspace stack start and end Xin Tong
  2014-07-28  3:32 ` anupam kapoor
@ 2014-08-01 16:22 ` Peter Teoh
  2014-08-01 16:31   ` Peter Teoh
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Teoh @ 2014-08-01 16:22 UTC (permalink / raw)
  To: kernelnewbies

FYI, there are many different types of kernel stack:

http://www.x86-64.org/pipermail/discuss/2005-April/005944.html


On Mon, Jul 28, 2014 at 12:52 AM, Xin Tong <trent.tong@gmail.com> wrote:

> I am trying to find the start and end address of the userspace stack. I
> see in the task_struct there is start_stack. But I could not find end_start
> anywhere in the kernel code ?
>
> Can someone please tell me how to find the end of the stack ?
>
> Thanks,
> Xin
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>


-- 
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140802/ab3e59c0/attachment.html 

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

* userspace stack start and end
  2014-08-01 16:22 ` Peter Teoh
@ 2014-08-01 16:31   ` Peter Teoh
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Teoh @ 2014-08-01 16:31 UTC (permalink / raw)
  To: kernelnewbies

and look into the function "print_context_stack()" which will teach u how
to identify the start/end of stack, whether the address is valid, how to
traverse from one frame to another (using RBP / EBP of course, so CONFIG
for framepointer is definitely needed).


On Sat, Aug 2, 2014 at 12:22 AM, Peter Teoh <htmldeveloper@gmail.com> wrote:

> FYI, there are many different types of kernel stack:
>
> http://www.x86-64.org/pipermail/discuss/2005-April/005944.html
>
>
> On Mon, Jul 28, 2014 at 12:52 AM, Xin Tong <trent.tong@gmail.com> wrote:
>
>> I am trying to find the start and end address of the userspace stack. I
>> see in the task_struct there is start_stack. But I could not find end_start
>> anywhere in the kernel code ?
>>
>> Can someone please tell me how to find the end of the stack ?
>>
>> Thanks,
>> Xin
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>
>
> --
> Regards,
> Peter Teoh
>



-- 
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140802/7546b092/attachment.html 

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

end of thread, other threads:[~2014-08-01 16:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-27 16:52 userspace stack start and end Xin Tong
2014-07-28  3:32 ` anupam kapoor
2014-07-28  3:35   ` Xin Tong
2014-07-28  3:51     ` anupam kapoor
2014-07-29  0:44       ` Xin Tong
2014-08-01 16:22 ` Peter Teoh
2014-08-01 16:31   ` Peter Teoh

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.