All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] fix obvious compilation problems in cap_bounds
@ 2010-11-08 17:58 Cyril Hrubis
       [not found] ` <AANLkTin1gbGLq=eoyBkLTycX-LxyNtUJQJv1jdnqdXtA@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2010-11-08 17:58 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 369 bytes --]

Hi!
Following patch fixes obvious problems with cap_bounds compilation

* CAP_LAST_CAP is defined in linux/capability.h => include it

* remove int errno; definition

* move #ifdef HAVE_SYS_CAPABILITY_H after int main(int argc, char *argv[])
  in check_pe.c

* small typos and coding style

Signed-off-by: Cyril Hrubis chrubis@suse.cz

-- 
Cyril Hrubis
chrubis@suse.cz

[-- Attachment #2: cap_bounds.patch --]
[-- Type: text/x-patch, Size: 4169 bytes --]

diff --git a/testcases/kernel/security/cap_bound/cap_bounds_r.c b/testcases/kernel/security/cap_bound/cap_bounds_r.c
index 0b1c5b3..13c5400 100644
--- a/testcases/kernel/security/cap_bound/cap_bounds_r.c
+++ b/testcases/kernel/security/cap_bound/cap_bounds_r.c
@@ -29,14 +29,13 @@
 #if HAVE_SYS_CAPABILITY_H
 #include <sys/capability.h>
 #endif
+#include <linux/capability.h>
 #include <sys/prctl.h>
 #include <test.h>
 
 char *TCID = "cap_bounds_r";
 int TST_TOTAL=1;
 
-int errno;
-
 int main(int argc, char *argv[])
 {
 #if HAVE_SYS_CAPABILITY_H
diff --git a/testcases/kernel/security/cap_bound/cap_bounds_rw.c b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
index 827a305..c23c598 100644
--- a/testcases/kernel/security/cap_bound/cap_bounds_rw.c
+++ b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
@@ -28,20 +28,19 @@
 #if HAVE_SYS_CAPABILITY_H
 #include <sys/capability.h>
 #endif
+#include <linux/capability.h>
 #include <sys/prctl.h>
 #include <test.h>
 
 char *TCID = "cap_bounds_rw";
 int TST_TOTAL=1;
 
-int errno;
-
 int check_remaining_caps(int lastdropped)
 {
 	int i;
 	int ret;
 
-	for (i=0; i <= lastdropped; i++) {
+	for (i = 0; i <= lastdropped; i++) {
 #if HAVE_DECL_PR_CAPBSET_READ
 		ret = prctl(PR_CAPBSET_READ, i);
 #else
@@ -57,7 +56,7 @@ int check_remaining_caps(int lastdropped)
 			return i;
 		}
 	}
-	for (; i<=CAP_LAST_CAP; i++) {
+	for (; i <= CAP_LAST_CAP; i++) {
 #if HAVE_DECL_PR_CAPBSET_READ
 		ret = prctl(PR_CAPBSET_READ, i);
 #else
@@ -108,7 +107,7 @@ int main(int argc, char *argv[])
 		tst_resm(TINFO, " %d is should not exist\n", max(INSANE, CAP_LAST_CAP+1));
 		tst_exit();
 	}
-	for (i=0; i<=CAP_LAST_CAP; i++) {
+	for (i = 0; i <= CAP_LAST_CAP; i++) {
 #if HAVE_DECL_PR_CAPBSET_DROP
 		ret = prctl(PR_CAPBSET_DROP, i);
 #else
diff --git a/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c b/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c
index 7033a37..1f3634b 100644
--- a/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c
+++ b/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c
@@ -37,8 +37,6 @@
 char *TCID = "cap_bounds_r";
 int TST_TOTAL=2;
 
-int errno;
-
 int main(int argc, char *argv[])
 {
 #if HAVE_SYS_CAPABILITY_H
diff --git a/testcases/kernel/security/cap_bound/check_pe.c b/testcases/kernel/security/cap_bound/check_pe.c
index f621e70..2f5aec9 100644
--- a/testcases/kernel/security/cap_bound/check_pe.c
+++ b/testcases/kernel/security/cap_bound/check_pe.c
@@ -38,12 +38,10 @@
 char *TCID = "check_pe";
 int TST_TOTAL=1;
 
-int errno;
-
-#if HAVE_SYS_CAPABILITY_H
-#ifdef HAVE_LIBCAP
 int main(int argc, char *argv[])
 {
+#ifdef HAVE_SYS_CAPABILITY_H
+#ifdef HAVE_LIBCAP
 	int ret = 1;
 	cap_flag_value_t f;
 	cap_t cur;
@@ -72,7 +70,7 @@ int main(int argc, char *argv[])
 			tst_resm(TPASS, "cap is in pE\n");
 			tst_exit();
 		}
-		tst_resm(TFAIL, "Cap is not in pE\n");
+		tst_resm(TFAIL, "cap is not in pE\n");
 		tst_exit();
 	}
 	if (f == CAP_CLEAR) {
diff --git a/testcases/kernel/security/cap_bound/dummy.c b/testcases/kernel/security/cap_bound/dummy.c
index e882940..3ee7c9b 100644
--- a/testcases/kernel/security/cap_bound/dummy.c
+++ b/testcases/kernel/security/cap_bound/dummy.c
@@ -5,7 +5,7 @@
 #include <sys/capability.h>
 #endif
 
-int main()
+int main(void)
 {
 #if HAVE_SYS_CAPABILITY_H
 #ifdef HAVE_LIBCAP
diff --git a/testcases/kernel/security/cap_bound/exec_with_inh.c b/testcases/kernel/security/cap_bound/exec_with_inh.c
index 123f665..dc18b63 100644
--- a/testcases/kernel/security/cap_bound/exec_with_inh.c
+++ b/testcases/kernel/security/cap_bound/exec_with_inh.c
@@ -37,8 +37,6 @@
 char *TCID = "exec_with_inh";
 int TST_TOTAL=1;
 
-int errno;
-
 int main(int argc, char *argv[])
 {
 #if HAVE_SYS_CAPABILITY_H
diff --git a/testcases/kernel/security/cap_bound/exec_without_inh.c b/testcases/kernel/security/cap_bound/exec_without_inh.c
index df3c4d9..8d99883 100644
--- a/testcases/kernel/security/cap_bound/exec_without_inh.c
+++ b/testcases/kernel/security/cap_bound/exec_without_inh.c
@@ -37,8 +37,6 @@
 char *TCID = "exec_without_inh";
 int TST_TOTAL=1;
 
-int errno;
-
 int main(int argc, char *argv[])
 {
 #if HAVE_SYS_CAPABILITY_H

[-- Attachment #3: Type: text/plain, Size: 360 bytes --]

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] fix obvious compilation problems in cap_bounds
       [not found] ` <AANLkTin1gbGLq=eoyBkLTycX-LxyNtUJQJv1jdnqdXtA@mail.gmail.com>
@ 2010-11-08 18:25   ` Cyril Hrubis
  2010-11-08 18:52     ` Cyril Hrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2010-11-08 18:25 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

Hi!
> > Following patch fixes obvious problems with cap_bounds compilation
> >
> > * CAP_LAST_CAP is defined in linux/capability.h => include it
> >
> > * remove int errno; definition
> >
> > * move #ifdef HAVE_SYS_CAPABILITY_H after int main(int argc, char *argv[])
> >  in check_pe.c
> >
> > * small typos and coding style
> 
> Hi Cyril!
>     Quick question -- why doesn't sys/capability.h build on
> linux/capability.h (in particular what OS did you run into this issue
> on)?

You are right, the problem is that HAVE_SYS_CAPABILITY_H is not in
config.h even when libcap-devel is installed and headers are found
(there is only #define HAVE_LIBCAP 1).

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] fix obvious compilation problems in cap_bounds
  2010-11-08 18:25   ` Cyril Hrubis
@ 2010-11-08 18:52     ` Cyril Hrubis
       [not found]       ` <AANLkTin_Ufopsjacwr4+nMhLg-6UMtfPO0geeq5+-Y2W@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2010-11-08 18:52 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

Hi!
> > > Following patch fixes obvious problems with cap_bounds compilation
> > >
> > > * CAP_LAST_CAP is defined in linux/capability.h => include it
> > >
> > > * remove int errno; definition
> > >
> > > * move #ifdef HAVE_SYS_CAPABILITY_H after int main(int argc, char *argv[])
> > >  in check_pe.c
> > >
> > > * small typos and coding style
> > 
> > Hi Cyril!
> >     Quick question -- why doesn't sys/capability.h build on
> > linux/capability.h (in particular what OS did you run into this issue
> > on)?
> 
> You are right, the problem is that HAVE_SYS_CAPABILITY_H is not in
> config.h even when libcap-devel is installed and headers are found
> (there is only #define HAVE_LIBCAP 1).
> 

Hmm, adding sys/capability.h into AC_CHECK_HEADERS() in configure.ac
seem to fixed this. Still I have no idea why AC_CHECK_HEADER() in
m4/ltp-cap.m4 hasn't exported HAVE_SYS_CAPABILITY_H.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] fix obvious compilation problems in cap_bounds
       [not found]       ` <AANLkTin_Ufopsjacwr4+nMhLg-6UMtfPO0geeq5+-Y2W@mail.gmail.com>
