lkml.org 
[lkml]   [2006]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] reliable stack trace support (x86-64)
* Jan Beulich <jbeulich@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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-16 17:12    [from the cache]
©2003-2011 Jasper Spaans