current->uid and current->euid can replace the first two.
schedule() should work for the latter.
File system operations look more complex: you can try and see if sys_chown() , sys_mknod() and sys_unlink() are sys_unlink() (available for use by any module). If they work, great. Here are some helpful helpful tips here . Otherwise, you have to dig a little deeper:
Syscall chown defined in fs/open.c At first glance, I donβt understand why you could not copy this code into your own kernel_chown function and try.
Syscalls mknodat and unlink are in fs/namei.c ; they end up calling vfs_mknod() and vfs_unlink() , respectively. Perhaps you can duplicate this code or find out how to do it from there.
source share