* Check verbose decoding of seccomp SECCOMP_SET_MODE_FILTER.
*
* Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2016-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
-#include <sys/syscall.h>
+#include <asm/unistd.h>
#include <unistd.h>
#ifdef HAVE_PRCTL
#ifdef HAVE_LINUX_SECCOMP_H
# include <linux/seccomp.h>
#endif
-#ifdef HAVE_LINUX_FILTER_H
-# include <linux/filter.h>
-#endif
+#include <linux/filter.h>
#if defined __NR_seccomp \
&& defined PR_SET_NO_NEW_PRIVS \
SOCK_FILTER_KILL_PROCESS
};
-#ifndef BPF_MAXINSNS
-# define BPF_MAXINSNS 4096
-#endif
-
int
main(void)
{
tail_memdup(filter_c, sizeof(filter_c));
struct sock_filter *const big_filter =
tail_alloc(sizeof(*big_filter) * (BPF_MAXINSNS + 1));
- struct sock_fprog *const prog = tail_alloc(sizeof(*prog));
+ TAIL_ALLOC_OBJECT_CONST_PTR(struct sock_fprog, prog);
int fds[2];
if (pipe(fds))
for (i = 0; i < BPF_MAXINSNS; ++i) {
if (i)
tprintf(", ");
- switch(BPF_CLASS(i)) {
+ switch (BPF_CLASS(i)) {
case BPF_LD:
tprintf("BPF_STMT(BPF_LD|BPF_W|BPF_IMM, %#x)", i << 16);
break;