All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jan Beulich <jbeulich@novell.com>
Cc: Andreas Kleen <ak@suse.de>,
	linux-kernel@vger.kernel.org, discuss@x86-64.org
Subject: Re: [PATCH 3/3] reliable stack trace support (i386)
Date: Tue, 16 May 2006 17:14:22 +0200	[thread overview]
Message-ID: <20060516151422.GD10760@elte.hu> (raw)
In-Reply-To: <4469FC41.76E4.0078.0@novell.com>


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

> These are the i386-specific pieces to enable reliable stack traces. This is
> going to be even more useful once CFI annotations get added to he assembly
> code, namely to entry.S (a patch for that had been submitted several times).

> +#define UNW_PC(frame) (frame)->regs.eip
> +#define UNW_SP(frame) (frame)->regs.esp
> +#ifdef CONFIG_FRAME_POINTER
> +#define UNW_FP(frame) (frame)->regs.ebp
> +#define FRAME_RETADDR_OFFSET 4
> +#define FRAME_LINK_OFFSET 0
> +#define STACK_BOTTOM(tsk) (((tsk)->thread.esp0 - 1) & ~(THREAD_SIZE - 1))
> +#define STACK_TOP(tsk) ((tsk)->thread.esp0)
> +#endif

style: i'd suggest to improve readability by aligning these.

> +static inline void
> +arch_unw_init_blocked(struct unwind_frame_info *info)
> +{
> +	memset(&info->regs, 0, sizeof(info->regs));
> +	info->regs.eip = info->task->thread.eip;
> +	info->regs.xcs = __KERNEL_CS;
> +	__get_user(info->regs.ebp, (long *)info->task->thread.esp);
> +	info->regs.esp = info->task->thread.esp;
> +	info->regs.xss = __KERNEL_DS;
> +	info->regs.xds = __USER_DS;
> +	info->regs.xes = __USER_DS;

hm, arent you using this from within show_trace()? In that case we 
shouldnt do a __get_user() i think, we might be in an arbitrary context 
...

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

same here as for x86_64: is this condition safe? Userspace can provoke 
an EIP of >= PAGE_OFFSET by for example jumping to the vsyscall page.

	Ingo

  reply	other threads:[~2006-05-16 15:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-16 14:22 [PATCH 3/3] reliable stack trace support (i386) Jan Beulich
2006-05-16 15:14 ` Ingo Molnar [this message]
2006-05-16 15:20   ` [discuss] " Andi Kleen
2006-05-16 15:15 ` Andi Kleen
2006-05-16 16:07   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060516151422.GD10760@elte.hu \
    --to=mingo@elte.hu \
    --cc=ak@suse.de \
    --cc=discuss@x86-64.org \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.