[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150309140712.GB12732@pd.tnic>
Date: Mon, 9 Mar 2015 15:07:12 +0100
From: Borislav Petkov <bp@...e.de>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Dave Hansen <dave.hansen@...el.com>,
Ingo Molnar <mingo@...nel.org>,
Andy Lutomirski <luto@...capital.net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Pekka Riikonen <priikone@....fi>,
Rik van Riel <riel@...hat.com>,
Suresh Siddha <sbsiddha@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
"Yu, Fenghua" <fenghua.yu@...el.com>,
Quentin Casasnovas <quentin.casasnovas@...cle.com>
Subject: Re: [PATCH 1/1] x86/fpu: x86/fpu: avoid math_state_restore() without
used_math() in __restore_xstate_sig()
On Sat, Mar 07, 2015 at 04:38:44PM +0100, Oleg Nesterov wrote:
> math_state_restore() assumes it is called with irqs disabled, but
> this is not true if the caller is __restore_xstate_sig().
>
> This means that if ia32_fxstate == T and __copy_from_user() fails
> __restore_xstate_sig() returns with irqs disabled too. This trgiggers
>
> BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:41
> [<ffffffff81381499>] dump_stack+0x59/0xa0
> [<ffffffff8106bd05>] ___might_sleep+0x105/0x110
> [<ffffffff8138786d>] ? _raw_spin_unlock_irqrestore+0x3d/0x70
> [<ffffffff8106bd8d>] __might_sleep+0x7d/0xb0
> [<ffffffff81385426>] down_read+0x26/0xa0
> [<ffffffff8138788a>] ? _raw_spin_unlock_irqrestore+0x5a/0x70
> [<ffffffff81136038>] print_vma_addr+0x58/0x130
> [<ffffffff8100239e>] signal_fault+0xbe/0xf0
> [<ffffffff810419aa>] sys32_rt_sigreturn+0xba/0xd0
>
> Change __restore_xstate_sig() to call set_used_math() unconditionally,
> this avoids sti/cli in math_state_restore(). If copy_from_user() fails
> we can simply do fpu_finit() by hand.
>
> Note: this is only the first step. math_state_restore() should not check
> used_math(), it should set this flag. While init_fpu() should simply die.
>
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
> Cc: <stable@...r.kernel.org>
Makes sense to me. I guess we should wait for Dave to test first though...
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
--
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