Commit ed9d85c3 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

test: seccomp -- Make sure __NR_seccomp is present to not fail building on old kernels

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 377601f9
......@@ -4,19 +4,25 @@
#include <stddef.h>
#include <sys/prctl.h>
#include <sys/ptrace.h>
#include <linux/seccomp.h>
#include <linux/filter.h>
#include <linux/limits.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#ifdef __NR_seccomp
#include <linux/seccomp.h>
#include <linux/filter.h>
#endif
#include "zdtmtst.h"
const char *test_doc = "Check that SECCOMP_MODE_FILTER is restored";
const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>";
#ifdef __NR_seccomp
int get_seccomp_mode(pid_t pid)
{
FILE *f;
......@@ -185,3 +191,9 @@ err:
kill(pid, SIGKILL);
return 1;
}
#else /* __NR_seccomp */
#include "skip-me.c"
#endif /* __NR_seccomp */
......@@ -4,19 +4,25 @@
#include <stddef.h>
#include <sys/prctl.h>
#include <sys/ptrace.h>
#include <linux/seccomp.h>
#include <linux/filter.h>
#include <linux/limits.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#ifdef __NR_seccomp
# include <linux/seccomp.h>
# include <linux/filter.h>
# include <linux/limits.h>
#endif
#include "zdtmtst.h"
const char *test_doc = "Check that SECCOMP_MODE_FILTER is restored";
const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>";
#ifdef __NR_seccomp
int get_seccomp_mode(pid_t pid)
{
FILE *f;
......@@ -174,3 +180,10 @@ err:
kill(pid, SIGKILL);
return 1;
}
#else /* __NR_seccomp */
#include "skip-me.c"
#endif /* __NR_seccomp */
......@@ -4,15 +4,19 @@
#include <stddef.h>
#include <sys/prctl.h>
#include <sys/ptrace.h>
#include <linux/seccomp.h>
#include <linux/filter.h>
#include <linux/limits.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <pthread.h>
#ifdef __NR_seccomp
# include <linux/seccomp.h>
# include <linux/filter.h>
# include <linux/limits.h>
# include <pthread.h>
#endif
#include "zdtmtst.h"
#ifndef SECCOMP_SET_MODE_FILTER
......@@ -26,6 +30,8 @@
const char *test_doc = "Check that SECCOMP_FILTER_FLAG_TSYNC works correctly after restore";
const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>";
#ifdef __NR_seccomp
pthread_mutex_t getpid_wait;
int get_seccomp_mode(pid_t pid)
......@@ -200,3 +206,9 @@ err:
kill(pid, SIGKILL);
return 1;
}
#else /* __NR_seccomp */
#include "skip-me.c"
#endif /* __NR_seccomp */
......@@ -2,18 +2,24 @@
#include <stdbool.h>
#include <signal.h>
#include <sys/prctl.h>
#include <linux/seccomp.h>
#include <linux/limits.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#ifdef __NR_seccomp
# include <linux/seccomp.h>
# include <linux/limits.h>
#endif
#include "zdtmtst.h"
const char *test_doc = "Check that SECCOMP_MODE_STRICT is restored";
const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>";
#ifdef __NR_seccomp
int get_seccomp_mode(pid_t pid)
{
FILE *f;
......@@ -120,3 +126,9 @@ err:
kill(pid, SIGKILL);
return 1;
}
#else /* __NR_seccomp */
#include "skip-me.c"
#endif /* __NR_seccomp */
int main(int argc, char ** argv)
{
test_init(argc, argv);
test_msg("Skipping test on incompatible kernel");
test_daemon();
test_waitsig();
pass();
return 0;
}
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