From: Jan Stancek <jstancek@redhat.com>
To: Simon Xu <xu.simon@oracle.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH 1/1] capability: fix sys/capability.h compile error
Date: Wed, 8 Aug 2012 03:19:33 -0400 (EDT) [thread overview]
Message-ID: <1509645544.1692111.1344410373260.JavaMail.root@redhat.com> (raw)
In-Reply-To: <5021FCE3.4040207@oracle.com>
----- Original Message -----
> From: "Simon Xu" <xu.simon@oracle.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Wednesday, 8 August, 2012 7:45:07 AM
> Subject: Re: [LTP] [PATCH 1/1] capability: fix sys/capability.h compile error
>
> On 2012/8/8 13:32, Caspar Zhang wrote:
> > On 08/03/2012 12:22 AM, Simon Xu wrote:
> >> Capability testcases fail to compile with sys/capability.h of
> >> libcap-devel in
> >> RHEL5-like distros:
I looked at RHEL 5.3/5.6/5.8 but couldn't reproduce this.
> >>
> >> In file included from /usr/include/sys/capability.h:34, from
> >> cap_bounds_r.c:30:
> >> /usr/include/linux/capability.h:70:
> >> error: expected specifier-qualifier-list before
> >> '__le32'
> >>
> >> This is due to sys/capability.h preventing the correct
> >> _LINUX_TYPES_H_ from
> >> being included. The problem can be bypassed by including
> >> linux/types.h in
> >> capability testcases.
> >>
> >> Signed-off-by: Simon Xu <xu.simon@oracle.com>
> > from doc/style-guide.txt:
> >
> > "
> > 14. System headers
> > ~~~~~~~~~~~~~~~~~~
> >
> > Don't use +linux/+ headers if at all possible. Usually they are
> > replaced
> > with
> > +sys/+ headers as things work their way into glibc. Furthermore,
> > +linux/+
> > headers get shuffled around a lot more than their +sys/+
> > counterparts it
> > seems.
> > "
> >
> > Do we have a better solution?
> >
> > Caspar
>
> [root@CentOS5 ~]# cd /usr/include
> [root@CentOS5 include]# grep -r "#define _LINUX_TYPES_H" *
> linux/types.h:#define _LINUX_TYPES_H
> sys/capability.h:#define _LINUX_TYPES_H
>
> The root problem is sys/capability.h prevents linux/types.h from
> being
> included, so to solve this issue you always need to include
> linux/types.h, one way or another.
I have seen some versions where sys/capability.h includes linux/types.h,
and others (e.g. RHEL 6.2) where it does:
#define _LINUX_TYPES_H
typedef unsigned int __u32;
typedef __u32 __le32;
gcc seemed to be OK with duplicate typedefs as long as
they were identical, so I didn't run into troubles with extra
include of "linux/types.h".
Regards,
Jan
>
> Thanks
> Simon
>
> >> ---
> >> testcases/kernel/security/cap_bound/cap_bounds_r.c | 1 +
> >> testcases/kernel/security/cap_bound/cap_bounds_rw.c | 1 +
> >> testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c | 1 +
> >> testcases/kernel/security/cap_bound/check_pe.c | 1 +
> >> testcases/kernel/security/cap_bound/dummy.c | 1 +
> >> testcases/kernel/security/cap_bound/exec_with_inh.c | 1 +
> >> testcases/kernel/security/cap_bound/exec_without_inh.c | 1 +
> >> testcases/kernel/security/filecaps/c.c | 1 +
> >> testcases/kernel/security/filecaps/check_simple_capset.c | 1 +
> >> testcases/kernel/security/filecaps/inh_capped.c | 1 +
> >> testcases/kernel/security/filecaps/print_caps.c | 1 +
> >> testcases/kernel/security/filecaps/verify_caps_exec.c | 1 +
> >> testcases/kernel/security/securebits/check_keepcaps.c | 1 +
> >> 13 files changed, 13 insertions(+)
> >>
> >> diff --git a/testcases/kernel/security/cap_bound/cap_bounds_r.c
> >> b/testcases/kernel/security/cap_bound/cap_bounds_r.c
> >> index 0c09873..4b28a6f 100644
> >> --- a/testcases/kernel/security/cap_bound/cap_bounds_r.c
> >> +++ b/testcases/kernel/security/cap_bound/cap_bounds_r.c
> >> @@ -27,6 +27,7 @@
> >> #include <errno.h>
> >> #include "config.h"
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >> #include <sys/prctl.h>
> >> diff --git a/testcases/kernel/security/cap_bound/cap_bounds_rw.c
> >> b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
> >> index 010ace6..e5bcb74 100644
> >> --- a/testcases/kernel/security/cap_bound/cap_bounds_rw.c
> >> +++ b/testcases/kernel/security/cap_bound/cap_bounds_rw.c
> >> @@ -26,6 +26,7 @@
> >> #include <errno.h>
> >> #include "config.h"
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >> #include <sys/prctl.h>
> >> 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 3a65faf..f4b0bd3 100644
> >> --- a/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c
> >> +++ b/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c
> >> @@ -29,6 +29,7 @@
> >> #include <errno.h>
> >> #include "config.h"
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >> #include <sys/prctl.h>
> >> diff --git a/testcases/kernel/security/cap_bound/check_pe.c
> >> b/testcases/kernel/security/cap_bound/check_pe.c
> >> index be16cc5..acdefe5 100644
> >> --- a/testcases/kernel/security/cap_bound/check_pe.c
> >> +++ b/testcases/kernel/security/cap_bound/check_pe.c
> >> @@ -30,6 +30,7 @@
> >> #include <errno.h>
> >> #include "config.h"
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >> #include <sys/prctl.h>
> >> diff --git a/testcases/kernel/security/cap_bound/dummy.c
> >> b/testcases/kernel/security/cap_bound/dummy.c
> >> index 0559a8e..cb58259 100644
> >> --- a/testcases/kernel/security/cap_bound/dummy.c
> >> +++ b/testcases/kernel/security/cap_bound/dummy.c
> >> @@ -3,6 +3,7 @@
> >> #include "test.h"
> >>
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >>
> >> diff --git a/testcases/kernel/security/cap_bound/exec_with_inh.c
> >> b/testcases/kernel/security/cap_bound/exec_with_inh.c
> >> index dd026ce..4bacfcf 100644
> >> --- a/testcases/kernel/security/cap_bound/exec_with_inh.c
> >> +++ b/testcases/kernel/security/cap_bound/exec_with_inh.c
> >> @@ -29,6 +29,7 @@
> >> #include <errno.h>
> >> #include "config.h"
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >> #include <sys/prctl.h>
> >> diff --git
> >> a/testcases/kernel/security/cap_bound/exec_without_inh.c
> >> b/testcases/kernel/security/cap_bound/exec_without_inh.c
> >> index 687e72b..56e9e9d 100644
> >> --- a/testcases/kernel/security/cap_bound/exec_without_inh.c
> >> +++ b/testcases/kernel/security/cap_bound/exec_without_inh.c
> >> @@ -29,6 +29,7 @@
> >> #include <errno.h>
> >> #include "config.h"
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >> #include <sys/prctl.h>
> >> diff --git a/testcases/kernel/security/filecaps/c.c
> >> b/testcases/kernel/security/filecaps/c.c
> >> index fbd0365..76f1803 100644
> >> --- a/testcases/kernel/security/filecaps/c.c
> >> +++ b/testcases/kernel/security/filecaps/c.c
> >> @@ -20,6 +20,7 @@
> >>
> >> #include <stdio.h>
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >>
> >> diff --git
> >> a/testcases/kernel/security/filecaps/check_simple_capset.c
> >> b/testcases/kernel/security/filecaps/check_simple_capset.c
> >> index 8f391e0..d1d2ee5 100644
> >> --- a/testcases/kernel/security/filecaps/check_simple_capset.c
> >> +++ b/testcases/kernel/security/filecaps/check_simple_capset.c
> >> @@ -21,6 +21,7 @@
> >> #include <stdio.h>
> >> #include "config.h"
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >>
> >> diff --git a/testcases/kernel/security/filecaps/inh_capped.c
> >> b/testcases/kernel/security/filecaps/inh_capped.c
> >> index b6dfeee..285c2ea 100644
> >> --- a/testcases/kernel/security/filecaps/inh_capped.c
> >> +++ b/testcases/kernel/security/filecaps/inh_capped.c
> >> @@ -27,6 +27,7 @@
> >> #include <stdio.h>
> >> #include "config.h"
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >> #include "test.h"
> >> diff --git a/testcases/kernel/security/filecaps/print_caps.c
> >> b/testcases/kernel/security/filecaps/print_caps.c
> >> index ed40c45..7584820 100644
> >> --- a/testcases/kernel/security/filecaps/print_caps.c
> >> +++ b/testcases/kernel/security/filecaps/print_caps.c
> >> @@ -33,6 +33,7 @@
> >> #include "config.h"
> >>
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >>
> >> diff --git a/testcases/kernel/security/filecaps/verify_caps_exec.c
> >> b/testcases/kernel/security/filecaps/verify_caps_exec.c
> >> index d89df82..f10ce86 100644
> >> --- a/testcases/kernel/security/filecaps/verify_caps_exec.c
> >> +++ b/testcases/kernel/security/filecaps/verify_caps_exec.c
> >> @@ -38,6 +38,7 @@
> >> #include <fcntl.h>
> >> #include "config.h"
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >> #include <sys/prctl.h>
> >> diff --git a/testcases/kernel/security/securebits/check_keepcaps.c
> >> b/testcases/kernel/security/securebits/check_keepcaps.c
> >> index 8cb9d22..f5c18eb 100644
> >> --- a/testcases/kernel/security/securebits/check_keepcaps.c
> >> +++ b/testcases/kernel/security/securebits/check_keepcaps.c
> >> @@ -1,6 +1,7 @@
> >> #include <errno.h>
> >> #include "config.h"
> >> #if HAVE_SYS_CAPABILITY_H
> >> +#include <linux/types.h>
> >> #include <sys/capability.h>
> >> #endif
> >> #include <sys/prctl.h>
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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
next prev parent reply other threads:[~2012-08-08 7:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-02 16:22 [LTP] [PATCH 1/1] capability: fix sys/capability.h compile error Simon Xu
2012-08-08 5:21 ` Wanlong Gao
2012-08-08 5:32 ` Caspar Zhang
2012-08-08 5:45 ` Simon Xu
2012-08-08 7:19 ` Jan Stancek [this message]
2012-08-08 7:31 ` Garrett Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1509645544.1692111.1344410373260.JavaMail.root@redhat.com \
--to=jstancek@redhat.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=xu.simon@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox