<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/net/rxrpc/call_accept.c, branch linux-5.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2018-10-19T18:03:06Z</updated>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2018-10-19T18:03:06Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2018-10-19T18:03:06Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2e2d6f0342be7f73a34526077fa96f42f0e8c661'/>
<id>urn:sha1:2e2d6f0342be7f73a34526077fa96f42f0e8c661</id>
<content type='text'>
net/sched/cls_api.c has overlapping changes to a call to
nlmsg_parse(), one (from 'net') added rtm_tca_policy instead of NULL
to the 5th argument, and another (from 'net-next') added cb-&gt;extack
instead of NULL to the 6th argument.

net/ipv4/ipmr_base.c is a case of a bug fix in 'net' being done to
code which moved (to mr_table_dump)) in 'net-next'.  Thanks to David
Ahern for the heads up.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rxrpc: Fix an uninitialised variable</title>
<updated>2018-10-16T05:07:36Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2018-10-11T21:32:31Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=d7b4c24f45d2efe51b8f213da4593fefd49240ba'/>
<id>urn:sha1:d7b4c24f45d2efe51b8f213da4593fefd49240ba</id>
<content type='text'>
Fix an uninitialised variable introduced by the last patch.  This can cause
a crash when a new call comes in to a local service, such as when an AFS
fileserver calls back to the local cache manager.

Fixes: c1e15b4944c9 ("rxrpc: Fix the packet reception routine")
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2018-10-13T04:38:46Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2018-10-13T04:38:46Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=d864991b220b7c62e81d21209e1fd978fd67352c'/>
<id>urn:sha1:d864991b220b7c62e81d21209e1fd978fd67352c</id>
<content type='text'>
Conflicts were easy to resolve using immediate context mostly,
except the cls_u32.c one where I simply too the entire HEAD
chunk.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rxrpc: Fix the packet reception routine</title>
<updated>2018-10-08T21:42:04Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2018-10-08T14:46:25Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c1e15b4944c9fa7fbbb74f7a5920a1e31b4b965a'/>
<id>urn:sha1:c1e15b4944c9fa7fbbb74f7a5920a1e31b4b965a</id>
<content type='text'>
The rxrpc_input_packet() function and its call tree was built around the
assumption that data_ready() handler called from UDP to inform a kernel
service that there is data to be had was non-reentrant.  This means that
certain locking could be dispensed with.

This, however, turns out not to be the case with a multi-queue network card
that can deliver packets to multiple cpus simultaneously.  Each of those
cpus can be in the rxrpc_input_packet() function at the same time.

Fix by adding or changing some structure members:

 (1) Add peer-&gt;rtt_input_lock to serialise access to the RTT buffer.

 (2) Make conn-&gt;service_id into a 32-bit variable so that it can be
     cmpxchg'd on all arches.

 (3) Add call-&gt;input_lock to serialise access to the Rx/Tx state.  Note
     that although the Rx and Tx states are (almost) entirely separate,
     there's no point completing the separation and having separate locks
     since it's a bi-phasal RPC protocol rather than a bi-direction
     streaming protocol.  Data transmission and data reception do not take
     place simultaneously on any particular call.

and making the following functional changes:

 (1) In rxrpc_input_data(), hold call-&gt;input_lock around the core to
     prevent simultaneous producing of packets into the Rx ring and
     updating of tracking state for a particular call.

 (2) In rxrpc_input_ping_response(), only read call-&gt;ping_serial once, and
     check it before checking RXRPC_CALL_PINGING as that's a cheaper test.
     The bit test and bit clear can then be combined.  No further locking
     is needed here.

 (3) In rxrpc_input_ack(), take call-&gt;input_lock after we've parsed much of
     the ACK packet.  The superseded ACK check is then done both before and
     after the lock is taken.

     The handing of ackinfo data is split, parsing before the lock is taken
     and processing with it held.  This is keyed on rxMTU being non-zero.

     Congestion management is also done within the locked section.

 (4) In rxrpc_input_ackall(), take call-&gt;input_lock around the Tx window
     rotation.  The ACKALL packet carries no information and is only really
     useful after all packets have been transmitted since it's imprecise.

 (5) In rxrpc_input_implicit_end_call(), we use rx-&gt;incoming_lock to
     prevent calls being simultaneously implicitly ended on two cpus and
     also to prevent any races with incoming call setup.

 (6) In rxrpc_input_packet(), use cmpxchg() to effect the service upgrade
     on a connection.  It is only permitted to happen once for a
     connection.

 (7) In rxrpc_new_incoming_call(), we have to recheck the routing inside
     rx-&gt;incoming_lock to see if someone else set up the call, connection
     or peer whilst we were getting there.  We can't trust the values from
     the earlier routing check unless we pin refs on them - which we want
     to avoid.

     Further, we need to allow for an incoming call to have its state
     changed on another CPU between us making it live and us adjusting it
     because the conn is now in the RXRPC_CONN_SERVICE state.

 (8) In rxrpc_peer_add_rtt(), take peer-&gt;rtt_input_lock around the access
     to the RTT buffer.  Don't need to lock around setting peer-&gt;rtt.

For reference, the inventory of state-accessing or state-altering functions
used by the packet input procedure is:

&gt; rxrpc_input_packet()
  * PACKET CHECKING

  * ROUTING
    &gt; rxrpc_post_packet_to_local()
    &gt; rxrpc_find_connection_rcu() - uses RCU
      &gt; rxrpc_lookup_peer_rcu() - uses RCU
      &gt; rxrpc_find_service_conn_rcu() - uses RCU
      &gt; idr_find() - uses RCU

  * CONNECTION-LEVEL PROCESSING
    - Service upgrade
      - Can only happen once per conn
      ! Changed to use cmpxchg
    &gt; rxrpc_post_packet_to_conn()
    - Setting conn-&gt;hi_serial
      - Probably safe not using locks
      - Maybe use cmpxchg

  * CALL-LEVEL PROCESSING
    &gt; Old-call checking
      &gt; rxrpc_input_implicit_end_call()
        &gt; rxrpc_call_completed()
	&gt; rxrpc_queue_call()
	! Need to take rx-&gt;incoming_lock
	&gt; __rxrpc_disconnect_call()
	&gt; rxrpc_notify_socket()
    &gt; rxrpc_new_incoming_call()
      - Uses rx-&gt;incoming_lock for the entire process
        - Might be able to drop this earlier in favour of the call lock
      &gt; rxrpc_incoming_call()
      	! Conflicts with rxrpc_input_implicit_end_call()
    &gt; rxrpc_send_ping()
      - Don't need locks to check rtt state
      &gt; rxrpc_propose_ACK

  * PACKET DISTRIBUTION
    &gt; rxrpc_input_call_packet()
      &gt; rxrpc_input_data()
	* QUEUE DATA PACKET ON CALL
	&gt; rxrpc_reduce_call_timer()
	  - Uses timer_reduce()
	! Needs call-&gt;input_lock()
	&gt; rxrpc_receiving_reply()
	  ! Needs locking around ack state
	  &gt; rxrpc_rotate_tx_window()
	  &gt; rxrpc_end_tx_phase()
	&gt; rxrpc_proto_abort()
	&gt; rxrpc_input_dup_data()
	- Fills the Rx buffer
	- rxrpc_propose_ACK()
	- rxrpc_notify_socket()

      &gt; rxrpc_input_ack()
	* APPLY ACK PACKET TO CALL AND DISCARD PACKET
	&gt; rxrpc_input_ping_response()
	  - Probably doesn't need any extra locking
	  ! Need READ_ONCE() on call-&gt;ping_serial
	  &gt; rxrpc_input_check_for_lost_ack()
	    - Takes call-&gt;lock to consult Tx buffer
	  &gt; rxrpc_peer_add_rtt()
	    ! Needs to take a lock (peer-&gt;rtt_input_lock)
	    ! Could perhaps manage with cmpxchg() and xadd() instead
	&gt; rxrpc_input_requested_ack
	  - Consults Tx buffer
	    ! Probably needs a lock
	  &gt; rxrpc_peer_add_rtt()
	&gt; rxrpc_propose_ack()
	&gt; rxrpc_input_ackinfo()
	  - Changes call-&gt;tx_winsize
	    ! Use cmpxchg to handle change
	    ! Should perhaps track serial number
	  - Uses peer-&gt;lock to record MTU specification changes
	&gt; rxrpc_proto_abort()
	! Need to take call-&gt;input_lock
	&gt; rxrpc_rotate_tx_window()
	&gt; rxrpc_end_tx_phase()
	&gt; rxrpc_input_soft_acks()
	- Consults the Tx buffer
	&gt; rxrpc_congestion_management()
	  - Modifies the Tx annotations
	  ! Needs call-&gt;input_lock()
	  &gt; rxrpc_queue_call()

      &gt; rxrpc_input_abort()
	* APPLY ABORT PACKET TO CALL AND DISCARD PACKET
	&gt; rxrpc_set_call_completion()
	&gt; rxrpc_notify_socket()

      &gt; rxrpc_input_ackall()
	* APPLY ACKALL PACKET TO CALL AND DISCARD PACKET
	! Need to take call-&gt;input_lock
	&gt; rxrpc_rotate_tx_window()
	&gt; rxrpc_end_tx_phase()

    &gt; rxrpc_reject_packet()

