* [PATCH 4/7] SLIM: secfs patch
@ 2006-08-23 19:05 Kylene Jo Hall
0 siblings, 0 replies; 6+ messages in thread
From: Kylene Jo Hall @ 2006-08-23 19:05 UTC (permalink / raw)
To: linux-kernel, LSM ML; +Cc: Dave Safford, Mimi Zohar, Serge Hallyn
This patch provides the securityfs used by SLIM.
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
---
security/slim/slm_secfs.c | 69 ++++++++++++++++++++++++++++++++++++
1 files changed, 69 insertions(+)
--- linux-2.6.18-rc3/security/slim/slm_secfs.c 1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.18-rc3-working/security/slim/slm_secfs.c 2006-08-07 13:00:14.000000000 -0500
@@ -0,0 +1,69 @@
+/*
+ * SLIM securityfs support: debugging control files
+ *
+ * Copyright (C) 2005, 2006 IBM Corporation
+ * Author: Mimi Zohar <zohar@us.ibm.com>
+ * Kylene Hall <kjhall@us.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2 of the License.
+ */
+
+#include <asm/uaccess.h>
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/security.h>
+#include <linux/debugfs.h>
+#include "slim.h"
+
+static struct dentry *slim_sec_dir, *slim_level;
+
+static ssize_t slm_read_level(struct file *file, char __user *buf,
+ size_t buflen, loff_t *ppos)
+{
+ struct slm_tsec_data *cur_tsec = current->security;
+ ssize_t len;
+ char data[28];
+ if (is_kernel_thread(current))
+ len = snprintf(data, sizeof(data), "KERNEL\n");
+ else if (!cur_tsec)
+ len = snprintf(data, sizeof(data), "UNKNOWN\n");
+ else {
+ if (cur_tsec->iac_wx != cur_tsec->iac_r)
+ len = snprintf(data, sizeof(data), "GUARD wx:%s r:%s\n",
+ slm_iac_str[cur_tsec->iac_wx],
+ slm_iac_str[cur_tsec->iac_r]);
+ else
+ len = snprintf(data, sizeof(data), "%s\n",
+ slm_iac_str[cur_tsec->iac_wx]);
+ }
+ return simple_read_from_buffer(buf, buflen, ppos, data, len);
+}
+
+static struct file_operations slm_level_ops = {
+ .read = slm_read_level,
+};
+
+int __init slm_init_secfs(void)
+{
+ slim_sec_dir = securityfs_create_dir("slim", NULL);
+ if (!slim_sec_dir || IS_ERR(slim_sec_dir))
+ return -EFAULT;
+ slim_level = securityfs_create_file("level", S_IRUGO,
+ slim_sec_dir, NULL, &slm_level_ops);
+ if (!slim_level || IS_ERR(slim_level)) {
+ securityfs_remove(slim_sec_dir);
+ return -EFAULT;
+ }
+ return 0;
+}
+
+__initcall(slm_init_secfs);
+
+void __exit slm_cleanup_secfs(void)
+{
+ securityfs_remove(slim_level);
+ securityfs_remove(slim_sec_dir);
+}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/7] SLIM: secfs patch
2006-09-18 20:50 ` Kylene Jo Hall
2006-09-18 20:54 ` Dave Jones
@ 2006-09-27 12:30 ` Stephen Smalley
1 sibling, 0 replies; 6+ messages in thread
From: Stephen Smalley @ 2006-09-27 12:30 UTC (permalink / raw)
To: Kylene Jo Hall
Cc: linux-kernel, LSM ML, Dave Safford, Mimi Zohar, Serge Hallyn, akpm
On Mon, 2006-09-18 at 13:50 -0700, Kylene Jo Hall wrote:
> On Mon, 2006-09-18 at 16:30 -0400, Stephen Smalley wrote:
> > On Tue, 2006-09-12 at 10:57 -0700, Kylene Jo Hall wrote:
> > > This patch provides the securityfs used by SLIM.
> > >
> > > Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
> > > Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
> > > ---
> > > security/slim/slm_secfs.c | 73 ++++++++++++++++++++++++++++++++++++
> > > 1 files changed, 73 insertions(+)
> > >
> > > --- linux-2.6.18/security/slim/slm_secfs.c 1969-12-31 16:00:00.000000000 -0800
> > > +++ linux-2.6.17-working/security/slim/slm_secfs.c 2006-09-06 11:49:09.000000000 -0700
> > > @@ -0,0 +1,73 @@
> > > +/*
> > > + * SLIM securityfs support: debugging control files
> > > + *
> > > + * Copyright (C) 2005, 2006 IBM Corporation
> > > + * Author: Mimi Zohar <zohar@us.ibm.com>
> > > + * Kylene Hall <kjhall@us.ibm.com>
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify
> > > + * it under the terms of the GNU General Public License as published by
> > > + * the Free Software Foundation, version 2 of the License.
> > > + */
> > > +
> > > +#include <asm/uaccess.h>
> > > +#include <linux/config.h>
> > > +#include <linux/module.h>
> > > +#include <linux/kernel.h>
> > > +#include <linux/security.h>
> > > +#include <linux/debugfs.h>
> > > +#include "slim.h"
> > > +
> > > +static struct dentry *slim_sec_dir, *slim_level;
> > > +
> > > +static ssize_t slm_read_level(struct file *file, char __user *buf,
> > > + size_t buflen, loff_t *ppos)
> > > +{
> > > + struct slm_tsec_data *cur_tsec = current->security;
> > > + ssize_t len;
> > > + char data[28];
> > > + if (is_kernel_thread(current))
> > > + len = snprintf(data, sizeof(data), "KERNEL\n");
> > > + else if (!cur_tsec)
> > > + len = snprintf(data, sizeof(data), "UNKNOWN\n");
> > > + else {
> > > + if (cur_tsec->iac_wx != cur_tsec->iac_r)
> > > + len = snprintf(data, sizeof(data), "GUARD wx:%s r:%s\n",
> > > + slm_iac_str[cur_tsec->iac_wx],
> > > + slm_iac_str[cur_tsec->iac_r]);
> > > + else
> > > + len = snprintf(data, sizeof(data), "%s\n",
> > > + slm_iac_str[cur_tsec->iac_wx]);
> > > + }
> > > + return simple_read_from_buffer(buf, buflen, ppos, data, len);
> > > +}
> >
> > Why do you need this when you implement getprocattr and return the same
> > data that way?
> >
> True you can get the same info that way but we find it very useful to be
> able to cat this file and get the level of the current process.
It is duplicated code and interface for no obvious purpose - why cannot
you cat /proc/self/attr/current instead?
--
Stephen Smalley
National Security Agency
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/7] SLIM: secfs patch
2006-09-18 20:50 ` Kylene Jo Hall
@ 2006-09-18 20:54 ` Dave Jones
2006-09-27 12:30 ` Stephen Smalley
1 sibling, 0 replies; 6+ messages in thread
From: Dave Jones @ 2006-09-18 20:54 UTC (permalink / raw)
To: Kylene Jo Hall
Cc: Stephen Smalley, linux-kernel, LSM ML, Dave Safford, Mimi Zohar,
Serge Hallyn, akpm
On Mon, Sep 18, 2006 at 01:50:42PM -0700, Kylene Jo Hall wrote:
> > > This patch provides the securityfs used by SLIM.
nitpick. (I never reviewed this when it was posted, but this followup
caught my eye..)
> > > --- linux-2.6.18/security/slim/slm_secfs.c 1969-12-31 16:00:00.000000000 -0800
> > > +++ linux-2.6.17-working/security/slim/slm_secfs.c 2006-09-06 11:49:09.000000000 -0700
> > > @@ -0,0 +1,73 @@
> > > +/*
> > > + * SLIM securityfs support: debugging control files
> > > + *
> > > + * Copyright (C) 2005, 2006 IBM Corporation
> > > + * Author: Mimi Zohar <zohar@us.ibm.com>
> > > + * Kylene Hall <kjhall@us.ibm.com>
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify
> > > + * it under the terms of the GNU General Public License as published by
> > > + * the Free Software Foundation, version 2 of the License.
> > > + */
> > > +
> > > +#include <asm/uaccess.h>
> > > +#include <linux/config.h>
You don't need to include config.h any more, kbuild does it for you.
(Might want to check the other files for the same thing).
Dave
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/7] SLIM: secfs patch
2006-09-18 20:30 ` Stephen Smalley
@ 2006-09-18 20:50 ` Kylene Jo Hall
2006-09-18 20:54 ` Dave Jones
2006-09-27 12:30 ` Stephen Smalley
0 siblings, 2 replies; 6+ messages in thread
From: Kylene Jo Hall @ 2006-09-18 20:50 UTC (permalink / raw)
To: Stephen Smalley
Cc: linux-kernel, LSM ML, Dave Safford, Mimi Zohar, Serge Hallyn, akpm
On Mon, 2006-09-18 at 16:30 -0400, Stephen Smalley wrote:
> On Tue, 2006-09-12 at 10:57 -0700, Kylene Jo Hall wrote:
> > This patch provides the securityfs used by SLIM.
> >
> > Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
> > Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
> > ---
> > security/slim/slm_secfs.c | 73 ++++++++++++++++++++++++++++++++++++
> > 1 files changed, 73 insertions(+)
> >
> > --- linux-2.6.18/security/slim/slm_secfs.c 1969-12-31 16:00:00.000000000 -0800
> > +++ linux-2.6.17-working/security/slim/slm_secfs.c 2006-09-06 11:49:09.000000000 -0700
> > @@ -0,0 +1,73 @@
> > +/*
> > + * SLIM securityfs support: debugging control files
> > + *
> > + * Copyright (C) 2005, 2006 IBM Corporation
> > + * Author: Mimi Zohar <zohar@us.ibm.com>
> > + * Kylene Hall <kjhall@us.ibm.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation, version 2 of the License.
> > + */
> > +
> > +#include <asm/uaccess.h>
> > +#include <linux/config.h>
> > +#include <linux/module.h>
> > +#include <linux/kernel.h>
> > +#include <linux/security.h>
> > +#include <linux/debugfs.h>
> > +#include "slim.h"
> > +
> > +static struct dentry *slim_sec_dir, *slim_level;
> > +
> > +static ssize_t slm_read_level(struct file *file, char __user *buf,
> > + size_t buflen, loff_t *ppos)
> > +{
> > + struct slm_tsec_data *cur_tsec = current->security;
> > + ssize_t len;
> > + char data[28];
> > + if (is_kernel_thread(current))
> > + len = snprintf(data, sizeof(data), "KERNEL\n");
> > + else if (!cur_tsec)
> > + len = snprintf(data, sizeof(data), "UNKNOWN\n");
> > + else {
> > + if (cur_tsec->iac_wx != cur_tsec->iac_r)
> > + len = snprintf(data, sizeof(data), "GUARD wx:%s r:%s\n",
> > + slm_iac_str[cur_tsec->iac_wx],
> > + slm_iac_str[cur_tsec->iac_r]);
> > + else
> > + len = snprintf(data, sizeof(data), "%s\n",
> > + slm_iac_str[cur_tsec->iac_wx]);
> > + }
> > + return simple_read_from_buffer(buf, buflen, ppos, data, len);
> > +}
>
> Why do you need this when you implement getprocattr and return the same
> data that way?
>
True you can get the same info that way but we find it very useful to be
able to cat this file and get the level of the current process.
> > +
> > +static struct file_operations slm_level_ops = {
> > + .read = slm_read_level,
> > +};
> > +
> > +int __init slm_init_secfs(void)
> > +{
> > + if (!slim_enabled)
> > + return 0;
> > +
> > + slim_sec_dir = securityfs_create_dir("slim", NULL);
> > + if (!slim_sec_dir || IS_ERR(slim_sec_dir))
> > + return -EFAULT;
> > + slim_level = securityfs_create_file("level", S_IRUGO,
> > + slim_sec_dir, NULL, &slm_level_ops);
> > + if (!slim_level || IS_ERR(slim_level)) {
> > + securityfs_remove(slim_sec_dir);
> > + return -EFAULT;
> > + }
> > + return 0;
> > +}
> > +
> > +__initcall(slm_init_secfs);
> > +
> > +void __exit slm_cleanup_secfs(void)
> > +{
> > + securityfs_remove(slim_level);
> > + securityfs_remove(slim_sec_dir);
> > +}
> > +
>
Thanks,
Kylie
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/7] SLIM: secfs patch
2006-09-12 17:57 Kylene Jo Hall
@ 2006-09-18 20:30 ` Stephen Smalley
2006-09-18 20:50 ` Kylene Jo Hall
0 siblings, 1 reply; 6+ messages in thread
From: Stephen Smalley @ 2006-09-18 20:30 UTC (permalink / raw)
To: Kylene Jo Hall
Cc: linux-kernel, LSM ML, Dave Safford, Mimi Zohar, Serge Hallyn, akpm
On Tue, 2006-09-12 at 10:57 -0700, Kylene Jo Hall wrote:
> This patch provides the securityfs used by SLIM.
>
> Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
> Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
> ---
> security/slim/slm_secfs.c | 73 ++++++++++++++++++++++++++++++++++++
> 1 files changed, 73 insertions(+)
>
> --- linux-2.6.18/security/slim/slm_secfs.c 1969-12-31 16:00:00.000000000 -0800
> +++ linux-2.6.17-working/security/slim/slm_secfs.c 2006-09-06 11:49:09.000000000 -0700
> @@ -0,0 +1,73 @@
> +/*
> + * SLIM securityfs support: debugging control files
> + *
> + * Copyright (C) 2005, 2006 IBM Corporation
> + * Author: Mimi Zohar <zohar@us.ibm.com>
> + * Kylene Hall <kjhall@us.ibm.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation, version 2 of the License.
> + */
> +
> +#include <asm/uaccess.h>
> +#include <linux/config.h>
> +#include <linux/module.h>
> +#include <linux/kernel.h>
> +#include <linux/security.h>
> +#include <linux/debugfs.h>
> +#include "slim.h"
> +
> +static struct dentry *slim_sec_dir, *slim_level;
> +
> +static ssize_t slm_read_level(struct file *file, char __user *buf,
> + size_t buflen, loff_t *ppos)
> +{
> + struct slm_tsec_data *cur_tsec = current->security;
> + ssize_t len;
> + char data[28];
> + if (is_kernel_thread(current))
> + len = snprintf(data, sizeof(data), "KERNEL\n");
> + else if (!cur_tsec)
> + len = snprintf(data, sizeof(data), "UNKNOWN\n");
> + else {
> + if (cur_tsec->iac_wx != cur_tsec->iac_r)
> + len = snprintf(data, sizeof(data), "GUARD wx:%s r:%s\n",
> + slm_iac_str[cur_tsec->iac_wx],
> + slm_iac_str[cur_tsec->iac_r]);
> + else
> + len = snprintf(data, sizeof(data), "%s\n",
> + slm_iac_str[cur_tsec->iac_wx]);
> + }
> + return simple_read_from_buffer(buf, buflen, ppos, data, len);
> +}
Why do you need this when you implement getprocattr and return the same
data that way?
> +
> +static struct file_operations slm_level_ops = {
> + .read = slm_read_level,
> +};
> +
> +int __init slm_init_secfs(void)
> +{
> + if (!slim_enabled)
> + return 0;
> +
> + slim_sec_dir = securityfs_create_dir("slim", NULL);
> + if (!slim_sec_dir || IS_ERR(slim_sec_dir))
> + return -EFAULT;
> + slim_level = securityfs_create_file("level", S_IRUGO,
> + slim_sec_dir, NULL, &slm_level_ops);
> + if (!slim_level || IS_ERR(slim_level)) {
> + securityfs_remove(slim_sec_dir);
> + return -EFAULT;
> + }
> + return 0;
> +}
> +
> +__initcall(slm_init_secfs);
> +
> +void __exit slm_cleanup_secfs(void)
> +{
> + securityfs_remove(slim_level);
> + securityfs_remove(slim_sec_dir);
> +}
> +
--
Stephen Smalley
National Security Agency
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/7] SLIM: secfs patch
@ 2006-09-12 17:57 Kylene Jo Hall
2006-09-18 20:30 ` Stephen Smalley
0 siblings, 1 reply; 6+ messages in thread
From: Kylene Jo Hall @ 2006-09-12 17:57 UTC (permalink / raw)
To: linux-kernel, LSM ML; +Cc: Dave Safford, Mimi Zohar, Serge Hallyn, akpm
This patch provides the securityfs used by SLIM.
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
---
security/slim/slm_secfs.c | 73 ++++++++++++++++++++++++++++++++++++
1 files changed, 73 insertions(+)
--- linux-2.6.18/security/slim/slm_secfs.c 1969-12-31 16:00:00.000000000 -0800
+++ linux-2.6.17-working/security/slim/slm_secfs.c 2006-09-06 11:49:09.000000000 -0700
@@ -0,0 +1,73 @@
+/*
+ * SLIM securityfs support: debugging control files
+ *
+ * Copyright (C) 2005, 2006 IBM Corporation
+ * Author: Mimi Zohar <zohar@us.ibm.com>
+ * Kylene Hall <kjhall@us.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2 of the License.
+ */
+
+#include <asm/uaccess.h>
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/security.h>
+#include <linux/debugfs.h>
+#include "slim.h"
+
+static struct dentry *slim_sec_dir, *slim_level;
+
+static ssize_t slm_read_level(struct file *file, char __user *buf,
+ size_t buflen, loff_t *ppos)
+{
+ struct slm_tsec_data *cur_tsec = current->security;
+ ssize_t len;
+ char data[28];
+ if (is_kernel_thread(current))
+ len = snprintf(data, sizeof(data), "KERNEL\n");
+ else if (!cur_tsec)
+ len = snprintf(data, sizeof(data), "UNKNOWN\n");
+ else {
+ if (cur_tsec->iac_wx != cur_tsec->iac_r)
+ len = snprintf(data, sizeof(data), "GUARD wx:%s r:%s\n",
+ slm_iac_str[cur_tsec->iac_wx],
+ slm_iac_str[cur_tsec->iac_r]);
+ else
+ len = snprintf(data, sizeof(data), "%s\n",
+ slm_iac_str[cur_tsec->iac_wx]);
+ }
+ return simple_read_from_buffer(buf, buflen, ppos, data, len);
+}
+
+static struct file_operations slm_level_ops = {
+ .read = slm_read_level,
+};
+
+int __init slm_init_secfs(void)
+{
+ if (!slim_enabled)
+ return 0;
+
+ slim_sec_dir = securityfs_create_dir("slim", NULL);
+ if (!slim_sec_dir || IS_ERR(slim_sec_dir))
+ return -EFAULT;
+ slim_level = securityfs_create_file("level", S_IRUGO,
+ slim_sec_dir, NULL, &slm_level_ops);
+ if (!slim_level || IS_ERR(slim_level)) {
+ securityfs_remove(slim_sec_dir);
+ return -EFAULT;
+ }
+ return 0;
+}
+
+__initcall(slm_init_secfs);
+
+void __exit slm_cleanup_secfs(void)
+{
+ securityfs_remove(slim_level);
+ securityfs_remove(slim_sec_dir);
+}
+
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-09-27 12:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-23 19:05 [PATCH 4/7] SLIM: secfs patch Kylene Jo Hall
2006-09-12 17:57 Kylene Jo Hall
2006-09-18 20:30 ` Stephen Smalley
2006-09-18 20:50 ` Kylene Jo Hall
2006-09-18 20:54 ` Dave Jones
2006-09-27 12:30 ` Stephen Smalley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).