This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ITA] _autorebase


On Dec 14 18:52, Achim Gratz wrote:
> Ken Brown writes:
> > I just noticed a couple of things about the base address.  First, you
> > have a typo in line 4 of rebaselst (missing 'd').
> 
> I'll fix that before the actual release.  Unless someone defines
> BaseAddress in the environment this doesn't poase a problem, though.
> 
> > Second, you use a default base address of 0x70000000 on both arches,
> > but rebaseall uses 0x400000000 on x86_64.
> 
> I haven't really seen why I'd need a different base address for x86_64
> and the past two years of me using that base address locally provide at
> least some justification.  I don't know where the values used in
> rebaseall came from, though, but I'm reasonably sure that they've been
> added to rebaseall after I've switched to rebaselst.  I don't mind
> changing it to the same value as rebaseall, based on the the
> architecture.  If anything that makes it easier to change the values
> should the need arise.

The change is required.  The base address 0x4:00000000 is a convention
which has been introduced to get reliable memory layout on x86_64.  All
of Cygwin's memory allocations, be it thread stack, executable and DLL
base addresses, heap address, or mmap's with NULL addresses, are chosen
so as not to collide with memory allocations chosen by the OS.  The OS
utilizes the lower 2GB 32 bit address space and the upper 0xff0:00000000
address space pretty much exclusively, and leaves everything in between
for the application.  Thus we developed the following convention, which
should be followed by every tool in the distro:

  0x000:00000000 - 0x000:7fffffff    Reserved for OS
  0x000:80000000 - 0x000:ffffffff    POSIX threads
  0x001:00000000 - 0x001:7fffffff    Process image
  0x001:80000000 - 0x001:ffffffff    Cygwin DLL w/ all shared data
  0x002:00000000 - 0x003:ffffffff    8 Gigs for rebased DLLs
  0x004:00000000 - 0x005:ffffffff    8 Gigs for non-rebased DLLs
  0x006:00000000 - 0x6ff:ffffffff    Heap bottom-up, mmaps top-down
  0x700:00000000 - 0x7ff:ffffffff    Reserved for OS

This was discussed and documented multiple times during the development
of the 64 bit version.  Please let's stick to that.

> > I also just noticed that rebaseall passes the --no-dynamicbase option
> > to rebase. Maybe you should do the same, and then you could forget
> > about the --noaslr option and unconditionally remove the call to
> > peflags from rebase_do.
> 
> I'll have to see if I can dig out my notes from that time, but I think
> it was both the ASLR and the TSAware flag that were creating problems
> with some libraries

TS aware?  To the contrary.  Don't remove it!


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpDzCXi6_urC.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]