[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140929152646.GC1629@tassilo.jf.intel.com>
Date: Mon, 29 Sep 2014 08:26:46 -0700
From: Andi Kleen <ak@...ux.intel.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Andi Kleen <andi@...stfloor.org>, dave@...1.net,
linux-kernel@...r.kernel.org, mingo@...nel.org, eranian@...gle.com,
x86@...nel.org, torvalds@...ux-foundation.org,
Vitaly Mayatskikh <v.mayatskih@...il.com>
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@...ux.intel.com -- Speaking for myself only
--
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