Received: by 10.213.65.68 with SMTP id h4csp1677765imn; Thu, 5 Apr 2018 01:42:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+XGQJilv4tbBACFWo+e+jmUkSmsMewN+hgnkt33KELgct028HYiJhVjvue4NAi27X4Dk0F X-Received: by 10.101.102.197 with SMTP id c5mr4002837pgw.93.1522917726417; Thu, 05 Apr 2018 01:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522917726; cv=none; d=google.com; s=arc-20160816; b=dpF46HwOvI9Cr1hqrMpHrMj95cGw4lXYln5kqdBwpvugqDqqfdkg9CVd8cX4S1oM/a Jbs0erX+rkJJeN0IDqXCzckZEuaPZcT28oOdTAqcOm5n83IfwTxBbC7qF20jE163zQS5 PLIz9XyrRZBa5p1w1lJCb4VAjcpXZbJDYQGBuMUG4QSNPOyDx+JT0rChHSKNpJaO/n98 RZH3xM2mgxE2TyoJM6Bk3QW1basHpb8xx2QjusbaLWg0J60WF0iD5SMf9HHwKSIeSChj WxtdDplXabn0D1+GuUAc1fJncMDR51iG/EdbFfgL3eyEgLcoLmPHDyw8R3vMlGwRPjgL m5dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=V2C1R0e8x3XR3lKxHQYNxmWYYgeiPpc8Ne0PXi+ZSc8=; b=Y/ZUUGb2+jfTXSpgh0zR+OJvHonUHp6ku7t0jMGLcFh6+FWKE/EgaUJdLcrGZar57P 2vo9nfOMHqC6xsCD5K8CkuRciAm5n4olgyiyUMWtqzG6bZVtEf2iO0zG6ooyedbHm7lo Ia8hMhxDCYpLT9jHpNXYnJ7vkMDoiur/CyHmPWphSUlbs8d4YnRVPnVCrFYVvtKlvC4F RGjyu8cl12m2AGkbcE4eN8HM5Z8gTrNj5GCmimtrqDjFKezZUNowQNbM2h1Dy4vAqLUl TPB2jQC4t3sCRaasNrWnldvgxX55EtqiI9CoFUC2I61R/VVZSPk40M/1jsB6SDac2au1 yBag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=anSkxnyn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s194si5132083pgc.578.2018.04.05.01.41.51; Thu, 05 Apr 2018 01:42:06 -0700 (PDT) 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=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=anSkxnyn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751277AbeDEIkf (ORCPT + 99 others); Thu, 5 Apr 2018 04:40:35 -0400 Received: from mail-cys01nam02on0062.outbound.protection.outlook.com ([104.47.37.62]:42933 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751097AbeDEIka (ORCPT ); Thu, 5 Apr 2018 04:40:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=V2C1R0e8x3XR3lKxHQYNxmWYYgeiPpc8Ne0PXi+ZSc8=; b=anSkxnyn2AP7B+lDgt8e5KVBkog8qzKQsKxhs1OKw/5VaPrW+joUmBQA2BvG3+5aYc/u4ce4coIj4ZmHiS+x7OaQ4Jq0dqItdcm/809m04Ygq+xHrxqG5I7e2x6ly7Gum/usNJiT364ErZSOu2449HM0cuwYSs8R793cSyTCb5Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jan.Glauber@cavium.com; Received: from hc (46.223.168.166) by BN3PR07MB2499.namprd07.prod.outlook.com (2a01:111:e400:7bbf::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.653.12; Thu, 5 Apr 2018 08:40:26 +0000 Date: Thu, 5 Apr 2018 10:40:18 +0200 From: Jan Glauber To: Herbert Xu Cc: "David S . Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Mahipal Challa , Robert Richter , stable Subject: Re: [PATCH 1/2] crypto: thunderx_zip: Fix fallout from CONFIG_VMAP_STACK Message-ID: <20180405084018.GB24281@hc> References: <20180328130557.10560-1-jglauber@cavium.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180328130557.10560-1-jglauber@cavium.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [46.223.168.166] X-ClientProxiedBy: AM5PR0201CA0003.eurprd02.prod.outlook.com (2603:10a6:203:3d::13) To BN3PR07MB2499.namprd07.prod.outlook.com (2a01:111:e400:7bbf::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20985de9-2e5e-427f-56c5-08d59ad0e208 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BN3PR07MB2499; X-Microsoft-Exchange-Diagnostics: 1;BN3PR07MB2499;3:rhSctHDYYYQCUUsb+2Ca2jeYNFq2W64ZB7psfuIACpFg7Ehj8mw5RnQcLlAkYhD+VaNkad7qs5q0XIkQD81AT9i7bW5z9J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ko3Yvxpv9RY3HAlswsi7c+yEQTQFQfRqj5fzwYLBvdF81Hx+4qyk3gedNK3nUR3qBQUBNEvRwtBStUv7XPWadGpuWth/Db9uUKZ5KLLFa6y4w5TDIrnBM2FSkyq6N0RHPITKylE4d/mgpOR88YGu4/Vva2N65G7Y0jTQxy7Z9aGzKk/F4epOcjmTGLNRb28EP0RR7CJE522wO+VLLmyYD+8hre5w8o7h8W7DgSReWsVPO7txdYlHnqbMsUuLuPkKLBWMLYC/H4gfDvQ4etedDAGwEHJCnFiqSVuGM8z69iO0qw8cB3E3rLW4qchPfEX8ijIU5twbRpCM/haxwopvl6ThrBwWQUGX5wEXQcJD404nG216E=;4:FacbsVeDAlyXx7kpvZ2FlSxOHFivGSaxCoih0WTjfhl7/YZadKnPCaQBjNrLBUky+CzCKa3sO7rXwH0YmpvkFKZQEFhU3pZqTEBuGOoug58Q/ROnJ0fR/vtTmGrmnteCAzjXR91WEqs4223TE6O8tMiU6ROrssN9RJ4zcWybRTyW4LBwBUmdvei8TaY83EGpMel6Rj/eEVUnU60uXdwRnSPkp9cCgaeaGj2mCBQEV/MjBswnYD2Fc/6atZ/jQzt9gl5a39KlYEKrDIMDT9AFe8N1Q2uXRKLRpcl7WknaE4Yxe6yQeKQUXlGZ/KhTv6Od X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(3231221)(944501327)(52105095)(3002001)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:BN3PR07MB2499;BCL:0;PCL:0;RULEID:;SRVR:BN3PR07MB2499; X-Forefront-PRVS: 06339BAE63 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(396003)(346002)(39380400002)(376002)(39860400002)(366004)(199004)(189003)(76176011)(6916009)(72206003)(33896004)(25786009)(105586002)(52116002)(6666003)(6496006)(68736007)(66066001)(97736004)(42882007)(316002)(7736002)(2906002)(26005)(47776003)(23726003)(6116002)(386003)(59450400001)(478600001)(229853002)(55016002)(16526019)(956004)(1076002)(8936002)(16586007)(81166006)(50466002)(305945005)(3846002)(5660300001)(186003)(81156014)(476003)(446003)(53936002)(6246003)(11346002)(33716001)(486006)(54906003)(8676002)(4326008)(9686003)(33656002)(58126008)(106356001)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2499;H:hc;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN3PR07MB2499;23:SgNYa87lun4zQneU84udNapl3IUVaD5hD4zGyKI88?= =?us-ascii?Q?DNWFkepL2XmXBQjWLmAroz25nXXRNBT4ZfXfOdYOd5eQEbdn6y3Hr026t9oe?= =?us-ascii?Q?Ehn1essleofhM3zEwmrDRikZYUUgPCX9uE10OyZDp7DlePU7yalDul/AbrXn?= =?us-ascii?Q?SWwk+ld3cRE1cwg636cFiYBwx80QXAH7NSb2/xiR7ccw7tzwhAqnefwKTEyo?= =?us-ascii?Q?aoai7wGaz9isEvV0YJAS3LECWcKO2CetrmBr2HQZ0GqvdBG930bUSJUpcsWI?= =?us-ascii?Q?rKyh7BepnZgrrHwp7R1AX6g0fs8tDIn+/REZliA+5mKjGeTxuy7LaCLKaR1J?= =?us-ascii?Q?jAotdbrvgfZ82CYLJseTLFM1asDxXoGX5fIknIGlJ4IwRhFXXpP/wETII2EF?= =?us-ascii?Q?SYj2MFDH33ffy9BkSArhmnULBrnUlIxKStWtUfrP+AR3WAHuT1QVIpL5jk0a?= =?us-ascii?Q?sa0V3TXyqvwOQjzvcO5gn/10p0PEd7CGp8EpG5kuomTRfi5R5CsBXdNGro7f?= =?us-ascii?Q?bmr1beplmPyA8eJuDz1WbZOquGRgF4BuIJjZU3tEzwAi6fs1Uz6mzAVDcXac?= =?us-ascii?Q?7d0uFW2sOfDU0KkgssK+qBYhg4ECjJOSqBbpzjRbOzJ69ssgt1fCv16CEEti?= =?us-ascii?Q?TSFPe8t4u7csYwb8ufjXF03XgrSNsDkSQ9hCWq+AnT/EfSsor7THvCMzRGQx?= =?us-ascii?Q?ozoTpVWxvv14SHP2SWdaPBraYFR47f5hfcHiKOm2wSlRZwV9hVZNgvI25ymo?= =?us-ascii?Q?r64kTajZTNWGOl3nM8/ctHps4eZGcEAs9xeGGJyxIxYzxnpcJ2oZWvnkwKbh?= =?us-ascii?Q?oR1CwdWhJQSO62ZG4NP0zeHMf2vQutij7Gw3tv23B/K/W1ffcyTdZ4C09IDl?= =?us-ascii?Q?HwZUIpYbCUNnJl/yoqPevXsCISWsOZXJKIVg5SG3RUtlVlJeNuC8mVysHTUb?= =?us-ascii?Q?65Ime7yIpFzaMJLVpaf2WmwqCxJdFDnGm2SVN6rWY8okB7k4KAfVzxNx9RpD?= =?us-ascii?Q?9uyixXe2uvViCpSH6Ik5flrshfO9WoBnAUv2m+NgmURJ+gG08T0/TwVnTsVq?= =?us-ascii?Q?QKIFP7cDR0N/ialN96GGrfOql+bhCPE/GHNlygUPJ2WDntn+bns2+LvnbZjv?= =?us-ascii?Q?wXraHwukYFasfUfor9D0eBeAwyuRbBiF1KHl6xUjdQhh0nVD24j12U6D0O48?= =?us-ascii?Q?lwFiIHI5MSAVnSz/1g23e72My948RpIWqHfuwJLSsl8rVEdQCjlKAlVK0nns?= =?us-ascii?Q?hegmMnsnAK00aojVsDaPTnEzgPG0482Wft4JGnmA92IoE1XQORA+CMc1PiAz?= =?us-ascii?Q?h8/F95bskvqoSzss2tVefIPzUhaTJtGz/Rbf3UJU041?= X-Microsoft-Antispam-Message-Info: LqLDS/NMfs3K27MBZ23VmWo67XGjf+NAWiMxcO/i/VHNiWai0seuJiCn+jZO3cMb8OVO8Bm1/Dp95tZJ2DXLU2sNrCaftrQv2RPYaU5h9BPOBWYQKesZfT6TDfDkymeC2JfB0NiGV18+X1QAtcQeAoCfEiQkEIqjuOBzv+sfSTG4OETG3+zMWjRUzudDUlah X-Microsoft-Exchange-Diagnostics: 1;BN3PR07MB2499;6:WWpDG3N5eo1wYyfr7nl6mUVrd7jCgiqPSOW2qjM6A0AM4UwpbBXKSWytLhdV8k7M1UYjory8/zswA06fPAzOzlDnL1mxwIjSxO8ICKuglKz2cbnU7kir6zznvePwvhCb0R48Q1EObJ4tsek0QYKmsqxO7S4/oTotm7UxqHJZc74ZmY5s3sTKaUV5GmnI9jhVVHTWvZIaVVW61G65F5qpGeUUEds9kgxSvy/UPy4SAWgo1N9/1cvwPfksR6W/oYchDQ65wzUTFi7xMhKvM7V4aXNVa9rhzP3/LQE7OjK3gR94xFPzwVEaXQVune7xbRUS8mcauqVi+Qw3QsHt+JwOq673pnhHB92c5jrCQbrP04tVDGYVjToMx97hltBgHMjjP0eqTzB9Hs4hFMWNVrw0bck5/ZPvSDsb8++3TvzERNu0WGUjvm89t1UuS8r1je/VBuWa95rA+XHs0P13h37Y4w==;5:JZMBUB0mkNx6MBS7bM12eEUdhp+m6bEELneFQ88s6dwt2+ThEmuFAuzSSTYc9cM6iFfoIdVSmdp8xVlm80/RSToxnQq6g+GaA/bXAMb2RlXrAWxVqR/q76R70Xg9HQ2L54Vy5f3bLgeHA8N47oQ/9UYbI89o2HIIvGdPRdVrEPo=;24:+Nz+kdOlCstTwx/uSYyFJaLBTaQjgG9WlhgB4Kxx5R3GhVzYgXZU/5/zPwlRfgetPfT2DDx7NxFgv4Vim5hSR7M44Zdnvo4tK1tdsgjwAFk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN3PR07MB2499;7:polqFEnDONg5K5+i9fQmOWM8tZL9ExIunBFnc6qy9UMjvAXIXKHfqj7umGgcEvx8KkKfuwA77eLC2l+tYu46jVFQZB7FapEH5CYJ0QH8ECOfCJc6ZTON06TgF30AinY2jv+e3eCGgmFT6rRmpFV5dLnpGIp5tVSL1DDjqXnCbq6bs1y4u+amnvcyR96bRNOu/feQvRTRFqNTcQgiWpk6dJTKOYobXqPVoXFkM9DUC8SizYNpxzRDZrlZIlngUycC X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2018 08:40:26.7771 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20985de9-2e5e-427f-56c5-08d59ad0e208 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2499 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 28, 2018 at 03:05:56PM +0200, Jan Glauber wrote: > Enabling virtual mapped kernel stacks breaks the thunderx_zip > driver. On compression or decompression the executing CPU hangs > in an endless loop. The reason for this is the usage of __pa > by the driver which does no longer work for an address that is > not part of the 1:1 mapping. > > The zip driver allocates a result struct on the stack and needs > to tell the hardware the physical address within this struct > that is used to signal the completion of the request. > > As the hardware gets the wrong address after the broken __pa > conversion it writes to an arbitrary address. The zip driver then > waits forever for the completion byte to contain a non-zero value. > > Allocating the result struct from 1:1 mapped memory resolves this > bug. Hi Herbert, Just realized that we might sleep in this path, so GFP_KERNEL wont work here. Same with usleep in the second patch. I'll respin the patches. --Jan > Signed-off-by: Jan Glauber > Reviewed-by: Robert Richter > Cc: stable # 4.14 > --- > drivers/crypto/cavium/zip/zip_crypto.c | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) > > diff --git a/drivers/crypto/cavium/zip/zip_crypto.c b/drivers/crypto/cavium/zip/zip_crypto.c > index 8df4d26..2fc9b03 100644 > --- a/drivers/crypto/cavium/zip/zip_crypto.c > +++ b/drivers/crypto/cavium/zip/zip_crypto.c > @@ -124,7 +124,7 @@ int zip_compress(const u8 *src, unsigned int slen, > struct zip_kernel_ctx *zip_ctx) > { > struct zip_operation *zip_ops = NULL; > - struct zip_state zip_state; > + struct zip_state *zip_state; > struct zip_device *zip = NULL; > int ret; > > @@ -135,20 +135,23 @@ int zip_compress(const u8 *src, unsigned int slen, > if (!zip) > return -ENODEV; > > - memset(&zip_state, 0, sizeof(struct zip_state)); > + zip_state = kzalloc(sizeof(*zip_state), GFP_KERNEL); > + if (!zip_state) > + return -ENOMEM; > + > zip_ops = &zip_ctx->zip_comp; > > zip_ops->input_len = slen; > zip_ops->output_len = *dlen; > memcpy(zip_ops->input, src, slen); > > - ret = zip_deflate(zip_ops, &zip_state, zip); > + ret = zip_deflate(zip_ops, zip_state, zip); > > if (!ret) { > *dlen = zip_ops->output_len; > memcpy(dst, zip_ops->output, *dlen); > } > - > + kfree(zip_state); > return ret; > } > > @@ -157,7 +160,7 @@ int zip_decompress(const u8 *src, unsigned int slen, > struct zip_kernel_ctx *zip_ctx) > { > struct zip_operation *zip_ops = NULL; > - struct zip_state zip_state; > + struct zip_state *zip_state; > struct zip_device *zip = NULL; > int ret; > > @@ -168,7 +171,10 @@ int zip_decompress(const u8 *src, unsigned int slen, > if (!zip) > return -ENODEV; > > - memset(&zip_state, 0, sizeof(struct zip_state)); > + zip_state = kzalloc(sizeof(*zip_state), GFP_KERNEL); > + if (!zip_state) > + return -ENOMEM; > + > zip_ops = &zip_ctx->zip_decomp; > memcpy(zip_ops->input, src, slen); > > @@ -179,13 +185,13 @@ int zip_decompress(const u8 *src, unsigned int slen, > zip_ops->input_len = slen; > zip_ops->output_len = *dlen; > > - ret = zip_inflate(zip_ops, &zip_state, zip); > + ret = zip_inflate(zip_ops, zip_state, zip); > > if (!ret) { > *dlen = zip_ops->output_len; > memcpy(dst, zip_ops->output, *dlen); > } > - > + kfree(zip_state); > return ret; > } > > -- > 2.7.4