Skip to contentSkip to conversation

linux-next: Tree for July 31 (IMA build error)

DISCUSSION Mimi Zohar 2 participants 2 messages Aug 1, 2008

Subsystems (4)
lore
Share & tools
lore

Mimi Zohar

author
#0 lore raw

Randy Dunlap <[email protected]> wrote on 08/01/2008 01:34:14 AM:

Quoted 7 lines

security/integrity/ima:

linux-next-20080731/security/integrity/ima/ima_policy.c:81: error: implicit declaration of function 'security_audit_rule_match' linux-next-20080731/security/integrity/ima/ima_policy.c:206: error: implicit declaration of function 'security_audit_rule_init'
make[4]: *** [security/integrity/ima/ima_policy.o] Error 1

- Update security/integrity/ima/Kconfig for LSM based policy rules to select CONFIG_AUDIT.
- Add dummy security_filter_rule_init/match routines for when CONFIG_AUDIT is not configured.

security/integrity/ima/Kconfig +8 -0
Index: security-testing-2.6/security/integrity/ima/Kconfig
===================================================================
@@ -39,3 +39,11 @@ config IMA_BASE_HOOKS
 	default n
 	help
 	  Enable this option to allow the LSM module to enforce integrity.
+
+config IMA_LSM_BASED_RULES
+	bool "Enable LSM based measurement policy rules(requires audit)"
+	depends on IMA
+	select AUDIT
+	default y
+	help
+	  Disabling this option will not enforce LSM based policy rules.
security/integrity/ima/ima.h +21 -0
Index: security-testing-2.6/security/integrity/ima/ima.h
===================================================================
@@ -145,4 +145,25 @@ struct ima_iint_cache {
 	u8 		digest[IMA_DIGEST_SIZE];
 	struct mutex mutex;
 };
+
+/* LSM based policy rules require audit */
+#ifdef CONFIG_AUDIT
+
+#define security_filter_rule_init security_audit_rule_init
+#define security_filter_rule_match security_audit_rule_match
+
+#else
+
+static inline int security_filter_rule_init(u32 field, u32 op, char *rulestr,
+					    void **lsmrule)
+{
+	return -EINVAL;
+}
+
+static inline int security_filter_rule_match(u32 secid, u32 field, u32 op,
+				   void *lsmrule, struct audit_context *actx)
+{
+	return -EINVAL;
+}
+#endif
 #endif
security/integrity/ima/ima_policy.c +0 -3
Index: security-testing-2.6/security/integrity/ima/ima_policy.c
===================================================================
@@ -20,9 +20,6 @@
 
 #include "ima.h"
 
-#define security_filter_rule_init security_audit_rule_init
-#define security_filter_rule_match security_audit_rule_match
-
 struct ima_measure_rule_entry {
 	struct list_head list;
 	int action;
#1 lore raw
Quoted 10 lines · On Fri, 01 Aug 2008 13:33:00 -0400 Mimi Zohar wrote:

Randy Dunlap <[email protected]> wrote on 08/01/2008 01:34:14 AM:

Quoted 7 lines

security/integrity/ima:

linux-next-20080731/security/integrity/ima/ima_policy.c:81: error: implicit declaration of function 'security_audit_rule_match' linux-next-20080731/security/integrity/ima/ima_policy.c:206: error: implicit declaration of function 'security_audit_rule_init'
make[4]: *** [security/integrity/ima/ima_policy.o] Error 1

Quoted 6 lines

- Update security/integrity/ima/Kconfig for LSM based policy rules to select CONFIG_AUDIT.
- Add dummy security_filter_rule_init/match routines for when CONFIG_AUDIT is not configured.

Thanks. Works for me.

Quoted 51 lines

Index: security-testing-2.6/security/integrity/ima/Kconfig
===================================================================

security/integrity/ima/Kconfig +8 -0
@@ -39,3 +39,11 @@ config IMA_BASE_HOOKS
 	default n
 	help
 	  Enable this option to allow the LSM module to enforce integrity.
+
+config IMA_LSM_BASED_RULES
+	bool "Enable LSM based measurement policy rules(requires audit)"
+	depends on IMA
+	select AUDIT
+	default y
+	help
+	  Disabling this option will not enforce LSM based policy rules.

Index: security-testing-2.6/security/integrity/ima/ima.h
===================================================================

security/integrity/ima/ima.h +21 -0
@@ -145,4 +145,25 @@ struct ima_iint_cache {
 	u8 		digest[IMA_DIGEST_SIZE];
 	struct mutex mutex;
 };
+
+/* LSM based policy rules require audit */
+#ifdef CONFIG_AUDIT
+
+#define security_filter_rule_init security_audit_rule_init
+#define security_filter_rule_match security_audit_rule_match
+
+#else
+
+static inline int security_filter_rule_init(u32 field, u32 op, char *rulestr,
+					    void **lsmrule)
+{
+	return -EINVAL;
+}
+
+static inline int security_filter_rule_match(u32 secid, u32 field, u32 op,
+				   void *lsmrule, struct audit_context *actx)
+{
+	return -EINVAL;
+}
+#endif
 #endif

Index: security-testing-2.6/security/integrity/ima/ima_policy.c
===================================================================

security/integrity/ima/ima_policy.c line 25

Quoted 9 lines
security/integrity/ima/ima_policy.c +0 -3
@@ -20,9 +20,6 @@
 
 #include "ima.h"
 
-#define security_filter_rule_init security_audit_rule_init
-#define security_filter_rule_match security_audit_rule_match
-
 struct ima_measure_rule_entry {
 	struct list_head list;
 	int action;

---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/