[CRIU] [PATCH 2/3] zdtm: check bset in caps00
Andrey Vagin
avagin at openvz.org
Wed Apr 24 02:46:21 EDT 2013
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
test/zdtm/live/static/caps00.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/test/zdtm/live/static/caps00.c b/test/zdtm/live/static/caps00.c
index 01cc1af..beb97ab 100644
--- a/test/zdtm/live/static/caps00.c
+++ b/test/zdtm/live/static/caps00.c
@@ -2,6 +2,8 @@
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
+#include <sys/prctl.h>
+#include <linux/capability.h>
#include "zdtmtst.h"
@@ -61,6 +63,11 @@ int main(int argc, char **argv)
struct cap_data data[_LINUX_CAPABILITY_U32S_3];
struct cap_data data_2[_LINUX_CAPABILITY_U32S_3];
+ if (prctl(PR_CAPBSET_DROP, CAP_SETPCAP, 0, 0, 0)) {
+ err("PR_CAPBSET_DROP");
+ return -1;
+ }
+
hdr.version = _LINUX_CAPABILITY_VERSION_3;
hdr.pid = 0;
@@ -114,6 +121,11 @@ int main(int argc, char **argv)
goto bad;
}
+ if (prctl(PR_CAPBSET_READ, CAP_SETPCAP, 0, 0, 0) != 0) {
+ res='5';
+ goto bad;
+ }
+
res = '0';
bad:
write(result_pipe[1], &res, 1);
--
1.8.2
More information about the CRIU
mailing list