[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMzpN2hG3N5RguPb6uj=Eau8Kdo8492L9L6k9s3921S2-XDQAg@mail.gmail.com>
Date: Mon, 23 May 2016 07:14:14 -0400
From: Brian Gerst <brgerst@...il.com>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Andy Lutomirski <luto@...capital.net>,
Thomas Gleixner <tglx@...utronix.de>,
Denys Vlasenko <dvlasenk@...hat.com>,
Ingo Molnar <mingo@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Borislav Petkov <bp@...e.de>, "H. Peter Anvin" <hpa@...or.com>,
X86 ML <x86@...nel.org>
Subject: Re: [PATCH 3/4] x86: Rewrite switch_to() code
On Sun, May 22, 2016 at 10:34 PM, Josh Poimboeuf <jpoimboe@...hat.com> wrote:
> On Sun, May 22, 2016 at 10:59:38AM -0700, Andy Lutomirski wrote:
>> cc: Josh Poimboeuf: do you care about the exact stack layout of the
>> bottom of the stack of an inactive task?
>
> So there's one minor issue with this patch, relating to unwinding the
> stack of a newly forked task. For detecting reliable stacks, the
> unwinder needs to unwind all the way to the syscall pt_regs to make sure
> the stack is sane. But for newly forked tasks, that won't be possible
> here because the unwinding will stop at the fork_frame instead.
>
> So from an unwinder standpoint it might be nice for copy_thread_tls() to
> place a frame pointer on the stack next to the ret_from_fork return
> address, so that it would resemble an actual stack frame. The frame
> pointer could probably just be hard-coded to zero. And then the first
> bp in fork_frame would need to be a pointer to it instead of zero. That
> would make it nicely resemble the stack of any other task.
>
> Alternatively I could teach the unwinder that if the unwinding starts at
> the fork_frame offset from the end of the stack page, and the saved rbp
> is zero, it can assume that it's a newly forked task. But that seems a
> little more brittle to me, as it requires the unwinder to understand
> more of the internal workings of the fork code.
>
> But overall I think this patch is a really nice cleanup, and other than
> the above minor issue it should be fine with my reliable unwinder, since
> rbp is still at the top of the stack.
Ok, how about if it pushed RBP first, then we teach get_wchan() to add
the fixed offset from thread.sp to get bp? that way it don't have to
push it twice.
--
Brian Gerst
Powered by blists - more mailing lists