[PATCH] setipv4sourcefilter: Avoid using alloca.

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Thu May 25 12:20:19 GMT 2023



On 25/05/23 08:57, Siddhesh Poyarekar wrote:
> On 2023-05-25 07:27, Florian Weimer wrote:
>> * Adhemerval Zanella Netto:
>>
>>> On 25/05/23 04:33, Florian Weimer via Libc-alpha wrote:
>>>> * Siddhesh Poyarekar:
>>>>
>>>>> scratch_buffer_free will also likely tamper with errno (it calls free
>>>>> after all) so it might make sense to save/restore errno here.  In fact
>>>>> I wonder if it makes sense to have scratch_buffer_free do that so that
>>>>> it's always safe to use it without worrying about errno.
>>>>
>>>> We need to change free not to clobber errno.  Mainly this requires
>>>> protecting munmap and mprotect calls.  It's a QoI issue.
>>>>
>>>> Thanks,
>>>> Florian
>>>
>>> We already save/restore errno on free since 69fda43b8dd795c.  We can optimize
>>> it a bit by adding munmap/mprotect that calls INTERNAL_SYSCALL_CALL, but I
>>> am not sure if the complexity will really be worth here.
>>
>> Ah, right, then scratch_buffer_free should be okay, too.
> 
> I guess, but should we still stick to preserving errno to account for lack of errno preservation in non-glibc malloc implementations?

I don't think it is worth, this requirement will be in the next POSIX [1] and 
it also means that we will need to propagate this assumption on all internal
glibc code (which is only boilerplate code in the end).

[1] https://www.austingroupbugs.net/view.php?id=385


More information about the Libc-alpha mailing list