From: Serge Hallyn <serue@us.ibm.com>
To: Chris Wright <chrisw@osdl.org>, linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, serue@us.ibm.com
Subject: [PATCH] BSD Jail LSM (1/3)
Date: Fri, 10 Sep 2004 15:21:45 -0500 [thread overview]
Message-ID: <1094847705.2188.94.camel@serge.austin.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 386 bytes --]
Attached is a patch which introduces a new LSM hook,
security_task_lookup. This hook allows an LSM to mediate visibility of
/proc/<pid> on a per-process level. It applies cleanly to 2.6.8.1 and
has been tested on xSeries, pSeries, and zSeries. The bsdjail lsm which
will be sent next is a user of this hook.
Please apply.
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
-serge
[-- Attachment #2: tasklookup.diff --]
[-- Type: text/x-patch, Size: 2857 bytes --]
diff -Nru linux-2.6.8.1/fs/proc/base.c linux-2.6.8.1-jail/fs/proc/base.c
--- linux-2.6.8.1/fs/proc/base.c 2004-08-14 05:55:35.000000000 -0500
+++ linux-2.6.8.1-jail/fs/proc/base.c 2004-09-01 04:42:26.000000000 -0500
@@ -1679,6 +1679,8 @@
int tgid = p->pid;
if (!pid_alive(p))
continue;
+ if (security_task_lookup(p))
+ continue;
if (--index >= 0)
continue;
tgids[nr_tgids] = tgid;
diff -Nru linux-2.6.8.1/include/linux/security.h linux-2.6.8.1-jail/include/linux/security.h
--- linux-2.6.8.1/include/linux/security.h 2004-08-14 05:55:48.000000000 -0500
+++ linux-2.6.8.1-jail/include/linux/security.h 2004-09-01 04:42:26.000000000 -0500
@@ -627,6 +627,11 @@
* Set the security attributes in @p->security for a kernel thread that
* is being reparented to the init task.
* @p contains the task_struct for the kernel thread.
+ * @task_lookup:
+ * Check permission to see the /proc/<pid> entry for process @p.
+ * @p contains the task_struct for task <pid> which is being looked
+ * up under /proc
+ * return 0 if permission is granted.
* @task_to_inode:
* Set the security attributes for an inode based on an associated task's
* security attributes, e.g. for /proc/pid inodes.
@@ -1152,6 +1157,7 @@
unsigned long arg3, unsigned long arg4,
unsigned long arg5);
void (*task_reparent_to_init) (struct task_struct * p);
+ int (*task_lookup)(struct task_struct *p);
void (*task_to_inode)(struct task_struct *p, struct inode *inode);
int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag);
@@ -1751,6 +1757,11 @@
security_ops->task_reparent_to_init (p);
}
+static inline int security_task_lookup(struct task_struct *p)
+{
+ return security_ops->task_lookup(p);
+}
+
static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
{
security_ops->task_to_inode(p, inode);
@@ -2386,6 +2397,11 @@
cap_task_reparent_to_init (p);
}
+static inline int security_task_lookup(struct task_struct *p)
+{
+ return 0;
+}
+
static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
{ }
diff -Nru linux-2.6.8.1/security/dummy.c linux-2.6.8.1-jail/security/dummy.c
--- linux-2.6.8.1/security/dummy.c 2004-08-14 05:54:51.000000000 -0500
+++ linux-2.6.8.1-jail/security/dummy.c 2004-09-01 04:42:26.000000000 -0500
@@ -616,6 +616,11 @@
return;
}
+static int dummy_task_lookup(struct task_struct *p)
+{
+ return 0;
+}
+
static void dummy_task_to_inode(struct task_struct *p, struct inode *inode)
{ }
@@ -978,6 +983,7 @@
set_to_dummy_if_null(ops, task_kill);
set_to_dummy_if_null(ops, task_prctl);
set_to_dummy_if_null(ops, task_reparent_to_init);
+ set_to_dummy_if_null(ops, task_lookup);
set_to_dummy_if_null(ops, task_to_inode);
set_to_dummy_if_null(ops, ipc_permission);
set_to_dummy_if_null(ops, msg_msg_alloc_security);
next reply other threads:[~2004-09-10 19:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-10 20:21 Serge Hallyn [this message]
2004-09-10 20:23 ` [PATCH] BSD Jail LSM (2/3) Serge Hallyn
2004-09-10 19:31 ` Alan Cox
2004-09-12 23:33 ` Serge E. Hallyn
2004-09-13 10:56 ` Alan Cox
2004-09-13 15:08 ` Serge E. Hallyn
2004-09-13 23:20 ` [PATCH] BSD Jail LSM Serge Hallyn
2004-09-13 23:58 ` Vincent Hanquez
2004-09-14 14:04 ` Serge E. Hallyn
2004-09-14 18:13 ` Chris Wright
2004-09-12 21:12 ` [PATCH] BSD Jail LSM (2/3) Herbert Poetzl
2004-09-10 20:23 ` [PATCH] BSD Jail LSM (3/3) Serge Hallyn
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=1094847705.2188.94.camel@serge.austin.ibm.com \
--to=serue@us.ibm.com \
--cc=akpm@osdl.org \
--cc=chrisw@osdl.org \
--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
all inboxes | Powered by JetHome®