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=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham 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 42826C43381 for ; Tue, 26 Feb 2019 20:35:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E84D421852 for ; Tue, 26 Feb 2019 20:35:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="W7AyW3Xx"; dkim=pass (1024-bit key) header.d=fb.onmicrosoft.com header.i=@fb.onmicrosoft.com header.b="EjlovieM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728920AbfBZUfL (ORCPT ); Tue, 26 Feb 2019 15:35:11 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:59570 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728849AbfBZUfL (ORCPT ); Tue, 26 Feb 2019 15:35:11 -0500 Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1QKWXdT004630; Tue, 26 Feb 2019 12:34:44 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=7iG14fSwen9Xhqy+wcO1IlVnqyF5vDkhc7vUpxWQgYU=; b=W7AyW3XxpskYdIZ7UbC3TKQnIdkF37XTHwMBcc0r176JsjrUuxYsaBzWCThhd0UeGO5f MhbsHAdgjxDHeseBi0ZlvWPe787RUiCc3HoWTQE0vCagCKBfrZcx/64+WVt8fCIS1YuO 59TFc1/uswfoOhV6ozMrkBr0zBO9XNL0IG4= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2qwbwjg5vm-14 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 26 Feb 2019 12:34:44 -0800 Received: from prn-hub06.TheFacebook.com (2620:10d:c081:35::130) by prn-hub02.TheFacebook.com (2620:10d:c081:35::126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1531.3; Tue, 26 Feb 2019 12:34:43 -0800 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1531.3 via Frontend Transport; Tue, 26 Feb 2019 12:34:42 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7iG14fSwen9Xhqy+wcO1IlVnqyF5vDkhc7vUpxWQgYU=; b=EjlovieMiPEe16AZ9mXKLDv5iagjJg2tyvacsoM0kglh+fTgE7eceBU80duflCFFmhOXepk6k4ltJ9XNHdrwhpaQt9HLb1WWY1AaVPNDuRtfc6R0Ou3xzoYRo97f6aNid7VuAlxZcgG2/3OvTEqWvomIT433DH8NfWioHU960b4= Received: from MWHPR15MB1134.namprd15.prod.outlook.com (10.175.2.12) by MWHPR15MB1215.namprd15.prod.outlook.com (10.175.2.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.18; Tue, 26 Feb 2019 20:34:41 +0000 Received: from MWHPR15MB1134.namprd15.prod.outlook.com ([fe80::2cef:9e43:9727:89b7]) by MWHPR15MB1134.namprd15.prod.outlook.com ([fe80::2cef:9e43:9727:89b7%4]) with mapi id 15.20.1643.019; Tue, 26 Feb 2019 20:34:41 +0000 From: Dave Watson To: Boris Pismenny CC: "aviadye@mellanox.com" , "john.fastabend@gmail.com" , "daniel@iogearbox.net" , "vakul.garg@nxp.com" , "netdev@vger.kernel.org" , "eranbe@mellanox.com" Subject: Re: [PATCH net 4/4] tls: Fix tls_device receive Thread-Topic: [PATCH net 4/4] tls: Fix tls_device receive Thread-Index: AQHUzcyjjYeVlDG4nkOdjSZNSiKa56XyiciA Date: Tue, 26 Feb 2019 20:34:40 +0000 Message-ID: <20190226203437.c7tsjfb5ri35nn6y@iphone-a056f37cfbb1.dhcp.thefacebook.com> References: <20190226121235.20784-1-borisp@mellanox.com> <20190226121235.20784-5-borisp@mellanox.com> In-Reply-To: <20190226121235.20784-5-borisp@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: NeoMutt/20180716 x-clientproxiedby: BYAPR01CA0063.prod.exchangelabs.com (2603:10b6:a03:94::40) To MWHPR15MB1134.namprd15.prod.outlook.com (2603:10b6:320:22::12) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2620:10d:c090:200::2:5834] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7487ebf9-d6c0-4c56-3769-08d69c29d53b x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020);SRVR:MWHPR15MB1215; x-ms-traffictypediagnostic: MWHPR15MB1215: x-microsoft-exchange-diagnostics: 1;MWHPR15MB1215;20:gOUwkXgthtEBhpTnxrW2QxCWHWj1Z5EAkPM7BOAvBI8oMiCfeen/FOuSnOiFmaNuF+74I/K6bJvBSR1829kErim7W5SDjCdyBNS1cauvCXbTYaTLl4T1yteiVEZAGVE/DIeuJ5tNw6HIK4tfZ6AUnbVf2ZJWaO7XllJ8tOncXjY= x-microsoft-antispam-prvs: x-forefront-prvs: 096029FF66 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(376002)(346002)(366004)(136003)(396003)(199004)(189003)(11346002)(6116002)(86362001)(97736004)(486006)(4326008)(186003)(476003)(105586002)(478600001)(99286004)(76176011)(8676002)(46003)(81166006)(81156014)(6916009)(6246003)(52116002)(8936002)(446003)(106356001)(7736002)(256004)(53546011)(6506007)(386003)(14444005)(102836004)(305945005)(14454004)(9686003)(229853002)(316002)(53936002)(54906003)(71200400001)(5660300002)(68736007)(58126008)(71190400001)(6486002)(25786009)(1076003)(2906002)(6436002)(6512007);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1215;H:MWHPR15MB1134.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: fb.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: q0H5jXhC0LGHQk9e8dpD4r4KMPYF3uAkRSnGSuKuC4pIIyrNx/0Y2V/V1971c1+09Kt6XivW0lt2FB9KxZIWYuZD4ckv74bPpW0ZCaacuqZ6LW4SwzWKIuz9sVIW42EGH5S3EQgvQ8/q9EtmKrElovCPUTYYM7hJ7FyMeTfwdIXViqdwM6DJW5D8tTiKhWLOvM7B/hXXttqFYGsAtZsya9jdKpq5jGe1lVw+2SzKAvsViN0In6nU6xL7Wp0z2rKLzZV2NMYtEdjbo9azGMFb7Xh31+Hd2rCHdtm3TR/LcwV1SnQZT2xQvmOTtUUfvlfui1K5ayO1OlKtGuZfMTT45NKKggLV1brk9C600gKo292wXe73OvWD75aN4rKe8JXeWw6LiRLC5mkagT69LpX3oiezEQJIxbccTvyCpYs9//Q= Content-Type: text/plain; charset="us-ascii" Content-ID: <70A71674A616914A986A1A6538A071DE@namprd15.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7487ebf9-d6c0-4c56-3769-08d69c29d53b X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2019 20:34:40.2832 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1215 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-26_11:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 02/26/19 02:12 PM, Boris Pismenny wrote: > Currently, the receive function fails to handle records already > decrypted by the device due to the commit mentioned below. >=20 > This commit advances the TLS record sequence number and prepares the cont= ext > to handle the next record. >=20 > Fixes: fedf201e1296 ("net: tls: Refactor control message handling on recv= ") > Signed-off-by: Boris Pismenny > Reviewed-by: Eran Ben Elisha > --- > net/tls/tls_sw.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) >=20 > diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c > index f515cd7e984e..85da10182d8d 100644 > --- a/net/tls/tls_sw.c > +++ b/net/tls/tls_sw.c > @@ -1481,18 +1481,17 @@ static int decrypt_skb_update(struct sock *sk, st= ruct sk_buff *skb, > =20 > return err; > } > - > - rxm->full_len -=3D padding_length(ctx, tls_ctx, skb); > - > - rxm->offset +=3D prot->prepend_size; > - rxm->full_len -=3D prot->overhead_size; > - tls_advance_record_sn(sk, &tls_ctx->rx, version); > - ctx->decrypted =3D true; > - ctx->saved_data_ready(sk); > } else { > *zc =3D false; > } > =20 > + rxm->full_len -=3D padding_length(ctx, tls_ctx, skb); > + rxm->offset +=3D prot->prepend_size; > + rxm->full_len -=3D prot->overhead_size; > + tls_advance_record_sn(sk, &tls_ctx->rx, version); > + ctx->decrypted =3D true; > + ctx->saved_data_ready(sk); > + > return err; > } This breaks the tls.control_msg test: [ RUN ] tls.control_msg tls.c:764:tls.control_msg:Expected memcmp(buf, test_str, send_len) (18446= 744073709551614) =3D=3D 0 (0) tls.c:777:tls.control_msg:Expected memcmp(buf, test_str, send_len) (18446= 744073709551614) =3D=3D 0 (0) tls.control_msg: Test failed at step #8 So either control message handling needs to only call decrypt_skb_update once, or we need a new flag or something to handle the device case