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

From: Ioannis Kappas <[email-masked]>
Date: Thu, 22 Sep 2022 21:46:14 +0100

Hi Eli,

On Thu, Sep 22, 2022 at 9:26 AM Eli Zaretskii <[email-masked]> wrote:

> > 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.
>
> There is one already.

Are you referring to an option for building form source? I couldn't
find an option
to turn off native compile for the precompiled windows binaries (such as those
retrieved from the official ftp site or from msys2 pacman) that can configured
to disable native comp.

> > > 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.
>
> Is that known, or is this just a guess?

This is an educated guess. The only facts are that
(1) Emacs crashes the moment it tries to read .eln files from the
  c:/Users/* directory,
(2) throws an "emacs module is not GPL compatible" error when
loading native modules from the same dir.
(3) and these are all side effect of trying to use GetProcAddress on a
 dll/eln file residing in the C:/Users/* dir. Both (1) and (2) work otherwise.

> Also, I asked which AV software has this problem.  Do you happen to
> know?

Here is an old article that I found published by the AV maker in question,
referring to how most of windows viruses use GetProcAddress

https://community.broadcom.com/symantecenterprise/viewdocument/fighting-epo-viruses

"""... . Most Windows viruses use the GetProcAddress API to obtain
needed API addresses for their future execution ... """

and I believe this the reasons why they try to restrict its use in the User's
directory, where it is unusual for mainstream programs to be installed,
as per your comment below.

>
> Anyway, programs are not normally installed under C:\Users, they are
> installed under C:\Program Files.

Correct, and I believe the AV exploits this, so that it puts stricter
controls on
the Users dir.

> > 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.
>
> This means that the problem will only affect people who have libgccjit
> and GCC/Binutils installed, because otherwise Emacs will be unable to
> compile new *.eln files.  Right?

Yes, since I understand Emacs won't be able to generate any new .eln files
without access to libgccjit.

Thanks