There are some functions used by the above that queue the packet, after
which the procedure is terminated:

 - rxrpc_post_packet_to_local()
   - local-&gt;event_queue is an sk_buff_head
   - local-&gt;processor is a work_struct
 - rxrpc_post_packet_to_conn()
   - conn-&gt;rx_queue is an sk_buff_head
   - conn-&gt;processor is a work_struct
 - rxrpc_reject_packet()
   - local-&gt;reject_queue is an sk_buff_head
   - local-&gt;processor is a work_struct

And some that offload processing to process context:

 - rxrpc_notify_socket()
   - Uses RCU lock
   - Uses call-&gt;notify_lock to call call-&gt;notify_rx
   - Uses call-&gt;recvmsg_lock to queue recvmsg side
 - rxrpc_queue_call()
   - call-&gt;processor is a work_struct
 - rxrpc_propose_ACK()
   - Uses call-&gt;lock to wrap __rxrpc_propose_ACK()

And a bunch that complete a call, all of which use call-&gt;state_lock to
protect the call state:

 - rxrpc_call_completed()
 - rxrpc_set_call_completion()
 - rxrpc_abort_call()
 - rxrpc_proto_abort()
   - Also uses rxrpc_queue_call()

Fixes: 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>rxrpc: Fix connection-level abort handling</title>
<updated>2018-10-08T21:42:04Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2018-10-08T14:46:17Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=647530924f47c93db472ee3cf43b7ef1425581b6'/>
<id>urn:sha1:647530924f47c93db472ee3cf43b7ef1425581b6</id>
<content type='text'>
Fix connection-level abort handling to cache the abort and error codes
properly so that a new incoming call can be properly aborted if it races
with the parent connection being aborted by another CPU.

The abort_code and error parameters can then be dropped from
rxrpc_abort_calls().

Fixes: f5c17aaeb2ae ("rxrpc: Calls should only have one terminal state")
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>rxrpc: Fix some missed refs to init_net</title>
<updated>2018-10-05T13:21:59Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2018-10-05T13:05:34Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=5e33a23ba4b56c109b732d57a0a76558a37d9ec5'/>
<id>urn:sha1:5e33a23ba4b56c109b732d57a0a76558a37d9ec5</id>
<content type='text'>
Fix some refs to init_net that should've been changed to the appropriate
network namespace.

