On Mon, 12 Aug 2024, Felix Lechner via "Developers list for Guile, the GNU 
extensibility library" <guile-devel@gnu.org> wrote:
> Hi,
[...]

> The warning probably originates here:
>
>     ret = madvise ((void *) lo, hi - lo, MADV_DONTNEED); [4]
>
> From my reading, that call is meant to return stack space back to the
> operating system.  According to the madvise(2) manual page [5] the
> variable 'lo' must be page-aligned, but apparently isn't.
>
> Why would the 'stack_bottom' not be page aligned, please?  Could it be
> mitigated by alignment instructions in my ELF shared object?

The argument passed to `madvise(2)' is page aligned correcly.  See the
round down with `lo &= ~(page_size - 1U); /* round down */' just above
the call.

The following is possible for EINVAL to be returned:

 1) hi - lo < page_size
 2) lenght = hi - lo; lo + lenght < lo => Unsigned integer overflow
 3) The memory range is locked.  See mlock(2)
 4) The variable `page_size' is zero for some reason (highly doubt)

You can check for all of the above with a debugger or `strace(1)'
easily.

Regards,
Olivier
-- 
Olivier Dion
oldiob.ca

  • madvise failed: I... Developers list for Guile, the GNU extensibility library
    • Re: madvise ... Olivier Dion

Reply via email to