Skip to contentSkip to conversation

integrity

PATCH In review Mimi Zohar 6 participants 19 messages Feb 4, 2009 – Feb 10, 2009

Subsystems (10)
lore
Share & tools
lore

Mimi Zohar

author
#0 lore raw

cover integrity

This patchset contains the IMA integrity patches. The changes made since the last integrity posting are based on comments made by James Morris and Serge Hallyn.
- removed test for NULL return code from securityfs_create_file/dir
- alloc ima_template_entry before calling ima_store_template()
- log ima_add_boot_aggregate failure
- free invalid rule
- add hook to increment opencount for /dev/zero shm
- replaced hard coded string length with #define name
- removed unused IMA_TEMPLATE_NAME_LEN

This patchset is dependent on the tpm-integrity-interface patch, which has been applied to the security-testing-2.6/#next.

Mimi Zohar (7):
integrity: IMA hooks
integrity: IMA as an integrity service provider
integrity: IMA display
integrity: IMA policy
integrity: IMA policy open
Integrity: IMA file free imbalance
Integrity: IMA update maintainers

author
#1 lore raw

PATCH 1/7 integrity: IMA hooks

This patch replaces the generic integrity hooks, for which IMA registered itself, with IMA integrity hooks in the appropriate places directly in the fs directory.

---

Documentation/kernel-parameters.txt +1 -0
index a2d8805..7c67b94 100644
@@ -44,6 +44,7 @@ parameter is applicable:
 	FB	The frame buffer device is enabled.
 	HW	Appropriate hardware is enabled.
 	IA-64	IA-64 architecture is enabled.
+	IMA     Integrity measurement architecture is enabled.
 	IOSCHED	More than one I/O scheduler is enabled.
 	IP_PNP	IP DHCP, BOOTP, or RARP is enabled.
 	ISAPNP	ISA PnP code is enabled.
fs/exec.c +10 -0
index 02d2e12..9c789a5 100644
@@ -45,6 +45,7 @@
 #include <linux/proc_fs.h>
 #include <linux/mount.h>
 #include <linux/security.h>
+#include <linux/ima.h>
 #include <linux/syscalls.h>
 #include <linux/tsacct_kern.h>
 #include <linux/cn_proc.h>
@@ -130,6 +131,9 @@ asmlinkage long sys_uselib(const char __user * library)
 	error = vfs_permission(&nd, MAY_READ | MAY_EXEC | MAY_OPEN);
 	if (error)
 		goto exit;
+	error = ima_path_check(&nd.path, MAY_READ | MAY_EXEC | MAY_OPEN);
+	if (error)
+		goto exit;
 
 	file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE);
 	error = PTR_ERR(file);
@@ -683,6 +687,9 @@ struct file *open_exec(const char *name)
 	err = vfs_permission(&nd, MAY_EXEC | MAY_OPEN);
 	if (err)
 		goto out_path_put;
+	err = ima_path_check(&nd.path, MAY_EXEC | MAY_OPEN);
+	if (err)
+		goto out_path_put;
 
 	file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE);
 	if (IS_ERR(file))
@@ -1209,6 +1216,9 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
 	retval = security_bprm_check(bprm);
 	if (retval)
 		return retval;
+	retval = ima_bprm_check(bprm);
+	if (retval)
+		return retval;
 
 	/* kernel module loader fixup */
 	/* so we don't try to load run modprobe in kernel space. */
fs/file_table.c +2 -0
index 0fbcacc..55895cc 100644
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/security.h>
+#include <linux/ima.h>
 #include <linux/eventpoll.h>
 #include <linux/rcupdate.h>
 #include <linux/mount.h>
@@ -276,6 +277,7 @@ void __fput(struct file *file)
 	if (file->f_op && file->f_op->release)
 		file->f_op->release(inode, file);
 	security_file_free(file);
+	ima_file_free(file);
 	if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL))
 		cdev_put(inode->i_cdev);
 	fops_put(file->f_op);
fs/inode.c +17 -7
index 098a244..ed22b14 100644
@@ -17,6 +17,7 @@
 #include <linux/hash.h>
 #include <linux/swap.h>
 #include <linux/security.h>
+#include <linux/ima.h>
 #include <linux/pagemap.h>
 #include <linux/cdev.h>
 #include <linux/bootmem.h>
@@ -144,13 +145,13 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
 	inode->i_cdev = NULL;
 	inode->i_rdev = 0;
 	inode->dirtied_when = 0;
-	if (security_inode_alloc(inode)) {
-		if (inode->i_sb->s_op->destroy_inode)
-			inode->i_sb->s_op->destroy_inode(inode);
-		else
-			kmem_cache_free(inode_cachep, (inode));
-		return NULL;
-	}
+
+	if (security_inode_alloc(inode))
+		goto out_free_inode;
+
+	/* allocate and initialize an i_integrity */
+	if (ima_inode_alloc(inode))
+		goto out_free_security;
 
 	spin_lock_init(&inode->i_lock);
 	lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key);
@@ -186,6 +187,15 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
 	inode->i_mapping = mapping;
 
 	return inode;
+
+out_free_security:
+	security_inode_free(inode);
+out_free_inode:
+	if (inode->i_sb->s_op->destroy_inode)
+		inode->i_sb->s_op->destroy_inode(inode);
+	else
+		kmem_cache_free(inode_cachep, (inode));
+	return NULL;
 }
 EXPORT_SYMBOL(inode_init_always);
 
fs/namei.c +8 -0
index af3783f..d4654ce 100644
@@ -24,6 +24,7 @@
 #include <linux/fsnotify.h>
 #include <linux/personality.h>
 #include <linux/security.h>
+#include <linux/ima.h>
 #include <linux/syscalls.h>
 #include <linux/mount.h>
 #include <linux/audit.h>
@@ -860,6 +861,8 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
 		err = exec_permission_lite(inode);
 		if (err == -EAGAIN)
 			err = vfs_permission(nd, MAY_EXEC);
+ 		if (!err)
+			err = ima_path_check(&nd->path, MAY_EXEC);
  		if (err)
 			break;
 
@@ -1525,6 +1528,11 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
 	error = vfs_permission(nd, acc_mode);
 	if (error)
 		return error;
+
+	error = ima_path_check(&nd->path,
+			       acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC));
+	if (error)
+		return error;
 	/*
 	 * An append-only file must be opened in append mode for writing.
 	 */
include/linux/ima.h new file +44 -0

44 lines not on this page · raw message

mm/mmap.c +4 -0
index d4855a6..c3647f3 100644
@@ -20,6 +20,7 @@
 #include <linux/fs.h>
 #include <linux/personality.h>
 #include <linux/security.h>
+#include <linux/ima.h>
 #include <linux/hugetlb.h>
 #include <linux/profile.h>
 #include <linux/module.h>
@@ -1050,6 +1051,9 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
 	error = security_file_mmap(file, reqprot, prot, flags, addr, 0);
 	if (error)
 		return error;
+	error = ima_file_mmap(file, prot);
+	if (error)
+		return error;
 
 	return mmap_region(file, addr, len, flags, vm_flags, pgoff,
 			   accountable);
Signature · 1 line
1.5.6.6
author
#2 lore raw

PATCH 2/7 integrity: IMA as an integrity service provider

In reply to Mimi Zohar

IMA provides hardware (TPM) based measurement and attestation for file measurements. As the Trusted Computing (TPM) model requires, IMA measures all files before they are accessed in any way (on the integrity_bprm_check, integrity_path_check and integrity_file_mmap hooks), and commits the measurements to the TPM. Once added to the TPM, measurements can not be removed.

In addition, IMA maintains a list of these file measurements, which can be used to validate the aggregate value stored in the TPM. The TPM can sign these measurements, and thus the system can prove, to itself and to a third party, the system's integrity in a way that cannot be circumvented by malicious or compromised software.

- alloc ima_template_entry before calling ima_store_template()
- log ima_add_boot_aggregate() failure
- removed unused IMA_TEMPLATE_NAME_LEN
- replaced hard coded string length with #define name

---

Documentation/kernel-parameters.txt +9 -0
index 7c67b94..31e0c2c 100644
@@ -895,6 +895,15 @@ and is between 256 and 4096 characters. It is defined in the file
 	ihash_entries=	[KNL]
 			Set number of hash buckets for inode cache.
 
+	ima_audit=	[IMA]
+			Format: { "0" | "1" }
+			0 -- integrity auditing messages. (Default)
+			1 -- enable informational integrity auditing messages.
+
+	ima_hash=	[IMA]
+			Formt: { "sha1" | "md5" }
+			default: "sha1"
+
 	in2000=		[HW,SCSI]
 			See header of drivers/scsi/in2000.c.
 
include/linux/audit.h +5 -0
index 26c4f6f..8d1f677 100644
@@ -125,6 +125,11 @@
 #define AUDIT_LAST_KERN_ANOM_MSG    1799
 #define AUDIT_ANOM_PROMISCUOUS      1700 /* Device changed promiscuous mode */
 #define AUDIT_ANOM_ABEND            1701 /* Process ended abnormally */
+#define AUDIT_INTEGRITY_DATA	    1800 /* Data integrity verification */
+#define AUDIT_INTEGRITY_METADATA    1801 /* Metadata integrity verification */
+#define AUDIT_INTEGRITY_STATUS	    1802 /* Integrity enable status */
+#define AUDIT_INTEGRITY_HASH	    1803 /* Integrity HASH type */
+#define AUDIT_INTEGRITY_PCR	    1804 /* PCR invalidation msgs */
 
 #define AUDIT_KERNEL		2000	/* Asynchronous audit record. NOT A REQUEST. */
 
