:: Re: [DNG] Nasty Linux systemd secur…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Didier Kryn
Fecha:  
A: dng
Asunto: Re: [DNG] Nasty Linux systemd security bug revealed
Le 30/07/2021 à 15:24, Enrico Weigelt, metux IT consult a écrit :
> On 21.07.21 14:36, Didier Kryn wrote:
>
>>      I want to add to the comments that this alloca() function has been
>> added (by gcc ?) to work around a missing feature of the C language:
>> dynamic allocation on the stack.
>
> What you *actually* want is not "on stack" (directly), but automatically
> freed when leaving the function scope - doing it by moving SP is just an
> specific implementation. But actually a problematic one that needs great
> caution: you usually don't know how much free stack you actually have.



    The principle of stack allocation, when possible is a very efficient
use of the memory and cpu: it is fast and requires no calculation. This
stack is not necessarily "the stack of automatic variables"; any array
can be managed as a stack by a custom allocator. This one, as you say is
convenient because automatically reclaimed on return.

--     Didier