Subject: Re: bug#57880: 28.1; Emacs crashes with native compilation on when some antivirus program is running on MS-Windows

From: Eli Zaretskii <[email-masked]>
Date: Thu, 22 Sep 2022 09:36:14 +0300

> From: Ioannis Kappas <[email-masked]>
> Date: Wed, 21 Sep 2022 18:19:11 +0100
> Cc: [email-masked], [email-masked]
> 
> On Wed, Sep 21, 2022 at 12:06 PM Eli Zaretskii <[email-masked]> 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.