Commit 42d861bb authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm: check bset in caps00

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 803321ab
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/prctl.h>
#include <linux/capability.h>
#include "zdtmtst.h" #include "zdtmtst.h"
...@@ -61,6 +63,11 @@ int main(int argc, char **argv) ...@@ -61,6 +63,11 @@ int main(int argc, char **argv)
struct cap_data data[_LINUX_CAPABILITY_U32S_3]; struct cap_data data[_LINUX_CAPABILITY_U32S_3];
struct cap_data data_2[_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.version = _LINUX_CAPABILITY_VERSION_3;
hdr.pid = 0; hdr.pid = 0;
...@@ -114,6 +121,11 @@ int main(int argc, char **argv) ...@@ -114,6 +121,11 @@ int main(int argc, char **argv)
goto bad; goto bad;
} }
if (prctl(PR_CAPBSET_READ, CAP_SETPCAP, 0, 0, 0) != 0) {
res='5';
goto bad;
}
res = '0'; res = '0';
bad: bad:
write(result_pipe[1], &res, 1); write(result_pipe[1], &res, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment