Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp915704imu; Fri, 4 Jan 2019 09:25:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/WaY+9k7hm9T0+zNdL2CIxG9JKTCgXa10r+L8WbyQFHY0PcnxWQooQjE10ED5WmByqAD6bL X-Received: by 2002:a62:99dd:: with SMTP id t90mr52770658pfk.179.1546622719824; Fri, 04 Jan 2019 09:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546622719; cv=none; d=google.com; s=arc-20160816; b=aBUVTCIXGIopQboPIqLmOqkvBoswR1ihZbv7zDN66DSt0J9D6qhuhs417x9jXU74Ap dTZUD9PBP2XB4GkxSUwB6n2762tG+jq98iOk5g0o1to+F/ThJ2Bwq0EfEFVi/3ux52Q2 A8aAVhODyB/NZMkCtJ2zpavK2N3pOalDTRGCXnHh9Z1fvHsGWeIMXthTM8LAcoq+dAi2 27Cl2cve3sYMF41UhEbW+s2eXx3uNjmDtEZUKBC4EbyjTKWH5RbpGz6fKtzeMRpKAYlM wXqrBga7dyvlG2CfjK8tZ+bS6+1UHcHBymx30Ht0eQmpLPzHHPN7+NBWdR3FNTadZu7A jYCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=hYKzSWSYwcftzoeOdqVyiFQ+oEhqpAgfvnV/vI0jHWo=; b=ffDWxdq/kCc1CB66Zm8Bw5I/0FQRjZXtbyFCZKmgURDfLTFxZCawAjuruzlak4e4mj z5r2em9gVun6EsIqAF+B6Q2cLBXD+yxxQBofAfram6dJollM5JbtEhpCrhNQUs1L+uPW wDx2xKrbWznLrX7xsiPAWEVTYizXdJxTMFhQFiuJ/0ZF0Pg2RxvB5XrkHpIQJTMKf5pR T93Grl8o6Xhhp37/5hjEjOqBxDC2xqchMbyqBKQHNtGj3wFr5neJdvZsoBmbE8xVWo7+ plv4U8S1XI3wENEJbYgM4rLIXXIxfGkGVJP2WXJbJrfcKQS2TiUDvcaWclkQo9nxkbl0 9jgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=DzQPMAzc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si34224426plk.90.2019.01.04.09.25.04; Fri, 04 Jan 2019 09:25:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=DzQPMAzc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727159AbfADPRb (ORCPT + 99 others); Fri, 4 Jan 2019 10:17:31 -0500 Received: from mail-eopbgr130071.outbound.protection.outlook.com ([40.107.13.71]:4800 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725939AbfADPRb (ORCPT ); Fri, 4 Jan 2019 10:17:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hYKzSWSYwcftzoeOdqVyiFQ+oEhqpAgfvnV/vI0jHWo=; b=DzQPMAzcjZhxYejFEfSXxdIoD+AKxrc+LrN2i5OZ8TmQhGZTrRjwiychYuhdmrUNhfHwc8afe9sro04sV2xpSTXx7SLXYdA0Ej2UkaX6e5Jj+eABM2yiWkOu3XB+UP9XKFCqcWfSwao8TAXI1ZGFkDagTP1qM1TsPJzn//E8U5w= Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com (52.134.3.153) by VI1PR0402MB3807.eurprd04.prod.outlook.com (52.134.16.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1471.20; Fri, 4 Jan 2019 15:17:25 +0000 Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com ([fe80::9c4e:17cb:deff:1c18]) by VI1PR0402MB3485.eurprd04.prod.outlook.com ([fe80::9c4e:17cb:deff:1c18%5]) with mapi id 15.20.1471.021; Fri, 4 Jan 2019 15:17:25 +0000 From: Horia Geanta To: Christophe Leroy , Herbert Xu , "David S. Miller" CC: "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "stable@vger.kernel.org" , "iommu@lists.linux-foundation.org" Subject: Re: [PATCH v3] crypto: talitos - fix ablkcipher for CONFIG_VMAP_STACK Thread-Topic: [PATCH v3] crypto: talitos - fix ablkcipher for CONFIG_VMAP_STACK Thread-Index: AQHUmQRIuiLMyqBCRUqtEmVYpQRHSQ== Date: Fri, 4 Jan 2019 15:17:25 +0000 Message-ID: References: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=horia.geanta@nxp.com; x-originating-ip: [192.88.166.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR0402MB3807;6:R50IUijGmnRo9yM4b4OfTaMiWekpyGwLixKsZ4ZfbHnkqaQUA3ZinJStzVXLhjpy1lXB85fAGLbHu1ayin016Uu49Sga4AOqU/FPpPLhklmpnqVsGomPzdx6dmV4rZySHGC2o1WmrfMzxBm7U3VO5fKYmuAGiZub7I1Gj5jU6NlRTslzpGtE16JdXZk0lbaazMwhfaatrw9rJ48SJMSykXw9e4GDbUHpCxHeNRafeRkYgR6OOHzmVXj914wadzkau1n2CQzpv6KLN8oDd0fS28adm6pjXcfijG72+gY1oLw32otP4rtiupiswdkFD+DMp3DbLTuFsjt6WiaWtH5mjSn7WfUXJfyJ50t5OtJ+LvAR+jvp+x3mbzWjkAGDMxOSCdd2p/me+s06RIBvJq3Q8oS4KR51Y7pj0mCfIr/JLinsz5lrRmwcwj/00lrc4gXqNWhw/5z1J2S+UK3fB4D4OA==;5:iG56CrVDfjnl6LfkMcHPwB8j0jtHxnteHwNFcS6RqIErMdEh/IAmhrPwflEpgWqLzHAfqNRmvFq9VDEZKTfh1lu8po+fzJhxmbPAIlryTNAz1X1eKFUVLxoEAK5KOyvkwUl9oO2gMrh84lb6yketii+MGvxXIP9g++u/BD/kyVA=;7:kiM343ROrXlD9ceOZhyZA0hKgHscDVkuhccoyOtjGPSFZlncvNYuVMP4B39P7kOiAeDNB8e851SeVxu2QfH5QX5ops3C0/Qgl8o7xUxYIeuI7VY/H5js1yDCg/S/9dfBwRwd83sKb4yTBCRWyVpl5g== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 765904e9-2f23-4f0d-f2fd-08d67257bbe5 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR0402MB3807; x-ms-traffictypediagnostic: VI1PR0402MB3807: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3002001)(93006095)(93001095)(3231475)(944501520)(52105112)(10201501046)(6055026)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:VI1PR0402MB3807;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0402MB3807; x-forefront-prvs: 0907F58A24 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(376002)(39860400002)(136003)(366004)(396003)(189003)(199004)(33656002)(229853002)(478600001)(68736007)(3846002)(6116002)(6436002)(14454004)(305945005)(2906002)(9686003)(55016002)(53936002)(81156014)(81166006)(8936002)(7736002)(8676002)(106356001)(25786009)(4326008)(486006)(476003)(6246003)(105586002)(26005)(186003)(97736004)(71200400001)(71190400001)(446003)(74316002)(5660300001)(110136005)(316002)(54906003)(76176011)(575784001)(6506007)(86362001)(44832011)(99286004)(14444005)(53546011)(102836004)(256004)(7696005)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0402MB3807;H:VI1PR0402MB3485.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 8CwyPvZXRzvWTuF0eKxn7WZtD9UOlwjz2M/oLk8/S3lCoxSBfxSGACeJfRGO1BzAx1rBJyfzKs/+2IHAALJNC3OzwkqefLReec4D8lIrHb3SzsrV3abBQJTOIEbnlaWBNqmlbcUszKudAkdIyN80z6I4HOSRiIaIam2glZk151KA8hyXN/aI0mQdSv4ANF83wL03CuKQeHEI4JnF4bmXvJnrTKe8MQCuHrkZZwjbMy9ZpuM14smT5T20GToVL+70Ihaq081SLykud1vnkZM67PDT9tOv98MQNiTrRGer+RbUF6ZknNGU28SXgDtqj/yI spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 765904e9-2f23-4f0d-f2fd-08d67257bbe5 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jan 2019 15:17:25.8783 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3807 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/21/2018 10:07 AM, Christophe Leroy wrote:=0A= [snip]=0A= > IV cannot be on stack when CONFIG_VMAP_STACK is selected because the stac= k=0A= > cannot be DMA mapped anymore.=0A= > This looks better, thanks.=0A= =0A= > This patch copies the IV into the extended descriptor when iv is not=0A= > a valid linear address.=0A= > =0A= Though I am not sure the checks in place are enough.=0A= =0A= > Fixes: 4de9d0b547b9 ("crypto: talitos - Add ablkcipher algorithms")=0A= > Cc: stable@vger.kernel.org=0A= > Signed-off-by: Christophe Leroy =0A= > ---=0A= > v3: Using struct edesc buffer.=0A= > =0A= > v2: Using per-request context.=0A= [snip]=0A= > + if (ivsize && !virt_addr_valid(iv))=0A= > + alloc_len +=3D ivsize;=0A= [snip]=0A= > =0A= > + if (ivsize && !virt_addr_valid(iv))=0A= A more precise condition would be (!is_vmalloc_addr || is_vmalloc_addr(iv))= =0A= =0A= It matches the checks in debug_dma_map_single() helper, though I am not sur= e=0A= they are enough to rule out all exceptions of DMA API.=0A= =0A= > + iv =3D memcpy(((u8 *)edesc) + alloc_len - ivsize, iv, ivsize);=0A= > +=0A= > edesc->src_nents =3D src_nents;=0A= > edesc->dst_nents =3D dst_nents;=0A= > - edesc->iv_dma =3D iv_dma;=0A= > + if (ivsize)=0A= > + edesc->iv_dma =3D dma_map_single(dev, iv, ivsize, DMA_TO_DEVICE);=0A= > + else=0A= > + edesc->iv_dma =3D 0;=0A= > +=0A=