Slide 16
Slide 16 text
// seccomp BPF ϑΟϧλͷఆٛ
struct sock_filter filter[] = {
// 1. seccomp_data ߏମ͔Β arch ϑΟʔϧυͷΛϩʔυ
// γεςϜίʔϧΞʔΩςΫνϟʹΑͬͯ࠾൪͕ҟͳΔͨΊɺ
// ඞͣνΣοΫ͢Δඞཁ͕͋Δɻ
BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof(struct seccomp_data, arch))),
// 2. x86_64 Ҏ֎ͷ߹ SECCOMP_RET_KILL
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, AUDIT_ARCH_X86_64, 0, 4),
// 3. seccomp_data ߏମ͔Β nr ϑΟʔϧυͷΛϩʔυ
// ͜͜ʹγεςϜίʔϧ൪߸͕֨ೲ͞Ε͍ͯΔ
BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof(struct seccomp_data, nr))),
// 4. uname(2) Ͱ͋Ε SECCOMP_RET_ERRNO ͰEPERM Λฦ͢
// ͦΕҎ֎ͷ߹ڐՄ
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, SYS_uname, 0, 1),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | (EPERM & SECCOMP_RET_DATA)),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_KILL),
};
TBOECPYԽ͢ΔίʔυΛ༻ҙ
TFDDPNQ
Λ࣮ߦ͢ΔؔΛ༻ҙ
#1'ϑΟϧλΛఆٛ
TFDDPNQ
Λద༻
TFDDPNQ