]> git.ipfire.org Git - thirdparty/lxc.git/commit
seccomp: simplify and fix rule parsing
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 23 Jul 2015 09:10:18 +0000 (11:10 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 13 Aug 2015 19:58:25 +0000 (15:58 -0400)
commit04c3432004cc805e3bb6e1159769adf416c9b913
treeee8a868aca4768bfd0f54b3e22b1ebd6de0c0705
parente76c508443dedcbbce22f27a912776c73b4d4c3f
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