From: "Jan Beulich" <jbeulich@novell.com>
To: "Ingo Molnar" <mingo@elte.hu>
Cc: "Andreas Kleen" <ak@suse.de>, <linux-kernel@vger.kernel.org>,
<discuss@x86-64.org>
Subject: Re: [PATCH 2/3] reliable stack trace support (x86-64)
Date: Tue, 16 May 2006 18:04:28 +0200 [thread overview]
Message-ID: <446A142C.76E4.0078.0@novell.com> (raw)
In-Reply-To: <20060516150918.GC10760@elte.hu>
>>> Ingo Molnar <mingo@elte.hu> 16.05.06 17:09 >>>
>* Jan Beulich <jbeulich@novell.com> wrote:
>> +#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.
If that's important...
>> +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?
You noted the comment, didn't you. This really should use user_mode(), but it can't as the unwind annotations don't
cover selector registers. Hence the initial CS/SS will always remain in place no matter how many unwinds you do.
But it's harmless for this function to return 'kernel mode' when in fact it might be user mode - nothing would crash
because of that, it might only lead to ill trailing entries on a stack dump.
Jan
next prev parent reply other threads:[~2006-05-16 16:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-16 14:21 [PATCH 2/3] reliable stack trace support (x86-64) Jan Beulich
2006-05-16 15:09 ` Ingo Molnar
2006-05-16 16:04 ` Jan Beulich [this message]
2006-05-16 15:13 ` Andi Kleen
2006-05-16 16:06 ` Jan Beulich
2006-05-16 17:05 ` [discuss] " Andi Kleen
2006-05-18 9:37 ` Jan Beulich
2006-05-18 10:20 ` Andi Kleen
2006-05-18 12:02 ` Jan Beulich
2006-05-18 12:25 ` Andi Kleen
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=446A142C.76E4.0078.0@novell.com \
--to=jbeulich@novell.com \
--cc=ak@suse.de \
--cc=discuss@x86-64.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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.