From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Olivier Dion Newsgroups: gmane.lisp.guile.devel Subject: Re: madvise failed: Invalid argument Date: Mon, 12 Aug 2024 23:21:08 -0400 Message-ID: <87wmklqfa3.fsf@laura> References: <87sev9b2pl.fsf@lease-up.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25380"; mail-complaints-to="usenet@ciao.gmane.io" To: Felix Lechner , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Tue Aug 13 05:21:50 2024 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sdi6Y-0006Wh-5D for guile-devel@m.gmane-mx.org; Tue, 13 Aug 2024 05:21:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdi69-0007p5-Tx; Mon, 12 Aug 2024 23:21:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdi66-0007oL-RH for guile-devel@gnu.org; Mon, 12 Aug 2024 23:21:23 -0400 Original-Received: from smtp.polymtl.ca ([132.207.4.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdi61-0006Kd-3G for guile-devel@gnu.org; Mon, 12 Aug 2024 23:21:22 -0400 Original-Received: from localhost ([209.209.33.88]) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 47D3L9OV128790; Mon, 12 Aug 2024 23:21:13 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 47D3L9OV128790 In-Reply-To: <87sev9b2pl.fsf@lease-up.com> X-Poly-FromMTA: ([209.209.33.88]) at Tue, 13 Aug 2024 03:21:09 +0000 Received-SPF: pass client-ip=132.207.4.11; envelope-from=olivier.dion@polymtl.ca; helo=smtp.polymtl.ca X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22665 Archived-At: On Mon, 12 Aug 2024, Felix Lechner via "Developers list for Guile, the GNU extensibility library" 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