[PATCH] proc: show personality via /proc/pid/personality

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, October 13, 2008 - 11:16 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=478307...
Commit:     478307230810d7e2a753ed220db9066dfdf88718
Parent:     a6bebbc87a8c16eabb6bd5c6fd2d994be0236fba
Author:     Kees Cook <kees.cook@canonical.com>
AuthorDate: Mon Oct 6 03:11:58 2008 +0400
Committer:  Alexey Dobriyan <adobriyan@gmail.com>
CommitDate: Fri Oct 10 04:18:57 2008 +0400

    [PATCH] proc: show personality via /proc/pid/personality
    
    Make process personality flags visible in /proc.  Since a process's
    personality is potentially sensitive (e.g. READ_IMPLIES_EXEC), make this
    file only readable by the process owner.
    
    Signed-off-by: Kees Cook <kees.cook@canonical.com>
    Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
 fs/proc/base.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index bb63fa1..c1332dd 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2438,6 +2438,13 @@ static int proc_tgid_io_accounting(struct task_struct *task, char *buffer)
 }
 #endif /* CONFIG_TASK_IO_ACCOUNTING */
 
+static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns,
+				struct pid *pid, struct task_struct *task)
+{
+	seq_printf(m, "%08x\n", task->personality);
+	return 0;
+}
+
 /*
  * Thread groups
  */
@@ -2454,6 +2461,7 @@ static const struct pid_entry tgid_base_stuff[] = {
 	REG("environ",    S_IRUSR, environ),
 	INF("auxv",       S_IRUSR, pid_auxv),
 	ONE("status",     S_IRUGO, pid_status),
+	ONE("personality", S_IRUSR, pid_personality),
 	INF("limits",	  S_IRUSR, pid_limits),
 #ifdef CONFIG_SCHED_DEBUG
 	REG("sched",      S_IRUGO|S_IWUSR, pid_sched),
@@ -2789,6 +2797,7 @@ static const struct pid_entry tid_base_stuff[] = {
 	REG("environ",   S_IRUSR, environ),
 	INF("auxv",      S_IRUSR, pid_auxv),
 	ONE("status",    S_IRUGO, pid_status),
+	ONE("personality", S_IRUSR, pid_personality),
 	INF("limits",	 S_IRUSR, pid_limits),
 #ifdef CONFIG_SCHED_DEBUG
 	REG("sched",     S_IRUGO|S_IWUSR, pid_sched),
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] proc: show personality via /proc/pid/personality, Linux Kernel Mailing ..., (Mon Oct 13, 11:16 am)