LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Do kernel and kernel modules have their own task_struct? (https://www.linuxquestions.org/questions/linux-kernel-70/do-kernel-and-kernel-modules-have-their-own-task_struct-4175734633/)

harry.hycc 03-06-2024 11:51 PM

Do kernel and kernel modules have their own task_struct?
 
I know that in user space, both processes and threads have corresponding task_structs.

I've also found information that kthreads have their own task_structs, with mm_struct=NULL.

But what I'm curious about is, do kernel and modules loaded via insmod/modprobe into the kernel also have their own task_structs?

I'm asking this because I've been using
Code:

current->nsproxy->mnt_ns
in my own kernel module, but I'm not sure who current represents when executing the code in kernel module. Does it refer to a specific process, or does it point to the kernel itself?

I do that since I want to iterate all current mountpoints through access mnt_list in mount_namespace in my own kernel module

And I found the implement like the function is_local_mountpoint in fs/namespace.c https://elixir.bootlin.com/linux/lat...mespace.c#L763

This has left me quite puzzled, so I'd like to ask for everyone's input.

frankbell 03-07-2024 08:17 PM

This question is way beyond me, but a web search turned up a number of articles that might be germane.

This one looks like a good starting point.


All times are GMT -5. The time now is 04:59 AM.