linux/net/rxrpc
David Howells d001648ec7 rxrpc: Don't expose skbs to in-kernel users [ver #2]
Don't expose skbs to in-kernel users, such as the AFS filesystem, but
instead provide a notification hook the indicates that a call needs
attention and another that indicates that there's a new call to be
collected.

This makes the following possibilities more achievable:

 (1) Call refcounting can be made simpler if skbs don't hold refs to calls.

 (2) skbs referring to non-data events will be able to be freed much sooner
     rather than being queued for AFS to pick up as rxrpc_kernel_recv_data
     will be able to consult the call state.

 (3) We can shortcut the receive phase when a call is remotely aborted
     because we don't have to go through all the packets to get to the one
     cancelling the operation.

 (4) It makes it easier to do encryption/decryption directly between AFS's
     buffers and sk_buffs.

 (5) Encryption/decryption can more easily be done in the AFS's thread
     contexts - usually that of the userspace process that issued a syscall
     - rather than in one of rxrpc's background threads on a workqueue.

 (6) AFS will be able to wait synchronously on a call inside AF_RXRPC.

To make this work, the following interface function has been added:

     int rxrpc_kernel_recv_data(
		struct socket *sock, struct rxrpc_call *call,
		void *buffer, size_t bufsize, size_t *_offset,
		bool want_more, u32 *_abort_code);

This is the recvmsg equivalent.  It allows the caller to find out about the
state of a specific call and to transfer received data into a buffer
piecemeal.

afs_extract_data() and rxrpc_kernel_recv_data() now do all the extraction
logic between them.  They don't wait synchronously yet because the socket
lock needs to be dealt with.

Five interface functions have been removed:

	rxrpc_kernel_is_data_last()
    	rxrpc_kernel_get_abort_code()
    	rxrpc_kernel_get_error_number()
    	rxrpc_kernel_free_skb()
    	rxrpc_kernel_data_consumed()

As a temporary hack, sk_buffs going to an in-kernel call are queued on the
rxrpc_call struct (->knlrecv_queue) rather than being handed over to the
in-kernel user.  To process the queue internally, a temporary function,
temp_deliver_data() has been added.  This will be replaced with common code
between the rxrpc_recvmsg() path and the kernel_rxrpc_recv_data() path in a
future patch.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-09-01 16:43:27 -07:00
..
af_rxrpc.c rxrpc: Don't expose skbs to in-kernel users [ver #2] 2016-09-01 16:43:27 -07:00
ar-internal.h rxrpc: Don't expose skbs to in-kernel users [ver #2] 2016-09-01 16:43:27 -07:00
call_accept.c rxrpc: Don't expose skbs to in-kernel users [ver #2] 2016-09-01 16:43:27 -07:00
call_event.c rxrpc: Use call->peer rather than going to the connection 2016-08-30 16:07:53 +01:00
call_object.c rxrpc: Don't expose skbs to in-kernel users [ver #2] 2016-09-01 16:43:27 -07:00
conn_client.c rxrpc: Trace rxrpc_call usage 2016-08-30 16:02:36 +01:00
conn_event.c rxrpc: Don't expose skbs to in-kernel users [ver #2] 2016-09-01 16:43:27 -07:00
conn_object.c rxrpc: Calls should only have one terminal state 2016-08-30 15:58:31 +01:00
conn_service.c rxrpc: Improve management and caching of client connection objects 2016-08-24 15:17:14 +01:00
input.c rxrpc: Don't expose skbs to in-kernel users [ver #2] 2016-09-01 16:43:27 -07:00
insecure.c rxrpc: Avoid using stack memory in SG lists in rxkad 2016-07-06 10:43:05 +01:00
Kconfig rxrpc: Absorb the rxkad security module 2016-04-11 15:34:41 -04:00
key.c rxrpc: Use structs to hold connection params and protocol info 2016-06-22 09:09:59 +01:00
local_event.c rxrpc: Use a tracepoint for skb accounting debugging 2016-08-23 15:27:24 +01:00
local_object.c rxrpc: Add RCU destruction for connections and calls 2016-07-06 10:43:51 +01:00
Makefile rxrpc: Split service connection code out into its own file 2016-07-06 10:49:35 +01:00
misc.c rxrpc: Limit the listening backlog 2016-06-10 18:14:47 -07:00
output.c rxrpc: Don't expose skbs to in-kernel users [ver #2] 2016-09-01 16:43:27 -07:00
peer_event.c rxrpc: Trace rxrpc_call usage 2016-08-30 16:02:36 +01:00
peer_object.c rxrpc: Provide a way for AFS to ask for the peer address of a call 2016-08-30 16:07:53 +01:00
proc.c rxrpc: Calls should only have one terminal state 2016-08-30 15:58:31 +01:00
recvmsg.c rxrpc: Don't expose skbs to in-kernel users [ver #2] 2016-09-01 16:43:27 -07:00
rxkad.c rxrpc: Drop channel number field from rxrpc_call struct 2016-08-23 15:27:24 +01:00
security.c rxrpc: Replace conn->trans->{local,peer} with conn->params.{local,peer} 2016-06-22 09:10:00 +01:00
skbuff.c rxrpc: Don't expose skbs to in-kernel users [ver #2] 2016-09-01 16:43:27 -07:00
sysctl.c rxrpc: Improve management and caching of client connection objects 2016-08-24 15:17:14 +01:00
utils.c rxrpc: Move data_ready peer lookup into rxrpc_find_connection() 2016-07-06 10:51:14 +01:00