]> git.ipfire.org Git - thirdparty/lxc.git/commit
seccomp: simplify and fix rule parsing 600/head
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 23 Jul 2015 09:10:18 +0000 (11:10 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 23 Jul 2015 11:28:40 +0000 (13:28 +0200)
commitd6417887b93477133a2c600ce755ba3afc843d44
tree441b9f3ef7927bfe59f5ffcdcd5f8ba66ef6909b
parentf5fd66f70ab513a1175f42ea8a878fc985725ce4
seccomp: simplify and fix rule parsing

1) Two checks on amd64 for whether compat_ctx has already
been generated were redundant, as compat_ctx is generally
generated before entering the parsing loop.

2) With introduction of reject_force_umount the check for
whether the syscall has the same id on both native and
compat archs results in false behavior as this is an
internal keyword and thus produces a -1 on
seccomp_syscall_resolve_name_arch().
The result was that it was added to the native architecture
twice and never to the 32 bit architecture, causing it to
have no effect on 32 bit containers on 64 bit hosts.

3) I do not see a reason to care about whether the syscalls
have the same number on the two architectures. On the one
hand this check was there to avoid adding it to two archs
(and effectively leaving one arch unprotected), while on
the other hand it seemed to be okay to add it to the
same arch *twice*.

The entire architecture checking branches are now reduced to
three simple cases: 'native', 'non-native' and 'all'. With
'all' adding to both architectures regardless of the syscall
ID.

Also note that libseccomp had a bug in its architecture
checking, so architecture related filters weren't working as
expected before version 2.2.2, which may have contributed to
the confusion in the original architecture-related code.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/lxc/seccomp.c