recvmsg bug

Thorsten Kukuk kukuk@weber-eb.uni-paderborn.de
Sat Aug 1 09:57:00 GMT 1998


On Sat, 01 Aug 1998, Zack Weinberg wrote:
>>No, you don't need to initialize the cmsghdr part.  You have one recvmsg, and
>>one sendmsg. The kernel only copies the data from the sendmsg call to the
>>recvmsg call and checks, if the data is valid (uid/gid/pid etc.).
>
>Ah.  In that case I think no wrapper can be correct in all cases.  The
>best we could do is blindly assume the user wants the new cmcred
>struct always, and they've provided enough space.  That will break
>programs compiled to glibc2.0 that used the kernel structure directly.

This programs will be break with linux 2.1.113 on plattforms, where 
__u32 != int, too.

>Maybe you could patch the kernel to know a new cmsghdr type, with the
>same semantics as the existing SCM_CREDENTIALS call but using the
>structure layout from glibc - members _and_ sizes.  Then we can throw
>away the recvmsg wrapper and just initialize the buffer in the sendmsg
>wrapper.  That'd also open the way for a proper BSD-compatible
>SCM_CREDS in kernel 2.3.

I think this is the only usefull option. I don't see another glibc solution, to
handle all the different cases. And this would fix my problems with
euid/uid in the RPC code.

  Thorsten
--
Thorsten Kukuk  kukuk@vt.uni-paderborn.de
                http://www-vt.uni-paderborn.de/~kukuk
Linux is like a Vorlon.  It is incredibly powerful, gives terse,
cryptic answers and has a lot of things going on in the background.



More information about the Libc-hacker mailing list