linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] mptcp: reject invalid mp_join requests right away
@ 2020-11-30 15:36 Florian Westphal
  2020-11-30 15:36 ` [PATCH net-next 1/3] security: add const qualifier to struct sock in various places Florian Westphal
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Florian Westphal @ 2020-11-30 15:36 UTC (permalink / raw)
  To: netdev; +Cc: mptcp, linux-security-module

At the moment MPTCP can detect an invalid join request (invalid token,
max number of subflows reached, and so on) right away but cannot reject
the connection until the 3WHS has completed.
Instead the connection will complete and the subflow is reset afterwards.

To send the reset most information is already available, but we don't have
good spot where the reset could be sent:

1. The ->init_req callback is too early and also doesn't allow to return an
   error that could be used to inform the TCP stack that the SYN should be
   dropped.

2. The ->route_req callback lacks the skb needed to send a reset.

3. The ->send_synack callback is the best fit from the available hooks,
   but its called after the request socket has been inserted into the queue
   already. This means we'd have to remove it again right away.

From a technical point of view, the second hook would be best:
 1. Its before insertion into listener queue.
 2. If it returns NULL TCP will drop the packet for us.

Problem is that we'd have to pass the skb to the function just for MPTCP.

Paolo suggested to merge init_req and route_req callbacks instead:
This makes all info available to MPTCP -- a return value of NULL drops the
packet and MPTCP can send the reset if needed.

Because 'route_req' has a 'const struct sock *', this means either removal
of const qualifier, or a bit of code churn to pass 'const' in security land.

This does the latter; I did not find any spots that need write access to struct
sock.

To recap, the two alternatives are:
1. Solve it entirely in MPTCP: use the ->send_synack callback to
   unlink the request socket from the listener & drop it.
2. Avoid 'security' churn by removing the const qualifier.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-03 22:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-30 15:36 [PATCH net-next 0/3] mptcp: reject invalid mp_join requests right away Florian Westphal
2020-11-30 15:36 ` [PATCH net-next 1/3] security: add const qualifier to struct sock in various places Florian Westphal
2020-12-02 19:28   ` Jakub Kicinski
2020-12-03 17:07     ` James Morris
2020-12-03 22:24       ` Jakub Kicinski
2020-11-30 15:36 ` [PATCH net-next 2/3] tcp: merge 'init_req' and 'route_req' functions Florian Westphal
2020-11-30 15:36 ` [PATCH net-next 3/3] mptcp: emit tcp reset when a join request fails Florian Westphal
2020-12-01 22:33   ` [MPTCP] " Mat Martineau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).