From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#26961: 26.0.50; Possible timming issue in regex-tests.el Date: Fri, 19 May 2017 20:38:40 +0900 Message-ID: <87shk113gf.fsf@calancha-pc> References: <87inkz23aw.fsf@calancha-pc> <878tlvy4d4.fsf@calancha-pc> <83bmqr5trb.fsf@gnu.org> <874lwi3b00.fsf@calancha-pc> <83ziea4358.fsf@gnu.org> <87h90hwmip.fsf@calancha-pc> <837f1d48uc.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1495194064 3904 195.159.176.226 (19 May 2017 11:41:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 19 May 2017 11:41:04 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 26961@debbugs.gnu.org, schwab@suse.de, tino.calancha@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 19 13:40:59 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1dBgHD-0000rz-7u for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 May 2017 13:40:59 +0200 Original-Received: from localhost ([::1]:58037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBgHI-0004lL-Qm for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 May 2017 07:41:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBgFO-0003Aa-Q2 for bug-gnu-emacs@gnu.org; Fri, 19 May 2017 07:39:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBgFL-0007YK-KN for bug-gnu-emacs@gnu.org; Fri, 19 May 2017 07:39:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51794) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dBgFL-0007YF-GR for bug-gnu-emacs@gnu.org; Fri, 19 May 2017 07:39:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dBgFL-0005p2-A7 for bug-gnu-emacs@gnu.org; Fri, 19 May 2017 07:39:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 May 2017 11:39:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26961 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26961-submit@debbugs.gnu.org id=B26961.149519394222363 (code B ref 26961); Fri, 19 May 2017 11:39:03 +0000 Original-Received: (at 26961) by debbugs.gnu.org; 19 May 2017 11:39:02 +0000 Original-Received: from localhost ([127.0.0.1]:54468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBgFJ-0005oZ-RB for submit@debbugs.gnu.org; Fri, 19 May 2017 07:39:02 -0400 Original-Received: from mail-pg0-f65.google.com ([74.125.83.65]:32981) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBgFH-0005oI-Mt for 26961@debbugs.gnu.org; Fri, 19 May 2017 07:39:00 -0400 Original-Received: by mail-pg0-f65.google.com with SMTP id s62so9540610pgc.0 for <26961@debbugs.gnu.org>; Fri, 19 May 2017 04:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=FmD2PnSKp5TnSvNx4fwqmdsMeSr/JI622urhmONWseA=; b=UgJj86Un5aOk8uUjiSvgZw1QZZFiDVyFQv1t9a23z3Dapr3/qASo+7Acw3Wz+sT5zR YyN6rHVHcWpVAukkTukRQooSNgyQSvy6YUfNw92thyABc0ozFEZtA9UA3qxI6dcGyh2f N0KnsgLvelir8JWSa7ZielAzpmurDCXRGO68ZV75eH49K9Xi9zZbl26mQuDu4/5YzQrB VN6g57iV3eJWq1R2zzRT9lEprQ7QiGHPJv+gLvxQ9uiS11NLpRxwWyFY1UEhXWuEAQgS yHlqAyjypfD6ZlPbwKfRA3Y99jTWJNr7fn0W1dor6q57n9mZxJAeoZlB/m8zDiKFMoc1 y5hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=FmD2PnSKp5TnSvNx4fwqmdsMeSr/JI622urhmONWseA=; b=f+fejUjfXlxvEX5IsGQ5eAA6i6U5y09wu2bPCFSFW563SLuY4TfukAW6oEDZ+5QGNW KhawrnX5fnVS+8bommuPgUMy/y2I2YiDyTW5DdqI/bfkEFpdK1uBeLk4fnBAklIC32v3 CokogaLCpANYnH5EOmFBWc6yGksmxU3qdH0h2kvtPldtqcqG2THOrZeITdx4Gz1t+vEK EA8Rm+fl4YBMVcgwBsuO37XeyXMMV8zlM9I0h0x682kEX0DpMYY0qVuGEFCovevHiW4x uUw4+bP8rzsT2YahrTprR8hbNg15Fqs4NZTLaR0gZPXk1lXPNeolrVJVvMPbW7wumXNT z+Uw== X-Gm-Message-State: AODbwcD49eTZqemTeIzxsGEKisMsclbYX+nB4ZrjpXUnFcgNEsvuxhpZ d+gzoI8SQzE/5A== X-Received: by 10.84.148.134 with SMTP id k6mr10879649pla.55.1495193933422; Fri, 19 May 2017 04:38:53 -0700 (PDT) Original-Received: from calancha-pc (222.139.137.133.dy.bbexcite.jp. [133.137.139.222]) by smtp.gmail.com with ESMTPSA id 67sm12721840pfn.84.2017.05.19.04.38.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 May 2017 04:38:52 -0700 (PDT) In-Reply-To: <837f1d48uc.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 19 May 2017 10:14:03 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:132634 Archived-At: Eli Zaretskii writes: >> + AUTO_STRING (inner_format, "`?%c'"); >> CALLN (Fmessage, >> format, file, >> - Fmapconcat (Qstring, >> + Fmapconcat (list3 (Qlambda, list1 (Qchar), >> + list3 (Qformat, inner_format, Qchar)), >> Fsort (Vlread_unescaped_character_literals, Qlss), >> separator)); >> } >>=20 >> Do you think this code is wrong? > > This does indeed look dangerous: we are in effect consing Lisp data > structures from stack-based Lisp objects, and then process them in a > way that could leave some of them lying around when this function > returns, and its stack becomes invalid. > > Can you present the evidence that caused you to suspect this > particular change? Were the "unescaped character literals" warning > displayed during the session which crashed? Yes, such warning always appear in the crash session. Loading =E2=80=98/home/calancha/soft/emacs-master/test/src/regex-tests.el= =E2=80=99: unescaped character literals `?;' detected! Running 22 tests (2017-05-19 20:24:31+0900) If i print out the string, when the object is a cons with its car the string to print, as follows: --8<-----------------------------cut here---------------start------------->= 8--- diff --git a/src/alloc.c b/src/alloc.c index faa14eebb3..20cfb3c88e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6664,7 +6664,32 @@ mark_object (Lisp_Object arg) cdr_count =3D 0; goto loop; } - mark_object (ptr->car); + po =3D XPNTR (ptr->car); + switch (XTYPE (ptr->car)) + { + case Lisp_String: + { + if (!STRING_MARKED_P (XSTRING (ptr->car)) && + !PURE_P (po) && + mem_find (po) =3D=3D MEM_NIL) + { + fprintf (stderr, "[ERROR] mem_find (po) =3D MEM_NIL, con= s %p car %s cdr %p\n", + ptr, XSTRING (ptr->car)->data, XPNTR (ptr->u.cd= r)); + return; + } + else + { + fprintf (stderr, "[OK] cons %p car %s cdr %p\n", + ptr, XSTRING (ptr->car)->data, XPNTR (ptr->u.cd= r)); + } + break; + } + default: + { + mark_object (ptr->car); + } + } + mark_object (ptr->car); obj =3D ptr->u.cdr; cdr_count++; if (cdr_count =3D=3D mark_object_loop_halt) --8<-----------------------------cut here---------------end--------------->= 8--- Then, i see that right before the crash, the string printed out is the name of the test file containinig the unescaped characters. [OK] cons 0x2f0a8f0 car /home/calancha/soft/emacs-master/test/src/regex-res= ources/BOOST.tests cdr 0x2f0a8e0 [ERROR] mem_find (po) =3D MEM_NIL, cons 0x2f45150 car =82 cdr 0x2f45140 [OK] cons 0x16d8720 car /home/calancha/soft/emacs-master/test/src/regex-res= ources/PCRE.tests cdr 0x16d8730 [ERROR] mem_find (po) =3D MEM_NIL, cons 0x2f45150 car =82 cdr 0x2f45140 [OK] cons 0x3009910 car /home/calancha/soft/emacs-master/test/src/regex-res= ources/PTESTS cdr 0x3009900 [ERROR] mem_find (po) =3D MEM_NIL, cons 0x2f45150 car =82 cdr 0x2f45140 With: Fmapconcat (Qstring, insted of: Fmapconcat (list3 (Qlambda, list1 (Qchar), list3 (Qformat, inner_format, Qchar)), we still see the warning, as we should because the test file contains those chars, but there is _no_ crash.