diff options
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/base.c | 38 | ||||
-rw-r--r-- | fs/proc/kcore.c | 8 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 3 | ||||
-rw-r--r-- | fs/proc/uptime.c | 7 |
4 files changed, 16 insertions, 40 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index a0f94952faf2..baf53d92081a 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -127,8 +127,6 @@ struct pid_entry { NOD(NAME, (S_IFREG|(MODE)), \ NULL, &proc_single_file_operations, \ { .proc_show = show } ) -#define ARD(NAME, MODE, iops, fops) \ - NOD(NAME, (S_IFREG|(MODE)), &iops, &fops, {} ) /* * Count the number of hardlinks for the pid_entry table, excluding the . @@ -1045,35 +1043,6 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, return end - buffer; } -#ifdef CONFIG_ANDROID -static int oom_adjust_permission(struct inode *inode, int mask) -{ - uid_t uid; - struct task_struct *p = get_proc_task(inode); - if(p) { - uid = task_uid(p); - put_task_struct(p); - } - - /* - * System Server (uid == 1000) is granted access to oom_adj of all - * android applications (uid > 10000) as and services (uid >= 1000) - */ - if (p && (current_fsuid() == 1000) && (uid >= 1000)) { - if (inode->i_mode >> 6 & mask) { - return 0; - } - } - - /* Fall back to default. */ - return generic_permission(inode, mask, NULL); -} - -static const struct inode_operations proc_oom_adjust_inode_operations = { - .permission = oom_adjust_permission, -}; -#endif - static const struct file_operations proc_oom_adjust_operations = { .read = oom_adjust_read, .write = oom_adjust_write, @@ -2562,11 +2531,7 @@ static const struct pid_entry tgid_base_stuff[] = { REG("cgroup", S_IRUGO, proc_cgroup_operations), #endif INF("oom_score", S_IRUGO, proc_oom_score), -#ifndef CONFIG_ANDROID REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adjust_operations), -#else - ARD("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adjust_inode_operations, proc_oom_adjust_operations), -#endif #ifdef CONFIG_AUDITSYSCALL REG("loginuid", S_IWUSR|S_IRUGO, proc_loginuid_operations), REG("sessionid", S_IRUGO, proc_sessionid_operations), @@ -2615,8 +2580,7 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) name.len = snprintf(buf, sizeof(buf), "%d", pid); dentry = d_hash_and_lookup(mnt->mnt_root, &name); if (dentry) { - if (!(current->flags & PF_EXITING)) - shrink_dcache_parent(dentry); + shrink_dcache_parent(dentry); d_drop(dentry); dput(dentry); } diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 59b43a068872..5fd7d2b3da82 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -361,7 +361,13 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) /* don't dump ioremap'd stuff! (TA) */ if (m->flags & VM_IOREMAP) continue; - memcpy(elf_buf + (vmstart - start), + /* + * we may access memory holes, then use + * ex_table. checking return value just for + * avoid warnings. + */ + vmsize = __copy_from_user_inatomic( + elf_buf + (vmstart - start), (char *)vmstart, vmsize); } read_unlock(&vmlist_lock); diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 07376a4a3ed1..9bd8be1d235c 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -689,6 +689,8 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, down_read(¤t->mm->mmap_sem); ret = get_user_pages(current, current->mm, uaddr, pagecount, 1, 0, pages, NULL); + up_read(¤t->mm->mmap_sem); + if (ret < 0) goto out_free; @@ -737,7 +739,6 @@ out_pages: page_cache_release(page); } out_free: - up_read(¤t->mm->mmap_sem); kfree(pages); out_mm: mmput(mm); diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c index 0c10a0b3f146..766b1d456050 100644 --- a/fs/proc/uptime.c +++ b/fs/proc/uptime.c @@ -4,13 +4,18 @@ #include <linux/sched.h> #include <linux/seq_file.h> #include <linux/time.h> +#include <linux/kernel_stat.h> #include <asm/cputime.h> static int uptime_proc_show(struct seq_file *m, void *v) { struct timespec uptime; struct timespec idle; - cputime_t idletime = cputime_add(init_task.utime, init_task.stime); + int i; + cputime_t idletime = cputime_zero; + + for_each_possible_cpu(i) + idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle); do_posix_clock_monotonic_gettime(&uptime); monotonic_to_bootbased(&uptime); |