* [PATCH] securityfs: do not depend on CONFIG_SECURITY
@ 2008-08-22 15:35 Eric Paris
2008-08-22 23:33 ` James Morris
2008-08-28 1:17 ` James Morris
0 siblings, 2 replies; 3+ messages in thread
From: Eric Paris @ 2008-08-22 15:35 UTC (permalink / raw)
To: linux-security-module, linux-kernel
Cc: chrisw, debora, srajiv, tpm, tpmdd-devel
Add a new Kconfig option SECURITYFS which will build securityfs support
but does not require CONFIG_SECURITY. The only current user of
securityfs does not depend on CONFIG_SECURITY and there is no reason the
full LSM needs to be built to build this fs.
Signed-off-by: Eric Paris <eparis@redhat.com>
---
Testing was basically just making sure that my kernel built with TCG_TPM
on but SECURITY off. I don't actually have a way to test is TCG_TPM
still worked properly....
drivers/char/tpm/Kconfig | 1 +
include/linux/security.h | 54 +++++++++++++++++++++++-------------------
security/Kconfig | 8 ++++++
security/Makefile | 3 +-
4 files changed, 41 insertions(+), 25 deletions(-)
diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
index 3738cfa..f5fc64f 100644
--- a/drivers/char/tpm/Kconfig
+++ b/drivers/char/tpm/Kconfig
@@ -6,6 +6,7 @@ menuconfig TCG_TPM
tristate "TPM Hardware Support"
depends on HAS_IOMEM
depends on EXPERIMENTAL
+ select SECURITYFS
---help---
If you have a TPM security chip in your system, which
implements the Trusted Computing Group's specification,
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
diff --git a/include/linux/security.h b/include/linux/security.h
index 80c4d00..f5c4a51 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1560,11 +1560,6 @@ struct security_operations {
extern int security_init(void);
extern int security_module_enable(struct security_operations *ops);
extern int register_security(struct security_operations *ops);
-extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
- struct dentry *parent, void *data,
- const struct file_operations *fops);
-extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
-extern void securityfs_remove(struct dentry *dentry);
/* Security operations */
int security_ptrace_may_access(struct task_struct *child, unsigned int mode);
@@ -2424,25 +2419,6 @@ static inline int security_netlink_recv(struct sk_buff *skb, int cap)
return cap_netlink_recv(skb, cap);
}
-static inline struct dentry *securityfs_create_dir(const char *name,
- struct dentry *parent)
-{
- return ERR_PTR(-ENODEV);
-}
-
-static inline struct dentry *securityfs_create_file(const char *name,
- mode_t mode,
- struct dentry *parent,
- void *data,
- const struct file_operations *fops)
-{
- return ERR_PTR(-ENODEV);
-}
-
-static inline void securityfs_remove(struct dentry *dentry)
-{
-}
-
static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
{
return -EOPNOTSUPP;
@@ -2806,5 +2782,35 @@ static inline void security_audit_rule_free(void *lsmrule)
#endif /* CONFIG_SECURITY */
#endif /* CONFIG_AUDIT */
+#ifdef CONFIG_SECURITYFS
+
+extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
+ struct dentry *parent, void *data,
+ const struct file_operations *fops);
+extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
+extern void securityfs_remove(struct dentry *dentry);
+
+#else /* CONFIG_SECURITYFS */
+
+static inline struct dentry *securityfs_create_dir(const char *name,
+ struct dentry *parent)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline struct dentry *securityfs_create_file(const char *name,
+ mode_t mode,
+ struct dentry *parent,
+ void *data,
+ const struct file_operations *fops)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline void securityfs_remove(struct dentry *dentry)
+{}
+
+#endif
+
#endif /* ! __LINUX_SECURITY_H */
diff --git a/security/Kconfig b/security/Kconfig
index 5592939..d9f47ce 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -51,6 +51,14 @@ config SECURITY
If you are unsure how to answer this question, answer N.
+config SECURITYFS
+ bool "Enable the securityfs filesystem"
+ help
+ This will build the securityfs filesystem. It is currently used by
+ the TPM bios character driver. It is not used by SELinux or SMACK.
+
+ If you are unsure how to answer this question, answer N.
+
config SECURITY_NETWORK
bool "Socket and Networking Security Hooks"
depends on SECURITY
diff --git a/security/Makefile b/security/Makefile
index f654260..c05c127 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -10,7 +10,8 @@ subdir-$(CONFIG_SECURITY_SMACK) += smack
obj-y += commoncap.o
# Object file lists
-obj-$(CONFIG_SECURITY) += security.o capability.o inode.o
+obj-$(CONFIG_SECURITY) += security.o capability.o
+obj-$(CONFIG_SECURITYFS) += inode.o
# Must precede capability.o in order to stack properly.
obj-$(CONFIG_SECURITY_SELINUX) += selinux/built-in.o
obj-$(CONFIG_SECURITY_SMACK) += smack/built-in.o
diff --git a/security/inode.c b/security/inode.c
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] securityfs: do not depend on CONFIG_SECURITY
2008-08-22 15:35 [PATCH] securityfs: do not depend on CONFIG_SECURITY Eric Paris
@ 2008-08-22 23:33 ` James Morris
2008-08-28 1:17 ` James Morris
1 sibling, 0 replies; 3+ messages in thread
From: James Morris @ 2008-08-22 23:33 UTC (permalink / raw)
To: Eric Paris
Cc: linux-security-module, linux-kernel, chrisw, debora, srajiv, tpm,
tpmdd-devel
On Fri, 22 Aug 2008, Eric Paris wrote:
> Add a new Kconfig option SECURITYFS which will build securityfs support
> but does not require CONFIG_SECURITY. The only current user of
> securityfs does not depend on CONFIG_SECURITY and there is no reason the
> full LSM needs to be built to build this fs.
>
> Signed-off-by: Eric Paris <eparis@redhat.com>
>
Reviewed-by: James Morris <jmorris@namei.org>
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] securityfs: do not depend on CONFIG_SECURITY
2008-08-22 15:35 [PATCH] securityfs: do not depend on CONFIG_SECURITY Eric Paris
2008-08-22 23:33 ` James Morris
@ 2008-08-28 1:17 ` James Morris
1 sibling, 0 replies; 3+ messages in thread
From: James Morris @ 2008-08-28 1:17 UTC (permalink / raw)
To: Eric Paris
Cc: linux-security-module, linux-kernel, chrisw, debora, srajiv, tpm,
tpmdd-devel
On Fri, 22 Aug 2008, Eric Paris wrote:
> Add a new Kconfig option SECURITYFS which will build securityfs support
> but does not require CONFIG_SECURITY. The only current user of
> securityfs does not depend on CONFIG_SECURITY and there is no reason the
> full LSM needs to be built to build this fs.
>
> Signed-off-by: Eric Paris <eparis@redhat.com>
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-28 1:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-22 15:35 [PATCH] securityfs: do not depend on CONFIG_SECURITY Eric Paris
2008-08-22 23:33 ` James Morris
2008-08-28 1:17 ` James Morris
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.