public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH ltp] fix detection of setcap for filecaps test
@ 2010-03-21  1:10 Serge E. Hallyn
  2010-03-22  6:46 ` Rishikesh K Rajak
  2010-03-23  8:53 ` Rishikesh K Rajak
  0 siblings, 2 replies; 5+ messages in thread
From: Serge E. Hallyn @ 2010-03-21  1:10 UTC (permalink / raw)
  To: LTP list

Remove the run-time checks and just have autoconf check for
libcap and setcap presence.

( applies on top of the patch I sent this morning )

After this, filecaps tests compile, install, and pass on f10 at least.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
---
 m4/ltp-cap.m4                                      |    1 +
 testcases/kernel/security/Makefile                 |    3 +
 .../kernel/security/filecaps/checkforfilecaps.sh   |   40 ------------
 .../kernel/security/filecaps/checkforlibcap.sh     |   66 --------------------
 testcases/kernel/security/filecaps/filecapstest.sh |   16 +-----
 5 files changed, 5 insertions(+), 121 deletions(-)
 delete mode 100755 testcases/kernel/security/filecaps/checkforfilecaps.sh
 delete mode 100755 testcases/kernel/security/filecaps/checkforlibcap.sh

diff --git a/m4/ltp-cap.m4 b/m4/ltp-cap.m4
index 28d998d..caa436f 100644
--- a/m4/ltp-cap.m4
+++ b/m4/ltp-cap.m4
@@ -28,6 +28,7 @@ AH_TEMPLATE(HAVE_LIBCAP,
 AC_CHECK_HEADERS(sys/capability.h,[
 	LTP_CAPABILITY_SUPPORT=yes
 	AC_CHECK_LIB(cap,cap_compare,[AC_DEFINE(HAVE_LIBCAP) CAP_LIBS="-lcap"], [CAP_LIBS=""])
+	AC_CHECK_PROG(HAVE_SETCAP,setcap,setcap,false)
 ])]
 AC_SUBST(CAP_LIBS)
 )
diff --git a/testcases/kernel/security/Makefile b/testcases/kernel/security/Makefile
index a23ce8f..52b8d06 100644
--- a/testcases/kernel/security/Makefile
+++ b/testcases/kernel/security/Makefile
@@ -29,6 +29,9 @@ include	$(top_srcdir)/include/mk/env_pre.mk
 ifeq ($(strip $(CAP_LIBS)),)
 FILTER_OUT_DIRS		:= cap_bound filecaps
 endif
+ifeq ($(HAVE_SETCAP),false)
+FILTER_OUT_DIRS		+= filecaps
+endif
 
 # XXX (garrcoop): avoid compilation failures on RHEL 5.4, as reported by
 # Mitani-san, because of policy versioning issues...
diff --git a/testcases/kernel/security/filecaps/checkforfilecaps.sh b/testcases/kernel/security/filecaps/checkforfilecaps.sh
deleted file mode 100755
index 757d409..0000000
--- a/testcases/kernel/security/filecaps/checkforfilecaps.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2008                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    ##
-##                                                                            ##
-################################################################################
-
-if ! check_simple_capset; then
-	echo Posix capabilities not compiled into the kernel.  Please
-	echo modprobe capability or recompile your kernel with
-	echo CONFIG_SECURITY_CAPABILITIES=y.
-	exit 1
-fi
-
-touch testme
-setcap cap_sys_admin=ip testme
-ret=$?
-rm -f testme
-if [ $ret -ne 0 ]; then
-	echo File capabilities not compiled into kernel.  Please
-	echo make sure your kernel is compiled with
-	echo CONFIG_SECURITY_FILE_CAPABILITIES=y.
-	exit 1
-fi
-
-exit 0
diff --git a/testcases/kernel/security/filecaps/checkforlibcap.sh b/testcases/kernel/security/filecaps/checkforlibcap.sh
deleted file mode 100755
index cc7642e..0000000
--- a/testcases/kernel/security/filecaps/checkforlibcap.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2008                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    ##
-##                                                                            ##
-################################################################################
-
-if [ "x$CC" = "x" ]; then
-	export CC=gcc
-fi
-yesno=0
-if [ "$1" = "yesno" ]; then
-	yesno=1
-fi
-
-SETCAP=`which setcap`
-if [ -z "${SETCAP}" ]; then
-    ret=1
-else
-    ret=0
-fi
-
-if [ $ret -eq 0 ]; then
-	#also test for -lcap
-	$CC -o check_simple_capset check_simple_capset.c -lcap \
-         2>/dev/null
-
-	ret=$?
-fi
-
-if [ $ret -eq 0 ]; then
-       #also test for xattr
-       $CC -o check_xattr check_xattr.c
-       ret=$?
-       if [ $ret -ne 0 ]; then
-               echo "Please install xattr headers"
-       fi
-fi
-
-if [ $ret -ne 0 ]; then
-	if [ $yesno -eq 1 ]; then
-		echo no
-	else
-		exit 1
-	fi
-else
-	if [ $yesno -eq 1 ]; then
-		echo yes
-	else
-		exit 0
-	fi
-fi
diff --git a/testcases/kernel/security/filecaps/filecapstest.sh b/testcases/kernel/security/filecaps/filecapstest.sh
index 149cbc1..9025b58 100755
--- a/testcases/kernel/security/filecaps/filecapstest.sh
+++ b/testcases/kernel/security/filecaps/filecapstest.sh
@@ -19,22 +19,8 @@
 ##                                                                            ##
 ################################################################################
 
-checkforlibcap.sh
-ret=$?
-if [ $ret -ne 0 ]; then
-	echo "Filecaps 0 CONF : System doesn't support execution of the test"
-	echo setcap not installed.  Please install libcap-2.11 or newer from
-	echo ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs/libcap2
-	exit 0
-fi
-checkforfilecaps.sh
-ret=$?
-if [ $ret -ne 0 ]; then
-	echo "Filecaps 0 CONF : File capabilities not available"
-	exit 0
-fi
-
 echo "Running in:"
+rm -f print_caps
 cp $LTPROOT/testcases/bin/print_caps .
 mkfifo caps_fifo
 chmod 777 caps_fifo
-- 
1.6.0.6


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH ltp] fix detection of setcap for filecaps test
  2010-03-21  1:10 [LTP] [PATCH ltp] fix detection of setcap for filecaps test Serge E. Hallyn
@ 2010-03-22  6:46 ` Rishikesh K Rajak
  2010-03-23  8:53 ` Rishikesh K Rajak
  1 sibling, 0 replies; 5+ messages in thread
From: Rishikesh K Rajak @ 2010-03-22  6:46 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: LTP list

On Sat, Mar 20, 2010 at 08:10:04PM -0500, Serge E. Hallyn wrote:
> Remove the run-time checks and just have autoconf check for
> libcap and setcap presence.
> 
> ( applies on top of the patch I sent this morning )
> 
> After this, filecaps tests compile, install, and pass on f10 at least.
> 
> Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>

Applied to next. Will merge soon to master once i/someone get a chance to test 
on multiple boxes.

-Thanks
Rishi

> ---
>  m4/ltp-cap.m4                                      |    1 +
>  testcases/kernel/security/Makefile                 |    3 +
>  .../kernel/security/filecaps/checkforfilecaps.sh   |   40 ------------
>  .../kernel/security/filecaps/checkforlibcap.sh     |   66 --------------------
>  testcases/kernel/security/filecaps/filecapstest.sh |   16 +-----
>  5 files changed, 5 insertions(+), 121 deletions(-)
>  delete mode 100755 testcases/kernel/security/filecaps/checkforfilecaps.sh
>  delete mode 100755 testcases/kernel/security/filecaps/checkforlibcap.sh
> 
> diff --git a/m4/ltp-cap.m4 b/m4/ltp-cap.m4
> index 28d998d..caa436f 100644
> --- a/m4/ltp-cap.m4
> +++ b/m4/ltp-cap.m4
> @@ -28,6 +28,7 @@ AH_TEMPLATE(HAVE_LIBCAP,
>  AC_CHECK_HEADERS(sys/capability.h,[
>  	LTP_CAPABILITY_SUPPORT=yes
>  	AC_CHECK_LIB(cap,cap_compare,[AC_DEFINE(HAVE_LIBCAP) CAP_LIBS="-lcap"], [CAP_LIBS=""])
> +	AC_CHECK_PROG(HAVE_SETCAP,setcap,setcap,false)
>  ])]
>  AC_SUBST(CAP_LIBS)
>  )
> diff --git a/testcases/kernel/security/Makefile b/testcases/kernel/security/Makefile
> index a23ce8f..52b8d06 100644
> --- a/testcases/kernel/security/Makefile
> +++ b/testcases/kernel/security/Makefile
> @@ -29,6 +29,9 @@ include	$(top_srcdir)/include/mk/env_pre.mk
>  ifeq ($(strip $(CAP_LIBS)),)
>  FILTER_OUT_DIRS		:= cap_bound filecaps
>  endif
> +ifeq ($(HAVE_SETCAP),false)
> +FILTER_OUT_DIRS		+= filecaps
> +endif
> 
>  # XXX (garrcoop): avoid compilation failures on RHEL 5.4, as reported by
>  # Mitani-san, because of policy versioning issues...
> diff --git a/testcases/kernel/security/filecaps/checkforfilecaps.sh b/testcases/kernel/security/filecaps/checkforfilecaps.sh
> deleted file mode 100755
> index 757d409..0000000
> --- a/testcases/kernel/security/filecaps/checkforfilecaps.sh
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -#!/bin/sh
> -################################################################################
> -##                                                                            ##
> -## Copyright (c) International Business Machines  Corp., 2008                 ##
> -##                                                                            ##
> -## This program is free software;  you can redistribute it and#or modify      ##
> -## it under the terms of the GNU General Public License as published by       ##
> -## the Free Software Foundation; either version 2 of the License, or          ##
> -## (at your option) any later version.                                        ##
> -##                                                                            ##
> -## This program is distributed in the hope that it will be useful, but        ##
> -## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
> -## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
> -## for more details.                                                          ##
> -##                                                                            ##
> -## You should have received a copy of the GNU General Public License          ##
> -## along with this program;  if not, write to the Free Software               ##
> -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    ##
> -##                                                                            ##
> -################################################################################
> -
> -if ! check_simple_capset; then
> -	echo Posix capabilities not compiled into the kernel.  Please
> -	echo modprobe capability or recompile your kernel with
> -	echo CONFIG_SECURITY_CAPABILITIES=y.
> -	exit 1
> -fi
> -
> -touch testme
> -setcap cap_sys_admin=ip testme
> -ret=$?
> -rm -f testme
> -if [ $ret -ne 0 ]; then
> -	echo File capabilities not compiled into kernel.  Please
> -	echo make sure your kernel is compiled with
> -	echo CONFIG_SECURITY_FILE_CAPABILITIES=y.
> -	exit 1
> -fi
> -
> -exit 0
> diff --git a/testcases/kernel/security/filecaps/checkforlibcap.sh b/testcases/kernel/security/filecaps/checkforlibcap.sh
> deleted file mode 100755
> index cc7642e..0000000
> --- a/testcases/kernel/security/filecaps/checkforlibcap.sh
> +++ /dev/null
> @@ -1,66 +0,0 @@
> -#!/bin/sh
> -################################################################################
> -##                                                                            ##
> -## Copyright (c) International Business Machines  Corp., 2008                 ##
> -##                                                                            ##
> -## This program is free software;  you can redistribute it and#or modify      ##
> -## it under the terms of the GNU General Public License as published by       ##
> -## the Free Software Foundation; either version 2 of the License, or          ##
> -## (at your option) any later version.                                        ##
> -##                                                                            ##
> -## This program is distributed in the hope that it will be useful, but        ##
> -## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
> -## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
> -## for more details.                                                          ##
> -##                                                                            ##
> -## You should have received a copy of the GNU General Public License          ##
> -## along with this program;  if not, write to the Free Software               ##
> -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    ##
> -##                                                                            ##
> -################################################################################
> -
> -if [ "x$CC" = "x" ]; then
> -	export CC=gcc
> -fi
> -yesno=0
> -if [ "$1" = "yesno" ]; then
> -	yesno=1
> -fi
> -
> -SETCAP=`which setcap`
> -if [ -z "${SETCAP}" ]; then
> -    ret=1
> -else
> -    ret=0
> -fi
> -
> -if [ $ret -eq 0 ]; then
> -	#also test for -lcap
> -	$CC -o check_simple_capset check_simple_capset.c -lcap \
> -         2>/dev/null
> -
> -	ret=$?
> -fi
> -
> -if [ $ret -eq 0 ]; then
> -       #also test for xattr
> -       $CC -o check_xattr check_xattr.c
> -       ret=$?
> -       if [ $ret -ne 0 ]; then
> -               echo "Please install xattr headers"
> -       fi
> -fi
> -
> -if [ $ret -ne 0 ]; then
> -	if [ $yesno -eq 1 ]; then
> -		echo no
> -	else
> -		exit 1
> -	fi
> -else
> -	if [ $yesno -eq 1 ]; then
> -		echo yes
> -	else
> -		exit 0
> -	fi
> -fi
> diff --git a/testcases/kernel/security/filecaps/filecapstest.sh b/testcases/kernel/security/filecaps/filecapstest.sh
> index 149cbc1..9025b58 100755
> --- a/testcases/kernel/security/filecaps/filecapstest.sh
> +++ b/testcases/kernel/security/filecaps/filecapstest.sh
> @@ -19,22 +19,8 @@
>  ##                                                                            ##
>  ################################################################################
> 
> -checkforlibcap.sh
> -ret=$?
> -if [ $ret -ne 0 ]; then
> -	echo "Filecaps 0 CONF : System doesn't support execution of the test"
> -	echo setcap not installed.  Please install libcap-2.11 or newer from
> -	echo ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs/libcap2
> -	exit 0
> -fi
> -checkforfilecaps.sh
> -ret=$?
> -if [ $ret -ne 0 ]; then
> -	echo "Filecaps 0 CONF : File capabilities not available"
> -	exit 0
> -fi
> -
>  echo "Running in:"
> +rm -f print_caps
>  cp $LTPROOT/testcases/bin/print_caps .
>  mkfifo caps_fifo
>  chmod 777 caps_fifo
> -- 
> 1.6.0.6
> 
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list

-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH ltp] fix detection of setcap for filecaps test
  2010-03-21  1:10 [LTP] [PATCH ltp] fix detection of setcap for filecaps test Serge E. Hallyn
  2010-03-22  6:46 ` Rishikesh K Rajak
@ 2010-03-23  8:53 ` Rishikesh K Rajak
  2010-03-23 13:25   ` Serge E. Hallyn
  1 sibling, 1 reply; 5+ messages in thread
From: Rishikesh K Rajak @ 2010-03-23  8:53 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: LTP list

Hi Serge,

Today we(me & iranna) got a chance to test your patch. Patch worked fine.

while running i tried fixing few unwanted messages. You can Ack if it is correct fix.

===== error log =====
Running in:
cp: cannot stat `/opt/ltp/testcases/bin/print_caps': No such file or directory
mkfifo: cannot create fifo `caps_fifo': File exists
cap_sys_admin tests
==== error log ======

Signed-off by : Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
---
diff --git a/testcases/kernel/security/filecaps/filecapstest.sh
b/testcases/kernel/security/filecaps/filecapstest.sh
index 9025b58..9646e8c 100755
--- a/testcases/kernel/security/filecaps/filecapstest.sh
+++ b/testcases/kernel/security/filecaps/filecapstest.sh
@@ -20,8 +20,8 @@
 ################################################################################
 
 echo "Running in:"
-rm -f print_caps
-cp $LTPROOT/testcases/bin/print_caps .
+#rm -f print_caps
+#cp $LTPROOT/testcases/bin/print_caps .
 mkfifo caps_fifo
 chmod 777 caps_fifo
 exit_code=0
@@ -45,5 +45,5 @@ tmp=$?
 if [ $tmp -ne 0 ]; then
        exit_code=$tmp
 fi

+unlink caps_fifo
 exit $exit_code

-Rishi

On Sat, Mar 20, 2010 at 08:10:04PM -0500, Serge E. Hallyn wrote:
> Remove the run-time checks and just have autoconf check for
> libcap and setcap presence.
> 
> ( applies on top of the patch I sent this morning )
> 
> After this, filecaps tests compile, install, and pass on f10 at least.
> 
> Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
> ---
>  m4/ltp-cap.m4                                      |    1 +
>  testcases/kernel/security/Makefile                 |    3 +
>  .../kernel/security/filecaps/checkforfilecaps.sh   |   40 ------------
>  .../kernel/security/filecaps/checkforlibcap.sh     |   66 --------------------
>  testcases/kernel/security/filecaps/filecapstest.sh |   16 +-----
>  5 files changed, 5 insertions(+), 121 deletions(-)
>  delete mode 100755 testcases/kernel/security/filecaps/checkforfilecaps.sh
>  delete mode 100755 testcases/kernel/security/filecaps/checkforlibcap.sh
> 
> diff --git a/m4/ltp-cap.m4 b/m4/ltp-cap.m4
> index 28d998d..caa436f 100644
> --- a/m4/ltp-cap.m4
> +++ b/m4/ltp-cap.m4
> @@ -28,6 +28,7 @@ AH_TEMPLATE(HAVE_LIBCAP,
>  AC_CHECK_HEADERS(sys/capability.h,[
>  	LTP_CAPABILITY_SUPPORT=yes
>  	AC_CHECK_LIB(cap,cap_compare,[AC_DEFINE(HAVE_LIBCAP) CAP_LIBS="-lcap"], [CAP_LIBS=""])
> +	AC_CHECK_PROG(HAVE_SETCAP,setcap,setcap,false)
>  ])]
>  AC_SUBST(CAP_LIBS)
>  )
> diff --git a/testcases/kernel/security/Makefile b/testcases/kernel/security/Makefile
> index a23ce8f..52b8d06 100644
> --- a/testcases/kernel/security/Makefile
> +++ b/testcases/kernel/security/Makefile
> @@ -29,6 +29,9 @@ include	$(top_srcdir)/include/mk/env_pre.mk
>  ifeq ($(strip $(CAP_LIBS)),)
>  FILTER_OUT_DIRS		:= cap_bound filecaps
>  endif
> +ifeq ($(HAVE_SETCAP),false)
> +FILTER_OUT_DIRS		+= filecaps
> +endif
> 
>  # XXX (garrcoop): avoid compilation failures on RHEL 5.4, as reported by
>  # Mitani-san, because of policy versioning issues...
> diff --git a/testcases/kernel/security/filecaps/checkforfilecaps.sh b/testcases/kernel/security/filecaps/checkforfilecaps.sh
> deleted file mode 100755
> index 757d409..0000000
> --- a/testcases/kernel/security/filecaps/checkforfilecaps.sh
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -#!/bin/sh
> -################################################################################
> -##                                                                            ##
> -## Copyright (c) International Business Machines  Corp., 2008                 ##
> -##                                                                            ##
> -## This program is free software;  you can redistribute it and#or modify      ##
> -## it under the terms of the GNU General Public License as published by       ##
> -## the Free Software Foundation; either version 2 of the License, or          ##
> -## (at your option) any later version.                                        ##
> -##                                                                            ##
> -## This program is distributed in the hope that it will be useful, but        ##
> -## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
> -## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
> -## for more details.                                                          ##
> -##                                                                            ##
> -## You should have received a copy of the GNU General Public License          ##
> -## along with this program;  if not, write to the Free Software               ##
> -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    ##
> -##                                                                            ##
> -################################################################################
> -
> -if ! check_simple_capset; then
> -	echo Posix capabilities not compiled into the kernel.  Please
> -	echo modprobe capability or recompile your kernel with
> -	echo CONFIG_SECURITY_CAPABILITIES=y.
> -	exit 1
> -fi
> -
> -touch testme
> -setcap cap_sys_admin=ip testme
> -ret=$?
> -rm -f testme
> -if [ $ret -ne 0 ]; then
> -	echo File capabilities not compiled into kernel.  Please
> -	echo make sure your kernel is compiled with
> -	echo CONFIG_SECURITY_FILE_CAPABILITIES=y.
> -	exit 1
> -fi
> -
> -exit 0
> diff --git a/testcases/kernel/security/filecaps/checkforlibcap.sh b/testcases/kernel/security/filecaps/checkforlibcap.sh
> deleted file mode 100755
> index cc7642e..0000000
> --- a/testcases/kernel/security/filecaps/checkforlibcap.sh
> +++ /dev/null
> @@ -1,66 +0,0 @@
> -#!/bin/sh
> -################################################################################
> -##                                                                            ##
> -## Copyright (c) International Business Machines  Corp., 2008                 ##
> -##                                                                            ##
> -## This program is free software;  you can redistribute it and#or modify      ##
> -## it under the terms of the GNU General Public License as published by       ##
> -## the Free Software Foundation; either version 2 of the License, or          ##
> -## (at your option) any later version.                                        ##
> -##                                                                            ##
> -## This program is distributed in the hope that it will be useful, but        ##
> -## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
> -## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
> -## for more details.                                                          ##
> -##                                                                            ##
> -## You should have received a copy of the GNU General Public License          ##
> -## along with this program;  if not, write to the Free Software               ##
> -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    ##
> -##                                                                            ##
> -################################################################################
> -
> -if [ "x$CC" = "x" ]; then
> -	export CC=gcc
> -fi
> -yesno=0
> -if [ "$1" = "yesno" ]; then
> -	yesno=1
> -fi
> -
> -SETCAP=`which setcap`
> -if [ -z "${SETCAP}" ]; then
> -    ret=1
> -else
> -    ret=0
> -fi
> -
> -if [ $ret -eq 0 ]; then
> -	#also test for -lcap
> -	$CC -o check_simple_capset check_simple_capset.c -lcap \
> -         2>/dev/null
> -
> -	ret=$?
> -fi
> -
> -if [ $ret -eq 0 ]; then
> -       #also test for xattr
> -       $CC -o check_xattr check_xattr.c
> -       ret=$?
> -       if [ $ret -ne 0 ]; then
> -               echo "Please install xattr headers"
> -       fi
> -fi
> -
> -if [ $ret -ne 0 ]; then
> -	if [ $yesno -eq 1 ]; then
> -		echo no
> -	else
> -		exit 1
> -	fi
> -else
> -	if [ $yesno -eq 1 ]; then
> -		echo yes
> -	else
> -		exit 0
> -	fi
> -fi
> diff --git a/testcases/kernel/security/filecaps/filecapstest.sh b/testcases/kernel/security/filecaps/filecapstest.sh
> index 149cbc1..9025b58 100755
> --- a/testcases/kernel/security/filecaps/filecapstest.sh
> +++ b/testcases/kernel/security/filecaps/filecapstest.sh
> @@ -19,22 +19,8 @@
>  ##                                                                            ##
>  ################################################################################
> 
> -checkforlibcap.sh
> -ret=$?
> -if [ $ret -ne 0 ]; then
> -	echo "Filecaps 0 CONF : System doesn't support execution of the test"
> -	echo setcap not installed.  Please install libcap-2.11 or newer from
> -	echo ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs/libcap2
> -	exit 0
> -fi
> -checkforfilecaps.sh
> -ret=$?
> -if [ $ret -ne 0 ]; then
> -	echo "Filecaps 0 CONF : File capabilities not available"
> -	exit 0
> -fi
> -
>  echo "Running in:"
> +rm -f print_caps
>  cp $LTPROOT/testcases/bin/print_caps .
>  mkfifo caps_fifo
>  chmod 777 caps_fifo
> -- 
> 1.6.0.6
> 
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list

-- 
Thanks & Regards
Rishi
LTP Maintainer
IBM, LTC, Bangalore
Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH ltp] fix detection of setcap for filecaps test
  2010-03-23  8:53 ` Rishikesh K Rajak
@ 2010-03-23 13:25   ` Serge E. Hallyn
  2010-03-23 16:36     ` Garrett Cooper
  0 siblings, 1 reply; 5+ messages in thread
From: Serge E. Hallyn @ 2010-03-23 13:25 UTC (permalink / raw)
  To: LTP list

Quoting Rishikesh K Rajak (risrajak@linux.vnet.ibm.com):
> Hi Serge,
> 
> Today we(me & iranna) got a chance to test your patch. Patch worked fine.
> 
> while running i tried fixing few unwanted messages. You can Ack if it is correct fix.
> 
> ===== error log =====
> Running in:
> cp: cannot stat `/opt/ltp/testcases/bin/print_caps': No such file or directory
> mkfifo: cannot create fifo `caps_fifo': File exists
> cap_sys_admin tests
> ==== error log ======
> 
> Signed-off by : Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>

I think these should be fine.

Acked-by: Serge Hallyn <serue@us.ibm.com>

> ---
> diff --git a/testcases/kernel/security/filecaps/filecapstest.sh
> b/testcases/kernel/security/filecaps/filecapstest.sh
> index 9025b58..9646e8c 100755
> --- a/testcases/kernel/security/filecaps/filecapstest.sh
> +++ b/testcases/kernel/security/filecaps/filecapstest.sh
> @@ -20,8 +20,8 @@
>  ################################################################################
> 
>  echo "Running in:"
> -rm -f print_caps
> -cp $LTPROOT/testcases/bin/print_caps .
> +#rm -f print_caps
> +#cp $LTPROOT/testcases/bin/print_caps .
>  mkfifo caps_fifo
>  chmod 777 caps_fifo
>  exit_code=0
> @@ -45,5 +45,5 @@ tmp=$?
>  if [ $tmp -ne 0 ]; then
>         exit_code=$tmp
>  fi
> 
> +unlink caps_fifo
>  exit $exit_code
> 
> -Rishi
> 
> On Sat, Mar 20, 2010 at 08:10:04PM -0500, Serge E. Hallyn wrote:
> > Remove the run-time checks and just have autoconf check for
> > libcap and setcap presence.
> > 
> > ( applies on top of the patch I sent this morning )
> > 
> > After this, filecaps tests compile, install, and pass on f10 at least.
> > 
> > Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
> > ---
> >  m4/ltp-cap.m4                                      |    1 +
> >  testcases/kernel/security/Makefile                 |    3 +
> >  .../kernel/security/filecaps/checkforfilecaps.sh   |   40 ------------
> >  .../kernel/security/filecaps/checkforlibcap.sh     |   66 --------------------
> >  testcases/kernel/security/filecaps/filecapstest.sh |   16 +-----
> >  5 files changed, 5 insertions(+), 121 deletions(-)
> >  delete mode 100755 testcases/kernel/security/filecaps/checkforfilecaps.sh
> >  delete mode 100755 testcases/kernel/security/filecaps/checkforlibcap.sh
> > 
> > diff --git a/m4/ltp-cap.m4 b/m4/ltp-cap.m4
> > index 28d998d..caa436f 100644
> > --- a/m4/ltp-cap.m4
> > +++ b/m4/ltp-cap.m4
> > @@ -28,6 +28,7 @@ AH_TEMPLATE(HAVE_LIBCAP,
> >  AC_CHECK_HEADERS(sys/capability.h,[
> >  	LTP_CAPABILITY_SUPPORT=yes
> >  	AC_CHECK_LIB(cap,cap_compare,[AC_DEFINE(HAVE_LIBCAP) CAP_LIBS="-lcap"], [CAP_LIBS=""])
> > +	AC_CHECK_PROG(HAVE_SETCAP,setcap,setcap,false)
> >  ])]
> >  AC_SUBST(CAP_LIBS)
> >  )
> > diff --git a/testcases/kernel/security/Makefile b/testcases/kernel/security/Makefile
> > index a23ce8f..52b8d06 100644
> > --- a/testcases/kernel/security/Makefile
> > +++ b/testcases/kernel/security/Makefile
> > @@ -29,6 +29,9 @@ include	$(top_srcdir)/include/mk/env_pre.mk
> >  ifeq ($(strip $(CAP_LIBS)),)
> >  FILTER_OUT_DIRS		:= cap_bound filecaps
> >  endif
> > +ifeq ($(HAVE_SETCAP),false)
> > +FILTER_OUT_DIRS		+= filecaps
> > +endif
> > 
> >  # XXX (garrcoop): avoid compilation failures on RHEL 5.4, as reported by
> >  # Mitani-san, because of policy versioning issues...
> > diff --git a/testcases/kernel/security/filecaps/checkforfilecaps.sh b/testcases/kernel/security/filecaps/checkforfilecaps.sh
> > deleted file mode 100755
> > index 757d409..0000000
> > --- a/testcases/kernel/security/filecaps/checkforfilecaps.sh
> > +++ /dev/null
> > @@ -1,40 +0,0 @@
> > -#!/bin/sh
> > -################################################################################
> > -##                                                                            ##
> > -## Copyright (c) International Business Machines  Corp., 2008                 ##
> > -##                                                                            ##
> > -## This program is free software;  you can redistribute it and#or modify      ##
> > -## it under the terms of the GNU General Public License as published by       ##
> > -## the Free Software Foundation; either version 2 of the License, or          ##
> > -## (at your option) any later version.                                        ##
> > -##                                                                            ##
> > -## This program is distributed in the hope that it will be useful, but        ##
> > -## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
> > -## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
> > -## for more details.                                                          ##
> > -##                                                                            ##
> > -## You should have received a copy of the GNU General Public License          ##
> > -## along with this program;  if not, write to the Free Software               ##
> > -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    ##
> > -##                                                                            ##
> > -################################################################################
> > -
> > -if ! check_simple_capset; then
> > -	echo Posix capabilities not compiled into the kernel.  Please
> > -	echo modprobe capability or recompile your kernel with
> > -	echo CONFIG_SECURITY_CAPABILITIES=y.
> > -	exit 1
> > -fi
> > -
> > -touch testme
> > -setcap cap_sys_admin=ip testme
> > -ret=$?
> > -rm -f testme
> > -if [ $ret -ne 0 ]; then
> > -	echo File capabilities not compiled into kernel.  Please
> > -	echo make sure your kernel is compiled with
> > -	echo CONFIG_SECURITY_FILE_CAPABILITIES=y.
> > -	exit 1
> > -fi
> > -
> > -exit 0
> > diff --git a/testcases/kernel/security/filecaps/checkforlibcap.sh b/testcases/kernel/security/filecaps/checkforlibcap.sh
> > deleted file mode 100755
> > index cc7642e..0000000
> > --- a/testcases/kernel/security/filecaps/checkforlibcap.sh
> > +++ /dev/null
> > @@ -1,66 +0,0 @@
> > -#!/bin/sh
> > -################################################################################
> > -##                                                                            ##
> > -## Copyright (c) International Business Machines  Corp., 2008                 ##
> > -##                                                                            ##
> > -## This program is free software;  you can redistribute it and#or modify      ##
> > -## it under the terms of the GNU General Public License as published by       ##
> > -## the Free Software Foundation; either version 2 of the License, or          ##
> > -## (at your option) any later version.                                        ##
> > -##                                                                            ##
> > -## This program is distributed in the hope that it will be useful, but        ##
> > -## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
> > -## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
> > -## for more details.                                                          ##
> > -##                                                                            ##
> > -## You should have received a copy of the GNU General Public License          ##
> > -## along with this program;  if not, write to the Free Software               ##
> > -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    ##
> > -##                                                                            ##
> > -################################################################################
> > -
> > -if [ "x$CC" = "x" ]; then
> > -	export CC=gcc
> > -fi
> > -yesno=0
> > -if [ "$1" = "yesno" ]; then
> > -	yesno=1
> > -fi
> > -
> > -SETCAP=`which setcap`
> > -if [ -z "${SETCAP}" ]; then
> > -    ret=1
> > -else
> > -    ret=0
> > -fi
> > -
> > -if [ $ret -eq 0 ]; then
> > -	#also test for -lcap
> > -	$CC -o check_simple_capset check_simple_capset.c -lcap \
> > -         2>/dev/null
> > -
> > -	ret=$?
> > -fi
> > -
> > -if [ $ret -eq 0 ]; then
> > -       #also test for xattr
> > -       $CC -o check_xattr check_xattr.c
> > -       ret=$?
> > -       if [ $ret -ne 0 ]; then
> > -               echo "Please install xattr headers"
> > -       fi
> > -fi
> > -
> > -if [ $ret -ne 0 ]; then
> > -	if [ $yesno -eq 1 ]; then
> > -		echo no
> > -	else
> > -		exit 1
> > -	fi
> > -else
> > -	if [ $yesno -eq 1 ]; then
> > -		echo yes
> > -	else
> > -		exit 0
> > -	fi
> > -fi
> > diff --git a/testcases/kernel/security/filecaps/filecapstest.sh b/testcases/kernel/security/filecaps/filecapstest.sh
> > index 149cbc1..9025b58 100755
> > --- a/testcases/kernel/security/filecaps/filecapstest.sh
> > +++ b/testcases/kernel/security/filecaps/filecapstest.sh
> > @@ -19,22 +19,8 @@
> >  ##                                                                            ##
> >  ################################################################################
> > 
> > -checkforlibcap.sh
> > -ret=$?
> > -if [ $ret -ne 0 ]; then
> > -	echo "Filecaps 0 CONF : System doesn't support execution of the test"
> > -	echo setcap not installed.  Please install libcap-2.11 or newer from
> > -	echo ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs/libcap2
> > -	exit 0
> > -fi
> > -checkforfilecaps.sh
> > -ret=$?
> > -if [ $ret -ne 0 ]; then
> > -	echo "Filecaps 0 CONF : File capabilities not available"
> > -	exit 0
> > -fi
> > -
> >  echo "Running in:"
> > +rm -f print_caps
> >  cp $LTPROOT/testcases/bin/print_caps .
> >  mkfifo caps_fifo
> >  chmod 777 caps_fifo
> > -- 
> > 1.6.0.6
> > 
> > 
> > ------------------------------------------------------------------------------
> > Download Intel&#174; Parallel Studio Eval
> > Try the new software tools for yourself. Speed compiling, find bugs
> > proactively, and fine-tune applications for parallel performance.
> > See why Intel Parallel Studio got high marks during beta.
> > http://p.sf.net/sfu/intel-sw-dev
> > _______________________________________________
> > Ltp-list mailing list
> > Ltp-list@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/ltp-list
> 
> -- 
> Thanks & Regards
> Rishi
> LTP Maintainer
> IBM, LTC, Bangalore
> Please join IRC #ltp @ irc.freenode.net

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH ltp] fix detection of setcap for filecaps test
  2010-03-23 13:25   ` Serge E. Hallyn
@ 2010-03-23 16:36     ` Garrett Cooper
  0 siblings, 0 replies; 5+ messages in thread
