Every time the cygheap is initialized, that is, on each fork
or exec, cygheap_init() *again* computes the bucket size values
and stores them in the cgyheap, albeit they are always the
same values anyway.
Make bucket_val a local const array, statically initialized
instead.
Fixes: 61522196c7 ("* Merge in cygwin-64bit-branch.)"
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Another reason ASLR may fail is the coupling of the standard shared
mem regions (global, userinfo, process info, shared console) to the
address of the Cygwin DLL. They are always placed in fixed addresses
preceeding the Cygwin DLL's address. With ASLR this is bound to fail.
Use a fixed, unused memory area to place the shared mem regions.
This also allows to simplify the shared memory creation. There's
no reason anymore to rebase the regions and rather than offsets,
just use the addresses directly.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
One reason that ASLR is tricky is the fact that the cygheap
is placed at the end of the DLL and especially that it's expected
to be growable. To support ASLR, this construct must go.
Define dedicated cygheap memory region and reserve entire region.
Commit 3 Megs, as was the default size of the cygheap before.
Fix linker script accordingly, drop a now useless version check
in get_cygwin_startup_info().
Collect all info about memory layout in one header file, so
the mem layout is documented in one logical place and not
in heap.cc arbitrarily.
Use info from this file throughout.
This is to prepare for ASLR support.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>