Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
Remove two unneeded exports and make two symbols static in fs/mpage.c
Cleanup after commit 585d3bc06f4ca57f975a5a1f698f65a45ea66225
Trim includes of fdtable.h
Don't crap into descriptor table in binfmt_som
Trim includes in binfmt_elf
Don't mess with descriptor table in load_elf_binary()
Get rid of indirect include of fs_struct.h
New helper - current_umask()
check_unsafe_exec() doesn't care about signal handlers sharing
New locking/refcounting for fs_struct
Take fs_struct handling to new file (fs/fs_struct.c)
Get rid of bumping fs_struct refcount in pivot_root(2)
Kill unsharing fs_struct in __set_personality()

+337 -268
-1
arch/cris/kernel/process.c
··· 19 19 #include <asm/system.h> 20 20 #include <linux/module.h> 21 21 #include <linux/spinlock.h> 22 - #include <linux/fs_struct.h> 23 22 #include <linux/init_task.h> 24 23 #include <linux/sched.h> 25 24 #include <linux/fs.h>
+1 -1
arch/powerpc/platforms/cell/spufs/inode.c
··· 635 635 if (dentry->d_inode) 636 636 goto out_dput; 637 637 638 - mode &= ~current->fs->umask; 638 + mode &= ~current_umask(); 639 639 640 640 if (flags & SPU_CREATE_GANG) 641 641 ret = spufs_create_gang(nd->path.dentry->d_inode,
-2
drivers/char/tty_audit.c
··· 10 10 */ 11 11 12 12 #include <linux/audit.h> 13 - #include <linux/file.h> 14 - #include <linux/fdtable.h> 15 13 #include <linux/tty.h> 16 14 17 15 struct tty_audit_buf {
-1
drivers/char/tty_ldisc.c
··· 10 10 #include <linux/tty_flip.h> 11 11 #include <linux/devpts_fs.h> 12 12 #include <linux/file.h> 13 - #include <linux/fdtable.h> 14 13 #include <linux/console.h> 15 14 #include <linux/timer.h> 16 15 #include <linux/ctype.h>
+1 -1
fs/Makefile
··· 11 11 attr.o bad_inode.o file.o filesystems.o namespace.o \ 12 12 seq_file.o xattr.o libfs.o fs-writeback.o \ 13 13 pnode.o drop_caches.o splice.o sync.o utimes.o \ 14 - stack.o 14 + stack.o fs_struct.o 15 15 16 16 ifeq ($(CONFIG_BLOCK),y) 17 17 obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o
+2 -20
fs/binfmt_elf.c
··· 12 12 #include <linux/module.h> 13 13 #include <linux/kernel.h> 14 14 #include <linux/fs.h> 15 - #include <linux/stat.h> 16 - #include <linux/time.h> 17 15 #include <linux/mm.h> 18 16 #include <linux/mman.h> 19 17 #include <linux/errno.h> ··· 19 21 #include <linux/binfmts.h> 20 22 #include <linux/string.h> 21 23 #include <linux/file.h> 22 - #include <linux/fcntl.h> 23 - #include <linux/ptrace.h> 24 24 #include <linux/slab.h> 25 - #include <linux/shm.h> 26 25 #include <linux/personality.h> 27 26 #include <linux/elfcore.h> 28 27 #include <linux/init.h> 29 28 #include <linux/highuid.h> 30 - #include <linux/smp.h> 31 29 #include <linux/compiler.h> 32 30 #include <linux/highmem.h> 33 31 #include <linux/pagemap.h> 34 32 #include <linux/security.h> 35 - #include <linux/syscalls.h> 36 33 #include <linux/random.h> 37 34 #include <linux/elf.h> 38 35 #include <linux/utsname.h> ··· 569 576 unsigned long error; 570 577 struct elf_phdr *elf_ppnt, *elf_phdata; 571 578 unsigned long elf_bss, elf_brk; 572 - int elf_exec_fileno; 573 579 int retval, i; 574 580 unsigned int size; 575 581 unsigned long elf_entry; ··· 623 631 goto out_free_ph; 624 632 } 625 633 626 - retval = get_unused_fd(); 627 - if (retval < 0) 628 - goto out_free_ph; 629 - get_file(bprm->file); 630 - fd_install(elf_exec_fileno = retval, bprm->file); 631 - 632 634 elf_ppnt = elf_phdata; 633 635 elf_bss = 0; 634 636 elf_brk = 0; ··· 641 655 retval = -ENOEXEC; 642 656 if (elf_ppnt->p_filesz > PATH_MAX || 643 657 elf_ppnt->p_filesz < 2) 644 - goto out_free_file; 658 + goto out_free_ph; 645 659 646 660 retval = -ENOMEM; 647 661 elf_interpreter = kmalloc(elf_ppnt->p_filesz, 648 662 GFP_KERNEL); 649 663 if (!elf_interpreter) 650 - goto out_free_file; 664 + goto out_free_ph; 651 665 652 666 retval = kernel_read(bprm->file, elf_ppnt->p_offset, 653 667 elf_interpreter, ··· 942 956 943 957 kfree(elf_phdata); 944 958 945 - sys_close(elf_exec_fileno); 946 - 947 959 set_binfmt(&elf_format); 948 960 949 961 #ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES ··· 1012 1028 fput(interpreter); 1013 1029 out_free_interp: 1014 1030 kfree(elf_interpreter); 1015 - out_free_file: 1016 - sys_close(elf_exec_fileno); 1017 1031 out_free_ph: 1018 1032 kfree(elf_phdata); 1019 1033 goto out;
-7
fs/binfmt_som.c
··· 188 188 static int 189 189 load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs) 190 190 { 191 - int som_exec_fileno; 192 191 int retval; 193 192 unsigned int size; 194 193 unsigned long som_entry; ··· 218 219 retval = -EIO; 219 220 goto out_free; 220 221 } 221 - 222 - retval = get_unused_fd(); 223 - if (retval < 0) 224 - goto out_free; 225 - get_file(bprm->file); 226 - fd_install(som_exec_fileno = retval, bprm->file); 227 222 228 223 /* Flush all traces of the currently running executable */ 229 224 retval = flush_old_exec(bprm);
+1
fs/block_dev.c
··· 204 204 } 205 205 return sync_blockdev(bdev); 206 206 } 207 + EXPORT_SYMBOL(fsync_bdev); 207 208 208 209 /** 209 210 * freeze_bdev -- lock a filesystem and force it into a consistent state
+1 -1
fs/btrfs/acl.c
··· 256 256 } 257 257 258 258 if (!acl) 259 - inode->i_mode &= ~current->fs->umask; 259 + inode->i_mode &= ~current_umask(); 260 260 } 261 261 262 262 if (IS_POSIXACL(dir) && acl) {
+1 -1
fs/btrfs/ioctl.c
··· 267 267 goto out_dput; 268 268 269 269 if (!IS_POSIXACL(parent->dentry->d_inode)) 270 - mode &= ~current->fs->umask; 270 + mode &= ~current_umask(); 271 271 272 272 error = mnt_want_write(parent->mnt); 273 273 if (error)
-1
fs/buffer.c
··· 3315 3315 EXPORT_SYMBOL(end_buffer_read_sync); 3316 3316 EXPORT_SYMBOL(end_buffer_write_sync); 3317 3317 EXPORT_SYMBOL(file_fsync); 3318 - EXPORT_SYMBOL(fsync_bdev); 3319 3318 EXPORT_SYMBOL(generic_block_bmap); 3320 3319 EXPORT_SYMBOL(generic_cont_expand_simple); 3321 3320 EXPORT_SYMBOL(init_buffer);
+2 -2
fs/cifs/dir.c
··· 254 254 return -ENOMEM; 255 255 } 256 256 257 - mode &= ~current->fs->umask; 257 + mode &= ~current_umask(); 258 258 if (oplockEnabled) 259 259 oplock = REQ_OPLOCK; 260 260 ··· 479 479 rc = -ENOMEM; 480 480 else if (pTcon->unix_ext) { 481 481 struct cifs_unix_set_info_args args = { 482 - .mode = mode & ~current->fs->umask, 482 + .mode = mode & ~current_umask(), 483 483 .ctime = NO_CHANGE_64, 484 484 .atime = NO_CHANGE_64, 485 485 .mtime = NO_CHANGE_64,
+2 -2
fs/cifs/inode.c
··· 1125 1125 goto mkdir_out; 1126 1126 } 1127 1127 1128 - mode &= ~current->fs->umask; 1128 + mode &= ~current_umask(); 1129 1129 rc = CIFSPOSIXCreate(xid, pTcon, SMB_O_DIRECTORY | SMB_O_CREAT, 1130 1130 mode, NULL /* netfid */, pInfo, &oplock, 1131 1131 full_path, cifs_sb->local_nls, ··· 1204 1204 if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2)) 1205 1205 direntry->d_inode->i_nlink = 2; 1206 1206 1207 - mode &= ~current->fs->umask; 1207 + mode &= ~current_umask(); 1208 1208 /* must turn on setgid bit if parent dir has it */ 1209 1209 if (inode->i_mode & S_ISGID) 1210 1210 mode |= S_ISGID;
+14 -2
fs/compat.c
··· 51 51 #include <linux/poll.h> 52 52 #include <linux/mm.h> 53 53 #include <linux/eventpoll.h> 54 + #include <linux/fs_struct.h> 54 55 55 56 #include <asm/uaccess.h> 56 57 #include <asm/mmu_context.h> ··· 1503 1502 bprm->cred = prepare_exec_creds(); 1504 1503 if (!bprm->cred) 1505 1504 goto out_unlock; 1506 - check_unsafe_exec(bprm); 1505 + 1506 + retval = check_unsafe_exec(bprm); 1507 + if (retval) 1508 + goto out_unlock; 1507 1509 1508 1510 file = open_exec(filename); 1509 1511 retval = PTR_ERR(file); 1510 1512 if (IS_ERR(file)) 1511 - goto out_unlock; 1513 + goto out_unmark; 1512 1514 1513 1515 sched_exec(); 1514 1516 ··· 1553 1549 goto out; 1554 1550 1555 1551 /* execve succeeded */ 1552 + write_lock(&current->fs->lock); 1553 + current->fs->in_exec = 0; 1554 + write_unlock(&current->fs->lock); 1556 1555 current->in_execve = 0; 1557 1556 mutex_unlock(&current->cred_exec_mutex); 1558 1557 acct_update_integrals(current); ··· 1573 1566 allow_write_access(bprm->file); 1574 1567 fput(bprm->file); 1575 1568 } 1569 + 1570 + out_unmark: 1571 + write_lock(&current->fs->lock); 1572 + current->fs->in_exec = 0; 1573 + write_unlock(&current->fs->lock); 1576 1574 1577 1575 out_unlock: 1578 1576 current->in_execve = 0;
+1 -1
fs/dcache.c
··· 17 17 #include <linux/syscalls.h> 18 18 #include <linux/string.h> 19 19 #include <linux/mm.h> 20 - #include <linux/fdtable.h> 21 20 #include <linux/fs.h> 22 21 #include <linux/fsnotify.h> 23 22 #include <linux/slab.h> ··· 31 32 #include <linux/seqlock.h> 32 33 #include <linux/swap.h> 33 34 #include <linux/bootmem.h> 35 + #include <linux/fs_struct.h> 34 36 #include "internal.h" 35 37 36 38 int sysctl_vfs_cache_pressure __read_mostly = 100;
+27 -8
fs/exec.c
··· 53 53 #include <linux/tracehook.h> 54 54 #include <linux/kmod.h> 55 55 #include <linux/fsnotify.h> 56 + #include <linux/fs_struct.h> 56 57 57 58 #include <asm/uaccess.h> 58 59 #include <asm/mmu_context.h> ··· 1057 1056 * - the caller must hold current->cred_exec_mutex to protect against 1058 1057 * PTRACE_ATTACH 1059 1058 */ 1060 - void check_unsafe_exec(struct linux_binprm *bprm) 1059 + int check_unsafe_exec(struct linux_binprm *bprm) 1061 1060 { 1062 1061 struct task_struct *p = current, *t; 1063 1062 unsigned long flags; 1064 - unsigned n_fs, n_sighand; 1063 + unsigned n_fs; 1064 + int res = 0; 1065 1065 1066 1066 bprm->unsafe = tracehook_unsafe_exec(p); 1067 1067 1068 1068 n_fs = 1; 1069 - n_sighand = 1; 1069 + write_lock(&p->fs->lock); 1070 1070 lock_task_sighand(p, &flags); 1071 1071 for (t = next_thread(p); t != p; t = next_thread(t)) { 1072 1072 if (t->fs == p->fs) 1073 1073 n_fs++; 1074 - n_sighand++; 1075 1074 } 1076 1075 1077 - if (atomic_read(&p->fs->count) > n_fs || 1078 - atomic_read(&p->sighand->count) > n_sighand) 1076 + if (p->fs->users > n_fs) { 1079 1077 bprm->unsafe |= LSM_UNSAFE_SHARE; 1078 + } else { 1079 + if (p->fs->in_exec) 1080 + res = -EAGAIN; 1081 + p->fs->in_exec = 1; 1082 + } 1080 1083 1081 1084 unlock_task_sighand(p, &flags); 1085 + write_unlock(&p->fs->lock); 1086 + 1087 + return res; 1082 1088 } 1083 1089 1084 1090 /* ··· 1304 1296 bprm->cred = prepare_exec_creds(); 1305 1297 if (!bprm->cred) 1306 1298 goto out_unlock; 1307 - check_unsafe_exec(bprm); 1299 + 1300 + retval = check_unsafe_exec(bprm); 1301 + if (retval) 1302 + goto out_unlock; 1308 1303 1309 1304 file = open_exec(filename); 1310 1305 retval = PTR_ERR(file); 1311 1306 if (IS_ERR(file)) 1312 - goto out_unlock; 1307 + goto out_unmark; 1313 1308 1314 1309 sched_exec(); 1315 1310 ··· 1355 1344 goto out; 1356 1345 1357 1346 /* execve succeeded */ 1347 + write_lock(&current->fs->lock); 1348 + current->fs->in_exec = 0; 1349 + write_unlock(&current->fs->lock); 1358 1350 current->in_execve = 0; 1359 1351 mutex_unlock(&current->cred_exec_mutex); 1360 1352 acct_update_integrals(current); ··· 1375 1361 allow_write_access(bprm->file); 1376 1362 fput(bprm->file); 1377 1363 } 1364 + 1365 + out_unmark: 1366 + write_lock(&current->fs->lock); 1367 + current->fs->in_exec = 0; 1368 + write_unlock(&current->fs->lock); 1378 1369 1379 1370 out_unlock: 1380 1371 current->in_execve = 0;
+1 -1
fs/ext2/acl.c
··· 318 318 return PTR_ERR(acl); 319 319 } 320 320 if (!acl) 321 - inode->i_mode &= ~current->fs->umask; 321 + inode->i_mode &= ~current_umask(); 322 322 } 323 323 if (test_opt(inode->i_sb, POSIX_ACL) && acl) { 324 324 struct posix_acl *clone;
+1 -1
fs/ext3/acl.c
··· 323 323 return PTR_ERR(acl); 324 324 } 325 325 if (!acl) 326 - inode->i_mode &= ~current->fs->umask; 326 + inode->i_mode &= ~current_umask(); 327 327 } 328 328 if (test_opt(inode->i_sb, POSIX_ACL) && acl) { 329 329 struct posix_acl *clone;
+1 -1
fs/ext4/acl.c
··· 323 323 return PTR_ERR(acl); 324 324 } 325 325 if (!acl) 326 - inode->i_mode &= ~current->fs->umask; 326 + inode->i_mode &= ~current_umask(); 327 327 } 328 328 if (test_opt(inode->i_sb, POSIX_ACL) && acl) { 329 329 struct posix_acl *clone;
+1 -1
fs/fat/inode.c
··· 934 934 935 935 opts->fs_uid = current_uid(); 936 936 opts->fs_gid = current_gid(); 937 - opts->fs_fmask = opts->fs_dmask = current->fs->umask; 937 + opts->fs_fmask = current_umask(); 938 938 opts->allow_utime = -1; 939 939 opts->codepage = fat_default_codepage; 940 940 opts->iocharset = fat_default_iocharset;
+177
fs/fs_struct.c
··· 1 + #include <linux/module.h> 2 + #include <linux/sched.h> 3 + #include <linux/fs.h> 4 + #include <linux/path.h> 5 + #include <linux/slab.h> 6 + #include <linux/fs_struct.h> 7 + 8 + /* 9 + * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. 10 + * It can block. 11 + */ 12 + void set_fs_root(struct fs_struct *fs, struct path *path) 13 + { 14 + struct path old_root; 15 + 16 + write_lock(&fs->lock); 17 + old_root = fs->root; 18 + fs->root = *path; 19 + path_get(path); 20 + write_unlock(&fs->lock); 21 + if (old_root.dentry) 22 + path_put(&old_root); 23 + } 24 + 25 + /* 26 + * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values. 27 + * It can block. 28 + */ 29 + void set_fs_pwd(struct fs_struct *fs, struct path *path) 30 + { 31 + struct path old_pwd; 32 + 33 + write_lock(&fs->lock); 34 + old_pwd = fs->pwd; 35 + fs->pwd = *path; 36 + path_get(path); 37 + write_unlock(&fs->lock); 38 + 39 + if (old_pwd.dentry) 40 + path_put(&old_pwd); 41 + } 42 + 43 + void chroot_fs_refs(struct path *old_root, struct path *new_root) 44 + { 45 + struct task_struct *g, *p; 46 + struct fs_struct *fs; 47 + int count = 0; 48 + 49 + read_lock(&tasklist_lock); 50 + do_each_thread(g, p) { 51 + task_lock(p); 52 + fs = p->fs; 53 + if (fs) { 54 + write_lock(&fs->lock); 55 + if (fs->root.dentry == old_root->dentry 56 + && fs->root.mnt == old_root->mnt) { 57 + path_get(new_root); 58 + fs->root = *new_root; 59 + count++; 60 + } 61 + if (fs->pwd.dentry == old_root->dentry 62 + && fs->pwd.mnt == old_root->mnt) { 63 + path_get(new_root); 64 + fs->pwd = *new_root; 65 + count++; 66 + } 67 + write_unlock(&fs->lock); 68 + } 69 + task_unlock(p); 70 + } while_each_thread(g, p); 71 + read_unlock(&tasklist_lock); 72 + while (count--) 73 + path_put(old_root); 74 + } 75 + 76 + void free_fs_struct(struct fs_struct *fs) 77 + { 78 + path_put(&fs->root); 79 + path_put(&fs->pwd); 80 + kmem_cache_free(fs_cachep, fs); 81 + } 82 + 83 + void exit_fs(struct task_struct *tsk) 84 + { 85 + struct fs_struct *fs = tsk->fs; 86 + 87 + if (fs) { 88 + int kill; 89 + task_lock(tsk); 90 + write_lock(&fs->lock); 91 + tsk->fs = NULL; 92 + kill = !--fs->users; 93 + write_unlock(&fs->lock); 94 + task_unlock(tsk); 95 + if (kill) 96 + free_fs_struct(fs); 97 + } 98 + } 99 + 100 + struct fs_struct *copy_fs_struct(struct fs_struct *old) 101 + { 102 + struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL); 103 + /* We don't need to lock fs - think why ;-) */ 104 + if (fs) { 105 + fs->users = 1; 106 + fs->in_exec = 0; 107 + rwlock_init(&fs->lock); 108 + fs->umask = old->umask; 109 + read_lock(&old->lock); 110 + fs->root = old->root; 111 + path_get(&old->root); 112 + fs->pwd = old->pwd; 113 + path_get(&old->pwd); 114 + read_unlock(&old->lock); 115 + } 116 + return fs; 117 + } 118 + 119 + int unshare_fs_struct(void) 120 + { 121 + struct fs_struct *fs = current->fs; 122 + struct fs_struct *new_fs = copy_fs_struct(fs); 123 + int kill; 124 + 125 + if (!new_fs) 126 + return -ENOMEM; 127 + 128 + task_lock(current); 129 + write_lock(&fs->lock); 130 + kill = !--fs->users; 131 + current->fs = new_fs; 132 + write_unlock(&fs->lock); 133 + task_unlock(current); 134 + 135 + if (kill) 136 + free_fs_struct(fs); 137 + 138 + return 0; 139 + } 140 + EXPORT_SYMBOL_GPL(unshare_fs_struct); 141 + 142 + int current_umask(void) 143 + { 144 + return current->fs->umask; 145 + } 146 + EXPORT_SYMBOL(current_umask); 147 + 148 + /* to be mentioned only in INIT_TASK */ 149 + struct fs_struct init_fs = { 150 + .users = 1, 151 + .lock = __RW_LOCK_UNLOCKED(init_fs.lock), 152 + .umask = 0022, 153 + }; 154 + 155 + void daemonize_fs_struct(void) 156 + { 157 + struct fs_struct *fs = current->fs; 158 + 159 + if (fs) { 160 + int kill; 161 + 162 + task_lock(current); 163 + 164 + write_lock(&init_fs.lock); 165 + init_fs.users++; 166 + write_unlock(&init_fs.lock); 167 + 168 + write_lock(&fs->lock); 169 + current->fs = &init_fs; 170 + kill = !--fs->users; 171 + write_unlock(&fs->lock); 172 + 173 + task_unlock(current); 174 + if (kill) 175 + free_fs_struct(fs); 176 + } 177 + }
+1 -1
fs/generic_acl.c
··· 134 134 mode_t mode = inode->i_mode; 135 135 int error; 136 136 137 - inode->i_mode = mode & ~current->fs->umask; 137 + inode->i_mode = mode & ~current_umask(); 138 138 if (!S_ISLNK(inode->i_mode)) 139 139 acl = ops->getacl(dir, ACL_TYPE_DEFAULT); 140 140 if (acl) {
+1 -1
fs/gfs2/acl.c
··· 215 215 if (error) 216 216 return error; 217 217 if (!acl) { 218 - mode &= ~current->fs->umask; 218 + mode &= ~current_umask(); 219 219 if (mode != ip->i_inode.i_mode) 220 220 error = munge_mode(ip, mode); 221 221 return error;
+1 -1
fs/hfsplus/options.c
··· 48 48 49 49 opts->creator = HFSPLUS_DEF_CR_TYPE; 50 50 opts->type = HFSPLUS_DEF_CR_TYPE; 51 - opts->umask = current->fs->umask; 51 + opts->umask = current_umask(); 52 52 opts->uid = current_uid(); 53 53 opts->gid = current_gid(); 54 54 opts->part = -1;
+1 -1
fs/hpfs/super.c
··· 480 480 481 481 uid = current_uid(); 482 482 gid = current_gid(); 483 - umask = current->fs->umask; 483 + umask = current_umask(); 484 484 lowercase = 0; 485 485 conv = CONV_BINARY; 486 486 eas = 2;
+7 -1
fs/internal.h
··· 11 11 12 12 struct super_block; 13 13 struct linux_binprm; 14 + struct path; 14 15 15 16 /* 16 17 * block_dev.c ··· 44 43 /* 45 44 * exec.c 46 45 */ 47 - extern void check_unsafe_exec(struct linux_binprm *); 46 + extern int check_unsafe_exec(struct linux_binprm *); 48 47 49 48 /* 50 49 * namespace.c ··· 61 60 extern struct vfsmount *copy_tree(struct vfsmount *, struct dentry *, int); 62 61 63 62 extern void __init mnt_init(void); 63 + 64 + /* 65 + * fs_struct.c 66 + */ 67 + extern void chroot_fs_refs(struct path *, struct path *);
+1 -1
fs/jffs2/acl.c
··· 336 336 return PTR_ERR(acl); 337 337 338 338 if (!acl) { 339 - *i_mode &= ~current->fs->umask; 339 + *i_mode &= ~current_umask(); 340 340 } else { 341 341 if (S_ISDIR(*i_mode)) 342 342 jffs2_iset_acl(inode, &f->i_acl_default, acl);
+1 -1
fs/jfs/acl.c
··· 182 182 cleanup: 183 183 posix_acl_release(acl); 184 184 } else 185 - inode->i_mode &= ~current->fs->umask; 185 + inode->i_mode &= ~current_umask(); 186 186 187 187 JFS_IP(inode)->mode2 = (JFS_IP(inode)->mode2 & 0xffff0000) | 188 188 inode->i_mode;
+9 -4
fs/mpage.c
··· 82 82 bio_put(bio); 83 83 } 84 84 85 - struct bio *mpage_bio_submit(int rw, struct bio *bio) 85 + static struct bio *mpage_bio_submit(int rw, struct bio *bio) 86 86 { 87 87 bio->bi_end_io = mpage_end_io_read; 88 88 if (rw == WRITE) ··· 90 90 submit_bio(rw, bio); 91 91 return NULL; 92 92 } 93 - EXPORT_SYMBOL(mpage_bio_submit); 94 93 95 94 static struct bio * 96 95 mpage_alloc(struct block_device *bdev, ··· 438 439 * just allocate full-size (16-page) BIOs. 439 440 */ 440 441 441 - int __mpage_writepage(struct page *page, struct writeback_control *wbc, 442 + struct mpage_data { 443 + struct bio *bio; 444 + sector_t last_block_in_bio; 445 + get_block_t *get_block; 446 + unsigned use_writepage; 447 + }; 448 + 449 + static int __mpage_writepage(struct page *page, struct writeback_control *wbc, 442 450 void *data) 443 451 { 444 452 struct mpage_data *mpd = data; ··· 654 648 mpd->bio = bio; 655 649 return ret; 656 650 } 657 - EXPORT_SYMBOL(__mpage_writepage); 658 651 659 652 /** 660 653 * mpage_writepages - walk the list of dirty pages of the given address space & writepage() all of them
+4 -10
fs/namei.c
··· 32 32 #include <linux/file.h> 33 33 #include <linux/fcntl.h> 34 34 #include <linux/device_cgroup.h> 35 + #include <linux/fs_struct.h> 35 36 #include <asm/uaccess.h> 36 37 37 38 #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) ··· 1579 1578 struct dentry *dir = nd->path.dentry; 1580 1579 1581 1580 if (!IS_POSIXACL(dir->d_inode)) 1582 - mode &= ~current->fs->umask; 1581 + mode &= ~current_umask(); 1583 1582 error = security_path_mknod(&nd->path, path->dentry, mode, 0); 1584 1583 if (error) 1585 1584 goto out_unlock; ··· 1990 1989 goto out_unlock; 1991 1990 } 1992 1991 if (!IS_POSIXACL(nd.path.dentry->d_inode)) 1993 - mode &= ~current->fs->umask; 1992 + mode &= ~current_umask(); 1994 1993 error = may_mknod(mode); 1995 1994 if (error) 1996 1995 goto out_dput; ··· 2068 2067 goto out_unlock; 2069 2068 2070 2069 if (!IS_POSIXACL(nd.path.dentry->d_inode)) 2071 - mode &= ~current->fs->umask; 2070 + mode &= ~current_umask(); 2072 2071 error = mnt_want_write(nd.path.mnt); 2073 2072 if (error) 2074 2073 goto out_dput; ··· 2898 2897 EXPORT_SYMBOL(vfs_unlink); 2899 2898 EXPORT_SYMBOL(dentry_unhash); 2900 2899 EXPORT_SYMBOL(generic_readlink); 2901 - 2902 - /* to be mentioned only in INIT_TASK */ 2903 - struct fs_struct init_fs = { 2904 - .count = ATOMIC_INIT(1), 2905 - .lock = __RW_LOCK_UNLOCKED(init_fs.lock), 2906 - .umask = 0022, 2907 - };
+1 -60
fs/namespace.c
··· 27 27 #include <linux/ramfs.h> 28 28 #include <linux/log2.h> 29 29 #include <linux/idr.h> 30 + #include <linux/fs_struct.h> 30 31 #include <asm/uaccess.h> 31 32 #include <asm/unistd.h> 32 33 #include "pnode.h" ··· 2091 2090 out1: 2092 2091 free_page(type_page); 2093 2092 return retval; 2094 - } 2095 - 2096 - /* 2097 - * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. 2098 - * It can block. Requires the big lock held. 2099 - */ 2100 - void set_fs_root(struct fs_struct *fs, struct path *path) 2101 - { 2102 - struct path old_root; 2103 - 2104 - write_lock(&fs->lock); 2105 - old_root = fs->root; 2106 - fs->root = *path; 2107 - path_get(path); 2108 - write_unlock(&fs->lock); 2109 - if (old_root.dentry) 2110 - path_put(&old_root); 2111 - } 2112 - 2113 - /* 2114 - * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values. 2115 - * It can block. Requires the big lock held. 2116 - */ 2117 - void set_fs_pwd(struct fs_struct *fs, struct path *path) 2118 - { 2119 - struct path old_pwd; 2120 - 2121 - write_lock(&fs->lock); 2122 - old_pwd = fs->pwd; 2123 - fs->pwd = *path; 2124 - path_get(path); 2125 - write_unlock(&fs->lock); 2126 - 2127 - if (old_pwd.dentry) 2128 - path_put(&old_pwd); 2129 - } 2130 - 2131 - static void chroot_fs_refs(struct path *old_root, struct path *new_root) 2132 - { 2133 - struct task_struct *g, *p; 2134 - struct fs_struct *fs; 2135 - 2136 - read_lock(&tasklist_lock); 2137 - do_each_thread(g, p) { 2138 - task_lock(p); 2139 - fs = p->fs; 2140 - if (fs) { 2141 - atomic_inc(&fs->count); 2142 - task_unlock(p); 2143 - if (fs->root.dentry == old_root->dentry 2144 - && fs->root.mnt == old_root->mnt) 2145 - set_fs_root(fs, new_root); 2146 - if (fs->pwd.dentry == old_root->dentry 2147 - && fs->pwd.mnt == old_root->mnt) 2148 - set_fs_pwd(fs, new_root); 2149 - put_fs_struct(fs); 2150 - } else 2151 - task_unlock(p); 2152 - } while_each_thread(g, p); 2153 - read_unlock(&tasklist_lock); 2154 2093 } 2155 2094 2156 2095 /*
+3 -3
fs/nfs/nfs3proc.c
··· 328 328 data->arg.create.verifier[1] = current->pid; 329 329 } 330 330 331 - sattr->ia_mode &= ~current->fs->umask; 331 + sattr->ia_mode &= ~current_umask(); 332 332 333 333 for (;;) { 334 334 status = nfs3_do_create(dir, dentry, data); ··· 528 528 529 529 dprintk("NFS call mkdir %s\n", dentry->d_name.name); 530 530 531 - sattr->ia_mode &= ~current->fs->umask; 531 + sattr->ia_mode &= ~current_umask(); 532 532 533 533 data = nfs3_alloc_createdata(); 534 534 if (data == NULL) ··· 639 639 dprintk("NFS call mknod %s %u:%u\n", dentry->d_name.name, 640 640 MAJOR(rdev), MINOR(rdev)); 641 641 642 - sattr->ia_mode &= ~current->fs->umask; 642 + sattr->ia_mode &= ~current_umask(); 643 643 644 644 data = nfs3_alloc_createdata(); 645 645 if (data == NULL)
+1 -1
fs/nfs/nfs4proc.c
··· 1501 1501 attr.ia_mode = nd->intent.open.create_mode; 1502 1502 attr.ia_valid = ATTR_MODE; 1503 1503 if (!IS_POSIXACL(dir)) 1504 - attr.ia_mode &= ~current->fs->umask; 1504 + attr.ia_mode &= ~current_umask(); 1505 1505 } else { 1506 1506 attr.ia_valid = 0; 1507 1507 BUG_ON(nd->intent.open.flags & O_CREAT);
+2 -5
fs/nfsd/nfssvc.c
··· 403 403 nfsd(void *vrqstp) 404 404 { 405 405 struct svc_rqst *rqstp = (struct svc_rqst *) vrqstp; 406 - struct fs_struct *fsp; 407 406 int err, preverr = 0; 408 407 409 408 /* Lock module and set up kernel thread */ ··· 411 412 /* At this point, the thread shares current->fs 412 413 * with the init process. We need to create files with a 413 414 * umask of 0 instead of init's umask. */ 414 - fsp = copy_fs_struct(current->fs); 415 - if (!fsp) { 415 + if (unshare_fs_struct() < 0) { 416 416 printk("Unable to start nfsd thread: out of memory\n"); 417 417 goto out; 418 418 } 419 - exit_fs(current); 420 - current->fs = fsp; 419 + 421 420 current->fs->umask = 0; 422 421 423 422 /*
+1 -1
fs/ocfs2/acl.c
··· 296 296 return PTR_ERR(acl); 297 297 } 298 298 if (!acl) 299 - inode->i_mode &= ~current->fs->umask; 299 + inode->i_mode &= ~current_umask(); 300 300 } 301 301 if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) { 302 302 struct posix_acl *clone;
+1 -1
fs/omfs/inode.c
··· 426 426 427 427 sbi->s_uid = current_uid(); 428 428 sbi->s_gid = current_gid(); 429 - sbi->s_dmask = sbi->s_fmask = current->fs->umask; 429 + sbi->s_dmask = sbi->s_fmask = current_umask(); 430 430 431 431 if (!parse_options((char *) data, sbi)) 432 432 goto end;
+1
fs/open.c
··· 29 29 #include <linux/rcupdate.h> 30 30 #include <linux/audit.h> 31 31 #include <linux/falloc.h> 32 + #include <linux/fs_struct.h> 32 33 33 34 int vfs_statfs(struct dentry *dentry, struct kstatfs *buf) 34 35 {
+1
fs/proc/base.c
··· 80 80 #include <linux/oom.h> 81 81 #include <linux/elf.h> 82 82 #include <linux/pid_namespace.h> 83 + #include <linux/fs_struct.h> 83 84 #include "internal.h" 84 85 85 86 /* NOTE:
+2 -1
fs/proc/task_nommu.c
··· 2 2 #include <linux/mm.h> 3 3 #include <linux/file.h> 4 4 #include <linux/fdtable.h> 5 + #include <linux/fs_struct.h> 5 6 #include <linux/mount.h> 6 7 #include <linux/ptrace.h> 7 8 #include <linux/seq_file.h> ··· 50 49 else 51 50 bytes += kobjsize(mm); 52 51 53 - if (current->fs && atomic_read(&current->fs->count) > 1) 52 + if (current->fs && current->fs->users > 1) 54 53 sbytes += kobjsize(current->fs); 55 54 else 56 55 bytes += kobjsize(current->fs);
+1 -1
fs/reiserfs/xattr_acl.c
··· 428 428 } else { 429 429 apply_umask: 430 430 /* no ACL, apply umask */ 431 - inode->i_mode &= ~current->fs->umask; 431 + inode->i_mode &= ~current_umask(); 432 432 } 433 433 434 434 return err;
+2 -2
fs/xfs/linux-2.6/xfs_iops.c
··· 227 227 xfs_dentry_to_name(&name, dentry); 228 228 229 229 if (IS_POSIXACL(dir) && !default_acl) 230 - mode &= ~current->fs->umask; 230 + mode &= ~current_umask(); 231 231 232 232 switch (mode & S_IFMT) { 233 233 case S_IFCHR: ··· 416 416 mode_t mode; 417 417 418 418 mode = S_IFLNK | 419 - (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); 419 + (irix_symlink_mode ? 0777 & ~current_umask() : S_IRWXUGO); 420 420 xfs_dentry_to_name(&name, dentry); 421 421 422 422 error = xfs_symlink(XFS_I(dir), &name, symname, mode, &cip, NULL);
-12
include/linux/buffer_head.h
··· 332 332 333 333 static inline void buffer_init(void) {} 334 334 static inline int try_to_free_buffers(struct page *page) { return 1; } 335 - static inline int sync_blockdev(struct block_device *bdev) { return 0; } 336 335 static inline int inode_has_buffers(struct inode *inode) { return 0; } 337 336 static inline void invalidate_inode_buffers(struct inode *inode) {} 338 337 static inline int remove_inode_buffers(struct inode *inode) { return 1; } 339 338 static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; } 340 - static inline void invalidate_bdev(struct block_device *bdev) {} 341 - 342 - static inline struct super_block *freeze_bdev(struct block_device *sb) 343 - { 344 - return NULL; 345 - } 346 - 347 - static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb) 348 - { 349 - return 0; 350 - } 351 339 352 340 #endif /* CONFIG_BLOCK */ 353 341 #endif /* _LINUX_BUFFER_HEAD_H */
+14
include/linux/fs.h
··· 1741 1741 1742 1742 extern int vfs_statfs(struct dentry *, struct kstatfs *); 1743 1743 1744 + extern int current_umask(void); 1745 + 1744 1746 /* /sys/fs */ 1745 1747 extern struct kobject *fs_kobj; 1746 1748 ··· 1887 1885 extern int fsync_no_super(struct block_device *); 1888 1886 #else 1889 1887 static inline void bd_forget(struct inode *inode) {} 1888 + static inline int sync_blockdev(struct block_device *bdev) { return 0; } 1889 + static inline void invalidate_bdev(struct block_device *bdev) {} 1890 + 1891 + static inline struct super_block *freeze_bdev(struct block_device *sb) 1892 + { 1893 + return NULL; 1894 + } 1895 + 1896 + static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb) 1897 + { 1898 + return 0; 1899 + } 1890 1900 #endif 1891 1901 extern const struct file_operations def_blk_fops; 1892 1902 extern const struct file_operations def_chr_fops;
+5 -5
include/linux/fs_struct.h
··· 4 4 #include <linux/path.h> 5 5 6 6 struct fs_struct { 7 - atomic_t count; /* This usage count is used by check_unsafe_exec() for 8 - * security checking purposes - therefore it may not be 9 - * incremented, except by clone(CLONE_FS). 10 - */ 7 + int users; 11 8 rwlock_t lock; 12 9 int umask; 10 + int in_exec; 13 11 struct path root, pwd; 14 12 }; 15 13 ··· 17 19 extern void set_fs_root(struct fs_struct *, struct path *); 18 20 extern void set_fs_pwd(struct fs_struct *, struct path *); 19 21 extern struct fs_struct *copy_fs_struct(struct fs_struct *); 20 - extern void put_fs_struct(struct fs_struct *); 22 + extern void free_fs_struct(struct fs_struct *); 23 + extern void daemonize_fs_struct(void); 24 + extern int unshare_fs_struct(void); 21 25 22 26 #endif /* _LINUX_FS_STRUCT_H */
+2
include/linux/mnt_namespace.h
··· 22 22 int event; 23 23 }; 24 24 25 + struct fs_struct; 26 + 25 27 extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 26 28 struct fs_struct *); 27 29 extern void __put_mnt_ns(struct mnt_namespace *ns);
-10
include/linux/mpage.h
··· 11 11 */ 12 12 #ifdef CONFIG_BLOCK 13 13 14 - struct mpage_data { 15 - struct bio *bio; 16 - sector_t last_block_in_bio; 17 - get_block_t *get_block; 18 - unsigned use_writepage; 19 - }; 20 - 21 14 struct writeback_control; 22 15 23 - struct bio *mpage_bio_submit(int rw, struct bio *bio); 24 16 int mpage_readpages(struct address_space *mapping, struct list_head *pages, 25 17 unsigned nr_pages, get_block_t get_block); 26 18 int mpage_readpage(struct page *page, get_block_t get_block); 27 - int __mpage_writepage(struct page *page, struct writeback_control *wbc, 28 - void *data); 29 19 int mpage_writepages(struct address_space *mapping, 30 20 struct writeback_control *wbc, get_block_t get_block); 31 21 int mpage_writepage(struct page *page, get_block_t *get_block,
+1
include/linux/nsproxy.h
··· 8 8 struct uts_namespace; 9 9 struct ipc_namespace; 10 10 struct pid_namespace; 11 + struct fs_struct; 11 12 12 13 /* 13 14 * A structure to contain pointers to all per-process
+2 -1
include/linux/sched.h
··· 68 68 #include <linux/smp.h> 69 69 #include <linux/sem.h> 70 70 #include <linux/signal.h> 71 - #include <linux/fs_struct.h> 71 + #include <linux/path.h> 72 72 #include <linux/compiler.h> 73 73 #include <linux/completion.h> 74 74 #include <linux/pid.h> ··· 97 97 struct robust_list_head; 98 98 struct bio; 99 99 struct bts_tracer; 100 + struct fs_struct; 100 101 101 102 /* 102 103 * List of flags we want to share for kernel threads,
+1
init/do_mounts.c
··· 14 14 #include <linux/fs.h> 15 15 #include <linux/initrd.h> 16 16 #include <linux/async.h> 17 + #include <linux/fs_struct.h> 17 18 18 19 #include <linux/nfs_fs.h> 19 20 #include <linux/nfs_fs_sb.h>
+1 -1
ipc/mqueue.c
··· 602 602 dentry->d_fsdata = attr; 603 603 } 604 604 605 - mode &= ~current->fs->umask; 605 + mode &= ~current_umask(); 606 606 ret = mnt_want_write(mqueue_mnt); 607 607 if (ret) 608 608 goto out;
+1
kernel/auditsc.c
··· 66 66 #include <linux/syscalls.h> 67 67 #include <linux/inotify.h> 68 68 #include <linux/capability.h> 69 + #include <linux/fs_struct.h> 69 70 70 71 #include "audit.h" 71 72
+1 -22
kernel/exec_domain.c
··· 18 18 #include <linux/syscalls.h> 19 19 #include <linux/sysctl.h> 20 20 #include <linux/types.h> 21 + #include <linux/fs_struct.h> 21 22 22 23 23 24 static void default_handler(int, struct pt_regs *); ··· 145 144 module_put(ep->module); 146 145 return 0; 147 146 } 148 - 149 - if (atomic_read(&current->fs->count) != 1) { 150 - struct fs_struct *fsp, *ofsp; 151 - 152 - fsp = copy_fs_struct(current->fs); 153 - if (fsp == NULL) { 154 - module_put(ep->module); 155 - return -ENOMEM; 156 - } 157 - 158 - task_lock(current); 159 - ofsp = current->fs; 160 - current->fs = fsp; 161 - task_unlock(current); 162 - 163 - put_fs_struct(ofsp); 164 - } 165 - 166 - /* 167 - * At that point we are guaranteed to be the sole owner of 168 - * current->fs. 169 - */ 170 147 171 148 current->personality = personality; 172 149 oep = current_thread_info()->exec_domain;
+2 -30
kernel/exit.c
··· 46 46 #include <linux/blkdev.h> 47 47 #include <linux/task_io_accounting_ops.h> 48 48 #include <linux/tracehook.h> 49 + #include <linux/fs_struct.h> 49 50 #include <linux/init_task.h> 50 51 #include <trace/sched.h> 51 52 ··· 421 420 void daemonize(const char *name, ...) 422 421 { 423 422 va_list args; 424 - struct fs_struct *fs; 425 423 sigset_t blocked; 426 424 427 425 va_start(args, name); ··· 453 453 454 454 /* Become as one with the init task */ 455 455 456 - exit_fs(current); /* current->fs->count--; */ 457 - fs = init_task.fs; 458 - current->fs = fs; 459 - atomic_inc(&fs->count); 460 - 456 + daemonize_fs_struct(); 461 457 exit_files(current); 462 458 current->files = init_task.files; 463 459 atomic_inc(&current->files->count); ··· 551 555 put_files_struct(files); 552 556 } 553 557 } 554 - 555 - void put_fs_struct(struct fs_struct *fs) 556 - { 557 - /* No need to hold fs->lock if we are killing it */ 558 - if (atomic_dec_and_test(&fs->count)) { 559 - path_put(&fs->root); 560 - path_put(&fs->pwd); 561 - kmem_cache_free(fs_cachep, fs); 562 - } 563 - } 564 - 565 - void exit_fs(struct task_struct *tsk) 566 - { 567 - struct fs_struct * fs = tsk->fs; 568 - 569 - if (fs) { 570 - task_lock(tsk); 571 - tsk->fs = NULL; 572 - task_unlock(tsk); 573 - put_fs_struct(fs); 574 - } 575 - } 576 - 577 - EXPORT_SYMBOL_GPL(exit_fs); 578 558 579 559 #ifdef CONFIG_MM_OWNER 580 560 /*
+28 -35
kernel/fork.c
··· 60 60 #include <linux/tty.h> 61 61 #include <linux/proc_fs.h> 62 62 #include <linux/blkdev.h> 63 + #include <linux/fs_struct.h> 63 64 #include <trace/sched.h> 64 65 #include <linux/magic.h> 65 66 ··· 682 681 return retval; 683 682 } 684 683 685 - static struct fs_struct *__copy_fs_struct(struct fs_struct *old) 686 - { 687 - struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL); 688 - /* We don't need to lock fs - think why ;-) */ 689 - if (fs) { 690 - atomic_set(&fs->count, 1); 691 - rwlock_init(&fs->lock); 692 - fs->umask = old->umask; 693 - read_lock(&old->lock); 694 - fs->root = old->root; 695 - path_get(&old->root); 696 - fs->pwd = old->pwd; 697 - path_get(&old->pwd); 698 - read_unlock(&old->lock); 699 - } 700 - return fs; 701 - } 702 - 703 - struct fs_struct *copy_fs_struct(struct fs_struct *old) 704 - { 705 - return __copy_fs_struct(old); 706 - } 707 - 708 - EXPORT_SYMBOL_GPL(copy_fs_struct); 709 - 710 684 static int copy_fs(unsigned long clone_flags, struct task_struct *tsk) 711 685 { 686 + struct fs_struct *fs = current->fs; 712 687 if (clone_flags & CLONE_FS) { 713 - atomic_inc(&current->fs->count); 688 + /* tsk->fs is already what we want */ 689 + write_lock(&fs->lock); 690 + if (fs->in_exec) { 691 + write_unlock(&fs->lock); 692 + return -EAGAIN; 693 + } 694 + fs->users++; 695 + write_unlock(&fs->lock); 714 696 return 0; 715 697 } 716 - tsk->fs = __copy_fs_struct(current->fs); 698 + tsk->fs = copy_fs_struct(fs); 717 699 if (!tsk->fs) 718 700 return -ENOMEM; 719 701 return 0; ··· 1528 1544 { 1529 1545 struct fs_struct *fs = current->fs; 1530 1546 1531 - if ((unshare_flags & CLONE_FS) && 1532 - (fs && atomic_read(&fs->count) > 1)) { 1533 - *new_fsp = __copy_fs_struct(current->fs); 1534 - if (!*new_fsp) 1535 - return -ENOMEM; 1536 - } 1547 + if (!(unshare_flags & CLONE_FS) || !fs) 1548 + return 0; 1549 + 1550 + /* don't need lock here; in the worst case we'll do useless copy */ 1551 + if (fs->users == 1) 1552 + return 0; 1553 + 1554 + *new_fsp = copy_fs_struct(fs); 1555 + if (!*new_fsp) 1556 + return -ENOMEM; 1537 1557 1538 1558 return 0; 1539 1559 } ··· 1653 1665 1654 1666 if (new_fs) { 1655 1667 fs = current->fs; 1668 + write_lock(&fs->lock); 1656 1669 current->fs = new_fs; 1657 - new_fs = fs; 1670 + if (--fs->users) 1671 + new_fs = NULL; 1672 + else 1673 + new_fs = fs; 1674 + write_unlock(&fs->lock); 1658 1675 } 1659 1676 1660 1677 if (new_mm) { ··· 1698 1705 1699 1706 bad_unshare_cleanup_fs: 1700 1707 if (new_fs) 1701 - put_fs_struct(new_fs); 1708 + free_fs_struct(new_fs); 1702 1709 1703 1710 bad_unshare_cleanup_thread: 1704 1711 bad_unshare_out:
+1
kernel/sys.c
··· 34 34 #include <linux/seccomp.h> 35 35 #include <linux/cpu.h> 36 36 #include <linux/ptrace.h> 37 + #include <linux/fs_struct.h> 37 38 38 39 #include <linux/compat.h> 39 40 #include <linux/syscalls.h>
+1 -1
net/unix/af_unix.c
··· 832 832 * All right, let's create it. 833 833 */ 834 834 mode = S_IFSOCK | 835 - (SOCK_INODE(sock)->i_mode & ~current->fs->umask); 835 + (SOCK_INODE(sock)->i_mode & ~current_umask()); 836 836 err = mnt_want_write(nd.path.mnt); 837 837 if (err) 838 838 goto out_mknod_dput;
+1
security/tomoyo/realpath.c
··· 12 12 #include <linux/types.h> 13 13 #include <linux/mount.h> 14 14 #include <linux/mnt_namespace.h> 15 + #include <linux/fs_struct.h> 15 16 #include "common.h" 16 17 #include "realpath.h" 17 18