Message ID | 20180322171015.GA67869@GeorgeHnsiPhone.dhcp.thefacebook.com (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 8D5DE600F6 for <patchwork-linux-crypto@patchwork.kernel.org>; Thu, 22 Mar 2018 17:12:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F279288AA for <patchwork-linux-crypto@patchwork.kernel.org>; Thu, 22 Mar 2018 17:12:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 666522885C; Thu, 22 Mar 2018 17:12:38 +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 3DC8E28938 for <patchwork-linux-crypto@patchwork.kernel.org>; Thu, 22 Mar 2018 17:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751823AbeCVRLb (ORCPT <rfc822;patchwork-linux-crypto@patchwork.kernel.org>); Thu, 22 Mar 2018 13:11:31 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:42944 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751835AbeCVRLO (ORCPT <rfc822;linux-crypto@vger.kernel.org>); Thu, 22 Mar 2018 13:11:14 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2MH0Huc027588; Thu, 22 Mar 2018 10:10:24 -0700 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=TzUOp9SxBbC1Y30wZhKHTbBZAF+uNenxQRbIuVADFxA=; b=oUK4WEl3qoCkVrdjhtfnmHKZ36U5XVLT93Zeh6xJxivKLrQrxIvwRJUguLOgOGRWbCkz PGFSYZLFplU/RsMkenEC502N5hchwS1rMhU6Eh9doQS/LG9QK1jKQOzeZamURTY5vchu aNCeGVbXUD3ic3I8tvjGWlecFkmvB7unZ0I= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2gvg5pg3tf-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 22 Mar 2018 10:10:24 -0700 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.16) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 22 Mar 2018 10:10:21 -0700 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=TzUOp9SxBbC1Y30wZhKHTbBZAF+uNenxQRbIuVADFxA=; b=AjKDgJaM8NFAAjSeLXJMDpQNqtcA8XPFIIC+HkzRE5Xq+Y8bnIDPQdPXSNimcTIwDm7PCAz0n8nHRqApmMcPX+JB/iOVXP2bgwM/FRKXtbC6pKUvQoRRZtccSGiGABuM59y2Vhzs0UQMJvwmqPD6+sTMublPJ+4nkKtjLfMJwgw= Received: from localhost (2620:10d:c090:200::6:9ccb) by BN6PR15MB1122.namprd15.prod.outlook.com (10.172.205.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.10; Thu, 22 Mar 2018 17:10:19 +0000 Date: Thu, 22 Mar 2018 10:10:15 -0700 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>, <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 v2 net-next 3/6] tls: Pass error code explicitly to tls_err_abort Message-ID: <20180322171015.GA67869@GeorgeHnsiPhone.dhcp.thefacebook.com> References: <cover.1521738244.git.davejwatson@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <cover.1521738244.git.davejwatson@fb.com> User-Agent: Mutt/1.6.0 (2016-04-01) X-Originating-IP: [2620:10d:c090:200::6:9ccb] X-ClientProxiedBy: DM5PR1501CA0013.namprd15.prod.outlook.com (52.132.136.154) To BN6PR15MB1122.namprd15.prod.outlook.com (10.172.205.12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2db6a9ee-b3f3-465c-0089-08d59017ca55 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN6PR15MB1122; X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1122; 3:BuhU2yrzlM0H0qlk5q5i4iVJz4pwGHa1lIACsHzv9zht/IbXurbAmUMDhUjDA/kA5UkTiu1/t7ulHEwBrAIcpyicyy9/0wjnxCpzCQvAWqG1a/Btyki71EvOOSp2Ef213moHBPonoB0S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1dWLNCs+oX4rnprBFYxwSZGd6lHYLhGPCfpQBK2xkvRQQshXRx5j3lbxk2FZYBKdE9BpwIW5UNZw9hqeVl+Pama3h+KELpsywr6FQacRkqeQ7ee7iNpW55ihBKBTKHIO1scWn+bKKsjgcWKVgkt7dTQY6Blb48H+wumYQPzIdgRi3H7H7Qw4W2KfU1i0hAFI0oCwk; 4:i2sCdgAzsj49jSRRrtut59U8V8Jyq68MkiYq3tiXxGf4IWAq+ZN0ILoTJasnlBC98OZr5PxGAxK7TkuykdUzE76IJ6ZsWGR0NiTi9ejH36uhgKz+L+2J1C/esPpHqu3QLgWeQhuYpoPehyPFUErAn09NVlbPxZxKnzipdFYrF4RnIIzNSR6ZvEPw65e7QS+e39AgO+WyL1/FtpFIbuF0vucHo3Fl43qo3hQk6qjSDjnLS86u8K2U+TaqQuatGzN0FK16xU+pxUeXA+4xvc4nGfgTVTfM8ozXxiGENChkORPHvNL0so/fDEISMZH6vKC409yjAByKVeD1mfBBNfFWWXkCekHxb8jv55X3hErIHaM= X-Microsoft-Antispam-PRVS: <BN6PR15MB112219F42E444FB791BA894EDDA90@BN6PR15MB1122.namprd15.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(266576461109395); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(11241501184)(944501327)(52105095)(10201501046)(3002001)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:BN6PR15MB1122; BCL:0; PCL:0; RULEID:; SRVR:BN6PR15MB1122; X-Forefront-PRVS: 0619D53754 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(346002)(39860400002)(366004)(396003)(39380400002)(376002)(199004)(189003)(59450400001)(68736007)(25786009)(1076002)(386003)(8656006)(4326008)(76176011)(52396003)(6496006)(305945005)(52116002)(86362001)(46003)(54906003)(110136005)(58126008)(5660300001)(11346002)(53936002)(478600001)(9686003)(76506005)(33656002)(23726003)(50466002)(6116002)(446003)(8936002)(2906002)(16526019)(16586007)(7736002)(6486002)(81166006)(81156014)(6666003)(97736004)(316002)(105586002)(106356001)(7416002)(33896004)(39060400002)(186003)(47776003)(8676002)(18370500001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR15MB1122; 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; BN6PR15MB1122; 23:jWBwsjJpAoQbqbOd2Qr4m7uVGq1Q1pLQNXDAsop0x?= =?us-ascii?Q?O15DJtzAeedIP8A4SdzSUalYiBzSWdI4xv03N0opeEb4wNX5xcQccBTdgvxe?= =?us-ascii?Q?rmFiRvNgqv0pbYNjpY2AIg2ehiwz/13eYzNu7q+OXo9FBw1UbcKwXORpXCd2?= =?us-ascii?Q?BqxqmmOksnyr1QXubALTjmry5dnUezvhveCAsJJjr1NUbR11keGaO1MLhsFD?= =?us-ascii?Q?wlGRcCXXbNbqxO0TQs1DPHwUi8b6nVFQbJFRx7RlrmqU+6o0de2NAmzEpX1l?= =?us-ascii?Q?RJOf5dR0kJ3ue+9Byoyc0a9zDzd3U6dttRAOpjlYfjKuDTThkWboyNT2apXP?= =?us-ascii?Q?mkuBDMT6wtEQY7dYN4FoiuTEwDi2kmVDww5jDrKZ9dapJNB1XAIHXger99SC?= =?us-ascii?Q?UEIgbrmtUVgNaHBTbJmqHpYlo4KZh2+A9oTxBu4INhHHdtmriOVVQxvF3aFl?= =?us-ascii?Q?VlxA9uOGAJl9HA51sUtvF59tGR26eRr5VVdDBo9rpi55Uyhz+Xm4OFJIXu42?= =?us-ascii?Q?aEglYjfiAzenXcA2ZJmWdeyh0oBE70tkCznk4EWGpPiUYlE2U8NflJ2D97nb?= =?us-ascii?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WOMo1IIg6QnH7qlQ0MVPQ7yknO20Y3BgnBzz7IM X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1122; 6:WgK6S/mqWRs51C5Dyq54fxHISPzngawOKl1y6P1qjOTarOzZlKpbcmyx60vgSrjN+m7AV+aWHk1ZVIbbqS2Ldc65afa/BRYsB7NbemQZnPuzWS+ZlhxwFe1H4JzxKRsnif6zEtqa/edDu7/SVD2Dc6P7jjQKCR4d9kG9g7dLBQqWXja6l3NjkXXokGrL0KoXYw68nI8JDuYhkF3OkPs2c4Tgo8tlVp9TQmRck5HfYn7ZkKAMBLaeRuitalFLpbocct4xPAiBpl9iDk5k53nmk/9hycW126zerKvDbneFJZXulbcUNcyxHUKm7oN2Su09PHpof+YeL+uiuGHd5IDlXTKBWKksTwH72m+vjoZO2zQTSwmtQycWimVQB8flS0NbSQeO1ofeHzvEX3DXEsUaHeYeGE1VBoo4a1w8sVXbArtctPJD0e7ZNaqb60556vhVVbbvCm31grBv2Dcaa8Fv1w==; 5:hNSMALBXC1bZApWhz0xI9zSaCz3ax5Gnsdbbiy6zKzB5YMwoxSD1USJT5UF7GlS5HRQh61etBf1lEGI4EPJlpiu2+ZB00kjBwd7ERAHJiQwh89uz+dsHOu+rhjOBA5schL8WmQa7t/eQtUpVURTUG5Wyfia3XLyCPucH6OHKobg=; 24:66xsFMDqQQW1FhMMuftU9v40qRm5jNkuPGSU5JjI8zTMwtTLS36n6I39ZXTnTNUqFBTzAmgij0C7Zm9SEryZffxKNH7oH8wrvXjVZR9TpoA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1122; 7:3CgbPxPq01adhLK50V86uP4BrK1qMuRnqC78CqQlTOB/qlbxe8BM/eRuAFkcZ8pyo2OCA0K+2YKgHVu3dMpnP+jKQ2FS8+3FJNuNEFyiQUWzSrDY85U8ibf2bVYlCbCVsU7lO7A+6llkTYwqD9AmQJEqm4wrPOvv2A+5uWA2wzS/+T7bn6lwc4ebqcG31VczQMbORHeom9/Y8njFYdQFfkoPhab2bS2TNhylp3jU+yrLsggIhL0F27x2oecNucaN; 20:dOa3s93+RQ008uEKCgcEUyOlR+4VdVtZgdH80YyMMVTN3TNP5E+c7AjPVwlCKfyecfdrdwaTtXy9s3e1gi45WafkHlvi5b34SV5Hm1wHZjrLIx2FYRH5tAEeoDSnaNjwvNbT9A+6alLBHKzZcrDKUSM1EdgNDWtiDEAxlvFdLng= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2018 17:10:19.3987 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2db6a9ee-b3f3-465c-0089-08d59017ca55 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1122 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-22_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 338d743..1c79d9a 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -214,7 +214,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 - EMSGSIZE if framing is larger than max TLS record size, EINVAL if TLS version mismatch. 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(-)