include/linux/ima.h +10 -0
index 4ed1e4d..dcc3664 100644
@@ -12,6 +12,15 @@
 #ifndef _LINUX_IMA_H
 #define _LINUX_IMA_H
 
+#ifdef CONFIG_IMA
+extern int ima_bprm_check(struct linux_binprm *bprm);
+extern int ima_inode_alloc(struct inode *inode);
+extern void ima_inode_free(struct inode *inode);
+extern int ima_path_check(struct path *path, int mask);
+extern void ima_file_free(struct file *file);
+extern int ima_file_mmap(struct file *file, unsigned long prot);
+
+#else
 static inline int ima_bprm_check(struct linux_binprm *bprm)
 {
 	return 0;
@@ -41,4 +50,5 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
 {
 	return 0;
 }
+#endif /* CONFIG_IMA_H */
 #endif /* _LINUX_IMA_H */
security/Kconfig +4 -1
index d9f47ce..a79b23f 100644
@@ -55,7 +55,8 @@ 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.
+	  the TPM bios character driver and IMA, an integrity provider.  It is
+	  not used by SELinux or SMACK.
 
 	  If you are unsure how to answer this question, answer N.
 
@@ -126,5 +127,7 @@ config SECURITY_DEFAULT_MMAP_MIN_ADDR
 source security/selinux/Kconfig
 source security/smack/Kconfig
 
+source security/integrity/ima/Kconfig
+
 endmenu
 
security/Makefile +4 -0
index c05c127..595536c 100644
@@ -17,3 +17,7 @@ obj-$(CONFIG_SECURITY_SELINUX)		+= selinux/built-in.o
 obj-$(CONFIG_SECURITY_SMACK)		+= smack/built-in.o
 obj-$(CONFIG_SECURITY_ROOTPLUG)		+= root_plug.o
 obj-$(CONFIG_CGROUP_DEVICE)		+= device_cgroup.o
+
+# Object integrity file lists
+subdir-$(CONFIG_IMA)			+= integrity/ima
+obj-$(CONFIG_IMA)			+= integrity/ima/built-in.o
security/integrity/ima/Kconfig new file +49 -0

49 lines not on this page · raw message

security/integrity/ima/Makefile new file +9 -0
new file mode 100644
index 0000000..9d6bf97
@@ -0,0 +1,9 @@
+#
+# Makefile for building Trusted Computing Group's(TCG) runtime Integrity
+# Measurement Architecture(IMA).
+#
+
+obj-$(CONFIG_IMA) += ima.o
+
+ima-y := ima_queue.o ima_init.o ima_main.o ima_crypto.o ima_api.o \
+	 ima_policy.o ima_iint.o ima_audit.o
security/integrity/ima/ima.h new file +135 -0

135 lines not on this page · raw message

security/integrity/ima/ima_api.c new file +190 -0

190 lines not on this page · raw message

security/integrity/ima/ima_audit.c new file +78 -0

78 lines not on this page · raw message

security/integrity/ima/ima_crypto.c new file +140 -0

140 lines not on this page · raw message

security/integrity/ima/ima_iint.c new file +185 -0

185 lines not on this page · raw message

security/integrity/ima/ima_init.c new file +90 -0

90 lines not on this page · raw message

security/integrity/ima/ima_main.c new file +280 -0

280 lines not on this page · raw message

security/integrity/ima/ima_policy.c new file +126 -0

126 lines not on this page · raw message

security/integrity/ima/ima_queue.c new file +140 -0

140 lines not on this page · raw message

Signature · 1 line
1.5.6.6
maintainer Acked-by Serge Hallyn on v1 2/7
#3 lore raw

Re: [PATCH 2/7] integrity: IMA as an integrity service provider

Quoted 13 lines · Mimi Zohar

IMA provides hardware (TPM) based measurement and attestation for file measurements. As the Trusted Computing (TPM) model requires, IMA measures all files before they are accessed in any way (on the integrity_bprm_check, integrity_path_check and integrity_file_mmap hooks), and commits the measurements to the TPM. Once added to the TPM, measurements can not be removed.

In addition, IMA maintains a list of these file measurements, which can be used to validate the aggregate value stored in the TPM. The TPM can sign these measurements, and thus the system can prove, to itself and to a third party, the system's integrity in a way that cannot be circumvented by malicious or compromised software.

Quoted 6 lines

- alloc ima_template_entry before calling ima_store_template()
- log ima_add_boot_aggregate() failure
- removed unused IMA_TEMPLATE_NAME_LEN
- replaced hard coded string length with #define name

#4 lore raw

Re: [PATCH 2/7] integrity: IMA as an integrity service provider

In reply to Mimi Zohar

Hi!

security/integrity/ima/Kconfig line 5

Quoted 8 lines
security/integrity/ima/Kconfig new file +5 -0
@@ -0,0 +1,49 @@
+# IBM Integrity Measurement Architecture
+#
+config IMA
+	bool "Integrity Measurement Architecture(IMA)"
+	depends on ACPI

Ugh?

Quoted 9 lines
security/integrity/ima/Kconfig new file +9 -0
+	select SECURITYFS
+	select CRYPTO
+	select CRYPTO_HMAC
+	select CRYPTO_MD5
+	select CRYPTO_SHA1
+	select TCG_TPM
+	select TCG_TIS
+	help
+	  The Trusted Computing Group(TCG) runtime Integrity

security/integrity/ima/Kconfig line 24

Quoted 10 lines
security/integrity/ima/Kconfig new file +10 -0
+	  Measurement Architecture(IMA) maintains a list of hash
+	  values of executables and other sensitive system files,
+	  as they are read or executed. If an attacker manages
+	  to change the contents of an important system file
+	  being measured, we can tell.
+
+	  If your system has a TPM chip, then IMA also maintains
+	  an aggregate integrity value over this list inside the
+	  TPM hardware, so that the TPM can prove to a third party
+	  whether or not critical system files have been modified.

Sound like 'well use this so people with homegrown distros can't access our e-shop'...

security/integrity/ima/Kconfig line 26

Quoted 2 lines
security/integrity/ima/Kconfig new file +2 -0
+	  Read <http://www.usenix.org/events/sec04/tech/sailer.html>
+	  to learn more about IMA.

Maybe some basic docs should go into Documentation?

security/integrity/ima/Kconfig line 37

Quoted 9 lines
security/integrity/ima/Kconfig new file +9 -0
+config IMA_MEASURE_PCR_IDX
+	int
+	depends on IMA
+	range 8 14
+	default 10
+	help
+	  IMA_MEASURE_PCR_IDX determines the TPM PCR register index
+	  that IMA uses to maintain the integrity aggregate of the
+	  measurement list.  If unsure, use the default 10.

This is quite ugly. How do you expect enduser to get this right? How do you expect distro to get it right for all users?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#5 lore raw

Re: [PATCH 2/7] integrity: IMA as an integrity service provider

Quoted 27 lines · Pavel Machek

Hi!

security/integrity/ima/Kconfig line 5

Quoted 8 lines
security/integrity/ima/Kconfig new file +5 -0
@@ -0,0 +1,49 @@
+# IBM Integrity Measurement Architecture
+#
+config IMA
+	bool "Integrity Measurement Architecture(IMA)"
+	depends on ACPI

Ugh?

Quoted 14 lines
security/integrity/ima/Kconfig new file +14 -0
+	select SECURITYFS
+	select CRYPTO
+	select CRYPTO_HMAC
+	select CRYPTO_MD5
+	select CRYPTO_SHA1
+	select TCG_TPM
+	select TCG_TIS
+	help
+	  The Trusted Computing Group(TCG) runtime Integrity
+	  Measurement Architecture(IMA) maintains a list of hash
+	  values of executables and other sensitive system files,
+	  as they are read or executed. If an attacker manages
+	  to change the contents of an important system file
+	  being measured, we can tell.
Quoted 8 lines

security/integrity/ima/Kconfig line 24

Quoted 5 lines
security/integrity/ima/Kconfig new file +5 -0
+
+	  If your system has a TPM chip, then IMA also maintains
+	  an aggregate integrity value over this list inside the
+	  TPM hardware, so that the TPM can prove to a third party
+	  whether or not critical system files have been modified.

Sound like 'well use this so people with homegrown distros can't access our e-shop'...

That would be tough to pull off, as they would have to have your TPM's public key stored.

So a small shop could pull this off for their employees, I suppose, but it's not practical for say a bank to do. (And if they did, well, I'll bank elsewhere.)

Quoted 5 lines

security/integrity/ima/Kconfig line 26

Quoted 2 lines
security/integrity/ima/Kconfig new file +2 -0
+	  Read <http://www.usenix.org/events/sec04/tech/sailer.html>
+	  to learn more about IMA.

Maybe some basic docs should go into Documentation?

Quoted 12 lines

security/integrity/ima/Kconfig line 37

Quoted 9 lines
security/integrity/ima/Kconfig new file +9 -0
+config IMA_MEASURE_PCR_IDX
+	int
+	depends on IMA
+	range 8 14
+	default 10
+	help
+	  IMA_MEASURE_PCR_IDX determines the TPM PCR register index
+	  that IMA uses to maintain the integrity aggregate of the
+	  measurement list.  If unsure, use the default 10.

This is quite ugly. How do you expect enduser to get this right? How do you expect distro to get it right for all users?

I'd asked about this before, and here's how I understood it:

End-users aren't expected to get this right - note that it's hidden. If it changes, then that will be because some other software using TPM (like trousers) uses 10, so it will be changed in the upstream kernel for everyone.

-serge

