Message ID | 20180308165032.GA19558@davejwatson-mba (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Herbert Xu |
Headers | show
Return-Path: <linux-crypto-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E40DF602C8 for <patchwork-linux-crypto@patchwork.kernel.org>; Thu, 8 Mar 2018 16:51:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2D1829AD7 for <patchwork-linux-crypto@patchwork.kernel.org>; Thu, 8 Mar 2018 16:51:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C74E529850; Thu, 8 Mar 2018 16:51:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27FE429AEA for <patchwork-linux-crypto@patchwork.kernel.org>; Thu, 8 Mar 2018 16:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752100AbeCHQvX (ORCPT <rfc822;patchwork-linux-crypto@patchwork.kernel.org>); Thu, 8 Mar 2018 11:51:23 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:54952 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752094AbeCHQvV (ORCPT <rfc822;linux-crypto@vger.kernel.org>); Thu, 8 Mar 2018 11:51:21 -0500 Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28GegS1006026; Thu, 8 Mar 2018 08:50:45 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=facebook; bh=sMoGdnnavthWLWniOTpOIhmyoNaboc3xQ2vyYwhedVA=; b=O636DmBZUwTxG93zHKOK7jwQNkbzoyjHcy9CFKncx1rkllhktrhJu036lBwylSnXT5de wqX4dOrWlr2pv+0NfujVpq/fYb6R8jctYMddkXWWA24CXZbEfayB4dCDxxvabT9VhR3y thadCgr//xRanjvJr3+WXIM6oRLBM6ADSI0= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2gk70xgfy4-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 08 Mar 2018 08:50:44 -0800 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.21) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 8 Mar 2018 11:50:38 -0500 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; bh=sMoGdnnavthWLWniOTpOIhmyoNaboc3xQ2vyYwhedVA=; b=A5IY5tOMKoXqyYkh/T2qHk1IMGJrEekGkEqejta/id7KmDcV1K86tU92ADEGchkpds8VN2Ej49zQnsT0MhYBlqNpGDfvIMoVm97V5s7i/vGPa1zuktvSmhnKoe3FGeMrqgEW4849fRLZOQhnJvYALHbw85SJYnUvzV9300znfzc= Received: from localhost (2620:10d:c090:180::1:bce7) by DM5PR15MB1132.namprd15.prod.outlook.com (2603:10b6:3:b1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Thu, 8 Mar 2018 16:50:36 +0000 Date: Thu, 8 Mar 2018 08:50:32 -0800 From: Dave Watson <davejwatson@fb.com> To: "David S. Miller" <davem@davemloft.net>, Tom Herbert <tom@quantonium.net>, Alexei Starovoitov <alexei.starovoitov@gmail.com>, <herbert@gondor.apana.org.au>, <linux-crypto@vger.kernel.org>, <netdev@vger.kernel.org>, <ilyal@mellanox.com>, <borisp@mellanox.com> CC: Atul Gupta <atul.gupta@chelsio.com>, Vakul Garg <vakul.garg@nxp.com>, Hannes Frederic Sowa <hannes@stressinduktion.org>, Steffen Klassert <steffen.klassert@secunet.com>, John Fastabend <john.fastabend@gmail.com>, Daniel Borkmann <daniel@iogearbox.net> Subject: [PATCH RFC 3/5] tls: Pass error code explicitly to tls_err_abort Message-ID: <20180308165032.GA19558@davejwatson-mba> References: <cover.1520527306.git.davejwatson@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <cover.1520527306.git.davejwatson@fb.com> User-Agent: Mutt/1.6.0 (2016-04-01) X-Originating-IP: [2620:10d:c090:180::1:bce7] X-ClientProxiedBy: CY4PR06CA0046.namprd06.prod.outlook.com (2603:10b6:903:77::32) To DM5PR15MB1132.namprd15.prod.outlook.com (2603:10b6:3:b1::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5ade1b89-40fb-4d3a-4b83-08d58514b796 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM5PR15MB1132; X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1132; 3:yQ4KDWP4IYBdt9ejWCxLZ/HtZ88vni7sh+DdF6NW3+NhbAfvD/0twnEoZ1EfejT5sXLX2yTH4mZdlCdd2ieO7f6D1DOpw4deHK9Ar6RhpMmtzKrmTliUljJuQcbfLWaV0tFfAGr1OtSYsY6wU6pN7R5YaetDRspEpFIhSpCbPhA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DL0cqCZ/gONrw0j7fxvfd/5o9fzBup3COtVPD+aOPKH1CbYPrlCZchCr/ZsxabgOL86g/3yDv2hvePSsMKFYPxIdg8++fBqHmtxvkLNui9/l7iGIM5ftZkkYyg/2Ub0OiH5+F/pYGwrwEj6Eo3LgAhzy/oULSj8YRaArloI8vr6Dor; 4:iNBM+qNpcxavKykZRDJ528U0fyBDlm3P+eVFZkviZVCiHb54jGBGQ3IhMeBoLKzmZc0UORL687QS5aitMnSyQXCTA1QdhKgiih7k01/RlVnJCNUGBtP8AogenvTORcDHIn3KgIPAIHN3VEvNekphmSP/NtvFNwTRVIdOBziACofbK8Vv+lu5TQxfRcRKTYbYvyHF9T+44+J05fv18t0pc4170+HBvTOEPqOItpLCD7QTsnlbbWQ2k7/hWS8VyFFZ7SNsB2zCqsArTGqgmCb0qCSFI86xZDZYAQ9z3hei0vy+Due1/z1d20aE+44oZVH2TMdjnYbw2BaBXubdkidstP4x1sLWNy9s09WMurxT19s= X-Microsoft-Antispam-PRVS: <DM5PR15MB11321033AFF859794A101369DDDF0@DM5PR15MB1132.namprd15.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(266576461109395); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(3002001)(3231220)(11241501184)(944501244)(52105095)(93006095)(93001095)(10201501046)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR15MB1132; BCL:0; PCL:0; RULEID:; SRVR:DM5PR15MB1132; X-Forefront-PRVS: 060503E79B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(7916004)(396003)(366004)(376002)(39860400002)(346002)(39380400002)(199004)(189003)(2950100002)(6666003)(6486002)(5660300001)(47776003)(39060400002)(46003)(105586002)(2906002)(106356001)(53936002)(7416002)(4326008)(23726003)(8676002)(81166006)(81156014)(7736002)(1076002)(8936002)(97736004)(68736007)(6116002)(305945005)(386003)(33896004)(76176011)(59450400001)(52116002)(478600001)(9686003)(8656006)(76506005)(25786009)(50466002)(16586007)(110136005)(54906003)(33716001)(58126008)(16526019)(6496006)(52396003)(316002)(86362001)(575784001)(33656002)(186003)(18370500001)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR15MB1132; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR15MB1132; 23:hP0ur21LQyGipZuIpO44n08WVMlGAOJVnwqo73v4b?= =?us-ascii?Q?JEuqKbBwFEnGhgybYOlvdhTqNKH7XkJmko740DrN4MWRsWlu6nZZeZFdNngz?= =?us-ascii?Q?um4zzVk9A7dyJMDgHGnmdQ6pLcWr3tx5k9hM5D2LHJAjQhY/RKkFiYD2r4J2?= =?us-ascii?Q?pfzNCKxgPPerVwZVd3LS3xDgStVZwYVRhEIrwf+CCR1SCedfHOPEE09aSg4H?= =?us-ascii?Q?Q4tVDTbgVOIlDZNzG0LgnRE2AXVAA2ltHSr8Vtiw2uUTxM156fr6bi+QrqiB?= =?us-ascii?Q?BDBcPsSe8Q3riAqYCSkYjWkWSWNxVo0xiByUSFFnyv5e4AlGe/7KNG4kzdh/?= =?us-ascii?Q?glBzSx+O0hNB8KDj2DI8dw58Dk67wcFbH6q2py/nJYeyGKzE14XjkAMyZyOl?= =?us-ascii?Q?bH1QWbnmS4VmV+9UUqKhfg7KMAe5ksAqXgWdi6WYtnTjDFBnPY01pTEz0t1u?= =?us-ascii?Q?kyueUwB4KKDpo04xOD4fg0Qk+klU+U7iDWvE3Zmb3Y+JIRDe3bwky0a0/CQC?= =?us-ascii?Q?vpvW6Z5n2uOIZX3pstZMxVe7qbSVp+M49ePYJnrohq/zNXioxOmrNxg/HrBy?= =?us-ascii?Q?lhl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wSsUtuaRax64H SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1132; 20:ihxoMd/AuhUQyQgD+8u0NFeLrWv21CTZgbbojBMK+h/lfpFV7UkmgzvomYwptpPJDNd/lEbDgqZgz6B+d5uJKkBNsq/YSN1n9ahjK2IlM1phej0CJadEkttEpged3uo3khLb4TAoDMM8Pt27iu9X15HZjqk9lD0iGriBmMsfdHg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 16:50:36.6682 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5ade1b89-40fb-4d3a-4b83-08d58514b796 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR15MB1132 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_09:, , signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: <linux-crypto.vger.kernel.org> X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/include/net/tls.h b/include/net/tls.h index 019e52d..6b44875 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -174,9 +174,9 @@ static inline bool tls_is_pending_open_record(struct tls_context *tls_ctx) return tls_ctx->pending_open_record_frags; } -static inline void tls_err_abort(struct sock *sk) +static inline void tls_err_abort(struct sock *sk, int err) { - sk->sk_err = EBADMSG; + sk->sk_err = err; sk->sk_error_report(sk); } @@ -197,7 +197,7 @@ static inline void tls_advance_record_sn(struct sock *sk, struct cipher_context *ctx) { if (tls_bigint_increment(ctx->rec_seq, ctx->rec_seq_size)) - tls_err_abort(sk); + tls_err_abort(sk, EBADMSG); tls_bigint_increment(ctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE, ctx->iv_size); } diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index dd4441d..6a0a669 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -269,7 +269,7 @@ static int tls_push_record(struct sock *sk, int flags, /* Only pass through MSG_DONTWAIT and MSG_NOSIGNAL flags */ rc = tls_push_sg(sk, tls_ctx, ctx->sg_encrypted_data, 0, flags); if (rc < 0 && rc != -EAGAIN) - tls_err_abort(sk); + tls_err_abort(sk, EBADMSG); tls_advance_record_sn(sk, &tls_ctx->tx); return rc;
Pass EBADMSG explicitly to tls_err_abort. Receive path will pass additional codes - E2BIG if framing is larger than max TLS record size. Signed-off-by: Dave Watson <davejwatson@fb.com> --- include/net/tls.h | 6 +++--- net/tls/tls_sw.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)