lkml.org 
[lkml]   [2011]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4/5] v2 seccomp_filter: add process state reporting
    Date
    Adds seccomp_filter status reporting to proc.
    /proc/<pid>/seccomp_filter will provide read-only access to the current
    filter set.

    v2: removed status entry, added seccomp file.
    (requested by kosaki.motohiro@jp.fujitsu.com)
    allowed S_IRUGO reading of entries
    (requested by viro@zeniv.linux.org.uk)
    added flags
    got rid of the seccomp_t type
    dropped seccomp file

    Signed-off-by: Will Drewry <wad@chromium.org>
    ---
    fs/proc/base.c | 25 +++++++++++++++++++++++++
    1 files changed, 25 insertions(+), 0 deletions(-)

    diff --git a/fs/proc/base.c b/fs/proc/base.c
    index dfa5327..f991d1a 100644
    --- a/fs/proc/base.c
    +++ b/fs/proc/base.c
    @@ -73,6 +73,7 @@
    #include <linux/security.h>
    #include <linux/ptrace.h>
    #include <linux/tracehook.h>
    +#include <linux/seccomp.h>
    #include <linux/cgroup.h>
    #include <linux/cpuset.h>
    #include <linux/audit.h>
    @@ -579,6 +580,24 @@ static int proc_pid_syscall(struct task_struct *task, char *buffer)
    }
    #endif /* CONFIG_HAVE_ARCH_TRACEHOOK */

    +/*
    + * Print out the current seccomp filter set for the task.
    + */
    +#ifdef CONFIG_SECCOMP_FILTER
    +int proc_pid_seccomp_filter_show(struct seq_file *m, struct pid_namespace *ns,
    + struct pid *pid, struct task_struct *task)
    +{
    + struct seccomp_state *state;
    +
    + rcu_read_lock();
    + state = get_seccomp_state(task->seccomp);
    + rcu_read_unlock();
    + seccomp_show_filters(state, m);
    + put_seccomp_state(state);
    + return 0;
    +}
    +#endif /* CONFIG_SECCOMP_FILTER */
    +
    /************************************************************************/
    /* Here the fs part begins */
    /************************************************************************/
    @@ -2838,6 +2857,9 @@ static const struct pid_entry tgid_base_stuff[] = {
    #ifdef CONFIG_HAVE_ARCH_TRACEHOOK
    INF("syscall", S_IRUGO, proc_pid_syscall),
    #endif
    +#ifdef CONFIG_SECCOMP_FILTER
    + ONE("seccomp_filter", S_IRUGO, proc_pid_seccomp_filter_show),
    +#endif
    INF("cmdline", S_IRUGO, proc_pid_cmdline),
    ONE("stat", S_IRUGO, proc_tgid_stat),
    ONE("statm", S_IRUGO, proc_pid_statm),
    @@ -3180,6 +3202,9 @@ static const struct pid_entry tid_base_stuff[] = {
    #ifdef CONFIG_HAVE_ARCH_TRACEHOOK
    INF("syscall", S_IRUGO, proc_pid_syscall),
    #endif
    +#ifdef CONFIG_SECCOMP_FILTER
    + ONE("seccomp_filter", S_IRUGO, proc_pid_seccomp_filter_show),
    +#endif
    INF("cmdline", S_IRUGO, proc_pid_cmdline),
    ONE("stat", S_IRUGO, proc_tid_stat),
    ONE("statm", S_IRUGO, proc_pid_statm),
    --
    1.7.0.4


    \
     
     \ /
      Last update: 2011-05-12 05:09    [W:0.025 / U:29.536 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site