Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Nov 2007 06:41:42 GMT
From:      Zhouyi ZHOU <zhouzhouyi@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 129612 for review
Message-ID:  <200711270641.lAR6fg96003246@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=129612

Change 129612 by zhouzhouyi@zhouzhouyi_mactest on 2007/11/27 06:41:03

	close the other end of pipe before doing open

Affected files ...

.. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/pipe_io.c#4 edit
.. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/pipe/00.t#3 edit

Differences ...

==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/pipe_io.c#4 (text+ko) ====

@@ -191,6 +191,7 @@
 								
 				if (i == 0)
 					break;
+
 				if (i < 0) {
 					perror("read");
 					close(logfd);
@@ -204,7 +205,7 @@
 		break;
 	}
 
-	close(logfd);
+
 
 	{
 		mac_t		label;
@@ -232,7 +233,9 @@
 	for (i = 0; i < 2; i++)
 		write_frame(fd[1], buf, sizeof buf);
 
+	close(fd[1]);
 
+	close(logfd);
 
 
 	machookmatch(macconf_file, pid);

==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/pipe/00.t#3 (text+ko) ====

@@ -1,61 +1,65 @@
 #!/bin/sh
-# $FreeBSD: src/tools/regression/mactest/tests/pipe/00.t,v 1.2 2007/01/25 20:50:02 zhouzhouyi Exp $
+# $FreeBSD$
 
-desc="manipulate fifo files"
+desc="manipulate pipe"
 
 
 dir=`dirname $0`
 . ${dir}/../misc.sh
 
-echo "1..2"
+case "${os}:${fs}" in
+FreeBSD:UFS)
 
+	mac_mls_support=`sysctl -n security.mac.mls.enabled 2>/dev/null`
+	mac_biba_support=`sysctl -n security.mac.biba.enabled 2>/dev/null`
+	mac_test_support=`sysctl -n security.mac.test.pseudoinit 2>/dev/null`
 
+	if [ "${mac_mls_support}" != "" ] && [ "${mac_biba_support}" != "" ] &&
+	    [ "${mac_test_support}" != "" ]; then
+
 #turn off all the switches
-for i in `sysctl security.mac | grep "\.enabled"| 
-     sed 's/\([a-z\.]*\.enabled\)\(:\ \)\([01]\)/\1/`; do
-sysctl ${i}=0
-done
+		for i in `sysctl security.mac | grep "\.enabled"| 
+			sed 's/\([a-z\.]*\.enabled\)\(:\ \)\([01]\)/\1/`; do
+			sysctl ${i}=0 >/dev/null
+		done
 
-mac_mls_support=`sysctl -n security.mac.mls.enabled 2>/dev/null`
-mac_biba_support=`sysctl -n security.mac.biba.enabled 2>/dev/null`
+		echo "1..10"
 
-if [ "${mac_mls_support}" != "" ] && [ "${mac_biba_support}" != "" ] ; then
-    dvplabel=`getfmac ".."| sed 's/\(\.\.:\ \)\([a-z\,\/]*\)/\2/`; 
+       
+		dvplabel=`getfmac ".."| sed 's/\(\.\.:\ \)\([a-z\,\/]*\)/\2/`; 
 
+		if [ -f ${mactest_conf} ]; then
+			rm ${mactest_conf}
+		fi
+		touch ${mactest_conf}
 
-    if [ -f ${mactest_conf} ]; then
-	rm ${mactest_conf}
-    fi
-    touch ${mactest_conf}
+		sysctl security.mac.mls.enabled=1 >/dev/null
 
-#############################################################
-    t=`sysctl security.mac.mls.enabled=1`
-    echo "enforcing mac/mls!"
-    t=`sysctl security.mac.mls.revocation_enabled=1`
-    echo "enabling revoking"
 #case 1: ioctl, read, write low pipe with low process
-    bizarretestexpect ${pipe_io} "" "" -r "mls/low(low-high)" -w "mls/low(low-high)" -f ${mactest_conf} 
+		bizarretestexpect ${pipe_io} "" "" -r "mls/low(low-high)" -w "mls/low(low-high)" -f ${mactest_conf} 
 
 #case 2: non-trival processing of pipe
-    echo -n "pid = -2 mac_test_check_pipe_ioctl:" > ${mactest_conf}
-    echo "biba/high(low-high),mls/low(low-high) biba/high,mls/low" >> ${mactest_conf}
-    echo -n "pid = -2 mac_test_check_pipe_relabel:" >> ${mactest_conf} 
-    echo "biba/high(low-high),mls/low(low-high) biba/high,mls/low biba/,mls/6" >> ${mactest_conf}
-    echo -n "pid = -2 mac_test_relabel_pipe:" >> ${mactest_conf}
-    echo "biba/high(low-high),mls/low(low-high) biba/high,mls/6 biba/,mls/6" >> ${mactest_conf}
-    echo -n "pid = -2 mac_test_check_pipe_read:" >> ${mactest_conf} 
-    echo "biba/high(low-high),mls/9(low-high) biba/high,mls/6" >> ${mactest_conf}
-    echo -n "pid = -2 mac_test_check_pipe_poll:" >> ${mactest_conf} 
-    echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6" >> ${mactest_conf}
-    echo -n "pid = -2 mac_test_check_pipe_write:" >> ${mactest_conf}
-    echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6" >> ${mactest_conf}
-    bizarretestexpect ${pipe_io} "" "" -r "mls/9(low-high)" -w "mls/6(low-high)" -p "mls/6" -f ${mactest_conf} 
+		echo -n "pid = -2 pipe_check_ioctl:" > ${mactest_conf}
+		echo "biba/high(low-high),mls/low(low-high) biba/high,mls/low" >> ${mactest_conf}
+		echo -n "pid = -2 pipe_check_relabel:" >> ${mactest_conf} 
+		echo "biba/high(low-high),mls/low(low-high) biba/high,mls/low biba/,mls/6" >> ${mactest_conf}
+		echo -n "pid = -2 pipe_relabel:" >> ${mactest_conf}
+		echo "biba/high(low-high),mls/low(low-high) biba/high,mls/6 biba/,mls/6" >> ${mactest_conf}
+		echo -n "pid = -2 pipe_check_read:" >> ${mactest_conf} 
+		echo "biba/high(low-high),mls/9(low-high) biba/high,mls/6" >> ${mactest_conf}
+		echo -n "pid = -2 pipe_check_poll:" >> ${mactest_conf} 
+		echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6" >> ${mactest_conf}
+		echo -n "pid = -2 pipe_check_write:" >> ${mactest_conf}
+		echo "biba/high(low-high),mls/6(low-high) biba/high,mls/6" >> ${mactest_conf}
+		bizarretestexpect ${pipe_io} "" "" -r "mls/9(low-high)" -w "mls/6(low-high)" -p "mls/6" -f ${mactest_conf} 
 
 #cleanup:
-    t=`sysctl security.mac.mls.enabled=0`
-    echo "disabling mac/mls!"
-
-
-    rm ${mactest_conf}
-fi
+		sysctl security.mac.mls.enabled=0 >/dev/null
+		rm ${mactest_conf}
+	fi
+	;;
+*)
+        quick_exit
+        ;;
+esac
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711270641.lAR6fg96003246>