unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: p.stephani2@gmail.com, philippe.vaucher@gmail.com, 23529@debbugs.gnu.org
Subject: bug#23529: Request for fixing randomize_va_space build issues
Date: Sat, 10 Sep 2016 00:52:33 -0700	[thread overview]
Message-ID: <34fb7c59-cf4a-fddf-98e7-fd4c25c3f395@cs.ucla.edu> (raw)
In-Reply-To: <83wpik8f18.fsf@gnu.org>

Eli Zaretskii wrote:

> I fail to see why it would be hard to maintain that portably.  Those
> data structures are entirely our design and implementatio

If it were *that* easy to do, the garbage collector would be doing it. It does 
not. It uses conservative collection, which is easier as it does not relocate 
pointers.

> temacs is not a program that needs to run for prolonged time
> intervals, its only purpose is to produce the data that the un-dumped
> Emacs will use.  So whether its malloc implementation is strong enough
> by today's standards is not a relevant question.  What matters is is
> it good enough for what temacs should do before it exits.

Fair enough. Still this hybrid-implementation approach, where the code uses one 
malloc implementation before dumping, and a different one after, is an extra 
complexity that makes it harder to understand and maintain Emacs. It would be 
better to remove this hack, and we should not be piling even more gingerbread 
atop it.

> we could have a variable that would force using the
> pre-dump malloc in emacs.

That would be still more complexity and state.

>> Plus, it assumes sbrk, which is backward-looking.
>
> What part assumes sbrk?

The current gmalloc implementation assumes the sbrk model, and operates poorly 
(if at all) when the underlying implementation uses address randomization. We 
are already at the edge of portability here; the fact that it works at all on 
modern GNU/Linux is a bit of an accident, requires mysterious tweaks 
occasionally at the C level, and there's no guarantee it will continue to work.

> we can still implement undump using a data
> file, but it will make our job slightly more complex, as we'd need to
> collect the data allocated off the heap before dumping it.  Not rocket
> science, either.

None of this is rocket science! But it is unnecessary complexity.

> But we don't do these things in our code, so how is this relevant to
> this discussion?

We do almost all of that example in our code already. Most of the example was 
taken from lisp.h (with some simplifications just for the example; the actual 
implementation would be based on the current lisp.h). The example demonstrates 
that compilers and linkers can relocate tagged Lisp pointers themselves, which 
means we don't have to do that ourselves.

> One example is string_blocks, which we
> use to maintain Lisp strings.  Surely, this structure will be in a
> single "block" under memory randomization, right?

That would be simpler, at least at first. But it's not the only possibility. For 
example, we could put each pure string in a separate block.






  reply	other threads:[~2016-09-10  7:52 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-13 12:18 bug#23529: Request for fixing randomize_va_space build issues Philippe Vaucher
2016-05-13 15:58 ` Paul Eggert
2016-05-17 16:38   ` Philippe Vaucher
2016-05-18  7:53     ` Philippe Vaucher
2016-05-18  8:21     ` Paul Eggert
2016-05-18  8:44       ` Philippe Vaucher
2016-05-20 17:52         ` Paul Eggert
2016-09-06  9:22           ` Philipp Stephani
2016-09-06 17:21             ` Paul Eggert
2016-09-06 17:40               ` Eli Zaretskii
2016-09-06 17:46                 ` Philippe Vaucher
2016-09-06 17:55                   ` Philipp Stephani
2016-09-06 18:04                     ` Eli Zaretskii
2016-09-06 17:59                   ` Eli Zaretskii
2016-09-06 18:03                     ` Philipp Stephani
2016-09-06 18:32                       ` Eli Zaretskii
2016-09-06 19:01                         ` Philipp Stephani
2016-09-06 18:24                     ` Philippe Vaucher
2016-09-06 19:11                       ` Eli Zaretskii
2016-09-06 18:18                 ` Clément Pit--Claudel
2016-09-06 19:09                   ` Eli Zaretskii
2016-09-06 19:59                     ` Clément Pit--Claudel
2016-09-06 18:44                 ` Paul Eggert
2016-09-06 19:18                   ` Eli Zaretskii
2016-09-06 20:37                     ` Paul Eggert
2016-09-07  7:12                       ` Philippe Vaucher
2016-09-07  7:40                         ` Paul Eggert
2016-09-07 11:01                           ` Philipp Stephani
2016-09-07 14:21                       ` Eli Zaretskii
2016-09-07 16:11                         ` Paul Eggert
2016-09-07 17:10                           ` Eli Zaretskii
2016-09-07 17:40                             ` Paul Eggert
2016-09-07 18:11                               ` Eli Zaretskii
2016-09-07 20:12                                 ` Paul Eggert
2016-09-09  5:40                                   ` Eli Zaretskii
2016-09-09  7:10                                     ` Paul Eggert
2016-09-09  7:50                                       ` Eli Zaretskii
2016-09-09  8:54                                         ` Paul Eggert
2016-09-09  9:09                                           ` Eli Zaretskii
2016-09-09 16:16                                             ` Paul Eggert
2016-09-09 18:45                                               ` Eli Zaretskii
2016-09-09 19:59                                                 ` Paul Eggert
2016-09-10  6:06                                                   ` Eli Zaretskii
2016-09-10  7:52                                                     ` Paul Eggert [this message]
2016-09-10 10:19                                                       ` Eli Zaretskii
2016-09-10 23:01                                                         ` Paul Eggert
2016-09-11 15:23                                                           ` Eli Zaretskii
2016-09-11 16:59                                                             ` Paul Eggert
2016-09-11 17:19                                                               ` Eli Zaretskii
2016-09-11 19:32                                                             ` Philippe Vaucher
2016-09-12  2:30                                                               ` Eli Zaretskii
2016-09-12  2:58                                                                 ` Clément Pit--Claudel
2016-09-12  6:09                                                                   ` Philipp Stephani
2016-09-12 17:04                                                                     ` Eli Zaretskii
2016-09-12 14:10                                                                 ` Philippe Vaucher
2016-09-12 14:18                                                                   ` Philippe Vaucher
2016-09-13 14:47                                                                     ` Eli Zaretskii
2016-09-13 15:21                                                                       ` Philippe Vaucher
2016-09-13 15:55                                                                         ` Eli Zaretskii
2016-09-13 15:51                                                                       ` Paul Eggert
2016-09-13 19:24                                                                         ` Eli Zaretskii
2016-09-09 20:00                                               ` Philippe Vaucher
2016-09-10  6:13                                                 ` Eli Zaretskii
2016-09-09 18:29                                     ` Andreas Schwab
2016-09-09 18:56                                       ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2019-09-14  4:18 bug#13964: " Stefan Kangas
2019-09-14  8:52 ` Philippe Vaucher
2019-09-14 10:39   ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34fb7c59-cf4a-fddf-98e7-fd4c25c3f395@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=23529@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=p.stephani2@gmail.com \
    --cc=philippe.vaucher@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).