Re: [PATCH] KVM: SVM: Fix sparse: incorrect type in argument 1 (different base types)

From: Al Viro
Date: Wed Feb 21 2018 - 15:18:47 EST


On Wed, Feb 21, 2018 at 01:59:55PM -0600, Brijesh Singh wrote:

> Sure, checking access_ok() does not guarantee that later
> copy_from_user() will not fail. But it does eliminate one possible
> reason for the failure. We are trying to validate most of the user
> inputs before we invoke  SEV command.

That makes no sense whatsoever. If user is deliberately fuzzing
your code or trying to DoS it, that "validation" doesn't buy you
anything - they can just as well feed you NULL, after all.

What is the rationale for that? "Userland is accidentally feeding
us garbage pointers" is the case where slowness is the least of your
concerns...