From: Jann Horn <jann@thejh.net>
To: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>,
Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
Konstantin Khlebnikov <koct9i@gmail.com>,
Hugh Dickins <hughd@google.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Rodrigo Freire <rfreire@redhat.com>,
John Stultz <john.stultz@linaro.org>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
Robert Ho <robert.hu@intel.com>,
Jerome Marchand <jmarchan@redhat.com>,
Andy Lutomirski <luto@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
"Richard W.M. Jones" <rjones@redhat.com>,
Joe Perches <joe@perches.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] proc: Report no_new_privs state
Date: Thu, 3 Nov 2016 23:09:15 +0100 [thread overview]
Message-ID: <20161103220915.GP8196@pc.thejh.net> (raw)
In-Reply-To: <20161103214041.GA58566@beast>
[-- Attachment #1: Type: text/plain, Size: 2443 bytes --]
On Thu, Nov 03, 2016 at 02:40:41PM -0700, Kees Cook wrote:
> Similar to being able to examine if a process has been correctly confined
> with seccomp, the state of no_new_privs is equally interesting, so this
> adds it to /proc/$pid/status.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
(Note: The proc.5 manpage also lists all the entries of the "status" file,
so it should also be updated.)
Reviewed-by: Jann Horn <jann@thejh.net>
> ---
> Documentation/filesystems/proc.txt | 2 ++
> fs/proc/array.c | 5 +++--
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
> index 74329fd0add2..c03f2f91c6ab 100644
> --- a/Documentation/filesystems/proc.txt
> +++ b/Documentation/filesystems/proc.txt
> @@ -191,6 +191,7 @@ read the file /proc/PID/status:
> CapPrm: 0000000000000000
> CapEff: 0000000000000000
> CapBnd: ffffffffffffffff
> + NoNewPrivs: 0
> Seccomp: 0
> voluntary_ctxt_switches: 0
> nonvoluntary_ctxt_switches: 1
> @@ -262,6 +263,7 @@ Table 1-2: Contents of the status files (as of 4.1)
> CapPrm bitmap of permitted capabilities
> CapEff bitmap of effective capabilities
> CapBnd bitmap of capabilities bounding set
> + NoNewPrivs no_new_privs, like prctl(PR_GET_NO_NEW_PRIV, ...)
> Seccomp seccomp mode, like prctl(PR_GET_SECCOMP, ...)
> Cpus_allowed mask of CPUs on which this process may run
> Cpus_allowed_list Same as previous, but in "list format"
> diff --git a/fs/proc/array.c b/fs/proc/array.c
> index 81818adb8e9e..082676ab4878 100644
> --- a/fs/proc/array.c
> +++ b/fs/proc/array.c
> @@ -342,10 +342,11 @@ static inline void task_cap(struct seq_file *m, struct task_struct *p)
>
> static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
> {
> + seq_put_decimal_ull(m, "NoNewPrivs:\t", task_no_new_privs(p));
> #ifdef CONFIG_SECCOMP
> - seq_put_decimal_ull(m, "Seccomp:\t", p->seccomp.mode);
> - seq_putc(m, '\n');
> + seq_put_decimal_ull(m, "\nSeccomp:\t", p->seccomp.mode);
> #endif
> + seq_putc(m, '\n');
> }
>
> static inline void task_context_switch_counts(struct seq_file *m,
> --
> 2.7.4
>
>
> --
> Kees Cook
> Nexus Security
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2016-11-03 22:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 21:40 [PATCH] proc: Report no_new_privs state Kees Cook
2016-11-03 22:09 ` Jann Horn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161103220915.GP8196@pc.thejh.net \
--to=jann@thejh.net \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=jmarchan@redhat.com \
--cc=joe@perches.com \
--cc=john.stultz@linaro.org \
--cc=keescook@chromium.org \
--cc=koct9i@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhocko@suse.com \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=rfreire@redhat.com \
--cc=rjones@redhat.com \
--cc=robert.hu@intel.com \
--cc=ross.zwisler@linux.intel.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.