emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MPS codegen


From: Eli Zaretskii
Subject: Re: MPS codegen
Date: Sat, 15 Jun 2024 10:34:43 +0300

> From: Gerd Möllmann <gerd.moellmann@gmail.com>
> Cc: eller.helmut@gmail.com,  acorallo@gnu.org,  emacs-devel@gnu.org
> Date: Sat, 15 Jun 2024 09:10:42 +0200
> 
> >> Pdumper can use, among other methods, mmap'd files. In that case
> >> munmap'ing could write changes back to disk. So pdumper rather marks the
> >> region as not needed. At least that's how I understand it.
> >
> > But it doesn't protect the region from being accessed, AFAIU.  By
> > contrast, on MS-Windows we do this:
> >
> >       (void) VirtualProtect (mem, size, PAGE_NOACCESS, &old_prot);
> >
> > which will then cause an access violation if any address within the
> > region is accessed in any way (read or write).  If you do the same
> > with mmap and PROT_NONE, does the build still work and does the built
> > Emacs succeed to start?
> 
> I'd rather if you comment out the discard_dump in igc.c, in mirror_dump
> and see if that's the problem.

And if disabling that eliminates the segfault, what will we do then?

IMO, getting Emacs to segfault on all systems due to access to the
discarded pdumper memory is the way forward: it allows all of us
(rather than just me) investigate the invalid access and fix it.

> The fwd causing the problem should point to Emacs' data segment, not
> the dump. The variable is a DEFVAR_BOOL.

Sorry, I don't understand what you mean here.  If I can help by
providing some information from my build here, please elaborate.

> > Note that originally pdumper.c called dump_discard_mem only for
> > sections considered discardable:
> >
> >   sections[DS_DISCARDABLE].spec = (struct dump_memory_map_spec)
> >     {
> >      .fd = dump_fd,
> >      .size = header->cold_start - adj_discardable_start,
> >      .offset = adj_discardable_start,
> >      .protection = DUMP_MEMORY_ACCESS_READWRITE,
> >     };
> >   [...]
> >   dump_mmap_discard_contents (&sections[DS_DISCARDABLE]);
> >
> > Whereas the code in igc.c seems to discard all of the memory loaded
> > from the pdumper file, or am I missing something?
> 
> It's the hot section that igc discards. The pdumper can only discard the
> relocs which are not longer needed once they have been processed. The
> theory is that it's no longer needed since we have made a copy.

Evidently, something was not done properly while copying, I guess?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]