tree-wide: ignore messages with too long control data
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Jan 2021 20:34:20 +0000 (21:34 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 2 Feb 2021 13:52:53 +0000 (14:52 +0100)
commitb7e0ac754eba3c91b76dc7b92802716144b569b8
tree454b93aa3ccfaecf0b9c392ab7e188fc1d08bf86
parenta054fe9c8975ce10d70abc3a268a3f596190e4f9
tree-wide: ignore messages with too long control data

Apparently SELinux inserts control data into AF_UNIX datagrams where we
don't expect it, thus miscalculating the control data. This looks like
something to fix in SELinux, but we still should handle this gracefully
and just drop the offending datagram and continue.

recvmsg_safe() actually already drops the datagram, it's just a matter
of actually ignoring EXFULL (which it generates if control data is too
large) in the right places.

This does this wherever an AF_UNIX/SOCK_DGRAM socket is used with
recvmsg_safe() that is not just internal communication.

Fixes: #17795
Follow-up for: 3691bcf3c5eebdcca5b4f1c51c745441c57a6cd1

(cherry picked from commit 741bfd7f4e60fdc07ecaadbd93f1196dbee657ca)
src/core/manager.c
src/nspawn/nspawn.c
src/shared/ask-password-api.c