* [LTP] [PATCH] securebits/check_keepcaps.c: Add comments about cap_get_flag may return -1 @ 2014-08-06 7:17 Zeng Linggang 2014-09-09 14:40 ` chrubis 0 siblings, 1 reply; 3+ messages in thread From: Zeng Linggang @ 2014-08-06 7:17 UTC (permalink / raw) To: ltp-list In RHEL7.0(3.10.0) the value of CAP_LAST_CAP in linux/capability.h is 36, it is greater than in the capability.h which is used to create libcap.so(libcap-2.22-8) and that value is 34. Then cap_get_flag returns -1, and errno is set to EINVAL. Add comments to make this clear. Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com> --- testcases/kernel/security/securebits/check_keepcaps.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testcases/kernel/security/securebits/check_keepcaps.c b/testcases/kernel/security/securebits/check_keepcaps.c index 83e463e..a602fb5 100644 --- a/testcases/kernel/security/securebits/check_keepcaps.c +++ b/testcases/kernel/security/securebits/check_keepcaps.c @@ -38,6 +38,16 @@ static int eff_caps_empty(cap_t c) for (i = 0; i < CAP_LAST_CAP; i++) { ret = cap_get_flag(c, i, CAP_PERMITTED, &v); + /* + * If the value of CAP_LAST_CAP in linux/capability.h is greater + * than the value in the capability.h which is used to create + * libcap.so. Then cap_get_flag returns -1, and errno is set to + * EINVAL. + */ + if (ret == -1) { + tst_brkm(TBROK | TERRNO, NULL, + "Not expected. Please check arguments."); + } if (ret || v) empty = 0; } -- 1.9.3 ------------------------------------------------------------------------------ Infragistics Professional Build stunning WinForms apps today! Reboot your WinForms applications with our WinForms controls. Build a bridge from your legacy apps to the future. http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk _______________________________________________ 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] securebits/check_keepcaps.c: Add comments about cap_get_flag may return -1 2014-08-06 7:17 [LTP] [PATCH] securebits/check_keepcaps.c: Add comments about cap_get_flag may return -1 Zeng Linggang @ 2014-09-09 14:40 ` chrubis [not found] ` <1410317916.31685.34.camel@G08JYZSD130126> 0 siblings, 1 reply; 3+ messages in thread From: chrubis @ 2014-09-09 14:40 UTC (permalink / raw) To: Zeng Linggang; +Cc: ltp-list Hi! > In RHEL7.0(3.10.0) the value of CAP_LAST_CAP in linux/capability.h is 36, it is > greater than in the capability.h which is used to create > libcap.so(libcap-2.22-8) and that value is 34. Then cap_get_flag returns -1, and > errno is set to EINVAL. Add comments to make this clear. I'm a bit confused, the sys/capability.h header which is part of libcap includes the linux/capability.h header which defines the the CAP_LAST_CAP (at least on my system). So there shouldn't be a disagreement between these two unless libcap was compiled with wrong kernel headers which I would call a bug in distribution. Are you sure that all your packages are up to date? -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce. Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk _______________________________________________ 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
[parent not found: <1410317916.31685.34.camel@G08JYZSD130126>]
[parent not found: <1095333434.20418604.1410337882836.JavaMail.zimbra@redhat.com>]
* Re: [LTP] [PATCH] securebits/check_keepcaps.c: Add comments about cap_get_flag may return -1 [not found] ` <1095333434.20418604.1410337882836.JavaMail.zimbra@redhat.com> @ 2014-09-10 16:36 ` chrubis 0 siblings, 0 replies; 3+ messages in thread From: chrubis @ 2014-09-10 16:36 UTC (permalink / raw) To: Jan Stancek; +Cc: ltp-list Hi! > > I think libcap was compiled with wrong kernel headers and it is a bug in > > distribution. I had installed these packages all from the default > > distribution. The value of CAP_LAST_CAP is different. > > Someone else reported it already: > Bug 1046008 - Some capabilities aren't be defined > https://bugzilla.redhat.com/show_bug.cgi?id=1046008 > > Patch looks good to me, it makes the bug more visible. Ok. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk _______________________________________________ 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:[~2014-09-10 16:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-06 7:17 [LTP] [PATCH] securebits/check_keepcaps.c: Add comments about cap_get_flag may return -1 Zeng Linggang
2014-09-09 14:40 ` chrubis
[not found] ` <1410317916.31685.34.camel@G08JYZSD130126>
[not found] ` <1095333434.20418604.1410337882836.JavaMail.zimbra@redhat.com>
2014-09-10 16:36 ` chrubis
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox