[PATCH] libc_fatal: Get rid of alloca

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Thu Aug 31 14:25:56 GMT 2023



On 31/08/23 11:04, Joe Simmons-Talbott via Libc-alpha wrote:
> On Thu, Aug 31, 2023 at 04:00:34PM +0200, Andreas Schwab wrote:
>> On Aug 31 2023, Joe Simmons-Talbott wrote:
>>
>>> I guess an option would be to use a fixed sized array with a judiciously
>>> selected size to store the structs.  I think this would work since there
>>> are not a lot of calls to __libc_message and none with more than a few
>>> '%s'.  Thoughts?
>>
>> How does that differ from using alloca?
> 
> I guess it really doesn't other than avoiding possible stack overflow
> which seems unlikely.
> 
> Thanks,
> Joe
> 

Maybe a better option would to evaluate each '%s' and call multiple writes
instead of one single writev.  You can maybe add support for %d, so we can
simplify __libc_assert_fail to be tail call to __libc_message.


More information about the Libc-alpha mailing list