Assume that <linux/filter.h> is always available

<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.
This commit is contained in:
Дмитрий Левин 2017-07-08 01:49:00 +00:00
parent e8eaee3563
commit cc5db1c893
5 changed files with 15 additions and 45 deletions

View 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

View File

@ -34,22 +34,20 @@
#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"
#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"
#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)
{

View 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 \

View 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)
{

View 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