On Fri, Oct 24, 2014 at 10:42:03PM +0700, Robert Elz wrote:
> Date: Fri, 24 Oct 2014 13:19:01 +0000
> From: Emmanuel Dreyfus <[email protected]>
> Message-ID: <[email protected]>
>
> | It happens in kcopy, an assembly language routine, in which I do not
> | see how we can get EINVAL returned.
>
> Yes, knew that (you can look back at the old thread on tech-kern,
> from mid August, subject "EINVAL from copyin/out - how?" to see as
> much as was worked out then (which was not much).
oops... sorry, somehow I didn't notice that thread.
> I have been expecting that the EINVAL comes from a fault, so far I have
> no idea what might be causing it.
the caller of uvm_fault() will arrange for kcopy(), copyin(), etc, to return
the error returned from uvm_fault(), which is probably coming from
VOP_GETPAGES() of the vnode you're trying to access with ubc_uiomove().
on i386 this is in trap() at the "copyfault" label:
copyfault:
frame->tf_eip = (uintptr_t)onfault;
frame->tf_eax = error;
if a read() or write() fails in VOP_GETPAGES() eg. with EIO, this is how
we return that errno back to the application.
I don't think all platforms have equivalent code to pass back the error
yet though, as I recall some still always return EFAULT.
-Chuck