passing access rights

Chris Torek chris at mimsy.UUCP
Sun Oct 23 01:34:29 AEST 1988


In article <705 at tub.UUCP> net at tub.UUCP (Oliver Laumann) writes:
>...  Although the demonstration program attached
>to this article works fine under Integrated Solutions 4.3 BSD
>and SunOS 4.0, the calls to `sendmsg' and `recvmsg' both
>return "Bad address" under vanilla 4.3 BSD on a Microvax.
>I can't find the bug; all fields of the message structures
>passed to `sendmsg' and `recvmsg' are properly initialized.
>Unfortunately, the manual entries for these system calls
>do not indicate under what circumstances EFAULT is returned.

As it turns out, the problem is that copyin() may not do what was
intended if it is given a zero length.  In this case, it still probes
one page.  You can get the program to work by giving the address of
some object as `msg.msg_iov': msg.msg_iovlen can still be zero, but
msg.msg_iov must point to something.

Probably copyin() and copyout() should return zero (no error) when
asked to copy no bytes (as should bcopy()), and useracc and kernacc
should grant access to no bytes; then a number of tests for zero
lengths could be dropped elsewhere.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list