mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 22:46:16 +02:00
b90a435332
What we basically want is a seccomp mode 2 BPF program like this but for every architecture: BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, nr)), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, __NR_chown, 4, 0), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, __NR_fchown, 3, 0), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, __NR_fchownat, 2, 0), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, __NR_lchown, 1, 0), BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW), BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ERRNO) However, on 32 bit architectures we do have chown32, lchown32 and fchown32, so we'd need to add all the architecture blurb which libseccomp handles for us. So we only need to make sure that we add the 32bit seccomp arch while we're on x86_64 and otherwise we just stay at the native architecture which was set during seccomp_init(), which more or less replicates setting 32bit personality during runChild(). The FORCE_SUCCESS() macro here could be a bit less ugly but I think repeating the seccomp_rule_add() all over the place is way uglier. Another way would have been to create a vector of syscalls to iterate over, but that would make error messages uglier because we can either only print the (libseccomp-internal) syscall number or use seccomp_syscall_resolve_num_arch() to get the name or even make the vector a pair number/name, essentially duplicating everything again. Signed-off-by: aszlig <aszlig@redmoonstudios.org> |
||
---|---|---|
.. | ||
binary-cache-store.cc | ||
binary-cache-store.hh | ||
build.cc | ||
builtins.cc | ||
builtins.hh | ||
crypto.cc | ||
crypto.hh | ||
derivations.cc | ||
derivations.hh | ||
download.cc | ||
download.hh | ||
export-import.cc | ||
fs-accessor.hh | ||
gc.cc | ||
globals.cc | ||
globals.hh | ||
http-binary-cache-store.cc | ||
local-binary-cache-store.cc | ||
local-fs-store.cc | ||
local-store.cc | ||
local-store.hh | ||
local.mk | ||
misc.cc | ||
nar-accessor.cc | ||
nar-accessor.hh | ||
nar-info-disk-cache.cc | ||
nar-info-disk-cache.hh | ||
nar-info.cc | ||
nar-info.hh | ||
nix-store.pc.in | ||
optimise-store.cc | ||
pathlocks.cc | ||
pathlocks.hh | ||
profiles.cc | ||
profiles.hh | ||
references.cc | ||
references.hh | ||
remote-fs-accessor.cc | ||
remote-fs-accessor.hh | ||
remote-store.cc | ||
remote-store.hh | ||
s3-binary-cache-store.cc | ||
s3-binary-cache-store.hh | ||
sandbox-defaults.sb.in | ||
schema.sql | ||
sqlite.cc | ||
sqlite.hh | ||
ssh-store.cc | ||
store-api.cc | ||
store-api.hh | ||
worker-protocol.hh |