3 ms·
> You can't achieve this with IPC to a privileged daemon because that daemon cannot inherit your current execution environment when starting new processes. Wha
by derefr 10y ago
> You can't achieve this with IPC to a privileged daemon because that daemon cannot inherit your current execution environment when starting new processes.
What if it could? An "execution environment" could be turned into some sort of kernel token object that could be passed to another process over IPC. A privileged daemon could receive one, fork(2) once, drop some privileges, and then fork(2) again, this time with the execution-environment parameter—and end up with a copy of itself running under the IPC-sender, with environment inherited from the sender but privileges inherited from the receiver (and, presumably, an address space that contains all the mappings of both parents, with the IP pointing into the receiver's code section, like a normal fork(2) would.)
- catern 10y agoDefinitely, that is one possible design. Although that would be fairly tricky to implement in the kernel. One way you could do this is to heavily abuse the CRIU project. https://criu.org/Main_Page https://criu.org/Main_Page Just do the following: 1. fork 2. send a request to a privileged daemon 3. privileged daemon checkpoints your child 4. privileged daemon modifies the saved state of your child in whatever way you requested 5. privileged daemon resurrects your child (which is possible because it is privileged) I am not really serious about this method but it is certainly a thing you could do. :)