]> granicus.if.org Git - strace/commitdiff
Assume that <linux/filter.h> is always available
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 8 Jul 2017 01:49:00 +0000 (01:49 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 8 Jul 2017 01:49:00 +0000 (01:49 +0000)
<linux/filter.h> was introduced in linux 2.1.75, way before
the minimal kernel version supported by strace.

* configure.ac (AC_CHECK_HEADERS): Remove linux/filter.h.
* seccomp.c: Assume HAVE_LINUX_FILTER_H.
* tests/prctl-seccomp-filter-v.c: Likewise.
* tests/seccomp-filter-v.c: Likewise.
* tests/seccomp-filter.c: Likewise.

configure.ac
seccomp.c
tests/prctl-seccomp-filter-v.c
tests/seccomp-filter-v.c
tests/seccomp-filter.c

index eb7b0e785a7fed5f73abeb1e98c7a13e4e8ada81..97fd149f9717d8cad0c62fc0aa417f28f1a5495c 100644 (file)
@@ -366,7 +366,6 @@ AC_CHECK_HEADERS(m4_normalize([
        linux/dqblk_xfs.h
        linux/falloc.h
        linux/fiemap.h
-       linux/filter.h
        linux/genetlink.h
        linux/hiddev.h
        linux/ip_vs.h
index 100b7d404eb6612e66450a82bb6869986a16d4c6..2625535aa3e277f7f25f810277e1161357c59487 100644 (file)
--- a/seccomp.c
+++ b/seccomp.c
 #include "xlat/seccomp_ops.h"
 #include "xlat/seccomp_filter_flags.h"
 
-#ifdef HAVE_LINUX_FILTER_H
-# include <linux/filter.h>
-# include "xlat/bpf_class.h"
-# include "xlat/bpf_miscop.h"
-# include "xlat/bpf_mode.h"
-# include "xlat/bpf_op_alu.h"
-# include "xlat/bpf_op_jmp.h"
-# include "xlat/bpf_rval.h"
-# include "xlat/bpf_size.h"
-# include "xlat/bpf_src.h"
-
-# ifndef SECCOMP_RET_ACTION
-#  define SECCOMP_RET_ACTION 0x7fff0000U
-# endif
-# include "xlat/seccomp_ret_action.h"
+#include <linux/filter.h>
+#include "xlat/bpf_class.h"
+#include "xlat/bpf_miscop.h"
+#include "xlat/bpf_mode.h"
+#include "xlat/bpf_op_alu.h"
+#include "xlat/bpf_op_jmp.h"
+#include "xlat/bpf_rval.h"
+#include "xlat/bpf_size.h"
+#include "xlat/bpf_src.h"
+
+#ifndef SECCOMP_RET_ACTION
+# define SECCOMP_RET_ACTION 0x7fff0000U
 #endif
+#include "xlat/seccomp_ret_action.h"
 
 struct bpf_filter {
        uint16_t code;
@@ -58,8 +56,6 @@ struct bpf_filter {
        uint32_t k;
 };
 
-#ifdef HAVE_LINUX_FILTER_H
-
 static void
 decode_bpf_code(uint16_t code)
 {
@@ -115,12 +111,9 @@ decode_bpf_code(uint16_t code)
 
 }
 
-#endif /* HAVE_LINUX_FILTER_H */
-
 static void
 decode_bpf_stmt(const struct bpf_filter *filter)
 {
-#ifdef HAVE_LINUX_FILTER_H
        tprints("BPF_STMT(");
        decode_bpf_code(filter->code);
        tprints(", ");
@@ -136,29 +129,17 @@ decode_bpf_stmt(const struct bpf_filter *filter)
        } else {
                tprintf("%#x)", filter->k);
        }
-#else
-       tprintf("BPF_STMT(%#x, %#x)", filter->code, filter->k);
-#endif /* HAVE_LINUX_FILTER_H */
 }
 
 static void
 decode_bpf_jump(const struct bpf_filter *filter)
 {
-#ifdef HAVE_LINUX_FILTER_H
        tprints("BPF_JUMP(");
        decode_bpf_code(filter->code);
        tprintf(", %#x, %#x, %#x)",
                filter->k, filter->jt, filter->jf);
-#else
-       tprintf("BPF_JUMP(%#x, %#x, %#x, %#x)",
-               filter->code, filter->k, filter->jt, filter->jf);
-#endif /* HAVE_LINUX_FILTER_H */
 }
 
-#ifndef BPF_MAXINSNS
-# define BPF_MAXINSNS 4096
-#endif
-
 static bool
 print_bpf_filter(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 {
index 69316fbedb7cfdf440134873dcc685ef84aa6d4f..a72c0f6d6072d736125bcba5707411b63448a89c 100644 (file)
@@ -40,9 +40,7 @@
 #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 HAVE_PRCTL \
  && defined PR_SET_NO_NEW_PRIVS \
index f65be7d811dab7e1f33ee7b50be79f97fea0a24e..e419c6cb74262912d14d3e0963ab0a2153b88717 100644 (file)
@@ -42,9 +42,7 @@
 #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 \
@@ -91,10 +89,6 @@ static const struct sock_filter filter_c[] = {
        SOCK_FILTER_KILL_PROCESS
 };
 
-#ifndef BPF_MAXINSNS
-# define BPF_MAXINSNS 4096
-#endif
-
 int
 main(void)
 {
index e2bea0611dab59ca41461b35a92bc4b8db5911a2..6e009823470fe0e919fcd955e42997d0dd4b6c51 100644 (file)
@@ -37,9 +37,7 @@
 #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 SECCOMP_SET_MODE_FILTER