GNU bug report logs - #41357
28.0.50; GC may miss to mark calle safe register content

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: Andrea Corallo <akrl@HIDDEN>; dated Sun, 17 May 2020 12:43:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 41357) by debbugs.gnu.org; 25 May 2020 02:10:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 24 22:10:06 2020
Received: from localhost ([127.0.0.1]:39221 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jd2Z3-00063c-Mr
	for submit <at> debbugs.gnu.org; Sun, 24 May 2020 22:10:06 -0400
Received: from gateway32.websitewelcome.com ([192.185.145.119]:29693)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tom@HIDDEN>) id 1jd2Yy-000633-C9
 for 41357 <at> debbugs.gnu.org; Sun, 24 May 2020 22:10:04 -0400
Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7])
 by gateway32.websitewelcome.com (Postfix) with ESMTP id C421D2B4243
 for <41357 <at> debbugs.gnu.org>; Sun, 24 May 2020 21:09:59 -0500 (CDT)
Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP
 id d2YxjCv00XVkQd2YxjFoqx; Sun, 24 May 2020 21:09:59 -0500
X-Authority-Reason: nr=8
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; 
 s=default;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=X9iO+60VkniiP8ozUpwepW7ymY6K8/7o1cXKXi1crTE=; b=tnfQ0PHOOTbzGyG22bdlHCfM5e
 VA3JTDOADamXUoj96EklhWLhNos3P1LgPeQRpz+vMlcsaTwONi2GVBPEzJwDkie3Lll0odtH5fUE4
 DLv4zyEhu2NOOJh7c807UJ38d;
Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:33322 helo=bapiya)
 by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
 (Exim 4.92) (envelope-from <tom@HIDDEN>)
 id 1jd2Yx-0014e7-DB; Sun, 24 May 2020 20:09:59 -0600
From: Tom Tromey <tom@HIDDEN>
To: Andrea Corallo <akrl@HIDDEN>
Subject: Re: bug#41357: 28.0.50; GC may miss to mark calle safe register
 content
References: <xjfzha6ag1j.fsf@HIDDEN>
X-Attribution: Tom
Date: Sun, 24 May 2020 20:09:58 -0600
In-Reply-To: <xjfzha6ag1j.fsf@HIDDEN> (Andrea Corallo's message of "Sun, 17
 May 2020 12:42:48 +0000")
Message-ID: <87y2pgsr2h.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - box5379.bluehost.com
X-AntiAbuse: Original Domain - debbugs.gnu.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - tromey.com
X-BWhitelist: no
X-Source-IP: 174.16.104.48
X-Source-L: No
X-Exim-ID: 1jd2Yx-0014e7-DB
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-Source-Sender: 174-16-104-48.hlrn.qwest.net (bapiya) [174.16.104.48]:33322
X-Source-Auth: tom+tromey.com
X-Email-Count: 2
X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20=
X-Local-Domain: yes
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41357
Cc: Eli Zaretskii <eliz@HIDDEN>, 41357 <at> debbugs.gnu.org,
 Paul Eggert <eggert@HIDDEN>
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: -0.3 (/)

Andrea> For now I'm testing the simple attached patch that seams to do the job
Andrea> for me.

It looks like this patch was checked in, so I think this bug can be
closed.  I didn't want to do it without verifying with you first though.

Tom




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 21:47:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 17:47:30 2020
Received: from localhost ([127.0.0.1]:44967 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaR86-0005Hg-7E
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 17:47:30 -0400
Received: from lists.gnu.org ([209.51.188.17]:34820)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1jaR80-0005HV-Re
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 17:47:29 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:60814)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>) id 1jaR7v-0005Tb-O2
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 17:47:20 -0400
Received: from mx.sdf.org ([205.166.94.20]:50028)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>)
 id 1jaR7t-0002Xd-53; Sun, 17 May 2020 17:47:19 -0400
Received: from sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 04HLlC2B014694
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sun, 17 May 2020 21:47:12 GMT
Received: (from akrl@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 04HLlCkN031467;
 Sun, 17 May 2020 21:47:12 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN>
 <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
Date: Sun, 17 May 2020 21:47:12 +0000
In-Reply-To: <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN> (Paul Eggert's
 message of "Sun, 17 May 2020 09:46:23 -0700")
Message-ID: <xjfftby8c9r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=205.166.94.20; envelope-from=akrl@HIDDEN;
 helo=mx.sdf.org
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:40:18
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001,
 SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Eli Zaretskii <eliz@HIDDEN>, bug-gnu-emacs@HIDDEN
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 (--)

Paul Eggert <eggert@HIDDEN> writes:

> On 5/17/20 9:40 AM, Andrea Corallo wrote:
>> I think this is a real bug that we have in the codebase (emacs-27
>> included).
>
> Thanks for all the detective work! Your analysis is correct and your patch looks
> good. I've always been suspicious of that code, and it looks like you've
> confirmed my suspicions.
>
> The only question in my mind is whether to install the patch into the emacs-27
> branch or the master branch. Given Eli's problems with stability in emacs-27
> (see Bug#41321), I'm inclined to think the former, as the bug could explain the
> problems Eli is observing.

Hi Paul,

I'm glad you liked the investigation.

I've pushed the fix on master as Eli suggested, feel free to improve it
in case.

I hope a different agreement can be found for 27, in case I'll port it
there.

Thanks!

  Andrea

-- 
akrl@HIDDEN




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 21:28:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 17:28:01 2020
Received: from localhost ([127.0.0.1]:44933 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaQpF-0004nY-JU
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 17:28:01 -0400
Received: from lists.gnu.org ([209.51.188.17]:57080)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1jaQpE-0004nS-MW
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 17:28:00 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:58568)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1jaQpE-0000rT-GN
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 17:28:00 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:57840)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1jaQpD-0007An-Lq; Sun, 17 May 2020 17:28:00 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 385BF160052;
 Sun, 17 May 2020 14:27:56 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id N-5eeGyRC4IG; Sun, 17 May 2020 14:27:55 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 885FD1600CC;
 Sun, 17 May 2020 14:27:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 1JUqwH3zPRlz; Sun, 17 May 2020 14:27:55 -0700 (PDT)
Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com
 [23.242.74.103])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 5D521160052;
 Sun, 17 May 2020 14:27:55 -0700 (PDT)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
To: Eli Zaretskii <eliz@HIDDEN>, Andrea Corallo <akrl@HIDDEN>
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
 <83d072bihd.fsf@HIDDEN> <xjf8shqa34d.fsf@HIDDEN> <837dxabhej.fsf@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Autocrypt: addr=eggert@HIDDEN; prefer-encrypt=mutual; keydata=
 LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB
 QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk
 R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH
 ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEVtbS95N0xiWUVQUWRVZHh1NDd4QTVL
 aFRZcDVibHRGM1dZRHoxWQpnZDdneDA3QXV3cDdp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JoSWhhZlNIS0x3YlhLKzZja2t4Qng2aAo4ejVjY3BHMFFzNGJGaGRGWW5G
 ckVpZURMb0dtbkUyWUxoZFY2c3dKOVZOQ1M2cExpRW9oVDNmbTdhWG0xNXRaCk9JeXpNWmhI
 UlNBUGJsWHhRMFpTV2pxOG9ScmNZTkZ4YzRXMVVScEFrQkNPWUpvWHZRZkQ1TDNscUFsOFRD
 cUQKVXpZeGhIL3RKaGJEZEhycUhINzY3amFEYVRCMStUYWxwLzJBTUt3Y1hOT2Rpa2xHeGJt
 SFZHNllHbDZnOExyYgpzdTlOWkVJNHlMbEh6dWlrdGhKV2d6KzN2WmhWR3lObHQrSE5Jb0Y2
 Q2pETDJvbXU1Y0VxNFJESE00NFFxUGs2Cmw3TzBwVXZOMW1UNEIrUzFiMDhSS3BxbS9mZjAx
 NUUzN0hOVi9waUl2Smx4R0FZejhQU2Z1R0NCMXRoTVlxbG0KZ2RoZDkvQmFiR0ZiR0dZSEE2
 VTQvVDV6cVUrZjZ4SHkxU3NBUVoxTVNLbEx3ZWtCSVQrNC9jTFJHcUNIam5WMApxNUgvVDZh
 N3Q1bVBrYnpTck9MU280cHVqK0lUb05qWXlZSURCV3pobEExOWF2T2ErcnZVam1IdEQzc0ZO
 N2NYCld0a0dvaThidU5jYnk0VT0KPUFMNm8KLS0tLS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxP
 Q0stLS0tLQo=
Organization: UCLA Computer Science Department
Message-ID: <9092d017-ba66-39a0-1cb1-cf4c1109ff7d@HIDDEN>
Date: Sun, 17 May 2020 14:27:55 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.7.0
MIME-Version: 1.0
In-Reply-To: <837dxabhej.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@HIDDEN;
 helo=zimbra.cs.ucla.edu
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:21:30
X-ACL-Warn: Detected OS   = Linux 3.1-3.10
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,
 SPF_PASS=-0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN
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 (--)

On 5/17/20 10:28 AM, Eli Zaretskii wrote:
> I'm saying that we've lived with this
> bug for a very long time, so if it is real, it is definitely very-very
> rare.

Yes, it very much has the smell of a GC bug: rare and hard to reproduce, but
deadly when it occurs. I wouldn't be surprised if it's causing the rare and
hard-to-reproduce crashes you reported in Bug#41321. You might try installing
the patch into your copy of emacs-27 and see whether it affects Bug#41321.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 21:21:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 17:21:55 2020
Received: from localhost ([127.0.0.1]:44925 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaQjL-0004eg-Nx
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 17:21:55 -0400
Received: from lists.gnu.org ([209.51.188.17]:53378)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1jaQjL-0004eZ-67
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 17:21:55 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:58068)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1jaQjK-0007Nr-V5
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 17:21:54 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:57132)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1jaQjJ-0005yZ-Ga; Sun, 17 May 2020 17:21:54 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7947C160052;
 Sun, 17 May 2020 14:21:50 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id 7gVvAPyyDrke; Sun, 17 May 2020 14:21:49 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id C19071600CC;
 Sun, 17 May 2020 14:21:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id kO9OAON6saWw; Sun, 17 May 2020 14:21:49 -0700 (PDT)
Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com
 [23.242.74.103])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 818A6160052;
 Sun, 17 May 2020 14:21:49 -0700 (PDT)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