Fixes: 2baec2c3f854 ("rxrpc: Support network namespacing")
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>rxrpc: Drop the local endpoint arg from rxrpc_extract_addr_from_skb()</title>
<updated>2018-10-04T08:32:28Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2018-10-04T08:32:28Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=5a790b7375414cffb0f7e8ab0f175d2e02a0af0e'/>
<id>urn:sha1:5a790b7375414cffb0f7e8ab0f175d2e02a0af0e</id>
<content type='text'>
rxrpc_extract_addr_from_skb() doesn't use the argument that points to the
local endpoint, so remove the argument.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>rxrpc: Make service call handling more robust</title>
<updated>2018-09-28T09:32:49Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2018-09-27T14:13:09Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=0099dc589bfa7caf6f2608c4cbc1181cfee22b0c'/>
<id>urn:sha1:0099dc589bfa7caf6f2608c4cbc1181cfee22b0c</id>
<content type='text'>
Make the following changes to improve the robustness of the code that sets
up a new service call:

 (1) Cache the rxrpc_sock struct obtained in rxrpc_data_ready() to do a
     service ID check and pass that along to rxrpc_new_incoming_call().
     This means that I can remove the check from rxrpc_new_incoming_call()
     without the need to worry about the socket attached to the local
     endpoint getting replaced - which would invalidate the check.

 (2) Cache the rxrpc_peer struct, thereby allowing the peer search to be
     done once.  The peer is passed to rxrpc_new_incoming_call(), thereby
     saving the need to repeat the search.

     This also reduces the possibility of rxrpc_publish_service_conn()
     BUG()'ing due to the detection of a duplicate connection, despite the
     initial search done by rxrpc_find_connection_rcu() having turned up
     nothing.

     This BUG() shouldn't ever get hit since rxrpc_data_ready() *should* be
     non-reentrant and the result of the initial search should still hold
     true, but it has proven possible to hit.

     I *think* this may be due to __rxrpc_lookup_peer_rcu() cutting short
     the iteration over the hash table if it finds a matching peer with a
     zero usage count, but I don't know for sure since it's only ever been
     hit once that I know of.

     Another possibility is that a bug in rxrpc_data_ready() that checked
     the wrong byte in the header for the RXRPC_CLIENT_INITIATED flag
     might've let through a packet that caused a spurious and invalid call
     to be set up.  That is addressed in another patch.

 (3) Fix __rxrpc_lookup_peer_rcu() to skip peer records that have a zero
     usage count rather than stopping and returning not found, just in case
     there's another peer record behind it in the bucket.

 (4) Don't search the peer records in rxrpc_alloc_incoming_call(), but
     rather either use the peer cached in (2) or, if one wasn't found,
     preemptively install a new one.

Fixes: 8496af50eb38 ("rxrpc: Use RCU to access a peer's service connection tree")
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>rxrpc: Emit BUSY packets when supposed to rather than ABORTs</title>
<updated>2018-09-28T09:32:19Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2018-09-27T14:13:08Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ece64fec164f523bfbe874abdef2a0e6ff376251'/>
<id>urn:sha1:ece64fec164f523bfbe874abdef2a0e6ff376251</id>
<content type='text'>
In the input path, a received sk_buff can be marked for rejection by
setting RXRPC_SKB_MARK_* in skb-&gt;mark and, if needed, some auxiliary data
(such as an abort code) in skb-&gt;priority.  The rejection is handled by
queueing the sk_buff up for dealing with in process context.  The output
code reads the mark and priority and, theoretically, generates an
appropriate response packet.

However, if RXRPC_SKB_MARK_BUSY is set, this isn't noticed and an ABORT
message with a random abort code is generated (since skb-&gt;priority wasn't
set to anything).

Fix this by outputting the appropriate sort of packet.

Also, whilst we're at it, most of the marks are no longer used, so remove
them and rename the remaining two to something more obvious.

Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
</content>
</entry>
<entry>
<title>rxrpc: Fix user call ID check in rxrpc_service_prealloc_one</title>
<updated>2018-08-01T18:49:49Z</updated>
<author>
<name>YueHaibing</name>
<email>yuehaibing@huawei.com</email>
</author>
<published>2018-08-01T12:27:23Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c01f6c9b3207e52fc9973a066a856ddf7a0538d8'/>
<id>urn:sha1:c01f6c9b3207e52fc9973a066a856ddf7a0538d8</id>
<content type='text'>
There just check the user call ID isn't already in use, hence should
compare user_call_ID with xcall-&gt;user_call_ID, which is current
node's user_call_ID.

Fixes: 540b1c48c37a ("rxrpc: Fix deadlock between call creation and sendmsg/recvmsg")
Suggested-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
