linux - Is it possible to force a range of virtual addresses? -
i have ada program written specific (embedded, multi-processor, 32-bit) architecture. i'm attempting use same code in simulation on 64-bit rhel shared object (since there multiple versions , have requirement choose version @ runtime).
the problem i'm having there several places in code people wrote (not me...) have used unchecked_conversions convert system.addresses 32-bit integers. not that, there multiple routines hard-coded memory addresses. can make minor changes code, porting x86_64 isn't option. there routines handle interrupts, cpu task scheduling, etc.
this code has run fine in past when statically-linked previous version of simulation (consisting of fortran/c/c++). now, however, main executable starts, loads shared object based on inputs. shared object checks other inputs , loads appropriate ada shared object.
looking through code, it's apparent should work fine if can keep logical memory addresses between 0 , 2,147,483,647 (32-bit signed int). there way either force shared object loader leave space in lower ranges ada code or perhaps make ada code "think" it's addresses between 0 , 2,147,483,647?
is there way either force shared object loader leave space in lower ranges ada code
the news loader leave lower ranges untouched.
the bad news not load shared object there. there no interface use influence placement of shared objects.
that said, dlopen memory (which implemented in our private fork of glibc) allow that. that's not available publicly.
your other possible options are:
if can fit entire process 32-bit address space, solution trivial: build
-m32
.use
prelink
relocate library desired address. since address should available, loader load library there.link loader custom
mmap
implementation, detects library of interest through kind of side channel, ,mmap
syscallmap_32bit
set, or- run program in
ptrace
sandbox. such sandbox can again interceptmmap
syscall, , or-inmap_32bit
when desirable.
or perhaps make ada code "think" it's addresses between 0 , 2,147,483,647?
i don't see how that's possible. if library stores address of function or global in 32-bit memory location, loads address , dereferences ... it's going 32-bit truncated address , sigsegv
on dereference.
Comments
Post a Comment