mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* (patch 1/3) lsm: add control over /proc/<pid> visibility
@ 2004-10-06 20:21 Serge Hallyn
  2004-10-06 20:24 ` [patch 1/3] lsm: add bsdjail module Serge Hallyn
  2004-10-06 20:25 ` [patch 3/3] lsm: add bsdjail documentation Serge Hallyn
  0 siblings, 2 replies; 38+ messages in thread
From: Serge Hallyn @ 2004-10-06 20:21 UTC (permalink / raw)
  To: akpm, Chris Wright, linux-kernel; +Cc: serue


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-pid level.  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>

diff -Nrup linux-2.6.9-rc3-bk6/fs/proc/base.c
linux-2.6.9-rc3-bk6-jail/fs/proc/base.c
--- linux-2.6.9-rc3-bk6/fs/proc/base.c	2004-10-06 10:07:55.000000000
-0500
+++ linux-2.6.9-rc3-bk6-jail/fs/proc/base.c	2004-10-06
10:51:04.000000000 -0500
@@ -1683,6 +1683,8 @@ static int get_tgid_list(int index, unsi
 		int tgid = p->pid;
 		if (!pid_alive(p))
 			continue;
+		if (security_task_lookup(p))
+			continue;
 		if (--index >= 0)
 			continue;
 		tgids[nr_tgids] = tgid;
diff -Nrup linux-2.6.9-rc3-bk6/include/linux/security.h
linux-2.6.9-rc3-bk6-jail/include/linux/security.h
--- linux-2.6.9-rc3-bk6/include/linux/security.h	2004-08-14
00:37:30.000000000 -0500
+++ linux-2.6.9-rc3-bk6-jail/include/linux/security.h	2004-10-06
10:51:04.000000000 -0500
@@ -627,6 +627,11 @@ struct swap_info_struct;
  * 	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 @@ struct security_operations {
 			   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 @@ static inline void security_task_reparen
 	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 @@ static inline void security_task_reparen
 	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 -Nrup linux-2.6.9-rc3-bk6/security/dummy.c
linux-2.6.9-rc3-bk6-jail/security/dummy.c
--- linux-2.6.9-rc3-bk6/security/dummy.c	2004-10-06 10:11:29.000000000
-0500
+++ linux-2.6.9-rc3-bk6-jail/security/dummy.c	2004-10-06
10:51:04.000000000 -0500
@@ -616,6 +616,11 @@ static void dummy_task_reparent_to_init 
 	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 @@ void security_fixup_ops (struct security
 	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);



^ permalink raw reply	[flat|nested] 38+ messages in thread
* Re: [patch 1/3] lsm: add bsdjail module
@ 2004-11-22  1:51 Colin Walters
  0 siblings, 0 replies; 38+ messages in thread
From: Colin Walters @ 2004-11-22  1:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alan Cox

[-- Attachment #1: Type: text/plain, Size: 1612 bytes --]

[ Sorry for the lack of References, I'm not on this list and had to grab
the message from the web archives ]

> On Iau, 2004-10-07 at 00:26, Andrew Morton wrote:
> > I don't recall anyone requesting this feature.  Tell me why we should add
> > it to Linux?
> 
> Subject to the code cleanups and stuff you've noted I'd actually like to
> see BSD jail stuff in our security modules because it has the virtue of
> simplicity. If it can be extended to do all of vserver even better. J
> Random Admin has a good chance at configuring BSD jails etups. J Random
> Admin needs some serious tools that don't exist to set up SELinux the
> same way.
> 
> In the security world simplicity is often a virtue, both in code and
> concepts.

BSD jails are a kind of halfway point on the 
"access control <-> virtualization" sliding scale.  Certainly, using
SELinux for virtualization is not trivial, and I think that's fine; it
is not its intended purpose.  But let's be honest - using BSD jails for
strong access control ("security") has its own downsides.  For example,
now J Random Admin has N rpm/dpkg databases to manage on the same system
instead of one.  Or they have hand-rolled chroots which need their own
special treatment, scripts, etc.

In other words, BSD jails and SELinux are certainly not the same thing.
This becomes more obvious when you realize that hey - SELinux is still
useful inside a BSD jail.  Why should the cracked sendmail daemon be
able to destroy your configuration and the rest of the chroot?  You
might even want BSD jails to enforce different SELinux policies.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2004-11-22  1:52 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-06 20:21 (patch 1/3) lsm: add control over /proc/<pid> visibility Serge Hallyn
2004-10-06 20:24 ` [patch 1/3] lsm: add bsdjail module Serge Hallyn
2004-10-06 23:26   ` Andrew Morton
2004-10-07  4:08     ` Serge E. Hallyn
2004-10-07  6:18       ` James Morris
2004-10-07  6:22         ` Andrew Morton
2004-10-07 16:06           ` Chris Wright
2004-10-07 18:40             ` Andrew Morton
2004-10-07 18:52               ` Chris Wright
2004-10-07 20:56                 ` Serge E. Hallyn
2004-10-10  6:24                 ` Herbert Poetzl
2004-10-07 12:06     ` Alan Cox
2004-10-07 19:01     ` [patch 2/3] " Serge E. Hallyn
2004-10-07 19:42       ` Chris Wright
2004-10-07 20:05         ` Andrew Morton
2004-10-08 18:05         ` Serge E. Hallyn
2004-10-10 10:41       ` Christoph Hellwig
2004-10-10 11:31         ` Serge E. Hallyn
2004-10-10 11:34           ` Christoph Hellwig
2004-10-11 13:47         ` Alan Cox
2004-10-12  7:00           ` Herbert Poetzl
2004-10-12  9:00             ` Christoph Hellwig
2004-10-12 12:27               ` Herbert Poetzl
2004-10-20 15:36                 ` Christoph Hellwig
2004-10-20 19:18                   ` Herbert Poetzl
2004-10-12 13:11           ` Serge E. Hallyn
2004-10-12 14:15             ` Christoph Hellwig
2004-10-12 22:35             ` Ulrich Drepper
2004-10-13  0:58               ` Serge E. Hallyn
2004-10-13  1:09                 ` Ulrich Drepper
2004-10-13  1:22                   ` Serge E. Hallyn
2004-10-13 15:26                     ` Stephen Smalley
2004-10-13  1:11               ` Chris Wright
2004-10-13 14:25               ` Stephen Smalley
2004-10-06 20:25 ` [patch 3/3] lsm: add bsdjail documentation Serge Hallyn
2004-10-07 22:17   ` Matthias Urlichs
2004-10-08 20:02     ` Serge E. Hallyn
2004-11-22  1:51 [patch 1/3] lsm: add bsdjail module Colin Walters

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome