[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Kernel or userland bug: file descript passing in Postfix
NetBSD's kernel was fixed in June of last year to accept the correct
use of the interface for receiving file descriptors, which is:
1. Userland must provide a buffer with CMSG_SPACE(n * (sizeof(int)))
bytes in msg.msg_control, to receive n file descriptors.
2. Userland must store this size in msg.msg_controllen.
3. From the CMSG_DATA of the cmsghdr, userland must read an array of
file descriptors of no more than CMSG_LEN(n * (sizeof(int))) bytes.
The fix committed in revision 1.2 of unix_recv_fd.c is correct.
Formerly, Postfix would allocate a buffer of sufficient size and then
report a potentially smaller size, computed by CMSG_LEN rather than
CMSG_SPACE, to the kernel, which is not only wrong but doesn't make
much sense either -- why allocate a buffer of CMSG_SPACE bytes and say
there are only CMSG_LEN bytes available? Please do submit the patch
Main Index |
Thread Index |