how to get right euid?

From: Kevin Qu
Date: Sat Jan 02 2010 - 08:16:51 EST


I wrote a kernel module and it create a "file" in /proc.
The "file" permission is set to 644.
When check access permission, I use :

if( op == 4 || (op ==2 && current->euid == 0) )
return 0;

But it does not work on 2.6.29,
so I changed it like below:

if( op & 0x4 || (op & 0x2 && current_euid() == 0) )
return 0;

It works when read from the "file" in /proc,
but when write to it with sudo, like:

sudo echo "some thing" > /proc/my_file

It denied. (But it works when I su to superuser and do so.)

So I checked the current_euid(),
but it returns 1000 (not 0),Why?

Thanks for help.

Rofail Qu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/