10 #include <rump/rump_syscalls.h>
13 ATF_TC_HEAD(div_by_zero
, tc
)
16 atf_tc_set_md_var(tc
, "descr", "Check that BPF rejects a filter "
17 "which divides by 0");
20 ATF_TC_BODY(div_by_zero
, tc
)
22 struct bpf_program bp
;
26 * Source code for following program:
29 struct bpf_insn bins
[] = {
30 { 0x20, 0, 0, 0x00000000 },
31 { 0x34, 0, 0, 0x00000000 },
32 { 0x15, 0, 1, 0x00000002 },
33 { 0x6, 0, 0, 0x00000060 },
34 { 0x6, 0, 0, 0x00000000 },
37 bp
.bf_len
= __arraycount(bins
);
41 fd
= rump_sys_open("/dev/bpf", O_RDWR
);
43 ATF_REQUIRE_EQ_MSG(rump_sys_ioctl(fd
, BIOCSETF
, &bp
), -1,
44 "bpf accepted program with division by zero");
50 ATF_TP_ADD_TC(tp
, div_by_zero
);
51 return atf_no_error();