Can I move a kernel thread into a special mount namespace
Hi,
Our requirement is, a user process sends a command to a kernel (3.10) module, and the kernel module creates a kernel thread, which has to be in same mount space with the user process since they have to access a same path, which is not mounted in root namespace. But seems all kernel threads have one parent "threadd", which is in root name space.
My question is, can I create a kernel thread with a special mount space(e.g, same with "current"), or move it after it is created? I have checked the setns syscall kernel source but still have no idea. I also have posted this question in stackoverflow but got no answer:
http://stackoverflow.com/questions/39869545/can-i-move-a-kernel-thread-from-one-namespace-to-another
Thank you very much.
Quoted 7 lines · Mark
Hi,
Our requirement is, a user process sends a command to a kernel (3.10) module, and the kernel module creates a kernel thread, which has to be in same mount space with the user process since they have to access a same path, which is not mounted in root namespace. But seems all kernel threads have one parent "threadd", which is in root name space.
Very odd requirement, do you have a pointer to your code anywhere? What exactly will that kernel thread do?
And why use such an obsolete and old kernel version?
thanks,
greg k-h
On 2016/10/26 20:31, Greg KH Wrote:
Quoted 9 lines · Mark
Quoted 7 lines
Hi,
Our requirement is, a user process sends a command to a kernel (3.10) module, and the kernel module creates a kernel thread, which has to be in same mount space with the user process since they have to access a same path, which is not mounted in root namespace. But seems all kernel threads have one parent "threadd", which is in root name space.
Quoted 9 lines
Very odd requirement, do you have a pointer to your code anywhere? What exactly will that kernel thread do?
And why use such an obsolete and old kernel version?
thanks,
greg k-h
The kernel thread checks a file and if it exists then do something, but the file is created in a separate namespace. Is this an odd requirement? I cannot post the code. It's on an android release so kernel is 3.10. Is there a solution on a newer kernel release?
Thank you very much, and sorry for late response:)
Quoted 17 lines · Mark
On 2016/10/26 20:31, Greg KH Wrote:
Quoted 14 lines · Mark
Quoted 7 lines
Hi,
Our requirement is, a user process sends a command to a kernel (3.10) module, and the kernel module creates a kernel thread, which has to be in same mount space with the user process since they have to access a same path, which is not mounted in root namespace. But seems all kernel threads have one parent "threadd", which is in root name space.
Very odd requirement, do you have a pointer to your code anywhere? What exactly will that kernel thread do?
And why use such an obsolete and old kernel version?
Quoted 7 lines
Quoted 4 lines
thanks,
greg k-h
The kernel thread checks a file and if it exists then do something, but the file is created in a separate namespace. Is this an odd requirement?
Yes, why should the kernel care about a file, the kernel should never be reading files directly from userspace.
Quoted 1 line
I cannot post the code.
Why not? You have our code, why can't you post yours? :)
Quoted 2 lines
It's on an android release so kernel is 3.10. Is there a solution on a newer kernel release?
I don't understand the problem you are trying to solve, can you perhaps explain the issue, not the potential solution you are trying to use? That would make it easier to understand.
thanks,
greg k-h