* accessing stack of non-current task
@ 2010-04-20 12:38 Uma shankar
2010-04-20 13:43 ` Johannes Weiner
0 siblings, 1 reply; 4+ messages in thread
From: Uma shankar @ 2010-04-20 12:38 UTC (permalink / raw)
To: linux-mm
Hi,
Is it possible for the kernel to access the user-stack data of a
task different from "current" ? ( This is needed for stack-dump as
well as backtrace. )
I thought the answer is "no". ( Kernel sees memory through the
page-table of "current" )
But I found few places in kernel where this is done. ( eg:
debug_rt_mutex_print_deadlock() in rtmutex-debug.c )
What is the explanation ?
thanks
shankar
--
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] 4+ messages in thread
* Re: accessing stack of non-current task
2010-04-20 12:38 accessing stack of non-current task Uma shankar
@ 2010-04-20 13:43 ` Johannes Weiner
2010-04-20 14:00 ` Uma shankar
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Weiner @ 2010-04-20 13:43 UTC (permalink / raw)
To: Uma shankar; +Cc: linux-mm
On Tue, Apr 20, 2010 at 06:08:14PM +0530, Uma shankar wrote:
> Hi,
>
> Is it possible for the kernel to access the user-stack data of a
> task different from "current" ? ( This is needed for stack-dump as
> well as backtrace. )
Yes, have a look at __get_user_pages() in mm/memory.c.
> I thought the answer is "no". ( Kernel sees memory through the
> page-table of "current" )
That is correct when using virtual addresses and letting the MMU
do the page table lookup in the currently active page tables.
But if you have the task_struct of another process, you can easily
get to its vmas and page tables (task->mm) and walk them in software.
--
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] 4+ messages in thread
* Re: accessing stack of non-current task
2010-04-20 13:43 ` Johannes Weiner
@ 2010-04-20 14:00 ` Uma shankar
2010-04-20 17:16 ` Johannes Weiner
0 siblings, 1 reply; 4+ messages in thread
From: Uma shankar @ 2010-04-20 14:00 UTC (permalink / raw)
To: Johannes Weiner; +Cc: linux-mm
On Tue, Apr 20, 2010 at 7:13 PM, Johannes Weiner <hannes@cmpxchg.org> wrote:
> On Tue, Apr 20, 2010 at 06:08:14PM +0530, Uma shankar wrote:
>> Hi,
>>
>> Is it possible for the kernel to access the user-stack data of a
>> task different from "current" ? ( This is needed for stack-dump as
>> well as backtrace. )
>
> Yes, have a look at __get_user_pages() in mm/memory.c.
>
Yes, I understand this.
But have a look at "void show_stack(struct task_struct *tsk,
unsigned long *sp) " in traps.c ( arch specific ).
Is there a implicit assumption that "tsk" and "current" are threads
sharing same "mm_strct" ?
--
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] 4+ messages in thread
* Re: accessing stack of non-current task
2010-04-20 14:00 ` Uma shankar
@ 2010-04-20 17:16 ` Johannes Weiner
0 siblings, 0 replies; 4+ messages in thread
From: Johannes Weiner @ 2010-04-20 17:16 UTC (permalink / raw)
To: Uma shankar; +Cc: linux-mm
On Tue, Apr 20, 2010 at 07:30:15PM +0530, Uma shankar wrote:
> On Tue, Apr 20, 2010 at 7:13 PM, Johannes Weiner <hannes@cmpxchg.org> wrote:
> > On Tue, Apr 20, 2010 at 06:08:14PM +0530, Uma shankar wrote:
> >> Hi,
> >>
> >> Is it possible for the kernel to access the user-stack data of a
> >> task different from "current" ? ( This is needed for stack-dump as
> >> well as backtrace. )
> >
> > Yes, have a look at __get_user_pages() in mm/memory.c.
> >
>
> Yes, I understand this.
>
> But have a look at "void show_stack(struct task_struct *tsk,
> unsigned long *sp) " in traps.c ( arch specific ).
>
> Is there a implicit assumption that "tsk" and "current" are threads
> sharing same "mm_strct" ?
No, this is dumping the _kernel stack_ of a process, not the user stack.
The mm_struct does not matter.
--
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] 4+ messages in thread
end of thread, other threads:[~2010-04-20 17:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-20 12:38 accessing stack of non-current task Uma shankar
2010-04-20 13:43 ` Johannes Weiner
2010-04-20 14:00 ` Uma shankar
2010-04-20 17:16 ` Johannes Weiner
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).