Does the Linux kernel support a PARTIAL exec
Clash Royale CLAN TAG#URR8PPP
I was looking at another question (https://stackoverflow.com/q/47845/537980), and saw an answer, about how much set up this other OS had to do, for every Process Create.
I got wondering. Would it be possible to do the setup (once, then fork), then do a partial exec to load the variable parts? That is only part of the process should be replaced.
A specific example of partial, would be. We want to load some execution environment, then exec to replace the loader, but not the environment. So this is taking control of what gets replaced (I know that exec does not replace everything (e.g. it keeps a COW of the file descriptor table)).
I realise that this may not have any practical use, as fork
and exec
are relatively cheep on many Unixes.
exec
add a comment |
I was looking at another question (https://stackoverflow.com/q/47845/537980), and saw an answer, about how much set up this other OS had to do, for every Process Create.
I got wondering. Would it be possible to do the setup (once, then fork), then do a partial exec to load the variable parts? That is only part of the process should be replaced.
A specific example of partial, would be. We want to load some execution environment, then exec to replace the loader, but not the environment. So this is taking control of what gets replaced (I know that exec does not replace everything (e.g. it keeps a COW of the file descriptor table)).
I realise that this may not have any practical use, as fork
and exec
are relatively cheep on many Unixes.
exec
You didn't explain what a partial exec is. Exec preserve some attributes of a thread, like your namespace, file descriptors, session relationship, tid.
– 炸鱼薯条德里克
Jan 10 at 14:13
I have made some improvements to the question, and my answer (based on feedback, received so far).
– ctrl-alt-delor
Jan 10 at 14:35
2
You should untie the fork and exec from each other in your mind; of course you can do a "partial exec"; yoummap(PROT_EXEC)
pages from another file into your address space, jump into them, and yuppie! "partial exec". I don't know if you can replicate everything exec does in userspace -- but you certainly can replicate most of it.
– pizdelect
Jan 10 at 14:54
@pizdelect, thanks. Could you write up an answer: that is the sort of thing I am looking for.
– ctrl-alt-delor
Jan 10 at 19:50
add a comment |
I was looking at another question (https://stackoverflow.com/q/47845/537980), and saw an answer, about how much set up this other OS had to do, for every Process Create.
I got wondering. Would it be possible to do the setup (once, then fork), then do a partial exec to load the variable parts? That is only part of the process should be replaced.
A specific example of partial, would be. We want to load some execution environment, then exec to replace the loader, but not the environment. So this is taking control of what gets replaced (I know that exec does not replace everything (e.g. it keeps a COW of the file descriptor table)).
I realise that this may not have any practical use, as fork
and exec
are relatively cheep on many Unixes.
exec
I was looking at another question (https://stackoverflow.com/q/47845/537980), and saw an answer, about how much set up this other OS had to do, for every Process Create.
I got wondering. Would it be possible to do the setup (once, then fork), then do a partial exec to load the variable parts? That is only part of the process should be replaced.
A specific example of partial, would be. We want to load some execution environment, then exec to replace the loader, but not the environment. So this is taking control of what gets replaced (I know that exec does not replace everything (e.g. it keeps a COW of the file descriptor table)).
I realise that this may not have any practical use, as fork
and exec
are relatively cheep on many Unixes.
exec
exec
edited Jan 10 at 14:33
ctrl-alt-delor
asked Jan 10 at 11:20
ctrl-alt-delorctrl-alt-delor
11.2k42058
11.2k42058
You didn't explain what a partial exec is. Exec preserve some attributes of a thread, like your namespace, file descriptors, session relationship, tid.
– 炸鱼薯条德里克
Jan 10 at 14:13
I have made some improvements to the question, and my answer (based on feedback, received so far).
– ctrl-alt-delor
Jan 10 at 14:35
2
You should untie the fork and exec from each other in your mind; of course you can do a "partial exec"; yoummap(PROT_EXEC)
pages from another file into your address space, jump into them, and yuppie! "partial exec". I don't know if you can replicate everything exec does in userspace -- but you certainly can replicate most of it.
– pizdelect
Jan 10 at 14:54
@pizdelect, thanks. Could you write up an answer: that is the sort of thing I am looking for.
– ctrl-alt-delor
Jan 10 at 19:50
add a comment |
You didn't explain what a partial exec is. Exec preserve some attributes of a thread, like your namespace, file descriptors, session relationship, tid.
– 炸鱼薯条德里克
Jan 10 at 14:13
I have made some improvements to the question, and my answer (based on feedback, received so far).
– ctrl-alt-delor
Jan 10 at 14:35
2
You should untie the fork and exec from each other in your mind; of course you can do a "partial exec"; yoummap(PROT_EXEC)
pages from another file into your address space, jump into them, and yuppie! "partial exec". I don't know if you can replicate everything exec does in userspace -- but you certainly can replicate most of it.
– pizdelect
Jan 10 at 14:54
@pizdelect, thanks. Could you write up an answer: that is the sort of thing I am looking for.
– ctrl-alt-delor
Jan 10 at 19:50
You didn't explain what a partial exec is. Exec preserve some attributes of a thread, like your namespace, file descriptors, session relationship, tid.
– 炸鱼薯条德里克
Jan 10 at 14:13
You didn't explain what a partial exec is. Exec preserve some attributes of a thread, like your namespace, file descriptors, session relationship, tid.
– 炸鱼薯条德里克
Jan 10 at 14:13
I have made some improvements to the question, and my answer (based on feedback, received so far).
– ctrl-alt-delor
Jan 10 at 14:35
I have made some improvements to the question, and my answer (based on feedback, received so far).
– ctrl-alt-delor
Jan 10 at 14:35
2
2
You should untie the fork and exec from each other in your mind; of course you can do a "partial exec"; you
mmap(PROT_EXEC)
pages from another file into your address space, jump into them, and yuppie! "partial exec". I don't know if you can replicate everything exec does in userspace -- but you certainly can replicate most of it.– pizdelect
Jan 10 at 14:54
You should untie the fork and exec from each other in your mind; of course you can do a "partial exec"; you
mmap(PROT_EXEC)
pages from another file into your address space, jump into them, and yuppie! "partial exec". I don't know if you can replicate everything exec does in userspace -- but you certainly can replicate most of it.– pizdelect
Jan 10 at 14:54
@pizdelect, thanks. Could you write up an answer: that is the sort of thing I am looking for.
– ctrl-alt-delor
Jan 10 at 19:50
@pizdelect, thanks. Could you write up an answer: that is the sort of thing I am looking for.
– ctrl-alt-delor
Jan 10 at 19:50
add a comment |
1 Answer
1
active
oldest
votes
Partial answer of an untested idea
fork
+ exec
can not do it, because exec replaces (almost) all of the process state.
The man page for clone
suggests that, maybe clone
+ exec
is flexible enough to allow this:
One could do the setup, then clone (with shared (non-writable) memory, for all resources that you want to be shared), then exec in the child. Exec
ed program would be programmed to use resources in the parent (via shared memory).
Therefore exec
did replace all of the process, however because of shared memory, because of clone, it was partial.
(Using clone
, can blur the definition of a process. clone
can be used to create threads, processes, and many other things in between.)
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f493676%2fdoes-the-linux-kernel-support-a-partial-exec%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Partial answer of an untested idea
fork
+ exec
can not do it, because exec replaces (almost) all of the process state.
The man page for clone
suggests that, maybe clone
+ exec
is flexible enough to allow this:
One could do the setup, then clone (with shared (non-writable) memory, for all resources that you want to be shared), then exec in the child. Exec
ed program would be programmed to use resources in the parent (via shared memory).
Therefore exec
did replace all of the process, however because of shared memory, because of clone, it was partial.
(Using clone
, can blur the definition of a process. clone
can be used to create threads, processes, and many other things in between.)
add a comment |
Partial answer of an untested idea
fork
+ exec
can not do it, because exec replaces (almost) all of the process state.
The man page for clone
suggests that, maybe clone
+ exec
is flexible enough to allow this:
One could do the setup, then clone (with shared (non-writable) memory, for all resources that you want to be shared), then exec in the child. Exec
ed program would be programmed to use resources in the parent (via shared memory).
Therefore exec
did replace all of the process, however because of shared memory, because of clone, it was partial.
(Using clone
, can blur the definition of a process. clone
can be used to create threads, processes, and many other things in between.)
add a comment |
Partial answer of an untested idea
fork
+ exec
can not do it, because exec replaces (almost) all of the process state.
The man page for clone
suggests that, maybe clone
+ exec
is flexible enough to allow this:
One could do the setup, then clone (with shared (non-writable) memory, for all resources that you want to be shared), then exec in the child. Exec
ed program would be programmed to use resources in the parent (via shared memory).
Therefore exec
did replace all of the process, however because of shared memory, because of clone, it was partial.
(Using clone
, can blur the definition of a process. clone
can be used to create threads, processes, and many other things in between.)
Partial answer of an untested idea
fork
+ exec
can not do it, because exec replaces (almost) all of the process state.
The man page for clone
suggests that, maybe clone
+ exec
is flexible enough to allow this:
One could do the setup, then clone (with shared (non-writable) memory, for all resources that you want to be shared), then exec in the child. Exec
ed program would be programmed to use resources in the parent (via shared memory).
Therefore exec
did replace all of the process, however because of shared memory, because of clone, it was partial.
(Using clone
, can blur the definition of a process. clone
can be used to create threads, processes, and many other things in between.)
edited Jan 10 at 13:27
answered Jan 10 at 11:20
ctrl-alt-delorctrl-alt-delor
11.2k42058
11.2k42058
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f493676%2fdoes-the-linux-kernel-support-a-partial-exec%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
You didn't explain what a partial exec is. Exec preserve some attributes of a thread, like your namespace, file descriptors, session relationship, tid.
– 炸鱼薯条德里克
Jan 10 at 14:13
I have made some improvements to the question, and my answer (based on feedback, received so far).
– ctrl-alt-delor
Jan 10 at 14:35
2
You should untie the fork and exec from each other in your mind; of course you can do a "partial exec"; you
mmap(PROT_EXEC)
pages from another file into your address space, jump into them, and yuppie! "partial exec". I don't know if you can replicate everything exec does in userspace -- but you certainly can replicate most of it.– pizdelect
Jan 10 at 14:54
@pizdelect, thanks. Could you write up an answer: that is the sort of thing I am looking for.
– ctrl-alt-delor
Jan 10 at 19:50