Closed Martins3 closed 3 years ago
不知道为什么上一次测试可以通过,很恐怖。
失败的原因都是因为 doesn't permit, 因为这些系统调用都是首先模拟,然后 ioctl 进入虚拟机,这些 ioctl 不能被满足
static const struct sock_filter strict_filter[] = {
BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof (struct seccomp_data, nr))),
BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_ioctl, 6, 0),
BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_close, 5, 0),
BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_exit, 4, 0),
BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_wait4, 3, 0),
BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_write, 2, 0),
BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_clone, 1, 0),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_KILL),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW)
};
如果让 ioctl 在 FILTER 模式下可以被运行,那么就只有下面的失败了:
prctl04.c:199: TFAIL: SECCOMP_MODE_STRICT doesn't permit read(2) write(2) and _exit(2)