author
#6 lore raw

PATCH 3/7 integrity: IMA display

In reply to Mimi Zohar

Make the measurement lists available through securityfs.
- removed test for NULL return code from securityfs_create_file/dir

---

security/integrity/ima/Makefile +1 -1
index 9d6bf97..787c4cb 100644
@@ -5,5 +5,5 @@
 
 obj-$(CONFIG_IMA) += ima.o
 
-ima-y := ima_queue.o ima_init.o ima_main.o ima_crypto.o ima_api.o \
+ima-y := ima_fs.o ima_queue.o ima_init.o ima_main.o ima_crypto.o ima_api.o \
 	 ima_policy.o ima_iint.o ima_audit.o
security/integrity/ima/ima.h +5 -0
index bfa72ed..9c280cc 100644
@@ -67,6 +67,9 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode,
 /* Internal IMA function definitions */
 void ima_iintcache_init(void);
 int ima_init(void);
+void ima_cleanup(void);
+int ima_fs_init(void);
+void ima_fs_cleanup(void);
 int ima_add_template_entry(struct ima_template_entry *entry, int violation,
 			   const char *op, struct inode *inode);
 int ima_calc_hash(struct file *file, char *digest);
@@ -115,6 +118,8 @@ void ima_store_measurement(struct ima_iint_cache *iint, struct file *file,
 			   const unsigned char *filename);
 int ima_store_template(struct ima_template_entry *entry, int violation,
 		       struct inode *inode);
+void ima_template_show(struct seq_file *m, void *e,
+		       enum ima_show_type show);
 
 /* radix tree calls to lookup, insert, delete
  * integrity data associated with an inode.
security/integrity/ima/ima_fs.c new file +296 -0

296 lines not on this page · raw message

security/integrity/ima/ima_init.c +7 -1
index e0f02e3..cf227db 100644
@@ -86,5 +86,11 @@ int ima_init(void)
 
 	ima_add_boot_aggregate();	/* boot aggregate must be first entry */
 	ima_init_policy();
-	return 0;
+
+	return ima_fs_init();
+}
+
+void __exit ima_cleanup(void)
+{
+	ima_fs_cleanup();
 }
security/integrity/ima/ima_main.c +5 -0
index 53cee4c..871e356 100644
@@ -274,6 +274,11 @@ static int __init init_ima(void)
 	return error;
 }
 
+static void __exit cleanup_ima(void)
+{
+	ima_cleanup();
+}
+
 late_initcall(init_ima);	/* Start IMA after the TPM is available */
 
 MODULE_DESCRIPTION("Integrity Measurement Architecture");
Signature · 1 line
1.5.6.6
author
#7 lore raw

PATCH 4/7 integrity: IMA policy

In reply to Mimi Zohar

Support for a user loadable policy through securityfs with support for LSM specific policy data.
- free invalid rule in ima_parse_add_rule()

---

Documentation/ABI/testing/ima_policy new file +61 -0
new file mode 100644
index 0000000..6434f0d
@@ -0,0 +1,61 @@
+What:		security/ima/policy
+Date:		May 2008
+Contact:	Mimi Zohar <[email protected]>
+Description:
+		The Trusted Computing Group(TCG) runtime Integrity
+		Measurement Architecture(IMA) maintains a list of hash
+		values of executables and other sensitive system files
+		loaded into the run-time of this system.  At runtime,
+		the policy can be constrained based on LSM specific data.
+		Policies are loaded into the securityfs file ima/policy
+		by opening the file, writing the rules one at a time and
+		then closing the file.  The new policy takes effect after
+		the file ima/policy is closed.
+
+		rule format: action [condition ...]
+
+		action: measure | dont_measure
+		condition:= base | lsm
+			base:	[[func=] [mask=] [fsmagic=] [uid=]]
+			lsm:	[[subj_user=] [subj_role=] [subj_type=]
+				 [obj_user=] [obj_role=] [obj_type=]]
+
+		base: 	func:= [BPRM_CHECK][FILE_MMAP][INODE_PERMISSION]
+			mask:= [MAY_READ] [MAY_WRITE] [MAY_APPEND] [MAY_EXEC]
+			fsmagic:= hex value
+			uid:= decimal value
+		lsm:  	are LSM specific
+
+		default policy:
+			# PROC_SUPER_MAGIC
+			dont_measure fsmagic=0x9fa0
+			# SYSFS_MAGIC
+			dont_measure fsmagic=0x62656572
+			# DEBUGFS_MAGIC
+			dont_measure fsmagic=0x64626720
+			# TMPFS_MAGIC
+			dont_measure fsmagic=0x01021994
+			# SECURITYFS_MAGIC
+			dont_measure fsmagic=0x73636673
+
+			measure func=BPRM_CHECK
+			measure func=FILE_MMAP mask=MAY_EXEC
+			measure func=INODE_PERM mask=MAY_READ uid=0
+
+		The default policy measures all executables in bprm_check,
+		all files mmapped executable in file_mmap, and all files
+		open for read by root in inode_permission.
+
+		Examples of LSM specific definitions:
+
+		SELinux:
+			# SELINUX_MAGIC
+			dont_measure fsmagic=0xF97CFF8C
+
+			dont_measure obj_type=var_log_t
+			dont_measure obj_type=auditd_log_t
+			measure subj_user=system_u func=INODE_PERM mask=MAY_READ
+			measure subj_role=system_r func=INODE_PERM mask=MAY_READ
+
+		Smack:
+			measure subj_user=_ func=INODE_PERM mask=MAY_READ
security/integrity/ima/Kconfig +6 -0
index 2a761c8..3d2b6ee 100644
@@ -47,3 +47,9 @@ config IMA_AUDIT
 	  auditing messages can be enabled with 'ima_audit=1' on
 	  the kernel command line.
 
+config IMA_LSM_RULES
+	bool
+	depends on IMA && (SECURITY_SELINUX || SECURITY_SMACK)
+	default y
+	help
+	  Disabling this option will disregard LSM based policy rules
security/integrity/ima/ima.h +24 -0
index 9c280cc..42706b5 100644
@@ -137,4 +137,28 @@ enum ima_hooks { PATH_CHECK = 1, FILE_MMAP, BPRM_CHECK };
 int ima_match_policy(struct inode *inode, enum ima_hooks func, int mask);
 void ima_init_policy(void);
 void ima_update_policy(void);
+int ima_parse_add_rule(char *);
+void ima_delete_rules(void);
+
+/* LSM based policy rules require audit */
+#ifdef CONFIG_IMA_LSM_RULES
+
+#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 /* CONFIG_IMA_LSM_RULES */
 #endif
security/integrity/ima/ima_fs.c +66 -1

103 lines not on this page · raw message

security/integrity/ima/ima_policy.c +290 -3

343 lines not on this page · raw message

Signature · 1 line
1.5.6.6
author
#8 lore raw

PATCH 5/7 integrity: IMA policy open

In reply to Mimi Zohar

Sequentialize access to the policy file
- permit multiple attempts to replace default policy with a valid policy

---

security/integrity/ima/ima_fs.c +16 -1
index 95ef1ca..573780c 100644
@@ -277,16 +277,30 @@ static struct dentry *runtime_measurements_count;
 static struct dentry *violations;
 static struct dentry *ima_policy;
 
+static atomic_t policy_opencount = ATOMIC_INIT(1);
+/*
+ * ima_open_policy: sequentialize access to the policy file
+ */
+int ima_open_policy(struct inode * inode, struct file * filp)
+{
+	if (atomic_dec_and_test(&policy_opencount))
+		return 0;
+	return -EBUSY;
+}
+
 /*
  * ima_release_policy - start using the new measure policy rules.
  *
  * Initially, ima_measure points to the default policy rules, now
- * point to the new policy rules, and remove the securityfs policy file.
+ * point to the new policy rules, and remove the securityfs policy file,
+ * assuming a valid policy.
  */
 static int ima_release_policy(struct inode *inode, struct file *file)
 {
 	if (!valid_policy) {
 		ima_delete_rules();
+		valid_policy = 1;
+		atomic_set(&policy_opencount, 1);
 		return 0;
 	}
 	ima_update_policy();
@@ -296,6 +310,7 @@ static int ima_release_policy(struct inode *inode, struct file *file)
 }
 
 static struct file_operations ima_measure_policy_ops = {
+	.open = ima_open_policy,
 	.write = ima_write_policy,
 	.release = ima_release_policy
 };
Signature · 1 line
1.5.6.6
author
#9 lore raw

PATCH 6/7 Integrity: IMA file free imbalance

In reply to Mimi Zohar

The number of calls to ima_path_check()/ima_file_free() should be balanced. An extra call to fput(), indicates the file could have been accessed without first being measured.

Although f_count is incremented/decremented in places other than fget/fput, like fget_light/fput_light and get_file, the current task must already hold a file refcnt. The call to __fput() is delayed until the refcnt becomes 0, resulting in ima_file_free() flagging any changes.

- add hook to increment opencount for IPC shared memory(SYSV), shmat files, and /dev/zero
- moved NULL iint test in opencount_get()

---

include/linux/ima.h +6 -0
index dcc3664..6db30a3 100644
@@ -19,6 +19,7 @@ extern void ima_inode_free(struct inode *inode);
 extern int ima_path_check(struct path *path, int mask);
 extern void ima_file_free(struct file *file);
 extern int ima_file_mmap(struct file *file, unsigned long prot);
+extern void ima_shm_check(struct file *file);
 
 #else
 static inline int ima_bprm_check(struct linux_binprm *bprm)
@@ -50,5 +51,10 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
 {
 	return 0;
 }
+
+static inline void ima_shm_check(struct file *file)
+{
+	return;
+}
 #endif /* CONFIG_IMA_H */
 #endif /* _LINUX_IMA_H */
ipc/shm.c +3 -0
index 38a0557..d39bd76 100644
@@ -39,6 +39,7 @@
 #include <linux/nsproxy.h>
 #include <linux/mount.h>
 #include <linux/ipc_namespace.h>
+#include <linux/ima.h>
 
 #include <asm/uaccess.h>
 
@@ -381,6 +382,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
 	error = PTR_ERR(file);
 	if (IS_ERR(file))
 		goto no_file;
+	ima_shm_check(file);
 
 	id = ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni);
 	if (id < 0) {
@@ -888,6 +890,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
 	file = alloc_file(path.mnt, path.dentry, f_mode, &shm_file_operations);
 	if (!file)
 		goto out_free;
+	ima_shm_check(file);
 
 	file->private_data = sfd;
 	file->f_mapping = shp->shm_file->f_mapping;
mm/shmem.c +2 -0
index f1b0d48..dd5588f 100644
@@ -51,6 +51,7 @@
 #include <linux/highmem.h>
 #include <linux/seq_file.h>
 #include <linux/magic.h>
+#include <linux/ima.h>
 
 #include <asm/uaccess.h>
 #include <asm/div64.h>
@@ -2600,6 +2601,7 @@ int shmem_zero_setup(struct vm_area_struct *vma)
 	if (IS_ERR(file))
 		return PTR_ERR(file);
 
+	ima_shm_check(file);
 	if (vma->vm_file)
 		fput(vma->vm_file);
 	vma->vm_file = file;
security/integrity/ima/ima.h +2 -0
index 42706b5..e3c16a2 100644
@@ -97,6 +97,7 @@ static inline unsigned long ima_hash_key(u8 *digest)
 
 /* iint cache flags */
 #define IMA_MEASURED		1
+#define IMA_IINT_DUMP_STACK	512
 
 /* integrity data associated with an inode */
 struct ima_iint_cache {
@@ -106,6 +107,7 @@ struct ima_iint_cache {
 	struct mutex mutex;	/* protects: version, flags, digest */
 	long readcount;		/* measured files readcount */
 	long writecount;	/* measured files writecount */
+	long opencount;		/* opens reference count */
 	struct kref refcount;	/* ima_iint_cache reference count */
 	struct rcu_head rcu;
 };
security/integrity/ima/ima_iint.c +17 -0
index 750db3c..1f035e8 100644
@@ -126,6 +126,7 @@ struct ima_iint_cache *ima_iint_find_insert_get(struct inode *inode)
 
 	return iint;
 }
+EXPORT_SYMBOL_GPL(ima_iint_find_insert_get);
 
 /* iint_free - called when the iint refcount goes to zero */
 void iint_free(struct kref *kref)
@@ -134,6 +135,21 @@ void iint_free(struct kref *kref)
 						   refcount);
 	iint->version = 0;
 	iint->flags = 0UL;
+	if (iint->readcount != 0) {
+		printk(KERN_INFO "%s: readcount: %ld\n", __FUNCTION__,
+		       iint->readcount);
+		iint->readcount = 0;
+	}
+	if (iint->writecount != 0) {
+		printk(KERN_INFO "%s: writecount: %ld\n", __FUNCTION__,
+		       iint->writecount);
+		iint->writecount = 0;
+	}
+	if (iint->opencount != 0) {
+		printk(KERN_INFO "%s: opencount: %ld\n", __FUNCTION__,
+		       iint->opencount);
+		iint->opencount = 0;
+	}
 	kref_set(&iint->refcount, 1);
 	kmem_cache_free(iint_cache, iint);
 }
@@ -174,6 +190,7 @@ static void init_once(void *foo)
 	mutex_init(&iint->mutex);
 	iint->readcount = 0;
 	iint->writecount = 0;
+	iint->opencount = 0;
 	kref_set(&iint->refcount, 1);
 }
 
security/integrity/ima/ima_main.c +42 -0

72 lines not on this page · raw message

Signature · 1 line
1.5.6.6
author
#10 lore raw

PATCH 7/7 Integrity: IMA update maintainers

In reply to Mimi Zohar

---

MAINTAINERS +5 -0
index 6bd7d47..12fc280 100644
@@ -2175,6 +2175,11 @@ M:	[email protected]
 L:	[email protected]
 S:	Maintained
 
+INTEGRITY MEASUREMENT ARCHITECTURE (IMA)
+P:	Mimi Zohar
+M:	[email protected]
+S:	Supported
+
 IMS TWINTURBO FRAMEBUFFER DRIVER
 L:	[email protected] (moderated for non-subscribers)
 S:	Orphan
Signature · 1 line
1.5.6.6
maintainer
#11 lore raw
In reply to Mimi Zohar

I get an oops on boot with this.

Do you have lock and list debugging enabled?

[    2.244280] ------------[ cut here ]------------
[    2.245261] WARNING: at kernel/mutex.c:135 mutex_lock_nested+0x325/0x380()
[    2.245261] Hardware name: PowerEdge T105
[    2.245261] Modules linked in:
[    2.245261] Pid: 1, comm: swapper Not tainted 2.6.28 #37
[    2.245261] Call Trace:
[    2.245261]  [<ffffffff8104f15f>] warn_slowpath+0xaf/0x110
[    2.245261]  [<ffffffff8107986d>] ? __lock_acquire+0x58d/0x1b80
[    2.245261]  [<ffffffff8107986d>] ? __lock_acquire+0x58d/0x1b80
[    2.245261]  [<ffffffff81383f75>] mutex_lock_nested+0x325/0x380
[    2.245261]  [<ffffffff810418fe>] ? __wake_up+0x4e/0x70
[    2.245261]  [<ffffffff81385c4d>] ? _spin_unlock_irqrestore+0x6d/0x90
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff8125b7db>] tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff8125ba64>] transmit_cmd+0x14/0x50
[    2.245261]  [<ffffffff8125baef>] __tpm_pcr_read+0x4f/0x80
[    2.245261]  [<ffffffff810e9f07>] ? kfree+0xc7/0x140
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff811b342f>] ? kobject_uevent_env+0x11f/0x3f0
[    2.245261]  [<ffffffff810a3e85>] ? __rcu_read_lock+0xc5/0xf0
[    2.245261]  [<ffffffff810a3d8b>] ? __rcu_read_unlock+0xbb/0xf0
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff8125c6b5>] ? tpm_chip_find_get+0xd5/0xf0
[    2.245261]  [<ffffffff8125c7d2>] tpm_pcr_read+0x42/0x70
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff8118d8b7>] ima_init+0x27/0x160
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dd8>] init_ima+0xe/0x1a
[    2.245261]  [<ffffffff8100a03c>] do_one_initcall+0x3c/0x180
[    2.245261]  [<ffffffff810a2a3e>] ? register_irq_proc+0xbe/0xe0
[    2.245261]  [<ffffffff81140000>] ? v2_read_dquot+0x240/0x2a0
[    2.245261]  [<ffffffff815ce703>] kernel_init+0x14d/0x1a3
[    2.245261]  [<ffffffff813855a6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    2.245261]  [<ffffffff81015ada>] child_rip+0xa/0x20
[    2.245261]  [<ffffffff810153be>] ? restore_args+0x0/0x30
[    2.245261]  [<ffffffff815ce5b6>] ? kernel_init+0x0/0x1a3
[    2.245261]  [<ffffffff81015ad0>] ? child_rip+0x0/0x20
[    2.245261] ---[ end trace 9947c764f5d88c86 ]---
[    2.245261] BUG: unable to handle kernel paging request at ffffffff00060000
[    2.245261] IP: [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261] PGD 203067 PUD 0
[    2.245261] Oops: 0000 [#1] PREEMPT SMP
[    2.245261] last sysfs file:
[    2.245261] CPU 0
[    2.245261] Modules linked in:
[    2.245261] Pid: 1, comm: swapper Tainted: G        W  2.6.28 #37
[    2.245261] RIP: 0010:[<ffffffff811cac36>]  [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261] RSP: 0018:ffff88012fa7fb80  EFLAGS: 00010046
[    2.245261] RAX: ffffffff00060000 RBX: ffffffff81559ce8 RCX: 0000000000000000
[    2.245261] RDX: ffffffff81559ce8 RSI: ffffffff00060000 RDI: ffff88012fa7fbd0
[    2.245261] RBP: ffff88012fa7fba0 R08: 0000000000000002 R09: 0000000000000001
[    2.245261] R10: ffff8801afa7f95f R11: ffff88012fa7f8e0 R12: ffffffff00060000
[    2.245261] R13: ffff88012fa7fbd0 R14: ffff88012fa80000 R15: ffffffff8125b7db
[    2.245261] FS:  0000000000000000(0000) GS:ffffffff8159fe00(0000) knlGS:0000000000000000
[    2.245261] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[    2.245261] CR2: ffffffff00060000 CR3: 0000000000201000 CR4: 00000000000006e0
[    2.245261] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    2.245261] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    2.245261] Process swapper (pid: 1, threadinfo ffff88012fa7e000, task ffff88012fa80000)
[    2.245261] Stack:
[    2.245261]  0000000000000246 ffffffff81559cb0 0000000000000246 ffffffff81559cb8
[    2.245261]  ffff88012fa7fc30 ffffffff81383d49 ffffffff8125b7db ffffffff810418fe
[    2.245261]  0000000000000001 ffffffff81559ce8 ffff88012fa7fbd0 ffff88012fa7fbd0
[    2.245261] Call Trace:
[    2.245261]  [<ffffffff81383d49>] mutex_lock_nested+0xf9/0x380
[    2.245261]  [<ffffffff8125b7db>] ? tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff810418fe>] ? __wake_up+0x4e/0x70
[    2.245261]  [<ffffffff8125b7db>] tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff8125ba64>] transmit_cmd+0x14/0x50
[    2.245261]  [<ffffffff8125baef>] __tpm_pcr_read+0x4f/0x80
[    2.245261]  [<ffffffff810e9f07>] ? kfree+0xc7/0x140
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff811b342f>] ? kobject_uevent_env+0x11f/0x3f0
[    2.245261]  [<ffffffff810a3e85>] ? __rcu_read_lock+0xc5/0xf0
[    2.245261]  [<ffffffff810a3d8b>] ? __rcu_read_unlock+0xbb/0xf0
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff8125c6b5>] ? tpm_chip_find_get+0xd5/0xf0
[    2.245261]  [<ffffffff8125c7d2>] tpm_pcr_read+0x42/0x70
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff8118d8b7>] ima_init+0x27/0x160
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dd8>] init_ima+0xe/0x1a
[    2.245261]  [<ffffffff8100a03c>] do_one_initcall+0x3c/0x180
[    2.245261]  [<ffffffff810a2a3e>] ? register_irq_proc+0xbe/0xe0
[    2.245261]  [<ffffffff81140000>] ? v2_read_dquot+0x240/0x2a0
[    2.245261]  [<ffffffff815ce703>] kernel_init+0x14d/0x1a3
[    2.245261]  [<ffffffff813855a6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    2.245261]  [<ffffffff81015ada>] child_rip+0xa/0x20
[    2.245261]  [<ffffffff810153be>] ? restore_args+0x0/0x30
[    2.245261]  [<ffffffff815ce5b6>] ? kernel_init+0x0/0x1a3
[    2.245261]  [<ffffffff81015ad0>] ? child_rip+0x0/0x20
[    2.245261] Code: 98 0f 1f 40 00 55 48 89 e5 48 83 ec 20 48 89 5d e8 4c 89 65 f0 48 89 d3 4c 89 6d f8 48 8b 42 08 49 89 fd 49 89 f4 48 39 f0 75 27 <49> 8b 04 24 48 39 d8 75 43 4c 89 6b 08 49 89 5d 00 4d 89 65 08
[    2.245261] RIP  [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261]  RSP <ffff88012fa7fb80>
[    2.245261] CR2: ffffffff00060000
[    2.245261] ---[ end trace 9947c764f5d88c86 ]---
[    2.822672] Kernel panic - not syncing: Attempted to kill init!
author
#12 lore raw
Quoted 3 lines · James Morris

I get an oops on boot with this.

Do you have lock and list debugging enabled?

In the past I had them enabled. Just recompiled now with them enabled and was able to boot without problems.

CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_PROVE_LOCKING=y
CONFIG_LOCKDEP=y
CONFIG_LOCK_STAT=y
CONFIG_DEBUG_LOCKDEP=y
CONFIG_TRACE_IRQFLAGS=y
CONFIG_DEBUG_SPINLOCK_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_HIGHMEM=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DEBUG_LIST=y

Quoted 104 lines
[    2.244280] ------------[ cut here ]------------
[    2.245261] WARNING: at kernel/mutex.c:135 mutex_lock_nested+0x325/0x380()
[    2.245261] Hardware name: PowerEdge T105
[    2.245261] Modules linked in:
[    2.245261] Pid: 1, comm: swapper Not tainted 2.6.28 #37
[    2.245261] Call Trace:
[    2.245261]  [<ffffffff8104f15f>] warn_slowpath+0xaf/0x110
[    2.245261]  [<ffffffff8107986d>] ? __lock_acquire+0x58d/0x1b80
[    2.245261]  [<ffffffff8107986d>] ? __lock_acquire+0x58d/0x1b80
[    2.245261]  [<ffffffff81383f75>] mutex_lock_nested+0x325/0x380
[    2.245261]  [<ffffffff810418fe>] ? __wake_up+0x4e/0x70
[    2.245261]  [<ffffffff81385c4d>] ? _spin_unlock_irqrestore+0x6d/0x90
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff8125b7db>] tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff8125ba64>] transmit_cmd+0x14/0x50
[    2.245261]  [<ffffffff8125baef>] __tpm_pcr_read+0x4f/0x80
[    2.245261]  [<ffffffff810e9f07>] ? kfree+0xc7/0x140
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff811b342f>] ? kobject_uevent_env+0x11f/0x3f0
[    2.245261]  [<ffffffff810a3e85>] ? __rcu_read_lock+0xc5/0xf0
[    2.245261]  [<ffffffff810a3d8b>] ? __rcu_read_unlock+0xbb/0xf0
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff8125c6b5>] ? tpm_chip_find_get+0xd5/0xf0
[    2.245261]  [<ffffffff8125c7d2>] tpm_pcr_read+0x42/0x70
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff8118d8b7>] ima_init+0x27/0x160
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dd8>] init_ima+0xe/0x1a
[    2.245261]  [<ffffffff8100a03c>] do_one_initcall+0x3c/0x180
[    2.245261]  [<ffffffff810a2a3e>] ? register_irq_proc+0xbe/0xe0
[    2.245261]  [<ffffffff81140000>] ? v2_read_dquot+0x240/0x2a0
[    2.245261]  [<ffffffff815ce703>] kernel_init+0x14d/0x1a3
[    2.245261]  [<ffffffff813855a6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    2.245261]  [<ffffffff81015ada>] child_rip+0xa/0x20
[    2.245261]  [<ffffffff810153be>] ? restore_args+0x0/0x30
[    2.245261]  [<ffffffff815ce5b6>] ? kernel_init+0x0/0x1a3
[    2.245261]  [<ffffffff81015ad0>] ? child_rip+0x0/0x20
[    2.245261] ---[ end trace 9947c764f5d88c86 ]---
[    2.245261] BUG: unable to handle kernel paging request at ffffffff00060000
[    2.245261] IP: [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261] PGD 203067 PUD 0
[    2.245261] Oops: 0000 [#1] PREEMPT SMP
[    2.245261] last sysfs file:
[    2.245261] CPU 0
[    2.245261] Modules linked in:
[    2.245261] Pid: 1, comm: swapper Tainted: G        W  2.6.28 #37
[    2.245261] RIP: 0010:[<ffffffff811cac36>]  [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261] RSP: 0018:ffff88012fa7fb80  EFLAGS: 00010046
[    2.245261] RAX: ffffffff00060000 RBX: ffffffff81559ce8 RCX: 0000000000000000
[    2.245261] RDX: ffffffff81559ce8 RSI: ffffffff00060000 RDI: ffff88012fa7fbd0
[    2.245261] RBP: ffff88012fa7fba0 R08: 0000000000000002 R09: 0000000000000001
[    2.245261] R10: ffff8801afa7f95f R11: ffff88012fa7f8e0 R12: ffffffff00060000
[    2.245261] R13: ffff88012fa7fbd0 R14: ffff88012fa80000 R15: ffffffff8125b7db
[    2.245261] FS:  0000000000000000(0000) GS:ffffffff8159fe00(0000) knlGS:0000000000000000
[    2.245261] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[    2.245261] CR2: ffffffff00060000 CR3: 0000000000201000 CR4: 00000000000006e0
[    2.245261] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    2.245261] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    2.245261] Process swapper (pid: 1, threadinfo ffff88012fa7e000, task ffff88012fa80000)
[    2.245261] Stack:
[    2.245261]  0000000000000246 ffffffff81559cb0 0000000000000246 ffffffff81559cb8
[    2.245261]  ffff88012fa7fc30 ffffffff81383d49 ffffffff8125b7db ffffffff810418fe
[    2.245261]  0000000000000001 ffffffff81559ce8 ffff88012fa7fbd0 ffff88012fa7fbd0
[    2.245261] Call Trace:
[    2.245261]  [<ffffffff81383d49>] mutex_lock_nested+0xf9/0x380
[    2.245261]  [<ffffffff8125b7db>] ? tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff810418fe>] ? __wake_up+0x4e/0x70
[    2.245261]  [<ffffffff8125b7db>] tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff8125ba64>] transmit_cmd+0x14/0x50
[    2.245261]  [<ffffffff8125baef>] __tpm_pcr_read+0x4f/0x80
[    2.245261]  [<ffffffff810e9f07>] ? kfree+0xc7/0x140
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff811b342f>] ? kobject_uevent_env+0x11f/0x3f0
[    2.245261]  [<ffffffff810a3e85>] ? __rcu_read_lock+0xc5/0xf0
[    2.245261]  [<ffffffff810a3d8b>] ? __rcu_read_unlock+0xbb/0xf0
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff8125c6b5>] ? tpm_chip_find_get+0xd5/0xf0
[    2.245261]  [<ffffffff8125c7d2>] tpm_pcr_read+0x42/0x70
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff8118d8b7>] ima_init+0x27/0x160
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dd8>] init_ima+0xe/0x1a
[    2.245261]  [<ffffffff8100a03c>] do_one_initcall+0x3c/0x180
[    2.245261]  [<ffffffff810a2a3e>] ? register_irq_proc+0xbe/0xe0
[    2.245261]  [<ffffffff81140000>] ? v2_read_dquot+0x240/0x2a0
[    2.245261]  [<ffffffff815ce703>] kernel_init+0x14d/0x1a3
[    2.245261]  [<ffffffff813855a6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    2.245261]  [<ffffffff81015ada>] child_rip+0xa/0x20
[    2.245261]  [<ffffffff810153be>] ? restore_args+0x0/0x30
[    2.245261]  [<ffffffff815ce5b6>] ? kernel_init+0x0/0x1a3
[    2.245261]  [<ffffffff81015ad0>] ? child_rip+0x0/0x20
[    2.245261] Code: 98 0f 1f 40 00 55 48 89 e5 48 83 ec 20 48 89 5d e8 4c 89 65 f0 48 89 d3 4c 89 6d f8 48 8b 42 08 49 89 fd 49 89 f4 48 39 f0 75 27 <49> 8b 04 24 48 39 d8 75 43 4c 89 6b 08 49 89 5d 00 4d 89 65 08
[    2.245261] RIP  [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261]  RSP <ffff88012fa7fb80>
[    2.245261] CR2: ffffffff00060000
[    2.245261] ---[ end trace 9947c764f5d88c86 ]---
[    2.822672] Kernel panic - not syncing: Attempted to kill init!
maintainer
#13 lore raw
Quoted 7 lines · Mimi Zohar
Quoted 3 lines · James Morris

