From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Markus Triska Newsgroups: gmane.emacs.devel Subject: Re: Using the GNU GMP Library for Bignums in Emacs Date: Sat, 21 Apr 2018 18:46:07 +0200 Message-ID: <87k1t05wz4.fsf@metalevel.at> References: <29f933ac-a6bf-8742-66a7-0a9d6d3e5a88@disroot.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1524329065 14741 195.159.176.226 (21 Apr 2018 16:44:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 21 Apr 2018 16:44:25 +0000 (UTC) User-Agent: Emacs/24.5 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 21 18:44:21 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f9vca-0003iY-Vz for ged-emacs-devel@m.gmane.org; Sat, 21 Apr 2018 18:44:21 +0200 Original-Received: from localhost ([::1]:57457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9vef-0005TJ-QR for ged-emacs-devel@m.gmane.org; Sat, 21 Apr 2018 12:46:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9veX-0005SA-OG for emacs-devel@gnu.org; Sat, 21 Apr 2018 12:46:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f9veT-0007SS-B4 for emacs-devel@gnu.org; Sat, 21 Apr 2018 12:46:21 -0400 Original-Received: from [195.159.176.226] (port=52943 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f9veT-0007Rj-2J for emacs-devel@gnu.org; Sat, 21 Apr 2018 12:46:17 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1f9vcJ-0003UP-GD for emacs-devel@gnu.org; Sat, 21 Apr 2018 18:44:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 26 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:GHNim9teCYss/Wg1eAonJRADIhM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:224770 Archived-At: "Siraphob (Ben) Phipathananunth" writes: > The benefits of linking GNU GMP are clear. It would make it easier to > extend the math capabilities of Emacs, while making it faster and less > error-prone. However, the downsides, if any exist, should be discussed > as well, to gauge whether pursuing such a task would be fruitful. Using GMP has a significant downside if you run out of memory: There’s currently no defined way for the allocation functions to recover from an error such as out of memory, they must *terminate* program execution. Please see the following page for details: https://gmplib.org/manual/Custom-Allocation.html Thus, situtations where you can currently throw an Emacs error that can be handled in user code would instead terminate the Emacs process. This can for example arise from malicious input that involves very large integers as results (7^7^7^7 etc.), and of course also elsewhere. Also, it may become hard to stop long GMP calculations, whereas you can easily stop computations that are written in Elisp. Thus, long GMP calculations may lead to denial of editing attacks. All the best, Markus