How does linux decide the load address and entry point when execve an ELF?How does the ELF loader determine...

Which comes first? Multiple Imputation, Splitting into train/test, or Standardization/Normalization

Is an early checkout possible at a hotel before its reception opens?

Can a black dragonborn's acid breath weapon destroy objects?

Taxi Services at Didcot

Movie about a boy who was born old and grew young

How Can I Tell The Difference Between Unmarked Sugar and Stevia?

Arriving at the same result with the opposite hypotheses

What is the actual quality of machine translations?

Find the Factorial From the Given Prime Relationship

Inconsistent behavior of compiler optimization of unused string

How would a aircraft visually signal "in distress"?

Should I compare a std::string to "string" or "string"s?

PhD - Well known professor or well known school?

Should I give professor gift at the beginning of my PhD?

Soft question: Examples where lack of mathematical rigour cause security breaches?

Using "subway" as name for London Underground?

Was there a priest on the Titanic who stayed on the ship giving confession to as many as he could?

Frame failure sudden death?

What does the term "railed" mean in signal processing?

Can anyone identify this tank?

Why doesn't Adrian Toomes give up Spider-Man's identity?

Are there downsides to using std::string as a buffer?

Facebook Marketing API asset access suddenly denied

Compiling c files on ubuntu and using the executable on Windows



How does linux decide the load address and entry point when execve an ELF?


How does the ELF loader determine the initial stack size?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















When linux execve() an ELF, it will mmap that ELF into the process's memory space and start to run code from the entry point. But how does the kernel decide the load address and entry point of the ELF?



If ASLR is disabled, it looks up the .p_vaddr of each PT_LOAD segment and use .e_entry of ELF header as entry point.



But what if ASLR is enabled? Will the kernel simply add an random shift to all the aboves but keeps their relative position?



Will the content of ELF affect kernel's behavior? Like if the least .p_vaddr of PT_LOAD segment is zero or non-zero? Like the .e_type of ELF header is ET_DYN or ET_EXEC?



I'm talking about x86_64, especially.










share|improve this question

























  • Very interesting question, I'd like to learn about this as well

    – Sergiy Kolodyazhnyy
    1 hour ago


















1















When linux execve() an ELF, it will mmap that ELF into the process's memory space and start to run code from the entry point. But how does the kernel decide the load address and entry point of the ELF?



If ASLR is disabled, it looks up the .p_vaddr of each PT_LOAD segment and use .e_entry of ELF header as entry point.



But what if ASLR is enabled? Will the kernel simply add an random shift to all the aboves but keeps their relative position?



Will the content of ELF affect kernel's behavior? Like if the least .p_vaddr of PT_LOAD segment is zero or non-zero? Like the .e_type of ELF header is ET_DYN or ET_EXEC?



I'm talking about x86_64, especially.










share|improve this question

























  • Very interesting question, I'd like to learn about this as well

    – Sergiy Kolodyazhnyy
    1 hour ago














1












1








1








When linux execve() an ELF, it will mmap that ELF into the process's memory space and start to run code from the entry point. But how does the kernel decide the load address and entry point of the ELF?



If ASLR is disabled, it looks up the .p_vaddr of each PT_LOAD segment and use .e_entry of ELF header as entry point.



But what if ASLR is enabled? Will the kernel simply add an random shift to all the aboves but keeps their relative position?



Will the content of ELF affect kernel's behavior? Like if the least .p_vaddr of PT_LOAD segment is zero or non-zero? Like the .e_type of ELF header is ET_DYN or ET_EXEC?



I'm talking about x86_64, especially.










share|improve this question
















When linux execve() an ELF, it will mmap that ELF into the process's memory space and start to run code from the entry point. But how does the kernel decide the load address and entry point of the ELF?



If ASLR is disabled, it looks up the .p_vaddr of each PT_LOAD segment and use .e_entry of ELF header as entry point.



But what if ASLR is enabled? Will the kernel simply add an random shift to all the aboves but keeps their relative position?



Will the content of ELF affect kernel's behavior? Like if the least .p_vaddr of PT_LOAD segment is zero or non-zero? Like the .e_type of ELF header is ET_DYN or ET_EXEC?



I'm talking about x86_64, especially.







linux-kernel exec elf aslr






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago









Sergiy Kolodyazhnyy

10.8k42765




10.8k42765










asked 2 hours ago









炸鱼薯条德里克炸鱼薯条德里克

6281417




6281417













  • Very interesting question, I'd like to learn about this as well

    – Sergiy Kolodyazhnyy
    1 hour ago



















  • Very interesting question, I'd like to learn about this as well

    – Sergiy Kolodyazhnyy
    1 hour ago

















Very interesting question, I'd like to learn about this as well

– Sergiy Kolodyazhnyy
1 hour ago





Very interesting question, I'd like to learn about this as well

– Sergiy Kolodyazhnyy
1 hour ago










0






active

oldest

votes












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f522737%2fhow-does-linux-decide-the-load-address-and-entry-point-when-execve-an-elf%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f522737%2fhow-does-linux-decide-the-load-address-and-entry-point-when-execve-an-elf%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...