[llvm-dev] Allocating shadow tables at the bottom of memory on Linux.
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Fri Jul 5 01:25:19 PDT 2019
Hi Carter,
On Fri, 5 Jul 2019 at 09:05, Carter Cheng via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I have been working on a llvm instrumentation pass as an exercise to get up to speed on how llvm operates. I am curious about what the best way would be to create a shadow table at a fixed address in low memory starting at 0x10000 and extending upwards.
Normally you'd put your data into a custom named section and then tell
the linker to put that section at a specific address through either
command-line options or a linker script.
> I am uncertain how the code ensures that the runtime metadata doesnt get overwritten by alloca calls for the stack.
If the value is a global it'll pretty much automatically be handled by
the linker and OS. The stack is usually pretty small and can be placed
out of the way of any allocation the OS knows about (and it knows
about all of them because it has to actually do the allocation at the
end of the day).
I think some sanitizers have a runtime that takes over the stack and
heap though and allocate both the "real" memory and its shadow
together. See compiler-rt/lib/asan for example.
Cheers.
Tim.
>
> Thanks in advance,
>
> Carter.
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list