lkml.org 
[lkml]   [2012]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86, 32-bit: Fix invalid stack address while in softirq
On 09/06/2012 11:54 PM, Steven Rostedt wrote:
> On Thu, 2012-09-06 at 17:36 +0200, Robert Richter wrote:
>
>> I meant:
>>
>> unsigned long kernel_stack_pointer(struct pt_regs *regs)
>> {
>> unsigned long context = (unsigned long)regs& ~(THREAD_SIZE - 1);
>> unsigned long sp = (unsigned long)&regs->sp;
>> struct thread_info *tinfo;
>>
>> if (context == (sp& ~(THREAD_SIZE - 1)))
>> return sp;
>>
>> tinfo = (struct thread_info *)context;
>> if (tinfo->previous_esp)
>> return tinfo->previous_esp;
>>
>> return (unsigned long)regs;
>> }
>>
>> -Robert
>>
>>> Maybe this is even better.
>>>
>>>
Stevent & Robert,

Actually, we also can revert the following commit:

commit 7b6c6c77732ca1d2498eda7eabb64f9648896e96
Author: Masami Hiramatsu <mhiramat@redhat.com>
Date: Mon May 11 17:03:00 2009 -0400

x86, 32-bit: fix kernel_trap_sp()

Use &regs->sp instead of regs for getting the top of stack in
kernel mode.
(on x86-64, regs->sp always points the top of stack)


I meant:

static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
{
#ifdef CONFIG_X86_32
return (unsigned long)regs;
#else
return regs->sp;
#endif
}


What do you think of it?

Thanks
Wei

> Yeah, this is probably the safest.
>
> Thanks,
>
> -- Steve
>
>
>



\
 
 \ /
  Last update: 2012-09-07 08:02    [W:0.156 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site