I get an oops on boot with this.

Do you have lock and list debugging enabled?

In the past I had them enabled. Just recompiled now with them enabled and was able to boot without problems.

Do you have CONFIG_PREEMPT_RCU and SMP ?

Quoted 134 lines

CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_PROVE_LOCKING=y
CONFIG_LOCKDEP=y
CONFIG_LOCK_STAT=y
CONFIG_DEBUG_LOCKDEP=y
CONFIG_TRACE_IRQFLAGS=y
CONFIG_DEBUG_SPINLOCK_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_HIGHMEM=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DEBUG_LIST=y

Quoted 95 lines
[    2.244280] ------------[ cut here ]------------
[    2.245261] WARNING: at kernel/mutex.c:135 mutex_lock_nested+0x325/0x380()
[    2.245261] Hardware name: PowerEdge T105
[    2.245261] Modules linked in:
[    2.245261] Pid: 1, comm: swapper Not tainted 2.6.28 #37
[    2.245261] Call Trace:
[    2.245261]  [<ffffffff8104f15f>] warn_slowpath+0xaf/0x110
[    2.245261]  [<ffffffff8107986d>] ? __lock_acquire+0x58d/0x1b80
[    2.245261]  [<ffffffff8107986d>] ? __lock_acquire+0x58d/0x1b80
[    2.245261]  [<ffffffff81383f75>] mutex_lock_nested+0x325/0x380
[    2.245261]  [<ffffffff810418fe>] ? __wake_up+0x4e/0x70
[    2.245261]  [<ffffffff81385c4d>] ? _spin_unlock_irqrestore+0x6d/0x90
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff8125b7db>] tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff8125ba64>] transmit_cmd+0x14/0x50
[    2.245261]  [<ffffffff8125baef>] __tpm_pcr_read+0x4f/0x80
[    2.245261]  [<ffffffff810e9f07>] ? kfree+0xc7/0x140
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff811b342f>] ? kobject_uevent_env+0x11f/0x3f0
[    2.245261]  [<ffffffff810a3e85>] ? __rcu_read_lock+0xc5/0xf0
[    2.245261]  [<ffffffff810a3d8b>] ? __rcu_read_unlock+0xbb/0xf0
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff8125c6b5>] ? tpm_chip_find_get+0xd5/0xf0
[    2.245261]  [<ffffffff8125c7d2>] tpm_pcr_read+0x42/0x70
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff8118d8b7>] ima_init+0x27/0x160
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dd8>] init_ima+0xe/0x1a
[    2.245261]  [<ffffffff8100a03c>] do_one_initcall+0x3c/0x180
[    2.245261]  [<ffffffff810a2a3e>] ? register_irq_proc+0xbe/0xe0
[    2.245261]  [<ffffffff81140000>] ? v2_read_dquot+0x240/0x2a0
[    2.245261]  [<ffffffff815ce703>] kernel_init+0x14d/0x1a3
[    2.245261]  [<ffffffff813855a6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    2.245261]  [<ffffffff81015ada>] child_rip+0xa/0x20
[    2.245261]  [<ffffffff810153be>] ? restore_args+0x0/0x30
[    2.245261]  [<ffffffff815ce5b6>] ? kernel_init+0x0/0x1a3
[    2.245261]  [<ffffffff81015ad0>] ? child_rip+0x0/0x20
[    2.245261] ---[ end trace 9947c764f5d88c86 ]---
[    2.245261] BUG: unable to handle kernel paging request at ffffffff00060000
[    2.245261] IP: [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261] PGD 203067 PUD 0
[    2.245261] Oops: 0000 [#1] PREEMPT SMP
[    2.245261] last sysfs file:
[    2.245261] CPU 0
[    2.245261] Modules linked in:
[    2.245261] Pid: 1, comm: swapper Tainted: G        W  2.6.28 #37
[    2.245261] RIP: 0010:[<ffffffff811cac36>]  [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261] RSP: 0018:ffff88012fa7fb80  EFLAGS: 00010046
[    2.245261] RAX: ffffffff00060000 RBX: ffffffff81559ce8 RCX: 0000000000000000
[    2.245261] RDX: ffffffff81559ce8 RSI: ffffffff00060000 RDI: ffff88012fa7fbd0
[    2.245261] RBP: ffff88012fa7fba0 R08: 0000000000000002 R09: 0000000000000001
[    2.245261] R10: ffff8801afa7f95f R11: ffff88012fa7f8e0 R12: ffffffff00060000
[    2.245261] R13: ffff88012fa7fbd0 R14: ffff88012fa80000 R15: ffffffff8125b7db
[    2.245261] FS:  0000000000000000(0000) GS:ffffffff8159fe00(0000) knlGS:0000000000000000
[    2.245261] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[    2.245261] CR2: ffffffff00060000 CR3: 0000000000201000 CR4: 00000000000006e0
[    2.245261] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    2.245261] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    2.245261] Process swapper (pid: 1, threadinfo ffff88012fa7e000, task ffff88012fa80000)
[    2.245261] Stack:
[    2.245261]  0000000000000246 ffffffff81559cb0 0000000000000246 ffffffff81559cb8
[    2.245261]  ffff88012fa7fc30 ffffffff81383d49 ffffffff8125b7db ffffffff810418fe
[    2.245261]  0000000000000001 ffffffff81559ce8 ffff88012fa7fbd0 ffff88012fa7fbd0
[    2.245261] Call Trace:
[    2.245261]  [<ffffffff81383d49>] mutex_lock_nested+0xf9/0x380
[    2.245261]  [<ffffffff8125b7db>] ? tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff810418fe>] ? __wake_up+0x4e/0x70
[    2.245261]  [<ffffffff8125b7db>] tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff8125ba64>] transmit_cmd+0x14/0x50
[    2.245261]  [<ffffffff8125baef>] __tpm_pcr_read+0x4f/0x80
[    2.245261]  [<ffffffff810e9f07>] ? kfree+0xc7/0x140
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff811b342f>] ? kobject_uevent_env+0x11f/0x3f0
[    2.245261]  [<ffffffff810a3e85>] ? __rcu_read_lock+0xc5/0xf0
[    2.245261]  [<ffffffff810a3d8b>] ? __rcu_read_unlock+0xbb/0xf0
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff8125c6b5>] ? tpm_chip_find_get+0xd5/0xf0
[    2.245261]  [<ffffffff8125c7d2>] tpm_pcr_read+0x42/0x70
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff8118d8b7>] ima_init+0x27/0x160
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dd8>] init_ima+0xe/0x1a
[    2.245261]  [<ffffffff8100a03c>] do_one_initcall+0x3c/0x180
[    2.245261]  [<ffffffff810a2a3e>] ? register_irq_proc+0xbe/0xe0
[    2.245261]  [<ffffffff81140000>] ? v2_read_dquot+0x240/0x2a0
[    2.245261]  [<ffffffff815ce703>] kernel_init+0x14d/0x1a3
[    2.245261]  [<ffffffff813855a6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    2.245261]  [<ffffffff81015ada>] child_rip+0xa/0x20
[    2.245261]  [<ffffffff810153be>] ? restore_args+0x0/0x30
Quoted 9 lines
[    2.245261]  [<ffffffff815ce5b6>] ? kernel_init+0x0/0x1a3
[    2.245261]  [<ffffffff81015ad0>] ? child_rip+0x0/0x20
[    2.245261] Code: 98 0f 1f 40 00 55 48 89 e5 48 83 ec 20 48 89 5d e8 4c 89 65 f0 48 89 d3 4c 89 6d f8 48 8b 42 08 49 89 fd 49 89 f4 48 39 f0 75 27 <49> 8b 04 24 48 39 d8 75 43 4c 89 6b 08 49 89 5d 00 4d 89 65 08
[    2.245261] RIP  [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261]  RSP <ffff88012fa7fb80>
[    2.245261] CR2: ffffffff00060000
[    2.245261] ---[ end trace 9947c764f5d88c86 ]---
[    2.822672] Kernel panic - not syncing: Attempted to kill init!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
James Morris
<[email protected]>
author
#14 lore raw
Quoted 11 lines · James Morris
Quoted 7 lines · Mimi Zohar
Quoted 3 lines · James Morris

I get an oops on boot with this.

Do you have lock and list debugging enabled?

In the past I had them enabled. Just recompiled now with them enabled and was able to boot without problems.

Do you have CONFIG_PREEMPT_RCU and SMP ?

