[PATCH 2/3] reliable stack trace support (x86-64)

Ingo Molnar mingo at elte.hu
Tue May 16 17:09:18 CEST 2006


* Jan Beulich <jbeulich at novell.com> wrote:

> These are the x86_64-specific pieces to enable reliable stack traces. The
> only restriction with this is that it currently cannot unwind across the
> interrupt->normal stack boundary, as that transition is lacking proper
> annotation.

> +#define UNW_PC(frame) (frame)->regs.rip
> +#define UNW_SP(frame) (frame)->regs.rsp
> +#ifdef CONFIG_FRAME_POINTER
> +#define UNW_FP(frame) (frame)->regs.rbp
> +#define FRAME_RETADDR_OFFSET 8
> +#define FRAME_LINK_OFFSET 0
> +#define STACK_BOTTOM(tsk) (((tsk)->thread.rsp0 - 1) & ~(THREAD_SIZE - 1))
> +#define STACK_TOP(tsk) ((tsk)->thread.rsp0)
> +#endif

style: align the defines.

> +static inline int
> +arch_unw_user_mode(const struct unwind_frame_info *info)
> +{
> +#if 0 /* This can only work when selector register saves/restores
> +         are properly annotated (and tracked in UNW_REGISTER_INFO). */
> +	return user_mode(&info->regs);
> +#else
> +	return (long)info->regs.rip >= 0;
> +#endif
> +}

is this safe? Cannot userspace provide (long)rip < 0 by jumping to it?

	Ingo



More information about the discuss mailing list