Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3590033rwd; Sat, 3 Jun 2023 08:03:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6L+ClJZSm+tl6TMoTWpvH4MiQcy6fg2XKgMf7V2A6TqqxO1ZcBcD+WTd5gv5yOTOy+GFyB X-Received: by 2002:a17:903:11c6:b0:1b1:8471:359 with SMTP id q6-20020a17090311c600b001b184710359mr3137600plh.29.1685804603504; Sat, 03 Jun 2023 08:03:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685804603; cv=pass; d=google.com; s=arc-20160816; b=JEPP40qTwsM+7y9Ilvp/TkpHANjLN+z6TTKIYcsX6xoj2doJDqigncKqZHSWGPmhQZ FBD0AM/4r+IaRS6XqwbgDm3N6fhWSf5wQC/qeRaV1v96ZXPCV5qCFzVDlqFYHIbxWJvv o/QtiSmR4ZwC6Jg9LN0h5rxA43PStVeMGSV4zSWDHGBzDxqzUOiELMAYq/mCugGM4JyP FcHf2NPwEbEGzgs83HT/9VJCk8Qo82NPPeu5LUKd7/KJF0S5+a/qw3ih3lGaKf9KYLC2 0rCNZgcLmHiwYgyuiz4hWzTvP/jKz46izFEs02JYEcYEfUzGnEkWxzce9byUc4dcnE+H sh+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kF6Nh9WnCeuMj838Yky8Q7UuKhApodT0gs079WiwVvo=; b=l/3iO/QEFsVKvIKInvKjzHg+KdHgv/ATyTm9LHMia0CXFYpEIlrW7EdES9bQen7Rad dmtm+5ZulwPFMCn3+/TRDYBWaqrsKIEkvq32spxzOGoHqC75B+UghwuhdkYYottzb5JH oq4kv7SeIi26TolZnIPQFlE4BjOTC00geG2p3mmqt5ND2o6ktGxGnADNgicEQ8+3Pzmv ZeVGgSPMEqoNOO8AurRnih3eOb3+jGccpuvfdR0c9ZZcd6+NNELnKfaIKGzT4E6Kwn2E 6LL8R86VmLLqosFbgomvf1+01okmSIHoAW47oGloOP4ZhRY81kXG1qSfsggAajvuWCz9 /I/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=uRn8+Tjf; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a170902c40700b001afd4fceea5si2813214plk.617.2023.06.03.08.03.10; Sat, 03 Jun 2023 08:03:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=uRn8+Tjf; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230016AbjFCOvp (ORCPT + 99 others); Sat, 3 Jun 2023 10:51:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjFCOvn (ORCPT ); Sat, 3 Jun 2023 10:51:43 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2110.outbound.protection.outlook.com [40.107.95.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 641E7CE; Sat, 3 Jun 2023 07:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R2b/Xsef337i0V3+0vEj3K0BvcwONhvni+6TqXGydb3ZlQBWEZGRljDcWlwIq1lvnWuaFL9+q0hhjDne2LzJrm4jt154Z/ISJ2u6y1CiNYIuHh6OqDdpS772oDlAuzjsrcpg7TVesr9AX4d1/b3GvouMl6XQbhH8JqelI2bi3V3Tz+l+qhaSzP/GZwKzTy4xtPQPzn5STODp+W4jeyLbXnyH+KbxjXKhbSMsadpUENJZeKJgR03WPhWiirEdHfdYvDhTypmWHa31MoU2hyJcF3gc0+XR2Y0C2B1DCtc2XWwUvLyBqxuw6//XuTQyk23NE94CByS+IJ1AlXoGAqrn3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kF6Nh9WnCeuMj838Yky8Q7UuKhApodT0gs079WiwVvo=; b=lMdPrFd0PqEkowOSGs3bRI/6AoDMXANnZRsoDN9WKB7EI7WXBzB28l8YKBD3nZzh0q+sBW2Jh+WL18AtFXltlDWvilZT/YyaNGsW3apJs/oGcLYLSruxQoQPzAOOFNi6c/KOhEdeWchNqGlgQFsrqnBQcl3VrylZzUvAu6d+aougdyfIWNdNpAumqoSabUk2oUA2loAvFQIor8Pipo7gZkSJYM6m/y71Fjc4PW1D6YgjwJVnDrE46eBlh3jO5pRN7Zy1ZOXeQpp+Qv64sdmBSBN0F36TmbjXfj0oJn+whV/+1vwLsThBSthHSQ98ufa4jgVcAcPnT/C/G41juS9Aow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kF6Nh9WnCeuMj838Yky8Q7UuKhApodT0gs079WiwVvo=; b=uRn8+Tjf0fyLvK6UYTZc+h59APqfofI6vQb0pgy8hVrUZhHdkG9jU5jbsATZIB0B2pJ6IzblVbZ4rIvDX2V7rrA7t4FIVv1GwEbHrvostHptbL9sQH1s764EaG4GIoYjrtgwOSH+I37cweGG8oE6bxlNGQ+vsp0MhfpmsE2FgFI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by SJ2PR13MB6118.namprd13.prod.outlook.com (2603:10b6:a03:4f5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.24; Sat, 3 Jun 2023 14:51:40 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::5e55:9a39:751f:55f6]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::5e55:9a39:751f:55f6%3]) with mapi id 15.20.6455.028; Sat, 3 Jun 2023 14:51:40 +0000 Date: Sat, 3 Jun 2023 16:51:32 +0200 From: Simon Horman To: Dan Carpenter Cc: David Howells , netdev@vger.kernel.org, Linus Torvalds , Chuck Lever , Boris Pismenny , John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v3 03/11] tls/sw: Use zero-length sendmsg() without MSG_MORE to flush Message-ID: References: <20230602150752.1306532-1-dhowells@redhat.com> <20230602150752.1306532-4-dhowells@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: AM0PR06CA0122.eurprd06.prod.outlook.com (2603:10a6:208:ab::27) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|SJ2PR13MB6118:EE_ X-MS-Office365-Filtering-Correlation-Id: 1de1b892-99f1-4216-7653-08db64420a03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /mEDGIXNv/iN+4ZnqP7yf3yeUd3hSjWCJaze2zRsIsBZ9cwxZcTUlFijm2B+VUPJ+l+UBdpycrECFkQ90OjNdr0/CWOcMPWuiSm2WvvHz/yrAc7DQ3pDqEatwMh7IosToKDdkOJG6Ken8wFkxZjTQlH4dBc184RWGdi0BR3iP+9BnHlBKJNvlVuEdO9U/mX14ZH6zKlXa9V+N0qEvleSHJp8+VVP0fpAgS7HoEj1aKulmKjzp6gi7FMQ0Od1xIxaj/F1IWPrLSncy/4m2/2rLW/88bUlaT8h3nPoxNa/FyrbDB5H0rOXRrh81MSlE0dAIc03FlnxdndE74gKcqpTc0XEPosL7Y/YcBx4Ayqij1gojLPjl9Z9xitRFL2wdGLKhhCGz/mzhkeLUPGhdnVfogGAWs+yt/bUAUPTKfY/H6AZcLepahMTEsXC+lkAXwQ14v85yC6NuvossRmFERlkLXMQrP26VPXZfbiFsWacYtfyuPfz98nfl+GcJpBVFe/wf3+ZFTHKKM5dNqUTHTGR/Yd23pbVWxGBwTNBoDsO6yf9qFdXgkvEKfkBxRrLejSQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39840400004)(136003)(376002)(396003)(366004)(346002)(451199021)(6666004)(478600001)(38100700002)(186003)(2616005)(6506007)(36756003)(6512007)(83380400001)(6486002)(316002)(66556008)(66476007)(66946007)(4326008)(44832011)(8936002)(7416002)(8676002)(6916009)(2906002)(5660300002)(41300700001)(86362001)(54906003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?D/+oPmpAFR+yfJlPGNLI/ZRoT/XgwqAz3rIPETbyuyIiLCBtg9wHrL16s8DH?= =?us-ascii?Q?imCjdbEoRvynIc3X+MhJ1s0a8XGTyYCeWqRdsSH6EDzxFdCuT2WW0BCRpm8Z?= =?us-ascii?Q?Z7bvR9bnzhUuwa+kM++PyDs2n1ySWNhQwoNFWRbqtlvNcecKWCKlo2hGjPDU?= =?us-ascii?Q?TGnxPvEFH+YudbWJ8PPQo3Ltr8nIYwEvdF17WNvfGATt6yIBsIZpt061mLjq?= =?us-ascii?Q?B2gA7wBbGAlHCTgv/9RWGQ4c9iMHHGqiRuSo9dIZpnVKBLEjX+f8EQ6gArCc?= =?us-ascii?Q?OSng3ge5EyLyZbEU6K3nBsZ1Uma+PdJWMRzCeXiDTJPz18RtsADQ9+mQ96wz?= =?us-ascii?Q?KHW+jBUZ+S/kMMXDsqrqPYRHqonI5cyD49ilFl8VkuTKUNWIK0+NWz/cd0V9?= =?us-ascii?Q?z1xEU6xku2WDSyF1zxvZtxN51IGDJKR3Oms3SexoecakJlvyH1JMxRdCmoBg?= =?us-ascii?Q?qe/1lPIuHzfsSmWXHif9ECxGHjx8NAeQW8kGCe5+phjFr1jFQyJl7Yv+bfib?= =?us-ascii?Q?fJ/PHfKmJLZIgAqZL6ZsxoXw2X5loSlNPAov90HchisVSiWiaXvxojs32pac?= =?us-ascii?Q?dfuCvifuhyxnsCiar7rTc4rzz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q?hfh3PH46OA8O36J7e5KkapCmX+JXmlxItiOmF3YXoqTuivkp62XREFZCiDqn?= =?us-ascii?Q?dZYJNkwJOTCWhJa7TzpT2c0J+TBNpdZRGlxn0bXKXLtbTFrOq6z9Ci5J5lif?= =?us-ascii?Q?ED+BlEeAUSdJ1rXQX8b8OpDq2+Qo3xSlTYo841SSjQCdiJbup5p4dVgtwUz0?= =?us-ascii?Q?LDBlAQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1de1b892-99f1-4216-7653-08db64420a03 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2023 14:51:40.2888 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jAVZ5v3Xm3fs6by006kMm40ftyAnEFtlcFtgLErhh6ym2NGD97Riyfnl/03WfdnqlZIPL2+xhhgHFcO9TqoGvkR+1kNB5j8gOOsJTs5/j6A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR13MB6118 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 02, 2023 at 10:00:45PM +0300, Dan Carpenter wrote: > On Fri, Jun 02, 2023 at 08:27:56PM +0200, Simon Horman wrote: > > + dan Carpenter > > > > On Fri, Jun 02, 2023 at 04:07:44PM +0100, David Howells wrote: > > > Allow userspace to end a TLS record without supplying any data by calling > > > send()/sendto()/sendmsg() with no data and no MSG_MORE flag. This can be > > > used to flush a previous send/splice that had MSG_MORE or SPLICE_F_MORE set > > > or a sendfile() that was incomplete. > > > > > > Without this, a zero-length send to tls-sw is just ignored. I think > > > tls-device will do the right thing without modification. > > > > > > Signed-off-by: David Howells > > > cc: Chuck Lever > > > cc: Boris Pismenny > > > cc: John Fastabend > > > cc: Jakub Kicinski > > > cc: Eric Dumazet > > > cc: "David S. Miller" > > > cc: Paolo Abeni > > > cc: Jens Axboe > > > cc: Matthew Wilcox > > > cc: netdev@vger.kernel.org > > > --- > > > net/tls/tls_sw.c | 6 +++++- > > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > > > diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c > > > index cac1adc968e8..6aa6d17888f5 100644 > > > --- a/net/tls/tls_sw.c > > > +++ b/net/tls/tls_sw.c > > > @@ -945,7 +945,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) > > > struct tls_rec *rec; > > > int required_size; > > > int num_async = 0; > > > - bool full_record; > > > + bool full_record = false; > > > int record_room; > > > int num_zc = 0; > > > int orig_size; > > > @@ -971,6 +971,9 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) > > > } > > > } > > > > > > + if (!msg_data_left(msg) && eor) > > > + goto just_flush; > > > + > > > > Hi David, > > > > the flow of this function is not entirely simple, so it is not easy for me > > to manually verify this. But in combination gcc-12 -Wmaybe-uninitialized > > and Smatch report that the following may be used uninitialised as a result > > of this change: > > > > * msg_pl > > This warning seems correct to me. > > > * orig_size > > This warning assumes we hit the first warning and then hit the goto > wait_for_memory; > > > * msg_en > > I don't get this warning on my system but it's the same thing. Hit the > first warning then the goto wait_for_memory. > > > * required_size > > Same. > > > * try_to_copy > > I don't really understand this warning and I can't reproduce it. > Strange. Thanks Dan. Of the above I think only the last one was flagged by GCC but not Smatch. I can try investigating further if it is useful.