* [LTP] [PATCH] filecapstest.sh: fix a bug of fail in RHEL5
@ 2012-05-30 7:43 Peng Haitao
2012-05-30 7:49 ` Peng Haitao
2012-06-07 13:38 ` chrubis
0 siblings, 2 replies; 3+ messages in thread
From: Peng Haitao @ 2012-05-30 7:43 UTC (permalink / raw)
To: ltp-list
setcap is not used in ltp, So AC_CHECK_PROG(SETCAP,setcap,setcap)
should be deleted.
When HAVE_LIBCAP is not defined, the case should not be fail.
Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
include/mk/features.mk.default | 3 ---
include/mk/features.mk.in | 3 ---
m4/ltp-cap.m4 | 1 -
testcases/kernel/security/Makefile | 8 --------
testcases/kernel/security/cap_bound/cap_bounds_r.c | 4 ++--
testcases/kernel/security/cap_bound/cap_bounds_rw.c | 10 +++++++++-
6 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/include/mk/features.mk.default b/include/mk/features.mk.default
index 75a4c1d..86e4d4c 100644
--- a/include/mk/features.mk.default
+++ b/include/mk/features.mk.default
@@ -20,9 +20,6 @@
# Garrett Cooper, October 2010
#
-# Path to setcap program
-SETCAP :=
-
# Tools enable knobs
WITH_EXPECT := no
diff --git a/include/mk/features.mk.in b/include/mk/features.mk.in
index c9162e5..1fd28f8 100644
--- a/include/mk/features.mk.in
+++ b/include/mk/features.mk.in
@@ -20,9 +20,6 @@
# Garrett Cooper, October 2010
#
-# Path to setcap program
-SETCAP := @SETCAP@
-
# Tools enable knobs
WITH_EXPECT := @WITH_EXPECT@
diff --git a/m4/ltp-cap.m4 b/m4/ltp-cap.m4
index 953ea50..c646c8c 100644
--- a/m4/ltp-cap.m4
+++ b/m4/ltp-cap.m4
@@ -29,7 +29,6 @@ AH_TEMPLATE(HAVE_LIBCAP,
AC_CHECK_HEADERS([sys/capability.h],[capability_header_prefix="sys"])
if test "x$capability_header_prefix" != x; then
AC_CHECK_LIB(cap,cap_compare,[cap_libs="-lcap"])
- AC_CHECK_PROG(SETCAP,setcap,setcap)
fi
if test "x$cap_libs" != x; then
AC_DEFINE(HAVE_LIBCAP)
diff --git a/testcases/kernel/security/Makefile b/testcases/kernel/security/Makefile
index 9a7a2b2..0bb816f 100644
--- a/testcases/kernel/security/Makefile
+++ b/testcases/kernel/security/Makefile
@@ -24,14 +24,6 @@ top_srcdir ?= ../../..
include $(top_srcdir)/include/mk/env_pre.mk
-# For broken compilers and toolchains, like Montavista, that improperly detect
-# system headers when running autoconf -_-... bleh.
-ifeq ($(strip $(CAP_LIBS)),)
-FILTER_OUT_DIRS := cap_bound filecaps securebits
-endif
-ifeq ($(strip $(SETCAP)),)
-FILTER_OUT_DIRS += filecaps
-endif
ifneq ($(HAVE_SECUREBITS),yes)
FILTER_OUT_DIRS += securebits
endif
diff --git a/testcases/kernel/security/cap_bound/cap_bounds_r.c b/testcases/kernel/security/cap_bound/cap_bounds_r.c
index 006ab6a..0c09873 100644
--- a/testcases/kernel/security/cap_bound/cap_bounds_r.c
+++ b/testcases/kernel/security/cap_bound/cap_bounds_r.c
@@ -37,7 +37,7 @@ int TST_TOTAL=1;
int main(int argc, char *argv[])
{
-#if HAVE_SYS_CAPABILITY_H
+#ifdef HAVE_LIBCAP
int ret = 1;
int i;
@@ -88,4 +88,4 @@ int main(int argc, char *argv[])
tst_resm(TCONF, "System doesn't have POSIX capabilities.");
#endif
tst_exit();
-}
\ No newline at end of file
+}
diff --git a/testcases/kernel/security/cap_bound/cap_bounds_rw.c b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
index eb69b4e..7ebdd65 100644
--- a/testcases/kernel/security/cap_bound/cap_bounds_rw.c
+++ b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
@@ -55,6 +55,7 @@ int check_remaining_caps(int lastdropped)
return i;
}
}
+#ifdef HAVE_LIBCAP
for (; i <= CAP_LAST_CAP; i++) {
#if HAVE_DECL_PR_CAPBSET_READ
ret = prctl(PR_CAPBSET_READ, i);
@@ -71,6 +72,9 @@ int check_remaining_caps(int lastdropped)
return -i;
}
}
+#else
+ printf("System doesn't support full POSIX capabilities.\n");
+#endif
return 0;
}
@@ -79,6 +83,7 @@ int main(int argc, char *argv[])
int ret = 1;
int i;
+#ifdef HAVE_LIBCAP
#if HAVE_DECL_PR_CAPBSET_DROP
ret = prctl(PR_CAPBSET_READ, -1);
#else
@@ -131,5 +136,8 @@ int main(int argc, char *argv[])
}
}
tst_resm(TPASS, "PR_CAPBSET_DROP tests passed\n");
+#else
+ printf("System doesn't support full POSIX capabilities.\n");
+#endif
tst_exit();
-}
\ No newline at end of file
+}
--
1.7.10.1
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] filecapstest.sh: fix a bug of fail in RHEL5
2012-05-30 7:43 [LTP] [PATCH] filecapstest.sh: fix a bug of fail in RHEL5 Peng Haitao
@ 2012-05-30 7:49 ` Peng Haitao
2012-06-07 13:38 ` chrubis
1 sibling, 0 replies; 3+ messages in thread
From: Peng Haitao @ 2012-05-30 7:49 UTC (permalink / raw)
To: ltp-list
On 05/30/2012 03:43 PM, Peng Haitao wrote:
> setcap is not used in ltp, So AC_CHECK_PROG(SETCAP,setcap,setcap)
> should be deleted.
>
> When HAVE_LIBCAP is not defined, the case should not be fail.
>
Before the patch, the test log is as follows:
<<<test_start>>>
tag=Cap_bounds stime=1338362616
cmdline="run_capbounds.sh"
contacts=""
analysis=exit
<<<test_output>>>
<<<execution_status>>>
initiation_status="pan(6369): execvp of 'run_capbounds.sh' (tag
Cap_bounds) failed. errno:2 No such file or directory"
duration=0 termination_type=exited termination_id=2 corefile=no
cutime=0 cstime=0
<<<test_end>>>
<<<test_start>>>
tag=Filecaps stime=1338362616
cmdline="filecapstest.sh"
contacts=""
analysis=exit
<<<test_output>>>
<<<execution_status>>>
initiation_status="pan(6369): execvp of 'filecapstest.sh' (tag Filecaps)
failed. errno:2 No such file or directory"
duration=0 termination_type=exited termination_id=2 corefile=no
cutime=0 cstime=0
<<<test_end>>>
incrementing stop
INFO: ltp-pan reported all tests PASS
LTP Version: 20120401-51-gd5507d0
###############################################################
Done executing testcases.
LTP Version: 20120401-51-gd5507d0
###############################################################
# cat /opt/ltp/results/LTP_RUN_ON-2012_May_30-15h_23m_36s.log
Test Start Time: Wed May 30 15:23:36 2012
-----------------------------------------
Testcase Result Exit Value
-------- ------ ----------
Cap_bounds FAIL 2
Filecaps FAIL 2
-----------------------------------------------
Total Tests: 2
Total Failures: 2
Kernel Version: 2.6.18-274.el5
Machine Architecture: x86_64
Hostname: RHEL5U7GA-Intel64
After the patch, the test log is as follows:
<<<test_start>>>
tag=Cap_bounds stime=1338362725
cmdline="run_capbounds.sh"
contacts=""
analysis=exit
<<<test_output>>>
Set variables TCID, TST_TOTAL, and TST_COUNT before each test:
export TCID=<test name>
export TST_TOTAL=<Total Number of Tests >
export TST_COUNT=<Test case number>
/opt/ltp/testcases/bin/run_capbounds.sh: line 26: 13933 Aborted
tst_resm TCONF "System kernel version is less than 2.6.25"
Set variables TCID, TST_TOTAL, and TST_COUNT before each test:
export TCID=<test name>
export TST_TOTAL=<Total Number of Tests >
export TST_COUNT=<Test case number>
/opt/ltp/testcases/bin/run_capbounds.sh: line 26: 13934 Aborted
tst_resm TCONF "Cannot execute test"
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=0 corefile=no
cutime=0 cstime=0
<<<test_end>>>
<<<test_start>>>
tag=Filecaps stime=1338362725
cmdline="filecapstest.sh"
contacts=""
analysis=exit
<<<test_output>>>
Running in:
cap_sys_admin tests
filecaps 1 TCONF : System doesn't have POSIX capabilities support.
testing for correct caps
filecaps 1 TCONF : System doesn't have POSIX capabilities support.
testing for correct pI checks
filecaps 1 TCONF : System doesn't have POSIX capabilities support.
incrementing stop
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=0 corefile=no
cutime=0 cstime=0
<<<test_end>>>
INFO: ltp-pan reported all tests PASS
LTP Version: 20120401-52-g82fb69b
###############################################################
Done executing testcases.
LTP Version: 20120401-52-g82fb69b
###############################################################
# cat /opt/ltp/results/LTP_RUN_ON-2012_May_30-15h_25m_25s.log
Test Start Time: Wed May 30 15:25:25 2012
-----------------------------------------
Testcase Result Exit Value
-------- ------ ----------
Cap_bounds PASS 0
Filecaps PASS 0
-----------------------------------------------
Total Tests: 2
Total Failures: 0
Kernel Version: 2.6.18-274.el5
Machine Architecture: x86_64
Hostname: RHEL5U7GA-Intel64
--
Best Regards,
Peng
> Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
> ---
> include/mk/features.mk.default | 3 ---
> include/mk/features.mk.in | 3 ---
> m4/ltp-cap.m4 | 1 -
> testcases/kernel/security/Makefile | 8 --------
> testcases/kernel/security/cap_bound/cap_bounds_r.c | 4 ++--
> testcases/kernel/security/cap_bound/cap_bounds_rw.c | 10 +++++++++-
> 6 files changed, 11 insertions(+), 18 deletions(-)
>
> diff --git a/include/mk/features.mk.default b/include/mk/features.mk.default
> index 75a4c1d..86e4d4c 100644
> --- a/include/mk/features.mk.default
> +++ b/include/mk/features.mk.default
> @@ -20,9 +20,6 @@
> # Garrett Cooper, October 2010
> #
>
> -# Path to setcap program
> -SETCAP :=
> -
> # Tools enable knobs
> WITH_EXPECT := no
>
> diff --git a/include/mk/features.mk.in b/include/mk/features.mk.in
> index c9162e5..1fd28f8 100644
> --- a/include/mk/features.mk.in
> +++ b/include/mk/features.mk.in
> @@ -20,9 +20,6 @@
> # Garrett Cooper, October 2010
> #
>
> -# Path to setcap program
> -SETCAP := @SETCAP@
> -
> # Tools enable knobs
> WITH_EXPECT := @WITH_EXPECT@
>
> diff --git a/m4/ltp-cap.m4 b/m4/ltp-cap.m4
> index 953ea50..c646c8c 100644
> --- a/m4/ltp-cap.m4
> +++ b/m4/ltp-cap.m4
> @@ -29,7 +29,6 @@ AH_TEMPLATE(HAVE_LIBCAP,
> AC_CHECK_HEADERS([sys/capability.h],[capability_header_prefix="sys"])
> if test "x$capability_header_prefix" != x; then
> AC_CHECK_LIB(cap,cap_compare,[cap_libs="-lcap"])
> - AC_CHECK_PROG(SETCAP,setcap,setcap)
> fi
> if test "x$cap_libs" != x; then
> AC_DEFINE(HAVE_LIBCAP)
> diff --git a/testcases/kernel/security/Makefile b/testcases/kernel/security/Makefile
> index 9a7a2b2..0bb816f 100644
> --- a/testcases/kernel/security/Makefile
> +++ b/testcases/kernel/security/Makefile
> @@ -24,14 +24,6 @@ top_srcdir ?= ../../..
>
> include $(top_srcdir)/include/mk/env_pre.mk
>
> -# For broken compilers and toolchains, like Montavista, that improperly detect
> -# system headers when running autoconf -_-... bleh.
> -ifeq ($(strip $(CAP_LIBS)),)
> -FILTER_OUT_DIRS := cap_bound filecaps securebits
> -endif
> -ifeq ($(strip $(SETCAP)),)
> -FILTER_OUT_DIRS += filecaps
> -endif
> ifneq ($(HAVE_SECUREBITS),yes)
> FILTER_OUT_DIRS += securebits
> endif
> diff --git a/testcases/kernel/security/cap_bound/cap_bounds_r.c b/testcases/kernel/security/cap_bound/cap_bounds_r.c
> index 006ab6a..0c09873 100644
> --- a/testcases/kernel/security/cap_bound/cap_bounds_r.c
> +++ b/testcases/kernel/security/cap_bound/cap_bounds_r.c
> @@ -37,7 +37,7 @@ int TST_TOTAL=1;
>
> int main(int argc, char *argv[])
> {
> -#if HAVE_SYS_CAPABILITY_H
> +#ifdef HAVE_LIBCAP
> int ret = 1;
> int i;
>
> @@ -88,4 +88,4 @@ int main(int argc, char *argv[])
> tst_resm(TCONF, "System doesn't have POSIX capabilities.");
> #endif
> tst_exit();
> -}
> \ No newline at end of file
> +}
> diff --git a/testcases/kernel/security/cap_bound/cap_bounds_rw.c b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
> index eb69b4e..7ebdd65 100644
> --- a/testcases/kernel/security/cap_bound/cap_bounds_rw.c
> +++ b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
> @@ -55,6 +55,7 @@ int check_remaining_caps(int lastdropped)
> return i;
> }
> }
> +#ifdef HAVE_LIBCAP
> for (; i <= CAP_LAST_CAP; i++) {
> #if HAVE_DECL_PR_CAPBSET_READ
> ret = prctl(PR_CAPBSET_READ, i);
> @@ -71,6 +72,9 @@ int check_remaining_caps(int lastdropped)
> return -i;
> }
> }
> +#else
> + printf("System doesn't support full POSIX capabilities.\n");
> +#endif
> return 0;
> }
>
> @@ -79,6 +83,7 @@ int main(int argc, char *argv[])
> int ret = 1;
> int i;
>
> +#ifdef HAVE_LIBCAP
> #if HAVE_DECL_PR_CAPBSET_DROP
> ret = prctl(PR_CAPBSET_READ, -1);
> #else
> @@ -131,5 +136,8 @@ int main(int argc, char *argv[])
> }
> }
> tst_resm(TPASS, "PR_CAPBSET_DROP tests passed\n");
> +#else
> + printf("System doesn't support full POSIX capabilities.\n");
> +#endif
> tst_exit();
> -}
> \ No newline at end of file
> +}
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] filecapstest.sh: fix a bug of fail in RHEL5
2012-05-30 7:43 [LTP] [PATCH] filecapstest.sh: fix a bug of fail in RHEL5 Peng Haitao
2012-05-30 7:49 ` Peng Haitao
@ 2012-06-07 13:38 ` chrubis
1 sibling, 0 replies; 3+ messages in thread
From: chrubis @ 2012-06-07 13:38 UTC (permalink / raw)
To: Peng Haitao; +Cc: ltp-list
Hi!
> +#ifdef HAVE_LIBCAP
> for (; i <= CAP_LAST_CAP; i++) {
> #if HAVE_DECL_PR_CAPBSET_READ
> ret = prctl(PR_CAPBSET_READ, i);
> @@ -71,6 +72,9 @@ int check_remaining_caps(int lastdropped)
> return -i;
> }
> }
> +#else
> + printf("System doesn't support full POSIX capabilities.\n");
This message is useless, as when HAVE_LIBCAP is not defined the
check_remaining_caps() is never called from the main() or am I mistaken?
> +#endif
> return 0;
> }
>
> @@ -79,6 +83,7 @@ int main(int argc, char *argv[])
> int ret = 1;
> int i;
>
> +#ifdef HAVE_LIBCAP
> #if HAVE_DECL_PR_CAPBSET_DROP
> ret = prctl(PR_CAPBSET_READ, -1);
> #else
> @@ -131,5 +136,8 @@ int main(int argc, char *argv[])
> }
> }
> tst_resm(TPASS, "PR_CAPBSET_DROP tests passed\n");
> +#else
> + printf("System doesn't support full POSIX capabilities.\n");
> +#endif
> tst_exit();
I'm a little lost in the ifdefs, but this one should IMHO be:
tst_resm(TCONF, "System doesn't support full POSIX capabilities.\n"
The rest seems to be fine.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-07 13:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-30 7:43 [LTP] [PATCH] filecapstest.sh: fix a bug of fail in RHEL5 Peng Haitao
2012-05-30 7:49 ` Peng Haitao
2012-06-07 13:38 ` chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox