Changing file permissions in kernel.
Posted
by Mehrdad
on Stack Overflow
See other posts from Stack Overflow
or by Mehrdad
Published on 2009-08-28T17:24:08Z
Indexed on
2010/05/29
20:32 UTC
Read the original article
Hit count: 163
I am writing kernel module(C in Linux) and I want to change the permission of the other files in it. any solution? since I am in kernel I can't use chmod syscall and ... thanks for your help
This is my Makefile:
> obj-m += ca.o
>
> all:
> make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
>
> clean:
> make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
And this is my Code:
> #include <linux/string.h>
> #include <linux/mm.h>
> /* Snip, tons of includes (all of them :))*/
> #include <linux/delay.h> .... int procfile_write(struct file *file,
> const char *buffer, unsigned long
> count,
> void *data) { ... sys_chmod(path, per); ... } ...
When Making it gives a warning:
WARNING: "sys_chmod" [file] undefiened
and when loading the module with "sudo insmod" it gives this error:
Unknown sybol in module
it seems that this error happens especialy in kernel modules. any idea? again thanks!
© Stack Overflow or respective owner