Messages in this thread | | | Date | Mon, 29 Sep 2014 08:26:46 -0700 | From | Andi Kleen <> | Subject | Re: [PATCH 2/2] x86: Only do a single page fault for copy_from_user_nmi |
| |
> For now, changing the semantics of the function seems like a sure way to > fail in the future though.
I doubt it. Nearly nobody uses the exact return value semantics.
(iirc it's mostly write() and some bizarre code in mount)
In fact it's a regular mistake to assume it returns -errno.
> > In theory we could also duplicate the whole copy_*_ path for cases > > where the caller doesn't care about the exact bytes. But that > > seems overkill for just this issue, and I'm not sure anyone > > else cares about how fast this is. The simpler check works > > as well for now. > > So I don't get that code, but why not fix it in general? Taking two > faults seems silly.
It's really complicated to reconstruct the exact bytes, as an optimized memcpy is very complicated and has a lot of corner cases.
I tried it originally when writing the original copy function, but failed. That is why people came up later with this two-fault scheme.
I think two fault is fine for most cases, just not for NMIs.
-Andi
-- ak@linux.intel.com -- Speaking for myself only
| |