]> git.proxmox.com Git - mirror_lxc.git/commit
seccomp: use SOCK_SEQPACKET for the notify proxy
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 5 Jul 2019 07:31:09 +0000 (09:31 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 9 Jul 2019 10:25:10 +0000 (12:25 +0200)
commit045ee7210dbe4ca1f250128e3ea4dc2cf7ec519c
treef9a6d0569fd718f6bb03944ddd8f7727a6259114
parentf910c9e526eb8fbc80d61d56786b80f1b0a0587a
seccomp: use SOCK_SEQPACKET for the notify proxy

The seccomp notify API has a few variables: The struct sizes
are queried at runtime, and we now also have a user
configured cookie.
This means that with a SOCK_STREAM connection the proxy
needs to carefully read() the right amount of data based on
the contents of our proxy message struct to avoid ending up
in the middle of a packet.
While for now this may not be too tragic, since we currently
only ever send a single packet and then wait for the
response, we may at some point want to be able to handle
multiple processes simultaneously, hence it makes sense to
switch to a packet based connection.

So switch to using SOCK_SEQPACKET which is packet based,
(and also guarantees ordering). The `MSG_PEEK` flag can be
used with `recvmsg()` to figure out a packet's size on the
other end, and usually the size *should* not change after
that for an existing connection from a running container.

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