GNU bug report logs - #57880
28.1; Emacs crashes with native compilation on when some antivirus program is running on MS-Windows

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: Ioannis Kappas <ioannis.kappas@HIDDEN>; dated Sat, 17 Sep 2022 11:15:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 57880) by debbugs.gnu.org; 22 Sep 2022 08:09:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 22 04:09:23 2022
Received: from localhost ([127.0.0.1]:36161 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1obHGt-0003sg-Mw
	for submit <at> debbugs.gnu.org; Thu, 22 Sep 2022 04:09:23 -0400
Received: from mx.sdf.org ([205.166.94.24]:65163)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1obHGr-0003sV-4g
 for 57880 <at> debbugs.gnu.org; Thu, 22 Sep 2022 04:09:22 -0400
Received: from ma.sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 28M89JTJ017812
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Thu, 22 Sep 2022 08:09:19 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57880: 28.1; Emacs crashes with native compilation on when
 some antivirus program is running on MS-Windows
In-Reply-To: <83bkr7ud5k.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 22 Sep
 2022 09:38:31 +0300")
References: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
 <xjfk05zbx3e.fsf@HIDDEN>
 <CAMRHuGBt_+GacqKYp-Cddk+-H1oxydoHsekkF-GqBRuhGK5w7A@HIDDEN>
 <xjfa66sbkbz.fsf@HIDDEN> <83bkr7ud5k.fsf@HIDDEN>
Date: Thu, 22 Sep 2022 08:09:19 +0000
Message-ID: <xjf5yhfbzkg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57880
Cc: ioannis.kappas@HIDDEN, 57880 <at> debbugs.gnu.org
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:

>> Cc: 57880 <at> debbugs.gnu.org
>> From: Andrea Corallo <akrl@HIDDEN>
>> Date: Wed, 21 Sep 2022 19:26:08 +0000
>> 
>> Okay, I think then is a good idea to guard against the NULL pointer
>> potentially returned, OTOH we do it already in the rest of the code.
>> 
>> I'm only not sure if we should signal an error or not here.
>
> No, we shouldn't, IMO.  We should just behave as if the *.eln files
> were unavailable, perhaps with some message logged in *Messages*.
> Signaling an error would be shooting the user in his/her foot, because
> loading of *.eln files is attempted as part of routine operation, so
> signaling an error will prevent the user from being able to invoke
> many commands.

Agree.

  Andrea




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

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


Received: (at 57880) by debbugs.gnu.org; 22 Sep 2022 06:55:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 22 02:55:21 2022
Received: from localhost ([127.0.0.1]:36024 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1obG7F-0008Cg-Il
	for submit <at> debbugs.gnu.org; Thu, 22 Sep 2022 02:55:21 -0400
Received: from mail-wm1-f50.google.com ([209.85.128.50]:37405)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ioannis.kappas@HIDDEN>) id 1obG7E-0008CR-9r
 for 57880 <at> debbugs.gnu.org; Thu, 22 Sep 2022 02:55:20 -0400
Received: by mail-wm1-f50.google.com with SMTP id
 z13-20020a7bc7cd000000b003b5054c6f9bso165712wmk.2
 for <57880 <at> debbugs.gnu.org>; Wed, 21 Sep 2022 23:55:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date;
 bh=C3SZrahwpK+9XyveDULwpIbfgwhJbNj8PG6fgMkLKSs=;
 b=XxIDEi5di2q2SaHi6JhVq7UkLEgCA9honHc1xkMkDtsrF5HB68uDvhAUqETuyBEPLC
 bS1QJLxNmSF7kExH5SOgUy8XxiF0aQ+PHPbJfpj9CS0TUZc7438FRaahmVz6l1tbVBFA
 X8XE4206Hzv6msrpqsI3dudyVbWTJdIJDaxlZQW2pivOUrMdOH+ffP4rsW+U1VDmwmT+
 Ab8sLQ/ssLtWMCrZH3x1+0/sqiAXb18uIUGwDt1mql+kabR4qcRJTJWES6WIAvepcE8m
 bpcFtTSg3qRUJKPFA8eMs0HeeRHbPLUojFuChLldDFleDc+nXCyvjJtqV5C6Pli2ogxi
 KkLQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date;
 bh=C3SZrahwpK+9XyveDULwpIbfgwhJbNj8PG6fgMkLKSs=;
 b=CW7Ju4JBOGqWOyvbXFIpX5zSkrUxQtuX3OWUq/XQ0Qw+6UHTaaV3HhySsIjE0wi8eo
 x5ouEzWG2tuoq/jQoFc/Y/OVPJEmorlvjcjgr7Ilj9rNTGrNeuFcnDimY4VWH5VPSpKr
 f9gBgJIvrgsCsN4Rqrs/OOYXePnEBstoGyRoAtYSqrDzW362oV1mnpoziZO8BOUdC/H6
 i6bwzGHIZvi4iCDooK2JPIoqRuan1RYjof8/1XXh+bt4gNpVZvuoSFXwK2gK/AWdf/BW
 W+DKXAyvTbaci09RU3qMJMg6GOvMg2+hdd3FXDiDEhZYJM6/0PeLjw9rnKwqxnnobEsS
 OXUA==
X-Gm-Message-State: ACrzQf247WOVMI/lYqymWIA9E70cKXqXiWBC5a0gkmdkpY7NpI84hv4H
 xS0Udwfjqhl4oL/Ef8vz8JVismiD6BVOT5B1eg8=
X-Google-Smtp-Source: AMsMyM7RwJ693YlMl9UPI8OfMDLk5QLLtqXAlVx7kO2ta4Gs2rF/MUKMtp2RVSIE7aNmNtfpkDR9NKoY1THh9XPnMBk=
X-Received: by 2002:a05:600c:3c8e:b0:3b4:d224:addf with SMTP id
 bg14-20020a05600c3c8e00b003b4d224addfmr8279559wmb.132.1663829714040; Wed, 21
 Sep 2022 23:55:14 -0700 (PDT)
MIME-Version: 1.0
References: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
 <xjfk05zbx3e.fsf@HIDDEN>
 <CAMRHuGBt_+GacqKYp-Cddk+-H1oxydoHsekkF-GqBRuhGK5w7A@HIDDEN>
 <83o7v9ugv2.fsf@HIDDEN>
 <CAMRHuGC-c5nK5zM=XL+skSMdYb9mf737ePB69w4OCvNcz6zzRw@HIDDEN>
 <83czbnud9d.fsf@HIDDEN>
In-Reply-To: <83czbnud9d.fsf@HIDDEN>
From: Ioannis Kappas <ioannis.kappas@HIDDEN>
Date: Thu, 22 Sep 2022 07:55:03 +0100
Message-ID: <CAMRHuGB-W9xWrV++Wf-VE8JweoUr2Xfgt2MY6hnDF83xk6hP3Q@HIDDEN>
Subject: Re: bug#57880: 28.1; Emacs crashes with native compilation on when
 some antivirus program is running on MS-Windows
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57880
Cc: 57880 <at> debbugs.gnu.org, 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 (-)

Hi Eli

On Thu, Sep 22, 2022 at 7:36 AM Eli Zaretskii <eliz@HIDDEN> wrote:

> How can an average user go about researching this?  They'd need a
> debugger, a binary with debug info, and probably also a way of
> compiling Emacs.  That doesn't sound like a typical Windows user to
> me.

There will get a lot of "eln file inconsistent with current runtime" messages
in Emacs warnings buffer, the users will search on the Internet, and
they eventually
notice this discussion, mentioning the possible workarounds.

> When Emacs crashes, they will report a bug, or ask on some forum.  We
> can have this issue and its solutions described in PROBLEMS, so we
> could point them to that place.

If Emacs just crashes with not the slightest indication what has gone wrong,
they have to go through a bug report, of which the average user won't do.

> We could even mention this in the
> README that accompanies the Windows binaries (if we believe users
> actually read that).  One way or another, if this issue happens
> frequently, the information will spread widely enough for people to be
> able to find it by a simple Internet search.

There is always the possibility this issue happens frequently but
there are no reports, users then just move one with other tooling, which
means the user base is reduced.

> Btw, which antivirus software have this "feature"?  If it's widely
> used, perhaps the "official" Emacs binaries should not be distributed
> with native-compilation enabled at all?

Or could there be an early init option to bypass the native compilation. This
way the users can test the issue with is native comp.

> > And I can see two ways going forward:
> > 1. Take a step back and switch off native compilation (but how to do this
> > other than recompiling Emacs?)
> > 2. Stil use native compilation but change the destination .eln directory
> >   to a safer path, so that they can still rip the benefit. I'd expect the AV
> > only have a limited set of dirs preventing GetProcAddress of
> > operating, otherwise nothing would work.
>
> Why does the directory where the *.eln files live matter?  Doesn't the
> antivirus software check any loading of any DLL from anywhere on the
> system?

Perhaps it only matters for the User directory. AVs want to put more
stricter control
on the binaries the user downloads and installs themselves.

> In any case, the *.eln files have at least two places on any system,
> and only one of them can be changed, the other one is fixed by the
> build.

Those precompiled with Emacs are fine in this use case since they are
not stored in the Users directory, it's only newly compiled files that
exhibit this issue because they store the .eln files in the user dir by
default.

Thanks




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

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


Received: (at 57880) by debbugs.gnu.org; 22 Sep 2022 06:38:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 22 02:38:29 2022
Received: from localhost ([127.0.0.1]:35977 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1obFqv-0007jq-7p
	for submit <at> debbugs.gnu.org; Thu, 22 Sep 2022 02:38:29 -0400
Received: from eggs.gnu.org ([209.51.188.92]:44722)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1obFqt-0007jY-Mt
 for 57880 <at> debbugs.gnu.org; Thu, 22 Sep 2022 02:38:28 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:54014)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1obFqo-0002DW-1D; Thu, 22 Sep 2022 02:38:22 -0400
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=7lJu5WzFj74VfRnkdzSXRHYwN29EV7W0bTZgZyd7tqk=; b=Vy3WiumtzTpR
 W0aQY/FZObXnAnoBWILzqrOVhj8LNWGe5QehtC7eUQdCwGb8d7Owmg+IlRL3scH9iJyViiRU89H+1
 xBjRtlr2eRiIRqpOFTcfSg9p7ZxRA2c+D7PLUqiUEw69S99raIv9nx/3Xztz7hJkaUDGXFAD44hSG
 zo/kjHL/cPmmHWwKnMnxDVNu2Zc0BdznExZl64VNS6ENO+k7jrqTMc5glnpfiMzeI2/ES2fvYa9LI
 HLeHkLE2/K4HGeFS4AH+8sAaCE/LJavJN2tcrRRpsMIqqKljZqCwyFjPw/Uc5DBuQ6YQDJGbGHqy7
 mM8huqI6yKsahrs+662vLw==;
Received: from [87.69.77.57] (port=2109 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1obFqn-0002R1-AX; Thu, 22 Sep 2022 02:38:21 -0400
Date: Thu, 22 Sep 2022 09:38:31 +0300
Message-Id: <83bkr7ud5k.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Andrea Corallo <akrl@HIDDEN>
In-Reply-To: <xjfa66sbkbz.fsf@HIDDEN> (message from Andrea Corallo on Wed, 
 21 Sep 2022 19:26:08 +0000)
Subject: Re: bug#57880: 28.1;
 Emacs crashes with native compilation on when some antivirus program
 is running on MS-Windows
References: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
 <xjfk05zbx3e.fsf@HIDDEN>
 <CAMRHuGBt_+GacqKYp-Cddk+-H1oxydoHsekkF-GqBRuhGK5w7A@HIDDEN>
 <xjfa66sbkbz.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57880
Cc: ioannis.kappas@HIDDEN, 57880 <at> debbugs.gnu.org
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: 57880 <at> debbugs.gnu.org
> From: Andrea Corallo <akrl@HIDDEN>
> Date: Wed, 21 Sep 2022 19:26:08 +0000
> 
> Okay, I think then is a good idea to guard against the NULL pointer
> potentially returned, OTOH we do it already in the rest of the code.
> 
> I'm only not sure if we should signal an error or not here.

No, we shouldn't, IMO.  We should just behave as if the *.eln files
were unavailable, perhaps with some message logged in *Messages*.
Signaling an error would be shooting the user in his/her foot, because
loading of *.eln files is attempted as part of routine operation, so
signaling an error will prevent the user from being able to invoke
many commands.




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

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


Received: (at 57880) by debbugs.gnu.org; 22 Sep 2022 06:36:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 22 02:36:13 2022
Received: from localhost ([127.0.0.1]:35967 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1obFoj-0007g2-9f
	for submit <at> debbugs.gnu.org; Thu, 22 Sep 2022 02:36:13 -0400
Received: from eggs.gnu.org ([209.51.188.92]:37444)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1obFog-0007fo-QX
 for 57880 <at> debbugs.gnu.org; Thu, 22 Sep 2022 02:36:11 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:52904)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1obFoa-0001sa-Uw; Thu, 22 Sep 2022 02:36:05 -0400
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=fgiqPPaGUBp5QiCAY1K2x8V13HKC3E9kig8nO7s4qf8=; b=eUiu90J7hlyC
 Q+2ovrCpGh1UOP9proG4t9z0UfD1nvkueETsGEQRDLEDCebTkepie+n0e+rALnPWJZsZlK5EpHoja
 3bZnH+yTEqIPTD4c1pHYGD4OPAIXQC5Vra4o0As1sJoLoQOs9+KQVnldfw1Xb3CjXe5z1/sVtiFHe
 l8wq24l7pZiuu3NEQSaZAC5glcHgbyHTgFf6d0HCBzHQFet9LJPiJElMVzr9QRSyJj+IaXGSZvVT2
 ptlqW2zECTMA+xfZQKpxGe1h91Lf/Bc6EHShcnVOW87v4ar0wb9lB2rx2+uYzUHtYoWOfDlbx37kA
 1FnCW6hH838G1Mf4ySPpGQ==;
Received: from [87.69.77.57] (port=1968 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1obFoZ-00028e-81; Thu, 22 Sep 2022 02:36:04 -0400
Date: Thu, 22 Sep 2022 09:36:14 +0300
Message-Id: <83czbnud9d.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ioannis Kappas <ioannis.kappas@HIDDEN>
In-Reply-To: <CAMRHuGC-c5nK5zM=XL+skSMdYb9mf737ePB69w4OCvNcz6zzRw@HIDDEN>
 (message from Ioannis Kappas on Wed, 21 Sep 2022 18:19:11 +0100)
Subject: Re: bug#57880: 28.1; Emacs crashes with native compilation on when
 some antivirus program is running on MS-Windows
References: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
 <xjfk05zbx3e.fsf@HIDDEN>
 <CAMRHuGBt_+GacqKYp-Cddk+-H1oxydoHsekkF-GqBRuhGK5w7A@HIDDEN>
 <83o7v9ugv2.fsf@HIDDEN>
 <CAMRHuGC-c5nK5zM=XL+skSMdYb9mf737ePB69w4OCvNcz6zzRw@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57880
Cc: 57880 <at> debbugs.gnu.org, 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 (---)

> From: Ioannis Kappas <ioannis.kappas@HIDDEN>
> Date: Wed, 21 Sep 2022 18:19:11 +0100
> Cc: akrl@HIDDEN, 57880 <at> debbugs.gnu.org
> 
> On Wed, Sep 21, 2022 at 12:06 PM Eli Zaretskii <eliz@HIDDEN> wrote:
> 
> > What would be the purpose of using Emacs with native-compilation on
> > such a system?   Users who must cope with such antivirus programs will
> > need to use Emacs without native-compilation.  I see no good reason to
> > prevent Emacs from crashing, since those *.eln files cannot be used
> > anyway, and we will just have a slowed-down Emacs without
> > native-compilation.  Right?  Or did I miss something?
> 
> A user who experience this issue for the first time and had Emacs crash,
> would have no indication whatsoever what hit them, i.e. they wouldn't
> know how to
> react. Thus my suggestion for checking for the NULL pointer in
> unload comp, so that they at least see the error message about
> the .eln files being inconsistent and research ways to go around it.

How can an average user go about researching this?  They'd need a
debugger, a binary with debug info, and probably also a way of
compiling Emacs.  That doesn't sound like a typical Windows user to
me.

When Emacs crashes, they will report a bug, or ask on some forum.  We
can have this issue and its solutions described in PROBLEMS, so we
could point them to that place.  We could even mention this in the
README that accompanies the Windows binaries (if we believe users
actually read that).  One way or another, if this issue happens
frequently, the information will spread widely enough for people to be
able to find it by a simple Internet search.

Btw, which antivirus software have this "feature"?  If it's widely
used, perhaps the "official" Emacs binaries should not be distributed
with native-compilation enabled at all?

> And I can see two ways going forward:
> 1. Take a step back and switch off native compilation (but how to do this
> other than recompiling Emacs?)
> 2. Stil use native compilation but change the destination .eln directory
>   to a safer path, so that they can still rip the benefit. I'd expect the AV
> only have a limited set of dirs preventing GetProcAddress of
> operating, otherwise nothing would work.

Why does the directory where the *.eln files live matter?  Doesn't the
antivirus software check any loading of any DLL from anywhere on the
system?

In any case, the *.eln files have at least two places on any system,
and only one of them can be changed, the other one is fixed by the
build.




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

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


Received: (at 57880) by debbugs.gnu.org; 21 Sep 2022 19:26:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 21 15:26:11 2022
Received: from localhost ([127.0.0.1]:35266 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ob5MI-0002gZ-OX
	for submit <at> debbugs.gnu.org; Wed, 21 Sep 2022 15:26:11 -0400
Received: from mx.sdf.org ([205.166.94.24]:64684)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1ob5MH-0002gR-9k
 for 57880 <at> debbugs.gnu.org; Wed, 21 Sep 2022 15:26:10 -0400
Received: from ma.sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 28LJQ8Xc019133
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Wed, 21 Sep 2022 19:26:08 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Ioannis Kappas <ioannis.kappas@HIDDEN>
Subject: Re: bug#57880: 28.1; Emacs crashes with native compilation on when
 some antivirus program is running on MS-Windows
In-Reply-To: <CAMRHuGBt_+GacqKYp-Cddk+-H1oxydoHsekkF-GqBRuhGK5w7A@HIDDEN>
 (Ioannis Kappas's message of "Tue, 20 Sep 2022 17:43:10 +0100")
References: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
 <xjfk05zbx3e.fsf@HIDDEN>
 <CAMRHuGBt_+GacqKYp-Cddk+-H1oxydoHsekkF-GqBRuhGK5w7A@HIDDEN>
Date: Wed, 21 Sep 2022 19:26:08 +0000
Message-ID: <xjfa66sbkbz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57880
Cc: 57880 <at> debbugs.gnu.org
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 (-)

Ioannis Kappas <ioannis.kappas@HIDDEN> writes:

> Hi Andrea,
> On Mon, Sep 19, 2022 at 9:14 AM Andrea Corallo <akrl@HIDDEN> wrote:
>
>> I'm not sure I understand why the issue is only in 'unload_comp_unit'
>> and not in all the other places where we use and rely on 'dynlib_sym'
>> (ex in 'make_subr').
>
> It is because `make_subr', or any of other relevant fns, is not given a
> chance to execute. The eln file is loaded fine, but the search for the
> COMP_UNIT_SYM'bol in the eln is unsuccessful (due to AV interference),
> the file is considered invalid, and the only path left to take is to unload it.
>
>
>> Also I've a question (no windows expert here), can GetProcAddress return
>> NULL?
>
> Yes, as per https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getprocaddress:
>
>   Return value
>
>   If the function succeeds, the return value is the address of the
> exported function or variable.
>
>   If the function fails, the return value is NULL. To get extended
> error information, call GetLastError.

Okay, I think then is a good idea to guard against the NULL pointer
potentially returned, OTOH we do it already in the rest of the code.

I'm only not sure if we should signal an error or not here.

  Andrea




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

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


Received: (at 57880) by debbugs.gnu.org; 21 Sep 2022 17:19:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 21 13:19:30 2022
Received: from localhost ([127.0.0.1]:35157 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ob3Ni-0007xs-II
	for submit <at> debbugs.gnu.org; Wed, 21 Sep 2022 13:19:30 -0400
Received: from mail-wm1-f46.google.com ([209.85.128.46]:54029)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ioannis.kappas@HIDDEN>) id 1ob3Ng-0007xe-Gf
 for 57880 <at> debbugs.gnu.org; Wed, 21 Sep 2022 13:19:28 -0400
Received: by mail-wm1-f46.google.com with SMTP id e18so4958295wmq.3
 for <57880 <at> debbugs.gnu.org>; Wed, 21 Sep 2022 10:19:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date;
 bh=HCTV1KrPJkyd7eHs8Hg4ZFiSxv0Ycvor/pWWOeG0RoY=;
 b=RZv4eKxzfCaEvJ0/ak0gwRYOxSB73k7WnAsYQsO9/j+cBJ1AM5DLZJcMZ+TD8pm48J
 5mP+j1IgJa2Mjv8TIc23vvmpA6f4J/PfR1L25FMW4RzU7+nVuaPUtt0NTf0zI/9SNMIq
 Xk0HGHLuls/rOk1yZ1ypFcWUvrwZYT4H1Li+clidNiAIlwY/RvGsngvthbmFvHAtzPMo
 j9uGCwt8v5TXTuQanFh+iSsKWMgJkdzruqHE6WSdHW4hqGeSpqY8WnYnP/VEm0QSwl/U
 ZCzKCwLlhYmVa/LJLS5/Tf1vVZD5JzL1aSNZGs04hsqtW7Mh52mA73cBqwEOtpS+Hnrw
 Wvsw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date;
 bh=HCTV1KrPJkyd7eHs8Hg4ZFiSxv0Ycvor/pWWOeG0RoY=;
 b=2kIqOczPwgzZLfHKSdUBbXuArB/iOejQAV3CnW7oj+X7wta3wy4LZcyZfNXVOGYscZ
 HWp0POk+v+0Wl9PGECO8/5TxQmOVtPt4AfkiJX514AxpvoJjZrNrtXntsSRfampc6lcL
 5AqKBDEPbSCIujTQASF2im7OZkgr6qajTgpEljrQQaWhK4o813b2ohKA50EeW1epJ9fW
 ykFP8alwoSYH9ns8PyObnv/ns/U2uWFoEIr8LD7n4Sw8rTaMuy9dJIIDj4ozhj9FqdPt
 JkaH7sCFXTgmdrPKMLuNfJgVSlPuKfBZ0eNy8/Q+ppRy0p7g9c8/8gEiZHgYesbdf0HX
 yQxQ==
X-Gm-Message-State: ACrzQf0b/axPgX5o3t5JDVBPHJ68fTCesdDUt3iej294uQCATGKiYNaO
 EaKRddAfUizaT9wxefuPSZ3SGwa7tPKEC1ETdYc=
X-Google-Smtp-Source: AMsMyM7kTq83RfRPJivDXQqF2kgVhw6fxKz/k0ufJVrfTt3A+UGMJdKZ7XjTRadUGuCfzLoDf8DG5LGrQTnbxwOBXGg=
X-Received: by 2002:a05:600c:b42:b0:3b4:7580:a995 with SMTP id
 k2-20020a05600c0b4200b003b47580a995mr6824642wmr.30.1663780762418; Wed, 21 Sep
 2022 10:19:22 -0700 (PDT)
MIME-Version: 1.0
References: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
 <xjfk05zbx3e.fsf@HIDDEN>
 <CAMRHuGBt_+GacqKYp-Cddk+-H1oxydoHsekkF-GqBRuhGK5w7A@HIDDEN>
 <83o7v9ugv2.fsf@HIDDEN>
In-Reply-To: <83o7v9ugv2.fsf@HIDDEN>
From: Ioannis Kappas <ioannis.kappas@HIDDEN>
Date: Wed, 21 Sep 2022 18:19:11 +0100
Message-ID: <CAMRHuGC-c5nK5zM=XL+skSMdYb9mf737ePB69w4OCvNcz6zzRw@HIDDEN>
Subject: Re: bug#57880: 28.1; Emacs crashes with native compilation on when
 some antivirus program is running on MS-Windows
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57880
Cc: 57880 <at> debbugs.gnu.org, 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 (-)

Hi Eli,

On Wed, Sep 21, 2022 at 12:06 PM Eli Zaretskii <eliz@HIDDEN> wrote:

> What would be the purpose of using Emacs with native-compilation on
> such a system?   Users who must cope with such antivirus programs will
> need to use Emacs without native-compilation.  I see no good reason to
> prevent Emacs from crashing, since those *.eln files cannot be used
> anyway, and we will just have a slowed-down Emacs without
> native-compilation.  Right?  Or did I miss something?

A user who experience this issue for the first time and had Emacs crash,
would have no indication whatsoever what hit them, i.e. they wouldn't
know how to
react. Thus my suggestion for checking for the NULL pointer in
unload comp, so that they at least see the error message about
the .eln files being inconsistent and research ways to go around it.

And I can see two ways going forward:
1. Take a step back and switch off native compilation (but how to do this
other than recompiling Emacs?)
2. Stil use native compilation but change the destination .eln directory
  to a safer path, so that they can still rip the benefit. I'd expect the AV
only have a limited set of dirs preventing GetProcAddress of
operating, otherwise nothing would work.

Thanks




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

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


Received: (at 57880) by debbugs.gnu.org; 21 Sep 2022 11:06:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 21 07:06:26 2022
Received: from localhost ([127.0.0.1]:60845 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oaxYg-0005kQ-MJ
	for submit <at> debbugs.gnu.org; Wed, 21 Sep 2022 07:06:26 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48160)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oaxYc-0005kA-5D
 for 57880 <at> debbugs.gnu.org; Wed, 21 Sep 2022 07:06:24 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:48360)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oaxYV-0000kP-CX; Wed, 21 Sep 2022 07:06:16 -0400
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=70wNezovzD7SWfZqIh7NY0PSSci+L0k2hkUF77r2/fY=; b=jdyKmdv+16aH
 ZG6Esv1Ed6KI00FLaojdOqK5fF+6UF1ChoM8y37EgP3EN2vQfUgHyT/54HjRPUa5bNcAviKmLKHDo
 w+ysPMeJCyea8oFI4QWAc2Q1EXabxTpF8tsveZWyo9IotbX/l5AyBL+lGK2WdtvYkIPm/zrKtlsA+
 WwoYXmtV0BFJebtjcjUzO7jzOPgd3ReVDFLty96Hklb/DKCAwbYuB2NCazGBKY3TMZW+urB4hIvNN
 D8dURS15GWH3HfaWQAUYrsa9C3xIj4ZAzaKkGP1ZqX46RFWyObTMBZaV1KEOBFvjbu5xYdD4lU6ZO
 hzXGsbB4sW1/XSPcBYzv9A==;
Received: from [87.69.77.57] (port=1635 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oaxYH-0000zP-9q; Wed, 21 Sep 2022 07:06:13 -0400
Date: Wed, 21 Sep 2022 14:06:09 +0300
Message-Id: <83o7v9ugv2.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ioannis Kappas <ioannis.kappas@HIDDEN>
In-Reply-To: <CAMRHuGBt_+GacqKYp-Cddk+-H1oxydoHsekkF-GqBRuhGK5w7A@HIDDEN>
 (message from Ioannis Kappas on Tue, 20 Sep 2022 17:43:10 +0100)
Subject: Re: bug#57880: 28.1;
 Emacs crashes with native compilation on when some antivirus program
 is running on MS-Windows
References: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
 <xjfk05zbx3e.fsf@HIDDEN>
 <CAMRHuGBt_+GacqKYp-Cddk+-H1oxydoHsekkF-GqBRuhGK5w7A@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57880
Cc: 57880 <at> debbugs.gnu.org, 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: 57880 <at> debbugs.gnu.org
> From: Ioannis Kappas <ioannis.kappas@HIDDEN>
> Date: Tue, 20 Sep 2022 17:43:10 +0100
> 
> Hi Andrea,
> On Mon, Sep 19, 2022 at 9:14 AM Andrea Corallo <akrl@HIDDEN> wrote:
> 
> > I'm not sure I understand why the issue is only in 'unload_comp_unit'
> > and not in all the other places where we use and rely on 'dynlib_sym'
> > (ex in 'make_subr').
> 
> It is because `make_subr', or any of other relevant fns, is not given a
> chance to execute. The eln file is loaded fine, but the search for the
> COMP_UNIT_SYM'bol in the eln is unsuccessful (due to AV interference),
> the file is considered invalid, and the only path left to take is to unload it.

What would be the purpose of using Emacs with native-compilation on
such a system?  Users who must cope with such antivirus programs will
need to use Emacs without native-compilation.  I see no good reason to
prevent Emacs from crashing, since those *.eln files cannot be used
anyway, and we will just have a slowed-down Emacs without
native-compilation.  Right?  Or did I miss something?




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

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


Received: (at 57880) by debbugs.gnu.org; 20 Sep 2022 16:43:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 20 12:43:25 2022
Received: from localhost ([127.0.0.1]:59483 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oagLE-0001qf-Q3
	for submit <at> debbugs.gnu.org; Tue, 20 Sep 2022 12:43:25 -0400
Received: from mail-wr1-f44.google.com ([209.85.221.44]:36823)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ioannis.kappas@HIDDEN>) id 1oagLD-0001qU-SL
 for 57880 <at> debbugs.gnu.org; Tue, 20 Sep 2022 12:43:24 -0400
Received: by mail-wr1-f44.google.com with SMTP id y5so5296130wrh.3
 for <57880 <at> debbugs.gnu.org>; Tue, 20 Sep 2022 09:43:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date;
 bh=Mda3YpdCtz0y7vcUo2p+CJKWbg/DQ3inG3b/SFsnaKM=;
 b=ZyWVdm6YS9+NY9FX0pOwx09DrwFRf1n+Ub2/DSN+aTa78HS7LvIwM+GtzhBaZdr1/j
 2jEedffX5yb+DfLMCb80RKeK53TIJDRExOGIa1mVgjKG7KFZLu5CFP4BPU7tmitGtQcb
 UUDJrAzECukBJ3rTp8ZIWeMON2WXFbELzrqgpjaK4vKuoZzF+ErmyuqccCRwoE2k3r2U
 WfM/Ub9+e8ruKgHzkwc5NA45MlA34ye2fTKRRDLvsIwsyB7LQK1IORIeh9r+X6hA0Ngj
 hb8O8rr4KsB85p9ylzxJXhrQE/gc9KP1YGWJ2muU5qrRTyFaO0sh8OrBG95GmACNyZxW
 TOYQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date;
 bh=Mda3YpdCtz0y7vcUo2p+CJKWbg/DQ3inG3b/SFsnaKM=;
 b=r6192qc/mpLKkPCqSMq39Zwe9Qzd6GKdPqncQuccjkr3OXbOPz4mwsRI0ESa8U/J7S
 YaTu3Ykl/ZJmc5l9yVHKCNkUw/LYUadDi4yxf23JHjrF2GdlSjr/keqlW2HwoUK2k8FU
 HiJguVvrypqqLq41wY4LvBl4Q5EeKeTAo+N8UxD7uzI5wp0iFy75pw5pmQzJpDKIrkyt
 nnTZbhxf+P7HT11WGsnGPpolLmlHvSKPEEMsDZZnVQt4uEtH1hTTZjtwNHbdqaHsytRK
 pMVZ//doR2GDPKloHLNMIPBJStF8pK38aB2B7nJjibYhyBuUpOJW/OJGPKLkXNC+8ekH
 lrSA==
X-Gm-Message-State: ACrzQf0mg/u3A+UInkpbD107AozCZ108rIDR5DJTt6on33dwiYcPccV0
 1AzLH6P8NUB6eSoTFlVGrqGnpOlwMQZpA99w57Kz0CQ+nwnSzA==
X-Google-Smtp-Source: AMsMyM42d76etKtUchYqDZsJ+4/acMTSBGnMYe0IqEGKB29z0xb8IDs2865QfhpeMw0ZyqfMDgucRwoszHyCMfsmMOw=
X-Received: by 2002:adf:eb50:0:b0:21e:3d13:3a91 with SMTP id
 u16-20020adfeb50000000b0021e3d133a91mr14161227wrn.484.1663692198106; Tue, 20
 Sep 2022 09:43:18 -0700 (PDT)
MIME-Version: 1.0
References: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
 <xjfk05zbx3e.fsf@HIDDEN>
In-Reply-To: <xjfk05zbx3e.fsf@HIDDEN>
From: Ioannis Kappas <ioannis.kappas@HIDDEN>
Date: Tue, 20 Sep 2022 17:43:10 +0100
Message-ID: <CAMRHuGBt_+GacqKYp-Cddk+-H1oxydoHsekkF-GqBRuhGK5w7A@HIDDEN>
Subject: Re: bug#57880: 28.1; Emacs crashes with native compilation on when
 some antivirus program is running on MS-Windows
To: Andrea Corallo <akrl@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57880
Cc: 57880 <at> debbugs.gnu.org
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 (-)

Hi Andrea,
On Mon, Sep 19, 2022 at 9:14 AM Andrea Corallo <akrl@HIDDEN> wrote:

> I'm not sure I understand why the issue is only in 'unload_comp_unit'
> and not in all the other places where we use and rely on 'dynlib_sym'
> (ex in 'make_subr').

It is because `make_subr', or any of other relevant fns, is not given a
chance to execute. The eln file is loaded fine, but the search for the
COMP_UNIT_SYM'bol in the eln is unsuccessful (due to AV interference),
the file is considered invalid, and the only path left to take is to unload it.


> Also I've a question (no windows expert here), can GetProcAddress return
> NULL?

Yes, as per https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getprocaddress:

  Return value

  If the function succeeds, the return value is the address of the
exported function or variable.

  If the function fails, the return value is NULL. To get extended
error information, call GetLastError.


I've also noticed another more surgical way to redirect the .eln cache
elsewhere, though is only available on the 29 branch:

;; in early-init.el
(when (> emacs-major-version 28)
  (startup-redirect-eln-cache "/to/a/safe/haven"))

Thanks




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

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


Received: (at 57880) by debbugs.gnu.org; 19 Sep 2022 08:14:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 19 04:14:29 2022
Received: from localhost ([127.0.0.1]:52265 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oaBvB-00085f-5a
	for submit <at> debbugs.gnu.org; Mon, 19 Sep 2022 04:14:29 -0400
Received: from mx.sdf.org ([205.166.94.24]:58194)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <akrl@HIDDEN>) id 1oaBv5-00085R-QK
 for 57880 <at> debbugs.gnu.org; Mon, 19 Sep 2022 04:14:27 -0400
Received: from ma.sdf.org (ma.sdf.org [205.166.94.33])
 by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 28J8Df5d029443
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO);
 Mon, 19 Sep 2022 08:14:21 GMT
From: Andrea Corallo <akrl@HIDDEN>
To: Ioannis Kappas <ioannis.kappas@HIDDEN>
Subject: Re: bug#57880: 28.1; Emacs crashes with native compilation on when
 some antivirus program is running on MS-Windows
In-Reply-To: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
 (Ioannis Kappas's message of "Sat, 17 Sep 2022 12:14:36 +0100")
References: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
Date: Mon, 19 Sep 2022 08:13:41 +0000
Message-ID: <xjfk05zbx3e.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57880
Cc: 57880 <at> debbugs.gnu.org
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 (-)

Ioannis Kappas <ioannis.kappas@HIDDEN> writes:

> Hi,
>
> there appears to be an issue with native compilation and some
> antivirus programs on MS-Windows that could cause Emacs to crash.
>
> This can happen when the antivirus program rewires GetProcAddress
> system fn to return NULL on a call to get the address of an exported
> variable/function, of which native compilation makes use of to
> identify features of the compiled code.
>
> I can't think of any straightforward instructions to reproduce the
> issue without such antivirus programs running, but the crash happens
> when an .el file has been compiled and the native code is partially
> loaded and then there is an attempt to unload it with the
> unload_comp_unit fn below

Hi Ioannis,

I'm not sure I understand why the issue is only in 'unload_comp_unit'
and not in all the other places where we use and rely on 'dynlib_sym'
(ex in 'make_subr').

Also I've a question (no windows expert here), can GetProcAddress return
NULL?

Thanks

  Andrea




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

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


Received: (at submit) by debbugs.gnu.org; 17 Sep 2022 11:14:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 17 07:14:56 2022
Received: from localhost ([127.0.0.1]:45249 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oZVmi-0005do-9d
	for submit <at> debbugs.gnu.org; Sat, 17 Sep 2022 07:14:56 -0400
Received: from lists.gnu.org ([209.51.188.17]:58250)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ioannis.kappas@HIDDEN>) id 1oZVmg-0005dg-26
 for submit <at> debbugs.gnu.org; Sat, 17 Sep 2022 07:14:54 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:44050)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ioannis.kappas@HIDDEN>)
 id 1oZVmf-0001ZC-S0
 for bug-gnu-emacs@HIDDEN; Sat, 17 Sep 2022 07:14:53 -0400
Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:36719)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <ioannis.kappas@HIDDEN>)
 id 1oZVmd-00057K-R1
 for bug-gnu-emacs@HIDDEN; Sat, 17 Sep 2022 07:14:53 -0400
Received: by mail-wr1-x435.google.com with SMTP id h8so32916621wrf.3
 for <bug-gnu-emacs@HIDDEN>; Sat, 17 Sep 2022 04:14:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date; bh=+lD7gCODj6rQrMXTbb4jWn0bEQ0AL7K5L9/90ogW+nM=;
 b=ahjswAG07TGpUA2/YrktI7JM8/DrfnssM9JuwHTIciXwcOqGKZQVKEVLKh5A97zAzq
 Gg8h8UpyiSZsmggpvWXixzp/4sOp6Xu5Nuj96TM44u3ocFnhR+gGW8yXPDLyKkkdPmRz
 EbrmWotgvQ5cxVCFhwc8oecAk+jfmzaR0ktAd2ezhTiHWgpK+h2gKYbz7evcETnHS2GI
 7pfJHoru7FmfZMZ9yid/3Yvc44ux0EbCTQSeWJt7f30RlRsbf1P0hqRziiT/B5LZhpzD
 V1r44qDZbZ5yHQkFpM7UspMvZiwN7c7AaiND4CoGNZLoMp+pSqFoRzxhtmDKGxo5jCtt
 10YQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date;
 bh=+lD7gCODj6rQrMXTbb4jWn0bEQ0AL7K5L9/90ogW+nM=;
 b=xZbAIC3pJ/p4XWyRrjlB8vf6+vddhNh4GB/UQ2Ypz2YeeFBIyy0YpEwBc59H6f0KC9
 KxbJ23bQVhiwaYsXgXokQy285Yh8vlcXqJAaYoskbF3IRM/orgQ1Pg8V/UoK6w7QrAia
 /R1JiIPRD6Mi+rL5B5S2A3JcLCssQi+LkUs565airzM6hAI7hXviptWaCj5YLYPIpSrt
 /5HpE+G8dXbg+hHrOUZWFwfE0otlOx4PoeJDr2RFJoUD/rpet5MPUzFFRUi/lnoP+DJk
 lW4moi75kJgvwkSh4xgTh8mdyaDEPDiOgqZQuA5sC+rQO3UOtOnyUrChWPu5DIxulnJz
 J7fA==
X-Gm-Message-State: ACrzQf23HDhxfwg6prlyPeHqK5gWJxsrHrByn/tWqEzVCLjkC2lpbuvU
 WIvslbvPnWJ2uddn5RJAwKp7eeJn28T7jxcqveqNJ1Hnwt8=
X-Google-Smtp-Source: AMsMyM5eANrc7GfpjyegwTP5QRNg8BefJBOxZPSzk56sTibXmCuKXcqsE2NIejt/7WTdaHl0/cEPN32CMHTep8NRFkI=
X-Received: by 2002:adf:d1c6:0:b0:228:dff6:77b8 with SMTP id
 b6-20020adfd1c6000000b00228dff677b8mr5582354wrd.115.1663413287723; Sat, 17
 Sep 2022 04:14:47 -0700 (PDT)
MIME-Version: 1.0
From: Ioannis Kappas <ioannis.kappas@HIDDEN>
Date: Sat, 17 Sep 2022 12:14:36 +0100
Message-ID: <CAMRHuGBEaOvfhc9nVwKnHHh+vnt8ikVz2zjE7WchmTZtwXsSxg@HIDDEN>
Subject: 28.1; Emacs crashes with native compilation on when some antivirus
 program is running on MS-Windows
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=2a00:1450:4864:20::435;
 envelope-from=ioannis.kappas@HIDDEN; helo=mail-wr1-x435.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hi,

there appears to be an issue with native compilation and some
antivirus programs on MS-Windows that could cause Emacs to crash.

This can happen when the antivirus program rewires GetProcAddress
system fn to return NULL on a call to get the address of an exported
variable/function, of which native compilation makes use of to
identify features of the compiled code.

I can't think of any straightforward instructions to reproduce the
issue without such antivirus programs running, but the crash happens
when an .el file has been compiled and the native code is partially
loaded and then there is an attempt to unload it with the
unload_comp_unit fn below

src/comp.c:
void
unload_comp_unit (struct Lisp_Native_Comp_Unit *cu)
{
  if (cu->handle == NULL)
    return;

  Lisp_Object *saved_cu = dynlib_sym (cu->handle, COMP_UNIT_SYM);
  Lisp_Object this_cu;
  XSETNATIVE_COMP_UNIT (this_cu, cu);
  if (EQ (this_cu, *saved_cu))
    *saved_cu = Qnil;
  dynlib_close (cu->handle);
}

saved_cu is returned as NULL and the program crashes without an
indication what has might have gone wrong.

I suppose a partial fix to avoid the crash (which seems good to have
regardless of antivirus interference), would be to check for NULL
pointer

void
unload_comp_unit (struct Lisp_Native_Comp_Unit *cu)
{
  if (cu->handle == NULL)
    return;

  Lisp_Object *saved_cu = dynlib_sym (cu->handle, COMP_UNIT_SYM);
  if (saved_cu)
    {
      Lisp_Object this_cu;
      XSETNATIVE_COMP_UNIT (this_cu, cu);
      if (EQ (this_cu, *saved_cu))
*saved_cu = Qnil;
    }
  dynlib_close (cu->handle);
}

Not sure if there is much we can do to circumvent the antivirus
restrictions? This at least also affects dynamically loaded modules
from loading  (but Emacs doesn't crash here, just displays the
misleading "module is not GPL compatible" warning), since it employs
the same technique to check if modules are GPL compatible

DEFUN ("module-load", Fmodule_load, Smodule_load, 1, 1, 0,
       doc: /* Load module FILE.  */)
  (Lisp_Object file)
{
  dynlib_handle_ptr handle;
  emacs_init_function module_init;
  void *gpl_sym;

  CHECK_STRING (file);
  handle = dynlib_open (SSDATA (file));
  if (!handle)
    xsignal2 (Qmodule_open_failed, file, build_string (dynlib_error ()));

  gpl_sym = dynlib_sym (handle, "plugin_is_GPL_compatible");
  if (!gpl_sym)
    xsignal1 (Qmodule_not_gpl_compatible, file);

// ...
}

In some situations (or perhaps in most?), the antivirus only applies
these restrictions to dll/eln files loaded from certain directories,
such as the user home directory starting at c:\Users. In that case, it
is possible to use the XDG_CONFIG_HOME path to set the user directory
(where the .eln files are generated at) to another, unrestricted,
location:

> mkdir c:\xdg-config\emacs
> set XDG_CONFIG_HOME=c:\xdg-config
> emacs

and then check that the above has taken effect with C-h v  user-emacs-directory.

(For XDG_CONFIG_HOME to work properly, ~/.emacs.d should not exist,
see https://www.gnu.org/software/emacs/manual/html_node/emacs/Find-Init.html
)

Thanks




Acknowledgement sent to Ioannis Kappas <ioannis.kappas@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#57880; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 22 Sep 2022 08:15:01 UTC

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