Re: [PATCH] update fix X86_64 procfs provide stack information for threads

From: Andi Kleen
Date: Wed Nov 04 2009 - 06:17:58 EST


Stefani Seibold <stefani@xxxxxxxxxxx> writes:
>
> +#ifdef CONFIG_IA32_EMULATION
> +unsigned long KSTK_ESP(struct task_struct *task)
> +{
> + return (test_tsk_thread_flag(task, TIF_IA32)) ? \
> + (task_pt_regs(task)->sp) : \
> + ((task)->thread.usersp);

Usersp is only set for system calls, but not when the process is blocked
in a interrupt.

In general if you really want a reliable implementation of this
you would really need to stop the task and grab the stack pointer;
otherwise it can be arbitarily outdated anyways.

-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/