Without PREEMPT_RCU, with SMP. Recompiling...

Quoted 135 lines
Quoted 134 lines

CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_PROVE_LOCKING=y
CONFIG_LOCKDEP=y
CONFIG_LOCK_STAT=y
CONFIG_DEBUG_LOCKDEP=y
CONFIG_TRACE_IRQFLAGS=y
CONFIG_DEBUG_SPINLOCK_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_HIGHMEM=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DEBUG_LIST=y

Quoted 95 lines
[    2.244280] ------------[ cut here ]------------
[    2.245261] WARNING: at kernel/mutex.c:135 mutex_lock_nested+0x325/0x380()
[    2.245261] Hardware name: PowerEdge T105
[    2.245261] Modules linked in:
[    2.245261] Pid: 1, comm: swapper Not tainted 2.6.28 #37
[    2.245261] Call Trace:
[    2.245261]  [<ffffffff8104f15f>] warn_slowpath+0xaf/0x110
[    2.245261]  [<ffffffff8107986d>] ? __lock_acquire+0x58d/0x1b80
[    2.245261]  [<ffffffff8107986d>] ? __lock_acquire+0x58d/0x1b80
[    2.245261]  [<ffffffff81383f75>] mutex_lock_nested+0x325/0x380
[    2.245261]  [<ffffffff810418fe>] ? __wake_up+0x4e/0x70
[    2.245261]  [<ffffffff81385c4d>] ? _spin_unlock_irqrestore+0x6d/0x90
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff8125b7db>] tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff8125ba64>] transmit_cmd+0x14/0x50
[    2.245261]  [<ffffffff8125baef>] __tpm_pcr_read+0x4f/0x80
[    2.245261]  [<ffffffff810e9f07>] ? kfree+0xc7/0x140
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff811b342f>] ? kobject_uevent_env+0x11f/0x3f0
[    2.245261]  [<ffffffff810a3e85>] ? __rcu_read_lock+0xc5/0xf0
[    2.245261]  [<ffffffff810a3d8b>] ? __rcu_read_unlock+0xbb/0xf0
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff8125c6b5>] ? tpm_chip_find_get+0xd5/0xf0
[    2.245261]  [<ffffffff8125c7d2>] tpm_pcr_read+0x42/0x70
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff8118d8b7>] ima_init+0x27/0x160
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dd8>] init_ima+0xe/0x1a
[    2.245261]  [<ffffffff8100a03c>] do_one_initcall+0x3c/0x180
[    2.245261]  [<ffffffff810a2a3e>] ? register_irq_proc+0xbe/0xe0
[    2.245261]  [<ffffffff81140000>] ? v2_read_dquot+0x240/0x2a0
[    2.245261]  [<ffffffff815ce703>] kernel_init+0x14d/0x1a3
[    2.245261]  [<ffffffff813855a6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    2.245261]  [<ffffffff81015ada>] child_rip+0xa/0x20
[    2.245261]  [<ffffffff810153be>] ? restore_args+0x0/0x30
[    2.245261]  [<ffffffff815ce5b6>] ? kernel_init+0x0/0x1a3
[    2.245261]  [<ffffffff81015ad0>] ? child_rip+0x0/0x20
[    2.245261] ---[ end trace 9947c764f5d88c86 ]---
[    2.245261] BUG: unable to handle kernel paging request at ffffffff00060000
[    2.245261] IP: [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261] PGD 203067 PUD 0
[    2.245261] Oops: 0000 [#1] PREEMPT SMP
[    2.245261] last sysfs file:
[    2.245261] CPU 0
[    2.245261] Modules linked in:
[    2.245261] Pid: 1, comm: swapper Tainted: G        W  2.6.28 #37
[    2.245261] RIP: 0010:[<ffffffff811cac36>]  [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261] RSP: 0018:ffff88012fa7fb80  EFLAGS: 00010046
[    2.245261] RAX: ffffffff00060000 RBX: ffffffff81559ce8 RCX: 0000000000000000
[    2.245261] RDX: ffffffff81559ce8 RSI: ffffffff00060000 RDI: ffff88012fa7fbd0
[    2.245261] RBP: ffff88012fa7fba0 R08: 0000000000000002 R09: 0000000000000001
[    2.245261] R10: ffff8801afa7f95f R11: ffff88012fa7f8e0 R12: ffffffff00060000
[    2.245261] R13: ffff88012fa7fbd0 R14: ffff88012fa80000 R15: ffffffff8125b7db
[    2.245261] FS:  0000000000000000(0000) GS:ffffffff8159fe00(0000) knlGS:0000000000000000
[    2.245261] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[    2.245261] CR2: ffffffff00060000 CR3: 0000000000201000 CR4: 00000000000006e0
[    2.245261] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    2.245261] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    2.245261] Process swapper (pid: 1, threadinfo ffff88012fa7e000, task ffff88012fa80000)
[    2.245261] Stack:
[    2.245261]  0000000000000246 ffffffff81559cb0 0000000000000246 ffffffff81559cb8
[    2.245261]  ffff88012fa7fc30 ffffffff81383d49 ffffffff8125b7db ffffffff810418fe
[    2.245261]  0000000000000001 ffffffff81559ce8 ffff88012fa7fbd0 ffff88012fa7fbd0
[    2.245261] Call Trace:
[    2.245261]  [<ffffffff81383d49>] mutex_lock_nested+0xf9/0x380
[    2.245261]  [<ffffffff8125b7db>] ? tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff810418fe>] ? __wake_up+0x4e/0x70
[    2.245261]  [<ffffffff8125b7db>] tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff8125ba64>] transmit_cmd+0x14/0x50
[    2.245261]  [<ffffffff8125baef>] __tpm_pcr_read+0x4f/0x80
[    2.245261]  [<ffffffff810e9f07>] ? kfree+0xc7/0x140
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff811b342f>] ? kobject_uevent_env+0x11f/0x3f0
[    2.245261]  [<ffffffff810a3e85>] ? __rcu_read_lock+0xc5/0xf0
[    2.245261]  [<ffffffff810a3d8b>] ? __rcu_read_unlock+0xbb/0xf0
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff8125c6b5>] ? tpm_chip_find_get+0xd5/0xf0
[    2.245261]  [<ffffffff8125c7d2>] tpm_pcr_read+0x42/0x70
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff8118d8b7>] ima_init+0x27/0x160
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dd8>] init_ima+0xe/0x1a
[    2.245261]  [<ffffffff8100a03c>] do_one_initcall+0x3c/0x180
[    2.245261]  [<ffffffff810a2a3e>] ? register_irq_proc+0xbe/0xe0
[    2.245261]  [<ffffffff81140000>] ? v2_read_dquot+0x240/0x2a0
[    2.245261]  [<ffffffff815ce703>] kernel_init+0x14d/0x1a3
[    2.245261]  [<ffffffff813855a6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    2.245261]  [<ffffffff81015ada>] child_rip+0xa/0x20
[    2.245261]  [<ffffffff810153be>] ? restore_args+0x0/0x30
Quoted 9 lines
[    2.245261]  [<ffffffff815ce5b6>] ? kernel_init+0x0/0x1a3
[    2.245261]  [<ffffffff81015ad0>] ? child_rip+0x0/0x20
[    2.245261] Code: 98 0f 1f 40 00 55 48 89 e5 48 83 ec 20 48 89 5d e8 4c 89 65 f0 48 89 d3 4c 89 6d f8 48 8b 42 08 49 89 fd 49 89 f4 48 39 f0 75 27 <49> 8b 04 24 48 39 d8 75 43 4c 89 6b 08 49 89 5d 00 4d 89 65 08
[    2.245261] RIP  [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261]  RSP <ffff88012fa7fb80>
[    2.245261] CR2: ffffffff00060000
[    2.245261] ---[ end trace 9947c764f5d88c86 ]---
[    2.822672] Kernel panic - not syncing: Attempted to kill init!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author
#15 lore raw
In reply to James Morris
Quoted 11 lines · James Morris
Quoted 7 lines · Mimi Zohar
Quoted 3 lines · James Morris

I get an oops on boot with this.

Do you have lock and list debugging enabled?

In the past I had them enabled. Just recompiled now with them enabled and was able to boot without problems.

Do you have CONFIG_PREEMPT_RCU and SMP ?

I've recompiled with both CONFIG_PREEMPT_RCU and SMP and didn't get the oops. Is your TPM enabled?

Quoted 135 lines
Quoted 134 lines

CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_PROVE_LOCKING=y
CONFIG_LOCKDEP=y
CONFIG_LOCK_STAT=y
CONFIG_DEBUG_LOCKDEP=y
CONFIG_TRACE_IRQFLAGS=y
CONFIG_DEBUG_SPINLOCK_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_DEBUG_HIGHMEM=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_VIRTUAL is not set
# CONFIG_DEBUG_WRITECOUNT is not set
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DEBUG_LIST=y

