This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] network: Fix cmsghdr padding in sendmsg (BZ#16919)

On 26 May 2016 11:37, Adhemerval Zanella wrote:
> This patch fixes the remaining issue in sendmsg POSIX compliance by
> adjusting the cmsghdr padding accordingly for 64-bits ABIs.  Since
> function contract does not allow to modify it in place, a temporary
> buffer instead.  Although the value used is arbitrary (current 2048
> bytes), it is expected to cover mostly common usar cases for this
> facility (passing file descriptors and permission between processes).
> I did not send this change on previous patches because I would like
> some feedback about buffer size used in copy operations.

i think it should do a length test -- if it's below a threshold, use
alloca, otherwise fall back to malloc+free.  inserting our own limit
here feels wrong.

i guess scanning the reserved fields ahead of time to see if they
are already zero isn't great either ?  if people allocated the mem
using calloc, then it's already zeroed ...

> +  struct cmsghdr auxcbuf[CMSGHDR_CONTROLLEN_MAX/sizeof(struct cmsghdr)+1];

style: missing spaces

> +	       c = CMSG_NXTHDR(&hdr, c))

style: missing space before (

Attachment: signature.asc
Description: Digital signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]