Our situation is:
- First we have a kernel thread (say KS) that starts to run when kernel starts to run;
- Then when system is ready, we create another namespace (say NS1) that has a different mntns with LXC.
Our requirement is the KS need to write something in a path that can only seen by NS1. So I'm thinking can I move the KS to the NS1 namespace (at least change the mount namespace)? If yes, how? I have checked the setns()
syscall and its kernel source code, but still don't know how to do it (either in user-space or change the KS source code), and even not sure if this is the right way to solve the problem.
My other question is: my understanding is that a kernel task (e.g., kernel threads) aware "namespace" if it is in process context, but my friend thinks that the "namespace" is a user-space concept, all kernel staff knows only about the root namespace. Which one is correct?