diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-10 16:04:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-10 16:04:49 -0400 |
commit | abb5a14fa20fdd400995926134b7be9eb8ce6048 (patch) | |
tree | 085add41cae3193b8c8293d25b453fd1ecae0c19 /fs/proc/base.c | |
parent | 911f9dab301e8583143c7e75b552eadd434ea0a8 (diff) | |
parent | e55f1d1d13e7f1c364672d667d78fd1f640ab9f9 (diff) |
Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc vfs updates from Al Viro:
"Assorted misc bits and pieces.
There are several single-topic branches left after this (rename2
series from Miklos, current_time series from Deepa Dinamani, xattr
series from Andreas, uaccess stuff from from me) and I'd prefer to
send those separately"
* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (39 commits)
proc: switch auxv to use of __mem_open()
hpfs: support FIEMAP
cifs: get rid of unused arguments of CIFSSMBWrite()
posix_acl: uapi header split
posix_acl: xattr representation cleanups
fs/aio.c: eliminate redundant loads in put_aio_ring_file
fs/internal.h: add const to ns_dentry_operations declaration
compat: remove compat_printk()
fs/buffer.c: make __getblk_slow() static
proc: unsigned file descriptors
fs/file: more unsigned file descriptors
fs: compat: remove redundant check of nr_segs
cachefiles: Fix attempt to read i_blocks after deleting file [ver #2]
cifs: don't use memcpy() to copy struct iov_iter
get rid of separate multipage fault-in primitives
fs: Avoid premature clearing of capabilities
fs: Give dentry to inode_change_ok() instead of inode
fuse: Propagate dentry down to inode_change_ok()
ceph: Propagate dentry down to inode_change_ok()
xfs: Propagate dentry down to inode_change_ok()
...
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index dc7fe5f3a53c..29fd7ef97be9 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -400,23 +400,6 @@ static const struct file_operations proc_pid_cmdline_ops = { | |||
400 | .llseek = generic_file_llseek, | 400 | .llseek = generic_file_llseek, |
401 | }; | 401 | }; |
402 | 402 | ||
403 | static int proc_pid_auxv(struct seq_file *m, struct pid_namespace *ns, | ||
404 | struct pid *pid, struct task_struct *task) | ||
405 | { | ||
406 | struct mm_struct *mm = mm_access(task, PTRACE_MODE_READ_FSCREDS); | ||
407 | if (mm && !IS_ERR(mm)) { | ||
408 | unsigned int nwords = 0; | ||
409 | do { | ||
410 | nwords += 2; | ||
411 | } while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */ | ||
412 | seq_write(m, mm->saved_auxv, nwords * sizeof(mm->saved_auxv[0])); | ||
413 | mmput(mm); | ||
414 | return 0; | ||
415 | } else | ||
416 | return PTR_ERR(mm); | ||
417 | } | ||
418 | |||
419 | |||
420 | #ifdef CONFIG_KALLSYMS | 403 | #ifdef CONFIG_KALLSYMS |
421 | /* | 404 | /* |
422 | * Provides a wchan file via kallsyms in a proper one-value-per-file format. | 405 | * Provides a wchan file via kallsyms in a proper one-value-per-file format. |
@@ -709,7 +692,7 @@ int proc_setattr(struct dentry *dentry, struct iattr *attr) | |||
709 | if (attr->ia_valid & ATTR_MODE) | 692 | if (attr->ia_valid & ATTR_MODE) |
710 | return -EPERM; | 693 | return -EPERM; |
711 | 694 | ||
712 | error = inode_change_ok(inode, attr); | 695 | error = setattr_prepare(dentry, attr); |
713 | if (error) | 696 | if (error) |
714 | return error; | 697 | return error; |
715 | 698 | ||
@@ -1014,6 +997,30 @@ static const struct file_operations proc_environ_operations = { | |||
1014 | .release = mem_release, | 997 | .release = mem_release, |
1015 | }; | 998 | }; |
1016 | 999 | ||
1000 | static int auxv_open(struct inode *inode, struct file *file) | ||
1001 | { | ||
1002 | return __mem_open(inode, file, PTRACE_MODE_READ_FSCREDS); | ||
1003 | } | ||
1004 | |||
1005 | static ssize_t auxv_read(struct file *file, char __user *buf, | ||
1006 | size_t count, loff_t *ppos) | ||
1007 | { | ||
1008 | struct mm_struct *mm = file->private_data; | ||
1009 | unsigned int nwords = 0; | ||
1010 | do { | ||
1011 | nwords += 2; | ||
1012 | } while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */ | ||
1013 | return simple_read_from_buffer(buf, count, ppos, mm->saved_auxv, | ||
1014 | nwords * sizeof(mm->saved_auxv[0])); | ||
1015 | } | ||
1016 | |||
1017 | static const struct file_operations proc_auxv_operations = { | ||
1018 | .open = auxv_open, | ||
1019 | .read = auxv_read, | ||
1020 | .llseek = generic_file_llseek, | ||
1021 | .release = mem_release, | ||
1022 | }; | ||
1023 | |||
1017 | static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count, | 1024 | static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count, |
1018 | loff_t *ppos) | 1025 | loff_t *ppos) |
1019 | { | 1026 | { |
@@ -2842,7 +2849,7 @@ static const struct pid_entry tgid_base_stuff[] = { | |||
2842 | DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations), | 2849 | DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations), |
2843 | #endif | 2850 | #endif |
2844 | REG("environ", S_IRUSR, proc_environ_operations), | 2851 | REG("environ", S_IRUSR, proc_environ_operations), |
2845 | ONE("auxv", S_IRUSR, proc_pid_auxv), | 2852 | REG("auxv", S_IRUSR, proc_auxv_operations), |
2846 | ONE("status", S_IRUGO, proc_pid_status), | 2853 | ONE("status", S_IRUGO, proc_pid_status), |
2847 | ONE("personality", S_IRUSR, proc_pid_personality), | 2854 | ONE("personality", S_IRUSR, proc_pid_personality), |
2848 | ONE("limits", S_IRUGO, proc_pid_limits), | 2855 | ONE("limits", S_IRUGO, proc_pid_limits), |
@@ -3230,7 +3237,7 @@ static const struct pid_entry tid_base_stuff[] = { | |||
3230 | DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations), | 3237 | DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations), |
3231 | #endif | 3238 | #endif |
3232 | REG("environ", S_IRUSR, proc_environ_operations), | 3239 | REG("environ", S_IRUSR, proc_environ_operations), |
3233 | ONE("auxv", S_IRUSR, proc_pid_auxv), | 3240 | REG("auxv", S_IRUSR, proc_auxv_operations), |
3234 | ONE("status", S_IRUGO, proc_pid_status), | 3241 | ONE("status", S_IRUGO, proc_pid_status), |
3235 | ONE("personality", S_IRUSR, proc_pid_personality), | 3242 | ONE("personality", S_IRUSR, proc_pid_personality), |
3236 | ONE("limits", S_IRUGO, proc_pid_limits), | 3243 | ONE("limits", S_IRUGO, proc_pid_limits), |