From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#46916: 28.0.50; pure_alloc(10424, ...) fails badly when pure space is exhausted Date: Thu, 4 Mar 2021 12:24:21 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4279"; mail-complaints-to="usenet@ciao.gmane.io" To: 46916@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 04 13:26:28 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lHn3k-0000xu-73 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Mar 2021 13:26:28 +0100 Original-Received: from localhost ([::1]:35670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHn3j-0000S7-48 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Mar 2021 07:26:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHn3K-0000Rx-KV for bug-gnu-emacs@gnu.org; Thu, 04 Mar 2021 07:26:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46470) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lHn3K-0001yo-Bj for bug-gnu-emacs@gnu.org; Thu, 04 Mar 2021 07:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lHn3K-000576-8z for bug-gnu-emacs@gnu.org; Thu, 04 Mar 2021 07:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Mar 2021 12:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46916 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161486070319544 (code B ref -1); Thu, 04 Mar 2021 12:26:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Mar 2021 12:25:03 +0000 Original-Received: from localhost ([127.0.0.1]:58009 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lHn2N-000559-Dj for submit@debbugs.gnu.org; Thu, 04 Mar 2021 07:25:03 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:37226) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lHn2L-00054o-LW for submit@debbugs.gnu.org; Thu, 04 Mar 2021 07:25:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHn2L-0000HW-GQ for bug-gnu-emacs@gnu.org; Thu, 04 Mar 2021 07:25:01 -0500 Original-Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]:39835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lHn2J-0001P9-Oc for bug-gnu-emacs@gnu.org; Thu, 04 Mar 2021 07:25:01 -0500 Original-Received: by mail-ot1-x336.google.com with SMTP id h22so27038408otr.6 for ; Thu, 04 Mar 2021 04:24:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=an2v5fzjI2UUys9vVF+hQmuSMFlG4RuVITdY3X+hiHg=; b=BEnO9kk7eZInkzlyRcI5dQhHFszzOrTzW+E+ZzM9zB+mQxI/NuIG/NINzVPxSodn4Y hg8ngP93bpfjzWBayefaDCyb0rf11pfgptgMfpJcYDkADaCMfz+/0kA4dppTJhVIaVLD VLulx6P606C2wQRRyEfKMY3xhkJMCzzOhWuAUBNiw0Fx/d+RO00txjrWBR5PwT/VsWLU oNOriW+5oyu81Y4OPuKBg6Gd5jyHYwvj49iqT18Gioalmo51EjH+1LKYchsQngvLkYhN RvcdhtVmjKYNUUmDtByR48FefTqyiNoosLDsn4e9YIj13vDRyyiKX9Tw8czqmntkYApg MKSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=an2v5fzjI2UUys9vVF+hQmuSMFlG4RuVITdY3X+hiHg=; b=oiGB1wBl+BTk3u0vDRr9XEximjCVR1PjTt1HmtZi3H7CiGFDA8gUQcobVb1V/m0dmW WSx77sx1P6oHAeECIMisfm7/8GPy9z/9Fjr8xYdOUk5wOt+cuZM5jJnAwfc5iXPr9FqU 56eak1l9f/qin9izhlUKKMPh0TUFfim5pItdWJ3+M3cFTwkH7JFWZYVJ7U7rHXTKkzlA dLPQJD+mvn1h9iCnDhJYyiXqmEniZRP3oZNudUN5WzcexWehEfqESoBwesk4hsPFcbT2 Pgh935/PUKIMoQVxpTTEq+n2dMvV2I400xDOz2RwaUn7EBgq87DOy61vSOd5y+v6db4g Cjdw== X-Gm-Message-State: AOAM533/zuwLNLUrAr8DAPu1NOMkGY0eipSN/z2aoWeisKjNwJY0pon+ vWBsKtR6aSChzKhAk2Uz01LO6xl0dDw3dVrQpvHL1rhSJIY= X-Google-Smtp-Source: ABdhPJxC1UrntV7OxZdTLaEhvRhIhpzfROCyWHmXdXqaE8TJrJ7uagDH3hSBDJYHrEw3Z5G42X+0afclXARlgkjjmwo= X-Received: by 2002:a05:6830:1e51:: with SMTP id e17mr3254957otj.292.1614860698238; Thu, 04 Mar 2021 04:24:58 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=pipcet@gmail.com; helo=mail-ot1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:201381 Archived-At: Pure space should be removed. But until it is, it shouldn't exhaust all virtual memory, crashing the machines of the unwary ones who tried to build emacs without a ulimit... The problem I ran into was that the native-comp branch calls Fpurecopy on comp_u->data_vec. In my case, pure space was already exhausted and data_vec had 1302 elements. That caused purecopy() to call pure_alloc with a size argument of 10424. pure_alloc allocated another 10000 bytes of fake pure space, found out those weren't enough, so it allocated another 10000 bytes of fake pure space, which weren't enough, etc., until the process started swapping. I'm not sure who's the culprit here: the native-comp branch tries to purecopy a large vector, which is a problem; purecopy() saw that request and passed it on to pure_alloc(), rather than returning the impure vector because it was too large. And pure_alloc() certainly should fail more gracefully than it did (there's an eassert() to prevent this situation, but that should be unconditionally compiled instead). I was going to write a message to emacs-devel (I'd started before hitting this bug) proposing to remove pure-space now, but I think it's fair to have a separate bug report if we decide to keep pure space after all.