Quoted 95 lines
[    2.244280] ------------[ cut here ]------------
[    2.245261] WARNING: at kernel/mutex.c:135 mutex_lock_nested+0x325/0x380()
[    2.245261] Hardware name: PowerEdge T105
[    2.245261] Modules linked in:
[    2.245261] Pid: 1, comm: swapper Not tainted 2.6.28 #37
[    2.245261] Call Trace:
[    2.245261]  [<ffffffff8104f15f>] warn_slowpath+0xaf/0x110
[    2.245261]  [<ffffffff8107986d>] ? __lock_acquire+0x58d/0x1b80
[    2.245261]  [<ffffffff8107986d>] ? __lock_acquire+0x58d/0x1b80
[    2.245261]  [<ffffffff81383f75>] mutex_lock_nested+0x325/0x380
[    2.245261]  [<ffffffff810418fe>] ? __wake_up+0x4e/0x70
[    2.245261]  [<ffffffff81385c4d>] ? _spin_unlock_irqrestore+0x6d/0x90
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff8125b7db>] tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff8125ba64>] transmit_cmd+0x14/0x50
[    2.245261]  [<ffffffff8125baef>] __tpm_pcr_read+0x4f/0x80
[    2.245261]  [<ffffffff810e9f07>] ? kfree+0xc7/0x140
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff811b342f>] ? kobject_uevent_env+0x11f/0x3f0
[    2.245261]  [<ffffffff810a3e85>] ? __rcu_read_lock+0xc5/0xf0
[    2.245261]  [<ffffffff810a3d8b>] ? __rcu_read_unlock+0xbb/0xf0
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff8125c6b5>] ? tpm_chip_find_get+0xd5/0xf0
[    2.245261]  [<ffffffff8125c7d2>] tpm_pcr_read+0x42/0x70
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff8118d8b7>] ima_init+0x27/0x160
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dd8>] init_ima+0xe/0x1a
[    2.245261]  [<ffffffff8100a03c>] do_one_initcall+0x3c/0x180
[    2.245261]  [<ffffffff810a2a3e>] ? register_irq_proc+0xbe/0xe0
[    2.245261]  [<ffffffff81140000>] ? v2_read_dquot+0x240/0x2a0
[    2.245261]  [<ffffffff815ce703>] kernel_init+0x14d/0x1a3
[    2.245261]  [<ffffffff813855a6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    2.245261]  [<ffffffff81015ada>] child_rip+0xa/0x20
[    2.245261]  [<ffffffff810153be>] ? restore_args+0x0/0x30
[    2.245261]  [<ffffffff815ce5b6>] ? kernel_init+0x0/0x1a3
[    2.245261]  [<ffffffff81015ad0>] ? child_rip+0x0/0x20
[    2.245261] ---[ end trace 9947c764f5d88c86 ]---
[    2.245261] BUG: unable to handle kernel paging request at ffffffff00060000
[    2.245261] IP: [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261] PGD 203067 PUD 0
[    2.245261] Oops: 0000 [#1] PREEMPT SMP
[    2.245261] last sysfs file:
[    2.245261] CPU 0
[    2.245261] Modules linked in:
[    2.245261] Pid: 1, comm: swapper Tainted: G        W  2.6.28 #37
[    2.245261] RIP: 0010:[<ffffffff811cac36>]  [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261] RSP: 0018:ffff88012fa7fb80  EFLAGS: 00010046
[    2.245261] RAX: ffffffff00060000 RBX: ffffffff81559ce8 RCX: 0000000000000000
[    2.245261] RDX: ffffffff81559ce8 RSI: ffffffff00060000 RDI: ffff88012fa7fbd0
[    2.245261] RBP: ffff88012fa7fba0 R08: 0000000000000002 R09: 0000000000000001
[    2.245261] R10: ffff8801afa7f95f R11: ffff88012fa7f8e0 R12: ffffffff00060000
[    2.245261] R13: ffff88012fa7fbd0 R14: ffff88012fa80000 R15: ffffffff8125b7db
[    2.245261] FS:  0000000000000000(0000) GS:ffffffff8159fe00(0000) knlGS:0000000000000000
[    2.245261] CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[    2.245261] CR2: ffffffff00060000 CR3: 0000000000201000 CR4: 00000000000006e0
[    2.245261] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    2.245261] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    2.245261] Process swapper (pid: 1, threadinfo ffff88012fa7e000, task ffff88012fa80000)
[    2.245261] Stack:
[    2.245261]  0000000000000246 ffffffff81559cb0 0000000000000246 ffffffff81559cb8
[    2.245261]  ffff88012fa7fc30 ffffffff81383d49 ffffffff8125b7db ffffffff810418fe
[    2.245261]  0000000000000001 ffffffff81559ce8 ffff88012fa7fbd0 ffff88012fa7fbd0
[    2.245261] Call Trace:
[    2.245261]  [<ffffffff81383d49>] mutex_lock_nested+0xf9/0x380
[    2.245261]  [<ffffffff8125b7db>] ? tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff810418fe>] ? __wake_up+0x4e/0x70
[    2.245261]  [<ffffffff8125b7db>] tpm_transmit+0x5b/0x270
[    2.245261]  [<ffffffff8125ba64>] transmit_cmd+0x14/0x50
[    2.245261]  [<ffffffff8125baef>] __tpm_pcr_read+0x4f/0x80
[    2.245261]  [<ffffffff810e9f07>] ? kfree+0xc7/0x140
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff811b342f>] ? kobject_uevent_env+0x11f/0x3f0
[    2.245261]  [<ffffffff810a3e85>] ? __rcu_read_lock+0xc5/0xf0
[    2.245261]  [<ffffffff810a3d8b>] ? __rcu_read_unlock+0xbb/0xf0
[    2.245261]  [<ffffffff81078752>] ? trace_hardirqs_on_caller+0x172/0x1d0
[    2.245261]  [<ffffffff810787bd>] ? trace_hardirqs_on+0xd/0x10
[    2.245261]  [<ffffffff8125c6b5>] ? tpm_chip_find_get+0xd5/0xf0
[    2.245261]  [<ffffffff8125c7d2>] tpm_pcr_read+0x42/0x70
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff8118d8b7>] ima_init+0x27/0x160
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dca>] ? init_ima+0x0/0x1a
[    2.245261]  [<ffffffff815f5dd8>] init_ima+0xe/0x1a
[    2.245261]  [<ffffffff8100a03c>] do_one_initcall+0x3c/0x180
[    2.245261]  [<ffffffff810a2a3e>] ? register_irq_proc+0xbe/0xe0
[    2.245261]  [<ffffffff81140000>] ? v2_read_dquot+0x240/0x2a0
[    2.245261]  [<ffffffff815ce703>] kernel_init+0x14d/0x1a3
[    2.245261]  [<ffffffff813855a6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    2.245261]  [<ffffffff81015ada>] child_rip+0xa/0x20
[    2.245261]  [<ffffffff810153be>] ? restore_args+0x0/0x30
Quoted 9 lines
[    2.245261]  [<ffffffff815ce5b6>] ? kernel_init+0x0/0x1a3
[    2.245261]  [<ffffffff81015ad0>] ? child_rip+0x0/0x20
[    2.245261] Code: 98 0f 1f 40 00 55 48 89 e5 48 83 ec 20 48 89 5d e8 4c 89 65 f0 48 89 d3 4c 89 6d f8 48 8b 42 08 49 89 fd 49 89 f4 48 39 f0 75 27 <49> 8b 04 24 48 39 d8 75 43 4c 89 6b 08 49 89 5d 00 4d 89 65 08
[    2.245261] RIP  [<ffffffff811cac36>] __list_add+0x26/0xa0
[    2.245261]  RSP <ffff88012fa7fb80>
[    2.245261] CR2: ffffffff00060000
[    2.245261] ---[ end trace 9947c764f5d88c86 ]---
[    2.822672] Kernel panic - not syncing: Attempted to kill init!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

maintainer
#16 lore raw
Quoted 8 lines · Mimi Zohar
Quoted 7 lines · James Morris
Quoted 5 lines · Mimi Zohar
Quoted 3 lines · James Morris

I get an oops on boot with this.

Do you have lock and list debugging enabled?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

In the past I had them enabled. Just recompiled now with them enabled and was able to boot without problems.

Do you have CONFIG_PREEMPT_RCU and SMP ?

I've recompiled with both CONFIG_PREEMPT_RCU and SMP and didn't get the oops. Is your TPM enabled?

It was disabled in bios, and the system boots ok with it enabled.

Signature · 2 lines
James Morris
<[email protected]>
#17 lore raw
Quoted 17 lines · James Morris
Quoted 14 lines · Mimi Zohar
Quoted 12 lines · James Morris
Quoted 9 lines · Mimi Zohar
Quoted 4 lines · James Morris

I get an oops on boot with this.

Do you have lock and list debugging enabled?

In the past I had them enabled. Just recompiled now with them enabled and was able to boot without problems.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Do you have CONFIG_PREEMPT_RCU and SMP ?

I've recompiled with both CONFIG_PREEMPT_RCU and SMP and didn't get the oops. Is your TPM enabled?

It was disabled in bios, and the system boots ok with it enabled.

Hi James, I've just submitted the fix.

Thanks,
Rajiv Andrade
IBM LTC Security Dev.

maintainer
#18 lore raw
In reply to Mimi Zohar
Quoted 14 lines · Mimi Zohar

This patchset contains the IMA integrity patches. The changes made since the last integrity posting are based on comments made by James Morris and Serge Hallyn.
- removed test for NULL return code from securityfs_create_file/dir
- alloc ima_template_entry before calling ima_store_template()
- log ima_add_boot_aggregate failure
- free invalid rule
- add hook to increment opencount for /dev/zero shm
- replaced hard coded string length with #define name
- removed unused IMA_TEMPLATE_NAME_LEN

This patchset is dependent on the tpm-integrity-interface patch, which has been applied to the security-testing-2.6/#next.

Quoted 8 lines

Mimi Zohar (7):
integrity: IMA hooks
integrity: IMA as an integrity service provider
integrity: IMA display
integrity: IMA policy
integrity: IMA policy open
Integrity: IMA file free imbalance
Integrity: IMA update maintainers

All applied to security-testing.

Signature · 1 line
James Morris <[email protected]>