From: Garrett Cooper @ 2010-03-23 16:36 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: LTP list

On Tue, Mar 23, 2010 at 6:25 AM, Serge E. Hallyn <serue@us.ibm.com> wrote:
> Quoting Rishikesh K Rajak (risrajak@linux.vnet.ibm.com):
>> Hi Serge,
>>
>> Today we(me & iranna) got a chance to test your patch. Patch worked fine.
>>
>> while running i tried fixing few unwanted messages. You can Ack if it is correct fix.
>>
>> ===== error log =====
>> Running in:
>> cp: cannot stat `/opt/ltp/testcases/bin/print_caps': No such file or directory
>> mkfifo: cannot create fifo `caps_fifo': File exists
>> cap_sys_admin tests
>> ==== error log ======
>>
>> Signed-off by : Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
>
> I think these should be fine.
>
> Acked-by: Serge Hallyn <serue@us.ibm.com>

    If you're commenting out the lines, why not just delete them?
Thanks,
-Garrett

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-23 16:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-21  1:10 [LTP] [PATCH ltp] fix detection of setcap for filecaps test Serge E. Hallyn
2010-03-22  6:46 ` Rishikesh K Rajak
2010-03-23  8:53 ` Rishikesh K Rajak
2010-03-23 13:25   ` Serge E. Hallyn
2010-03-23 16:36     ` Garrett Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox