GNU bug report logs - #46916
28.0.50; pure_alloc(10424, ...) fails badly when pure space is exhausted

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Pip Cet <pipcet@HIDDEN>; dated Thu, 4 Mar 2021 12:26:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Mar 2021 12:25:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 04 07:25:03 2021
Received: from localhost ([127.0.0.1]:58009 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lHn2N-000559-Dj
	for submit <at> debbugs.gnu.org; Thu, 04 Mar 2021 07:25:03 -0500
Received: from lists.gnu.org ([209.51.188.17]:37226)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pipcet@HIDDEN>) id 1lHn2L-00054o-LW
 for submit <at> debbugs.gnu.org; Thu, 04 Mar 2021 07:25:01 -0500
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 <pipcet@HIDDEN>) id 1lHn2L-0000HW-GQ
 for bug-gnu-emacs@HIDDEN; Thu, 04 Mar 2021 07:25:01 -0500
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 <pipcet@HIDDEN>) id 1lHn2J-0001P9-Oc
 for bug-gnu-emacs@HIDDEN; Thu, 04 Mar 2021 07:25:01 -0500
Received: by mail-ot1-x336.google.com with SMTP id h22so27038408otr.6
 for <bug-gnu-emacs@HIDDEN>; 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)
MIME-Version: 1.0
From: Pip Cet <pipcet@HIDDEN>
Date: Thu, 4 Mar 2021 12:24:21 +0000
Message-ID: <CAOqdjBeZBCGMF5w6Q6CY8CX31tPWJWEM1Od+-f_2bAmsmjZu_A@HIDDEN>
Subject: 28.0.50;
 pure_alloc(10424, ...) fails badly when pure space is exhausted
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=2607:f8b0:4864:20::336;
 envelope-from=pipcet@HIDDEN; 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-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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.




Acknowledgement sent to Pip Cet <pipcet@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#46916; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 4 Mar 2021 12:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.