18 static int tomoyo_cred_alloc_blank(
struct cred *
new,
gfp_t gfp)
33 static int tomoyo_cred_prepare(
struct cred *
new,
const struct cred *old,
37 new->security = domain;
49 static void tomoyo_cred_transfer(
struct cred *
new,
const struct cred *old)
51 tomoyo_cred_prepare(
new, old, 0);
59 static void tomoyo_cred_free(
struct cred *
cred)
73 static int tomoyo_bprm_set_creds(
struct linux_binprm *bprm)
87 #ifndef CONFIG_SECURITY_TOMOYO_OMIT_USERSPACE_LOADER
102 bprm->
cred->security)->users);
118 static int tomoyo_bprm_check_security(
struct linux_binprm *bprm)
127 const int idx = tomoyo_read_lock();
129 tomoyo_read_unlock(idx);
160 static int tomoyo_path_truncate(
struct path *
path)
220 const char *old_name)
255 switch (mode & S_IFMT) {
275 static int tomoyo_path_link(
struct dentry *old_dentry,
struct path *new_dir,
276 struct dentry *new_dentry)
278 struct path path1 = { new_dir->
mnt, old_dentry };
279 struct path path2 = { new_dir->
mnt, new_dentry };
293 static int tomoyo_path_rename(
struct path *old_parent,
294 struct dentry *old_dentry,
295 struct path *new_parent,
296 struct dentry *new_dentry)
298 struct path path1 = { old_parent->
mnt, old_dentry };
299 struct path path2 = { new_parent->
mnt, new_dentry };
312 static int tomoyo_file_fcntl(
struct file *
file,
unsigned int cmd,
329 static int tomoyo_file_open(
struct file *
f,
const struct cred *cred)
347 static int tomoyo_file_ioctl(
struct file *file,
unsigned int cmd,
361 static int tomoyo_path_chmod(
struct path *path,
umode_t mode)
382 if (!error && gid_valid(gid))
395 static int tomoyo_path_chroot(
struct path *path)
411 static int tomoyo_sb_mount(
const char *dev_name,
struct path *path,
412 const char *type,
unsigned long flags,
void *
data)
425 static int tomoyo_sb_umount(
struct vfsmount *
mnt,
int flags)
439 static int tomoyo_sb_pivotroot(
struct path *old_path,
struct path *new_path)
506 static struct security_operations tomoyo_security_ops = {
508 .cred_alloc_blank = tomoyo_cred_alloc_blank,
509 .cred_prepare = tomoyo_cred_prepare,
510 .cred_transfer = tomoyo_cred_transfer,
511 .cred_free = tomoyo_cred_free,
512 .bprm_set_creds = tomoyo_bprm_set_creds,
513 .bprm_check_security = tomoyo_bprm_check_security,
514 .file_fcntl = tomoyo_file_fcntl,
515 .file_open = tomoyo_file_open,
516 .path_truncate = tomoyo_path_truncate,
517 .path_unlink = tomoyo_path_unlink,
518 .path_mkdir = tomoyo_path_mkdir,
519 .path_rmdir = tomoyo_path_rmdir,
520 .path_symlink = tomoyo_path_symlink,
521 .path_mknod = tomoyo_path_mknod,
522 .path_link = tomoyo_path_link,
523 .path_rename = tomoyo_path_rename,
524 .inode_getattr = tomoyo_inode_getattr,
525 .file_ioctl = tomoyo_file_ioctl,
526 .path_chmod = tomoyo_path_chmod,
527 .path_chown = tomoyo_path_chown,
528 .path_chroot = tomoyo_path_chroot,
529 .sb_mount = tomoyo_sb_mount,
530 .sb_umount = tomoyo_sb_umount,
531 .sb_pivotroot = tomoyo_sb_pivotroot,
532 .socket_bind = tomoyo_socket_bind,
533 .socket_connect = tomoyo_socket_connect,
534 .socket_listen = tomoyo_socket_listen,
535 .socket_sendmsg = tomoyo_socket_sendmsg,
546 static int __init tomoyo_init(
void)
555 panic(
"Failure registering TOMOYO Linux");