@ 2010-11-08 19:25         ` Cyril Hrubis
       [not found]           ` <AANLkTinXqYi7iHTPyMCNOt=kHNeRKAS6btL8aVcj23Tk@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2010-11-08 19:25 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

Hi!
> >> > > Following patch fixes obvious problems with cap_bounds compilation
> >> > >
> >> > > * CAP_LAST_CAP is defined in linux/capability.h => include it
> >> > >
> >> > > * remove int errno; definition
> >> > >
> >> > > * move #ifdef HAVE_SYS_CAPABILITY_H after int main(int argc, char *argv[])
> >> > >  in check_pe.c
> >> > >
> >> > > * small typos and coding style
> >> >
> >> > Hi Cyril!
> >> >     Quick question -- why doesn't sys/capability.h build on
> >> > linux/capability.h (in particular what OS did you run into this issue
> >> > on)?
> >>
> >> You are right, the problem is that HAVE_SYS_CAPABILITY_H is not in
> >> config.h even when libcap-devel is installed and headers are found
> >> (there is only #define HAVE_LIBCAP 1).
> >>
> >
> > Hmm, adding sys/capability.h into AC_CHECK_HEADERS() in configure.ac
> > seem to fixed this. Still I have no idea why AC_CHECK_HEADER() in
> > m4/ltp-cap.m4 hasn't exported HAVE_SYS_CAPABILITY_H.
> 
>     Probably because I forgot to remove the square brackets; give the
> patch attached a shot and let me know how it goes...

Nope, it looks like AC_CHECK_HEADER() does not set HAVE_* at all(1).  So
we need to change AC_HECK_HEADER() to AC_CHECK_HEADERS() in
m4/ltp-cap.m4.

1) http://www.gnu.org/software/hello/manual/autoconf/Generic-Headers.html

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] fix obvious compilation problems in cap_bounds
       [not found]           ` <AANLkTinXqYi7iHTPyMCNOt=kHNeRKAS6btL8aVcj23Tk@mail.gmail.com>
@ 2010-11-08 19:32             ` Cyril Hrubis
       [not found]               ` <AANLkTinhaO2R8RwtCz3p28QGyRTAouBaCVSKsmMihh15@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2010-11-08 19:32 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

Hi!
> >> >> > > Following patch fixes obvious problems with cap_bounds compilation
> >> >> > >
> >> >> > > * CAP_LAST_CAP is defined in linux/capability.h => include it
> >> >> > >
> >> >> > > * remove int errno; definition
> >> >> > >
> >> >> > > * move #ifdef HAVE_SYS_CAPABILITY_H after int main(int argc, char *argv[])
> >> >> > >  in check_pe.c
> >> >> > >
> >> >> > > * small typos and coding style
> >> >> >
> >> >> > Hi Cyril!
> >> >> >     Quick question -- why doesn't sys/capability.h build on
> >> >> > linux/capability.h (in particular what OS did you run into this issue
> >> >> > on)?
> >> >>
> >> >> You are right, the problem is that HAVE_SYS_CAPABILITY_H is not in
> >> >> config.h even when libcap-devel is installed and headers are found
> >> >> (there is only #define HAVE_LIBCAP 1).
> >> >>
> >> >
> >> > Hmm, adding sys/capability.h into AC_CHECK_HEADERS() in configure.ac
> >> > seem to fixed this. Still I have no idea why AC_CHECK_HEADER() in
> >> > m4/ltp-cap.m4 hasn't exported HAVE_SYS_CAPABILITY_H.
> >>
> >>     Probably because I forgot to remove the square brackets; give the
> >> patch attached a shot and let me know how it goes...
> >
> > Nope, it looks like AC_CHECK_HEADER() does not set HAVE_* at all(1).  So
> > we need to change AC_HECK_HEADER() to AC_CHECK_HEADERS() in
> > m4/ltp-cap.m4.
> 
>     That's kind of lame :/... Could you try this patch instead please?

Yes, this works regardless if there are square braces around
sys/capability.h or not.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] fix obvious compilation problems in cap_bounds
       [not found]               ` <AANLkTinhaO2R8RwtCz3p28QGyRTAouBaCVSKsmMihh15@mail.gmail.com>
