lix/src
aszlig b90a435332
libstore/build: Forge chown() to return success
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>
2016-11-16 16:48:30 +01:00
..
boost Force stack trace for boost format errors 2016-03-02 15:46:07 +01:00
buildenv Fix Fedora build 2016-08-30 13:56:22 +02:00
download-via-ssh printMsg(lvlError, ...) -> printError(...) etc. 2016-09-21 16:54:53 +02:00
libexpr Fix comments parsing 2016-11-13 17:20:34 +01:00
libmain Shut up some warnings 2016-10-12 15:53:38 +02:00
libstore libstore/build: Forge chown() to return success 2016-11-16 16:48:30 +01:00
libutil Add missing #include 2016-11-07 14:35:47 +01:00
nix Store::computeFSClosure(): Support a set of paths 2016-11-10 17:45:04 +01:00
nix-build Fix Darwin build 2016-10-19 15:21:18 +02:00
nix-channel Enable HTTP/2 support 2016-09-14 16:36:02 +02:00
nix-collect-garbage printMsg(lvlError, ...) -> printError(...) etc. 2016-09-21 16:54:53 +02:00
nix-daemon Merge branch 'ssh-store' of https://github.com/shlevy/nix 2016-11-09 18:57:22 +01:00
nix-env printMsg(lvlError, ...) -> printError(...) etc. 2016-09-21 16:54:53 +02:00
nix-instantiate Allow setting the state directory as a store parameter 2016-06-02 16:02:48 +02:00
nix-prefetch-url printMsg(lvlError, ...) -> printError(...) etc. 2016-09-21 16:54:53 +02:00
nix-store Store::computeFSClosure(): Support a set of paths 2016-11-10 17:45:04 +01:00
resolve-system-dependencies printMsg(lvlError, ...) -> printError(...) etc. 2016-09-21 16:54:53 +02:00