Re: Floating point usage inside kernel

From: Andy Lutomirski
Date: Sun Nov 27 2011 - 23:06:07 EST


On 11/25/2011 08:16 AM, Nuno Santos wrote:
> Hi Jiri,
>
> Thanks for your reply.
>
> The algorithm is a matrix transform computation to make a affine a
> geometric transform.
>
> Basicly it is based on the following functions:
>
> http://pastebin.com/YHzYuLPU
>
> Curiously I ran a test before writing this email and guest what.... is
> working!! :)
>
> But now that I have opened this question here I should ask... is it safe?

[...]

> I'm not protecting the call to the function with kernel_fpu_begin and
> kernel_fpu_end

It's not safe even if you do protect it with kernel_fpu_begin. On
x86-64, a userspace process that mucks with MXCSR can trivially cause
you to oops even if you use kernel_fpu_begin. (I'm pretty sure x86-32
has a similar issue, and I imagine that other architectures have related
issues.) This might change someday, but there are exactly zero use
cases outside staging, so don't hold your breath.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/