From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05B98C2D0A8 for ; Sat, 26 Sep 2020 18:43:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBDF920809 for ; Sat, 26 Sep 2020 18:43:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730152AbgIZSnm (ORCPT ); Sat, 26 Sep 2020 14:43:42 -0400 Received: from stargate.chelsio.com ([12.32.117.8]:30433 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726309AbgIZSnm (ORCPT ); Sat, 26 Sep 2020 14:43:42 -0400 Received: from [10.193.177.145] (ashwini.asicdesigners.com [10.193.177.145] (may be forged)) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id 08QIhWCq000338; Sat, 26 Sep 2020 11:43:33 -0700 Subject: Re: Re: [PATCH net] net/tls: sendfile fails with ktls offload To: Jakub Kicinski , "David S. Miller" , "netdev@vger.kernel.org" References: <20200925165235.5dba5d7d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: rohit maheshwari Cc: vakul.garg@nxp.com, secdev Message-ID: <439f7a6f-fdbd-8c6e-129d-c25f803e3e5e@chelsio.com> Date: Sun, 27 Sep 2020 00:13:31 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org >> > -----Original Message----- >> > From: Jakub Kicinski >> > Sent: Friday, September 25, 2020 3:27 AM >> > To: Rohit Maheshwari >> > Cc: netdev@vger.kernel.org; davem@davemloft.net; >> vakul.garg@nxp.com; secdev >> > Subject: Re: [PATCH net] net/tls: sendfile fails with ktls offload >> > > >> > Also shouldn't we update this field or destroy the record before >> the break on line 478? If more is set, and payload is lesser than the >> max size, then we need to >> hold on to get next sendpage and continue adding frags in the same >> record. >> So I don't think we need to do any update or destroy the record. Please >> correct me if I am wrong here. > > Agreed, if more is set we should continue appending. > > What I'm saying is that we may exit the loop on line 478 or 525 without > updating pending_open_record_frags. So if pending_open_record_frags is > set, we'd be in a position where there is no data in the record, yet > pending_open_record_frags is set. Won't subsequent cmsg send not cause > a zero length record to be generated? > Exit on line 478 can get triggered if sk_page_frag_refill() fails, and > then by Exit on line 478 can get triggered if sk_page_frag_refill() fails, and then by exiting, it will hit line 529 and will return 'rc = orig_size - size', so I am sure we don't need to do anything else there. Exit on line 525 will be, due to do_tcp_sendpage(), and I think pending_open_record_frags won't be set if this is the last record. And if it is not the last record, do_tcp_sendpage will be failing for a complete and correct record, that doesn't need to be destroyed and at this very moment pending_open_record_frags will suggest that there is more data (unrelated to current failing record), which actually is correct. I think, there won't be cmsg if pending_open_record_frags is set.