[PATCH] network: Fix cmsghdr padding in sendmsg (BZ#16919)
Adhemerval Zanella
adhemerval.zanella@linaro.org
Thu May 26 19:43:00 GMT 2016
On 26/05/2016 13:27, Joseph Myers wrote:
> On Thu, 26 May 2016, Mike Frysinger wrote:
>
>> 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.
>
> sendmsg is required by POSIX to be AS-safe, so can't use malloc+free; it
> would have to allocate memory in some other AS-safe way.
And I think introducing AS-safe allocation here adds a lot of complexity
and performance issues (even using mmap or pool buffer in some way).
I do fell it might be wrong to add an arbitrary limit here, however the
usage of control buffer in these syscalls is quite limited and passing
large buffers is unusual. Also ENOMEM just instruct to use that it should
either send multiple messages or rework de application, which I fell it is
a tradeoff to implement the standard compliance fix.
More information about the Libc-alpha
mailing list