To: Eli Zaretskii <eliz@HIDDEN>
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN>
 <92ac80b1-102b-7429-8642-d5a2e974f468@HIDDEN> <838shqbhko.fsf@HIDDEN>
 <ed7f81e2-faf0-e3ae-0042-0c4be32753fd@HIDDEN> <83wo5a9xd1.fsf@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Autocrypt: addr=eggert@HIDDEN; prefer-encrypt=mutual; keydata=
 LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB
 QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk
 R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH
 ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEVtbS95N0xiWUVQUWRVZHh1NDd4QTVL
 aFRZcDVibHRGM1dZRHoxWQpnZDdneDA3QXV3cDdpdzdlTnZub0RUQWxLQWw4S1lEWnpiRE5D
 UUdFYnBZM2VmWkl2UGRlSStGV1FONFcra2doCnkrUDZhdTZQcklJaFlyYWV1YTdYRGRiMkxT
 MWVuM1NzbUUzUWpxZlJxSS9BMnVlOEpNd3N2WGUvV0szOEV6czYKeDc0aVRhcUkzQUZINmls
 QWhEcXBNbmQvbXNTRVNOR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1TDNscUFsOFRD
 cUQKVXpZeGhIL3RKaGJEZEhycUhINzY3amFEYVRCMStUYWxwLzJBTUt3Y1hOT2Rpa2xHeGJt
 SFZHNllHbDZnOExyYgpzdTlOWkVJNHlMbEh6dWlrdGhKV2d6KzN2WmhWR3lObHQrSE5Jb0Y2
 Q2pETDJvbXU1Y0VxNFJESE00NFFxUGs2Cmw3TzBwVXZOMW1UNEIrUzFiMDhSS3BxbS9mZjAx
 NUUzN0hOVi9waUl2Smx4R0FZejhQU2Z1R0NCMXRoTVlxbG0KZ2RoZDkvQmFiR0ZiR0dZSEE2
 VTQvVDV6cVUrZjZ4SHkxU3NBUVoxTVNLbEx3ZWtCSVQrNC9jTFJHcUNIam5WMApxNUgvVDZh
 N3Q1bVBrYnpTck9MU280cHVqK0lUb05qWXlZSURCV3pobEExOWF2T2ErcnZVam1IdEQzc0ZO
 N2NYCld0a0dvaThidU5jYnk0VT0KPUFMNm8KLS0tLS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxP
 Q0stLS0tLQo=
Organization: UCLA Computer Science Department
Message-ID: <77d3993d-b711-767e-5e5e-cab7a7b2c21b@HIDDEN>
Date: Sun, 17 May 2020 14:21:49 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.7.0
MIME-Version: 1.0
In-Reply-To: <83wo5a9xd1.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@HIDDEN;
 helo=zimbra.cs.ucla.edu
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:21:30
X-ACL-Warn: Detected OS   = Linux 3.1-3.10
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,
 SPF_PASS=-0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, akrl@HIDDEN
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 (--)

On 5/17/20 12:26 PM, Eli Zaretskii wrote:
> And where's GC in this picture?  If it's called directly from 'f', can
> you show me such code in Emacs?  Then we could disassembly it and see
> what we've got.
> 
> Usually the code that calls GC is much deeper, and thus the chance of
> that temporary to stay in a register is very small, to say the least.

The probability is not that small, unfortunately. Compilers often have a habit
of running through the same set of callee-save registers in the same order.
Let's say you're on the x86 and your compiler consumes the four callee-save
registers in the order ebx, esi, edi, ebp. Then if we call f which calls g which
calls h which calls the GC, it's likely that f will save just ebx, then g will
save just ebx, esi, edi, then h will save just ebx and esi. Hence if the caller
has assigned a local variable to ebp, the GC won't see the variable's contents.

We should give Andrea a big round of applause for catching this bug.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at 41357) by debbugs.gnu.org; 17 May 2020 21:03:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 17:03:24 2020
Received: from localhost ([127.0.0.1]:44911 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaQRQ-0004Ef-Ax
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 17:03:24 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:34444)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1jaQRP-0004ER-0p
 for 41357 <at> debbugs.gnu.org; Sun, 17 May 2020 17:03:23 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6C74D160052;
 Sun, 17 May 2020 14:03:17 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id mj-YvO_lD-5w; Sun, 17 May 2020 14:03:16 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id A594B1600CC;
 Sun, 17 May 2020 14:03:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 2nc_yWFU_pRF; Sun, 17 May 2020 14:03:16 -0700 (PDT)
Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com
 [23.242.74.103])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 73570160052;
 Sun, 17 May 2020 14:03:16 -0700 (PDT)
Subject: Re: bug#41357: 28.0.50; GC may miss to mark calle safe register
 content
To: Eli Zaretskii <eliz@HIDDEN>
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <8f0c7763-9210-aa29-7cee-945b8494d827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UrZjZ4SHkxU3NBUVoxTVNLbEx3ZWtCSVQrNC9jTFJHcUNIam5WMApxNUgvVDZh
 N3Q1bVBrYnpTck9MU280cHVqK0lUb05qWXlZSURCV3pobEExOWF2T2ErcnZVam1IdEQzc0ZO
 N2NYCld0a0dvaThidU5jYnk0VT0KPUFMNm8KLS0tLS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxP
 Q0stLS0tLQo=
Organization: UCLA Computer Science Department
Message-ID: <29b1551d-1280-d358-eac8-9120ec790a3d@HIDDEN>
Date: Sun, 17 May 2020 14:03:12 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.7.0
MIME-Version: 1.0
In-Reply-To: <83y2pq9xnr.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41357
Cc: 41357 <at> debbugs.gnu.org, pipcet@HIDDEN, akrl@HIDDEN
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: -3.3 (---)

>>> I don't think that platform even has callee-saved registers?

>> Eli's platform is 32-bit Microsoft Windows, and W32 has four callee-save
>> registers (ebx, esi, edi, ebp) not counting esp and eip which are of course
>> callee-save by definition. So the problem could at least in theory be occurring
>> on his platform, depending on the compiler and its options.

> I've seen the same problem on 64-bit Windows as well, in Emacs
> compiled with a different (newer) version of GCC.  I don't think this
> has anything to do with how many registers are there. 

You're right that the number of registers doesn't matter, in the sense that the
problem can occur if any registers are callee-save. I was responding to Pip
Cet's comment, where he said he thought your platform (W32 in the original bug
report) had zero callee-saved registers. That would have meant the problem
couldn't occur on your platform. However, because your platform does have
callee-save registers the problem can occur there.

64-bit Windows also has callee-save registers (rbx, rbp, rdi, rsi, r12, r13,
r14, r15) so it can also have the problem. Most platforms do have callee-save
these days.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at 41357) by debbugs.gnu.org; 17 May 2020 20:23:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 16:23:06 2020
Received: from localhost ([127.0.0.1]:44856 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaPoQ-0003Fn-0c
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 16:23:06 -0400
Received: from mx.sdf.org ([205.166.94.20]:62368)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1jaPoO-0003Ff-1Q
 for 41357 <at> debbugs.gnu.org; Sun, 17 May 2020 16:23:04 -0400
Received: from sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 04HKN2o1016989
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sun, 17 May 2020 20:23:02 GMT
Received: (from akrl@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 04HKN2r4021667;
 Sun, 17 May 2020 20:23:02 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#41357: 28.0.50;
 GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN>
 <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
 <CAOqdjBfK2h6sFhV9UgCjjM8futVCtY_rZ=6dtxdDM8LKxPwzaQ@HIDDEN>
 <ca688659-f490-9d85-8128-e1b16af074a9@HIDDEN>
 <83y2pq9xnr.fsf@HIDDEN>
Date: Sun, 17 May 2020 20:23:02 +0000
In-Reply-To: <83y2pq9xnr.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 17 May
 2020 22:19:52 +0300")
Message-ID: <xjfo8qm8g61.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41357
Cc: 41357 <at> debbugs.gnu.org, Paul Eggert <eggert@HIDDEN>, pipcet@HIDDEN
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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Eli's platform is 32-bit Microsoft Windows, and W32 has four callee-save
>> registers (ebx, esi, edi, ebp) not counting esp and eip which are of course
>> callee-save by definition. So the problem could at least in theory be occurring
>> on his platform, depending on the compiler and its options.
>
> I've seen the same problem on 64-bit Windows as well, in Emacs
> compiled with a different (newer) version of GCC.  I don't think this
> has anything to do with how many registers are there.  I also never
> before saw these problems, so this is most definitely due to some
> recent changes, I just cannot yet figure out which ones.

It's hard to say but I suspect the main gate that saved us till today is
'garbage_collect' that being quite big is likely to have calle-save regs
spilled.

You can disassemble your 'garbage_collect' and see if all of this regs
are spilled (in my case they are at -O2).  This could give an indication
on the correlation of the two bugs (but nothing more).

  Andrea

-- 
akrl@HIDDEN




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 19:46:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 15:46:43 2020
Received: from localhost ([127.0.0.1]:44809 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaPFD-0002Lk-8f
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 15:46:43 -0400
Received: from lists.gnu.org ([209.51.188.17]:60556)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1jaPFC-0002Ld-Lh
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 15:46:42 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49508)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>) id 1jaPFC-0002wT-Ds
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 15:46:42 -0400
Received: from mx.sdf.org ([205.166.94.20]:52132)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>)
 id 1jaPFA-0007AG-O8; Sun, 17 May 2020 15:46:42 -0400
Received: from sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 04HJkae5005581
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sun, 17 May 2020 19:46:36 GMT
Received: (from akrl@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 04HJkZ73001404;
 Sun, 17 May 2020 19:46:35 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN>
 <92ac80b1-102b-7429-8642-d5a2e974f468@HIDDEN>
 <838shqbhko.fsf@HIDDEN>
 <ed7f81e2-faf0-e3ae-0042-0c4be32753fd@HIDDEN>
 <83wo5a9xd1.fsf@HIDDEN>
Date: Sun, 17 May 2020 19:46:35 +0000
In-Reply-To: <83wo5a9xd1.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 17 May
 2020 22:26:18 +0300")
Message-ID: <xjfsgfy8hus.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=205.166.94.20; envelope-from=akrl@HIDDEN;
 helo=mx.sdf.org
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:40:18
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001,
 SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, Paul Eggert <eggert@HIDDEN>
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 (--)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Cc: akrl@HIDDEN, bug-gnu-emacs@HIDDEN
>> From: Paul Eggert <eggert@HIDDEN>
>> Date: Sun, 17 May 2020 12:05:25 -0700
>> 
>> On 5/17/20 10:24 AM, Eli Zaretskii wrote:
>> > I struggle to see
>> > how a Lisp object could appear in a register without leaving any trace
>> > on the stack
>> 
>> Quite easily. It happens all the time. If I do something like this:
>> 
>>     Lisp_Object a = Fcons (b, c);
>>     f (x, y);
>>     return a;
>
> And where's GC in this picture?

GC can be triggered by f or any of his callee it does not matter.

> If it's called directly from 'f', can
> you show me such code in Emacs?  Then we could disassembly it and see
> what we've got.

I'm not sure what we can prove disassembling, that would be just the
result of a specific .c + toolchain + invocation.  I think we want to
have code that is sufficiently portable and safe because correct.

> Usually the code that calls GC is much deeper, and thus the chance of
> that temporary to stay in a register is very small, to say the least.

Probably yes, but I don't think we want to have code that works accidentally.

  Andrea

-- 
akrl@HIDDEN




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 19:26:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 15:26:32 2020
Received: from localhost ([127.0.0.1]:44785 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaOvg-0001p6-0p
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 15:26:32 -0400
Received: from lists.gnu.org ([209.51.188.17]:42692)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jaOve-0001oz-Cm
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 15:26:30 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47680)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1jaOvc-0001yT-TP
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 15:26:29 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:36931)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jaOvc-0002HD-DC; Sun, 17 May 2020 15:26:28 -0400
Received: from [176.228.60.248] (port=1687 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jaOvZ-0007Nz-DP; Sun, 17 May 2020 15:26:26 -0400
Date: Sun, 17 May 2020 22:26:18 +0300
Message-Id: <83wo5a9xd1.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <ed7f81e2-faf0-e3ae-0042-0c4be32753fd@HIDDEN> (message from
 Paul Eggert on Sun, 17 May 2020 12:05:25 -0700)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN>
 <92ac80b1-102b-7429-8642-d5a2e974f468@HIDDEN> <838shqbhko.fsf@HIDDEN>
 <ed7f81e2-faf0-e3ae-0042-0c4be32753fd@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, akrl@HIDDEN
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: -3.3 (---)

> Cc: akrl@HIDDEN, bug-gnu-emacs@HIDDEN
> From: Paul Eggert <eggert@HIDDEN>
> Date: Sun, 17 May 2020 12:05:25 -0700
> 
> On 5/17/20 10:24 AM, Eli Zaretskii wrote:
> > I struggle to see
> > how a Lisp object could appear in a register without leaving any trace
> > on the stack
> 
> Quite easily. It happens all the time. If I do something like this:
> 
>     Lisp_Object a = Fcons (b, c);
>     f (x, y);
>     return a;

And where's GC in this picture?  If it's called directly from 'f', can
you show me such code in Emacs?  Then we could disassembly it and see
what we've got.

Usually the code that calls GC is much deeper, and thus the chance of
that temporary to stay in a register is very small, to say the least.

> The proposed fix is harmless

Yeah, right.  Sorry, I don't buy this.  Too many gray hair from such
assumptions.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at 41357) by debbugs.gnu.org; 17 May 2020 19:20:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 15:20:08 2020
Received: from localhost ([127.0.0.1]:44778 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaOpU-0001fl-2O
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 15:20:08 -0400
Received: from eggs.gnu.org ([209.51.188.92]:39554)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jaOpS-0001fK-Q4
 for 41357 <at> debbugs.gnu.org; Sun, 17 May 2020 15:20:07 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:36873)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jaOpM-0000VP-Fn; Sun, 17 May 2020 15:20:00 -0400
Received: from [176.228.60.248] (port=1293 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jaOpL-0006Zh-UX; Sun, 17 May 2020 15:20:00 -0400
Date: Sun, 17 May 2020 22:19:52 +0300
Message-Id: <83y2pq9xnr.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <ca688659-f490-9d85-8128-e1b16af074a9@HIDDEN> (message from
 Paul Eggert on Sun, 17 May 2020 12:01:40 -0700)
Subject: Re: bug#41357: 28.0.50; GC may miss to mark calle safe register
 content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
 <CAOqdjBfK2h6sFhV9UgCjjM8futVCtY_rZ=6dtxdDM8LKxPwzaQ@HIDDEN>
 <ca688659-f490-9d85-8128-e1b16af074a9@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41357
Cc: 41357 <at> debbugs.gnu.org, pipcet@HIDDEN, akrl@HIDDEN
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: -3.3 (---)

> Cc: Andrea Corallo <akrl@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
>  41357 <at> debbugs.gnu.org
> From: Paul Eggert <eggert@HIDDEN>
> Date: Sun, 17 May 2020 12:01:40 -0700
> 
> On 5/17/20 10:00 AM, Pip Cet wrote:
> > I don't think that platform even has callee-saved registers?
> 
> Eli's platform is 32-bit Microsoft Windows, and W32 has four callee-save
> registers (ebx, esi, edi, ebp) not counting esp and eip which are of course
> callee-save by definition. So the problem could at least in theory be occurring
> on his platform, depending on the compiler and its options.

I've seen the same problem on 64-bit Windows as well, in Emacs
compiled with a different (newer) version of GCC.  I don't think this
has anything to do with how many registers are there.  I also never
before saw these problems, so this is most definitely due to some
recent changes, I just cannot yet figure out which ones.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 19:05:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 15:05:29 2020
Received: from localhost ([127.0.0.1]:44750 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaObJ-0001K0-Ka
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 15:05:29 -0400
Received: from lists.gnu.org ([209.51.188.17]:59878)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1jaObJ-0001Jt-48
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 15:05:29 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45472)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1jaObI-0003ZC-VR
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 15:05:28 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:44456)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1jaObI-0005Wq-0e; Sun, 17 May 2020 15:05:28 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id A37C3160052;
 Sun, 17 May 2020 12:05:26 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id Q_lhkkTEwKhv; Sun, 17 May 2020 12:05:25 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id E5ADE1600CC;
 Sun, 17 May 2020 12:05:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id aherHqjcxlYz; Sun, 17 May 2020 12:05:25 -0700 (PDT)
Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com
 [23.242.74.103])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id B7290160052;
 Sun, 17 May 2020 12:05:25 -0700 (PDT)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
To: Eli Zaretskii <eliz@HIDDEN>
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN>
 <92ac80b1-102b-7429-8642-d5a2e974f468@HIDDEN> <838shqbhko.fsf@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Autocrypt: addr=eggert@HIDDEN; prefer-encrypt=mutual; keydata=
 LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB
 QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk
 R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH
 ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEV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aFhpaGdXS0QKMER3KzBMWVBuVU9zUTBLT0Z4SFhYWUhtUnJTMU9a
 UFU1OUJMdmMrVFJoSWhhZlNIS0x3YlhLKzZja2t4Qng2aAo4ejVjY3BHMFFzNGJGaGRGWW5G
 ckVpZURMb0dtbkUyWUxoZFY2c3dKOVZOQ1M2cExpRW9oVDNmbTdhWG0xNXRaCk9JeXpNWmhI
 UlNBUGJsWHhRMFpTV2pxOG9ScmNZTkZ4YzRXMVVScEFrQkNPWUpvWHZRZkQ1TDNscUFsOFRD
 cUQKVXpZeGhIL3RKaGJEZEhycUhINzY3amFEYVRCMStUYWxwLzJBTUt3Y1hOT2Rpa2xHeGJt
 SFZHNllHbDZnOExyYgpzdTlOWkVJNHlMbEh6dWlrdGhKV2d6KzN2WmhWR3lObHQrSE5Jb0Y2
 Q2pETDJvbXU1Y0VxNFJESE00NFFxUGs2Cmw3TzBwVXZOMW1UNEIrUzFiMDhSS3BxbS9mZjAx
 NUUzN0hOVi9waUl2Smx4R0FZejhQU2Z1R0NCMXRoTVlxbG0KZ2RoZDkvQmFiR0ZiR0dZSEE2
 VTQvVDV6cVUrZjZ4SHkxU3NBUVoxTVNLbEx3ZWtCSVQrNC9jTFJHcUNIam5WMApxNUgvVDZh
 N3Q1bVBrYnpTck9MU280cHVqK0lUb05qWXlZSURCV3pobEExOWF2T2ErcnZVam1IdEQzc0ZO
 N2NYCld0a0dvaThidU5jYnk0VT0KPUFMNm8KLS0tLS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxP
 Q0stLS0tLQo=
Organization: UCLA Computer Science Department
Message-ID: <ed7f81e2-faf0-e3ae-0042-0c4be32753fd@HIDDEN>
Date: Sun, 17 May 2020 12:05:25 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.7.0
MIME-Version: 1.0
In-Reply-To: <838shqbhko.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@HIDDEN;
 helo=zimbra.cs.ucla.edu
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:21:30
X-ACL-Warn: Detected OS   = Linux 3.1-3.10
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,
 SPF_PASS=-0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, akrl@HIDDEN
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 (--)

On 5/17/20 10:24 AM, Eli Zaretskii wrote:
> I struggle to see
> how a Lisp object could appear in a register without leaving any trace
> on the stack

Quite easily. It happens all the time. If I do something like this:

    Lisp_Object a = Fcons (b, c);
    f (x, y);
    return a;

The compiler might put 'a' into a callee-save register R, which means that while
f is running there's no trace of 'a' on the stack (unless f's code itself
decides to use R for whatever reason, but let's suppose it doesn't). This
situation can persist even if f calls g which calls h which calls the garbage
collector, and the garbage collector will then think the cons is garbage even
though it's not.

The proposed fix is harmless except it may execute a handful more instructions
per GC. So the cost of applying the fix is tiny, whereas the potential
reliability benefit is large.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at 41357) by debbugs.gnu.org; 17 May 2020 19:01:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 15:01:53 2020
Received: from localhost ([127.0.0.1]:44746 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaOXp-0001Es-6L
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 15:01:53 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:51270)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1jaOXn-0001Ee-0z
 for 41357 <at> debbugs.gnu.org; Sun, 17 May 2020 15:01:51 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 83BB5160052;
 Sun, 17 May 2020 12:01:45 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id nh-maX2OCJuF; Sun, 17 May 2020 12:01:44 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id D35461600CC;
 Sun, 17 May 2020 12:01:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id c22uITxRHkyc; Sun, 17 May 2020 12:01:44 -0700 (PDT)
Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com
 [23.242.74.103])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A3B12160052;
 Sun, 17 May 2020 12:01:44 -0700 (PDT)
Subject: Re: bug#41357: 28.0.50; GC may miss to mark calle safe register
 content
To: Pip Cet <pipcet@HIDDEN>
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
 <CAOqdjBfK2h6sFhV9UgCjjM8futVCtY_rZ=6dtxdDM8LKxPwzaQ@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Autocrypt: addr=eggert@HIDDEN; prefer-encrypt=mutual; keydata=
 LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB
 QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk
 R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH
 ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEVtbS95N0xiWUVQUWRVZHh1NDd4QTVL
 aFRZcDVibHRGM1dZRHoxWQpnZDdneDA3QXV3cDdpdzdlTnZub0RUQWxLQWw4S1lEWnpiRE5D
 UUdFYnBZM2VmWkl2UGRlSStGV1FONFcra2doCnkrUDZhdTZQcklJaFlyYWV1YTdYRGRiMkxT
 MWVuM1NzbUUzUWpxZlJxSS9BMnVlOEpNd3N2WGUvV0szOEV6czYKeDc0aVRhcUkzQUZINmls
 QWhEcXBNbmQvbXNTRVNORnQ3NkRpTzFaS1FNcjlhbVZQa25qZlBtSklTcWRoZ0IxRApsRWR3
 MzRzUk9mNlY4bVp3MHhmcVQ2UEtFNDZMY0ZlZnpzMGtiZzRHT1JmOHZqRzJTZjF0azVlVThN
 Qml5Ti9iClowM2JLTmpOWU1wT0REUVF3dVA4N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2pETDJvbXU1Y0VxNFJESE00NFFxUGs2Cmw3TzBwVXZOMW1UNEIrUzFiMDhSS3BxbS9mZjAx
 NUUzN0hOVi9waUl2Smx4R0FZejhQU2Z1R0NCMXRoTVlxbG0KZ2RoZDkvQmFiR0ZiR0dZSEE2
 VTQvVDV6cVUrZjZ4SHkxU3NBUVoxTVNLbEx3ZWtCSVQrNC9jTFJHcUNIam5WMApxNUgvVDZh
 N3Q1bVBrYnpTck9MU280cHVqK0lUb05qWXlZSURCV3pobEExOWF2T2ErcnZVam1IdEQzc0ZO
 N2NYCld0a0dvaThidU5jYnk0VT0KPUFMNm8KLS0tLS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxP
 Q0stLS0tLQo=
Organization: UCLA Computer Science Department
Message-ID: <ca688659-f490-9d85-8128-e1b16af074a9@HIDDEN>
Date: Sun, 17 May 2020 12:01:40 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.7.0
MIME-Version: 1.0
In-Reply-To: <CAOqdjBfK2h6sFhV9UgCjjM8futVCtY_rZ=6dtxdDM8LKxPwzaQ@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 41357
Cc: Eli Zaretskii <eliz@HIDDEN>, 41357 <at> debbugs.gnu.org,
 Andrea Corallo <akrl@HIDDEN>
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: -3.3 (---)

On 5/17/20 10:00 AM, Pip Cet wrote:
> I don't think that platform even has callee-saved registers?

Eli's platform is 32-bit Microsoft Windows, and W32 has four callee-save
registers (ebx, esi, edi, ebp) not counting esp and eip which are of course
callee-save by definition. So the problem could at least in theory be occurring
on his platform, depending on the compiler and its options.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 18:16:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 14:16:31 2020
Received: from localhost ([127.0.0.1]:44698 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaNpv-00008B-F8
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 14:16:31 -0400
Received: from lists.gnu.org ([209.51.188.17]:48320)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1jaNpu-000084-0V
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 14:16:30 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:40374)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>) id 1jaNpt-0007kn-RP
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 14:16:29 -0400
Received: from mx.sdf.org ([205.166.94.20]:64883)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>)
 id 1jaNps-0002Od-Eu; Sun, 17 May 2020 14:16:29 -0400
Received: from sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 04HIGOLP018945
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sun, 17 May 2020 18:16:24 GMT
Received: (from akrl@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 04HIGOiI019015;
 Sun, 17 May 2020 18:16:24 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN>
 <xjfd072a3ih.fsf@HIDDEN> <83a726bhn1.fsf@HIDDEN>
 <xjf4ksea213.fsf@HIDDEN> <835zcubg1j.fsf@HIDDEN>
Date: Sun, 17 May 2020 18:16:24 +0000
In-Reply-To: <835zcubg1j.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 17 May
 2020 20:57:28 +0300")
Message-ID: <xjfzha68m13.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=205.166.94.20; envelope-from=akrl@HIDDEN;
 helo=mx.sdf.org
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:40:18
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001,
 SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
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 (--)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Andrea Corallo <akrl@HIDDEN>
>> Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
>> Date: Sun, 17 May 2020 17:45:28 +0000
>> 
>> Lisp_Object
>> foo (void)
>> {
>>   /* 'res' goes in a callee saved reg  */
>>   Lisp_Object res = build_string ("bar");
>>   [...]
>>   /* LTO inline the following as "flush_stack_call_func (mark_threads_callback, NULL);" */
>>   mark_threads ();
>>   [...]
>>   gc_sweep ();
>> 
>>   /* The string pointed by 'res' was garbage collected.  */
>>   return res;
>> }
>
> But mark_threads etc. (GC in general) isn't called from functions like
> your 'foo.  It is more like this:
>
> Lisp_Object
> foo (void)
> {
>   /* 'res' goes in a callee saved reg  */
>   Lisp_Object res = build_string ("bar");
>   [...]
>   call_something ();
>   [...]
>
> }
>
> call_something (void)
> {
>   [...]
>   garbage_collect ();
>   [...]
> }

Yes, my example was minimal your is certanly more realistic.

But also this can be critical.  We have to hope that in 'call_something'
or 'garbage_collect' there is sufficient register pressure to have the
register that is holding 'res' to be pushed.


  Andrea

-- 
akrl@HIDDEN




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 17:57:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:57:46 2020
Received: from localhost ([127.0.0.1]:44692 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaNXl-00087i-Qe
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:57:46 -0400
Received: from lists.gnu.org ([209.51.188.17]:51306)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jaNXk-00087a-9V
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:57:44 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:36816)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1jaNXj-00042B-KT
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 13:57:44 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:35407)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jaNXj-0005Ui-6j; Sun, 17 May 2020 13:57:43 -0400
Received: from [176.228.60.248] (port=4170 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jaNXe-00019p-9K; Sun, 17 May 2020 13:57:39 -0400
Date: Sun, 17 May 2020 20:57:28 +0300
Message-Id: <835zcubg1j.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Andrea Corallo <akrl@HIDDEN>
In-Reply-To: <xjf4ksea213.fsf@HIDDEN> (message from Andrea Corallo on Sun, 17
 May 2020 17:45:28 +0000)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN>
 <xjfd072a3ih.fsf@HIDDEN> <83a726bhn1.fsf@HIDDEN> <xjf4ksea213.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
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: -3.3 (---)

> From: Andrea Corallo <akrl@HIDDEN>
> Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
> Date: Sun, 17 May 2020 17:45:28 +0000
> 
> Lisp_Object
> foo (void)
> {
>   /* 'res' goes in a callee saved reg  */
>   Lisp_Object res = build_string ("bar");
>   [...]
>   /* LTO inline the following as "flush_stack_call_func (mark_threads_callback, NULL);" */
>   mark_threads ();
>   [...]
>   gc_sweep ();
> 
>   /* The string pointed by 'res' was garbage collected.  */
>   return res;
> }

But mark_threads etc. (GC in general) isn't called from functions like
your 'foo.  It is more like this:

Lisp_Object
foo (void)
{
  /* 'res' goes in a callee saved reg  */
  Lisp_Object res = build_string ("bar");
  [...]
  call_something ();
  [...]

}

call_something (void)
{
  [...]
  garbage_collect ();
  [...]
}

Which is quite different, AFAIU, wrt stack usage.

Or maybe I don't understand how "callee saved registers" work.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 17:45:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:45:34 2020
Received: from localhost ([127.0.0.1]:44687 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaNLy-0007rC-Lt
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:45:34 -0400
Received: from lists.gnu.org ([209.51.188.17]:38036)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1jaNLx-0007r4-29
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:45:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35650)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>) id 1jaNLw-0005YC-RA
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 13:45:32 -0400
Received: from mx.sdf.org ([205.166.94.20]:54105)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>)
 id 1jaNLv-00034w-4J; Sun, 17 May 2020 13:45:32 -0400
Received: from sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 04HHjSRD024777
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sun, 17 May 2020 17:45:28 GMT
Received: (from akrl@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 04HHjSuk004388;
 Sun, 17 May 2020 17:45:28 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN>
 <xjfd072a3ih.fsf@HIDDEN> <83a726bhn1.fsf@HIDDEN>
Date: Sun, 17 May 2020 17:45:28 +0000
In-Reply-To: <83a726bhn1.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 17 May
 2020 20:22:58 +0300")
Message-ID: <xjf4ksea213.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=205.166.94.20; envelope-from=akrl@HIDDEN;
 helo=mx.sdf.org
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:40:18
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001,
 SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
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 (--)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Andrea Corallo <akrl@HIDDEN>
>> Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
>> Date: Sun, 17 May 2020 17:13:26 +0000
>> 
>> If a C function caller of 'flush_stack_call_func' allocates a
>> Lisp_Object in a temp variable and the compiler decide to keep this in a
>> callee saved reg while 'flush_stack_call_func' is called this will be
>> garbage collected unexpectedly.
>
> Can you show me an example of this (as skeleton C code)?
>
> Thanks.

Sure, something like

=====

Lisp_Object
foo (void)
{
  /* 'res' goes in a callee saved reg  */
  Lisp_Object res = build_string ("bar");
  [...]
  /* LTO inline the following as "flush_stack_call_func (mark_threads_callback, NULL);" */
  mark_threads ();
  [...]
  gc_sweep ();

  /* The string pointed by 'res' was garbage collected.  */
  return res;
}

=====

I'm not sure this is the only possible scenarion tho.

  Andrea

-- 
akrl@HIDDEN




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 17:28:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:28:18 2020
Received: from localhost ([127.0.0.1]:44661 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaN5F-0007R7-TY
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:28:18 -0400
Received: from lists.gnu.org ([209.51.188.17]:55118)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jaN5E-0007Qy-76
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:28:16 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34040)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1jaN5C-0007Hl-QT
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 13:28:16 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:35005)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jaN5B-0006Ey-7y; Sun, 17 May 2020 13:28:14 -0400
Received: from [176.228.60.248] (port=2373 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jaN59-00076T-EB; Sun, 17 May 2020 13:28:12 -0400
Date: Sun, 17 May 2020 20:28:04 +0300
Message-Id: <837dxabhej.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Andrea Corallo <akrl@HIDDEN>
In-Reply-To: <xjf8shqa34d.fsf@HIDDEN> (message from Andrea Corallo on Sun, 17
 May 2020 17:21:54 +0000)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN>
 <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
 <83d072bihd.fsf@HIDDEN> <xjf8shqa34d.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
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: -3.3 (---)

> From: Andrea Corallo <akrl@HIDDEN>
> Cc: Paul Eggert <eggert@HIDDEN>, bug-gnu-emacs@HIDDEN
> Date: Sun, 17 May 2020 17:21:54 +0000
> 
> But I just wanted to point out that I think this is clearly a bug in our
> code, and it can trigger depending on decision of the tool-chain we have
> no control over.

I'm not saying it is not a bug.  I'm saying that we've lived with this
bug for a very long time, so if it is real, it is definitely very-very
rare.

If we put every bugfix we could think of into the release branch, we
will never release Emacs 27.  Never.  Because there's always one more
bug.

> I think it should be trated as we would do if we discover and verify an
> "access out of bounds" or "read after free".

Depends on the circumstances.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 17:24:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:24:34 2020
Received: from localhost ([127.0.0.1]:44657 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaN1e-0007LT-Df
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:24:34 -0400
Received: from lists.gnu.org ([209.51.188.17]:52148)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jaN1c-0007LM-Vl
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:24:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33596)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1jaN1c-0005dD-Pb
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 13:24:32 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:34942)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jaN1b-0005aJ-MN; Sun, 17 May 2020 13:24:31 -0400
Received: from [176.228.60.248] (port=2147 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jaN1a-0003mZ-Sc; Sun, 17 May 2020 13:24:31 -0400
Date: Sun, 17 May 2020 20:24:23 +0300
Message-Id: <838shqbhko.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <92ac80b1-102b-7429-8642-d5a2e974f468@HIDDEN> (message from
 Paul Eggert on Sun, 17 May 2020 10:08:00 -0700)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN>
 <92ac80b1-102b-7429-8642-d5a2e974f468@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, akrl@HIDDEN
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: -3.3 (---)

> Cc: bug-gnu-emacs@HIDDEN
> From: Paul Eggert <eggert@HIDDEN>
> Date: Sun, 17 May 2020 10:08:00 -0700
> 
> It's a low-level problem in which the garbage collector is not seeing some
> objects that it should see, because at the machine level the object addresses
> are in registers that the garbage collector hasn't saved and thus won't see when
> it scans memory.

Since we write in C and in Lisp, not in assembly, I struggle to see
how a Lisp object could appear in a register without leaving any trace
on the stack.  I'm probably missing something.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 17:23:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:23:11 2020
Received: from localhost ([127.0.0.1]:44653 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaN0J-0007JP-0v
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:23:11 -0400
Received: from lists.gnu.org ([209.51.188.17]:49826)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jaN0G-0007JH-SH
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:23:09 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33342)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1jaN0G-0004Yr-Mg
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 13:23:08 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:34913)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jaN0G-0005Nk-AC; Sun, 17 May 2020 13:23:08 -0400
Received: from [176.228.60.248] (port=2056 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jaN0E-0003ba-Fg; Sun, 17 May 2020 13:23:07 -0400
Date: Sun, 17 May 2020 20:22:58 +0300
Message-Id: <83a726bhn1.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Andrea Corallo <akrl@HIDDEN>
In-Reply-To: <xjfd072a3ih.fsf@HIDDEN> (message from Andrea Corallo on Sun, 17
 May 2020 17:13:26 +0000)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN> <xjfd072a3ih.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
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: -3.3 (---)

> From: Andrea Corallo <akrl@HIDDEN>
> Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
> Date: Sun, 17 May 2020 17:13:26 +0000
> 
> If a C function caller of 'flush_stack_call_func' allocates a
> Lisp_Object in a temp variable and the compiler decide to keep this in a
> callee saved reg while 'flush_stack_call_func' is called this will be
> garbage collected unexpectedly.

Can you show me an example of this (as skeleton C code)?

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 17:22:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:22:02 2020
Received: from localhost ([127.0.0.1]:44649 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaMzC-0007HG-GP
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:22:02 -0400
Received: from lists.gnu.org ([209.51.188.17]:49600)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1jaMzA-0007Gr-RI
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:22:01 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33230)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>) id 1jaMzA-0004PU-8n
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 13:22:00 -0400
Received: from mx.sdf.org ([205.166.94.20]:56833)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>)
 id 1jaMz8-0005H2-Gp; Sun, 17 May 2020 13:21:59 -0400
Received: from sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 04HHLsjo007568
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sun, 17 May 2020 17:21:55 GMT
Received: (from akrl@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 04HHLsIQ026493;
 Sun, 17 May 2020 17:21:54 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN>
 <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
 <83d072bihd.fsf@HIDDEN>
Date: Sun, 17 May 2020 17:21:54 +0000
In-Reply-To: <83d072bihd.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 17 May
 2020 20:04:46 +0300")
Message-ID: <xjf8shqa34d.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=205.166.94.20; envelope-from=akrl@HIDDEN;
 helo=mx.sdf.org
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:40:18
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001,
 SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, Paul Eggert <eggert@HIDDEN>
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 (--)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Cc: bug-gnu-emacs@HIDDEN
>> From: Paul Eggert <eggert@HIDDEN>
>> Date: Sun, 17 May 2020 09:46:23 -0700
>> 
>> The only question in my mind is whether to install the patch into the emacs-27
>> branch or the master branch.
>
> Definitely the master!

Is not my responsability so I'll not insist.

But I just wanted to point out that I think this is clearly a bug in our
code, and it can trigger depending on decision of the tool-chain we have
no control over.

I think it should be trated as we would do if we discover and verify an
"access out of bounds" or "read after free".

My opinion :)

Regards

  Andrea

-- 
akrl@HIDDEN




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 17:15:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:15:47 2020
Received: from localhost ([127.0.0.1]:44529 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaMt8-0005Yy-K3
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:15:47 -0400
Received: from lists.gnu.org ([209.51.188.17]:34660)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1jaMt6-0005Ww-Ib
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:15:44 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59728)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1jaMt6-0005k0-CE
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 13:15:44 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:33896)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1jaMt5-0003mo-FG; Sun, 17 May 2020 13:15:44 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id EEAB41600CC;
 Sun, 17 May 2020 10:08:06 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id hMLv3FZxO7yw; Sun, 17 May 2020 10:08:01 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4AADF1600DA;
 Sun, 17 May 2020 10:08:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 3z7idkr_73JW; Sun, 17 May 2020 10:08:01 -0700 (PDT)
Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com
 [23.242.74.103])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 1FCE1160052;
 Sun, 17 May 2020 10:08:01 -0700 (PDT)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
To: Eli Zaretskii <eliz@HIDDEN>, Andrea Corallo <akrl@HIDDEN>
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Autocrypt: addr=eggert@HIDDEN; prefer-encrypt=mutual; keydata=
 LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB
 QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk
 R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH
 ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEVtbS95N0xiWUVQUWRVZHh1NDd4QTVL
 aFRZcDVibHRGM1dZRHoxWQpnZDdneDA3QXV3cDdpdzdlTnZub0RUQWxLQWw4S1lEWnpiRE5D
 UUdFYnBZM2VmWkl2UGRlSStGV1FONFcra2doCnkrUDZhdTZQcklJaFlyYWV1YTdYRGRiMkxT
 MWVuM1NzbUUzUWpxZlJxSS9BMnVlOEpNd3N2WGUvV0szOEV6czYKeDc0aVRhcUkzQUZINmls
 QWhEcXBNbmQvbXNTRVNORnQ3NkRpTzFaS1FNcjlhbVZQa25qZlBtSklTcWRoZ0IxRApsRWR3
 MzRzUk9mNlY4bVp3MHhmcVQ2UEtFNDZ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
 SFZHNllHbDZnOExyYgpzdTlOWkVJNHlMbEh6dWlrdGhKV2d6KzN2WmhWR3lObHQrSE5Jb0Y2
 Q2pETDJvbXU1Y0VxNFJESE00NFFxUGs2Cmw3TzBwVXZOMW1UNEIrUzFiMDhSS3BxbS9mZjAx
 NUUzN0hOVi9waUl2Smx4R0FZejhQU2Z1R0NCMXRoTVlxbG0KZ2RoZDkvQmFiR0ZiR0dZSEE2
 VTQvVDV6cVUrZjZ4SHkxU3NBUVoxTVNLbEx3ZWtCSVQrNC9jTFJHcUNIam5WMApxNUgvVDZh
 N3Q1bVBrYnpTck9MU280cHVqK0lUb05qWXlZSURCV3pobEExOWF2T2ErcnZVam1IdEQzc0ZO
 N2NYCld0a0dvaThidU5jYnk0VT0KPUFMNm8KLS0tLS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxP
 Q0stLS0tLQo=
Organization: UCLA Computer Science Department
Message-ID: <92ac80b1-102b-7429-8642-d5a2e974f468@HIDDEN>
Date: Sun, 17 May 2020 10:08:00 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.7.0
MIME-Version: 1.0
In-Reply-To: <83eeribiim.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@HIDDEN;
 helo=zimbra.cs.ucla.edu
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:21:30
X-ACL-Warn: Detected OS   = Linux 3.1-3.10
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,
 SPF_PASS=-0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN
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 (--)

On 5/17/20 10:04 AM, Eli Zaretskii wrote:
> I cannot easily
> correlate your description of using registers with what happens when
> we call Lisp or bytecode.

His description is generic: it applies regardless of whether the garbage
collector is called from C code (in his branch, generated from Lisp code) or
from the interpreter (either in his branch or in the emacs-27 branch) as it is
executing Lisp code or bytecode.

It's a low-level problem in which the garbage collector is not seeing some
objects that it should see, because at the machine level the object addresses
are in registers that the garbage collector hasn't saved and thus won't see when
it scans memory.

A serious and insidious bug in our existing system, in other words.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 17:13:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:13:34 2020
Received: from localhost ([127.0.0.1]:44525 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaMr0-0004mV-4z
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:13:34 -0400
Received: from lists.gnu.org ([209.51.188.17]:60926)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1jaMqy-0004mO-KX
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:13:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59528)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>) id 1jaMqy-0004oq-Ez
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 13:13:32 -0400
Received: from mx.sdf.org ([205.166.94.20]:57726)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>)
 id 1jaMqw-0003CE-SX; Sun, 17 May 2020 13:13:32 -0400
Received: from sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 04HHDQow029956
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sun, 17 May 2020 17:13:26 GMT
Received: (from akrl@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 04HHDQKQ021622;
 Sun, 17 May 2020 17:13:26 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <83eeribiim.fsf@HIDDEN>
Date: Sun, 17 May 2020 17:13:26 +0000
In-Reply-To: <83eeribiim.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 17 May
 2020 20:04:01 +0300")
Message-ID: <xjfd072a3ih.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=205.166.94.20; envelope-from=akrl@HIDDEN;
 helo=mx.sdf.org
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:40:18
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001,
 SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
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 (--)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Andrea Corallo <akrl@HIDDEN>
>> Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
>> Date: Sun, 17 May 2020 16:40:09 +0000
>> 
>> I think this is a real bug that we have in the codebase (emacs-27
>> included).
>
> Maybe it's so, but your explanation makes sense only in the context of
> calling a machine-language function.  When we call Lisp or bytecode,
> the machine-level operation is very different, and I cannot easily
> correlate your description of using registers with what happens when
> we call Lisp or bytecode.  Sorry for my misunderstanding.

That is correct, but I don't think we need bytecode to come into play
here to have the problem.

If a C function caller of 'flush_stack_call_func' allocates a
Lisp_Object in a temp variable and the compiler decide to keep this in a
callee saved reg while 'flush_stack_call_func' is called this will be
garbage collected unexpectedly.

Am I wrong?

  Andrea

-- 
akrl@HIDDEN




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 17:04:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:04:56 2020
Received: from localhost ([127.0.0.1]:44518 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaMie-0004a4-7n
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:04:56 -0400
Received: from lists.gnu.org ([209.51.188.17]:51160)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jaMic-0004Zv-78
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:04:55 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:58272)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1jaMic-00006M-3G
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 13:04:54 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:34388)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jaMib-0008KW-QW; Sun, 17 May 2020 13:04:53 -0400
Received: from [176.228.60.248] (port=4815 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jaMia-0008Rp-W6; Sun, 17 May 2020 13:04:53 -0400
Date: Sun, 17 May 2020 20:04:46 +0300
Message-Id: <83d072bihd.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN> (message from
 Paul Eggert on Sun, 17 May 2020 09:46:23 -0700)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, akrl@HIDDEN
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: -3.3 (---)

> Cc: bug-gnu-emacs@HIDDEN
> From: Paul Eggert <eggert@HIDDEN>
> Date: Sun, 17 May 2020 09:46:23 -0700
> 
> The only question in my mind is whether to install the patch into the emacs-27
> branch or the master branch.

Definitely the master!




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 17:04:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:04:13 2020
Received: from localhost ([127.0.0.1]:44515 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaMhw-0004Yz-T2
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:04:13 -0400
Received: from lists.gnu.org ([209.51.188.17]:51152)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jaMhu-0004Yr-Ry
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:04:11 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:58214)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1jaMhu-0008KU-Mz
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 13:04:10 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:34381)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jaMhu-0008H4-BV; Sun, 17 May 2020 13:04:10 -0400
Received: from [176.228.60.248] (port=4769 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jaMht-0004d7-LL; Sun, 17 May 2020 13:04:10 -0400
Date: Sun, 17 May 2020 20:04:01 +0300
Message-Id: <83eeribiim.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Andrea Corallo <akrl@HIDDEN>
In-Reply-To: <xjfh7wea51y.fsf@HIDDEN> (message from Andrea Corallo on Sun, 17
 May 2020 16:40:09 +0000)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
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: -3.3 (---)

> From: Andrea Corallo <akrl@HIDDEN>
> Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
> Date: Sun, 17 May 2020 16:40:09 +0000
> 
> I think this is a real bug that we have in the codebase (emacs-27
> included).

Maybe it's so, but your explanation makes sense only in the context of
calling a machine-language function.  When we call Lisp or bytecode,
the machine-level operation is very different, and I cannot easily
correlate your description of using registers with what happens when
we call Lisp or bytecode.  Sorry for my misunderstanding.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at 41357) by debbugs.gnu.org; 17 May 2020 17:01:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 13:01:22 2020
Received: from localhost ([127.0.0.1]:44511 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaMfC-0003Zp-9r
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 13:01:22 -0400
Received: from mail-oi1-f174.google.com ([209.85.167.174]:45246)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pipcet@HIDDEN>) id 1jaMfA-0003TW-Gj
 for 41357 <at> debbugs.gnu.org; Sun, 17 May 2020 13:01:20 -0400
Received: by mail-oi1-f174.google.com with SMTP id d191so6965487oib.12
 for <41357 <at> debbugs.gnu.org>; Sun, 17 May 2020 10:01:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=aP23GjOmNbKxN6cYRsmnvx+TBeH0xG26Cxanqz9BthQ=;
 b=qohbNBiOnmKzHS3mTAA5gQw5cztFBW1E82fjBtOhO4zd66uDs532Lqen9zv0e+ThJt
 0LKR3K8cHYxo6p3WW5TYwMX+vvioDa+1izwjBqPmR2RXge7PZKKRNf07uoXc4OvIOydD
 1WZGLWYlMo4RCyt81Dgd5304R5BWG1Y+Ycyp1nj8RoOsRSVIs12V4ZYfa/ck8z7MWTXQ
 xlc2I82FxIpgaQByvtdmJIj+iVqYBXnpnDVCLUgjIplz5pG4leL01yO7kKa8fwA4jRIb
 QehCZvQBFBCsjhLV35+V3Bk3nabe9jvXx+6m/BCE6SIZROj0fu8Z+xygcSfX0XYZUBSc
 eLXA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=aP23GjOmNbKxN6cYRsmnvx+TBeH0xG26Cxanqz9BthQ=;
 b=I9q/yn1GKYuXqJ5j96iv0z+eL1pkR4xr6N4+HfFBTiY9O/DMoXpm/nShC2Hv4OXl/K
 qWVlWt94r/Hvnq+Y1ct5zqwrXS2e/fuJIzF7oUU7Shns+xBnVSPh+bGPo/SLpOZiS9K9
 7oDPrMcWnjNYbJXVywUDxx2k3Nn6J6XqYUvH/rLRxJmmGVDCBYHBmW41z0HfIRZ8RUiV
 XMrSt8l9y4Jvsl2J8Z8IpIykiMhbmy00aao7FVLiv/qgWJo54g/LXa36gB8WkAvdIiGG
 Wph6AyJsTxAg3JIV4jfuJ/RPU/ShPVHcDjnGBn31wDt0Z+JY3NXbWOigZEgVJUr0MPiH
 X69w==
X-Gm-Message-State: AOAM533ZRSfacZOUP/TWTODbSIJN5sfXMqmxomMhjaWldLjbmCT9r3FY
 I63Os4mq+eF3fg3gu/iFJl1cXEHiNZJ/rm0h5wA=
X-Google-Smtp-Source: ABdhPJzLM3nIfO07TBtxZaf7Lwle3GvQswudwZqENjy5JGNs9JzecmIvM8dwCzE/0DOUh8WaARJCSf+hjLWIeRTTkGM=
X-Received: by 2002:aca:ea05:: with SMTP id i5mr8792576oih.44.1589734874776;
 Sun, 17 May 2020 10:01:14 -0700 (PDT)
MIME-Version: 1.0
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN> <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
In-Reply-To: <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
From: Pip Cet <pipcet@HIDDEN>
Date: Sun, 17 May 2020 17:00:38 +0000
Message-ID: <CAOqdjBfK2h6sFhV9UgCjjM8futVCtY_rZ=6dtxdDM8LKxPwzaQ@HIDDEN>
Subject: Re: bug#41357: 28.0.50;
 GC may miss to mark calle safe register content
To: Paul Eggert <eggert@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 41357
Cc: Eli Zaretskii <eliz@HIDDEN>, 41357 <at> debbugs.gnu.org,
 Andrea Corallo <akrl@HIDDEN>
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: -1.0 (-)

On Sun, May 17, 2020 at 4:47 PM Paul Eggert <eggert@HIDDEN> wrote:
> On 5/17/20 9:40 AM, Andrea Corallo wrote:
> > I think this is a real bug that we have in the codebase (emacs-27
> > included).
> Thanks for all the detective work! Your analysis is correct and your patch looks
> good.

That's my impression as well.

> The only question in my mind is whether to install the patch into the emacs-27
> branch or the master branch. Given Eli's problems with stability in emacs-27
> (see Bug#41321), I'm inclined to think the former, as the bug could explain the
> problems Eli is observing.

I don't think that platform even has callee-saved registers? But I
think the fix should go on the emacs-27 branch. It's a bad bug and
sheer luck that Fgarbage_collect on my platform (using this specific
compiler, etc.) pushes all callee-saved registers. We shouldn't rely
on such lucks on all platforms.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 16:46:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 12:46:30 2020
Received: from localhost ([127.0.0.1]:44492 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaMQo-0001DN-5h
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 12:46:30 -0400
Received: from lists.gnu.org ([209.51.188.17]:52496)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1jaMQm-0001C9-Tn
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 12:46:29 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:56430)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1jaMQm-0004Cp-KG
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 12:46:28 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:59260)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1jaMQk-00054V-Ki; Sun, 17 May 2020 12:46:27 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4F7A9160052;
 Sun, 17 May 2020 09:46:24 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id qGQxvLSttYDH; Sun, 17 May 2020 09:46:23 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9658E1600CC;
 Sun, 17 May 2020 09:46:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id MY5awj0NO-lr; Sun, 17 May 2020 09:46:23 -0700 (PDT)
Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com
 [23.242.74.103])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 5639E160052;
 Sun, 17 May 2020 09:46:23 -0700 (PDT)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
To: Andrea Corallo <akrl@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
 <xjfh7wea51y.fsf@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Autocrypt: addr=eggert@HIDDEN; prefer-encrypt=mutual; keydata=
 LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB
 QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk
 R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH
 ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEVtbS95N0xiWUVQUWRVZHh1NDd4QTVL
 aFRZcDVibHRGM1dZRHoxWQpnZDdneDA3QXV3cDdpdzdlTnZub0RUQWxLQWw4S1lEWnpiRE5D
 UUdFYnBZM2VmWkl2UGRlSStGV1FONFcra2doCnkrUDZhdTZQcklJaFlyYWV1YTdYRGRiMkxT
 MWVuM1NzbUUzUWpxZlJxSS9BMnVlOEpNd3N2WGUvV0szOEV6czYKeDc0aVRhcUkzQUZINmls
 QWhEcXBNbmQvbXNTRVNORnQ3NkRpTzFaS1FNcjlhbVZQa25qZlBtSklTcWRoZ0IxRApsRWR3
 MzRzUk9mNlY4bVp3MHhmcVQ2UEtFNDZMY0ZlZnpzMGtiZzRHT1JmOHZqRzJTZjF0azVlVThN
 Qml5Ti9iClowM2JLTmpOWU1wT0REUVF3dVA4NGtZTGtYMndCeHhNQWhCeHdiRFZadWR6eERa
 SjFDMlZYdWpDT0pWeHEya2wKakJNOUVUWXVVR3FkNzVBVzJMWHJMdzYrTXVJc0hGQVlBZ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z1R0NCMXRoTVlxbG0KZ2RoZDkvQmFiR0ZiR0dZSEE2
 VTQvVDV6cVUrZjZ4SHkxU3NBUVoxTVNLbEx3ZWtCSVQrNC9jTFJHcUNIam5WMApxNUgvVDZh
 N3Q1bVBrYnpTck9MU280cHVqK0lUb05qWXlZSURCV3pobEExOWF2T2ErcnZVam1IdEQzc0ZO
 N2NYCld0a0dvaThidU5jYnk0VT0KPUFMNm8KLS0tLS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxP
 Q0stLS0tLQo=
Organization: UCLA Computer Science Department
Message-ID: <8f0c7763-9210-aa29-7cee-945b8494d827@HIDDEN>
Date: Sun, 17 May 2020 09:46:23 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.7.0
MIME-Version: 1.0
In-Reply-To: <xjfh7wea51y.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@HIDDEN;
 helo=zimbra.cs.ucla.edu
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:21:30
X-ACL-Warn: Detected OS   = Linux 3.1-3.10
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,
 SPF_PASS=-0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN
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 (--)

On 5/17/20 9:40 AM, Andrea Corallo wrote:
> I think this is a real bug that we have in the codebase (emacs-27
> included).

Thanks for all the detective work! Your analysis is correct and your patch looks
good. I've always been suspicious of that code, and it looks like you've
confirmed my suspicions.

The only question in my mind is whether to install the patch into the emacs-27
branch or the master branch. Given Eli's problems with stability in emacs-27
(see Bug#41321), I'm inclined to think the former, as the bug could explain the
problems Eli is observing.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 16:40:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 12:40:24 2020
Received: from localhost ([127.0.0.1]:44476 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaMKu-00089z-G2
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 12:40:24 -0400
Received: from lists.gnu.org ([209.51.188.17]:50434)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1jaMKs-00089s-DK
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 12:40:22 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:55848)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>) id 1jaMKs-0002Sa-67
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 12:40:22 -0400
Received: from mx.sdf.org ([205.166.94.20]:62086)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>)
 id 1jaMKq-00036o-HT; Sun, 17 May 2020 12:40:21 -0400
Received: from sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 04HGeAZK017481
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sun, 17 May 2020 16:40:10 GMT
Received: (from akrl@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 04HGe9fa003083;
 Sun, 17 May 2020 16:40:09 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN> <83pnb2bmk2.fsf@HIDDEN>
Date: Sun, 17 May 2020 16:40:09 +0000
In-Reply-To: <83pnb2bmk2.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 17 May
 2020 18:36:45 +0300")
Message-ID: <xjfh7wea51y.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=205.166.94.20; envelope-from=akrl@HIDDEN;
 helo=mx.sdf.org
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 12:40:18
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001,
 SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
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 (--)

--=-=-=
Content-Type: text/plain

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Andrea Corallo <akrl@HIDDEN>
>> Cc: Paul Eggert <eggert@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
>> Date: Sun, 17 May 2020 12:42:48 +0000
>>
>> What is going on is that in a .eln in a function A a Lisp_Object is
>> hold in a register (r14).  Function A is calling other functions into
>> emacs-core till Garbage Collection is triggered.
>>
>> Being emacs-core compiled with -O0 GCC is not selecting any callee safe
>> register and therefore these gets never pushed.
>
> Isn't this something for the infrastructure of calling
> natively-compiled Lisp to solve?  The Emacs C code isn't prepared for
> calling optimized C code when it calls Lisp, and I don't think it's
> right for us to assume that, because it will make Emacs slower.  If
> the natively-compiled Lisp needs some setup to be compatible with GC,
> I think the calling framework should set that up.

Hi Eli,

I think this is a real bug that we have in the codebase (emacs-27
included).

Usually it works because having many big functions with high register
pressure that gets activated before reaching 'flush_stack_call_func'
statistically callee saved regs are very likely to be pushed.

But nothing prevents a caller of 'flush_stack_call_func' to store a lisp
object into a callee saved regs and trigger the bug.  This obviously
depends on the compiler, flags used etc, things we have no control over.

This could be also an explanation of instability for LTO configurations.
Given that callers of 'flush_stack_call_func' are more likely to be
inlined the exposed surface becomes considerably higher.

This bug should be also more likely to be observable if C files are
compiled with a mix of -O0 and -O2.

I think we should honor calling convention and make sure we garbage
collect also the content of callee saved registers, BTW I guess that's
the reason why we call '__builtin_unwind_init' isn't?

If we are concerned about performance the attached the attached patch
should be zero performance overhead.

Regards

  Andrea

--
akrl@HIDDEN

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Fix-Garbage-Collector-for-missing-calle-safe-registe.patch

From ef923e029d5192b67ff7a0aede75a19c2c5327d4 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <akrl@HIDDEN>
Date: Sun, 17 May 2020 13:23:59 +0100
Subject: [PATCH] * Fix Garbage Collector for missing calle safe registers
 content

	* src/alloc.c (SET_STACK_TOP_ADDRESS): Do not call
	__builtin_unwind_init.
	(flush_stack_call_func1): Rename from 'flush_stack_call_func'.
	(flush_stack_call_func): New function to spill all registers
	before calling 'flush_stack_call_func1'.  This to make sure the
	top of the stack identified includes those registers.
---
 src/alloc.c | 4 +---
 src/lisp.h  | 9 ++++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index f2b80fac88..d6ba4d9790 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4952,12 +4952,10 @@ test_setjmp (void)
 #ifdef HAVE___BUILTIN_UNWIND_INIT
 # define SET_STACK_TOP_ADDRESS(p)	\
    stacktop_sentry sentry;		\
-   __builtin_unwind_init ();		\
    *(p) = NEAR_STACK_TOP (&sentry)
 #else
 # define SET_STACK_TOP_ADDRESS(p)		\
    stacktop_sentry sentry;			\
-   __builtin_unwind_init ();			\
    test_setjmp ();				\
    sys_setjmp (sentry.j);			\
    *(p) = NEAR_STACK_TOP (&sentry + (stack_bottom < &sentry.c))
@@ -5033,7 +5031,7 @@ mark_stack (char const *bottom, char const *end)
    from FUNC.  */
 
 NO_INLINE void
-flush_stack_call_func (void (*func) (void *arg), void *arg)
+flush_stack_call_func1 (void (*func) (void *arg), void *arg)
 {
   void *end;
   struct thread_state *self = current_thread;
diff --git a/src/lisp.h b/src/lisp.h
index 66a86ddadf..c7ce3918fc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3819,7 +3819,14 @@ verify (FLT_RADIX == 2 || FLT_RADIX == 16);
 extern void alloc_unexec_post (void);
 extern void mark_maybe_objects (Lisp_Object const *, ptrdiff_t);
 extern void mark_stack (char const *, char const *);
-extern void flush_stack_call_func (void (*func) (void *arg), void *arg);
+
+INLINE void
+flush_stack_call_func (void (*func) (void *arg), void *arg)
+{
+  __builtin_unwind_init ();
+  flush_stack_call_func1 (func, arg);
+}
+
 extern void garbage_collect (void);
 extern void maybe_garbage_collect (void);
 extern const char *pending_malloc_warning;
-- 
2.17.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 15:37:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 11:37:06 2020
Received: from localhost ([127.0.0.1]:44332 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaLLd-00053Q-OH
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 11:37:05 -0400
Received: from lists.gnu.org ([209.51.188.17]:35562)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jaLLZ-00053B-Rr
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 11:37:04 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49072)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1jaLLZ-0006yf-Ck
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 11:37:01 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:60780)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jaLLW-0002DO-Fi; Sun, 17 May 2020 11:36:58 -0400
Received: from [176.228.60.248] (port=3381 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jaLLS-0002mL-B1; Sun, 17 May 2020 11:36:55 -0400
Date: Sun, 17 May 2020 18:36:45 +0300
Message-Id: <83pnb2bmk2.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Andrea Corallo <akrl@HIDDEN>
In-Reply-To: <xjfzha6ag1j.fsf@HIDDEN> (message from Andrea Corallo on Sun, 17
 May 2020 12:42:48 +0000)
Subject: Re: 28.0.50; GC may miss to mark calle safe register content
References: <xjfzha6ag1j.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, eggert@HIDDEN
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: -3.3 (---)

> From: Andrea Corallo <akrl@HIDDEN>
> Cc: Paul Eggert <eggert@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
> Date: Sun, 17 May 2020 12:42:48 +0000
> 
> What is going on is that in a .eln in a function A a Lisp_Object is
> hold in a register (r14).  Function A is calling other functions into
> emacs-core till Garbage Collection is triggered.
> 
> Being emacs-core compiled with -O0 GCC is not selecting any callee safe
> register and therefore these gets never pushed.

Isn't this something for the infrastructure of calling
natively-compiled Lisp to solve?  The Emacs C code isn't prepared for
calling optimized C code when it calls Lisp, and I don't think it's
right for us to assume that, because it will make Emacs slower.  If
the natively-compiled Lisp needs some setup to be compatible with GC,
I think the calling framework should set that up.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#41357; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 17 May 2020 12:42:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 08:42:59 2020
Received: from localhost ([127.0.0.1]:42525 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jaId9-0006UP-CX
	for submit <at> debbugs.gnu.org; Sun, 17 May 2020 08:42:59 -0400
Received: from lists.gnu.org ([209.51.188.17]:37042)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1jaId8-0006UI-80
 for submit <at> debbugs.gnu.org; Sun, 17 May 2020 08:42:58 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:56288)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>) id 1jaId7-0006Om-P1
 for bug-gnu-emacs@HIDDEN; Sun, 17 May 2020 08:42:58 -0400
Received: from mx.sdf.org ([205.166.94.20]:63002)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <akrl@HIDDEN>)
 id 1jaId5-00085g-Qa; Sun, 17 May 2020 08:42:57 -0400
Received: from sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 04HCgm2L005673
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Sun, 17 May 2020 12:42:48 GMT
Received: (from akrl@localhost)
 by sdf.org (8.15.2/8.12.8/Submit) id 04HCgm1P018464;
 Sun, 17 May 2020 12:42:48 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 28.0.50; GC may miss to mark calle safe register content
Date: Sun, 17 May 2020 12:42:48 +0000
Message-ID: <xjfzha6ag1j.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=205.166.94.20; envelope-from=akrl@HIDDEN;
 helo=mx.sdf.org
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/17 08:42:52
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001,
 SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Eli Zaretskii <eliz@HIDDEN>, Paul Eggert <eggert@HIDDEN>
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 (--)

--=-=-=
Content-Type: text/plain

Hi all,

debugging the native compiler I've been chasing a bug in a configuration
where the .eln are compiled at speed 2 (-O2) and emacs-core is compiled
at -O0.

What is going on is that in a .eln in a function A a Lisp_Object is
hold in a register (r14).  Function A is calling other functions into
emacs-core till Garbage Collection is triggered.

Being emacs-core compiled with -O0 GCC is not selecting any callee safe
register and therefore these gets never pushed.  The value stays in r14
till we enter into 'flush_stack_call_func' where we have to push all
registers and identify the end of the stack for mark.

We correctly push callee safe register with __builtin_unwind_init () and
we identify the top (end) of the stack on my machine using
__builtin_frame_address (0).

Here I think raise the issue, __builtin_frame_address on GCC 7 and 10
for X86_64 is returning the base pointer and not the stack pointer [1].
As a consequence this is not including the callee safe registers that we
have just pushed.

In my case r14 gets pushed at address 0x7ffc47b95fa0 but in mark_stack
we are scanning the interval 0x7ffc47b95fb0 (end) 0x7ffc47b9a150
(bottom).  This because __builtin_frame_address returned ebp
(0x7ffc47b95fb0 in this case).

The consequence is that the object originally referenced by r14 is never
marked and this leads to have it freed and to a crash.

I think we would be interested into obtaining the stack pointer and not
the base pointer, unfortunately what __builtin_frame_address does is
appears not really portable:

https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html

This bug is easy to observe in the native compiler with configurations
like this (speed2 for eln -O0 for core) but I believe can affect stock
Emacs too if any caller of flush_stack_call_func has a callee safe
register holding a reference to a live object not present into the
stack.  This can get trickier especially with LTO enabled.

For now I'm testing the simple attached patch that seams to do the job
for me.  It pushes the registers in 'flush_stack_call_func' and then
call 'flush_stack_call_func1' where now ebp must include the address
where those register got pushed.

I hope I'm not catastrophically wrong in this analysis, in case
I apologize for the noise.

Thanks

  Andrea

[1] Reduced example. GCC7 -O0

void *
foo (void)
{
  __builtin_unwind_init ();
  return __builtin_frame_address (0);
}

foo:
	push	rbp
	mov	rbp, rsp
	push	r15
	push	r14
	push	r13
	push	r12
	push	rbx
	mov	rax, rbp
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	ret

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Fix-Garbage-Collector-for-missing-calle-safe-registe.patch

From f8a5d8a4a95182e91037d444d6d1f51f7dc7e467 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <akrl@HIDDEN>
Date: Sun, 17 May 2020 13:23:59 +0100
Subject: [PATCH] * Fix Garbage Collector for missing calle safe registers
 content

	* src/alloc.c (SET_STACK_TOP_ADDRESS): Do not call
	__builtin_unwind_init.
	(flush_stack_call_func1): Rename from 'flush_stack_call_func'.
	(flush_stack_call_func): New function to spill all registers
	before calling 'flush_stack_call_func1'.  This to make sure the
	top of the stack identified includes those registers.
---
 src/alloc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index f2b80fac88..1d2ee05481 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4952,12 +4952,10 @@ test_setjmp (void)
 #ifdef HAVE___BUILTIN_UNWIND_INIT
 # define SET_STACK_TOP_ADDRESS(p)	\
    stacktop_sentry sentry;		\
-   __builtin_unwind_init ();		\
    *(p) = NEAR_STACK_TOP (&sentry)
 #else
 # define SET_STACK_TOP_ADDRESS(p)		\
    stacktop_sentry sentry;			\
-   __builtin_unwind_init ();			\
    test_setjmp ();				\
    sys_setjmp (sentry.j);			\
    *(p) = NEAR_STACK_TOP (&sentry + (stack_bottom < &sentry.c))
@@ -5033,7 +5031,7 @@ mark_stack (char const *bottom, char const *end)
    from FUNC.  */
 
 NO_INLINE void
-flush_stack_call_func (void (*func) (void *arg), void *arg)
+flush_stack_call_func1 (void (*func) (void *arg), void *arg)
 {
   void *end;
   struct thread_state *self = current_thread;
@@ -5043,6 +5041,13 @@ flush_stack_call_func (void (*func) (void *arg), void *arg)
   eassert (current_thread == self);
 }
 
+void
+flush_stack_call_func (void (*func) (void *arg), void *arg)
+{
+  __builtin_unwind_init ();
+  flush_stack_call_func1 (func, arg);
+}
+
 /* Determine whether it is safe to access memory at address P.  */
 static int
 valid_pointer_p (void *p)
-- 
2.17.1


--=-=-=--




Acknowledgement sent to Andrea Corallo <akrl@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#41357; 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: Mon, 25 May 2020 02:15:01 UTC

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