From: Kees Cook <kees.cook@canonical.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] proc: add "personality" to process status file
Date: Thu, 2 Oct 2008 14:14:24 -0700 [thread overview]
Message-ID: <20081002211424.GJ10632@outflux.net> (raw)
There is no sane way to query the personality flags of arbitrary process
from userspace. This adds the flags to the /proc/$pid/status file.
For example, to detect READ_IMPLIES_EXEC:
$ ./32bit-sleeper &
[1] 6732
$ grep ^Pers /proc/6732/status
Personality: 00000000
$ execstack -s 32bit-sleeper
$ ./32bit-slepper &
[2] 6735
$ grep ^Pers /proc/6735/status
Personality: 00040000
Signed-off-by: Kees Cook <kees.cook@canonical.com>
---
fs/proc/array.c | 6 ++++--
include/linux/sched.h | 3 +--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 71c9be5..1235fab 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -182,13 +182,15 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
"PPid:\t%d\n"
"TracerPid:\t%d\n"
"Uid:\t%d\t%d\t%d\t%d\n"
- "Gid:\t%d\t%d\t%d\t%d\n",
+ "Gid:\t%d\t%d\t%d\t%d\n"
+ "Personality:\t%08x\n",
get_task_state(p),
task_tgid_nr_ns(p, ns),
pid_nr_ns(pid, ns),
ppid, tpid,
p->uid, p->euid, p->suid, p->fsuid,
- p->gid, p->egid, p->sgid, p->fsgid);
+ p->gid, p->egid, p->sgid, p->fsgid,
+ p->personality);
task_lock(p);
if (p->files)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3d9120c..f2fc441 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1085,8 +1085,7 @@ struct task_struct {
int exit_state;
int exit_code, exit_signal;
int pdeath_signal; /* The signal sent when the parent dies */
- /* ??? */
- unsigned int personality;
+ unsigned int personality; /* Special-case bits (linux/personality.h) */
unsigned did_exec:1;
pid_t pid;
pid_t tgid;
--
1.5.6.3
--
Kees Cook
Ubuntu Security Team
next reply other threads:[~2008-10-02 21:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-02 21:14 Kees Cook [this message]
2008-10-02 22:46 ` [PATCH] proc: add "personality" to process status file Randy.Dunlap
2008-10-02 22:56 ` Kees Cook
2008-10-04 21:40 ` Alexey Dobriyan
2008-10-04 21:51 ` Arjan van de Ven
2008-10-04 22:02 ` Kees Cook
2008-10-04 23:42 ` Arjan van de Ven
2008-10-05 0:42 ` Kees Cook
2008-10-05 0:48 ` Arjan van de Ven
2008-10-05 9:11 ` Alexey Dobriyan
2008-10-05 10:07 ` Kees Cook
2008-10-05 10:14 ` [PATCH v2] proc: show personality via /proc/pid/personality Kees Cook
2008-10-05 23:20 ` Alexey Dobriyan
2008-10-07 13:39 ` Michael Kerrisk
2008-10-07 16:14 ` Kees Cook
2008-10-08 2:45 ` Michael Kerrisk
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=20081002211424.GJ10632@outflux.net \
--to=kees.cook@canonical.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox