Re: [PATCH 2/2] x86: Only do a single page fault for copy_from_user_nmi

From: Andi Kleen
Date: Fri Oct 03 2014 - 19:25:44 EST


> There are cleaner ways to solve this problem - PeterZ offered
> one, but there are other options as well, such as:
>
> - removing exact-bytes semantics explicitly from almost all
> cases and offering a separate (and more expensive, in the
> faulting case) memcpy variant for write() and other code that
> absolutely must know the number of copied bytes.

That would be a full tree audit of thousands of calls.
And any mistake would be a security hole.

> - or adding a special no-bytes-copied memcpy variant that the
> NMI code could use.

That's the duplicated copy path I mentioned. If people really want that
I can implement it, although I personally think it's ugly and bloated
over engineering for this case.

> It might be more work for you, but it gives us a cleaner and more
> maintainable kernel. The problem is that you should know this
> general principle already, instead you are wasting maintainer
> bandwidth via arguing in favor of ugly hacks again and again...

The duplicated path is unlikely to be more maintainable
than the simple and obvious check.

-Andi
--
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/