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: Fri, 9 Sep 2016 12:59:16 -0700	[thread overview]
Message-ID: <3fe2aff8-d34e-afa3-a2bf-6e42394d7be6@cs.ucla.edu> (raw)
In-Reply-To: <83eg4sap3t.fsf@gnu.org>

On 09/09/2016 11:45 AM, Eli Zaretskii wrote:
> All of those data structures are memory allocated for Lisp objects and
> their supporting structures, with known structures, so we know exactly
> which pointers need fixing.

Of course. But it's not trivial to fix them. It can be done, but it will 
take code that will be hard to maintain portably.

> gmalloc is already implemented

Yes, and its problems are prompting this discussion. gmalloc was a fine 
design for the 1980s but is not now.

> If there are libc's out there that allow the application to define its
> own sbrk, then we could use that (we do on Windows).

The sbrk model is becoming less and less plausible.

> If not, gmalloc
> will be good enough for the temacs run; emacs will of course use the
> normal libc allocators.

This would give up on redumping, no? Plus, it assumes sbrk, which is 
backward-looking. POSIX has withdrawn support for sbrk and there is 
movement to deprecate it in C libraries due to security/robustness 
concerns. This is something we should encourage, not run away from.

> What is a "block" in this context? Surely, a data structure with
> linked pointers cannot be distributed between different "blocks",
> since a linker will not know how to fixup each address, because it
> doesn't understand the data structure.

It can be distributed between different "blocks", because we can tell 
the compiler and linker the data structure. Here's a quick example with 
two small "blocks" dX and dY (the actual code would differ, this is just 
a proof of concept):

   /* Simplified version of lisp.h.  */
   #include <stdint.h>
   typedef intptr_t Lisp_Object;
   enum { Lisp_Int0 = 2, Lisp_Cons = 3 /* ... */};
   #define make_number(n) (((n) << 2) + Lisp_Int0)
   #define TAG_PTR(tag, ptr) ((intptr_t) (ptr) + (tag))
   #define Qnil ((Lisp_Object) 0)
   struct Lisp_Cons { Lisp_Object car, cdr; };

   /* Define a statically-allocated pair x that is equal to (10).  */
   struct Lisp_Cons dX = { make_number (10), Qnil };
   #define x TAG_PTR (Lisp_Cons, &dX)

   /* Use x to build a statically-allocated list y that is equal to (5 
10).  */
   struct Lisp_Cons dY = { make_number (5), x };
   #define y TAG_PTR (Lisp_Cons, &dY)


> We won't be able to use them as just compilers and linkers. We will
> be using them for a job that is quite a bit more complex and
> different.

No, this sort of thing is something that compilers and linkers do all 
the time.






  reply	other threads:[~2016-09-09 19:59 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 [this message]
2016-09-10  6:06                                                   ` Eli Zaretskii
2016-09-10  7:52                                                     ` Paul Eggert
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=3fe2aff8-d34e-afa3-a2bf-6e42394d7be6@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).