Task
I have a small kernel module that I wrote for my RaspBerry Pi 2, which implements an additional system call to generate power metrics. I would like to change the system call so that it is called only when it is issued by a special user (for example, the "root" or "pi" user). Otherwise, the call simply skips the main body and returns success.
Background work
I examined this question in detail, and I found a similar question in SO , but from my point of view there are many problems from my point of view (below).
Question
A related question notes what struct task_structcontains an element of a pointer to struct cred, as defined in linux/sched.hand linux/cred.h. The last of the two headers does not exist on my system (s), and the first does not show an element pointer declaration struct cred. It makes sense?- Stupid mistake. This is present in the kernel headers (i.e.
/usr/src/linux-headers-$(uname -r)/include/linux/cred.h) I searched in the gcc-build headers in /usr/include/linux.
Even if the above worked, it does not mention whether I will get a real, efficient or saved UID for the process . Is it even possible to get each of these three values from a system call?cred.h already contains all this data.
, , , /etc/group?
Update
, :
, , RCU.