@ 2010-11-08 19:56                 ` Cyril Hrubis
  0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2010-11-08 19:56 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

Hi!
> >> >> >> > > Following patch fixes obvious problems with cap_bounds compilation
> >> >> >> > >
> >> >> >> > > * CAP_LAST_CAP is defined in linux/capability.h => include it
> >> >> >> > >
> >> >> >> > > * remove int errno; definition
> >> >> >> > >
> >> >> >> > > * move #ifdef HAVE_SYS_CAPABILITY_H after int main(int argc, char *argv[])
> >> >> >> > >  in check_pe.c
> >> >> >> > >
> >> >> >> > > * small typos and coding style
> >> >> >> >
> >> >> >> > Hi Cyril!
> >> >> >> >     Quick question -- why doesn't sys/capability.h build on
> >> >> >> > linux/capability.h (in particular what OS did you run into this issue
> >> >> >> > on)?
> >> >> >>
> >> >> >> You are right, the problem is that HAVE_SYS_CAPABILITY_H is not in
> >> >> >> config.h even when libcap-devel is installed and headers are found
> >> >> >> (there is only #define HAVE_LIBCAP 1).
> >> >> >>
> >> >> >
> >> >> > Hmm, adding sys/capability.h into AC_CHECK_HEADERS() in configure.ac
> >> >> > seem to fixed this. Still I have no idea why AC_CHECK_HEADER() in
> >> >> > m4/ltp-cap.m4 hasn't exported HAVE_SYS_CAPABILITY_H.
> >> >>
> >> >>     Probably because I forgot to remove the square brackets; give the
> >> >> patch attached a shot and let me know how it goes...
> >> >
> >> > Nope, it looks like AC_CHECK_HEADER() does not set HAVE_* at all(1).  So
> >> > we need to change AC_HECK_HEADER() to AC_CHECK_HEADERS() in
> >> > m4/ltp-cap.m4.
> >>
> >>     That's kind of lame :/... Could you try this patch instead please?
> >
> > Yes, this works regardless if there are square braces around
> > sys/capability.h or not.
> 

Do you want me to create new patch (for the original issue) without
#include <linux/capability.h>?

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2010-11-08 19:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-08 17:58 [LTP] [PATCH] fix obvious compilation problems in cap_bounds Cyril Hrubis
     [not found] ` <AANLkTin1gbGLq=eoyBkLTycX-LxyNtUJQJv1jdnqdXtA@mail.gmail.com>
2010-11-08 18:25   ` Cyril Hrubis
2010-11-08 18:52     ` Cyril Hrubis
     [not found]       ` <AANLkTin_Ufopsjacwr4+nMhLg-6UMtfPO0geeq5+-Y2W@mail.gmail.com>
2010-11-08 19:25         ` Cyril Hrubis
     [not found]           ` <AANLkTinXqYi7iHTPyMCNOt=kHNeRKAS6btL8aVcj23Tk@mail.gmail.com>
2010-11-08 19:32             ` Cyril Hrubis
     [not found]               ` <AANLkTinhaO2R8RwtCz3p28QGyRTAouBaCVSKsmMihh15@mail.gmail.com>
2010-11-08 19:56                 ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.