I know that you can't technically chroot a thread, but I'm looking for functional alternatives that would limit the amount of permissions to an existing set of tasks within a thread.
Edit: This is for a Linux environment, however Windows related techniques would be useful as well (even if they have no *NIX equivalent.
There are few differences between threads and processes on Linux. Use the clone syscall with the flag CLONE_THREAD and without the flag CLONE_FS, so that the new thread does not share its root directory/current directory/umask with the calling thread. Alternatively, you can use the unshare syscall with CLONE_FS after the fact. Now you can use chroot as normal and it will not affect other threads in the process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With