This is the needed refactor for the selinux fixes, as discussed on
Patch the first 2 patches address old, currently not so relevant bugs
which will become more serious once the refactor is applied.
Patches 3-7 are pre-reqs for the bulk changes, but also IMHO nice to
have even stand-alone.
The main change, introduced by patch 8, consists in moving the first
subflow initialization from the msk init callback into the mptcp
syscall needing such data (namely: bind, listen, connect).
Patches 9, 10, 11 are not strictly needed, but are some nice to have
follow-up, cleaning-up the related code.
Specifically patch 10 closes issues/290
Finally patches 12 && 13 address the LSM issue. They really target the
LSM subtree, and are added here just to allow verify the fix in our
tree before the LSM submission.
Sharing after little testing to get feedback and let the bot massage
the new code: a couple of patches can have subtle effect, I would like to
have syzkaller digest them for a while.
Paolo Abeni (13):
mptcp: fix locking for setsockopt corner-case
mptcp: fix locking for in-kernel listener creation.
mptcp: refactor passive socket initialization.
mptcp: drop unneeded argument
mptcp: drop legacy code.
mptcp: avoid unneeded __mptcp_nmpc_socket() usage
mptcp: move fastopen subflow check inside mptcp_sendmsg_fastopen()
mptcp: move first subflow allocation at mpc access time
mptcp: do not keep around the first subflow after disconnect.
mptcp: fastclose msk when cleaning unaccepted sockets
mptcp: refactor mptcp_stream_accept()
security, lsm: Introduce security_mptcp_add_subflow()
selinux: Implement mptcp_add_subflow hook
include/linux/lsm_hook_defs.h | 1 +
include/linux/lsm_hooks.h | 9 ++
include/linux/security.h | 6 ++
net/mptcp/options.c | 9 +-
net/mptcp/pm.c | 4 +-
net/mptcp/pm_netlink.c | 14 +--
net/mptcp/protocol.c | 163 ++++++++++++++++++----------------
net/mptcp/protocol.h | 4 +-
net/mptcp/sockopt.c | 29 +++---
net/mptcp/subflow.c | 48 +++++++---
security/security.c | 5 ++
security/selinux/hooks.c | 16 ++++
security/selinux/netlabel.c | 8 +-
13 files changed, 198 insertions(+), 118 deletions(-)