[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <525308C4.1030007@nec-labs.com>
Date: Mon, 7 Oct 2013 15:17:24 -0400
From: Steve Rago <sar@...-labs.com>
To: David Miller <davem@...emloft.net>
CC: <luto@...capital.net>, <netdev@...r.kernel.org>,
<mtk.manpages@...il.com>, <ebiederm@...ssion.com>
Subject: Re: bug in passing file descriptors
On 10/07/2013 03:12 PM, David Miller wrote:
> From: Steve Rago <sar@...-labs.com>
> Date: Mon, 7 Oct 2013 15:06:02 -0400
>
>> Maybe. So a client expecting to receive x bytes of control
>> information should make sure their buffer is at least CMSG_SPACE(x)
>> bytes long instead of CMSG_LEN(x) bytes long, because you feel
>> compelled to copy the final padding from kernel space to user space?
>> Seems wrong to me. IMHO, the final padding should only come into play
>> when calculating where the next header should begin.
>
> Yes, all control messages must be aligned to, and be of a length of a
> multiple of, "sizeof(long)".
>
> This is the only correct way to program control messages.
>
Except when sizeof(long) can change and you need to maintain binary compatibility with older applications. x86 comes to
mind as a relevant example: used to be 32 bits, but is 64 now.
Steve
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists