From: Jun Sun <jsun@junsun.net>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: fpu_emulator can lose fpu on get_user/put_user
Date: Wed, 6 Oct 2004 15:09:36 -0700 [thread overview]
Message-ID: <20041006220936.GA21135@gateway.junsun.net> (raw)
In-Reply-To: <20041006.101920.126571873.nemoto@toshiba-tops.co.jp>
On Wed, Oct 06, 2004 at 10:19:20AM +0900, Atsushi Nemoto wrote:
> I found a potential problem in math emulation. The math-emu uses
> put_user/get_user to fetch the instruction or to emulate load/store
> fp-regs. The put_user/get_user can sleep then we can lose fpu
> ownership on it. It it happened, subsequent restore_fp will cause CpU
> exception which not allowed in kernel.
>
> Here is a quick fix. Can be applied bath 2.4 and 2.6. Could you apply?
>
I don't feel good about this patch. If emulator loses FPU ownership it should
get it back, not the caller of emulator.
Jun
> --- linux-mips/arch/mips/kernel/traps.c Sat Aug 14 19:55:20 2004
> +++ linux/arch/mips/kernel/traps.c Wed Oct 6 09:50:26 2004
> @@ -509,6 +509,10 @@
> /* Run the emulator */
> sig = fpu_emulator_cop1Handler (0, regs,
> ¤t->thread.fpu.soft);
> + if (!is_fpu_owner()) {
> + /* We might lose fpu in fpu_emulator. */
> + own_fpu();
> + }
>
> /*
> * We can't allow the emulated instruction to leave any of
>
>
> Also, there is another problem in the math-emu. While math-emu is not
> reentrant, it will not work properly if a process lose ownership in
> the math-emu and another process uses the math-emu. One possible fix
> is to save/restore ieee754_csr on get_user/put_user. I will post a
> patch later.
>
> ---
> Atsushi Nemoto
next prev parent reply other threads:[~2004-10-06 22:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-06 1:19 fpu_emulator can lose fpu on get_user/put_user Atsushi Nemoto
2004-10-06 9:40 ` Atsushi Nemoto
2004-10-06 22:09 ` Jun Sun [this message]
2004-10-07 1:15 ` Atsushi Nemoto
2004-10-08 19:45 ` Jun Sun
2004-10-09 14:38 ` Atsushi Nemoto
2004-10-11 16:54 ` Jun Sun
2004-10-12 10:11 ` Atsushi Nemoto
2006-11-15 15:17 ` [PATCH] rewrite restore_fp_context/save_fp_context Atsushi Nemoto
2006-11-18 14:27 ` Atsushi Nemoto
2006-11-19 13:54 ` Atsushi Nemoto
2004-10-24 15:36 ` fpu_emulator can lose fpu on get_user/put_user Atsushi Nemoto
2004-10-07 6:20 ` Atsushi Nemoto
-- strict thread matches above, loose matches on Subject: below --
2006-02-07 16:52 [PATCH] rewrite restore_fp_context/save_fp_context Atsushi Nemoto
2006-04-11 9:54 ` Atsushi Nemoto
2006-06-19 15:37 ` Atsushi Nemoto
2006-08-29 13:56 ` Atsushi Nemoto
2006-11-14 17:46 ` Ralf Baechle
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=20041006220936.GA21135@gateway.junsun.net \
--to=jsun@junsun.net \
--cc=anemo@mba.ocn.ne.jp \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox