From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Help with new Windows 98 crash Date: Tue, 06 Dec 2022 14:12:54 +0200 Message-ID: <83wn747mt5.fsf@gnu.org> References: <87o7sindcl.fsf.ref@yahoo.com> <87o7sindcl.fsf@yahoo.com> <83ilip9a37.fsf@gnu.org> <838rjl9477.fsf@gnu.org> <87k035nwv3.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11303"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 06 13:33:29 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2X8b-0002kv-5J for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Dec 2022 13:33:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2Wow-00018U-BO; Tue, 06 Dec 2022 07:13:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2Wov-00018K-0m for emacs-devel@gnu.org; Tue, 06 Dec 2022 07:13:09 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2Wou-0005dI-Hv; Tue, 06 Dec 2022 07:13:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=m3TMJVjEp4c3935K9DmFuPs0wa+r1viEM1QYbNN/N3s=; b=q4VEaaGo7rPq FJWaaMtKUyvAtzzUip9Rq6bCcKAwAweNgX5nOdkMtRrhq0naJzMH/mxGMDPoWE4uXh+BWtTJAMX3P dOhVCmJxnOJjNuSR1uPlXYUR8qySDhPhjwZDo5EUC7o2T8cE711QVBoFq57kjm0046wDeDF2dE8+r ySaVDKv2gJT4uNxMp1G23XoIBPPZonNScaFxolXJPSHYqL5pdcfTdKT0YFDM47p/O7WBwQD8ItEOl 94LQ+zrPvmK/fI9ziWP+xew97v2Lip4UGWL22VI41jHSSwFSrN0GwKQJZ08FaRmVyT2teLCVuPbNH 0ZoRIwn7gB9MXbDZ08txyA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2Wou-0004nJ-05; Tue, 06 Dec 2022 07:13:08 -0500 In-Reply-To: <87k035nwv3.fsf@yahoo.com> (message from Po Lu on Tue, 06 Dec 2022 09:29:04 +0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300960 Archived-At: > From: Po Lu > Cc: emacs-devel@gnu.org > Date: Tue, 06 Dec 2022 09:29:04 +0800 > > init_bignum must be called before make_initial_frame, because that > allocates a bignum in temacs (as set_window_buffer calls > bset_display_time and Fcurrent_time, which go through the time > arithmetic stuff), before our own allocator has been set up, which ends > up in the dumped Emacs, leading to a free of a pointer from the wrong > heap once the bignum is garbage collected. > > I have installed the change on the Emacs 30 branch because I am not sure > it is safe for Emacs 29. Can you think of a safer fix? There's nothing unsafe in what you did, but: . the call to init_bignum inside the !initialized block should be conditioned on HAVE_UNEXEC . the call to init_bignum that is a few lines below that, and outside of the !initialized condition should be conditioned using HAVE_UNEXEC and initialized such that we don't invoke this function twice in any case, whether this is during dumping or not and whether this is a pdumper build or not If you do these two changes, we can have the result on the release branch. Please show the patch before installing. Thanks.