S
S
Semyon Prikhodko2018-01-07 20:43:45
Operating Systems
Semyon Prikhodko, 2018-01-07 20:43:45

Is it possible to relocate process data/stack?

Do I understand correctly that we cannot (in the general case) correctly relocate (move by some offset) the process data/stack? I mean x86_64/AArch64 code generated by a regular compiler. Please do not confuse with code relocation (PIC).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2018-01-08
@jcmvbkbc

Depending on what is meant by "move". Before execution starts, the stack can be placed anywhere. Because addressing on the stack is always relative to the stack pointer/frame pointer. During operation, the stack pointer can be moved down to an arbitrary depth. The used part of the stack cannot be transferred during operation. In general, data cannot be transferred. To be able to, you need to use the base register and refer to offsets from it. For example, this is how TLS and FDPIC work. On the other hand, code generated as PIC/PIE can be moved along with the data, and if you analyze the fixups and apply only those that refer to the data segment, the data can be moved separately from the code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question