Netdev List
 help / color / mirror / Atom feed
From: Shannon Nelson <shannon.nelson@oracle.com>
To: Yossi Kuperman <yossiku@mellanox.com>,
	Steffen Klassert <steffen.klassert@secunet.com>
Cc: Aviv Heller <avivh@mellanox.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Boris Pismenny <borisp@mellanox.com>,
	Yevgeny Kliteynik <kliteyn@mellanox.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net v2 2/3] xfrm: Add an activate() offload dev op
Date: Sat, 2 Dec 2017 16:38:11 -0800	[thread overview]
Message-ID: <d9e31dd8-233d-ecf8-b93d-53b1b2d26a8c@oracle.com> (raw)
In-Reply-To: <4767ACB7-EBCF-407C-95C8-7345109D7544@mellanox.com>

On 12/2/2017 2:33 PM, Yossi Kuperman wrote:
> 
> 
>>> On 1 Dec 2017, at 9:09, Steffen Klassert <steffen.klassert@secunet.com> wrote:
>>>
>>> On Tue, Nov 28, 2017 at 07:55:41PM +0200, avivh@mellanox.com wrote:
>>> From: Aviv Heller <avivh@mellanox.com>
>>>
>>> Adding the state to the offload device prior to replay init in
>>> xfrm_state_construct() will result in NULL dereference if a matching
>>> ESP packet is received in between.
>>>
>>> In order to inhibit driver offload logic from processing the state's
>>> packets prior to the xfrm_state object being completely initialized and
>>> added to the SADBs, a new activate() operation was added to inform the
>>> driver the aforementioned conditions have been met.
>>
>> We discussed this already some time ago, and I still think that
>> we should fix this by setting XFRM_STATE_VALID only after the
>> state is fully initialized.
> 
> An upcoming patch will refactor the if statement (encap_type < 0) in xfrm_input, in order to support crypto offload with GRO disabled. Currently it doesn’t work. This entails yet another check for the validity of the state. Resulting in total of 3 copies: 1) for normal traffic, 2) GRO and 3) crypto offload.
> 
> Anyway, IMO it is not right that we (the driver) allow an incoming packet to be delivered while the SA is not yet ready. Rather than checking for an invalid input I prefer to make sure that such a case won’t happen in the first place.
> 
> To complete the picture, there is another patch to the driver which simply drop incoming packets that underwent successful decryption and haven’t been activated yet. Active state merely means that the SA is present in the driver’s hash table.
> 
> We can make a separate patch to set the state to valid once it is fully initialized, it make sense on its own.
> 
> What do you think?
> 

If the SA isn't ready, just don't tell the driver about it.  Please 
don't add yet another state for the driver to track.  This should be as 
simple as possible, and shouldn't be any more complex than the model 
already used by ndo_vlan_rx_add_vid and ndo_vlan_rx_kill_vid.

sln

  reply	other threads:[~2017-12-03  0:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 17:55 [PATCH net v2 1/3] xfrm: Fix xfrm_input() to verify state is valid when (encap_type < 0) avivh
2017-11-28 17:55 ` [PATCH net v2 2/3] xfrm: Add an activate() offload dev op avivh
2017-12-01  7:09   ` Steffen Klassert
2017-12-02 22:33     ` Yossi Kuperman
2017-12-03  0:38       ` Shannon Nelson [this message]
2017-12-03 21:09         ` Yossi Kuperman
2017-12-03 11:28       ` Boris Pismenny
2017-12-03 13:59         ` Yossi Kuperman
2017-12-01 19:47   ` Shannon Nelson
2017-12-02 22:11     ` Shannon Nelson
2017-12-03 22:16       ` Yossi Kuperman
2017-12-04 19:40         ` Shannon Nelson
2017-11-28 17:55 ` [PATCH net v2 3/3] xfrm: Remove redundant state assignment in xfrm_input() avivh
2017-12-01  7:05   ` Steffen Klassert
2017-12-01  7:04 ` [PATCH net v2 1/3] xfrm: Fix xfrm_input() to verify state is valid when (encap_type < 0) Steffen Klassert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9e31dd8-233d-ecf8-b93d-53b1b2d26a8c@oracle.com \
    --to=shannon.nelson@oracle.com \
    --cc=avivh@mellanox.com \
    --cc=borisp@mellanox.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kliteyn@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=yossiku@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox