[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1257684666.20579.9.camel@wall-e>
Date: Sun, 08 Nov 2009 13:51:06 +0100
From: Stefani Seibold <stefani@...bold.net>
To: Ingo Molnar <mingo@...e.hu>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"H. Peter Anvin" <hpa@...or.com>,
Americo Wang <xiyou.wangcong@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Andi Kleen <andi@...stfloor.org>
Subject: Re: [PATCH] RFC x86_64 more accurate KSTK_ESP implementation
Am Sonntag, den 08.11.2009, 12:35 +0100 schrieb Ingo Molnar:
> * Stefani Seibold <stefani@...bold.net> wrote:
>
> > +
> > + if (((stkp < stk) || (stkp >= stk + THREAD_SIZE))
> > + && regs->ip < PAGE_OFFSET)
> > + percpu_write(old_rsp, stkp);
> > +}
>
> that check for regs->ip looks imprecise - why dont you use the
> user_mode_vm()?
>
> It's true that the value itself is statistical, but still we dont want
> to leak a kernel-space regs->sp reason - it's an information leak.
>
Good idea. Much better ;-)
> > --- linux-2.6.32-rc5.old/arch/x86/kernel/irq_64.c 2009-10-16 02:41:50.000000000 +0200
> > +++ linux-2.6.32-rc5.new/arch/x86/kernel/irq_64.c 2009-11-04 22:29:55.762951577 +0100
> > @@ -53,6 +53,7 @@
> > struct irq_desc *desc;
> >
> > stack_overflow_check(regs);
> > + update_usersp(regs);
> >
> >
> > desc = irq_to_desc(irq);
> > if (unlikely(!desc))
> > --- linux-2.6.32-rc5.old/arch/x86/kernel/apic/apic.c 2009-10-16 02:41:50.000000000 +0200
> > +++ linux-2.6.32-rc5.new/arch/x86/kernel/apic/apic.c 2009-11-04 23:12:32.805086991 +0100
> > @@ -831,6 +831,9 @@
> > {
> > struct pt_regs *old_regs = set_irq_regs(regs);
> >
> > +#ifndef CONFIG_X86_32
> > + update_usersp(regs);
> > +#endif
>
> Cleanliness: please eliminate this #ifdef by defining update_usersp() on
> 32-bit as well, as an empty inline function.
>
> But, i dont like this patch because it adds overhead to the IRQ
> fastpath.
>
Agree, but i saw no other way.
> I'd suggest a competely different method: why dont you use an IPI to
> sample the SP whenever someone wants to read it from /proc and we see
> that the task is running on a CPU right now?
>
Sounds like a challenge, i like the idea. I will have a look on it...
Stefani
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists