Release 4.10 fs/proc/base.c
/*
* linux/fs/proc/base.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* proc base directory handling functions
*
* 1999, Al Viro. Rewritten. Now it covers the whole per-process part.
* Instead of using magical inumbers to determine the kind of object
* we allocate and fill in-core inodes upon lookup. They don't even
* go into icache. We cache the reference to task_struct upon lookup too.
* Eventually it should become a filesystem in its own. We don't use the
* rest of procfs anymore.
*
*
* Changelog:
* 17-Jan-2005
* Allan Bezerra
* Bruna Moreira <bruna.moreira@indt.org.br>
* Edjard Mota <edjard.mota@indt.org.br>
* Ilias Biris <ilias.biris@indt.org.br>
* Mauricio Lin <mauricio.lin@indt.org.br>
*
* Embedded Linux Lab - 10LE Instituto Nokia de Tecnologia - INdT
*
* A new process specific entry (smaps) included in /proc. It shows the
* size of rss for each memory area. The maps entry lacks information
* about physical memory size (rss) for each mapped file, i.e.,
* rss information for executables and library files.
* This additional information is useful for any tools that need to know
* about physical memory consumption for a process specific library.
*
* Changelog:
* 21-Feb-2005
* Embedded Linux Lab - 10LE Instituto Nokia de Tecnologia - INdT
* Pud inclusion in the page table walking.
*
* ChangeLog:
* 10-Mar-2005
* 10LE Instituto Nokia de Tecnologia - INdT:
* A better way to walks through the page table as suggested by Hugh Dickins.
*
* Simo Piiroinen <simo.piiroinen@nokia.com>:
* Smaps information related to shared, private, clean and dirty pages.
*
* Paul Mundt <paul.mundt@nokia.com>:
* Overall revision about smaps.
*/
#include <linux/uaccess.h>
#include <linux/errno.h>
#include <linux/time.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/task_io_accounting_ops.h>
#include <linux/init.h>
#include <linux/capability.h>
#include <linux/file.h>
#include <linux/fdtable.h>
#include <linux/string.h>
#include <linux/seq_file.h>
#include <linux/namei.h>
#include <linux/mnt_namespace.h>
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/rcupdate.h>
#include <linux/kallsyms.h>
#include <linux/stacktrace.h>
#include <linux/resource.h>
#include <linux/module.h>
#include <linux/mount.h>
#include <linux/security.h>
#include <linux/ptrace.h>
#include <linux/tracehook.h>
#include <linux/printk.h>
#include <linux/cgroup.h>
#include <linux/cpuset.h>
#include <linux/audit.h>
#include <linux/poll.h>
#include <linux/nsproxy.h>
#include <linux/oom.h>
#include <linux/elf.h>
#include <linux/pid_namespace.h>
#include <linux/user_namespace.h>
#include <linux/fs_struct.h>
#include <linux/slab.h>
#include <linux/flex_array.h>
#include <linux/posix-timers.h>
#ifdef CONFIG_HARDWALL
#include <asm/hardwall.h>
#endif
#include <trace/events/oom.h>
#include "internal.h"
#include "fd.h"
/* NOTE:
* Implementing inode permission operations in /proc is almost
* certainly an error. Permission checks need to happen during
* each system call not at open time. The reason is that most of
* what we wish to check for permissions in /proc varies at runtime.
*
* The classic example of a problem is opening file descriptors
* in /proc for a task before it execs a suid executable.
*/
static u8 nlink_tid;
static u8 nlink_tgid;
struct pid_entry {
const char *name;
unsigned int len;
umode_t mode;
const struct inode_operations *iop;
const struct file_operations *fop;
union proc_op op;
};
#define NOD(NAME, MODE, IOP, FOP, OP) { \
.name = (NAME), \
.len = sizeof(NAME) - 1, \
.mode = MODE, \
.iop = IOP, \
.fop = FOP, \
.op = OP, \
}
#define DIR(NAME, MODE, iops, fops) \
NOD(NAME, (S_IFDIR|(MODE)), &iops, &fops, {} )
#define LNK(NAME, get_link) \
NOD(NAME, (S_IFLNK|S_IRWXUGO), \
&proc_pid_link_inode_operations, NULL, \
{ .proc_get_link = get_link } )
#define REG(NAME, MODE, fops) \
NOD(NAME, (S_IFREG|(MODE)), NULL, &fops, {})
#define ONE(NAME, MODE, show) \
NOD(NAME, (S_IFREG|(MODE)), \
NULL, &proc_single_file_operations, \
{ .proc_show = show } )
/*
* Count the number of hardlinks for the pid_entry table, excluding the .
* and .. links.
*/
static unsigned int __init pid_entry_nlink(const struct pid_entry *entries,
unsigned int n)
{
unsigned int i;
unsigned int count;
count = 2;
for (i = 0; i < n; ++i) {
if (S_ISDIR(entries[i].mode))
++count;
}
return count;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
vegard nossum | vegard nossum | 60 | 95.24% | 1 | 50.00% |
alexey dobriyan | alexey dobriyan | 3 | 4.76% | 1 | 50.00% |
| Total | 63 | 100.00% | 2 | 100.00% |
static int get_task_root(struct task_struct *task, struct path *root)
{
int result = -ENOENT;
task_lock(task);
if (task->fs) {
get_fs_root(task->fs, root);
result = 0;
}
task_unlock(task);
return result;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
hugh dickins | hugh dickins | 23 | 41.07% | 1 | 25.00% |
eric w. biederman | eric w. biederman | 20 | 35.71% | 1 | 25.00% |
albert cahalan | albert cahalan | 7 | 12.50% | 1 | 25.00% |
miklos szeredi | miklos szeredi | 6 | 10.71% | 1 | 25.00% |
| Total | 56 | 100.00% | 4 | 100.00% |
static int proc_cwd_link(struct dentry *dentry, struct path *path)
{
struct task_struct *task = get_proc_task(d_inode(dentry));
int result = -ENOENT;
if (task) {
task_lock(task);
if (task->fs) {
get_fs_pwd(task->fs, path);
result = 0;
}
task_unlock(task);
put_task_struct(task);
}
return result;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
eric w. biederman | eric w. biederman | 39 | 48.75% | 1 | 14.29% |
miklos szeredi | miklos szeredi | 24 | 30.00% | 1 | 14.29% |
albert cahalan | albert cahalan | 6 | 7.50% | 1 | 14.29% |
hugh dickins | hugh dickins | 3 | 3.75% | 1 | 14.29% |
david howells | david howells | 3 | 3.75% | 1 | 14.29% |
cyrill gorcunov | cyrill gorcunov | 3 | 3.75% | 1 | 14.29% |
jan blunck | jan blunck | 2 | 2.50% | 1 | 14.29% |
| Total | 80 | 100.00% | 7 | 100.00% |
static int proc_root_link(struct dentry *dentry, struct path *path)
{
struct task_struct *task = get_proc_task(d_inode(dentry));
int result = -ENOENT;
if (task) {
result = get_task_root(task, path);
put_task_struct(task);
}
return result;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
eric w. biederman | eric w. biederman | 39 | 67.24% | 1 | 12.50% |
albert cahalan | albert cahalan | 5 | 8.62% | 1 | 12.50% |
cyrill gorcunov | cyrill gorcunov | 3 | 5.17% | 1 | 12.50% |
hugh dickins | hugh dickins | 3 | 5.17% | 1 | 12.50% |
david howells | david howells | 3 | 5.17% | 1 | 12.50% |
chuck lever | chuck lever | 2 | 3.45% | 1 | 12.50% |
jan blunck | jan blunck | 2 | 3.45% | 1 | 12.50% |
miklos szeredi | miklos szeredi | 1 | 1.72% | 1 | 12.50% |
| Total | 58 | 100.00% | 8 | 100.00% |
static ssize_t proc_pid_cmdline_read(struct file *file, char __user *buf,
size_t _count, loff_t *pos)
{
struct task_struct *tsk;
struct mm_struct *mm;
char *page;
unsigned long count = _count;
unsigned long arg_start, arg_end, env_start, env_end;
unsigned long len1, len2, len;
unsigned long p;
char c;
ssize_t rv;
BUG_ON(*pos < 0);
tsk = get_proc_task(file_inode(file));
if (!tsk)
return -ESRCH;
mm = get_task_mm(tsk);
put_task_struct(tsk);
if (!mm)
return 0;
/* Check if process spawned far enough to have cmdline. */
if (!mm->env_end) {
rv = 0;
goto out_mmput;
}
page = (char *)__get_free_page(GFP_TEMPORARY);
if (!page) {
rv = -ENOMEM;
goto out_mmput;
}
down_read(&mm->mmap_sem);
arg_start = mm->arg_start;
arg_end = mm->arg_end;
env_start = mm->env_start;
env_end = mm->env_end;
up_read(&mm->mmap_sem);
BUG_ON(arg_start > arg_end);
BUG_ON(env_start > env_end);
len1 = arg_end - arg_start;
len2 = env_end - env_start;
/* Empty ARGV. */
if (len1 == 0) {
rv = 0;
goto out_free_page;
}
/*
* Inherently racy -- command line shares address space
* with code and data.
*/
rv = access_remote_vm(mm, arg_end - 1, &c, 1, 0);
if (rv <= 0)
goto out_free_page;
rv = 0;
if (c == '\0') {
/* Command line (set of strings) occupies whole ARGV. */
if (len1 <= *pos)
goto out_free_page;
p = arg_start + *pos;
len = len1 - *pos;
while (count > 0 && len > 0) {
unsigned int _count;
int nr_read;
_count = min3(count, len, PAGE_SIZE);
nr_read = access_remote_vm(mm, p, page, _count, 0);
if (nr_read < 0)
rv = nr_read;
if (nr_read <= 0)
goto out_free_page;
if (copy_to_user(buf, page, nr_read)) {
rv = -EFAULT;
goto out_free_page;
}
p += nr_read;
len -= nr_read;
buf += nr_read;
count -= nr_read;
rv += nr_read;
}
} else {
/*
* Command line (1 string) occupies ARGV and maybe
* extends into ENVP.
*/
if (len1 + len2 <= *pos)
goto skip_argv_envp;
if (len1 <= *pos)
goto skip_argv;
p = arg_start + *pos;
len = len1 - *pos;
while (count > 0 && len > 0) {
unsigned int _count, l;
int nr_read;
bool final;
_count = min3(count, len, PAGE_SIZE);
nr_read = access_remote_vm(mm, p, page, _count, 0);
if (nr_read < 0)
rv = nr_read;
if (nr_read <= 0)
goto out_free_page;
/*
* Command line can be shorter than whole ARGV
* even if last "marker" byte says it is not.
*/
final = false;
l = strnlen(page, nr_read);
if (l < nr_read) {
nr_read = l;
final = true;
}
if (copy_to_user(buf, page, nr_read)) {
rv = -EFAULT;
goto out_free_page;
}
p += nr_read;
len -= nr_read;
buf += nr_read;
count -= nr_read;
rv += nr_read;
if (final)
goto out_free_page;
}
skip_argv:
/*
* Command line (1 string) occupies ARGV and
* extends into ENVP.
*/
if (len1 <= *pos) {
p = env_start + *pos - len1;
len = len1 + len2 - *pos;
} else {
p = env_start;
len = len2;
}
while (count > 0 && len > 0) {
unsigned int _count, l;
int nr_read;
bool final;
_count = min3(count, len, PAGE_SIZE);
nr_read = access_remote_vm(mm, p, page, _count, 0);
if (nr_read < 0)
rv = nr_read;
if (nr_read <= 0)
goto out_free_page;
/* Find EOS. */
final = false;
l = strnlen(page, nr_read);
if (l < nr_read) {
nr_read = l;
final = true;
}
if (copy_to_user(buf, page, nr_read)) {
rv = -EFAULT;
goto out_free_page;
}
p += nr_read;
len -= nr_read;
buf += nr_read;
count -= nr_read;
rv += nr_read;
if (final)
goto out_free_page;
}
skip_argv_envp:
;
}
out_free_page:
free_page((unsigned long)page);
out_mmput:
mmput(mm);
if (rv > 0)
*pos += rv;
return rv;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexey dobriyan | alexey dobriyan | 805 | 97.81% | 3 | 37.50% |
eric w. biederman | eric w. biederman | 10 | 1.22% | 1 | 12.50% |
linus torvalds | linus torvalds | 4 | 0.49% | 1 | 12.50% |
christoph lameter | christoph lameter | 2 | 0.24% | 1 | 12.50% |
andrea arcangeli | andrea arcangeli | 1 | 0.12% | 1 | 12.50% |
al viro | al viro | 1 | 0.12% | 1 | 12.50% |
| Total | 823 | 100.00% | 8 | 100.00% |
static const struct file_operations proc_pid_cmdline_ops = {
.read = proc_pid_cmdline_read,
.llseek = generic_file_llseek,
};
#ifdef CONFIG_KALLSYMS
/*
* Provides a wchan file via kallsyms in a proper one-value-per-file format.
* Returns the resolved symbol. If that fails, simply return the address.
*/
static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
unsigned long wchan;
char symname[KSYM_NAME_LEN];
wchan = get_wchan(task);
if (wchan && ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)
&& !lookup_symbol_name(wchan, symname))
seq_printf(m, "%s", symname);
else
seq_putc(m, '0');
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
eric w. biederman | eric w. biederman | 28 | 34.15% | 1 | 9.09% |
alexey dobriyan | alexey dobriyan | 22 | 26.83% | 2 | 18.18% |
ingo molnar | ingo molnar | 11 | 13.41% | 1 | 9.09% |
jake edge | jake edge | 6 | 7.32% | 1 | 9.09% |
joe perches | joe perches | 4 | 4.88% | 1 | 9.09% |
rick lindsley | rick lindsley | 4 | 4.88% | 1 | 9.09% |
paul jackson | paul jackson | 3 | 3.66% | 1 | 9.09% |
robin humble | robin humble | 2 | 2.44% | 1 | 9.09% |
robert love | robert love | 1 | 1.22% | 1 | 9.09% |
jann horn | jann horn | 1 | 1.22% | 1 | 9.09% |
| Total | 82 | 100.00% | 11 | 100.00% |
#endif /* CONFIG_KALLSYMS */
static int lock_trace(struct task_struct *task)
{
int err = mutex_lock_killable(&task->signal->cred_guard_mutex);
if (err)
return err;
if (!ptrace_may_access(task, PTRACE_MODE_ATTACH_FSCREDS)) {
mutex_unlock(&task->signal->cred_guard_mutex);
return -EPERM;
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
al viro | al viro | 59 | 98.33% | 1 | 50.00% |
jann horn | jann horn | 1 | 1.67% | 1 | 50.00% |
| Total | 60 | 100.00% | 2 | 100.00% |
static void unlock_trace(struct task_struct *task)
{
mutex_unlock(&task->signal->cred_guard_mutex);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
al viro | al viro | 21 | 100.00% | 1 | 100.00% |
| Total | 21 | 100.00% | 1 | 100.00% |
#ifdef CONFIG_STACKTRACE
#define MAX_STACK_TRACE_DEPTH 64
static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
struct stack_trace trace;
unsigned long *entries;
int err;
int i;
entries = kmalloc(MAX_STACK_TRACE_DEPTH * sizeof(*entries), GFP_KERNEL);
if (!entries)
return -ENOMEM;
trace.nr_entries = 0;
trace.max_entries = MAX_STACK_TRACE_DEPTH;
trace.entries = entries;
trace.skip = 0;
err = lock_trace(task);
if (!err) {
save_stack_trace_tsk(task, &trace);
for (i = 0; i < trace.nr_entries; i++) {
seq_printf(m, "[<%pK>] %pB\n",
(void *)entries[i], (void *)entries[i]);
}
unlock_trace(task);
}
kfree(entries);
return err;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
ken chen | ken chen | 142 | 85.54% | 1 | 33.33% |
al viro | al viro | 23 | 13.86% | 1 | 33.33% |
josh poimboeuf | josh poimboeuf | 1 | 0.60% | 1 | 33.33% |
| Total | 166 | 100.00% | 3 | 100.00% |
#endif
#ifdef CONFIG_SCHED_INFO
/*
* Provides /proc/PID/schedstat
*/
static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
if (unlikely(!sched_info_on()))
seq_printf(m, "0 0 0\n");
else
seq_printf(m, "%llu %llu %lu\n",
(unsigned long long)task->se.sum_exec_runtime,
(unsigned long long)task->sched_info.run_delay,
task->sched_info.pcount);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
eric w. biederman | eric w. biederman | 21 | 25.93% | 1 | 11.11% |
alexey dobriyan | alexey dobriyan | 17 | 20.99% | 1 | 11.11% |
naveen n. rao | naveen n. rao | 17 | 20.99% | 1 | 11.11% |
ingo molnar | ingo molnar | 11 | 13.58% | 2 | 22.22% |
andrew morton | andrew morton | 9 | 11.11% | 1 | 11.11% |
joe perches | joe perches | 3 | 3.70% | 1 | 11.11% |
ken chen | ken chen | 2 | 2.47% | 1 | 11.11% |
balbir singh | balbir singh | 1 | 1.23% | 1 | 11.11% |
| Total | 81 | 100.00% | 9 | 100.00% |
#endif
#ifdef CONFIG_LATENCYTOP
static int lstats_show_proc(struct seq_file *m, void *v)
{
int i;
struct inode *inode = m->private;
struct task_struct *task = get_proc_task(inode);
if (!task)
return -ESRCH;
seq_puts(m, "Latency Top version : v0.1\n");
for (i = 0; i < 32; i++) {
struct latency_record *lr = &task->latency_record[i];
if (lr->backtrace[0]) {
int q;
seq_printf(m, "%i %li %li",
lr->count, lr->time, lr->max);
for (q = 0; q < LT_BACKTRACEDEPTH; q++) {
unsigned long bt = lr->backtrace[q];
if (!bt)
break;
if (bt == ULONG_MAX)
break;
seq_printf(m, " %ps", (void *)bt);
}
seq_putc(m, '\n');
}
}
put_task_struct(task);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
arjan van de ven | arjan van de ven | 122 | 67.40% | 1 | 25.00% |
joe perches | joe perches | 31 | 17.13% | 1 | 25.00% |
hiroshi shimamoto | hiroshi shimamoto | 26 | 14.36% | 1 | 25.00% |
alexey dobriyan | alexey dobriyan | 2 | 1.10% | 1 | 25.00% |
| Total | 181 | 100.00% | 4 | 100.00% |
static int lstats_open(struct inode *inode, struct file *file)
{
return single_open(file, lstats_show_proc, inode);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
arjan van de ven | arjan van de ven | 21 | 80.77% | 1 | 33.33% |
hiroshi shimamoto | hiroshi shimamoto | 5 | 19.23% | 2 | 66.67% |
| Total | 26 | 100.00% | 3 | 100.00% |
static ssize_t lstats_write(struct file *file, const char __user *buf,
size_t count, loff_t *offs)
{
struct task_struct *task = get_proc_task(file_inode(file));
if (!task)
return -ESRCH;
clear_all_latency_tracing(task);
put_task_struct(task);
return count;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
arjan van de ven | arjan van de ven | 37 | 62.71% | 1 | 33.33% |
hiroshi shimamoto | hiroshi shimamoto | 19 | 32.20% | 1 | 33.33% |
al viro | al viro | 3 | 5.08% | 1 | 33.33% |
| Total | 59 | 100.00% | 3 | 100.00% |
static const struct file_operations proc_lstats_operations = {
.open = lstats_open,
.read = seq_read,
.write = lstats_write,
.llseek = seq_lseek,
.release = single_release,
};
#endif
static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
unsigned long totalpages = totalram_pages + total_swap_pages;
unsigned long points = 0;
points = oom_badness(task, NULL, NULL, totalpages) *
1000 / totalpages;
seq_printf(m, "%lu\n", points);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
eric w. biederman | eric w. biederman | 21 | 30.43% | 1 | 10.00% |
alexey dobriyan | alexey dobriyan | 17 | 24.64% | 1 | 10.00% |
david rientjes | david rientjes | 14 | 20.29% | 2 | 20.00% |
eric paris | eric paris | 4 | 5.80% | 1 | 10.00% |
kosaki motohiro | kosaki motohiro | 4 | 5.80% | 1 | 10.00% |
joe perches | joe perches | 3 | 4.35% | 1 | 10.00% |
michael lemay | michael lemay | 3 | 4.35% | 1 | 10.00% |
oleg nesterov | oleg nesterov | 2 | 2.90% | 1 | 10.00% |
andrew morton | andrew morton | 1 | 1.45% | 1 | 10.00% |
| Total | 69 | 100.00% | 10 | 100.00% |
struct limit_names {
const char *name;
const char *unit;
};
static const struct limit_names lnames[RLIM_NLIMITS] = {
[RLIMIT_CPU] = {"Max cpu time", "seconds"},
[RLIMIT_FSIZE] = {"Max file size", "bytes"},
[RLIMIT_DATA] = {"Max data size", "bytes"},
[RLIMIT_STACK] = {"Max stack size", "bytes"},
[RLIMIT_CORE] = {"Max core file size", "bytes"},
[RLIMIT_RSS] = {"Max resident set", "bytes"},
[RLIMIT_NPROC] = {"Max processes", "processes"},
[RLIMIT_NOFILE] = {"Max open files", "files"},
[RLIMIT_MEMLOCK] = {"Max locked memory", "bytes"},
[RLIMIT_AS] = {"Max address space", "bytes"},
[RLIMIT_LOCKS] = {"Max file locks", "locks"},
[RLIMIT_SIGPENDING] = {"Max pending signals", "signals"},
[RLIMIT_MSGQUEUE] = {"Max msgqueue size", "bytes"},
[RLIMIT_NICE] = {"Max nice priority", NULL},
[RLIMIT_RTPRIO] = {"Max realtime priority", NULL},
[RLIMIT_RTTIME] = {"Max realtime timeout", "us"},
};
/* Display limits for a process */
static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
unsigned int i;
unsigned long flags;
struct rlimit rlim[RLIM_NLIMITS];
if (!lock_task_sighand(task, &flags))
return 0;
memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS);
unlock_task_sighand(task, &flags);
/*
* print the file header
*/
seq_printf(m, "%-25s %-20s %-20s %-10s\n",
"Limit", "Soft Limit", "Hard Limit", "Units");
for (i = 0; i < RLIM_NLIMITS; i++) {
if (rlim[i].rlim_cur == RLIM_INFINITY)
seq_printf(m, "%-25s %-20s ",
lnames[i].name, "unlimited");
else
seq_printf(m, "%-25s %-20lu ",
lnames[i].name, rlim[i].rlim_cur);
if (rlim[i].rlim_max == RLIM_INFINITY)
seq_printf(m, "%-20s ", "unlimited");
else
seq_printf(m, "%-20lu ", rlim[i].rlim_max);
if (lnames[i].unit)
seq_printf(m, "%-10s\n", lnames[i].unit);
else
seq_putc(m, '\n');
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
neil horman | neil horman | 200 | 86.58% | 1 | 50.00% |
alexey dobriyan | alexey dobriyan | 31 | 13.42% | 1 | 50.00% |
| Total | 231 | 100.00% | 2 | 100.00% |
#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{
long nr;
unsigned long args[6], sp, pc;
int res;
res = lock_trace(task);
if (res)
return res;
if (task_current_syscall(task, &nr, args, 6, &sp, &pc))
seq_puts(m, "running\n");
else if (nr < 0)
seq_printf(m, "%ld 0x%lx 0x%lx\n", nr, sp, pc);
else
seq_printf(m,
"%ld 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
nr,
args[0], args[1], args[2], args[3], args[4], args[5],
sp, pc);
unlock_trace(task);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
roland mcgrath | roland mcgrath | 106 | 67.95% | 1 | 25.00% |
al viro | al viro | 24 | 15.38% | 1 | 25.00% |
alexey dobriyan | alexey dobriyan | 21 | 13.46% | 1 | 25.00% |
joe perches | joe perches | 5 | 3.21% | 1 | 25.00% |
| Total | 156 | 100.00% | 4 | 100.00% |
#endif /* CONFIG_HAVE_ARCH_TRACEHOOK */
/************************************************************************/
/* Here the fs part begins */
/************************************************************************/
/* permission checks */
static int proc_fd_access_allowed(struct inode *inode)
{
struct task_struct *task;
int allowed = 0;
/* Allow access to a task's file descriptors if it is us or we
* may use ptrace attach to the process and find out that
* information.
*/
task = get_proc_task(inode);
if (task) {
allowed = ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS);
put_task_struct(task);
}
return allowed;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
eric w. biederman | eric w. biederman | 25 | 48.08% | 2 | 18.18% |
al viro | al viro | 14 | 26.92% | 3 | 27.27% |
pre-git | pre-git | 10 | 19.23% | 4 | 36.36% |
stephen d. smalley | stephen d. smalley | 2 | 3.85% | 1 | 9.09% |
jann horn | jann horn | 1 | 1.92% | 1 | 9.09% |
| Total | 52 | 100.00% | 11 | 100.00% |
int proc_setattr(struct dentry *dentry, struct iattr *attr)
{
int error;
struct inode *inode = d_inode(dentry);
if (attr->ia_valid & ATTR_MODE)
return -EPERM;
error = setattr_prepare(dentry, attr);
if (error)
return error;
setattr_copy(inode, attr);
mark_inode_dirty(inode);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
eric w. biederman | eric w. biederman | 36 | 50.70% | 1 | 12.50% |
christoph hellwig | christoph hellwig | 19 | 26.76% | 1 | 12.50% |
al viro | al viro | 9 | 12.68% | 2 | 25.00% |
david howells | david howells | 3 | 4.23% | 1 | 12.50% |
jan kara | jan kara | 2 | 2.82% | 1 | 12.50% |
dipankar sarma | dipankar sarma | 1 | 1.41% | 1 | 12.50% |
pre-git | pre-git | 1 | 1.41% | 1 | 12.50% |
| Total | 71 | 100.00% | 8 | 100.00% |
/*
* May current process learn task's sched/cmdline info (for hide_pid_min=1)
* or euid/egid (for hide_pid_min=2)?
*/
static bool has_pid_permissions(struct pid_namespace *pid,
struct task_struct *task,
int hide_pid_min)
{
if (pid->hide_pid < hide_pid_min)
return true;
if (in_group_p(pid->pid_gid))