Skip to contentSkip to conversation

segmentation fault in /tmp

DISCUSSION Ed Street 2 participants 2 messages Jul 21, 2002 – Jul 26, 2002 SELinux security module

lore
Share & tools
lore

Ed Street

author
#0 lore raw

Hello,

This is a base install woody 3.0 with a promise controller card (hardware mirror). I have /var and /tmp broken off into separate partitions, 10 gigs each. (40g barracuda drives)

When /tmp is umounted at any time it produces a Segmentation fault. (umount /tmp from either console or shutdown/poweroff/halt/reboot scripts) Under a non-selinux kernel this behavior is not displayed.

I have avc_enforcing set to permissive using the default policy. This is on a clean install after the lsm deb's and the kernel went on, also Make -C realabel was ran before reboot.

This is the message that I get, so far I have been unable to produce any core files from this.

Unable to handle kernel NULL pointer dereference at virtual address
00000098 printing eip:
*pde = 00000000
Oops: 0000
CPU: 0

EIP: 0010:[<c016017f>] Not tainted
EFLAGS: 00010212
Eax: cf5c0420 ebx: cefad970 ecx: ce71befc edx: 00000000
Esi: cebad970 edi: c0000000 ebp: ceb8a380 esp: ce71becc
Ds: 0018 es: 0018 ss: 0018
Process umount (pid: 249, stackpage=ce71b000)

Stack: 

ce71a000 c01ae769 cebad970 ce71defc 00000004 ce71bef4 cebadc00 ceb8a380 Cebadc00 c0439f20 0001fd10 00000000 00000000 c01b5584 ceb9a380 ce71a000 Ceb8a380 c014e882 ceb8a280 cf5c0420 ceb8a380 cebad800 cfff8da0 c014b79d

Call Trace: [<c01ae769>} {<c01b5584>] [<c014e882>] [<c014b79d>]

[<c01ad882>]
[<c01ae49d>] [<c01b4010>] [<c0150b82>] [<c0150cae>] [<c0127562>] [<c0150cd4>]

[<c0107023>]

Code: 8b 82 98 00 00 00 f6 40 2b 10 75 0f f6 82 0c 01 00 00 01 75
 Segmentation fault

Ed

--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 7 lines · Ed Street

This is a base install woody 3.0 with a promise controller card (hardware mirror). I have /var and /tmp broken off into separate partitions, 10 gigs each. (40g barracuda drives)

When /tmp is umounted at any time it produces a Segmentation fault. (umount /tmp from either console or shutdown/poweroff/halt/reboot scripts) Under a non-selinux kernel this behavior is not displayed.

<snip>

The attached patch (also committed to the sourceforge CVS) fixes several bugs in the PSID mapping code related to safely closing the PSID mapping files and freeing the in-memory data structures for an unmount. To apply, save this patch to ~/psid.patch, cd lsm-2.4, and patch -p1 < ~/psid.patch. Then, rebuild your kernel.

As a side note, Ed ran into this particular bug because his init scripts were removing everything from /tmp on every boot, including the persistent label mapping files since /tmp was a separate filesystem. Naturally, this would have been denied if the system was in enforcing mode. It is obviously not a good idea to remove these files.

--
Stephen D. Smalley, NAI Labs
[email protected]

Index: lsm-2.4/security/selinux/hooks.c
===================================================================
RCS file: /cvsroot/selinux/nsa/lsm-2.4/security/selinux/hooks.c,v retrieving revision 1.14

security/selinux/hooks.c +8 -9
diff -u -r1.14 hooks.c
@@ -372,7 +372,7 @@
 	if (!sbsec || sbsec->magic != SELINUX_MAGIC) 
 		return; 
 
-	if (sbsec->uses_psids && sbsec->psidtab)
+	if (sbsec->uses_psids)
 		psid_release(sb);
 
 	sb->s_security = NULL;
@@ -2160,7 +2160,7 @@
 
 	if (reinit_psids) {
 		sbsec = sb->s_security;
-		if (sbsec->uses_psids && sbsec->psidtab) {
+		if (sbsec->uses_psids) {
 			psid_release(sb);
 			rc = psid_init(sb);
 			if (rc < 0) {
@@ -2211,7 +2211,7 @@
 		return;
 	sbsec = sb->s_security;
 
-	if (sbsec->uses_psids && sbsec->psidtab) {
+	if (sbsec->uses_psids) {
 		psid_release(sb);
 		rc = psid_init(sb);
 		if (rc < 0) {
@@ -2392,14 +2392,13 @@
 {
 	struct super_block *sb = inode->i_sb; 
 	if (sb) {
-		struct superblock_security_struct *sbsec;
-		int rc;
+		struct superblock_security_struct *sbsec = sb->s_security;
 
-		rc = superblock_precondition(sb);
-		if (rc <= 0)
+		if (!sbsec || sbsec->magic != SELINUX_MAGIC || 
+		    !sbsec->initialized)
 			return;
-		sbsec = sb->s_security;
-		if (sbsec && sbsec->uses_psids)
+
+		if (sbsec->uses_psids)
 			clear_psid(inode);
 	}
 }

Index: lsm-2.4/security/selinux/psid.c
===================================================================
RCS file: /cvsroot/selinux/nsa/lsm-2.4/security/selinux/psid.c,v retrieving revision 1.2

security/selinux/psid.c +118 -33

361 lines not on this page · raw message