unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Olivier Dion <olivier.dion@polymtl.ca>
To: Felix Lechner <felix.lechner@lease-up.com>, guile-devel@gnu.org
Subject: Re: madvise failed: Invalid argument
Date: Mon, 12 Aug 2024 23:21:08 -0400	[thread overview]
Message-ID: <87wmklqfa3.fsf@laura> (raw)
In-Reply-To: <87sev9b2pl.fsf@lease-up.com>

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



      reply	other threads:[~2024-08-13  3:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13  2:01 madvise failed: Invalid argument Felix Lechner via Developers list for Guile, the GNU extensibility library
2024-08-13  3:21 ` Olivier Dion [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmklqfa3.fsf@laura \
    --to=olivier.dion@polymtl.ca \
    --cc=felix.lechner@lease-up.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).