bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack frame in execl_ is larger than allocated area on 64-bit


From: Jan Nieuwenhuizen
Subject: Re: Stack frame in execl_ is larger than allocated area on 64-bit
Date: Sat, 08 May 2021 10:59:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

W. J. van der Laan writes:

Hello,

> I just noticed, by accident, that on 64-bit platforms the following array:
>
>     char *c_argv[1000];
>
> as defined in execl_ in src/posix.c is 8000 bytes, this is more than
> the 4260 bytes of stack frame allocated for every function in
> function-locals.

Oops.

> I think the fix is to change the 4 multiplier in x86_64:function-locals and 
> riscv64:function-locals to 8?:
> ----------------------------------------------------------
> (define (x86_64:function-locals . rest)
>   `(
>     ("sub____$i32,%rsp" (#:immediate ,(+ (* 4 1025) (* 20 8))))
>     )) ; 4*1024 buf, 20 local vars
> ----------------------------------------------------------

Yes...ugh.  This was me cutting corners, or framed more positively:
avoiding complex/dynamic code by doing the simplest thing...

> As well as maybe detecting and throwing an error when this happens.

Yeah...also, it would be nice to make this stack allocation dynamic.

Greetings,
Janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]