Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2353178rwd; Fri, 2 Jun 2023 08:17:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ64LxAeXr2o1LiurnbnxEMRu2YGgZfZZDnheJDJ9vCaT7tPqVCld6g+Jzb5tpC8aonii6W+ X-Received: by 2002:a17:902:e851:b0:1ae:6a3:d058 with SMTP id t17-20020a170902e85100b001ae06a3d058mr305361plg.36.1685719030961; Fri, 02 Jun 2023 08:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685719030; cv=none; d=google.com; s=arc-20160816; b=fV2+8BMTzoJwcHBOz+HFKdMZAnIZWD2u/NC7PINEMt9qVhC0kaVUdqB7WlBzwCgrha IM8DlCXfXux4+Wi55qK/8wq+Eiuxtudp2WNW0zYwltcMA2PwgdXupZGrIqyFci8Xe+xf TEh5i5k15s6iHURT09cT3IQ0yxcHDJzd6hmExL9DRhUrU6Hv0QWE79MA2uADVZAZ+u/F kTTc/I0Wg9GLZ3c28dpfKlPaqAbATkQ5qCPr/x/GKWaM2hNjoIXt7Uh0cMQxXBTGjn+b dn6V0m3hJVp6ztbnKlO3Egj7zs2r9SmInWbVRY5Q9MacEqu/DSCgH5T7+UgJDXR3P4/E E5Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2ZNhwXeGIbA58IS6DHid2Q6FV7QVgcqbxppr3d+VzBk=; b=eIEVNSrGxysZci3mXRpQ49akr7Piz+DSiXKGI5O9R/e9ALByocEN47ukfy8VINs08J 5QOIsrNop6R2P6ejQ4wxuINOvYvR6SU4+dFYkpnHrJ3a3eCC1rmH6ndfLKwDGHxxCytW TTCrW0hopzBWPwJancOtNyYNsb3yHlC64wTlgUy7MlGBsFW504yY4qNXv2HewAdKJPYe k84ILqlBCbzwzSCPDsKPETVpj9BkpTKeTvYN2mMczVmzL4QjukEccbaOfwCaiFGLqfJh uSxORB83m3XHu3qb8CTV0oj8636+DEGMNFkzkBVVEZ8me4vpHHsfy9JXZ1A67mlkraCA JU/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aUCtBTl9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp23-20020a17090b191700b0024666c4e8d8si2827874pjb.187.2023.06.02.08.16.57; Fri, 02 Jun 2023 08:17:10 -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=@redhat.com header.s=mimecast20190719 header.b=aUCtBTl9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236507AbjFBPJi (ORCPT + 99 others); Fri, 2 Jun 2023 11:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236407AbjFBPJY (ORCPT ); Fri, 2 Jun 2023 11:09:24 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14E75E4A for ; Fri, 2 Jun 2023 08:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685718514; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2ZNhwXeGIbA58IS6DHid2Q6FV7QVgcqbxppr3d+VzBk=; b=aUCtBTl9gsDcwQXshNUm3oCfKjR4vr1TUw/JScwzeZdfnv9/WgcSr2TrRQQmzCr6+QkeaV mCkc2eTk/Ay5X2K+bdq2A1Mfpp9VjEv+h7gnu16ygs5sKd8wvKiNy78nBRPExmpFn3ZgOk b3W/K1LluMVOtzsVc6mfSI0gvUAxABg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-257-hxUTvV89POCJp7sspC3Tpw-1; Fri, 02 Jun 2023 11:08:29 -0400 X-MC-Unique: hxUTvV89POCJp7sspC3Tpw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 49A92811E96; Fri, 2 Jun 2023 15:08:28 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id 255369E60; Fri, 2 Jun 2023 15:08:26 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org, Linus Torvalds Cc: David Howells , 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: [PATCH net-next v3 06/11] tls: Address behaviour change in multi_chunk_sendfile kselftest Date: Fri, 2 Jun 2023 16:07:47 +0100 Message-ID: <20230602150752.1306532-7-dhowells@redhat.com> In-Reply-To: <20230602150752.1306532-1-dhowells@redhat.com> References: <20230602150752.1306532-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 The multi_chunk_sendfile tests in the TLS kselftest now fail because the behaviour of sendfile()[*] changed when SPLICE_F_MORE signalling was fixed. Now MSG_MORE is signalled to the socket until we have read sufficient data to fulfill the request - which means if we get a short read, MSG_MORE isn't seen to be dropped and the TLS record remains pending. [*] This will also affect splice() if SPLICE_F_MORE isn't included in the flags. Fix the TLS multi_chunk_sendfile kselftest to attempt to flush the outstanding TLS record if we get a short sendfile() by doing a zero-length send() with MSG_MORE unset. 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 --- tools/testing/selftests/net/tls.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c index e699548d4247..8f4bed8aacc0 100644 --- a/tools/testing/selftests/net/tls.c +++ b/tools/testing/selftests/net/tls.c @@ -377,7 +377,7 @@ static void chunked_sendfile(struct __test_metadata *_metadata, char buf[TLS_PAYLOAD_MAX_LEN]; uint16_t test_payload_size; int size = 0; - int ret; + int ret = 0; char filename[] = "/tmp/mytemp.XXXXXX"; int fd = mkstemp(filename); off_t offset = 0; @@ -398,6 +398,10 @@ static void chunked_sendfile(struct __test_metadata *_metadata, size -= ret; } + /* Flush the TLS record on a short read. */ + if (ret < chunk_size) + EXPECT_EQ(send(self->fd, "", 0, 0), 0); + EXPECT_EQ(recv(self->cfd, buf, test_payload_size, MSG_WAITALL), test_payload_size);